The drop is always movingYou know that saying about standing on the shoulders of giants? Drupal is standing on a huge pile of midgetsAll content management systems suck, Drupal just happens to suck less.Popular open source software is more secure than unpopular open source software, because insecure software becomes unpopular fast. [That doesn't happen for proprietary software.]Drupal makes sandwiches happen.There is a module for that

Down with pseudo objects

Submitted by nk on Sun, 2007-07-22 20:00

Note: this is a reformatted repost of the original, I have my moved my blog and that entry was not in the dump. It needed a reformat anyways...

I had a node which stored user profile data and upon blocking said user I wanted to clean it up. A little bit later I will post the code -- for now let it suffice that I needed to use $profile->{$key}[0][$k] = ''; instead of $profile[$key][0][$k] = ''; . I consider myself a not-too bad PHP coder but this syntax took me quite some time to figure out.

The icing on the cake that is Drupal 6

Submitted by nk on Wed, 2007-07-04 15:58

Just today, two patches has been committed that has tremendeous importance: one, the AHAH patch by quicksketch was realizes the JS capability Eaton and I have put into form API 3. I spent ten days at the end of April in a Chicago motel just to work with Jeff on form API 3 and with this patch committed, I feel the invested money and time was worth it. Second, another form API enabler was committed which was originally written by me but I had so little time then that dopry submitted it to the queue so I am not even mentioned in the comit message. Credit issues aside, makes writing widgets so much more powerful and a bit easier. All in all, I am content with the form API we will have in six.

Drupal(.org) rules the world

Submitted by nk on Sun, 2007-07-01 16:42

Do you need proof? Less than four days after posting a short and polite request to chip in for my dream laptop, googling on Toshiba R500 reveals that my humble little chipin page on Toshiba R500 is the first! The reason? has such an insane high page rank that none can contend and everything linked from there -- in this case the planet jumps to the top of Google.

When you do not want to cache a few pages

Submitted by nk on Fri, 2007-06-29 13:56

NowPublic has a page which tries to find out the locality of the visitors based on her IP. We do not want this page to be cached (obviously). But Drupal provides no mechanism to make a page exempt from caching. By the time the page is loaded from the cache we have settings, database connection, sessions, variables and hook_init is ran. There are quite some tricks you can do even with this limited arsenal, but I found variable overrides in settings.php to be best if ($_GET['q'] == 'local') $conf['cache'] = FALSE;.

Toshiba R500

Submitted by nk on Wed, 2007-06-27 00:58

If you like my work, here is a nice way to say thanks.

Frans Alkemade

Submitted by nk on Sat, 2007-06-16 16:06

I have written previously about when this guy under the nickname of RNGsoft was first stealing Drupal. He was stupid enough to ask help from the Drupal community so his rouse was quickly found. Now, Bert Boerland writes that Frans Alkemade is still stealing our work, the code and the documentation alike and he is writing nice comments about himself under various pseudonyms. Dude, that's not nice. And why I am blogging this? To make sure Bert's blog post has a higher rank, of course :D

More optmization

Submitted by nk on Mon, 2007-06-11 19:56

And yes, more can be done. Let's make term_node changed nonzero only if it satisfies other where conditions in the query i am optimizing (like n.status = 1) and add an index on (tid, changed) to term_node.

Optimizing ORDER BY changed DESC LIMIT 5 more

Submitted by nk on Mon, 2007-06-11 19:56

So I asked David Strauss, the new Drupal resident SQL expert what he thinks of the optimization described in the earlier article. He says, not bad, but if you add n.changed to term_node and index that then the query will speed up. And it did, in a spectacular fashion. Keeping term_node.changed in sync with node.changed can be either done with an INSERT BEFORE trigger or with a nodeapi module with a module weight which is higher than of taxonomy. We picked the latter because it fits more into our code flow and easier to document.

Optimizing ORDER BY changed DESC LIMIT 5

Submitted by nk on Fri, 2007-06-08 02:56

the five latest nodes satisfying some condition. MySQL (and I believe any RDBMS) will pick the whole result set, sort it, and then limit it. On NowPublic homepage this meant tens, sometimes hundreds of thousands nodes to sort. We have a very nice box to serve database queries, but not this nice. So we implemented a cutoff -- surely anything older than some time is not front page worthy. Now it just sorts the nodes that gets submitted in a short timespan: SELECT ... WHERE changed > $cutoff_time

Next problem was cutting off nodes belonging to certain terms.

Looking back to my three years as a Drupaler

Submitted by nk on Tue, 2007-05-29 20:52

In 2004 spring, I was working as a web programmer with a friend of mine and we were just past the phase where one is sick of rewriting login for every client -- we needed a CMS. We tried everything we could find and man, they were horrible. It should be noted that Drupal in 2004 spring was hard to find.

Come May 29, 2004 Goba's talk about Drupal in a rural town in Hungary and I found Drupal and registered that day. Almost immediately I began to work on a client's site with Drupal -- Drupal HEAD, I think. The results were fantastic... fantastic crap, that is. I scrapped the site a few months later and has rewritten it... and that still was crap but it took some months to realize. At one point I contributed a flexinode field type (table) -- very likely this was my first contribution to the project. As this website was in two languages I got involved with i18n almost immediately. This resulted in my first core patch, let it stand here: