Saturday, 30 June 2007

Charitable Search Engine

A news letter I recently received from the RNLI pointed me to a new search engine, MagicTaxi. According to the home page, MagicTaxi gives 50% of its advertising revenue to charity. So if you want to donate while you search, point your browser their way.

Cryptic Codes and Canon Lenses

As I have enough camera gear that a standard travel insurance will not cover it, I bought a special insurance just for the camera and associated bits and pieces. They require that I provide serial numbers for every item that is worth more than £200. So when I recently acquired a new EF 15mm f/2.8 Fisheye lens, I decided to add it to the insurance policy and went in search of the serial number. On the box, there is a sticker that specifies a serial number but, at first sight, it looks nothing like any of the codes on the lens itself. To start with, the lens has two codes: a numeric one and an alphanumeric one. Which one is the right one? After some digging on the net, I had the answer, so here's an illustration of it, with a couple of my lenses.

The numeric code is the actual serial number. On the EF 15mm f/2.8 Fisheye lens, it is located on the barrel, near the camera mount. On the EF24-105mm f/4 L IS USM lens, it is located on the bayonet flange.

Serial number on the barrel of the EF15mm f/2.8 Fisheye lens Serial number on the bayonet of the EF24-105mm f/4 L IS USM lens

Serial number on the EF15mm f/2.8 Fisheye and the EF24-105mm f/4 L IS USM

That same number is also available on the box the lens came in. On that box, there is a sticker with a bar code and a couple of numeric codes, with the title Lens No. At first sight, none of the codes on the sticker seem to really match what's on the lens. But looking closer, it appears that the serial number is the end part of the bottom code. It all makes sense now! What the other codes mean, I don't have the faintest idea.

Lens No sticker with serial number circled

Lens No sticker with circled serial number

I also found an explanation for the alphanumeric code that can be found on the lens. This is a manufacturing code. My fish-eye lens has a code that says UV0509.

  • The first letter, U, identifies the factory that produced the lens: Utsunomiya, in Japan.
  • The second letter, V identifies the year the lens was manufactured: 2007.
  • The following two digits identify the month the lens was manufactured: May.
  • The last two digits are an internal Canon batch number.
This manufacturing code enables Canon to identify a batch of lenses. For example, the first batches of the EF24-105mm f/4 L IS USM lens had an optical defect that produced serious flares. This code on the lens enabled owners to identify whether their lenses were part of any defective batch so that they could return it to Canon.

Manufacturing code on the EF15mm f/2.8 Fisheye lens

Manufacturing code on the EF15mm f/2.8 Fisheye

So there you go, that's what all those numbers mean on Canon lenses. I can now fill in my insurance policy properly.

Monday, 25 June 2007

Journalistic Faux-Pas

Sports commentators are known for their sometimes amusing comparisons and comments. In an attempt to sound interesting, they often eschew good taste, common sense and simplicity to come up with the weirdest things, as demonstrated today in the BBC commentary of the Moya-Henman game:

Relief for Moya as Henman's groundstrokes are drawn to the net like papparazi to an intoxicated Jade Goody.

See what I mean?

Saturday, 23 June 2007

Pure Brilliance

I got this picture entitled Pure Brilliance by email today. I completely agree with the title!

Man drinking a fountain of beer out of 5 glasses

Pure Brilliance!

From Zatte Vrienden.be apparently.

Sunday, 17 June 2007

Ubuntu 7.04 on an IBM ThinkPad T42

I inherited this IBM (now Lenovo) ThinkPad T42 from a previous job. It's a great machine, built according to development specs: it's got a decent processor and lots of RAM and is a good desktop replacement. I had never really changed what was installed on it so it was still running its original operating system, Windows XP Professional, and it was still setup to connect to the company's domain. I was virtually never using it, having everything I needed on my Mac and being very happy with it. However, my Mac is a desktop computer and more and more I'd like to have a laptop I can use regularly but without the pain that goes with running Windows. I thought about buying myself a MacBook but then why would I buy another computer when I have a perfectly good one doing nothing? So I decided to see if this laptop could run a decent operating system. Ideally I'd like an OpenSolaris distribution because I know Solaris very well but there are currently no really tried and tested OpenSolaris distribution and Solaris has always had weak support for laptops. So I decided to go for Ubuntu as I've heard a lot of good things about that Linux distribution. I fired my browser at the web site and got downloading.

Download

The download of the latest Ubuntu distribution, 7.04, was a breeze. The mirror I choose, Ubuntu in the UK, was fast and I had an ISO image of the Live CD very quickly. It actually felt like it took longer to burn it on CD than to download it.

Boot

