Haiku For a Dying Drive

Bad sectors remapped,
Too many, substrate failing,
Data migrates

JDK 1.6.0_18 Bug

Found a bug in JDK 1.6.0_18.

This, abeit brain-dead, code causes some sort of deadlock condition where multiple threads get stuck in the replaceAll() method:

// Replace all double spaces with single spaces
while ( string.indexOf(" ") != -1 ) {
   string = string.replaceAll("\\s\\s", " ");

Modify it to this makes it go away:

// Replace all double spaces with single spaces
string = string.replaceAll("\\s+", " ");

Maybe the first version of the code was not supposed to work in the first place.

Cloud Platform Choices

Good article over on ArsTechnica about Cloud Platform Choices, well worth reading if for no other reason than to keep up with what is going on in that space:

Cloud computing is one of the most hyped technology concepts in recent memory, and, like many buzzwords, the term “cloud” is overloaded and overused. A while back Ars ran an article attempting to clear some of the confusion by reviewing the cloud’s hardware underpinnings and giving it a proper definition, and in this article I’ll flesh out that picture on the software side by offering a brief tour of the cloud platform options available to development teams today. I’ll also discuss these options’ key strengths and weaknesses, and I’ll conclude with some thoughts about the kinds of advances we can expect in the near term. In all, though, it’s important to keep in mind that what’s presented here is just a snapshot. The cloud is evolving very rapidly—critical features that seem to be missing today may be standard a year from now.

Aperture 3.0

Apple released Aperture 3.0 last week which was interesting to me because I use it to manage my photos so I will most likely upgrade but I think I will wait for a maintenance release to come out as I have read in a couple of places that it is a little unstable (1, 2), and I like stable software.

Updated Feb 17, 2010 to add one more corroborating post.

Close up of a Nurse Shark

This is another angle on the large (pregnant) Nurse Shark I posted last september. This Nurse Shark has been swimming around us and decided to take a rest tucking its head under a coral head, the back end of the was out on the sand around the coral head.

I was pretty sure it was pregnant when I saw it turn right in front of me, you could see from the stomach that there was something substantial there (all divers were accounted for so not that) and one of the dive master signaled to me that it was indeed pregnant (there is no sign in the dive book for pregnant but it was obvious to me). Also there was slight wound on its side, it had gotten in a scrape with some other sea creature or maybe a human, hard to tell, but it was there, you can see the bump to the left of the remora’s head in this picture.

I felt really lucky that it had settled down and I was able to approach it very closely and got pictures from both sides and some nice close ups of which this is one. I don’t put the full size image on Flickr but you can see the texture and color of the scales, and the eye. I was able to spent about 2-3 minutes and took 17 shots.

Recovering Files off of a Mac

I recently helped a friend migrate from a 10+ year old Mac to something a little more modern, a new iMac in this case.

Migrating was pretty easy, most of the documents were in a standard format so everything copied over nicely, I used the excellent USB 2.0 Universal Drive Adapter from NewerTechnology to hook the old drive to the new Mac and most files were copied in minutes.

Email on the other hand was an issue. The mail client used was Microsoft Outlook Express for the Mac. Such a beast existed a long, long time ago, I remember checking it out in 2000 and preferred to use Entourage because there was an OS X migration path for that, Outlook Express never made it off System 9, and it was running under the Classic Environment on that Mac (Mac OS 9 in-a-box).

In the process the Mac had to be disconnected from the mains which caused it to lose its clock setting reverting back to 1969 (the internal battery was long dead) and Outlook Express freaked and reset its database hence losing all the email (Outlook Express like Entourage stored its emails in a proprietary database). Of course there was no back and I neglected to do one since we were migrating off the machine.

So after some experimentation with deleted file recovery software I came across the interesting idea of reading the drive in raw format, ie opening the device name as a file (‘/dev/disk4’ in this case) and reading my way across the drive. I wrote a little script which scanned for email headers and pulled the emails off the drive as it came across them.

There were a few wrinkles though: Even though it was able to identify 30,000+ emails based on headers, a second pass knocked that down to 10,000+ once I checked for valid content. Since Outlook Express was running in the Classic Environment, the end of line separator is a carriage return as opposed to a new line. And the way I decided an email ended was to look for non-ascii characters or the start of a new email.

Once I got al the emails out, I wrapped them up in an mbox formatted file and Mac OS X Mail was able to import it in just under a minute.


I spent some time this weekend playing around with the ePub format, actually I had a copy of a book of genetic traits sitting around from a previous consulting gig, along with a script designed to turn the ascii text (with some markup, a mixture of Wordstar style tags and XML) into HTML. It took be a few hours to update the HTML into XHTML, generate the various XML files which are required in an ePub package and I had an ebook. Very cool.

If you are interested in this I would strongly recommend reading the Wikipedia article on ePub, along with this post on Bob DuCharme’s weblog about creating epub files, specifically the bits about creating the the zip file itself. You will also need the epubcheck application which proved invaluable in weeding out issues with the eBook (which in my case turned out to be XHTML issues), and you are going to want to download some sort of ebook reader to view your masterpiece. I am on Mac OS X so I tried out Stanza and Adobe Digital Editions. There is a list of ebook readers at the end of the Wikipedia article on ePub.