Monthly Archives: July 2010

Anita said yes!

I have been poking at [Adobe][adobe]’s support pages recently. They have RSS feeds to which you can subscribe in order to learn when [new support documents have been published][rss]. Today I happened to refresh the feed in those moments before someone bothered to proof-read what they were publishing.

> Please do not publish this doc without checking with Anita. I’m in the process of reviewing and editing it. Thanks. AnitaWhat’s coveredIntroduction to the GPUGPU features in Photoshop and Adobe Bridge…

Here’s how it looked in [NetNewsWire][nnw]:

Screenshot of NetNewsWire

Those run-together words in the feed are a fair example of the lack of attention to detail in the design of [the Adobe support site][support]. There’s good stuff on there, but finding it is frustrating and anyway wouldn’t you rather download a demo of something with [motherfucking Akamai download manager][akamai]?

Meanwhile Anita must have said to go ahead because [there’s no mention of her on that article’s page now][kb].

[adobe]: http://www.adobe.com/
[nnw]: http://netnewswireapp.com/
[support]: http://www.adobe.com/support/
[rss]: http://www.adobe.com/support/rss/
[akamai]: http://kb2.adobe.com/cps/402/kb402065.html
[kb]: http://kb2.adobe.com/cps/404/kb404898.html

Django-style routing for Bottle

[Bottle][bottle] provides the [`@route` decorator][route] to associate URL paths with view functions. This is very convenient, but if you are a [Django][django]-reject like me then you may prefer having all your URLs defined in one place, the advantage being it is easy to see at a glance [all the different URLs your application will match][urlconf].

*Updated: I have re-written this post and the example to make it simpler following Marcel Hellkamp’s comments (Marcel is the primary author of Bottle). My original example was needlessly complicated.*

It is possible to have [a Django-style urlpatterns stanza][urlpatterns] with a Bottle app. Here’s how it can work:

from bottle import route

# Assuming your *_page view functions are defined above somewhere
urlpatterns = (
# (path, func, name)
(‘/’, home_page, ‘home’),
(‘/about’, about_page, ‘about’),
(‘/contact’, contact_page, ‘contact’),
)

for path, func, name in urlpatterns:
route(path, name=name)(func)

Here we run through a list where each item is a triple of URL path, view function and a name for the route. For each we simply call the `route` method and then invoke it with the function object. Not as flexible as using the decorator on a function (because the `@route` decorator can take additional keyword arguments) but at least you can have all the routes in one place at the end of the module.

Then again if you have so many routes that you need to keep them in a pretty list you probably aren’t writing the simple application that Bottle was intended for.

(This was tested with Bottle’s 0.8 and 0.9-dev branches.)

[bottle]: http://bottle.paws.de/
[route]: http://bottle.paws.de/docs/0.8/api.html#bottle.route
[django]: http://www.djangoproject.com/
[urlconf]: http://docs.djangoproject.com/en/1.2/topics/http/urls/#example
[urlpatterns]: http://docs.djangoproject.com/en/dev/topics/http/urls/

Extensions are not enough

Another thing I like about Mac OS X is [the print preview available in any software][printing] that chooses to provide printing (unless that software [chooses to be awkward][acrobat]).

Acrobat dialog box being unhelpful as ever

Best software ever

When this feature first appeared, one could trigger a stupid bug if one happened to have an application other than Preview.app set as the default application for files with the `.pdf` extension. If you had Adobe Acrobat set as your default PDF viewer, then hitting the preview button in print dialog boxes would open that preview in Acrobat.

It was a stupid bug, particularly because it was so obvious what was going wrong. The preview was being written to a temporary file with a `.pdf` extension and then being opened using whatever handler was defined in launch services. But you don’t want that, you want it to be handled by the operating system and not be subject to whether or not you have the patience to wait thirty seconds while Acrobat version 6 merrily paints its splash screen for your pleasure.

Later versions of Mac OS X fixed this so that the print preview is *always* displayed using Preview.app. This happens even if you set Acrobat as the default application for `.pdf` files, and it is a good thing it behaves like this. (In fairness, launch times for Acrobat since version 8 are no longer painful.)

*I tested what happens if you delete Preview.app on a clean 10.5.8 install: the system falls back to opening QuickTime Player.app for displaying previews (which works fine). And if you delete QuickTime Player.app it falls back to using Safari.app (also works fine). And if you delete Safari.app it falls back to TextEdit.app (which works fine as long as you can render raw PDF data in your head).*

