Cocoa devs fail Data Structures & Algorithms?

I can’t find a linked-list class in Cocoa. Yes, I do want to do middle-insertions, and I’d have a fine time amortising my sequential access to constant time. Fine; it’s not like they’re hard to implement.

The scary thing is that when searching, I blindly fell into the pool of ignorance displayed in this circa-2004 Cocoa-dev thread. To be fair, the OP was more concerned about iterator functionality than a list implementation, but most of the responses seemed oblivious to:

  • The iterator design pattern
  • The time-complexity advantages of a linked-list implementation over arrays and deques (NSArray) and hashes and trees (NSDictionary and NSSet)

Continue reading “Cocoa devs fail Data Structures & Algorithms?”

ruby-mp3info utf-8 support

While apparently there are plans to improve ruby’s support for unicode, the 1.8 stdlib doesn’t make working with encodings transparent. The historically poor support has had its toll on ruby libraries, as I discovered while updating scroball.rb to do the right thing with utf-8.

It led to this patch. On the whole though, it’s of limited use. You don’t see the Id3v2 class from the Mp3Info class, so you don’t get an opportunity to set the encoding up. Even if you did, the implicit assumption that the user deals solely in iso-8559-1 isn’t comforting. Fortunately the characterspace isn’t always truncated into iso-8559-1: strings which fail the iconv transcoding get left alone.

The situation with ruby-mp3info is symptomatic of several legacies: id3v2 and its ad hoc unicode extensions, and second-class support of unicode strings in ruby before 1.9.

reStructuredText for WordPress

I’ve previously mentioned how Matthew Scott’s reStructuredText for WordPress is a good hack for making wordpress usable. However, revision 5 from the rest-wordpress bazaar repository was broken in a few ways.

The most annoying way was that the options I’d configured up the top of the file weren’t having the desired effect. I wasted the better part of an hour in debugging until I recalled how horrid PHP scoping was. It was a simple fix.

Continue reading “reStructuredText for WordPress”