linux and windows tips, mathematics, and some recipes

Friday, March 31, 2006

Daylight Saving Time - Crime, Larks, and Energy

This Sunday, clocks go forward at 2:00am in most of the U.S. The biannual clock-changing has been marked by controvery since it was first conceived by Benjamin Franklin in 1784. Many late-night revelers feel cheated of an hour's drinking time. This has lead to Time Change Saturday riots in Athens Ohio, witnessing skirmishes between armed police and rowdy students.

However, the general trend is that Daylight Saving Time reduces crime. One study in Washington DC found a 10 to 13 per cent decrease in violent crime. This is due to lighter evenings, making crime more detectable.

Unfortunately, there is a downside for 'larks' — those who naturally wake early. They are genetically more aware of light and will have a harder time adjusting.

Finally, this is the last year that clocks 'spring forward' on the first Sunday of April. From 2007, the time change will occur on the second Sunday of March, with a corresponding alteration in the Fall. This is in accordance with the Energy Policy Act of 2005, which hopes to give a 1 to 2 per cent saving in household energy use by reducing the need for electric lighting in the evenings.

Thursday, March 09, 2006

A Reformed Linux Zealot Speaks Out

They say there's nothing worse than a reformed smoker. Perhaps that's true, but it's a great thing to be a reformed Linux Zealot. Actually, not using Linux is akin to smoking and drinking all you want and generally having a big party (note this is a simile - I don't smoke at all and drink only in moderation).

I take this opportunity to share a tale with my Linux brethren in the hopes that I may lead you to the land of Easy Computing in far off Redmond (though Cupertino works too). As you read my story, you will come across familiar horrors such as driver woes, kernel compilation, and writing scripts just to get basic functionality. I begin with a brief chronology of my computer use:
  • c. 1988 Sinclair ZX Spectrum 128K +2 (died in action)
  • c. 1992 Acorn Electron
  • c. 1994 PC (Western Systems 486 SX 33 MHz, 4Mb RAM, 270 Mb hard drive)
  • 1994-2005 A succession of upgrades / cannibalisations with second hand PCs
  • 2005 Acer Travelmate 4151LMi Laptop (Pentium M 725 @ 1.6 GHz, 512 Mb RAM, 60 Gb hard drive)
I was introduced to Linux in 1996 on university computers at Imperial College, London. Having dabbled in C programming on the Windows platform, I found Linux to be a breath of fresh air. At the time, a programmer had to use many system calls to get things done properly with Windows. All this was transparent to Linux, and it was really just a case of coding in ANSI C. Even more wonderful for a cash-strapped student was the fact that the gcc compiler is free.

At some point in my undergraduate career, I decided to go dual-boot and opted for Debian (either Slink or Potato, I forget which). In retrospect, this was a terrible choice as a first Linux distribution. At the time, Debian was very much a hardcore distribution and only for the brave souls who wanted to get down and dirty with Linux. My first installation took a couple of very stressful days, and involved a steep learning curve. A major source of stress was the worry that I would accidentally format my Windows partition, or that the resizing process would damage it somehow. These days, I would strongly recommend backing up data before messing about with partitions.

Linux was not entirely hardware-friendly. In particular, I spent many hours (days?) getting sound, joysticks, and printing to work properly. Only by recompiling the kernel was I able to get sound to work properly. Things are somewhat easier now with the introduction of kernel modules, but it's still something of a hassle.

I switched to Red Hat 6.2, and then to Pink Tie 9 (a Red Hat 9 clone). This distribution was sufficiently capable that I dropped Windows 95 in favour of it, only returning to Windows when I needed to use MS Office (which was infrequently). I saw further improvements with Debian Woody and then Debian Sarge. By the time I got to Sarge, Windows was a distant and rather unpleasant memory.

As a mathematician, my main applications are: a web-browser and email client, emacs (a text editor), LaTeX (a typesetting application), and Maple (a computer algebra package). Unencumbered by reliance on MS Office, I was entirely free to use whatever operating system I desired. Ironically, it was this very freedom which ultimately led me back to Windows.

My brand-spanking new laptop had a SATA drive. Unfortunately, this drive was not recognised by the Ubuntu Hoary Hedgehog installer (Ubuntu being my current Linux distribution of choice). Instead I installed Debian Sarge. The problem was that the system still needed considerable work to support my wireless card and didn't have xv support for my graphics card.

Back in the dual Linux/Windows 95 days, I would have had no option but to spend hours configuring the drivers, recompiling the kernel, etc. However, I suddenly found myself working with a perfectly functioning Windows XP Pro. Other than some relatively minor tweaks, XP worked fine. It was a busy time for me with deadlines fast approaching, so I ditched Sarge in favour of Windows XP. I haven't looked back.

Don't misunderstand me, I didn't drop open source software. I didn't even completely ditch Linux. Other than the operating system, the only commercial software I use is Maple (so no change from my Linux days). When I need the power of Linux, I turn to Cygwin, a Linux-like environment which sits on top of Windows. The advantage of Cygwin over a virtual machine is that Cygwin uses the Windows filesystem, device drivers, and system calls, but presents a Linux-like API to applications. In effect, it is Linux but without the hassle!

I now find that I spend much more time getting things done, instead of tweaking my Linux system to the nth degree. If Linux is to find mainstream acceptance, developers should make hardware support a priority. Ubuntu seems to be going in the right direction by offering the xorg server and generally good automatic hardware configuration. The turning point will come when major computer manufacturers produce good machines with Linux preinstalled.

The point of my article is that in these days of free/open source software, the operating system has become less important, not more. Applications are the king and they are no longer tied to particular operating systems.

Sunday, March 05, 2006

Partial Preorders

How many transitive and reflexive relations (partial preorders) are there on a set of three elements? This question was recently posed in a first-year maths problem sheet at the University of Oxford.

It can easily be shown that there are 64 reflexive relations on such a set, and one can determine which of them are transitive. This is a bit of a pain, so I wrote a Maple worksheet to simplify the process.

The worksheet computes all relations on a set of 3 elements and represents them as matrices. Without loss of generality, the set of 3 elements is S = {1, 2, 3}. A relation is then represented by a matrix A with entries from {0, 1}, where A[i, j]=1 iff i ~ j.

With this representation, a matrix is reflexive iff the diagonal entries are all 1. The transitivity condition is a little more complicated, but can be coded without much difficulty.

It turns out that the answer is 29.