Ubuntu booted from CD without complaining. It took quite a long time to start up. Luckily, a progress bars come up very quickly to tell you that it's actually doing something useful. For some reason, the start procedure starts looking for stuff on the hard disk, as I had the hard disk LED full on for a long time. It then loads from the CD before worryingly switching to a blank screen for a few seconds. Then the desktop flash screen comes up, it initialises everything and you're in. Welcome to Ubuntu.

Sound

No need to test if the sound card works: the jingle you get on login told me immediately that all was well with the sound card. I still went through a few quick tests to confirm it was all fine. And it is, no configuration needed.

Display

Ubuntu automatically identified all the screen resolution that my video card supports and set itself to use the highest possible resolution. Once again, no configuration necessary.

Network

Wireless

I then tried to connect to the internet. To do this, I tried to set up the wireless network so that it would connect via my broadband router. Unfortunately, Ubuntu only supports WEP authentication. My router is configured to use WPA-PSK. So that didn't work. Nevermind, it's no worse than Windows that couldn't connect to that network either. I'll have to try on a WEP or unprotected network but I didn't feel like re-configuring my router tonight. So I decided to see if a cable connection would work properly.

Cable

I connected the cable and... nothing. I went through the network setup dialog, checked that the interface was defined in such a way that it would use DHCP. But still no luck. I tried setting a fixed IP address and still no luck. I tried to manually bring up the network interface through the command line and still no luck. Eventually, I decided to try what would happen if I configured the connection to be a roaming one. And lo and behold! It worked! So, in Ubuntu speak, a roaming connection is one you can connect and disconnect at will and it will notice when you do that. Exactly what I need for a laptop.

Software

The pre-installed stuff

Ubuntu comes with a decent software suite installed by default, in particular it includes software like OpenOffice.org, Firefox or GIMP. It all works out of the box.

Add/Remove dialog

Now, for a newbie, that's probably the best feature of Ubuntu. Like Windows, Ubuntu has an Add/Remove dialog to manage the software that is installed on the machine. But, unlike Windows, you can choose to add new software from a list downloaded from the internet. You want a project management tool similar to Microsoft Projects? No problem, you don't have to know what it's called, just browse in the list and select it. When you're done with your virtual shopping, click Apply and Ubuntu will download and install everything. Of course this only works for the open source and free software that is in the list but looking at said list, you're unlikely to ever need anything that's not on there. Of note, there is quite a large education section, which is nice.

Of course, this being a Linux distribution, there is much more software to choose from than what's in the list of supported packages offered on the list but then you would not benefit from the simple checkbox install it offers and the list is very comprehensive anyway.

Install to hard disk

Having played with Ubuntu sufficiently to know that I wouldn't miss Windows on that laptop, I decided to install it to hard disk. So I double-clicked the install icon on the desktop. After specifying my time zone and keyboard layout, I choose to use the full hard disk and blast Windows to oblivion. A nice touch on the keyboard layout screen is the ability to type text into a box to verify that you've choose the correct layout. The installer also asks you for the details of a user account it will create. After that, it does everything on its own without requiring manual input so I had a tea break. Ubuntu was quicker in installing itself than me in drinking my cup of tea.

Once everything is installed, you need to reboot without the CD so that it boots on the hard disk. The restart is very fast and once you've entered your user name and password, loading the desktop happens in a snap.

The first thing that Ubuntu does when you log in is to check for updates. As it was a fresh install from a CD, I had 60 updates to download so I mentally prepared myself for the long haul. Fool that I was! The update was significantly faster than any OS-X update I've seen. Compared to Windows Updates that recently took 5 hours to install 70 odd updates on a friend's computer, well... there's no comparison possible, they are in a different league.

After such a large update, Ubuntu needs to reboot but there is no pressure to do so, no nagging, as you have on Windows or OS-X. I restarted anyway and this is where it became scary. The computer started to boot, then the boot process forced an fsck on the main partition, presumably because it had never been done before, and failed, triggering the system to reboot once more. At that point I was getting quite worried that the system would fall in a heap, as I have seen so many versions of Linux do in the past. Luckily my fears were unfounded and a few seconds later it was up and running.

Power management

This being a laptop, I decided to check the power management features. The options about the notification area in the General tab are a bit confusing but otherwise everything you would expect is here: when to shut things down, screen luminosity, what happens when you close the lid, etc. with different settings whether you are on mains or battery. So I set everything the way I wanted, closed the dialog and pulled the mains cable out of the laptop. As you would expect, it immediately dimmed the screen and showed the battery charge icon in the status bar. Shutting the lid put it into sleep mode as expected and it woke up without a glitch when opening the lid again, reconnected to the network without any problem and was back in service in a few seconds.

Conclusion

Installing Ubuntu on this laptop was a revelation. It reconciled me with Linux after years of aborted tries. Apart from the network, the installation was a real breeze and could be performed by anybody. It's actually more straightforward than Windows, on a par with OS-X. The live CD means you can test drive it before committing to it and because it's a Linux distribution, you can always install it with a boot loader so that it shares the computer with other operating systems, although I didn't try that.

