There a lots of great ways to improve your desktop experience in Linux. If the default stylings of GNOME or KDE just aren’t your cup of tea, or you really want a Mac but can’t afford one like me, then read on.

Vista, really?

I’m first to admit, and rather shamelessly, that I really like a bit of eye candy in an OS, especially 3D candy. For all it’s underwhelming glory, I do quite enjoy the shinyness of Vista. If I was really going to make the total conversion over to Linux once and for all, I was really going to miss those effects. Unfortunately for Vista, and consequently the reason I’m trying Linux, is that it’s a bit like a photo of a hooker; looks good, but doesn’t do much. But I digress.

Turning on a bit of visual flair in Ubuntu requires that you have a graphics card with some form of graphics acceleration available. My faithful laptop has an absolute clanger of a video card, an ATI Radeon Mobility X1400 to be precise. I can almost hear you stifling a yawn – it really does suck that much – or so I thought…

Driver dramas

Being OSS, Ubuntu doesn’t include proprietary drivers in the distribution due to the license restrictions many of the EULAs impose. This means that by default you’re using an open source equivalent driver for your hardware. This is fine for every day 2D office related tasks. This won’t do with what we’re proposing however as they don’t support many of the advanced features your graphics card offers – we’re gonna need those. Now before you break out in a cold sweat and start fretting about compiling, editing X config files or anything silly like that, take a deep breath. EnvyNG is a great tool that takes care of all the driver updates for you. It detects and installs the correct proprietary video card driver for you in a matter of minutes. Easy huh?

Mac on a mortgage

Mac4Lin Desktop

After a reboot you should now be ready to turn on advanced desktop effects (Compiz-Fusion for those in the know). This will enable all kinds of funky effects on your desktop like wobbly windows, 3D cube desktop selection etc.

Impressive eh? Well this is where it gets really fun. Head on over to SourceForge and grab all the latest files from the Mac4Lin project. This should include everything you need, including instructions on how you tweak your desktop till it’s damn near unrecognisable as Linux. I’m not real sure how Steve Jobs would feel if he saw this.

One thing I’m really impressed with is the speed at which all these effects run. Under Vista one could have been forgiven for thinking that Dell had given me the worst graphics card known to man. In fact I’ve always been slighly disappointed with my laptop’s performance until now. Ubuntu runs like a scalded cat on a hot tin roof, and I’m smiling from ear to ear about it.

Sorry Vista, looks like another nail in your already sealed coffin.

Click here For a more in depth look at more things you can do in Hardy Heron.


I had a question from one of my coworkers a few weeks back about some basic OO techniques in JavaScript. Seeing as this is a key question from most people getting into JS from a classical OO background I thought I might just share a powerful little concept called the “Module Pattern” to get you all started.

The module pattern (first identified by Douglas Crockford) exploits the fact that JS only has one kind of scope: function scope. Forget blocks, or any other kind of scope resoultion techniques you might know from other programming languages – it ain’t here. JS allows you create functions within functions (i.e. nest them), and hence function scope is also nested. Any nested function can see anything in the parent function and so on up the tree. It does this through the use of closures which is far to big a topic for this short article, you’ll just have to accept the fact that it works.

Okay so why is this important? Well JS has a major flaw (some would say feature) in that it doesn’t have any sort of PPP (public, private, protected) functionality. Everything is public. Everything. So how do we achieve any sort of meaningful encapsulation you ask? Isn’t information hiding critical to the design principle “open for extension, closed for modification”? Well the module pattern is one solution to this problem.

Here’s how it works:

MyObject = function() {

    var myPrivateField;

    function myPrivateMethod(someValue) {
        // look ma I'm a closure
        myPrivateField = someValue;

        // assigning a private member to a public one
        pub.myPublicField = myPrivateField; 

        return "I'm a private method";

     * this is where we define the object's public
     * interface using another bit of JS
     * magic: the object literal
    var pub = {
        myPublicField: null,

        myPublicMethod: function() {
            return "Hello World!";

        myPrivateMethodWrapper: function(someValue) {
            // calling a private/hidden method
            return myPrivateMethod(someValue);

    // here we override the constructor's return value
    // with our public interface object
    return pub;


var o = new MyObject();
o.myPrivateMethod();   // wont work it's private/hidden
o.myPublicMethod();    // works!

I know that this will completely weird out some of you OO purists, but when JS is the only thing you’ve got (e.g. in the browser) it’s a pretty useful technique for gaining some sort of PPP control over your objects API.


Well it looks like Canonical finally hit some of the right stuff with their latest incarnation of the Debian based Ubuntu: Hardy Heron (8.04).

A couple of weeks back I installed Ubuntu Linux in a dual boot configuration on my laptop along side Vista after getting a good review from a friend about it. Some of you might remember that I’ve tried to do this before with prior versions of Ubuntu but been met with stiff oposition from my Dell laptop’s stubborn drivers. In fact it damn near killed my laptop due to a faulty ACPI implementation that caused my processor to cook itself. Not a great day at the office really.

Anyway my experiences lately have been chalk and cheese. The install process was so straightforward, fast and easy that I actually managed to install the distro on the bus on the way to work (I’m a dork and I make no apologies for it). All my applications and drivers installed fine, and there was no baked chips to speak of. It just worked. In fact I think it was easier and faster to install that Windows – very nice.

It looks like Linux on the laptop has come a long way.

Web based IM clients are seem to be the flavour of the month at the moment. Gmail has had one for a little while now and more recently Facebook has added this to their already impressive stable of features. These are really cool, and rip all over the old form based chat rooms, but how do they do it without using any plugins, flash or the dreaded ActiveX componets?

Typically they use a combination of things:


At the heart of the system is a Jabber IM server such as Openfire. The server performs real-time communications with clients via the Extensible Messaging and Presence Protocol (XMPP). XMPP is an open XML based protocol that works on a concept similar to email. That is, anyone with a server open to the internet can create a Jabber IM server and become part of the wider decentralized IM network.

It’s worth noting that XMPP places no restrictions whatsoever on what the client should be. Much of the effort and complexity of developing a Jabber IM network goes into the server itself. Given that there are already a number of perfectly good OSS Jabber servers out there it makes the Web Developers job relatively easy.


Gmail and Facebook use clients written in JavaScript (no plugins!) which communicates can communicate either directly with the server, or via a server-side proxy. There are generally two accepted methods communicating with the server from the browser; HTTP binding (BOSH) or HTTP polling (now deprecated).

Binding universally preferred as it virtually eliminates the number of round trips to the server (the majority of which yield no result) by using keep-alives to hold connections open to the server. What does that all mean? It means that the Jabber server is able to push messages back down to the browser rather than the client checking at set intervals for new messages. Cool huh? The only drawback seems to be that you need to be able to manage a large number of open connections concurrently. The fact that Openfire is built on Jetty helps because of their use of the Continuation Pattern to suspend blocked polling requests and free the worker thread.

Going direct

Communicating with the jabber server directly saves a lot a lot of hassle as opposed to proxying the requests via a servlet or something similar. It also avoids the problem of having to move your existing web server over to something more scalable like Jetty. But how do you do this when JavaScript can only make requests to its own domain? Well if you’re using Apache you’re in luck! Mod_rewrite is your friend here and adding the following to your http.conf file should have to talking to your Jabber servers http-bind service in no time at all:

<VirtualHost *:80>
    DocumentRoot /var/www
    AddDefaultCharset UTF-8
    RewriteEngine On
    RewriteRule ^/http-bind/ [P]

Viola! All requests to will be automatically forwarded to your chat server.

Talking XMPP

Okay so we’ve solved the cross-domain request problem, but how to we talk to the server. You’re probably asking yourself “Do I now have to actually parse all those XML messages myself in JavaScript?”. Fortunately no. JSJaC is a freely available, washed in the blood open source GPL JavaScript library, that handles all those icky details for you. It works on an event based model so you can just register your event handler callback functions, and get on with writing your very own IM client.

Speaking of which I’m going to do just that right now!

Free File Hosting

May 26, 2008

Today I thought I’d put up a few Joomla! extensions that I’ve been working on over the past few days. I thought I could just upload them directly to wordpress but it I can only upload media stuff, if I want to post anything else I have to host them elsewhere. Given that my hosting arrangement has just expired and I’m not willing to renew it I set out to try find a free file hosting site.

As it turns out it was surprisingly easy to find a good one. For now I’ve got all my stuff being hosted by Media Fire which seems like a pretty sweet deal. They’ve got a really clean no fuss UI (sprinkled with just the right amount of AJAX to make things easier) and it’s all pretty straight forward. Nice work guys.