Fazal Majid's low-intensity blog

Sporadic pontification

Fazal Fazal

Organizing with Delicious Library

Delicious Library is one of the slickest apps on the Mac, and won countless design accolades. Essentially, it is a database for your books, CDs and DVDs (version 2 added gadgets), and it looks glorious on a large monitor like mine. It seems like a novelty for collector-fondlers, and I myself unfairly dismissed it as a toy in 2008, but behind its playful user interface lies a remarkably powerful organizational tool, and the new 2.5 version has made major improvements in stability and performance after 2 years of relative neglect.

Screenshot of Delicious Library

My wife and I are both avid readers—one of our common dreams is to someday have a home with a dedicated room for a library. We are squarely in the demographic for the Bookshelf porn website. Here is a montage of mine alone, not including the books I reluctantly had to consign to storage, or those in my parents’ basement back in France:

My bookshelves

With well over 900 books, I needed a system to manage. At some point I discovered Delicious Library has a writeable location field in its database for every item, and you can create virtual shelves to organize your books. I literally have one DL shelf for each shelf in my bookshelves, one for each box in storage, and one for all the books I keep at work. This way, I can browse shelf by shelf or box by box, or conversely look up the location of a book I need.

Location data for a book

You may think recording the location of each book would be a mind-numbing task, but Delicious Library makes it effortless. It can read ISBN bar codes using the iSight camera included in most Macs, but a better option is to use the Microvision RoV Bluetooth barcode scanner they sell and support. It is quite expensive at well over $200, specially compared to the inexpensive Symbol CS1504, but the convenience makes it well worth the price if you have a serious library to wrangle.

If you select a shelf on the left sidebar, then scan a barcode, the book is automatically added to the selected shelf. I filed a feature request with them in 2008 for precisely this, and I do not know when they added it, but it makes a world of difference. The scanner has a memory, so you can zip into an adjoining room, scan all the barcodes on a shelf, zip back and let the scanner pour the shelf’s inventory into DL. It even reads out the titles as they are added. Repeat the process and quite quickly you can compile an inventory of your entire library.

The search function in DL is somewhat primitive, but Smart bookshelves (similar to iTunes’ Smart playlists) help. I have Smart Bookshelves for:

  • Books I have already read
  • Books I have yet to read
  • Books that now have significant resale values on Amazon, to identify candidates for decluttering (you would be surprised to see the markups some art or technical books can fetch once they go out of print, even temporarily, such as my old copy of De Marco’s Peopleware).
  • Books signed by the author
  • Science-Fiction and Fantasy books, using Amazon’s (probably Bookscan’s) categorization
  • Computer books, similarly

Delicious Library tries hard to use cutting-edge functionality in OS X, which is why version 2 only supported Snow Leopard and later. It has a top-notch AppleScript implementation. I am no AppleScript guru, but I relatively easily wrote my own scripts to:

  • Copy the bookshelf name into all the books it contains. This essentially eliminates the data entry, but you have to be careful to make sure a book is not misfiled into two shelves at the same time. The sample script Highlight shelves containing selected media is helpful in this respect.
  • Find the BookMooch entry for books I want to give away.
  • Find the book in the San Francisco Public Library, in case they do not have it and might be interested in a donation.

Thanks to the user interface, browsing books on the Mac is almost as fun as doing so on the bookshelves, and infinitely faster. Of course, this is true of most book catalog programs, including many fine free options available for Windows and Mac, but most others do it with less aplomb.

Incensed at Mozilla

One of the greatest features in the Webkit-based browsers (Apple’s Safari and Google Chrome) is WebSQLdatabase, the ability for a web site to store information in a SQLite database on your browser accessible via JavaScript. This allows web developers to build database-enabled applications that run entirely in the browser, without requiring a server. This is very useful for mobile devices, which in the US enjoy flaky network connectivity at best. One very handsome example is the iPad-optimized Every Time Zone webapp.

SQLite is probably the most important open-source project you have never heard of. It is a simple, streamlined and efficient embedded database. Firefox stores its bookmarks in it. Google distributes its database of phishing sites in that format. Sun’s industrial-strength Solaris operating system stores the list of services it runs on boot in it—if it were to fail, a server would be crippled so that is a pretty strong vote of confidence. Adobe Lightroom and Apple’s Aperture use it to store their database, as do most Mac applications that use the CoreData framework, and many iPhone apps. In other words, it is robust and proven mission-critical software that is widely yet invisibly deployed.

