Archive for October, 2006

26 Oct 2006

by Noel

Paperback iPod

£9.95 RRP for an iPod? Maybe.

The iPod has also benefited from a more crowded world. The academic literature surrounding personal stereos frequently references the 19th-century German sociologist Georg Simmel, who was one of the first to detail the acute horror of the urban commute:

Before the development of buses, railroads and trams in the nineteenth century, people had never been in a position of having to look at one another for long minutes or even hours without speaking to one another.

Europeans responded to the new reality by keeping silent and expecting the courtesy of not being spoken to. That strategy wasn’t always successful. They also started reading. Books, in effect, were the original iPods.

Has the iPod changed anything? – By Michael Agger – Slate Magazine

Acute horror? That’s a bit strong. Otherwise an interesting point. Books are certainly cheaper, and they come in a wider range of colours.

Posted in Fun | Comments Off on Paperback iPod

25 Oct 2006

by Noel

Firefox 2.0 Review

I’m editing this post using the
Performancing extension for the new Firefox 2.0 browser. Being a web whore I simply had to download the latest version of Firefox as soon as it was out.

If anything, Firefox 2.0 is proof that the browser is now a stable product. The changes from 1.5 are incremental. There is nothing that particularly excites me on the user end.

From the point of view of a developer, it’s a different story. Javascript 1.7 continues the evolution of Javascript from a hairball to a language you wouldn’t be embarassed to take to school to meet your Professors. Array comprehensions, proper lexical scoping, and generators are the main features. Support for the WhatWG client-side session and persistent store adds more possibilities for storing continuations on the client-side. I’m interested to see that their motivating example is exactly the same as the one Shriram uses when proselytizing continuations (the “Orbitz bug”).

Of course, to use most of this you’re stuck with Firefox. However, as Firefox evolves further from the functionality offered by IE it becomes more compelling as a platform is its own right. Somebrowser stats show encouraging numbers of people are using Firefox. Give it a few years and IE support may legitimately be optional.

Posted in Web development | Comments Off on Firefox 2.0 Review

11 Oct 2006

by Noel

Debugging File Handle Exhaustion

Dave has been working like a maniac to switch our database code over from SQLite to PostgreSQL. PostgreSQL has two main advantages: it is much faster, and we can open up ODBC connections to the database for other uses that don’t require a web interface. The change is now complete, however it hasn’t been without some difficulties. One problem that bit us was running out of file handles. If you ever have a similar problem, here is how to debug it.

On Linux the /proc filesystem reflects a great many kernel resources. The particularly interesting directories for our purposes are:

  • The files file-nr and file-max in /proc/sys/fs.
  • The per process directories keyed by process ID

The first thing to check is the value of /proc/sys/fs/file-max, which is the maximum number of file handles allowed on your system. This shouldn’t be a problem, but just ensure it isn’t something ridiculously small. On our system we get:

$ cat /proc/sys/fs/file-max
89367

That should be plenty under any reasonable usage, but we can check how many file handles are open by reading the value of/proc/sys/fs/file-nr. On our system this is:

$ cat /proc/sys/fs/file-nr
920 0 89367

This first number is the number of file handles in use. Definitely no problem there. It must be that a process is exceeding the per-process limit on file handles. In our setup this could be either PostgreSQL or MzScheme. We need the process IDs to find out how many handles each is using.

$ ps -A | grep postmaster
12936 ? 00:00:00 postmaster
12937 ? 00:00:00 postmaster
12939 ? 00:00:00 postmaster
12940 ? 00:00:00 postmaster
12941 ? 00:00:00 postmaster
$ ps -A | grep mzscheme
20382 ? 00:00:26 mzscheme

We can see how many handles are in use by looking in the directory for each process ID. For example, for the first PostgeSQL process:

$ sudo ls -l /proc/12936/fd/ | wc -l
4

So that PostgreSQL process is using 4 handles. The other processes are using similar numbers. So it must be our MzScheme process that is using up all the handles. We check that in a similar way, and the result is:

$ sudo ls -l /proc/20382/fd/ | grep socket | wc -l
193

Looks like we’ve found our culprit.

Posted in Web development | Comments Off on Debugging File Handle Exhaustion

10 Oct 2006

by Noel

Think Fast and You’ll Feel Better For It

Want to feel better? Think fast. A study shows that people forced to think quickly feel better:

[Emily] Pronin and … Daniel Wegner … experimentally manipulated the pace at which participants read a series of statements … The researchers found that regardless of the content of the statements, people felt happier, more energetic, more creative, more powerful, and more grandiose when they read the statements at a fast rather than a slow pace.

This type of behaviour is very similar to manic behaviour, so whether it is beneficial in the long term in debatable, but it’s at least an interesting result. Perhaps it explains why so many of us put off work till the last minute — we want the rush of working at a fast pace. At least we now have a plausible argument for such behaviour!

Posted in General | Comments Off on Think Fast and You’ll Feel Better For It