Older blog entries for wingo (starting at number 102)

unsolicited shill

A couple of interesting kernel pages on this week's LWN. Wow. In my limited experience, I've never seen programming journalism as consistently well-written as LWN. Keep it up, folks.

G_GNUC_CONST

GTK+ has a dynamic type system whereby type id's are assigned at runtime, but don't change over the course of the execution of the program. The idiomatic way to do this is with a get_type functions:

/* in the header */
GType foo_get_type(void) G_GNUC_CONST;

/* implementation */ GType foo_get_type(void) { static GType type = 0; if (type == 0) type = register_type(...); return type; }

Here, the G_GNUC_CONST means that the function will always return the same value, so if it is called three times in a block of code, the compiler is free to call it only once and use the same result later on.

That's what we thought it meant, anyway. When working on the 0.9 branch of GStreamer, Wim was seeing some warnings about registering types twice, which means that two threads were calling uninitialized get_type functions at the same time. But, we had explicitly made sure to call these objects' get_type functions before starting threads, so that the static variables would be initialized:

static void
init_types (void)
{
    /* called from the main thread, before others are created */
    foo_get_type();
    ...
}

What had happened was that the compiler optimized away the only call to foo_get_type in the initializing function because the return value was not used. An __attribute__((const)) function not only returns a constant value, but its output is solely determined by its arguments; it is not even allowed to look at global memory. pure functions (G_GNUC_PURE) are allowed to look at global memory, but can't modify it (i.e., can't have side effects). Since what we wanted was the side effect of registering the type, neither const nor pure was appropriate. Removing the attribute solved the problem.

Moral of the story: don't count your chickens before they hatch, if your chickens are in fact const or pure functions and you're using gcc mumble mumble mumble.

holiday

Just got back from a most rocking vacation.

And lest he complain, here's a photo of Christian DOMINATING the slopes:

Eight days of snowboarding in the French Alps, yo. That's straight-up bourgeois of us. Fun though. I considered prolonging the experience by seducing some millionaire sugar mama, but my solidarity with the proletariat kept me back. And so it's back to work on Monday. Hope my fellow proles appreciate it.

notes from out of the womb: a naval harvest

I first left the states when I was 18. In the 7 years since then I've slept in about a dozen countries, lived in two, and spent more time out of the U.S. than in. Now I find myself in Barcelona. Not a bad place to find one's self. They tell me it's even better in the summer.

I thought, though, that this would be an easier adjustment to make than my previous ones, because I had already learned (castilian) spanish, had been in spain before, but mainly because I had already undergone this process before. That was the expectation, anyway -- just to drop right in, start functioning like a normal person-in-society.

It's a fallacious expectation of course. Anyone who's gone back home from a long stay abroad will recognize it, as it pertains to home itself. The typical example is returning home, expecting to pick up where you left off, but coming to find that neither your friends nor you yourself are the same people as before. But home does provide something of comfort, no matter how much (or little) places and people have changed in the meantime.

Which brings me back to this stressed-out feeling I've been having recently -- I think it's from not seeing Americans at all! In Salamanca I had the other students to support me, in Namibia I had the other peace corps volunteers, but here I haven't really interacted with any compatriots. Yes, the best thing to do is to integrate with people where you are, but it's so nice to share culture.

looking outward

A lot of times when travelling I feel like I'm deaf-mute or something. I can walk the streets of Oaxaca or somewhere, looking at things, maybe buying something or other, venturing into bars or such, but still without the feeling of being there. It's like there's a conversation I'm not a part of, a whole set of memes and motivations lying beneath surface effects that I have no idea about. What's going on. Qué pasa. Oshike tashi ningwa. Maybe I need to consume more media.

khack

(As in the singer, khaled)

iInteresting things that I'd like to work on, given time:

Profiling tools: learning more about what's there, developing better analysis tools, cross-language profiling (guile-c and python-c).

Thesis: a profiling platform should have two interfaces: one to activate and disactivate the profiling from within the program being profiled, and one to run a program from the shell with profiling.

