Annoyances and things like them

It seems to have been a week of minor annoyances. Particularly with regard to this website. For some bizarre and as yet unknown reason the VM upon which this site resides keeps losing track of time, by up to ten hours. The upshot of this – and I haven’t been able to track down exactly why yet but it’s either Django’s DateTimeFields or, more likely, PostgreSQL’s datetime handling – is that every time you try to access a blog post by date you get a big fat 404. I’m starting to get the distinct feeling that I’m going to have to re-image the machine at some point, but I’m loathe to do that unless there’s no way to fix whatever it is that’s going wrong.

Other minor annoyances have mostly been self-related. I’ve spent most of the week working on some cool new features for Launchpad but, due to the fact that we’re in code freeze at the moment because this is Launchpad 2.2.4 release week, I haven’t been able to land anything. Add to that the usual frustration that comes with doing anything that requires a particularly intricate piece of UI work and you find me feeling not unlike I’ve repeatedly smashing myself on the head with a potato masher.

On the other hand, doing all this cool Launchpad Javascript work has given me a new appreciation for just how much fun Javascript can be when done right. I’ve tended to avoid Javascript most of the time because I found it non-intuitive and, coming from a background of object-oriented languages, a bit weird. You see, Javascript’s a prototype-based language, which when observed in a certain way makes it look as though the developers were adding object orientation as an afterthought and, worse, going the wrong way about doing it.

But whether that’s true or not (and I have no idea whether it is) the simple fact is that you can’t observe Javascript as an object-oriented language because it isn’t one, at least not in the purest sense. If you lose that particular conceit and actually treat it as what it is then you fairly quickly realise that:

  • Javascript is extremely good at what it does – that’s why it’s been around for so long and hasn’t been superseded by anything remotely convincing (and don’t go saying Flash here because if you do I’ll reach into the internet and slap you).
  • Most of the problems with Javascript are due to inconsistencies in different browsers’ JS engines – which is why doing anything with IE7 and Firefox is only marginally less painful that hitting yourself in the nuts with a lump hammer.

Anyway, all this fooling around with Javascript, fun as it’s been, has led me to thinking about how to include it in my blog engine (because if there’s technology you’ve no choice but to use it, right? Yeah, that’s going to end well). I’ve got some ideas – many of which include using the code provided by the awesome LAZR-JS library, which in turn uses YUI 3. I wasn’t a fan of YUI to begin with – it’s big and complicated and more heavyweight than I need for most things – but after two weeks of solid YUI work I’ve come to really like it.

So, watch this space for news of things that I’m trying to do. You probably won’t notice them at first because high on my list of things to do is write a better interface for blogging rather than using the existing Django admin interface. Whilst django.contrib.admin is awesome in a lot of ways it’s not the most user friendly thing ever (I’m writing this in gvim using It’s All Text for a reason you know), so I aim to improve it to the point where it’s on a par with the latest WordPress UI (not that I’m setting the bar high or anything).

But before that, I have to do other things, which I’ll talk about in a separate post. In the meantime, if you’re looking to do interesting things with Javascript, take a look at LAZR-JS. I can’t guarantee it’ll be useful, but it may well be instructive.