Treeview conclusions

It looks like you guys are interested in loading three million rows in a GtkTreeView. Yesterday 512 (new) visitors visited our company subversion service to checkout the demo :-p. I think +- 100 people checked it out completely (the less obvious files, like Makefile.am’s, got viewed +- 90 times). That tops codegen‘s first day. Well, you can now put comments on my blog. So if you have questions about it: go ahead.

Note that I updated some files in the repository. Now it’s using a more correct way of implementing interfaces in C. The usage of the proxy pattern, thus implementing an interface, is actually the point of the demo. Sure is the wow cool thing about it that you can load millions of rows in a view. But the point is the proxy pattern. So it should be correct, if the intention is to ‘show’ how to do it. Right? Note that the proxy technique can be used in all sorts of model view controller situations. Not just for a treeview or datagrid.

In that demo, I should also do more with the proxy classes to show that you can treat them as if they are real subjects. That’s because they fulfill the contract (the interface) of the subject (a message header, in the case of the demo). Yet these proxy instances consume only 20 bytes. By the way, my favorite programming technique is strategy (I promised somebody not to use the word design pattern anymore. He felt design pattern is a buzzword). I’m likely going to do/show something with strategy sooner or later :-p. When browsing free software code, I often see “less good” designs decisions. Performance tweaking is very good but it wont help if the application developers aren’t going to use their brains before designing the application. The era of typical VB6 development should be over. A lot ‘managers’ should stop whining about KISS and first learn what it really means. KISS, like the KISS most people think KISS is, sucks. It doesn’t scale and it’s impossible to integrate unit testing and modern programming methods with it. The other KISS is a different story. Read Head First, Design Patterns and learn all about it. There, I’ve said it.

As a consultant I guess I got tired of manager-type guys who don’t have a clue, telling me to do everything KISS. Perhaps those guys should read about Peter Principle?! Sorry for this opinionated entry. I know I shouldn’t.

Auwch, I made a big mistake:

$ svn diff -r 14
Index: src/msg-header-proxy.c
=============================================================
--- src/msg-header-proxy.c      (revision 14)
+++ src/msg-header-proxy.c      (working copy)
@@ -76,7 +76,7 @@
 MsgHeaderProxy**
 msg_header_proxy_new_alot (gint amount)
 {
-       MsgHeaderProxy **proxies = (MsgHeaderProxy **) g_new (MsgHeaderProxy, amount);
+       MsgHeaderProxy **proxies = (MsgHeaderProxy **) g_new (MsgHeaderProxy*, amount);
        gint i=0;

        for (i=0; i < amount; i++)
$

Wow .. that would have been a total waste of memory AND a huge leak! Note that doing one huge allocation in stead of one allocation of a pointer-index-table followed by many g_slice_alloc, might improve the cpu usage a little bit (less expensive malloc syscalls). So perhaps it can be made even a little bit faster than the current result. Try it, send me a diff.

Migrated to wordpress

Some people might have noticed on the blog aggregators that yesterday, I’ve switched from DotClear to WordPress. I guess the reason some blog aggregators repeat old blog entries is because they compare cache. And after a migration, for example the unique IDs are often different. So no, there’s nothing wrong with my blog :-p!

I also installed a RewriteRule in such a way that most old blog url’s will resolve to the new WordPress URL. I can’t make all of them work automatically because DotClear and WordPress use a different algorithm for forming the title-part of the URL (called the post slug). But most work. You can tell me if a specific “old” URL isn’t working. WordPress allows me to set the “post slug” manually. I can easily set it to the old slug or in such a way that my redirector stuff resolves it correctly.

Oh, and somebody tell the DotClear developers to get themselves a real anti-spam feature. Perhaps a captcha or something like that? For my case it’s to late: goodbye DotClear.

I’m probably going to regret it, but after installing bad-behaviour on both my wiki and my blog and on the blog also Akismet, I re-enabled editing the wiki and posting comments on the blog. As I weed through thousands of moderated spam messages in my old blogs database, I’ll try to recover the relevant comments and restore them in the WordPress database of my new WordPress blog.

Some code that might help you migrate DotClear to WordPress: