Categories
Blogs Kim Blog (English)

From #twehab: Hi! My name Is Kim “Twinehouse” Bach and I’m out of #twehab

There’s too much going on on twitter for me stop engaging in the conversation, I recommend that you unfollow me if you’re on a low bandwidth device, you can befriend me on Facebook instead.

Yeah I grabbed the cool URL! http://www.facebook.com/kim.bach

Kind regards

Kim “Twinehouse” Bach

ps. My Amazon Kindle is waiting for me at the DHL Warehouse, it arrived yesterday, but it’s one expensive little number, an extra $150 in customs. OUCH!

Categories
Blogs Kim Blog (English)

Superlative?

Stay while I recount the crazy TF2 kill I managed yesterday, my friends.
I’ll spare you my dream then…Nah…Thugs were trying to kill me because they didn’t like that I tried to stop them from killing dogs, for fun, by wailing like a ghost. A kid in the supermarket wouldn’t stop his lift, just kept on going, sliding me through the aisle, eventually dropping the load. The he gave me two bananas that began morphing into a potted plastic flower that spewed some nasty stuff, I told him that I hoped he had to cover the damages from his allowance! BAD! BAD! Kid – ugly too, a nasty redheaded geek with glasses and pimples. That’s when I woke up – thank God!

The comic-stip is from the wonderful xkdc, this one really hit home, and I’ve been waiting for the chance to use it a blog post.

Categories
Blogs Kim Blog (English)

The Perfect Gentleman

Creepy

OK, I need your advise.

An attractive, rather thrashed, woman walks up to me asking for directions to a bar, I find it using my tech-wizardry, she MUST have known where it was, she claimed that she had lived in that street, I wished her a pleasant night, and we went our seperate ways.

I now see that there were several other doors I could have choosen:

1. Showed her the way
2. Asked if I could join her
3. Suggested that we went somewhere else

Did I choose the right door, in post-cog I think that I should have tried door number 3, I was high on culture from last nights Kulturnat event, and there are several places that are better suited for spirtual encounters than Wessels Kro.

ps. I think that I should have, at least, tried door number 1, it would have let to the possibility of choosing the other two. Hey I might finally be getting the rules if this game, it is a very strange game, and I thought the only way to win is by not playing https://www.kimbach.org/2009/06/28/game-theory/

pps. Suggesting that you go “somewhere else”, is much like saying you want to “park the car” – I should have picked door #1.

Cross posted to facebook: http://www.facebook.com/note.php?note_id=153324064892

Categories
Blogs Computere og Internet Kim Blog (English) Technology

Amazon Kindled KISS

Kindle
Order Date: October 7, 2009
Order #: xxx-xxxxxxx-xxxxxxx
Recipient: Kim Bach

Items not yet shipped:
Delivery estimate: October 21, 2009 – October 23, 2009
Shipping estimate: October 19, 2009
1 of: Kindle Wireless Reading Device (6″ Display, U.S. & International Wireless, Latest Generation)
Sold by: Amazon Export Sales, Inc.
1 of: Patagonia Kindle Case (Fits 6″ Display, Latest Generation Kindle)
Sold by: Amazon Export Sales, Inc.

Kindle and Sony PRS-505I’ve been waiting for the Kindle to be launched in Denmark, I’ve wanted one since I laid my hands on one at Reboot 11 in June. So now I know what I’m getting for my birthday.

Yes, the Kindle has it’s problems, and I fear that it will end in my hardware graveyard, alongside my Palm Vx (which I loved, and read books on) and my Compaq PDA (which I loved, and read books on), but the Kindle is a different creature, much like the iPod, it’s focusing on a specific application and has connected that with a clear business model, I see it as a connected object, a beautiful combination of form and function, something Microsoft has never understood, and that Apple has abandoned, except with the iPod Shuffle.

KISS!

For those oblivious to what a Kindle is, it’s an eBook reader developed by Amazon. Amazon’s vision is to make all books ever published available in digital form, and Jeff Bezos can repeat after Steve Jobs: “we have xx millions of accounts, AND they come with creditcards”. I believe that it will take talent for Amazon to fumble this.

Categories
'i dag' (Danish) Blogs Manic Panic Uncategorized

الآن! خدمة الحوار المباشر للدخول في الإسلام بالإنجليزية

Categories
Blogs Computere og Internet Education/Undervisning Hackers Historier/Stories IT Guruer Kim Blog (English) Open Source Technology Undervisning Videnskab

