Apple Mail filters suck

While I would normally use gnus/gmane for mailing lists, cygwin-apps‘s gmane gateway is read-only, so sending a message necessitates an ezmlm subscription. Unlike mailman, ezmlm doesn’t allow you to be subscribed in a “don’t send me mail” state.

So I end up with 38 emails of noise in my inbox overnight, which would be fine, except that interspersed with these are personal emails which I overlook.

One of the nifty features of M2 was its automatic mailboxes for mailing lists. IIRC thunderbird had similar “virtual folders”, and Apple Mail has a “Smart Mailbox” feature that is essentially stored filters. The only problem is, the Apple smartness is limited to a few predefined fields, and the “Mailing-List” and “List-Id” headers aren’t among them. However, you *can* add custom headers for “Rules”, but this requires a genuine folder (e.g. an IMAP folder), and by that point it’s a better policy to add the rule server-side.

So, here’s the maildrop ~/.mailfilter rule:

if (/^List-Id:.*/)
{
        exception {
                to $DEFAULT/.Lists/
        }
}

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.