Blogs Computere og Internet Hackers Historier/Stories Kim Blog (English) Open Source Technology

DrupalCamp Copenhagen 2008: Guess what, I’m the hero – Introducing Droopy your new microblogging service

The Danish Drupal community, Drupal Danmark, organised a miniconference, DrupalCamp Copenhagen, in the weekend of the 15th and 16th of November 2008 at La Oficina, a new – FANTASTIC – co-working space in Copenhagen

Show your <3 for Drupal

People that know me, also knows that I’m a big fan of the Content Management System (CMS) Drupal, and I constantly push it.

One of the main reasons I LOVE Drupal is that it, besides the pure open source license <3, also tries hard to support standards, rather than doing “clever” things in core. This is in strong contrast to other tools, that attempt to make it easy for the user, but then locks you in.

Personally I love HTML and the constant cry for a rich editor in core is lost on me, but then again, I’m writing this using the off-line client ecto 😉

A restless 2008, but where’s the inspiration
2008 has been an amazing year for me, and I’ve attended several events that should have made me so inspired that I’d blog up a storm, but somehow this failed to happen, and I was reluctant to sign up for DrupalCamp Copenhagen, because I was also involved in the organisation of BarCamp Copenhagen the following weekend – I was afraid to overcommit myself, resulting in me burning out.

It turned out that I was “pushed” – nah let’s say inspired – to sign-up by a guy I’ve never met in person, but knew well from the Danish Mac community.

“Unfortunately” I got so inspired that I even had the audacity to suggest that I should host a session at DrupalCamp Copenhagen – oh no what a fine mess I got myself into, this happens every time I get inspired, like I said, I tend to overcommit myself.

Then all was quiet for a while, like forever, and DrupalCamp Copenhagen was only four days away, when a preliminary schedule was sent out to the participants, which, by the way, was now exceeding the capacity of the venue, pretty Fanø amazing!

Hmm, my session wasn’t on the schedule, ok, I guess I don’t have to prepare anything then 🙂

So you want to be a Drupal Star, well the stage is yours!
On Wednesday night the final schedule was sent out, and lo-and-behold, my session was actually featured, “Using Drupal as a Web Application Framework“, hmm I’ll be addressing a bunch of hardcore Drupal professionals, and they have payed a fee, albeit a nominal one, to attend, but still this is the first time ever that I was to address a paying audience, pretty daunting when you think about it.

So I started thinking hard about the theme of the session.

When I sugested the session, I had promised that the session would be much more of a participatory session, than a presentation, and that I was hosting it to learn from the failures I had trying use Drupal as a framework for web-applications.

In my mind a different idea began to take hold, one that focused on the things that I learned, and was succesful in achieving instead of focusing on the failure of my projects.

I decided that I’d start by asking the question: “What is a web-application?”, and inspired by one of my “failed” projects, I decided that I’d do a walk-through of how you could build a Twitter like site without any, or close to no, coding on your part.

Twitter is the perfect candidate for demoing a web-application implemented using Drupal, since it’s all about content and simplicity. Strangely enough my choice of Twitter as a model for a sample aligned itself perfectly with the Miki’s session, Modules 101, on Sunday, even though he took a different approach than I did, and actually did a fair amount of coding.

One could have the idea that we had co-ordinated this, we hadn’t, so I’ll just rack it up to coincidence, and the fact that Twitter is the second most hyped thing on the Internet these days.

Guess what, I’m the hero
Drupal Droopy DogI won’t go into serious details about my session, but it saw me show praise for open source and Drupal, do a hands-on step through of how to build a Twitter clone, called Droopy, and demo my first Mac OS X Cocoa application EVER!

Droopy is a fictonal web-application, the name was inspired by the Tex Avery cartoon, but it also sounds like Drupal.

Droopy allows you to post microblog content using a simplified form. Microblog content, or “Droops”. A “Droop” is a standard Drupal content-type, that you can submit to the site by using a custom form. Implementing the form took some 10 lines of code to implement as a module.

At your service
The real star of the show was, however, the wonderful Drupal services module. If you install the services module you can access Drupal using a varity of web-service standards, but as default it support XML-RPC, so that’s what I focused on.

The services module implements a number of methods that you can use, I focused on the node and the user services.

The node service implements methods for retrieving, deleting and updating nodes, the user service implements methods for login and logout.

