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.

http://cocomag.dyndns.org/UnderColor.shtml

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.

Brick

On the last episode of The Totally Rad Show Dan Trachtenberg mentioned that Brick was a good movie and everyone should see it. His movie recommendations have always been good, so I decided to watch it. Thanks to my local video store I did just that a few days ago.

He mentioned it’s style was film noir, but with a twist. I enjoyed it a lot. As usual these days, it took me two viewings to fully understand the movie.

Copy and Paste on the iPhone

My guess as to why there is no Copy/Paste on the iPhone is because there is a software patent in the way. Steve Jobs prolly has a certain way he wants it implemented, and there is some patent stopping him from releasing it.
Apple is most likely negotiating right now with the patent holder or looking for prior art.
I have no evidence to back any of this up.

MacSOUP and Time Machine

Time Machine is Mac OS X’s backup solution. It supports incremental backups. Which is really the way to go. But I avoided it because of the email program I use: MacSOUP. Like most email programs it keeps individual messages in large files. I currently have 2.3 gigabytes of email. The actual implementation MacSOUP uses is to have a file for each mailbox.

My largest mailbox is 600 megabytes. The file grows every time I get email, dozens of times per day. This will cause a problems for me because my backup hard drive is the same size as my main drive. This means the drive will fill up very fast and I will have few incremental snap shots to choose from.

Apple got around this problem for Mail.app by keeping email messages in their own separate files. So Time Machine’s file based incremental backup fits nicely with that scheme.

I recently learned about the new bundle version of Apple’s sparse disk image format. Using this image format can really help keep Time Machine incremental backups from filling up the back up hard drive.

First some definitions. A disk image is a file on your computer that you can mount as a hard drive. It is becoming very common for software to be released on disk images. Like real hard drives, disk images have a maximum amount of data they can hold. A sparse disk image keeps the image file small and it will grow as you increase the amount data stored on the image. A sparse disk image bundle uses many 8 megabyte files to contain the image data. The small files are created as needed and writes to the disk image only modify the individual files that have changes.

This fits very nicely with Time Machine. MacSOUP can use it’s large files to store email and Time Machine has it’s small files for incremental backup.

Tidbits has a nice tutorial on how to create these sparse disk image bundles.

After copying all of my MacSOUP data to the mounted disk image, I made an alias of the MacSOUP settings file. The alias file resides in my documents folder. I then added that alias to my dock. When I click the alias, the system is smart enough to mount the disk image if needed and then open the file which starts MacSOUP.

a1 a1 fb

To no one’s surprise, I look at my search referrers quite often. Just now I saw someone search for “a1 a1 fb” and actually click on one of the pages I’ve written on the subject.

I thought this was interesting. I’ll leave the meaning of “a1 a1 fb” undisclosed at this point in time. But it is pretty arcane. Whoever searched on this, I applaud you!