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

Pronunciation guide

Submitted by nk on Wed, 2010-04-14 17:27

So my name is Károly Négyesi and although I typically ask people to call me Charlie for simplicity they still try. So the challenge in Károly is the "ly" because most think that's a consonant and a wovel -- no, it's one consonant, like "j" in the beginning of York or yacht. For the á, check the city of Bath.

Moving hooks to the PHP5 era

Submitted by nk on Sun, 2010-04-11 04:30

Right now we have something like hook_user_logout which is documented in user.api.php and if mymodule wants to implement it then it needs to use a function called mymodule_user_logout. This is a Drupal convention and is not supported by any developer tool. We could instead have an interface called HookUserLogout with a single method called invoke which has the exact same signature and documentation as hook_user_logout. Edit: aside from IDE support, this would mean that PHP itself forces us to keep the hook signature. Invoking would happen through the registry table where we iterate over the classes implementing this interface. Of course, this would be cached but module_implements uses a cache in Drupal 7 already so not much change there. Code example is here, a skeleton of the invoker is here. The conversion would involve wrapping the function in a class, that's literally two lines of code including the } and renaming the function to invoke. The cost of creating a class vs calling a variable named function is not negligible but simply there are not enough on the page to make a measurable difference: 1000 calls are like 0.0025 vs 0.003 seconds.

MongoDB: what's to love (and what's not to)

Submitted by nk on Mon, 2010-03-29 18:34

Challenge: list the nodes of a user ordered by comment count. Sounds simple but the uid is stored in the node table and the comment count is in node_comment_statistics and beccause of that, this query can not be indexed and will therefore be always slow. Of course, you can begin to denormalize but do you want to keep a denormalized copy of your data for every kind of query? That's not a solution, that's a kludge and an ugly one.

To answer some trademark FUD

Submitted by nk on Sun, 2010-03-28 20:22

Somebody begun to "protest the Drupal Trademark policy [...] yet the policy requires sites, like this, to pay to use the trademarked name in various areas such as website domain names". Now, this not true. The trademark policy has been created with lots of feedback from the community and I for myself strongly support it, does allow free usage of the word Drupal if "You exclusively use the Drupal trademark to either extend or improve the Drupal software, or to encourage the use of the Drupal software (in short "foster the Drupal software"). So my blog is fine for example.

Becoming a Drupal coder: a wise career move

Submitted by nk on Sun, 2010-03-14 23:46

-- Please help getting the word out by reposting this for various programmer-but-not-Drupal lists groups etc.

Drupal 7 multistep node forms are easy

Submitted by nk on Mon, 2010-03-08 01:21

The bane of multistep node forms are validation errors. But Drupal 7 has a cure. Not nice but a cure.

Slap #access = FALSE on form elements you dont want to see in the current step and then set up the Next button with #limit_validation_errors set to the elements you are about to see. The Prev button should get an empty #limit_validation_errors. Should field validation errors bother you, you can nuke those in hook_field_attach_validate.

<?php
define('MYMODULE_STORY_NODE_FORM_LAST_STEP', 2);

Multiple forms together

Submitted by nk on Sun, 2010-03-07 02:45

I have written a Drupal 7 module which allows you to put together any number of forms into one <form>. For example, if you have a professor with various titles and you have created a title entity with the various fields necessary to describe that title then you can show all the title entity forms on the user edit form in a seamless manner. Co-maintainers are welcome.

VAAPI on Ubuntu Karmic Linux

Submitted by nk on Thu, 2010-02-25 21:07

I wanted to test VA API with my Lenovo T400s (GMA4500HD aka G45). You first need to install libva and then a libva-enabled mplayer. The only problem I have encountered is that the Debian package in the libva I downloaded disabled the i965 driver. I have reenabled it, it seems working. After installing, I found a small problem, reported on the Phoronix and the hkepc forums both: the skin of the people become blue. This can also be fixed easily.

Quickly navigating the deep directory structure

Submitted by nk on Mon, 2010-02-15 07:44

This works only on Linux:

chx@veyron:/var/www/drupal$ tail -3 /home/chx/.bashrc
function go() {
  cd `find . -type d -name $1`
}
chx@veyron:/var/www/drupal$ go views
chx@veyron:/var/www/drupal/sites/all/modules/views$

Do not use github

Submitted by nk on Thu, 2010-02-04 11:24

If you use git then use gitorious or repo.or.cz or anything that's not github. Reasons:

  1. github source code is not available. This makes me very uncomfortable. Who knows what might happen to the source code hosted there. I am not saying they will sneak in a backdoor but they could.