WebSQLdatabase basically makes the power of SQLite available to web developers trying to build apps that work offline, specially on mobile devices. No good deed goes unpunished, and the Mozilla foundation teamed up with unlikely bedfellow Microsoft to torpedo formal adoption of WebSQLdatabase as a web standard, on spurious grounds, and pushed an alternate standard called IndexedDB instead. To quote the Chromium team:

Q: Why this over WebSQLDatabase?

A: Microsoft and Mozilla have made it very clear they will not implement SQL in the browser.  If you want to argue this is silly, talk to them, not me.

IndexedDB is several steps backwards. Instead of using powerful, expressive and mature SQL technology, it uses a verbose JavaScript B-tree API that is a throwback to the 1960s bad old days of hierarchical databases and ISAM, requires a lot more work from the developer, for no good reason. To add injury to insult, Firefox 4’s implementation of IndexedDB is actually built on top of SQLite. The end result will be that web developers will need to build a SQL emulation library on top of IndexedDB to restore the SQLite functionality deliberately crippled by IndexedDB. If there is one constant in software engineering, it is that multiple layers add brittleness and impair performance.

Of course, both Mozilla and Microsoft are irrelevant on mobiles, where WebKit has essentially won the day, so why should this matter? Microsoft has always been a hindrance to the development of the web, since they have to protect the Windows API from competition by increasingly capable webapps, but I cannot understand Mozilla’s attitude, except possibly knee-jerk not-invented-here syndrome and petulance at being upstaged by WebKit. WebSQLdatabase is not perfect—to reach its full potential, it needs and automatic replication and sync facility between the local database and the website’s own database, but it is light years ahead of IndexedDB in terms of power and productivity.

I am so irritated by Mozilla’s attitude that after 10 years of using Mozilla-based browsers, I switched today from Firefox to Chrome as my primary browser. Migrating was surprisingly easy. Key functionality like bookmark keywords, AdBlock, FlashBlock, a developer console, and the ability to whitelist domains for cookies, all have equivalents on Chrome. The main regressions are bookmark tags, and Chrome’s sync options are not yet equivalent to Weave‘s. At some point I will need to roll my own password syncing facility (Chrome stores its passwords in the OS X keychain, which is also used by Safari and Camino).

Forbidden functions

When I first read Asimov’s Foundation as a child in 1980 or so, I was blown away by the idea that a mathematical operation could be forbidden.

“Before you are done with me, young man, you will learn to apply psychohistory to all problems as a matter of course. – Observe.” Seldon removed his calculator pad from the pouch at his belt. Men said he kept one beneath his pillow for use in moments of wakefulness. Its gray, glossy finish was slightly worn by use. Seldon’s nimble fingers, spotted now with age, played along the files and rows of buttons that filled its surface. Red symbols glowed out from the upper tier.

He said, “That represents the condition of the Empire at present.”

He waited.

Gaal said finally, “Surely that is not a complete representation.”

“No, not complete,” said Seldon. “I am glad you do not accept my word blindly. However, this is an approximation which will serve to demonstrate the proposition. Will you accept that?”

“Subject to my later verification of the derivation of the function, yes.” Gaal was carefully avoiding a possible trap.

“Good. Add to this the known probability of Imperial assassination, viceregal revolt, the contemporary recurrence of periods of economic depression, the declining rate of planetary explorations, the…”

He proceeded. As each item was mentioned, new symbols sprang to life at his touch, and melted into the basic function which expanded and changed.

Gaal stopped him only once. “I don’t see the validity of that set-transformation.”

Seldon repeated it more slowly.

Gaal said, “But that is done by way of a forbidden sociooperation.”

“Good. You are quick, but not yet quick enough. It is not forbidden in this connection. Let me do it by expansions.”

Isaac Asimov, Foundation, Chapter 4 (emphasis mine)

Later, I learned in a Byte article on Karmarkar’s algorithm for linear programming that AT&T had patented it. The idea that mathematical algorithms are patentable was just as absurd for a 17 year old. Not quite as absurd as patenting living organisms’ genome still seems to me, but close. Forbidden mathematics seemed like something from the Middle Ages, or Stalinist Russia.

Of course, this is exactly what happens when our governments try to outlaw cryptography, or the media industry tries to ban algorithms like DeCSS, or even public discussion by academics of flaws in their poorly designed cryptosystems. There is an apocryphal myth that Pythagoras’ mathemato-mystical cult tried to assassinate the man who first proved the square root of two is an irrational number. Mathematics can be an inconvenient truth at times.

RapidSSL 1 – GoDaddy 0

My new company’s website uses SSL. I ordered an “extended validation” certificate from GoDaddy, instead of my usual CA, RapidSSL/GeoTrust, because GoDaddy’s EV certificates were cheap. EV certificates are security theater more than anything else, I probably should not have bothered.

Immediately after switching from my earlier “snake oil” self-signed test certificate to the production certificate, I saw SSL errors on Google Chrome for Mac and Safari for Mac, i.e. the two browsers that use OS X’s built-in crypto and certificate store. I suppose I should have tested the certificate on another server before going live, but I trusted GoDaddy (they are my DNS registrars, and competent, if garish).

Big mistake.

I called their tech support hotline, which is incredibly grating because of the verbose phone tree that keeps trying to push add-ons (I guess it is consistent with the monstrosity that is their home page).

After a while, I got a first-level tech. He asked whether I saw the certificate error on Google Chrome for Windows. At that point, I was irate enough to use a four-letter word. Our customers are Android mobile app developers. A significant chunk of them use Macs, and almost none (less than 5%) use IE, so know-nothing “All the world is IE” demographics are not exactly applicable.

After about half an hour of getting the run-around and escalating to level 2, with my business partner Michael getting progressively more anxious in the background, the level 1 CSR tells me the level 2 one can’t reproduce the problem (I reproduced it on three different Macs in two different locations). I gave them an ultimatum: fix it within 10 minutes or I would switch. At this point, the L1 CSR told me he had exhausted all his options, but I could call their “RA” department, and offered to switch me. Inevitably, the call transfer failed.

I dialed their SSL number, and in parallel started the certificate application process on RapidSSL. They offered a free competitive upgrade, I tried it, and within 3 minutes I had my fresh new, and functional certificate, valid for 3 years, all for free and in less time than it takes to listen to GoDaddy’s obnoxious phone tree (all about “we pride ourselves in customer service” and other Orwellian corporate babble).

I then called GoDaddy’s billing department to get a refund. Surprisingly, the process was very fast and smooth. I guess it is well-trod.

The moral of the story: GoDaddy—bad. RapidSSL—good.

Update (2012-08-26)

I switched my DNS business from GoDaddy to Gandi.net in December 2011 after Bob Parsons’ despicable elephant-hunting stunt.

Ginormous iPod to go

The hard drive in my October 2006 vintage 80GB iPod 5.5G died a few weeks ago.  I wasn’t keen on upgrading to the iPod Classic as:

  1. With a maximum capacity of 160GB, it is still too small to house my entire 220GB music collection
  2. Apple introduced encrypted audio outputs on the dock connector, to force accessory makers to pay royalties, thus making it incompatible with many accessories and forcing you to buy new ones.

I use my iPod mostly in my car. The classic hard drive iPods have one key capability iPhones and iPod Touches lack—the ability to shuffle by album, which is essential when you listen mostly to classical music and where an opus maps to an album.

While investigating repair options, I found out Toshiba now makes a two-platter 240GB (224 GiB) hard drive. The iPod Classic won’t recognize the second platter (a third strike against it) but the 5.5G will. I sent mine to RapidRepair for repair/upgrade and received it back yesterday. The flip side of such an enormous drive is that the sync takes forever: I started it around 10PM yesterday and it is till running, over 9 hours later. They handled the repair very professionally, there are no marks on the casing, and I now have a fully functional 224GB iPod for less than the price of buying a new 160GB iPod Classic. The only feature it is missing is the ability to play 24-bit/96kHz ALAC files like those I made out FLACs purchased from Linn or the B&W Society of Sound.

I can’t understand why Apple does not make this new high-capacity drive available in iPods or the MacBook Air.