Birds on Rails, Part 1

Sunday, November 27th, 2005

I’ve been working on reimplementing a web application for tracking bird reports in something modern. The current app is held together with Interbase, Delphi, payware e-mail libraries, and variety of handgrown scripts. There aren’t even any input forms that talk directly to the database. Instead you have to e-mail your reports in. The site is uploaded to the server after being statically generated from the database every five minutes or so. This was state of the art in 1995, I suppose. It’s a little questionable today, and the current maintainer/inventor wants to give it up. One of the problems with these sorts of applications is that they’re unmanageable by anybody other than the person who wrote them. Thus it seemed like time to reimplement all this in a slightly more standard manner.

I began by setting up the database tables in MySQL. The lack of foreign key constraints feels a little wrong since I have lots of detail tables in this app. However, it does make the initial data entry a little easier than it might otherwise be.

I tried writing some PHP pages, but that was more difficult than I expected so I thought I’d take a day and see if Ruby on Rails was all it was cracked up to be. I’d looked at it initially, but decided against it because IBiblio doesn’t yet support Ruby. But I’m prototyping this on my desktop Mac, and if Ruby makes my job a lot easier, I could find a different host. (more…)

Rails, 64-bit MYSQL, and Mac OS X 10.4.3 incompatible

Saturday, November 26th, 2005

A bit of Google fodder. After several hours of futzing and debugging I have determined that the combination of Ruby on Rails 0.14.3, Mac OS X 10.4.3, and the 64-bit version of MySQL 5.0.16 are incompatible. The problem is most likely in MySQL/Ruby 2.7.1, but it could also be in the Mac’s build tools, or it could be in MySQL. I’m not sure. But this combination definitely does not work together. Reverting to the 32-bit version of MySQL makes everything work.

Addicted to Blogging

Saturday, November 26th, 2005

WordPress is surprisingly addictive. I’ve always been an active writer: e-mail, Usenet, the Cafes, 12+ books, so I’m probably more susceptible than most. I’m always astonished at people who say how much work it is to update their site every day. My problem is ususally how to write less, not more. Still maybe the people who said you shouldn’t be writing XML by hand were right.

On the other hand, I just discovered that WordPress’s editor doesn’t recognize CDATA sections. Very annoying. I’m going to have to manually escape all my markup examples. Bleah. I should probably file an RFE. Let me dig out the password they e-mailed me. There. Done.

Interesting. That’s only bug #1965. I would have expected a lot more. Either WordPress is even cleaner code than I thought, or they’re not really logging everything into the bug tracking system. I suspect the latter. They seem to prefer IRC and Wikis to a more formal issue tracker.

Disney Food

Friday, November 25th, 2005

A week ago my wife and I went to Disneyland in Anaheim, California. A couple of years ago we spent a few days at Disneyworld in Orlando. We did not have children with us either time. Disney may be running commericals advertising how much fun they are for adults, but they’ve clearly got a long way to go.

One thing we noticed in both resorts was a definite lack of good places to eat, or rather of sufficient good places to eat. Both Disney resorts have dramatically expanded their upscale (read: better than McDonalds) dining options in the last decade or two, but they’re not close to meeting demand. In both resorts, on-season and off, we’ve noticed that you absolutely must make a reservation (which Disney calls “priority seating” to try to explain why you still have to wait 30 minutes for a table after arriving right on time for your 8:00 reservation) to have any hope of eating something better than hamburgers and fries.

Once you get seated, the food at some of the nicer places isn’t bad. It’s not Michelin three-star by any stretch of the imagination, but it’s comparable to a typical nice New York restaurant, and maybe a little cheaper. (Guests from less expensive cities or with many children in tow may feel differently.)

There are a couple of tricks and lesser known places. At Orlando, there are much better, more plentiful, and less crowded dining options at Epcot than anywhere else in the resort. The Moroccan restaurant is especially worth checking out. At Disneyland, the wine bar under Hook’s Pointe often has empty tables with no waiting. Officially they only serve appetizers, but you can usually coax them into serving the full Hook’s Pointe menu. Also at Disneyland many restaurants will happily serve you at the bar even if no tables are available. And of course at Disneyland you’re really not very far from local, non-Disney restaurants, though these do tend to run more toward the McDonald’s/Del Taco/Denny’s end of the spectrum rather than Ducasse or the Gotham. Basically you just need to make your dining and restaurant reservations as far in advance as possible.

