Ikke's Blog

May 8
Development-related presentations using Git

Yesterday I had to give some introduction presentation on Django, a Python-based web-application development framework (really cool, if you don't know it yet, take a look!).
The goal was to build some simple blog-like application during the presentation to give the audience an overview of the framework and some of it's basic capabilities (whilst still hand-coding everything, not using newforms/generic views/..., providing pointers to these great features though).

Obviously, at several points of the presentation, you got to show some example code. As most of the time you work on one source file during several stages of the presentation, you don't want to show the end file from the beginning, you want to incrementally add code.

There are some obvious ways to do this:

  • Type everything by hand at every stage
  • Have a source tree for each state in different directories
  • Give files a special name, like blog/models.py_slide19

These "solutions" got several problems though:

  • The first one is slow, error-prone and boring for the public
  • The second one is acceptable but uses a lot of diskspace
  • The last one is not acceptable as (in this case) because of the "wrong" filenames, you won't be able to run the django development server at the separate stages of development

The way I did it: put the code of your first slide in a (local) Git repository, create a new branch whenever you change code, check-out the branch, change the code and commit. Then when the presentation starts, git-check-out master, then everytime you're at a slide where you changed some code, git-check-out (name of the branch for this slide). I used "slideXX" as branch names, using just 1, 2, 3 etc might be better as my schema'd break if I had inserted a slide somewhere.

Really quick and easy to work this way!

Apr 28
How to fix your ACPI buttons, the hackish way

Some time ago my ACPI-driven laptop keyboard buttons (volume control, music player controls,...) stopped working. I'm using the acpi-support package (although not running a Debian derivate) driven by acpid.
Today I decided I wanted my buttons back, so I started to find out what was going wrong.

The issue: acpi_fakekey checks all /dev/input/eventX devices whether or not it's a keyboard device, and if it finds one, it writes the necessary scancode to this device. Since some recent kernel, /dev/input/event0 is no longer my AT keyboard, but one of these ACPI buttons, so writing scancodes to the device won't work: my X server keyboard driver won't see them.

/proc/bus/input/devices told me I need event4 (or use this command: hal-get-property --udi `hal-find-by-capability --capability input | grep KBD` --key input.device | sed "s:/dev/input/event::g"
). Patching acpi_fakekey.c is pretty trivial:

--- acpi-support-0.94/acpi_fakekey.c.orig       2007-04-28 18:09:37.078953488 +0200
+++ acpi-support-0.94/acpi_fakekey.c    2007-04-28 18:09:49.578470914 +0200
@@ -13,7 +13,7 @@
         char filename[32];
         char key_bitmask[(KEY_MAX + 7) / 8];
 
-        for (i=0; i<32; i++) {
+        for (i=4; i<32; i++) {
                 snprintf(filename,sizeof(filename), "/dev/input/event%d", i);
 
                 fd = open(filename, O_RDWR);

Replace the 4 with the correct number on your system.

Now my buttons "work" again. Patching acpi_fakekey so it uses HAL to figure out the correct device to write to might be somewhat more reasonable though :-)

Apr 15
About the lack of Java-style interfaces in Python

Just had some discussion about OO concepts, abstract classes and interfaces in Java and Python in #gnome-nl. I still dislike the fact Python and other interpreted languages got no enforced interface implementation support.

A little comparison (not meant to be disrespectful againt anyone):
When you're living in a Java world, you can go out on friday night, meet some person implementing the Girl interface, invite her at your place and have some fun (you know ;-)).

When you're Python, you might go out on friday night, meet some person who tells you "it" implements the Girl interface and at a first sight does so, as get_voice_timbre returns "girl" and has_boobs returns true. Then you take the person home, to your bedroom, and find out, well, it's a shemale.

Got the picture? :-)

Anyway... SoC news will follow later on!

Apr 3
Quote of the day

A quote from the weblog of Bruno Segers, former topman at Microsoft Belgium:

Eerst en vooral laten we nu reacties toe. De vrees dat de bijna religieuze anti-Microsoft lobby mijn blog als hun ‘Uitlaat’ rubriek zou gebruiken is immers niet meer aanwezig. We blijven met Windows Live Spaces werken maar vanaf nu is commentaar mogelijk. Bruno goes open source !

In english:

First and foremost, we allow comments now. The fear an almost religious anti-Microsoft lobby will use my blog to show their dissatisfaction *(somewhat bad translation, I know)* is gone. We continue using Windows Live Spaces but from now on writing reactions is possible. Bruno goes open source !

So enabling comments in a blog is "going open source". Hmm... I'd figure people who used to be at top positions inside Microsoft would at least *know* what Free/Open Source is all about. Looks like I've been somewhat naive.

Via Kris.

Apr 2
Summer of code

Application deadline for Google's Summer of Code 2007 is already some time behind us. Might be interesting to provide a list of proposals I submitted, maybe some other people might pick up a project ;-)

I submitted 3 of them:
- GNOME: HID handling
Basicly, integration of XInputHotplug in the desktop, including per-device settings, and better Bluetooth mouse/keyboard handling (if possible without any command line magic etc.). Enhancing multimedia key support (especially ACPI-based) was a subproject too.
- Django: Row-level permissions
Title says it all. A pretty important project for the Django community.
- Gaim: Porting the Bonjour protocol module to Avahi, and enhance it's functionality
Bonjour-based IM (iChat) is pretty cool and should be (ab)used more. libhowl isn't so nice though as we got the Avahi guys providing us a completely free, glib-integrated mdns/dns-sd stack.

That's about it... I do hope at least one of them gets selected :-) All projects do deserve some love though, that's for sure.

Anyway, while waiting, I'm going to implement some little gimmick panel applet, more about that one later... Still doubting whether to take the Mono/C# or Python road.

<< Previous Page :: Next Page >>

Categories

Who's Online?

  • Guest Users: 430

Misc

XML Feeds

What is RSS?