One of the nicest features of the services module, is that it has a nice UI for browsing and testing the exposed services.

A KISS from Droopy
You can, of course post content using /node/add/droop, but like I said I’d like to do that a little smarter/simpler, so for that purpose I developed a small module that utilises the Form API to implement a simplified data entry-form to post the content-type a “droop”.

This was quite simple to do, the only problem I had was that I wanted to tag my content (flat taxonomy), and in order to do that, you can’t simpy use the standard mechanism to save a node, this is how I implemented a method to create a node programatically including creation of tags, the vid that is hardcoded to 2 might be problematic, but the thing to focus on is the line:

$node->taxonomy['tags'] = array($vid => $tags);
 * Create a droop node programatically.
 * @param $param 
 * Either a droop - enabled node type or a $node object with at least valid $node->type.
 * @param $title 
 * The body of the droop post.
function droop_create_node($param, $title, $tags) {
  if (is_object($param)) {
    $node = $param;
  else {
    $node = new stdClass();
    $node->type = $param;
  $node->title = $title;
  $node->body = $title;
  $node_options = variable_get('node_options_'. $node->type, array('status', 'promote'));
  // If this is a new node, fill in the default values.
  foreach (array('status', 'promote', 'sticky') as $key) {
    $node->$key = in_array($key, $node_options);
  // Get the content-type settings as default
  global $user;
  $node->uid = $user->uid;
  $vid = 2;
  $node->taxonomy['tags'] = array($vid => $tags);
  return $node;

In order to have the custom form show up, I decided to do a theme hack, this could probably be done much cleaner, but it’s really simple to have a form show up on a page.

print(drupal_get_form('droop_simplified_form', $currentGroup));

Below is a screenshot of a simple theme that shows the simplified form:

Droopy and Droop form screenshot

Fat client
I already had a functional XML-RPC client written in PHP, but I wanted to do something a little smarter.

Fundamentally I believe that the web is extremely ill suited to host applications, what you can do with a full client that has direct access to the rich presentation services that the operating system exposes, is just so much easier to develop, than trying to support x-number of browsers. I’m a huge fan of applications like iTunes, since they combine webcontent with a fat client, I think that’s going to comeback in a big way, powered by the mobile platforms, that, due to limited resources, forces us back to writing applications that tagets specific platforms.

In my daily job I work with Microsoft .NET on a standard Lenovo pc, but when I’m at home, I swear by my beloved PowerBook G4 12″, and that doesn’t run Windows and Visual Studio, so how could I develop a fat client to use to demo how to shout “DOWN BOY!” to Droopy, I had never ever had any success developing for Mac OS X? OTHO, that was a challenge, and I love those, even though this was now late Friday morning, and my presentation was less than 48 hours away!

Schizoid development platform from the last century
Development for Mac OS X is strange, Apple does bundle the development tools you need to target Mac OS X with Leopard, but that’s basically where the help stops.

So I knew that I need to enlist the help of Google, and I already knew what I was looking for, so how difficult could it be, well it turned out that it was.

For one, development for Mac OS X is not very widespread, but I did manage to find a number of samples, one of them implemented what is know as a framework, which basically extends Mac OS X with additional features, but hey, I just wanted to call a service using some simple XML that I wanted to post using HTTP, did that really require a framework?

Another strange fact, was that the samples I found were really old, but I found out that Mac OS X actually contains some nice high-level APIs that you can use to call web-services, they’re all prefixed with WS, for instance WSMethodInvocationCreate, WSMethodInvocationSetParameters and WSMethodInvocationInvoke, the strangest thing about these interfaces was that I saw several warnings against using these functions, strange.

Drupal XMLRPC Cocoa ClientOh well I manged to find a suitable sample here: Ranchero Software: Cocoa XML-RPC Demo, and I managed to change it so that I could call the node.load method exposed by the node service, but this was when trouble arose.

The node.load service allows you to supply a list of node-fields that you want to to have returned, if you supply an empty list, you’ll get all the fields. I tried several things, to no avail, my service kept returning node not found errors, this was a problem that I never manged to fix.

The problem has something to do with the way Apple’s API serialises it’s parameters, Drupal is expecting a list, that will get de-serialised into a PHP array, I couldn’t get that to work.

I then decided that I’d try to interface with the user service instead, and that faired better, and I manged to login to Drupal from my client, heavenly bliss :-).

OK, next step would be to add an additional button to my client, called “Login”, and have two buttons in my application, this was when I hit rock-bottom, I just couldn’t figure out how to hook up an InterfaceBuilder push-button with an Objective-C eventhandler.

This is something that is super-simple to do with almost any other development tools, why oh why has Apple decided to stay in the 80ies, I want a double-click in the designer to generate a stub and open my event-handler code in the editor.

Oh well, my application works, but I think that I’ll follow the advice, and stop using the WS* APIs, and start interfacing directly with the HTTP POST API, and serialise/deserialise the XML myself, another benefit of this approach, is that it’ll also works on the iPhone 😉

Below is the code required to do a login to Drupal using XML-RPC from Mac OS X.

- (IBAction) doUserLoginLogin: (id) sender {
	Called when the Login button is clicked.
	int ixState = [numberField intValue];
	NSNumber *stateNum = [NSNumber numberWithInt: ixState];
	WSMethodInvocationRef rpcCall;
	NSURL *rpcURL = [NSURL URLWithString: @"http://localhost:8888/droopy/?q=services/xmlrpc"];
	NSString *methodName = @"user.login";
	NSDictionary *result;
	NSMutableDictionary   *params;
	params     = [[[NSMutableDictionary alloc] init] retain];

	[params setObject:@"user" forKey:@"username"];
	[params setObject:@"password"            forKey:@"password"];
	/*First create a method invocation.*/
	/*First parameter is the URL to the XML-RPC web service.
	Second parameter is the name of the XML-RPC method to call.
	Third parameter is a constant specifying XML-RPC protocol.*/
	rpcCall = WSMethodInvocationCreate ((CFURLRef) rpcURL, (CFStringRef) methodName, kWSXMLRPCProtocol);

	/*Then set the parameters. (There's just one in this case.)*/
	/*First parameter is the invocation created above.
	Second parameter is a dictionary containing the parameters.
	Third parameter may be an array specifying parameter order.
	(Since there's just one parameter, NULL is passed for parameter order.)*/
	WSMethodInvocationSetParameters (rpcCall, (CFDictionaryRef) params, NULL);
	/*Do the actual XML-RPC call and get the result.*/
	result = (NSDictionary *) (WSMethodInvocationInvoke (rpcCall));
	/*Display the result.*/
	if (WSMethodResultIsFault ((CFDictionaryRef) result)) /*error?*/
		[resultField setStringValue: [result objectForKey: (NSString *) kWSFaultString]];
	else /*no error; all's well*/
		[resultField setStringValue: [result objectForKey: (NSString *) kWSMethodInvocationResult]];		
	} /*doLogin*/

Lessons learned

  • It’s easy to develop a web application with little, or no, coding using Drupal.
  • I’ve actually learned a LOT from my failures
  • Work with the framework, not against it
  • I can haz OS X apps
  • Oh and: Don’t hack core 😉

Thank you to the organisers
DrupalCamp Copenhagen 2008 was a tremendous success, 100 people, including visitors from as far away as Canada, a venue filled with energy, amazing sessions, especially the sessions hosted by Miki and Acquia filled with practical advice, but it’s also amazing that the Danish newspapers showed up, ready to share their experiences on how to performance optimise Drupal, I guess that print media is finally getting the Internet and the concept of open and free, and it fills me with optimism!

I’m now ready to face the world with renewed faith in Drupal and my own abilities to put it to use, gentlemen start your Drupal engines!

One more thing
Come to think about it I should have named my Twitter clone, Sylvester, OTOH Sylvester never manages to catch “Tweety Bird” does he 🙂

External links

Droopy is a trademark of and copyright MGM, Sylvester and Tweety are trademarks of and copyright Warner Brothers. I claim fair use

Blogs Bookmarks Computere og Internet Kim Blog (English) Resources

DrupalCamp Copenhagen 2008 – Drupal Danmark: You’ve come a long way, baby

Drupal.OrgRegular readers might know that I’m a big fan of the Content Managment System Drupal. I’ve been actively promoting this system for 3 years, and I was active when Drupal Danmark, the Danish Drupal community, was established in the spring of 2006.

Despite this, I’ve never really managed to build anything useful using Drupal!

It’s not that I haven’t tried, actually I’ve ventured into a number of projects where I’ve tried to use Drupal as an application framework, because I, strongly, believe that Drupal is so much more than a CMS.

The projects haven’t failed completely, and I’ve learned valuable lessons, but I never really managed to finish them.

As a developer trying to work with a CMS for development is rather frustrating, since you get to spend most of your time configuring the system, and you constantly run into limitations, that mostly are related to the fact that developers and non-developers alike, has to be able to configure the system.

Why did the projects fail? Was it due to lacking skills on my part, or is Drupal not suited to use as an application framework or are there additional factors?

I’d like to explore this, so I’ve signed-up for the very first DrupalCamp Copenhagen, that will be held November 15th and 16th 2008 in Copenhagen.

I’ve also proposed a session: Using Drupal as a Web Application Framework, let’s see if that is accepted, but for sure I’m not going to be a tourist, and I’m going to actively pursue an answer to my questions.

You’ve come a long way baby
Like I mentioned, I was present when we took the first steps trying to establish the community back in spring of 2006, but since late 2006 I’ve been mostly absent from the community.

Since then Drupal, and Drupal Danmark, has grown stronger and stronger, and if you take a look at the sign-ups for DrupalCamp Copenhagen 2008, you can see how strong the community has grown.

The fact that there’s a significant number of international attendees is impressive. This has a lot to do with Drupal Danmark and evangelists like Morten DK’s and Mikkel Høgh’s very active participation in the international community.

So thank you all for growing the community, and having the guts to go ahead with DrupalCamp Copenhagen 2008. YOU ROCK!

Drupal Danmark: You’ve come a long way baby.

Hope to see you at DrupalCamp Copenhagen.

See also:

Blogs Computere og Internet Hackers Kim Blog (English) Open Source Technology

Drupal:Reloaded: Upon this “rock” I will build my “church”

Drupal.OrgAfter a while being away from Drupal CMS, and struggling with a, IMHO, buggy version 5.0 earlier this year, I’ve come back to visit this old friend, and I’m very happy to be back.

Firstly: I must say that the current version 5.3 of Drupal is rock solid, and that I have renewed confidence in Drupal.

My revisiting Drupal has, in part, been sparked by a rather depressing talk on the Drupal Denmark mailing list. The community seemed to be withering away, and I was sad to hear that.

Personally I’m back from a long break from ICT work, and I think that I did a fair share of volunteer work, while we were trying to set up the group last year.

Another reason I’m back, is that I have a number of web-projects coming up, and I’ve long considered making Drupal the foundation of a majority of my future web projects, you might not notice, since my projects, most likely, won’t look much like Drupal.

You might also want to check my links tagged with Drupal, I’m currently looking into integration issues, but I’ll also be sharing module recommendations, and I’ll, most likely, contribute localisation files back to the community – it’s good to be back.

Drupal: Upon this “rock” I will build my “church”

Blogs Kim Blog (English) Open Source Technology

Drupal – Incompatible environment

If you get this error from Drupal:

Incompatible environment

The following error must be resolved before you can continue the installation process:

Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini mbstring.http_input setting. Please refer to the PHP mbstring documentation for more information. (Currently using Unicode library Error)

It can be fixed by adding the following lines to your settings.php file in the PHP settings section:

/* PHP.ini overrides */
ini_set('mbstring.http_input', 'pass');
ini_set('mbstring.http_output', 'pass');

Thank you to Henrik for fixing this for me, Surftown accounts need this setting in order for Drupal 5 to work.

Blogs Bookmarks Kim Blog (English) Open Source Technology WordPress

Using XML-RPC to combine Drupal and WordPress on a site |

Using XML-RPC to combine Drupal and WordPress on a site |

This looks like a cool tip, using the Moveable Type XML-RPC API to integrate content from WordPress and Drupal.

I just love the XML-RPC blogging API, don’t migrate, integrate…Hmm does a Moveable Type XML-RPC API implementation exist for MediaWiki?

I think that using RSS for content integration, is the way to go under normal circumstances, but the flexibility the XML-RPC API offers is great.

Blogs Kim Blog (English) Technology

BarCamp Copenhagen November 2006: Adopt a rabbit

So the very first BarCamp Copenhagen took place this Friday, and it was great, I went home with new ideas and confidence that my own ideas aren’t “completely off the meter”.

I didn’t really know the format of BarCamp, other than what Henriette Weber had told us in the invitation, but I think we did quite well, and all the participants had something to bring to the table.

I suppose that the other participants will write about their respective subjects, but I’d say that the GEEK factor was VERY high, with subjects ranging from marketing to blood donation over the “new new isn’t the new but the old”, which, by magic, was a recurring theme in three of the presentations, including my own.

Henriette Weber talked about marketing, and an idea that she had, she’s actually tired of the “new new”, e.g. viral marketing which she thinks is nothing but “old-school marketing”.

Peter Brodersen presented his simple and brilliant Google Maps application,

Frederik talked about how to bridge the gap between business and technology, they rarely speak the same language. That could have been an interesting discussion, but I was too busy documenting what was going on the IRC channel, that right now seems to have been lost in the black bit hole, next time I suggest that we use iChat or Skype.

Karin Høgh presented a great list with 14 items on how to please your podcaster, basically they need encouragement, comments and donations to keep doing what they’re doing, so if you listen to a podcast, remember to please the people that are producing it.

Olle talked about the new and the old, and that put us on a track where we discussed programming languages, and Karin mentioned that she once had taken a course in Java programming…What a waste for the world, and her. She actually thought that programming languages were something akin to a real language, so she was surprised that it was basically mathematics. This started a track where we discussed the old Knuth paradigm of computer programming as an art form, vs. the current predominant paradigm, where computer programming is seen as a science.

Now it was my turn, and I also talked about the old and the new, we’re currently tied to our desktops, laptops, mobile devices. What if we could have dedicated hardware that could help strengthen and build a community, and this brought me from the visionary Minitel to the equally visionary Wired Rabbit – or “Lapin Communicant”, the Nabaztag from Violet – The smart object company. J’ai vu le futur et le futur étiez Violet.

I’m trying to build a Danish Nabaztag community site,, but I’m managed to kill it with embedded PHP code, and my “man” is too busy at the D3 Expo to help me.

Here’s my presentation: Adopt a rabbit (1.4MB Open Document Format).

Now we took a break to go get something to eat.

After the break we went into a more free format.

Thomas wanted to discuss how to utilise cell phones for more than texting and voice, well this was not your typical audience, so we all surfed the web on mobile devices. My personal favourite mobile web applications are Google over WAP ( Google over WAP is brilliant because it utilises Google cache to serve pages optimised for mobile devices, and it works like a dream, even with hyperlinks. Next is Gmail over XHTML (, now I’m as mobile as I ever want.

I also mentioned my traditional collaboration project Æbletræet, where we’ve build a sizeable knowledge base of Apple and Macintosh related subjects using a wiki based on MediaWiki. This has been great being involved in, because you can “hype” each other – when somebody writes an article you get inspired to improve it, and/or write your own. Like one of the comments reads IRC+Kim Bach=Inspiration.

I also mentioned how we’re using MediaWiki combined with Google Maps, to visualise the location of volunteers and users in Hjemmelektiehjælpen – a volunteer project, in collaboration with the Danish Refugee Council (Dansk Flygtningehjælp). We’ve actually worked with the developer of the MediaWiki Google Maps extension to improve it.

Morten is venturing into GEEKDOM as well, he talked about how to improve the Drupal administration interface with standard Tango icons, what a remarkable and simple idea, for a geekstradionare comme moi, I have few problems navigating the Drupal admin interface, but after I went home I could see how right Morten is.

Finally Christian engaged the geek warp drive, first he talked about the perfect match RSS and XMPP is. And you know what? Nabaztag understands XMPP!

But Christian also had a surprise, and I guessed it a Simon game! WOW, I just love that. He made a historical account of the start of the gaming industry, and with the Nintendo Wii, Nabaztag etc. it’s like we’re coming full circle game play and plain fun is important once again.

Christian ended by pitching blood donation! A noble cause, he felt that he need some counterweight to my shameless pitch of Nabaztag.

“Geeky shit” as said…Indeed!

Thank you Henriette! Looking forward to the next BarCamp Copenhagen. I think the attendance was about right. Yes it was sad with the late cancelations, but if we’d been more people, we’d had too little time to go into the discussions. I love the open space format, but we sometimes we need to respect the “speaking order”.