2 Mar 2003 amars   » (Journeyer)

I ended up adapting my materialized path tree to use periods as separators and instead of bothering with sorting them with MySQL, i wrote a cmp_signatures function in PHP to pass to the usort function. It's not as elegant as i'd like it to have been, but it works reasonably well with as little obfuscation as possible. So, now i'm able to fetch all children of any given node with one query and sort them with one call to usort in order to produce an array of organized nodes.

I'm rather surprized that there isn't an equivalent to substr_count in MySQL. in order to effectively select all root children, i have to keep track of the depth of a node by counting the number of periods and storing that in a depth column. That way, i'm able to select all where depth=1 to fetch all root nodes.

Despite the otherwise empty apartment, i still felt the need to "go out" to get some work done so i could gather my thoughts. So, i'm in the student union now with my powerbook on wireless access. Having managed to solve a problem, i imagine i'll return to watch one of the DVDs i recently bought.

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!