Compared to the competition, there are two things that set Ubuntu apart. The first is the Add/Remove software dialog as described above. The second is the blisteringly fast network connection. I don't know what the difference is in the network stack but Ubuntu is a joy to use on the internet. Browsing is extremely fast, much faster than on OS-X or Windows, and that's with the same web browser (Firefox) on all 3 operating systems.

How to create a colour palette from a photograph using Photoshop

Following a talk by John Hicks at @media2007, I was wondering how to derive a colour palette from a photograph in Photoshop. As I am a real Photoshop novice, I started by searching through the help and eventually came to a technique that involving transforming the image to indexed colour mode, reducing the number of colours and creating a swatch library from the resulting image. The results were quite poor and it was very cumbersome to do. There had to be a better way.

So I ditched the Photoshop manual and went googling. It took about 5 minutes to come up with the answer: pixelate the picture, as explained graphically on Upstart Blogger from the original article at YourTotalSite. Here is the result with one of my pictures:

Pixelated photograph to extract its colour palette

Pixelated photograph to extract its colour palette

The cool thing about this technique is that it is very fast and you can manipulate the resulting colour palette as an image. Of course, if you want to, you can always extract a swatch library out of it as you would have done in the original picture.

Update: Of course, as I had just published this article I had a brain wave and decided to check out fd's flickr toys. As you would expect, they have a palette generator that does exactly what it says on the tin and gives you a 15 colour palette with hexadecimal codes and an example CSS snippet.

Screenshot of fd's flickr toys palette generator output

Screenshot of fd's flickr toys palette generator output

Tuesday, 12 June 2007

The Weakest Link

I asked my ISP what BT had done to rectify the problem on my broadband and got the following answer:

BT had changed the SNR margin and applied interleaving to your line to try and reduce errors in transmission. This did not seem to fix the issue though. The way your service is now delivered has changed from BT exchange equipment to our own LLU equipment.

So, in other words, BT is now completely out of the loop (literally) and it works great!

Monday, 11 June 2007

Broadband purgatory

Any experienced network administrator will tell you: the worse problems are not when nothing works but when it sort of works but not quite. So when I started having performance problems with my broadband connection 6 weeks ago, I knew I was in trouble. How to explain the problem to my ISP's helpdesk? I could download pages, even though they sometimes timed out but I couldn't upload any file. So my flickr photo stream started to dry out.

Of course, the first reaction of my ISP was to blame my equipment. As I had the same problem on a Power Mac G5 running OS-X and an IBM laptop running Windows XP, with Firefox as well as Internet Explorer, whether I was connected with to the network wirelesly or with a cable, it quickly came apparent that the only potential culprit on my side was the broadband router. As I was due for an upgrade anyway, I bought a new one and proved that I still had the problem with two different routers.

Then followed the various requests for test outputs to see what could go wrong. All this was a very slow process as I could not test during the day while my ISP's helpdesk was only able to review the tests during working hours. So a routine set in: I do a test during the evening, they look at it the following day, they suggest something else, I do a new test, etc. I quickly became frustrated and ended up writing a shell script to automate calls to traceroute followed by ping in order to get any decent statistics. And, lo and behold! It then became obvious that, anywhere on my network I had no packet loss whatsoever, whereas as soon as I reached my ISP's first router, I had between 5% and 50% packet loss depending on packet size. Now, 5% loss is huge and definitely way too high for TCP/IP to function properly. 50% loss doesn't even bear thinking about. The most likely culprit was now my broadband line. So my ISP passed the call to BT and, miracle, my connection now works like a charm! It only took 6 weeks to get there.

It's scary how we get used to facilities such as broadband though. Those 6 weeks really felt more like 6 months of frustration. Every time I clicked a link or a button on a page, I had no guarantee that it would load properly. Interestingly enough, the pages that were most affected by the problem were pages that depended on AJAX, GMail in particular. I suspect that this is because, when a normal page fails to load completely, the only downside is missing images and suchlike. The page is still usable. But an AJAX page can be completely crippled when it can't load everything: some essential functionality is missing. In fact, I saw exactly the same problem at work recently on my current project: a web application that depends heavily on Javascript and is completely broken if some of the Javascript source files fail to load properly. So, there's a moral for all AJAX developers out there: one of the rules to follow to build bulletproof AJAX is to ensure that your application still works, even if some of the code fails to load.

Following this, I just created a project on SourceForge, where I will maintain the script I developed during this incident. Obviously, this assumes the project gets approved by SourceForge. Assuming it does, I hope this tool proves useful to others and if anybody can contribute by testing it on other operating systems such as Linux or Solaris and helping me make it generic enough to run on those, it'd be much appreciated.