Speeding up JavaScript

Ajaxian Dion Almaer announces that Google will make available JavaScript libraries straight from Google.

Whenever I wrote an application that uses one of these frameworks, I would picture a user accessing my application, having 33 copies of prototype.js, and yet downloading yet another one from my site. It would make me squirm. What a waste!

Well done.

Early adopters have fun problems

There's a great post by Dare Obasanjo that points out theat Early Adopters are not the Mass Market. He says (and I agree) that listening to the early adopters is not going to help you in mass market who generally have completely different problems.

Recently I've been devoting time to thinking about what to do when I leave Blue Fountain and head back to Canada - sometime around Christmas. There's lots to think about and the first thing to do was set some boundaries so that I can ignore tempting options that don't fit into those boundaries. One other way of categorising things is dividing into solutions for early adopters and solutions for the mass market.

All I hear all day is stuff about Twitter, Twitter and a bit more Twitter. That's certainly something that's interesting (I'm clearwind btw), but I haven't figured exactly what for yet. At the other end of the spectrum I work with companies who solve everything by emailing around an Excel spreadsheet. These companies run millions and and millions of pounds through these systems, not a care about the bleeding edge.

When I look at this I think that these companies that send everything around via email, work with Excel and so on I see someone who is not an early adopter. I think about improving things and maybe solving say workflow or versioning problems and I think golly: that doesn't sound too interesting. Solving spam problems or trying to solve email attachments? Aargh. That is not where I want to be.

I might not be able to reach the mass market, but I'd rather have fun in the land of early adopters.

End of programming?

For the past few years my fingers have gotten slowly worse from typing so much day in day out. By the end of some days they will ache. I used to go white water kayaking but found with increasing regularity that I was dropping the paddle. I just couldn't get a grip on the paddle anymore. Cycling was fine, but I found that going doing a big hill in cold air would cause pain in my fingers.

Recently I've been working on a project 9-5 (well more than that) that isn't technically challenging but involves writing large amounts of mostly repetitive code. By the end of the day now my fingers hurt and my wrist will start to ache. Scarier than anything the last few days I've woken up in the morning with numb hands, pins and needles in my fingers. At 6.30am as I write this, my fingers ache.

I'm currently looking at where I will be in five years with my fingers and I have to say it isn't looking pretty. I've known my time as programmer was limited and waning (alright I've never been a good programmer, before any wags get at me) but I know my ability to do a lot of typing is coming to a rapid end.

I've installed AntiRSI and off to visit the doctor. In some ways there's some positives to come out of this.

Writing code has never been my skill and this will force me to get away from it. This is something I've known for a while, but quantifying my skill in "getting stuff done" and figuring out where I slot into organisations is a challenge.

Knowing there's a limited amount of time to write code means I have to focus purely on paying the bills. In six months or so I'll be heading back to Canada. There i'll be on my second startup and getting ready for that has been focusing my brain on paying the bills as well. The downside is that my open source work is dropping off to nothing.

But I have to admit I'm quite scared, it feels like I'm sacrificing my future to current work. Essentially I'm scared that my current livelihood looks like it's coming to a rapid end. Time to change.

Open source involvement

Recently we've been interviewing candidates for jobs at Blue Fountain. We are looking for developers and sys. admins willing to do some work on our stuff. Nearly all of our systems are open source, so naturally we are looking for open source developers. Naturally everyone we chat to is very enthusiastic about open source and keen to work in a company that uses it.

And the conversation goes like this (with one notable exception):

Me: are you involved in any open source projects?
Interviewee: not really, what do you mean?
Me: have you contributed code to any open source project?
Interviewee: no
Me: are you on any mailing lists?
Interviewee: no
Me: do you have any open source code I can look at?
Interviewee: no
Me: do you have a blog?
Interviewee: no
Me: ok, let's move on

To me real involvement in a open source project indicates a keen developer one step above everyone else.

Making Google Reader pretty

One thing that's holding me back from using Google Apps is that they are generally damn ugly. You can use Mail.app to pull mail in Gmail down and get a nicer UI. I can pull my calendar down into iCal and get a nice UI as well. But in the end those web UI's are full of far too many buttons and links and just don't thrill me.

I've been using Fluid for my Google Reader and it rocks. I can now just hit RSS in Quicksilver and get my RSS feeds. Using the scripts from userscripts.org I now get: Growl notifications of new posts and a count in the dock of new posts. Today I grabbed this script: http://flingmedia.com/articles/making-google-reader-for-fluid/ and that applies a custom stylesheet. It makes the reader look like the screenshot below. Weeee!

