Read on and leave a comment
or return to our portfolio.

5 Nov 2006

by Noel

Firefox 2.0 Find Again

Incremental search is one great feature in the Firefox 1.x series. Press /, or simply start typing, and Firefox searches as you type. Firefox 2.0 has the same feature, except it is missing the “Find Next” and “Find Previous” buttons. Here are three ways you can get this functionality back:

  1. Press F3 to find next, and Shift-F3 to find previous
  2. Start your search by pressing Control-F (Command-F on OS X).
  3. Muck around with your Firefox configuration to turn on the buttons

Mozilla call this feature Find As You Type. Follow that link and you’ll find a few more usage tips.

Posted in General | Comments Off on Firefox 2.0 Find Again

2 Nov 2006

by Noel

Air Taxis, Constraint Solving, and Computing Power

This week’s In Business covered the fascinating industry of air taxis. An air taxi is exactly what the name suggests: an airplane that takes you where you want to go, when you want to go. Now clearly the infrastructure required for air taxis is a bit more expensive than that for a normal taxi, so answering the question “how do you make money?” is quite involved. The best answer was provided by DayJet. Essentially they run a massive constraint solving system, juggling aircraft, airports, and travellers, and they charge you by how difficult you make the constraints. If you demand to travel in a small window of time it is going to be difficult for them to find other passengers for the plane, so you pay more. If you don’t particularly care when you travel, or how long the journey takes, then they might be able to fill the plane, or make a detour to pick up other customers.  Hence you pay less.  This is an elegant solution to a difficult problem, and I’m struck that this is the type of solution, indeed the type of industry, that can only exist because of information technology. Even five years ago I doubt computer power was cheap enough to make this feasible.

Now just don’t get me started about the environmental problems air taxis would cause. That’s a problem there is no easy or elegant solution for.

Posted in Business | Comments Off on Air Taxis, Constraint Solving, and Computing Power

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

14 Sep 2006

by Noel

CMS software for QMUL

We “went live” today with our second project for Queen Mary, University of London: a content management system for publishing course and staff homepages.

The system is simple and intuitive: each homepage consists of a single page of HTML, and doubles as an online filestore. Members of staff can upload files such as lecture notes and slides, and visitors to the page can download them simply by clicking on a hyperlink. We use the metaphor of attachments to relate this back to the familiar process of writing an email.

The main page editor screen is split into two halves: a WYSIWYG HTML editor (we used TinyMCE) and a list of attachments (complete with controls for uploading, renaming and deleting files). A separate management interface allows administrative staff to set up homepages for new courses and members of staff, assign permissions for who can edit what, and flag external pages that are held off-site and not maintained with our software.

All of this new functionality is integrated into our existing software for registering students on courses. Members of staff access all their pages through a control panel that displays only the information they need, and everything is nicely integrated with QMUL’s IDCheck single sign-on service.

Behind the scenes, the code for the CMS is based on a prototype for our new component-oriented web UI library, LyluxUI. We still have a way to go before the code is ready for open release, but it will eventually be available for public consumption alongside our other open source libraries, Snooze and Unlib.

Posted in Business | Comments Off on CMS software for QMUL

13 Sep 2006

by Noel

A live hash-table using XML-RPC

I received a question the other day about using our XML-RPC library, and thought I’d put the response here. It’s still a simple example, but it illustrates one or two things. You must be running PLT Scheme 352.5 or greater for this to work, as we’re using some nifty new features that make things more stable.

I’m going to implement a “live hash-table”. By this, I mean I’m going to have a PLT Scheme hash-table that I can access from anywhere via XML-RPC. I created a “testing” directory in in the “servlets” directory of my server. Inside of that “testing” directory, I created a servlet called “live-hash.ss”. It looks like this:

(module live-hash mzscheme

(require
;; For the 'xmlrpc-server' and 'add-handler' functions
   (planet "xmlrpc-module-servlet.ss"
("schematics" "xmlrpc.plt" 1 3))
;; For 'raise-exn:xmlrpc'
   (planet "base.ss"
("schematics" "xmlrpc.plt" 1 3))
)

(provide interface-version manager timeout start)

;; I'm using 'equal here so that strings can be
  ;; used as hashtable keys.
  (define table (make-hash-table 'equal))

;; CONTRACT
  ;; insert : (U string number) any -> bool
  ;; PURPOSE
  ;; The 'insert' method will insert a value into the
  ;; hashtable, and return #t. We return a boolean in all
  ;; casees because XML-RPC has no natural coercion for the
  ;; #<void> value.
  (define (insert key value)
(if (or (string? key)
(number? key))
(begin (hash-table-put! table key value) #t)
#f))

;; CONTRACT
  ;; get : (U string number) -> any
  ;; PURPOSE
  ;; The 'get' method returns a value from the hashtable, or
  ;; raises an XML-RPC fault.
  (define (get key)
(hash-table-get
table key
(lambda ()
(raise-exn:xmlrpc
(format "No value in hash for key '~a'" key))
)))

;; Make 'insert' and 'get' available to the
  ;; outside world.
  (add-handler 'insert insert)
(add-handler 'get get)

)

If you can execute this in the “module” language of DrScheme and not get any errors, there’s a good chance that it will run under the webserver. At least, that’s a first step.

On the client side, I have some code that declares that the PLT webserver running on my local machine (with the “live-hash.ss” servlet) is an XML-RPC endpoint. I then map two local functions, “ins” and “get” to the remote methods provided by the server. Lastly, I do a quick test: I insert some data, and then request it back.

The client-side looks like:

(module live-hash-client mzscheme

(require (planet "xmlrpc.ss"
("schematics" "xmlrpc.plt" 1 3)))

;; Declare where the endpoint for this XML-RPC call is
  (define local (xmlrpc-server
"localhost"
8080
"servlets/testing/live-hash.ss"))

;; Define the mappings from local method calls to remove
  ;; method calls. In this case, the local name "ins" is bound
  ;; to the method "insert" running on the server.
  (define ins (local 'insert))
(define get (local 'get))

;; Try inserting some data
  (for-each (lambda (key val)
(ins key val))
'(1 2 3 4 5)
'(a b c d e))

;; Now, try retrieving it
  (for-each (lambda (key)
(printf "K: ~a V: ~a~n" key (get key)))
'(1 2 3 4 5))

)

Again, I’m working under the “module” language here.

If all goes well, you can run the client-side, and see the data go round-trip to the server. Well, you can’t exactly “see” it, but you can guess that it goes round-trip to the server.

Welcome to DrScheme, version 352.5-svn28aug2006.
Language: (module ...).
K: 1 V: a
K: 2 V: b
K: 3 V: c
K: 4 V: d
K: 5 V: e

That’s perhaps not a lot to be getting on with; there’s more documentation in the “doc.txt” file included in the distribution. And it’s not quite as cool as Tony’s explorations with Erlang, but… well, this library has been around for a while, and occasionally, someone finds a use for it.

(Pretty-printing of code to HTML made possible by Paste Scheme at scheme.dk. Woot.)

Posted in Code | Comments Off on A live hash-table using XML-RPC

23 Aug 2006

by Noel

Unlib and IDCheck Release

Two code releases today: a new version of Unlib, and the first release of our library for interacting with the IDCheck single sign-on system (say that ten times quickly).

Posted in Code | Comments Off on Unlib and IDCheck Release

19 Aug 2006

by Noel

Exit Strategy, Internet Style

Investors in a startup always want to know how the startup is going to get their money back — their exit strategy. “Get bought by Google/Yahoo/Microsoft” is a pretty common one in the Internet world. One I’ve never heard is “sell the company’s assets on Ebay”. Well, that’s exactly what Kiko are doing. Bidding starts at US$50’000. Very appropriate, I must say!

Posted in Business | Comments Off on Exit Strategy, Internet Style