It is as if going by the default association between file extension and application was not enough; that the system had a need to use a particular bit of software for these PDF preview files, regardless of what software was chosen as the handler for a different set of PDF files. Who’d have guessed?

All of this is an argument for providing a **programmatic** way to set the owning application for a file. You might call this a creator code, potentially any file could have one, but no biggie if it was not present because you could fall back to some regular stupid heuristic for determining the owner.

And then in Mac OS X 10.6 you might [change the behaviour of the system][106] so that [this useful and important information about the file is ignored][ars]. Grumble.

Dammit, only just occurred to me to see whether the system would eventually fall back to using Acrobat itself for displaying previews. Grumble.

[printing]: http://support.apple.com/kb/HT3771
[acrobat]: http://www.adobe.com/products/acrobatpro/
[ars]: http://arstechnica.com/staff/fatbits/2009/09/metadata-madness.ars
[106]: http://db.tidbits.com/article/10537

More mail bombs

[Tim Gaden over on Hawk Wings][hawkwings] [doesn’t agree][agree] that [Mail.app’s behaviour regarding deleting POP accounts is misguided][bomb].

His first point is that Mail.app gives you a big warning before doing the dirty. I don’t think that excuses the bad behaviour. Warning someone that you behave badly does not excuse that bad behaviour (my ex says this rule applies in more cases than the implementation of mail clients).

His second point is that the user should have a backup; with a good backup she can recover from her mistake when all those old messages disappear. I agree that people should have backups, but I don’t think that argument has any weight because you can imagine that the answer for all bad design decisions is “you should have had a backup”, in which case there are no bad design decisions.

The problem is that Mail.app’s insistence on a POP account being a separate set of folders means a message cannot appear in the Inbox unless it belongs to an account. If you delete a POP account then you have to move the messages to the Inbox of another account just to keep them appearing in the Inbox. This does not make sense.

Suppose you have a large history of messages received via a POP account. Then you delete that account and switch to an IMAP service with a meagre storage limit. If you want to keep those old messages appearing in the Inbox you must move your the historic Inbox messages to the IMAP account’s Inbox even though that will take up space on the server (and there may not be sufficient space on the server for them anyway). The other option is to give up the idea that old messages belong in the Inbox and just move them to local folders “On My Mac”.

If Mail.app provided a local Inbox folder that appeared as part of the unified Inbox then my objections would go away. (There should also be a corresponding local Sent folder.)

IMAP and POP are different in that a POP account’s mailbox is really just a temporary queue for messages that have yet to be retrieved by the client. Mail.app should recognize that difference and stop pretending that the two types of account are equivalent.

Quite pleased that Hawk Wings even knows my blog exists. Hawk Wings is good.

[hawkwings]: http://www.hawkwings.net/
[agree]: http://www.hawkwings.net/2010/07/07/mail-apps-disappearing-pop-mail-trick/
[bomb]: http://reliablybroken.com/b/2010/07/apple-mail-bomb/

A digression on Entourage

[Microsoft Entourage][entourage] is such an interesting piece of software. It evolved from (Mac) Outlook Express which was a great mail client for the old Mac OS (despite its grumpy IMAP implementation). Outlook Express itself took many of its design cues from Claris Emailer, to the extent I believe the early versions of Outlook Express were [coded by peeps who had worked on Claris Emailer][emailer].

I always liked that Outlook Express and Entourage defaulted to plain text for messages. I particularly liked the fact that OE / Entourage defaulted to bottom-posting when replying to a message – as any fule kno top-posting is a hideous convention foisted on us by miserable office mail systems back when there was still a chance that your e-mail would not be delivered via SMTP (Exchange version 5 and earlier is the primary culprit here).

I still get annoyed that when using Mail.app hitting the tab key in a plain-text e-mail inserts a tab character instead of expanding it to four spaces like Entourage.

Given enough time this post would devolve into arguments about [top-posting versus bottom-posting][netiquette], the width of [the one true tab-stop][tabs] and how [HTML e-mail][html] has turned our youths’ minds into mush.