It would be very interesting to make a real-time profile analyzer. However in the things I've profiled, and the profilers I've hacked on (qprof and guile's statprof), the analysis typically takes as much time as running the program.

Applications of continuations to GUI programming, both first-class continuations as in scheme and cheap ones like python. Continuation-passing style in GUI apps.

Looking at Gazpacho and seeing what they're up to. It seems to me that writing GUIs really really sucks, and that no one knows a good way to write one.

ESR says that you should learn lisp, that it will make you a better programmer. For me it just made me irritating to be around. "Yes, but in lisp, you just but a parenthesis here and here, and then the program writes itself!" is not very intelligible to pychecker.

Christian Schaller has an active imagination. That is all.

13 Feb 2005 (updated 13 Feb 2005 at 14:06 UTC) »

I am pleased to report that I have indeed spent two weeks in the same bed. That is more than twice what I was able to manage in the two months preceding this momentous accomplishment.

Other newsies:

Aikido

I missed Aikido a lot when I was in Namibia, so a couple weeks after getting here I joined up with a local dojo (warning, flash-heavy site). There are two chief instructors, both 4th degree black belts, students of Yamada Sensei in New York. The style is very similar to what was taught at my old dojo back in the states.

I am having a bit of a hard time figuring out who I should listen to in the dojo, though. In the states, the only ones to wear hakamas (the funny divided skirts) were black belts and the couple ranks below that. It was clear who knew what was going on. Here, though, they don't have pre-black-belt ranks, which is fine, but the custom is for any student that's been with the dojo for a year or two to wear the hakama. Although I am a bit rusty, I have more experience than that, but as I'm not from here I don't wear the hakama. It's a double problem: they think I'm new, and so think I need a lot of talk, and I can't tell who's worth listening to. I need help, but not from someone with the same experience as me.

Other than that, it is interesting to have two chief instructors, and of different genders as well. Yamada Sensei is coming this weekend from the states for a seminar, too. I'd like to attend at least a class or two -- we'll see how it works out.

Work

Work is going well. I get to hack a lot of python, which is fun, and I also get to mix it up sometimes with C, when GStreamer needs some work. It's fun to hack on Wim's branch of GStreamer, too -- it's well thought out. And having hackers in the room with you to discuss ideas is just grand. I do wish they would keep their colds to themselves though.

Home

Finally settled in to the new house. I went to Furniture McDonald's (otherwise known as Ikea) to fill my room with sleek scandinavian furniture. I end up hanging out a bit with the roommates, which is nice. They're good folk. Dancers from South America. Yow.

Hackin

Other than work, I haven't done anything. Perhaps that will change now that I have a place to do it, and now that we've rigged up a wireless network in the house that sucks off the neighbor's connection. Leechin. Until Telefónica gets their act together, anyway.

It seems that Belgian law allows the export of mislabeled products. They produce something labeled “beer", but with the strength of wine.

In related news, I went out last night with the work krew to a bar catalán-belga. I think I’m still a bit tipsy.

8 Jan 2005 (updated 8 Jan 2005 at 19:26 UTC) »
travels

I’m a tourist in my own country now. Well, not really – I’m mostly visiting friends rather than places – but I still haven’t slept in the same place for a week straight. Here are a few photos:

computers

I got a new hard drive for my old laptop and installed Ubuntu on it. The brown is surprisingly nice, and the Applications / Places / System menus seem well-thought out. I went ahead and upgraded to Hoary. No problems here. To me, it’s just debian with better gnome support.

I’m trying out bazaar as well. Arch is an interesting phenomenon – you have a number of smart, strong-minded folks exploring the revision control problem space, with tensions from the different directions (GNU, Tom Lord, Bazaar, PyArch..), but united in their fundamental approach. I find it fascinating that these competing efforts can share a mailing list and an irc channel.

Bazaar does seem to provide some usability improvements over tla. I’m happy with it for now, and since it interoperates with tla-format archives, I imagine I’ll use it in the future as well.

I started using hard-linked revision libraries with baz/tla (both greedy and sparse). I ran into some problems at first, because I had emacs set to not make backup files. Because the revision library and the working copy point to the same inode, editing the working copy affects the “pristine” source as well.

The solution to the problem is to turn on backup files, of course. Because I don’t like lots of ~ files cluttering up my work space, I set the backups to go to ~/.backups/ with this .emacs snippet:

(custom-set-variables
 ; just copy the two lines below into the custom-set-variables block
 '(backup-directory-alist (quote ((".*" . "~/.backups"))))
 '(make-backup-files t)
)

This means that before emacs writes your file, it moves the old copy to ~/.backups. Thus the original inode is not affected, and the revision library keeps its integrity. If you mess up somehow, arch will know anyway – you just have to remove the revision from your library. The next time you need it, arch will make a fresh copy.

Advogato’s RSS export only takes you about 10 entries back. If you want older ones, you’ll need to scrape them from the web, or otherwise use the XML-RPC interface.

I was going to do this manually, but there were too many entries, and I hadn’t hacked anything for a few weeks, so instead I took the opportunity to write an Advogato importer for wordpress. Just grab it, drop it in the wp-admin dir, point your browser to blogurl/wp-admin/import-advogato.php, and follow the directions.

While doing this I proved myself to be a moron.

30 Dec 2004 (updated 30 Dec 2004 at 03:40 UTC) »

Er... I'm dumb. While importing older advo entries into my wordpress setup, I managed to repost them on advogato. I swore I turned that damn thing off!

Move along, nothing to see...

30 Dec 2004 (updated 30 Dec 2004 at 03:40 UTC) »
30 Dec 2004 (updated 30 Dec 2004 at 03:41 UTC) »

93 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!