Forget this world and all its troubles and if possible its multitudinous Charlatans… – Celebrating women in tech

March the 24th 2009 is Ada Lovelace Day, the brainchild of Suw Charman-Anderson. Suw pledged to write a blog-post about a woman in tech that she admired, if at least 1,000 would make the same pledge, and since I’ve admired and been fascinated by Ada Lovelace since childhood, and especially after I read the wonderful book The Difference Engine, so I embraced the project, but at the same time I knew that it would be difficult for me to find just a woman in tech that I admire, that is because the list is long, and I’m happy to say that it’s actually getting longer.

In the end it turned out to be quite simple to name one single woman in “tech” that I admire, a woman that I’ve admired for 2,5 years since I met her at the wonderful BlogForum 2 – an initiative that we really need to revive – and almost did at Copenhagen Twitterfestival.

Since 2006 the woman I have in mind has become quite the celebrity, due to her uncompromising and relentless pursuit of the truth in the murky waters of the Danish tech-business, and this year she’s the natural selection, she’s the woman behind the mainstream breakthrough of the blog-media in Denmark, she is – of course – Bizzen/Toften: the journalist and blogger par excellence Dorte Toft.

Love/hate relationship with “tech”
I have a love/hate relationship with my field, the field known as “tech”. Tech is definitely one of the places where change is happening today, and I feel blessed that I’m involved in bringing this change.

But “Tech” is a field that is riddled by paradox. On one hand it’s crawling with greedy snake-oil salesmen, on the other it’s home to the most revolutionary, idealistic and altruistic people ever as well as some of the most wonderful concepts that humankind has ever come up with.

The problem with the snake-oil salesmen, is that, until now, they’ve pretty much got away with cheating their customers, the authorities, the business community and worst, their employees, and a lot of the snake-oil has been sold under the heading that Denmark is number one in tech.

It’s been a constant embarrassment to me, and I actually left the business four years ago, and it took me two years of “repenting” before I felt that could return to “tech”, and today I’m luckily to be employed by a tech-company that doesn’t carry any snake-oil.

Emperor’s new clothes
I’m just going to, briefly, mention the fact that Dorte Toft was the woman that noticed that Stein Bagger and IT Factory didn’t wear any clothes, thus exposing one of the biggest scams the Danish tech-sector has seen to date, but thank you Dorte for exposing these people, so that we can be protected against these predators and making it possible to feel proud about working in “tech” again.

Feminism isn’t “low-status”
What I’d rather celebrate today is that Dorte Toft is a self-proclaimed feminist, even though it’s – in her own words – a field that is “low-status”, and her labour of love “Nærmest Lykkelig I Nørdland” (“Almost happy in Geekland” – something got lost in translation sorry about that), where Dorte Toft has been writing and writing and writing about the benefits young women would have if the choose to join the so-called “though” fields, technology and science, a very noble cause.

I noticed that Dorte Toft also wrote a blog-post in observation of Ada Lovelace Day today. In this blog-post Dorte is pledging to return to “Nærmest Lykkelig I Nørdland”, I’m so, so happy to hear that, Dorte Toft has been toiling away, trying to ease young women into the fields of tech and science, and her work deserves so much more attention than the perpetual Stein Bagger saga.

To all the wonderful women that I’ve worked with, am working with and will work with in the future, thank you so, so much for putting up with us, we need you, and remember how far you’ve come.

When I mentioned to my father how much I loved having female managers, he simply said that he could never ever imagine have a female manager, I was appalled.

Women, “tech” is too important to be left to men
Women please don’t stop now, so that next time I’m in a position where I’m hiring tech-staff, I hope that I’ll receive applications from women. Looking at the number of students at the IT University in Copenhagen I’m quite optimistic that that would be the case.

DORTE TOFT: Please go work on “Nærmest Lykkelig I Nørdland”, I’m waiting for it, unlike the book about “Banditterne i habitterne” (“The Bandits In Suits”) – and remember feminism isn’t “low-status”!

YOUNG WOMEN: We really, really need you in the tech-sector. Tech is far too important to leave to us men, and listen to, and get inspired by Dorte Toft!

Celebrating the Enchantress of Numbers
I’ll close this post with these wonderful quotes.

We may see aptly that the Analytical Engine weaves algebraic patterns just as the Jacquard loom weaves flowers and leaves
Lady Ada Lovelace

Forget this world and all its troubles and if possible its multitudinous Charlatans – everything in short but the Enchantress of Numbers
Charles Babagge, inventor of the Analytical and Difference engines

