Archive for 2007

Insanity with dumping MySQL stored procedures

Suppose you have a MySQL database containing stored procedures (which were added in MySQL 5.0.3). Now you dump that database using mysqldump, take the dump, and load it into a different server.

Oops, the dump didn’t contain the stored-procedure definitions, so your code fails. So you read the mysqldump manual, and discover that you need to add a -R (--routines) unbreak-me option. You regenerate the dump with -R, and load it into your other server. That worked; phew. (Assuming the user you dumped as has read permissions on the mysql.proc table, anyway.)

Then you load the dump into a third server. But you weren’t thinking very clearly at this point, and this third server is running 5.0.2, or 4.1, or some other version N−k. What should happen now?


Spanish phonology and American accents

Among native speakers of American English who are learning Spanish, there’s a natural error that can easily mark them out as non-native Spanish speakers, and that seems to be fairly common. It’s all about the pronunciation and behaviour of the coronal consonants /t/ and /d/.


Colour schemes in terminal emulators

Some people prefer dark-on-light colour schemes for their terminals. Others prefer light-on-dark.

I’m in the latter camp. I suspect that’s mainly just out of habit, rather than anything well-reasoned; certainly I find myself agreeing with the idea that matching the properties of paper is a good thing.


Numbers and strings in MySQL

Here’s a MySQL query issued by some Perl code:

        byline_id int PRIMARY KEY,
        last_used int not null
    SELECT byline_id, MAX(IfNull(published_at, ?)) AS last_used
    FROM article
    GROUP BY byline_id
}, undef, time());

Spot the bug? No, nor did I.


Unix filesystem semantics are useful

There’s been a minor furore lately about ZFS and Mac OS and laptops.

First, AppleInsider reported that ZFS would play a larger role in future versions of Mac OS X. MWJ took that article to task, contending (once you ignore the snarky asides) that ZFS is inappropriate for laptops. Drew Thaler, previously a filesystem engineer for Apple, chimed in to extol the good qualities of ZFS.

Then MWJ responded, explaining their position in more depth. Which is all well and good, except that some of the things they said made no sense at all.


Mac Mini

If you’re looking for an inexpensive Linux box, you’d probably find it hard to beat the low-end Mac Mini. It currently goes for £399 in a configuration including a 1.83 GHz Core 2 Duo, 1 GiB of RAM, an 80 GB hard disk, a CD-RW/DVD-ROM drive, both VGA and DVI output, a remote control, gigabit ethernet, 802.11b/g wireless, Bluetooth, Firewire, four USB ports. The case is only 51×165×165 mm, and the system’s all but silent.

Picking up a non-Apple keyboard, optical wheelmouse, and 17” or 19” DVI monitor will take the total price to somewhere in the region of £500–£550. What’s not to like?

If you’re looking to run Mac OS, you can still go with the non-Apple monitor and mouse, but you’re probably better spending the extra money for an Apple keyboard; OS X is somewhat confusing on a standard PC keyboard. But if you’re looking for a desktop system, note that the more extra bits and pieces you buy, the closer the price will come to that of an iMac, at £799, especially if you go for the high-end Mini at £499.

Update, 1 Oct: Well, there are two caveats if you want to run Linux, it turns out.


An egregiously-broken website

I have a ticket to the William Gibson event at the Edinburgh International Book Festival. However, I can’t make it: I’m going to be at YAPC::Europe instead. So, I’m shopping the ticket round some friends. I’d like to point them to the URL of the event. So, I go to the festival website — hey, that’s nice, it’s the first Google hit for the term book festival. Click on What’s on. Select the date of the show. Search within page to find Gibson. Click on the More information link. Go to copy URL into clipbo— just a minute, the page URL shows absolutely nothing of value. The thing I clicked on must have been a POST form.


Book Review: Mastering Regular Expressions (3rd Edition)

[Also published here.]

Mastering Regular Expressions has been around for a long time — this is the third edition of a book originally published a decade ago. Does that actually reflect justified popularity, or is it just that this is the only book-length treatment of the various regex engines, how they differ, and how to get the most out of them? I’m glad to say that doesn’t seem to be case: if you use regexes in any depth at all, you should probably read this book.


It’s a modifier key, dammit!

[Previously published here.]

Sometimes the small hates are the most consuming ones.

My desktop uses Gnome. I mostly like it; it’s certainly not hate-free, but it’s not the topic of today’s rant.

OpenOffice.org.o.OoOO.Oooo runs on my Gnome desktop. I don’t really like OpenOffice, but some idiot has sent me a picture as, of all things, a PowerPoint presentation, and I need to be able to look at the benighted thing. So. Now I can Alt+Tab between the thing I’m actually working on, and the stupid picture stuffed into the stupid PowerPoint document.


MySQL whitespace insanity

Here’s some astonishingly bad MySQL insanity. (I know I rant about MySQL lossage a lot, but that’s because there’s just so much of it to rant about.)


Regex matching algorithms and asymptotic run time

[Previously published here.]

Russ Cox recently wrote an article about the worst-case run time of two different implementation strategies for matching regexes: Thompson NFA, and backtracking NFA. In particular, Russ points to the Perl regex engine as an example of how not to do it.

The article’s an interesting read. But I don’t think the approach described is necessarily easy and/or useful to fit into Perl, though.