Tidying Page Templates

I know this is old hat, but I still get a fact that I can still run HTML Tidy over my Page Templates and fix up indenting and a few other things. Perhaps it's just because I've seen some horrible Rails templates that are a badly indented and hard to read. Well I've seen a few Page Templates like that, but hey at least I can clean them in one simple bash script:

tidy -i -m -xml $1

Inquisitor acquired by Yahoo, still cheating

Inquisitor is a piece of software that has a bad reputation and its developer doesn't fare much better. It's just been acquired by Yahoo and everyone is reporting that the affiliate links are gone.

Yet it still mangles search results. The search for p2p is the most glaring one. The top result? Dave's other products. Please clean this up Yahoo.

Prototyping in Django

For a while I've been working on a site for a great client of ours. It's a Zope 2 site that uses ZSQLMethods, (Script) Python and ZSQL Methods to pull together a site, it's been around for a long time and working well. Recently we've been adding some functionality to it and I wanted to write some new functionality.

Sadly that does mean manually writing some: SQL, Python and Page Templates. I was just about to start it all off and in the back of my head was toying just importing Django and using its ORM, model and form code from within Zope (would that work, perhaps)?

But for the moment I've just prototyped it all out in Django. It took about one hour to create the models and relations and add in the tests. Testing is quick and easy, the unit tests run nice and quickly. The free UI gives me a quick sanity check that everything is fine.

All I have to do now is spend 4 days translating that prototype into ZSQLMethods and associated stuff. Fortunately I can now steal all the sql from django queries.

Update: this helps.

Login decorator for OpenId

The login decorator for Django looks for a user, as if you'd logged in through the admin interface. That's not what OpenId gives you. For that you'd want something like this:

def login_required(fn):
    def new(*args, **kw):
        request = args[0]
        if request.openid is None:
            return HttpResponseRedirect("/login")
        else:
            return fn(*args, **kw)
    return new  

Then for any views that require OpenId login on them, slap the following before them just like normal:

@login_required

Finally got serious about RSS

After faffing around with many RSS readers over the year, I was watching Duncan Booth use Google Reader one day and said, dammit I get it. It's the keyboard accelerators, pressing space to hop through your posts is easy.

I've now got far too many RSS feeds in it.

iPhone in Canada

One of the many things I'm looking forward to in heading back to Canada around Christmas is that the iPhone should be out in Canada by then. I resisted here because I wasn't going to be around long enough and somehow unlocking and losing some features doesn't appeal.

Then I heard it will be 3G and now GPS? Excellent, 7 months to go and counting. Hopefully Rogers won't cripple me with bills though. Source.

Django miscellany

My colleagues got hit by this issue the other day. It's a definite annoyance, and just for the record here's my version, just on the off chance that os.curdir is different.

import os
this = os.path.dirname(os.path.abspath(__file__))

TEMPLATE_DIRS = (
    "%s/jobs/templates" % this,
)

On other things I integrated django-openid the other day into a Django site and its really nice. It worked really well, although I do have to find a way of altering the templates to go nicely into my Page Templated site. I do have to put in some work to the login screen. I have to explain the OpenId login, without making it too daunting and provide an easy way to create an account.

Finally I had a quick play with Google maps. Want to show a map based on a UK postcode? How about:

          var postcode = "L7 9NJ";
          if (postcode != "") {
              if (GBrowserIsCompatible()) {
                var map = new GMap2(mapnode);
                var lookup = new GClientGeocoder();
                lookup.setBaseCountryCode('uk');            
                map.addControl(new GSmallMapControl());                
                lookup.getLatLng(postcode, function(point){
                    map.setCenter(point, 12);
                });
              }
          }

Yay. Not the encoding has to done with setBaseCountryCode as UK, not .co.uk or gb. Otherwise it centres on Germany, not Liverpool.

Citrix woes

Today was a frustrating day as Citrix kept messing me around. I found that if I ran Windows in a VMWare on my Mac, the client there ran much better. The only problem was finding the Windows client. So I've got an .ica file, you need to run. So you end up at the following page, where next?

One easy place? Yeah right, it's not obvious or easy. Answer it's Citrix XenApp (the new name for Presentation Server). As someone who doesn't know what all the product names mean, there's no way for me to know what the hell to do next.