Notes
If you want to learn more about the fascinating life of Ada Lovelace, daughter of Lord Byron, by many considered the inventor of programming languages, I’d strongly recommend “The Bride of Science: Romance, Reason, and Byron’s Daughter“, “Zeroes and Ones: Digital Women and the New Technoculture” and “The Difference Engine“.

I’m also building a “shrine” to Ada Lovelace on Algorim.dk, a result of “mellemrumssingulariteten” which was inspired by a young woman I know, this woman is, BTW., working in the purest field of them all 😉

Categories
Blogs Kim Blog (English)

Happy Fifth Blogaversary – I brought the noise!

Joy Of Tech - Stop Googling YourselfYesterday the 15th of February 2009, marked the fifth year of me being a blogger. Technically I’ve had an Internet presence since 1999, but it’s the moment when I started using the service “blogger”, I count as the beginning of my “career” as a blogger.

My first real blogpost was a short “review” of the KRAFTWERK! concert in K.B. Hallen in 2004, which was fantastic:

Mass for the deities of techno

KRAFTWERK! – much better than expected – revelation that they’re such a live act – the bass made the doors flap. Bow to the funky devils aus Deutschland. Seems that I miss my techno

I think I was quite uncertain as to what to write in that entry, I knew I had no readers, and it is documented in the later entries that I had some doubts as to how wise it was to engage in publishing to the Internet.

Even though I started blogging in 2004, it wasn’t until autumn 2005 I really started blogging under the https://www.kimbach.org handle. With real blogging, I’m referring to fact that I transcended the diary format.

Looking back I’m pretty satisfied with my blog, and it’s great to have this assisted memory, it’s like a locker of fragments.

One sobering fact is that the biggest drivers of traffic to my blog remains the article about the 5002 error in iTunes and the article that contains a photo of chalk art by Julian Beever, which is heavily copied and hotlinked.

I’m most proud of some of my articles about technology where I’m blasting the monopolies, especially this one:

Net Wars Episode VI: Return of the Jedi

I’m also very satisfied with the concert reviews I’ve published, especially these:

Review: Woman power – Beyoncé gave the “Green Light” and other “coincidences”
Review: Natacha Atlas Acoustic Ensemle – The “real” Madonna was in Copenhagen

My blogpost about the Ungdomshus summed up my feelings about it:

Automonotoni – ‘Ungeren’ er en idé

911 is another important topic, and I feel like that event really has been the inspiration behind much of the activities I’m engaged in today. My favourite article concerning 911 is this one:

The Church doesn’t have Wi-Fi

Originally the topic of my blog was technology, but I can see from the tag-cloud, that the technology tag is shrinking, and the “kim bach” tag is growing, kimbach.org is increasingly about me, which is the way I want it to be.

In the colophon I’ve also summarised my personal goals:

Become:

Better at writing – so I can write a novel or maybe become a journalist

Better at reading – so I can have the patience to read Kierkegaard

Better at photography – so I dare to publish a photography book

Better at teaching – so I can help the kids in Mjølnerparken and elsewhere even more

To sum up: I work towards being able to make a living doing some, or all, of these things.

Since 2004 I’ve actually worked professionally as a teacher, and the only field I haven’t made progress in, is reading, so that will be a focus point in the future. I think some of my articles shows some journalistic merit, but I doubt that I’ll ever be able to make a living from it. I think I’ve become a better photographer, again I’m probably not going to be able to make a living from photography.

Stop googling yourself…

If you googled “kim bach” in june 2005, you had to browse to page 25, now I’m a bit easier to locate due to all the noise I’ve been making over the past five years. The result is that I’ve made lots of new friends in real life, had tremendous fun, organised events, been an activist. All in all: being active in the blog-community has changed my life, and helped me reach my personal goals so:

Thank you all, and sorry to disappoint you, but I’m not done making noise!

The image that accompanies this article is from the wonderful comic Joy of Tech, it’s copyright Nitrozac & Snaggy, I’m hoping that the use here falls under “fair use”. Please support Joy of Tech by buying merchandise from their website.

Categories
Blogs Education/Undervisning Frivillig arbejde Historier/Stories Kunst Music Musik Resources Undervisning

Working Class Hero by John Lennon

As soon as you’re born they make you feel small
By giving you no time instead of it all
Till the pain is so big you feel nothing at all
A working class hero is something to be
A working class hero is something to be

They hurt you at home and they hit you at school
They hate you if you’re clever and they despise a fool
Till you’re so fucking crazy you can’t follow their rules
A working class hero is something to be
A working class hero is something to be