[entourage]: http://www.microsoft.com/mac/products/entourage2008/
[emailer]: http://blog.entourage.mvps.org/2007/05/in_the_beginning.html
[netiquette]: http://www.faqs.org/rfcs/rfc1855.html
[tabs]: http://www.jwz.org/doc/tabs-vs-spaces.html
[html]: http://www.birdhouse.org/etc/evilmail.html

Apple mail bomb

[Apple’s Mail.app][mailapp] has an approach to mailboxes for [POP mail accounts][pop] that has never made sense to me. At least, I can see that it is a logical approach, but I don’t think it is a good approach because it can easily lead the user to inadvertently delete messages.

The problem is related to how Mail.app stores messages for an account. For an [IMAP account][imap] (or a [Microsoft Exchange account][exchange]) Mail.app creates a folder on the local disk and creates mailboxes within that folder corresponding to the mailboxes on the server. The contents of those mailboxes are synchronised with the contents of the mailboxes residing on the server. This makes perfect sense because with IMAP because the messages live on the server – keeping a local copy of those messages is effectively a performance optimisation.

What is weird is that Mail.app uses the same strategy for POP accounts, even though with POP there is only one mailbox on the server and it is effectively a temporary store for messages, which is to say that with a POP account a message does not live on the server but moves from one mailbox to another until it reaches its final resting place, that place being on the client.

The only copy of a message received via POP is on the client. (Having said that, [Gmail’s POP support][gmailpop] muddies the waters because [issuing a DELE command][dele] does not actually delete the message from the server, but the principle is the same.)

Now when you go to remove an IMAP account Mail.app deletes all the local mailboxes for that IMAP account. This is not a problem, after all those local mailboxes are simple caches; the only reason the client keeps a copy is as a performance optimisation (as noted above).

Now when you remove a POP account Mail.app deletes all messages sent or received via that account, even though there will be no copy of those messages on the server (especially true for sent messages). This is not useful or intuitive – it is a bad design.

Why is this a bad design? It is a bad design because with an IMAP account you understand that the messages live on the server whereas with a POP account you understand that the messages live on your local hard drive. With an IMAP account you understand that removing the account removes your access to those mailboxes that exist on the server, whereas with a POP account it makes no sense that the act of stopping the retrieval of messages from the account implies that all the messages received via that account and now stored on your hard disk should be removed as well.

Earlier versions of Mail.app had an even more destructive behaviour when removing a POP mailbox. In the version of Mail.app that shipped as part of Mac OS X 10.4, if you removed a POP account then _all messages associated with that account were removed without warning_. Now imagine the not uncommon sequence of events for someone changing from POP account A to POP account B using earlier versions of Mail.app:

1. User accumulates years of e-mail using POP account A.
2. User adds new POP account B.
3. User removes POP account A.

At step 3 the user lost all her historic e-mail! Apple finally realised that this was no way to win friends and so introduced a confirmation specifically warning that messages would be lost before deleting a POP account (this change was introduced with Mac OS X 10.5).

Another unfortunate behaviour is how Mail.app handles a disabled POP account. Disabling an account stops Mail.app from using that account for sending and receiving but also removes all the associated messages from the Inbox.

It is possible to keep an old POP account enabled so that its messages are still displayed but then turn off the preference to “Include when automatically checking for new messages”. This leaves the old account available when composing a new message as a choice in the From field so one must also change the preference for “Send new messages from” to always use the new POP account in order to avoid inadvertently sending a message using the old From address (or edit the from address in the old account to match that in the new account).

[Microsoft Entourage][entourage] has a better approach to this situation: messages for POP accounts are delivered to the Inbox mail folder “On My Computer”, and they stay there when the POP account is deleted. The flaw in Entourage’s approach is that the local folders appear even when all your e-mail accounts are server-based (i.e. all IMAP and / or Exchange accounts). I think it would be better to create those local folders only when a POP account has been defined because if you have only server-based accounts then it is distracting to have a set of folders called “On My Computer” which have no purpose.

[mailapp]: http://www.apple.com/support/mail/
[pop]: http://en.wikipedia.org/wiki/Post_Office_Protocol
[imap]: http://en.wikipedia.org/wiki/IMAP
[exchange]: http://www.microsoft.com/exchange/
[gmailpop]: http://mail.google.com/support/bin/answer.py?answer=13273
[dele]: http://tools.ietf.org/html/rfc1939#page-8
[entourage]: http://www.microsoft.com/mac/products/entourage2008/default.mspx