Saturday, July 23, 2011

Give my luck back, Firefox 5!

Today I've upgraded to firefox 5, special thanks to Debian developer for packaging it. So far, everything works well and better than before, except two things (one of which I managed to tweak):
  1. The tabs bar is higher than before. This means that the mouse must move more to reach them. This has been solved. Thanks for allowing me to put the tabs bar below back again.
  2. The address bar no more involves "I feel lucky" search. The feature was awesome, because I often write a partial website name and I get most of the time to the right page without actually typing the whole name. Also, since we already have a search bar on the top-right, why was this feature removed? It's kind of duplicated now.
So, dear readers, do you know of any add-on so that I can have "I feel lucky" search back, before I write one? Having it on the top-right bar is good as well.

Edit: The solution is to open about:config and set the keyword.URL value to "" (without quotes). Thanks to Giuseppe for the hint.

Saturday, July 09, 2011

Python/Ruby like generators in Vala

the post below is copied straight from here.

Here I'll show a cool snippet code making use Vala async functions and iterators for emulating Python/Ruby generators. Creating a generator is as simple as extending the Generator class and implementing the generate() method.

abstract class Generator {
    private bool consumed;
    private G value;
    private SourceFunc callback;

    public Generator () {
        helper ();

    private async void helper () {
        yield generate ();
        consumed = true;

    protected abstract async void generate ();

    protected async void feed (G value) {
        this.value = value;
        this.callback = feed.callback;

    public bool next () {
        return !consumed;

    public G get () {
        var result = value;
        callback ();
        return result;

    public Generator<G> iterator () {
        return this;

class IntGenerator : Generator<int> {
    protected override async void generate () {
        for (int i=0; i < 10; i++) {
            yield feed (i);

void main () {
    var gen = new IntGenerator ();
    foreach (var i in gen) {
        message ("%d", i);

You can find the above code snippet here as well.

Tuesday, July 05, 2011

Why I'm still using Emacs

I'm using emacs since a long time by now. Everytime I ask myself why I'm using it, given emacs certainly isn't the easiest environment for programming. So, I often tried to replace emacs with other IDEs or editors, using several extensions and so on, but I still miss these killer features in a single editor:
  • Pressing a key (whatever it is, TAB in emacs) correctly/smartly indent the row according to the current language.
  • Split view, horizontal and vertical
  • No horizontal scrollbar, rather wrap the text
  • Opening/closing files without either opening a dialog or using the mouse
  • Search, search and replace (also with regexp variant) without opening any dialog
  • Switching between buffers using the longest-common-subsequence matching, without using the mouse (i.e. I don't care about file tabs, but about switching among them fast)
  • Indent entire code regions
  • Vala, C, Python, Java, Shell, Autoconf/Automake, Make and Javascript support

So, I'm not using emacs because I love it, but because it's actually the only editor with the above features.

What I'm looking for? I'm looking for a new editor/IDE, less complex, easier to customize, having the above features plus smart completion and symbol browser.
Emacs can have completion and symbol browser as well, but managing those buffers such as speedbar suck a little, things get complicated to use and to customize.

If anybody knows of such an editor, please let me know :)