When they’ve tortured and scared you for twenty odd years
Then they expect you to pick a career
When you can’t really function you’re so full of fear
A working class hero is something to be
A working class hero is something to be

Keep you doped with religion and sex and TV
And you think you’re so clever and class less and free
But you’re still fucking peasants as far as I can see
A working class hero is something to be
A working class hero is something to be

There’s room at the top they are telling you still
But first you must learn how to smile as you kill
If you want to be like the folks on the hill
A working class hero is something to be
A working class hero is something to be
If you want to be a hero well just follow me
If you want to be a hero well just follow me

Categories
Blogs Humor Kim Blog (English) Music Musik

Mrs. O’Leary’s Cow

INSTRUCTIONS:

  1. Put your iPod or other music player on shuffle.
  2. For each question, press the NEXT button to get your answer.
  3. YOU MUST WRITE THAT SONG NAME DOWN NO MATTER HOW SILLY IT SOUNDS!
  4. Tag friends who might enjoy doing this as well as the person you got this from.

IF SOMEONE SAYS “IS THIS OKAY” YOU SAY?
Piano Concerto No. 21 in C Major, K. 467: II. Andante – Wolfgang Amadeus Mozart – Friedrich Gulda, Hans Swarowsky & Vienna State Opera Orchestra

WHAT WOULD BEST DESCRIBE YOUR PERSONALITY?
Mellow Mood – Material

WHAT DO YOU LIKE IN A GUY/GIRL?
Calabi Yau Manifold – Dopplereffekt

WHAT IS YOUR LIFE’S PURPOSE
100 bpm – Mikæl Simpson

WHAT IS YOUR MOTTO?
Sexy Dancer – Prince

WHAT DO YOUR FRIENDS THINK OF YOU?
Le Printemps (For Mona) – Natacha Atlas

WHAT DO YOU THINK ABOUT OFTEN?
Freeland – Big Wednesday

WHAT IS 2+2?
All’ Aurora – Bernhard Lewkowitch

WHAT DO YOU THINK OF YOUR BEST FRIENDS
Mistlur – Martinez

WHAT IS YOUR LIFE STORY?
Sugar Never Tasted So Good – The White Stripes

WHAT DO YOU WANT TO BE WHEN YOU GROW UP?
When The World Ends (Oakenfold Remix) – Dave Mathews Band

WHAT DO YOU THINK WHEN YOU SEE YOU SEE THE PERSON YOU LIKE?
Fourty Days – Sound Directions

WHAT DO YOUR PARENTS THINK OF YOU?
The Ostrich Effect – Dorit Chrysler

WHAT WILL YOU DANCE TO AT YOUR WEDDING?
Hayati Inta – Natacha Atlas

WHAT WILL THEY PLAY AT YOUR FUNERAL?
Zorba’s Dance – The Sirtaki Orchestra

WHAT IS YOUR HOBBY/INTEREST?
Circus – Kelis

WHAT IS YOUR BIGGEST SECRET?
Fynboen – Dirch Passer

WHAT DO YOU THINK OF YOUR FRIENDS?
Kada sva sama – Olivia

WHAT’S THE WORST THING THAT COULD HAPPEN?
The Matrix Revolutions Main Title – Don Davis

HOW WILL YOU DIE?
Who’s My Baby – Natacha Atlas

WHAT IS THE ONE THING YOU REGRET?
Momentos – Andrea Bocelli

WHAT MAKES YOU LAUGH?
At Least You Tried – Neo Geo

WHAT MAKES YOU CRY?
Achilles – Antena

WILL YOU EVER GET MARRIED?
long life – E.T.

WHAT SCARES YOU THE MOST?
The Boy From West Bronx – Future 3

DOES ANYONE LIKE YOU?
All Day – Interfarence

IF YOU COULD GO BACK IN TIME, WHAT WOULD YOU CHANGE?
Dolphin Dance – Herbie Hancock

WHAT HURTS RIGHT NOW?
Bliv Ved Med At Danse – MC Einar

WHAT WILL YOU POST THIS AS?
Mrs. O’Leary’s Cow – Brian Wilson

Tagged by Laura Marie Kiralfy on facebook, originally posted to facebook as Mrs. O’Leary’s Cow

Categories
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
  node_object_prepare($node);
  global $user;
  $node->uid = $user->uid;
  $vid = 2;
  $node->taxonomy['tags'] = array($vid => $tags);
  
  node_save($node);
  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