Comic-Con 2008 photos

October 29, 2008
0 comments Misc. links

Comic-Con 2008 photos I'm not a comic book kinda guy at all and I don't know who half of these costumes are supposed to be but it's nevertheless very impressive. Looking through the thumbnails you spot a couple of people who seem to take it very seriously but a large majority seem to just enjoy themselves. Just goes to show that people always like to dress up.

Django vs. Java

October 25, 2008
1 comment Django

From the django-users mailinglist which I'm becoming more and more helpful in:


> Could you share approximately how big your project is? I know it's
> hard to find a real measure for this, but how about number of database
> tables?

A project I worked on over the summer used a Database that was 130
tables, and getting 1gb updates every 2 minutes. I was witting a new
web app to do calculations on the data and the company wanted to use
Java since thats what they knew best and had spend huge amounts of
money (1 mil +) to support with Sun Servers, and such. But I knew
python and django would be a better fit for this particular app, but
the boss wouldnt listen. So we had 10 Developers working on the Java
version (Including me) and over 3 months we got it about 85% done,
though it had no unit tests. During the same three months, I worked on
my own time after work and basically had no life for the whole time, I
was able to get the web app 100% complete with unit tests. That
convinced my boss that Django was a good fit.

The site is an internal app that I cannot give access to (And I
actually had to get permission to give what info I have), but I can
say that Django is a suitable framework for what you are looking for. 

Christ! 10 developers and no unit test!? Someone should remind them that you don't write unit tests for your bosses pleasure but for your own sanity and productivity.

I know that this quote is totally unscientific since Dj, as he says, can't back it up but it's a story interesting enough.

Flash advert hell

October 24, 2008
1 comment Web development

Flash advert hell I actually don't mind a bit of adverts on websites but sometimes it just gets too much. On this page I couldn't even read the text since as I scroll down the huge ad over the text scrolls with the page.

Feels greedy like they've just thrown more and more ads in without thinking about the original design.

World Plone Day here in London, England

October 21, 2008
0 comments Plone

On the 7th of November my company, Fry-IT is hosting the London arm of the World Plone Day in our office. It's basically an event for Plone developers, Plone companies and other people interested in Plone to meet up and promote or learn or share something about Plone. To quote the "FAQ":

"What is the goal of the World Plone Day?
The World Plone Day (WPD) is a worldwide event. Our goal is to promote and educate the worldwide public about of the benefits of using Plone in education, government, ngos, and in business."

The "invite" is here. I'm really looking forward to meeting everybody and put faces to people whose blogs and mailing lists posts I read. My colleague Lukasz has a nice map to our office and I recommend that you contact him to say you're coming.

Why bother with MySQL...

October 9, 2008
2 comments Linux

...over PostgreSQL? I've just read through this document:MySQL vs PostgreSQL and it's obvious paragraph after paragraph that PostgreSQL is the better database. Performance, features and community are all in PostgreSQL's favor. There is almost nothing in MySQL's favor apart from obscure things like faster count(*) (without conditionals) and built in replication support. In the last two weeks I've also had the great fortune of playing with full textindexing in both MySQL and PostgreSQL and again, MySQL sucks ass and PostgreSQL (8.3) is really impressive and fast. (I've used both databases quite extensively over the past 8 years as a web developer)

I once heard that Google uses MySQL for its user database with a custom built transaction machine. And I read that Google engineers had donated some great code to the MySQL project. But why do they bother? What do they know that other engineers don't? And why is MySQL so popular with cheap stack-em-high LAMP hosting sites?

I do understand that PostgreSQL came off a bad start 5 years ago(ish) when it didn't support Windows which meant that newbies had to use MySQL and that stigma is still lingering but that was a very long time ago.

I guess it takes a lot of convincing to switch from one technology to another once you've set your mind on something. That's why we're human. A proof of this is shown if you scroll down to the bottom of this page there's a little simple survey and despite being on a long article with objective convincing arguments that PostgreSQL is better MySQL is doing quite well. Why?

When '_properties' gets stuck as a persistent attribute

October 1, 2008
1 comment Zope

Doing some on-site consulting on an old Zope CMS that has been developed by many different developers over many years. It's pretty good and has lots of powerful features but over the years certain things have been allowed to slip. One problem was that you couldn't click the "Properties" tab. The reason was that it was trying to fetch properties that didn't exist anymore. What had happened was that the class attribute _properties (which is used by the "Properties" tab in the ZMI) had been stored as a persistent attribute. Here's how to solve that:


def manage_fixPropertiesProblem(self):
    """ fix so _properties becomes a class attribute instead """
    if '_properties' in self.__dict__.keys():
        del self._properties

    return "Awesome!"

V8 < TraceMonkey < SquirrelFish

September 23, 2008
0 comments Web development

V8 < TraceMonkey < SquirrelFish When V8 was announced to the world jointly with the launch of Google Chrome there was a lot of buzz about how fast it was.

Then, the guru of Javascript, John Resig couldn't hold back his announcement about Tracemonkey and how it was faster than V8

Now there's a third one that apparently beats them all: SquirrelFish Extreme

"As you can see, SquirrelFish Extreme is 36% faster than V8, and 55% faster than TraceMonkey."

Personally I take all of these things with a shovel of salt since what matters isn't how fast it can compute raw Javascript code but how well it all works together with the browser and the browser's graphic routines and stuff and most importantly how the DOM tree is updated by the Javascript instructions.

Closing note; the most important thing is that there's something happening and this will mean that Javascript becomes more and more reliable for web developers and not just reliable but also faster so apps like Google spreadsheet might one day become usable. To quote John Resig on his closing notes:

"I fully expect to see more, massive, projects being written in JavaScript. Projects that expect the performance gains that we're starting to see. Applications that are number-heavy (like image manipulation) or object-heavy (like relational object structures)."

The importance of env (and how it works with virtualenv)

September 18, 2008
8 comments Python

I have for a long time wondered why I'm supposed to use this in the top of my executable python files:


#!/usr/bin/env python

Today I figured out why.

The alternative, which you see a lot around is something like this:


#!/usr/bin/python

Here's why it's better to use env rather than the direct path to the executable: virtualenv. Perhaps there are plenty of other reasons the Linux experts can teach me but this is now my first obvious benefit of doing it the way I'm supposed to do it.

If you create a virtualenv, enter it and activate it so that writing:


$ python 

starts the python executable of the virtual environment, then this will be respected if you use the env shebang header. Good to know.

The stupidity of 'id' as a variable name (or stupidity of me)

September 16, 2008
3 comments Python

Both in Zope2 and in Django you need to work with attributes called id. This is a shame since it's such a huge pitfall. Despite having done Python programming for so many years I today fell into this pitfall twice!! The pitfall is that id is a builtin function, not a suitable variable name. The reason is that I was changing a complex app to use something called the UUID as the indentifier instead of the ID which happened to be a name of a primary key in a table.

This meant lots of changes and I tested and tested and kept getting really strange errors. I took the whole thing apart and put it back together when I discovered my error of checking if variable id was set or not. id, if undefined, defaults to the builtin function id() which will always return true on bool(id).

It's been a long day. I'm going home. Two newbie mistakes in one programming session. I'm sure I'm not the only one who's been trapped by this.