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.