Why This Site?

Wednesday, November 23rd, 2005

About a year ago I launched a The Cafes with some fanfare to host shorter writings on a variety of subjects that didn’t already fit into Cafe au Lait or Cafe con Leche. That site was a partial response to my feelings about the shortcomings of a lot of existing weblog management and CMS software. In several ways I think it’s still superior to a lot of what’s out there, including the WordPress engine that hosts this blog. But not in all ways.

For The Cafes I spent a lot of time thinking about the front end and the user interface to the site, and I think I did a very good job there. It works and it works well. The Cafes is still a very nice site design. I spent a lot of time working on comments in particular, because that was the main feature Cafe au Lait and Cafe con Leche were always missing. I not so humbly think the comment system is second to none (though perhaps it could be a tad more obvious how to find it.)

Unfortunately I was so focused on the comments and the overall reader experience, that I neglected the other side of the user interface: how posts were uploaded, written, and managed. The process of writing and posting new articles was so involved that I tended not to do it. Adding a new article requires editing and manually uploading at least three separate pages. Consequently I’ve written very few articles specifically for The Cafes over the last several months. In a few cases I’ve actually written fairly long articles, but not gone to the trouble to upload them. (The negligible AdSense revenues haven’t really inspired me either.) Most of the recent articles on The Cafes started as long posts on Cafe au Lait or Cafe con Leche that grew past what I like to put on those sites.

By contrast, WordPress isn’t just nice for readers. It’s also nice for authors. In fact, it’s so nice, I’ve actually drafted one article for The Cafes in WordPress rather than BBEdit. WordPress makes it much easier to dash out quick notes on a variety of subjects, organize them, and catalog them.

There are some issues I have not yet addressed. I would love to rip out the cookies and replace them with decent HTTP Digest authentication, though that’s a bigger task than I feel comfortable undertaking just yet. I want to replace the Atom 0.3 and RSS feeds with a single Atom 1.0 feed. Possibly WordPress 1.6 will offer that option. And I absolutely must get rid of the hideous HTML escaped markup in the feeds. That’s too gross to be believed. It has to go. It is an embarrassment to have it here.

But I can do all that, sooner or later. The WordPress code is well enough designed that I can hack this all together. I’ve already made one change. I hacked the WordPress software to generate RSS/Atom feeds for the different categories subcategories, so you can subscribe, for example, just to the Software Development feed or just to the Testing feed. So far I haven’t even needed to ask for help on IRC or the mailing list. The combination of Google and the WordPress Codex has answered all my questions, though I still have a few doubts about whether my hacks are the right solutions to my problems or whether there are easier ways to accomplish what I want to accomplish. I may have to ask the mailing list for their judgment on that.

I’m not abandoning The Cafes. I still plan to publish my longer more focused articles there (Indeed I’m dual publishing this article on The Cafes and on Mokka mit Schlag) but I think Mokka mit Schlag is likely to see a lot more activity going forward.

P.S. Mokka mit Schlag is a form of German coffee covered in whipped cream I first encountered at Borsodi’s coffee house in New Orleans about 20 years ago. This site is dedicated to the memory of its proprietor, Robert Borsodi. If I’ve skipped an umlaut or doubled consonant or some such, I apologize to any germanophones reading this; but that’s how Bob spelled it.

SQL Date Types and Ranges in No Year

Monday, November 21st, 2005

in XML Schema there is a gMonthDay type which represents dates such as October 31; that is, Halloween but not in any particular year. How is this typically handled in SQL? The date type requires a year? Do I just have to define separate INT fields for month and day?

A related question: how are date ranges handled? e.g. the range from Halloween to Christmas (10-31 to 12-25)? Two columns for the start and two for the end? Or a start date followed by a number of days? Leap years make this tricky though.

And still a third question: ranges may extend for the entire year or a part thereof. Furthermore they may extend across the New Year’s boundary. e.g. their could be a range that goes from 11-3 to 3-15. How is that handled?

And finally, to really complicate matters the range may be discontiguous. That is, it could cover March 15 to May 15 and September 15 to October 15, but not the intervening dates. However, the potential discontiguity is limited. In my application, there are never more than two contiguous ranges within a year.

I can hack this together, but surely I’m not the first person to need something like this. Has anyone seriously worked through a problem like this and published a detailed analysis of the different approaches for modelling this in SQL tables, and the advantages and disadvantages of each? References appreciated.