Posts

Sessions must die

Many e-commerce sites have session timeouts. Dawdle too long between the moment you enter the site and the moment you actually want to buy something, and you will be presented with an unpleasant message. The words “session timeout” will be there, drowned in a sea of technobabble, and you will have to restart from scratch. Using a bookmark will often have the same effect.

At this point, you may well be tempted to go shop elsewhere; indeed, it is the only principled response to such blatant contempt for customers. You will notice that successful sites like Amazon.com do not make their customers suffer such hassles – once you’re in, you are in, whether you have to take a lunch break or not. I don’t buy the security argument either – there is nothing sensitive about the contents of a cart, security belongs at checkout time, not browse time.

The reason why such crimes against usability are perpetrated is that business requirements too often take a back seat to technical expediency, paradoxically most often due to lack of technical competence. Many web development environments keep track of what you do on a website, the contents of your cart, and so on, in “sessions”, portions of memory that are set aside for this book-keeping purpose. They cannot be set aside forever, and must be purged to make room for new customers.

The tyro programmer will leave the default policy in place, which is to dump the session altogether and place the burden of recovering state on the customer. More experienced programmers will implement the session mechanism in a database so it can be kept almost indefinitely. In an era where disk space costs a dollar or two per gigabyte, and a desktop computer has enough processing power to crunch tens of thousands of transactions per minute, there is no justification for not doing so.

Richart Chocolates opens a San Francisco store

This morning, while walking to work, I noticed a brand new Richart Chocolates shop on Sutter street. Apparently it opened a month ago.

Richart is a Paris chocolatier who pioneered ornately decorated chocolate palets (their byline used to be “Richart - Art et Chocolat”) with daring combinations of tastes.

They are as overpriced as in Paris, but make for a classy gift (many French companies send out Richart chocolates around Christmas as corporate gifts).

Update (2013-04-20):

They closed some time ago.

Homo trium literarum

Homo trium literarum (man of three letters) is a synonym for thief in the 1922 edition of Roget’s thesaurus. The latin word for thief is fur, hence the pedantic periphrase. The only record I find of it ever being used was by Wedderburn, the British Solicitor-General against Benjamin Franklin, in front of the Privy Council:

I hope, my Lords, he exclaimed, with thundering voice and vehement beating of his fist on the cushion before him – I hope, my Lords, you will mark and brand the man, for the honour of this country, of Europe, and of mankind… He has forfeited all the respect of societies and of men. Into what companies will he hereafter go with an unembarrassed face, or the honest intrepidity of virtue? Men will watch him with a jealous eye; they will hide their papers from him, and lock up their escritoirs. He will henceforth esteem it a libel to be called a man of letters; homo trium literarum (i.e., fur, thief!).

Franklin had made public letters from the governor of Massachusetts, where the latter urged the British government to take draconian measures against the colonists.

That said, with so many CEOs and CFOs implicated in corporate embezzlement, this quaint expression might be overdue for a revival…

Chocoholics rejoice!

Berkeley-based chocolatier Scharffen-Berger finally yielded to customer demand and introduced milk chocolate to their line, much to the gnashing of teeth of dark chocolate snobs nationwide, no doubt. According to the salesman at Fog City News, where I bought my bar, it has been available for two weeks now, even though the company’s own website apparently makes no mention of it.

It has a high cocoa content (41%), and has the brand’s distinctive rich flavor and long finish, although I find it a little bit too sweet. My preferred brand of premium milk chocolate remains Michel Cluizel, with their amazing 50% Java cocoa milk chocolate bars.

Making Mac OS X sleep from the command line

In a previous article, I showed how to use Wake-on-LAN to remotely wake a sleeping Mac. I often log on to my home Mac remotely using SSH via my Solaris home server, waking it in the process. With the default settings, the machine will go back to sleep after a few minutes of inactivity.

I recently changed my system defaults to never make the machine sleep, however, because OS X’s sleep functionality will cause the system to sleep even when active Unix jobs are running, like long compiles. That is because the OS has no way of distinguishing between live applications and background daemons. There does not seem to be a command-line utility allowing the user to put the machine to sleep, however, so I quickly wrote one, using Apple Q&A 1134 as a starting point.

You can download the command and source code (including a Panther binary) here: macsleep-1.0.tar.gz (Tiger and Intel users, see below for 1.1)

Restrictions: this command will only work if the user ID it is being executed from matches the user ID of the currently logged on user (not a problem for me because I have auto-logon enabled).

Update (2003-12-06):

Mike Harris reports another similar utility already exists, SleepNow.

Update (2005-11-30):

Kalvis Jansons suggests using AppleScript and the System Events application introduced in 10.3 to achieve the same results, using the following shell script:

#!/bin/bash
osascript << EOT
tell application "System Events"
     sleep
end
EOT

Update (2006-04-02):

I have rebuilt the program for Tiger in both Intel and PowerPC flavors, as well as a universal binary. The new version is macsleep-1.1.tar.gz. The source code itself is unchanged.