Writing Web Applications

The last few weeks I’ve been writing a web application. My first.
I used perl for the back-end, and HTML and Javascript for the front-end. It is far enough along that I announced it to the community it is aimed at.


I’d like to thank Robert Gault, Joel Ewy, and Darren A. for wonderful feature suggestions and bug reports.
My biggest mistake so far was not doing enough testing when I moved the app from the development machine (Max OS X) to the deployment machine (Debian). I had it in my mind to do the testing, but when everything was working so wonderfully on my development machine I decided just to release without testing everything. This caused a 12 hour period where the site was up and down and things did not look so good. But I got thru it.
Finding little differences between Linux and Mac was an interesting problem. Opendir/readdir on the Mac will return alphabetically sorted entries, on Linux it won’t. There was also a weird problem with a system() call. When calling ImageMagick’s convert program I would pass computed cropping and resizing like this:

'-crop', $width."x".$height."+".$left."+".$top, '-resize','540x700'

On Mac this would produce the a correctly cropped and scaled image, maintaining the proper aspect ratio. But on Linux the image would be stretched to exactly 540 pixels by 700 pixels. The fix was to do this instead (this works on both Mac and Linux):

'-crop', $width.'x'.$height.'+'.$left.'+'.$top, '-resize','540x700'

I really can’t explain why one would work and the other wouldn’t.

Update: I published this entry on September 7, 2008 10:42 AM, and Google did it’s first read of my project at: September 7, 2008 11:10 AM. Neat.

Packages of Two

The other day, my 10-year-old daughter comes into our bedroom and asks, “Can I have a Poptart™?”
My wife and I have the exact same response, though she said it first, “You can have one.”
This sends Megan into a fit. She wants two! Our thinking is this: Poptarts™ come in packages of two, she’ll cook two, she’ll be full after eating one, the other will be wasted. Just as my wife starts yelling back at her to calm down and use her “Quiet Voice”, something unusual happens to me. I become calm and I know exactly what to say.
“Megan, cook only one, and we’ll see how you feel afterword about the other one.”
Megan calms down, says, “OK.”
Just as she turns around I say, “And put the other Poptart™ in a bag.”
Mentioning the bag after she agreed to eat only one was important. She already accepted the deal, so the bag didn’t affect her attitude.
And this is why I’m eating the last tasty Poptart™ in the house right now.