April 30th, 2008 @ 20:34

It’s not just about living forever, Jackie. It’s about living with yourself forever.

At World’s End

April 20th, 2008 @ 22:40

The board is set, the pieces are moving, we come to it at last…

Examinations are starting on Wednesday 23rd, and will end on May 26th around 6:30pm. 115 hours (114 and a half, to be accurate) of exams :( See you next month, world!

April 13th, 2008 @ 08:45

For a project of mine (involving LEJOS-OSEK, mostly), I’m forced (well, almost) to use Windows, which my dear VirtualBox virtualizes fairly well on my clean Linux host. I obviously setup vim for my coding needs, but its default behavior isn’t quite what we are used to on other platforms. For instance visual mode selection with arrows requires you to hold Shift, while it doesn’t elsewhere and backup files are created upon write.

So, let’s edit the .vimrc file, which actually is at VIM_INSTALL_PATH\_vimrc (for instance C:\Program Files\vim\_vimrc with the default install options).
Disabling backup files is as simple as adding

set nobackup

Getting visual mode arrows selection is a bit different, as explained in vim tip 864 comments, you can either add

set keymodel-=stopsel

around the end of the file
or drop the

behave mswin

line from the default vimrc.

Here are two other (non windows-specific) tips:
Bash like filename completion:

set wildmode=longest:full
set wildmenu

Pythonic smart indent:

autocmd BufRead *.py set ai et ts=4 sw=4 sts=4
autocmd FileType python set ai et ts=4 sw=4 sts=4
autocmd BufRead *.pyx set ai et ts=4 sw=4 sts=4
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class

See also this pretty Tango color scheme for vim.

April 12th, 2008 @ 08:35

I love them all. This movie is really great.

What we do in life echoes in eternity.

Death smiles at us all. All a man can do is smile back.

We mortals are but shadows and dust.

There was a dream that was Rome. It shall be realized.

Is Rome worth one good man’s life? We believed it once. Make us believe it again. He was a soldier of Rome. Honor him.

Last but not least, the last lines of the movie:

And now we are Free. I will see you again… but not yet… Not yet!

French ones:

Ce que l’on fait dans sa vie résonne dans l’éternité.

La Mort nous sourit à tous, nous tout ce qu’on peut faire c’est sourire à la Mort.

Nous mortels ne sommes qu’ombre et poussière.

Il y avait un rêve qui s’appelait Rome. Il doit être réalisé.

Est-ce que Rome vaut la vie d’un homme de bien ? Nous l’avons cru autrefois. Il faut le croire à nouveau. Il était un soldat de Rome. Honorez-le.

Maintenant nous sommes libres. Nous nous reverrons… Mais pas encore… Pas encore!

April 12th, 2008 @ 08:24

Ever heard of Gogh? This is a really nice drawing tool for graphic tablets owner (such as those by Wacom). However it stopped working on my Hardy system after some recent update. After some investigation, it appeared that it was due to python-xml being moved away of Python path because it interfered with stuff in Python core ; the whole python-xml package being scheduled for deprecation as soon as the reverse depends would be cleared. I figured it out and dropped the reference to python-xml package in gogh/settingsmanager.py, using a method provided by Python core xml stuff instead. It seems that quite a bunch of people are currently using xml.doc.ext.PrettyPrint from pyxml to output an XML document to a file, so I figured that posting this little tip might help someone :)

So, let’s say you currently have something like this to output your xml document “doc” to a file at path “path”, doc being an xml.dom.minidom.Document object (or similar):

        f = open(path, "w")
        xml.dom.ext.PrettyPrint(doc, f)

All you need to change is PrettyPrint call to make use of the .toxml() method of your document object instead:

        f = open(path, "w")

Here you go, hope this might save someone’s day someday :)

April 11th, 2008 @ 18:07

Have you ever mistakenly shut down or rebooted your operation-critical server while you were willing to halt your desktop computer through ssh before going to bed, or anything like this? If so, and if you are on Debian/Ubuntu, molly-guard is designed for you: this nifty bash script gets between you and the shutdown/reboot/halt tools, checking if you are connecting through ssh and if so asking for the hostname of the machine before proceeding.

Wondering how it looks? Here is the output of a little test:

ixce@timmy:~$ sudo shutdown -r
W: molly-guard: SSH session detected!
Please type in hostname of the machine to shutdown: 
Good thing I asked; I won't shutdown timmy ...

Since it doesn’t correctly handle sudo yet (actually sudo is at fault here, since it drops SSH_CONNECTION environment variable when doing its stuff), you might want to add PRETEND_SSH around the beginning of /usr/sbin/shutdown as specified on Nico “nion” Golde’s blog.

You might also want to grab the molly-guard 0.3.2 etch package I backported from sid (all I changed is downgrade debhelper build-dep version and debhelper compatibility level in debian/compat since etch only has debhelper 5 and the sid package required debhelper 6 ; this shouldn’t break anything since the newer debhelper just seems to be needed to recognize a few fields in debian/control about where the package is maintained). Sources are also available, anyway.

Thanks hr for the tip :)

April 8th, 2008 @ 22:46

This one is really interresting and raises a lot of questions. Did you know…


See also Did you know 2.0, an updated (with facts which were up to date in June 2007) and redesigned version of this video.

I acknowledge these videos are quite old and famous, but I couldn’t help posting them here, sorry.

April 6th, 2008 @ 22:03

Building dynamic forms with Django newforms module is quite undocumented, though it’s quite easy to do. All you need to do is to hook up the __init__ function of the form, raise the __init__ to the parent forms.Form class and then add your dynamically generated fields to self.fields dict.

Here is a quick snippet demonstrating it, which will create a form with n integer fields named from 0 to (n – 1), but you will easily be able to heavily extend it.

from django import newforms as forms
class MyForm (forms.Form):
    def __init__ (self, n, *args, **kwargs):
        forms.Form.__init__ (self, *args, **kwargs)
        for i in range (0, n):
            field = forms.IntegerField (label = "%d" % i, required = True,
                                        min_value = 0, max_value = 200)
            self.fields["%d" % i] = field
April 3rd, 2008 @ 23:26

Compiz Fusion Logo
We have just released Compiz Fusion 0.7.4, based on Compiz 0.7.4. This is a new development release, featuring a good bunch of bugfixes and a new plugin providing bicubic filtering through shaders.

The official announcement is available in Compiz Fusion Community list archives.

March 31st, 2008 @ 23:00

Bah, it took so much time to get them, while it was just a matter of finding one or two dozens of hours to make them all :)

Well, I’m too lazy to do any screenshot now, so just check them out by yourselves :)