Apache versions and .htaccess files

The other day I was looking into a problem someone was reporting with an Apache RewriteRule, only to conclude that it was using features of the Regex library which weren't available in their version of Apache. I found a means of detecting the different versions of Apache using the mod_version module. This allows you to write htaccess files which can fall back to other rules for older versions of Apache. Unfortunately it's only been available since version 2.0.56, but given that this was before the first release of version 2 it's fairly safe to assume that anything without mod_version will be running Apache 1. I will concede that this sounds very obvious, but there was a surprising lack of results in google for any of the keywords that I thought to try. For the benefit of anyone searching for this; below is an example of how you can use mod_version in practice:
<IfModule !mod_version.c>
        # Earlier than version 2.0.56, so almost certainly 1.x
        # as 2.0.63 was the first release of version 2.
</IfModule>
<IfModule mod_version.c>
        # Version 2.0.56 or later
        <IfVersion < 2.2>
                # Before version 2.2
        </IfVersion>
        <IfVersion >= 2.2>
                # Version 2.2 or later
        </IfVersion>
</IfModule>

Not your regular TI-83

I've only ever owned one graphical calculator, a TI-83, which was bought for me around when I started Secondary School. It was the device on which I broke my programming teeth, making crummy games and utilities to make maths exercises less tedious.

The other week I was experimenting with the HTML Canvas element for another little side-project of mine when I was reminded of the Graph Plot screen which my old calculator has. Essentially it lets you enter a Cartesian equation which it will then plot on the screen.

Subsequently, over a couple of days I put together a Javascript powered equation plotter, with much the same functionality as my TI-83. Oh and in the process I found a bug in the WebKit nightly, which they swiftly fixed.

You're free to use the source to the how you wish, if you're that way inclined (it's a client-side web script so it's practically open source off the bat). Under the hood it makes use of the MooTools javascript framework, though I've not made use of its features extensively, so It would only be a matter of an evening's work to remove this dependancy.

Making the most of Pandora.com

Pandora.com is pretty cool, it's been around for a while now but I just went back to it for some easy listening background music to work to. Supposedly they've begun to use IP filtering to limit the audience to the US. Either this is no longer in place or they've made a mistake in a regex somewhere, as this is definitely not the US. I'd forgotten about the limit to the unpaid service, which stops playback after so many songs, but it was quite a while before I actually encountered it. This may be a Mac OS X bug in the flash implementation, but it seems that if you keep the Firefox window containing the player minimised in the Dock, the music doesn't stop playing! Of course this does get in the way of the whole feedback system slightly, but I'm sure there are those who won't mind too much. Once I did encounter the limit I couldn't just refresh the page and go back to listening again as they're smart enough to stop you doing that. But not that smart. To completely stop this you would require either some heinous DRM-spawn system describable as cookies which you can't delete, or some kind of unique client ID, effectively voiding all browser privacy. So to be fair, from the technologies they had to work with, they've done the best they could. ;) So once you've been shut out of the Pandora player try the following:
  1. Delete your cookies from their domains.
  2. Delete any data stored within Adobe Flash for their domain.
The latter can be achieved by opening the Adobe Flash client settings and changing the data limit for the domain to 0KB, which will take effect upon refreshing the page, upon which the flash applet will request to store data in your browser again, and you're back listening, but without any of your stations.

Update:

It appears that the region filtering will go live on January 15th, not quite yet.