iPhone Keyboard Trick

I’d noticed a while back that if you hold down a key on the iPhone keyboard, such as the ‘E’, for a second or two, you get a pop-up menu with variations on the ‘E’ theme, like ‘é’, ‘è’, ‘ê’, and so on.

But what I hadn’t noticed until just now is that the “.com” key, which appears when you’re expected to type in a URL, exhibits the same behavior: if you hold it down, you get a popup menu with “.net”, “.edu”, “.org”, and “.com”.

In addition, since I have the French keyboard installed, the popup contains “.fr”.

In the email application, when you’re entering an address, there’s no “.com” button, just a “.” (period) button. However, it also has the domain popup, with the same TLDs as the “.com” button.

I’ve gotta say: it’s little touches like this that help the interface get the hell out of the way of whatever it is you’re trying to do.

How Do You Spell the Names of the Months?

One construct that I’ve seen (and used) a lot in Perl is a hash that maps month abbreviations to numeric values that can be fed to POSIX::strftime:

our %months = (
    "jan" => 0, "feb" => 1, "mar" => 3, ...
);

This is useful for parsing log files and such. It works, it’s quick and easy, and it doesn’t require a whole tree of dependent modules (which are always on the wrong side of the Internet) to be installed.

But what’s always bugged me is that this is the sort of thing that the machine ought to know already. And besides, it’s US-centric: what if the person running the script is in a non-English-speaking country?

Fortunately, I18N::Langinfo knows the names of the months. Continue reading “How Do You Spell the Names of the Months?”