Another Reason I Hate Internet Explorer

January 23rd, 2008 by Andrew

I’ve never calculated it, but if I had to guess, I’d say I spend 30% of my time designing a site, 30% implementing the site, and 40% fixing it up so it will work in Internet Explorer. This goes for CSS and Javascript. I recently discovered mootools, a nice Javascript framework with some cool effects. In the past I have also used, but I wanted to try something new. So while writing some new code for Mootools, I discovered that the Javascript worked fine in Firefox (of course), Safari, etc., but Internet Explorer 6 and 7 died on it. Here’s an example:

var Site = {
	start: function() {
  	  if ($('givenow')) Site.giveNow();
	giveNow: function(){
		var size_closed = 56;
		var size_open = 110;
		var gn = $('givenow-a');
		var fx = new Fx.Styles(gn, {wait: false, duration: 300, transition: Fx.Transitions.Quad.easeOut});
		gn.addEvent('mouseenter', function(){
			fx.start({'width': size_open});
		gn.addEvent('mouseleave', function(){
			fx.start({'width': size_closed});

Can you see what’s wrong with that code? I couldn’t see it for about 30 minutes. IE kept giving the error “expected identifier, string or number”, and pointed to the last line of the script as the problem location. Well, the last line looked fine to me.

What it ended up being was the final comma after the function giveNow. Huh? Well, it seems that when grouping functions like this in an object, the last function shouldn’t have a comma after it. Firefox and everything else handled it just fine. Internet Explorer decided it wouldn’t run any of my Javascript code after seeing that. Thanks for making life wonderful, Internet Explorer.

Another Day Out My Window

January 20th, 2008 by Andrew

This time around my bash script for gphoto started when it was supposed to. I captured a full day worth of photos, 1 every 60 seconds. The frames were captures on January 18th, 2008. I ended up with 710 photos in the final video, which is about 11.8 hours worth of the day. When I made the video, I set the delay to 1/10th of a second, resulting in 10 photos per second. So every second of this video covers 10 minutes of the day.

This video is better than my first attempt, but still not as awesome as I’d like. The morning started cloudy and a little snowy/rainy, then the clouds moved away and the sky turned bright blue until sunset. I’ll need to find a better vantage point to take some more striking images.

Another hindrance to finding a good location is that gphoto still doesn’t work correctly on Mac OS X. That means I can’t use it on my laptop, so the camera has to be tied to my Ubuntu box. Even though I installed gphoto2 with Mac Ports, I can’t find any solutions to the delay and disappearing file problems I’m having.

One Day Out My Window

January 17th, 2008 by Andrew

I finally got the Nikon EH-5a, the $70 power cord for my camera. It’s crazy that a cord can cost that much money, and all it does it supply my camera with power from a wall socket. I put it to use though, by running my camera all day on the 16th. I shot out my window towards the woods. Unfortunately it was a really clear day, the sun was never really in the picture, and the script didn’t start when it was supposed to (6am). Lots of problems. So the video’s kind of boring, but it was a good learning experience for when I do more time lapse videos.

Here’s the process I used. I installed gphoto on my ubuntu box. Gphoto allows you to control a capable camera with your computer. It’s a very neat program. There are tons of options I can play with, and I think everything is controllable through the software from aperture to shutter speed to white balance and ISO. I didn’t use any of its crazy capabilities though. I just wrote a bash script that called it every 60 seconds to take a picture and download it to the computer. I set the camera to aperture priority (A) mode. That way, the depth of field of the images wouldn’t change throughout the day, only the shutter speed.

Once I had a directory full of photos (just under 600), I ran ImageMagick’s “mogrify” command on them to resize them all to 600×366. From there, I used ImageMagick again, this time it’s “convert” command to turn all the jpegs into an mpeg, with 5 jpegs every second. This resulted in a movie that plays for a little over a minute that shows about 12 hours worth of time.

Y2K38: The New Y2K

January 16th, 2008 by Andrew

Remember the Y2K scare? Everyone was afraid the world would end when clocks changed over to January 1st, 2000. Why? Because many antiquated computer systems were never programmed with knowledge of the year 2000. The values for years on these systems were stored as only two numbers. So 76 meant 1976, and 00 meant 1900. So what would happen when the year changed from 1999 to 2000? The computer thought it was 1900 again. There was a wraparound problem. Luckily, the world didn’t end, and no major catastrophes resulted.

Fast forward 38 years to 2038, when a similar problem will occur. Unix timestamps are used to keep track of time for many systems. A Unix timestamp is the number of seconds since the Unix epoch, which was January 1st, 1970 at 12:00am. Unfortunately, these Unix timestamps have been stored using only 32 bits as signed integers. The maximum signed integer which can be represented in 32 bits is 2,147,483,647 seconds. January 1st, 1970 12:00am plus 2,147,483,647 seconds is January 19, 2038 3:14:07am. When it turns to 3:14:08am on that day, the Unix timestamp will wraparound to -2,147,483,648, so those seconds would be subtracted from 1970, giving you a date of about 8pm on December 13, 1901.

There have already been reports of problems from this. Many programs which calculate dates into the future more than 30 years, and use Unix timestamps, are likely to fail or get very confused at the least. There doesn’t appear to be any easy solution to this problem. Changing from 32 to 64 bits would allow us to calculate time in seconds for another 290 billion years. Unfortunately, the standard 32 bit timestamp is used in so much software and hardware that it’s impossible to update everything that relies on it. We’ll see what happens in 2038… or should I say 1901?

PowerBook RAM Upgrade

January 11th, 2008 by Andrew

I had meant to post this back in August when it was relevant. I didn’t.

When my PowerBook hard drive crapped out on me, and I had to use Disk Warrior to retrieve all my data, I decided it was also a good time to finally upgrade my memory. Here’s a before and after of my memory usage:

Before and After