How to build a web service in 8 hours

I was a big fan of Jaiku (here I am) and didn’t “get” Twitter until about a year ago when a friend showed me Tweetdeck. Aha! So that’s how you’re supposed to use it! Not through the web page but by using a third party tool. I got so excited that I proclaimed Twitter the future of the web.

And I stopped using Jaiku.

One thing I did miss from the Jaiku-days, though, was the long discussion threads under each “jaik” (the Jaiku version of a “tweet”). Here’s an example. This provided Jaiku with depth, something you can hardly accuse Twitter of.

So an idea emerged: what if you could build a web service that made it possible to comment and discuss each tweet just like you did in the Jaiku-days.

Thus, Discuss a Tweet was born.

Or, well, at least the domain was registered. I did this April 17 2009. It then ended up in my pile of great-ideas-I-should-one-day-implement and nothing happened.

Until… last weekend.

I knew that it would be possible to put it all together quite fast. I had used Disqus when we built Rate My Pitch during 24 hour business camp – so I knew that the commenting system, the most difficult part, I would get for “free”. I wouldn’t even need a database. It was all about putting things together in a slightly new way. A classic mashup.

So, I started hacking away. A couple of hours later, the result is a mashup of the following services:

This is just a tiny little hack but I think it serves as a good example of how modern web development is done. You pick bits and pieces from all over the web, some open source components, some embedded web services. You put things together and something new emerges.

I used PHP and this is also worth noting. People complain about PHP but one of its biggest strengths is its user base and size. When you’re doing a mashup such as Discuss a Tweet you can be sure someone else has done about the same things you need and there is code out there ready to be used. You can’t say that about Scala or Erlang regardless of how powerful and beautiful the languages are. (Things are changing of course as the popularity of the language grows.)

Another thing happened while Discuss-a-Tweet was in my idea-pool: Google Buzz launched. According to Mr Jaiku himself, Jyri Engeström, Buzz is the continuation of Jaiku. And, yes, it allows you to comment and discuss tweets.

Maybe a usage pattern is emerging in how we use different social networks. Twitter for quick news updates and cool links, Facebook for our friends and Buzz for the discussions. Maybe the Opportunity Cloud for a service such as Discuss-a-Tweet is dispersing. We’ll see. It was fun building it anyway – and it only took a few hours after all. 🙂

(PS. Follow me on Twitter.)


Copying a VirtualBox VDI file running Ubuntu Server and getting Drupal running

Sigh. Things are never as easy as you want them to be. 🙂

I have two computers on my desk. My MacBook and my Asus EEE B202 running Windows XP. I wanted a development environment for Drupal (a php content management framework), so I tried running PHP on my MacBook.

It worked fine, but the first problem appeared when I tried to run Drupal. The PHP GD library was missing (used by Drupal for graphics). This is a known problem and requires a recompilation of PHP. The problem is, the Apache web server installed on the MacBook is used by OS X and may change in future updates to the OS by Apple. It also seemed a bit cumbersome to get it all to work as it should. So, I figured, why not in stead run a virtual machine with a developer setup in linux and get a clean separation between my day to day OS (OS X) and my developer server.

I decided to use VirtualBox, a free software provided by Sun, and run it on my XP machine (the B202). I installed Ubuntu Server 8.10 on the virtual machine.

If you haven’t used a software like VirtualBox or VMWare before, I can only say that it’s much easier than it sounds like. If you can install an operating system you can use VirtualBox. It’s a very slick and easy to use program.

But, there are of course a few problems.

The first problem was that Ubuntu Server was also missing PHP GD (not because of VirtualBox of course, but still). This time I only needed to do a:

apt-get install php5-gd

and voila, Drupal was running.

Now everything should have been fine and dandy if it hadn’t been for the bluescreens that suddenly started to occur on my EEE-box. After running VirtualBox and Ubuntu Server for a couple of minutes, maybe half an hour, XP decides to just crash. This happened over and over again.

Finding the cause of a bluescreen is never fun but it was clearly due to the VirtualBox setup.

But, hey, I’m in the virtual world here. So, I simply copied the .vdi-file (the file that VirtualBox uses to store the operating system on – it’s like a virtual hard drive) to my MacBook and set up a virtual machine with the vdi-file.

Everything worked as it should, except networking (I’m using hosted networking, making the virutal machine appear just like a third computer on my network – very neat, when it works).

The problem is that, although the environments are similar, the virtual network adapter gets a new MAC address. So, the Ubuntu OS gets confused and can’t find the network adapter. This is easily fixed by simply deleting an autogenerated file:

rm /etc/udev/rules.d/70-persistent-net.rules

and rebooting.

Now I have Ubuntu Server 8.10 running on my MacBook. I don’t have any desktop environment set up, making it rather slim (I use 384MB RAM and the full OS only takes about 1,5GB hard drive space). You probably want something like Webmin to make configuration a bit simpler. Here are instructions for setting it up.

Now, let’s just hope my MacBook doesn’t bluescreen.