27 May 2005 ncm   » (Master)

It would be hard to gauge how much damage John Lakos's book, "Large-Scale C++ Software Design" has done. When I reviewed the manuscript for A-W, lo those many years ago, I pointed out some of the problems; I didn't find any fixed when it came out. It was badly out of date then, moreso today. It might better be titled, "Build Enormous Hairballs with 1987 AT&T Cfront". There's a whole Antipattern devoted to this style of development. (The first bit of bad advice I recall was: Around each #include directive, put a #if/#endif to check if it has been included before, so the compiler doesn't have to read it again. Of course all normal headers already have that in them, and compilers have long since learned not to bother opening and re-reading those.)

He runs on about flattening and whatnot, but offers no hint that the language positively teems with facilities to make all that stuff moot. The manuscript I saw didn't mention "template", never mind "smart pointer" or "reference-counted value class", anywhere.

If you observe ordinary sound engineering principles, none of the problems he is trying to solve, using such desperate measures, even appear. Sound principles? Try splitting your enormous program up into separate, independently testable libraries. Try splitting your truly enormous system up into separate, independently testable programs communicating via pipes or sockets with stable, human-readable communication formats, or files (likewise), or even a database (gods help us). I could go on.

Got my Compaq Armada E500 laptop suspending to RAM via ACPI. It was a lot of work. I started out looking for a package called "pmtools" (not the Perl thing) which wasn't in any of the normal places (e.g. its page on sf.net). I found one, but not before building something I downloaded from Intel called "acpica". To build it I had to edit buggy source. It included a program to copy the ACPI "dsdt" table out of the BIOS, and to decompile it to ".dsl" source, and to compile that to a C array- initialization statement. It reported errors in the .dsl source (originating in Compaq's table), which I had to figure out and fix, first. I had to tell my kernel config that it should not be "STANDALONE", to use "CUSTOM_DSDT" C code and where to find it, to use ACPI, and to sleep etc., and to expose a /proc/acpi/sleep fake file system.

Build, install, reboot. Install "hibernate". Experiment with uninstalling modules. Find a GNOME daemon has the sound driver open, unused. Debian bug tracking says that's fixed somewhere in capplet and/or gstreamer. Upgrade capplets, purge a lot of old 0.6 gstreamer stuff, upgrade the 0.8 stuff (which, on Debian, don't assert complete dependencies; so update all the libs, besides). Edit hibernate.conf, and while there add programs it should kill, such as mixer panels and VoIP phones, so it can unload the sound module. Add sound module (snd_es1968, which I don't trust) to blacklisted-modules so it will unload them first. Try it... it can't kill the VoIP program. Close that by hand. Now it works! Congratulations and thanks to everybody who made this stuff work at all.

My Gstreamer problems might be over too, now that all the libraries that the useful bits depend on match. Reluctant to try it, though... OK, upgrade Rhythmbox. Run it. It pops up a box "Have you run gst-register?". (Well, no. Why didn't dpkg run it?) Here's a "gst-register-0.8". Run that. Run Rhythmbox again. Poke a song to play. It says, "Could not create audio output element; check your settings." Hmm, nothing in "preferences", nothing in "properties". "Help" doesn't work. Nothing in Gnome Control Center.

Hmm, how about Totem? "Totem could not startup[sic]. No reason." (No kidding.) Stderr output says "libhal.c 2282 : Error sending msg: Service 'org.freedesktop.Hal' does not exist", whatever that is, and "No GConf default audio sink key and osssink doesn't work". OK, let's run gconf-editor, and look in, hmm, system/gstreamer/0.8/default. Aha, it thinks I have OSS. Fix that. Fix the default while I'm at it. Now Totem starts up, plays music: 4 seconds on, 2 seconds silent, 4 on again, etc. Turn off "visual effects"; no help. Hmm. Try Rhythmbox again. Hey, it mostly works now! That wasn't so hard, was it?

[Update: The Gnome control panel thing (under "Advanced") to choose where Rhythmbox will send its output is stashed away in a "gnome-media" package, which nothing installed admits to depending on. Also, Rhythmbox skips every minute or three, which xmms has never done.]

[Update 2: No, it still can't play the Firefox flash ad.]

Congratulations to everybody who worked so hard on that Nokia gadget. Maybe I'll have to get one.

Latest blog entries     Older blog 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!