More stupid web tricks coming your way…

I realize I’ve been working with PHP for too long when I get an idea like “I wonder exactly how birth rate affects population levels” and the first thing I think of is, “well why don’t I just build a PHP app to figure it out?”

This is the result of such thinking: Population Trajectory Calculator. It’s the newest addition to my Stupid Web Tricks page, and the first that’s not just JavaScript triggering an irritating pop-up.

This is probably just as pointless though, but it was a fun little exercise, and it’s starting to give me more ideas, which is always dangerous. Before long I’ll have built a web-based version of Oregon Trail.

I’m not kidding.

(Well, OK, I hope I am.)

Mac does Windows…

It’s old news that Apple‘s new computers all run the Intel Core Duo processor (or the unimaginatively — yet redundantly — named Core 2 Duo), and that thanks to Boot Camp, or a third-party app called Parallels (which I didn’t bother to buy, so I’m also not going to bother to track down the link), Apple’s computers can now run Windows natively.

Ultimately for no other reason than that it can be done, I naturally had to install Windows on my new MacBook. Tonight the “dream” (and I use that term without implying any positive connotations) became reality.

Sure, it’s great to have Windows, I guess. It benefits me mainly in that I can test my work in that most unpredictable of environments, Internet Explorer. I suppose it would also be handy for running Windows-only software, if there were any Windows-only software I actually wanted or needed to run.

The most striking characteristic I’ve noted so far is how obnoxious Windows software installers are. Installing a new application on Windows feels a bit like forcing your way through a crowded flea market, with aggressive hawkers pushing their wares on you. (In fact, come to think of it, that’s basically what it is.)

So far I’ve only installed 3 programs, aside from the OS itself (a harrowing experience in its own right), those being Adobe Reader, Firefox, and AOL Instant Messenger. I tried to install the latest version of Flash Player as well, but for some reason the installer just starts and then vanishes mysteriously. Ah, Windows.

Among those 3 installed programs, only Firefox did not accost me with multiple offers to install other, unwanted programs… or that perennial favorite, the browser toolbar. No thanks! I’m just coming for Adobe Reader. I really don’t care to also litter my hard drive (and desktop… and Start menu… and taskbar) with the likes of a 30-day trial of a watered-down version of Photoshop. And I definitely am not interested in the Adobe Yahoo! toolbar, nor can I even imagine what purpose it could possibly serve, other than to surreptitiously alert Adobe to the fact that I’ve surfed on over to my own website, wherein I’ve then proceeded to write and post a rant on the topic of invasive spyware.

It doesn’t have to be like this, people! (In fact, I am writing this once again having returned to the comfort of an operating system that just gets the hell out of the way and lets me do what I want to do thank you very much!)

Quickly now…

Just a quick one, as I don’t have a lot of time to post… but of course, as usual, I had to make time for a detour into the madness of Internet Explorer when I discovered that my CSS line-height positioning was breaking when there was an inline image in the text. Why? Who knows? But the solution involved sticking vspace=”7″ into each offending image tag. Yet another case of hacking a one-off solution into the code to work around an Internet Explorer quirk. Almost as frustrating as IE’s violations of standards is the fact that there’s almost never a one-size-fits-all workaround!

Forget what I said before; we have a winner!

It’s a given that anything I post here is going to be brain-deflatingly stupid. But this one goes beyond even what I would have expected of Microsoft. Fortunately, thanks to a highly effective Google search, I was able to solve the problem in minutes.

The problem was this: For a site I’m working on, we are manipulating the 404 error feature to allow users to set up customized URLs. If the URL entered doesn’t match a real page, it gets fed into this 404 error script, which looks up the path in a database and redirects the user to their customized page. A bit of a hack, but it’s pretty slick.

As usual, I am developing the site using Firefox as my test browser. But… UH-OH! Surprise! When giving a demo of this feature today using Internet Explorer, we discovered it didn’t work! Internet Explorer was not returning the server’s 404 error page, instead using its own internal version (which we’ve all seen and most generally ignore).

Drat! What to do? Well, as it turns out (thanks to the aforementioned Google search), the problem is quite simple. To quote the unbelievable but, as I verified, 100% accurate description I found on this page:

Internet Explorer has a lightly-documented “feature” that stops it from serving any custom 404 error page that is less than 512 bytes long. Your visitors will instead be sent to IE’s own 404 page, which is generic and suggests they use an MSN search to “look for information on the Internet.” That’s one way to lose visitors! Make sure your custom 404 error page is over this limit — about 10 full lines of text and HTML should be enough.

Yep, that’s it. I did my best Bart Simpson-at-the-blackboard impersonation, filling my 404.html file with a large comment block wherein I repeated (about 130 times, for good measure) the phrase “This block exists solely to force Internet Explorer to load this page.”

Sure enough, it worked. D’oh!

Thinking a bit more about this, I at least think I understand why Microsoft chose to do this. “If the server’s default 404 error page is so short,” I imagine them musing, “then it probably doesn’t offer users much helpful information. And since our wonderful web browser is much more important to our users than the web pages themselves, let’s just butt in and do things our way. (Is there really any other way anyway?)”