Welcome to Geoffrey Swift's βlog. Please subscribe to the Atom feed.


Blog attempt

Have refactored the XSL code for the podcasts/site updates pages, so that an XPath query can be passed into a generic implementation. This means I can have the blog.php page filter out individual posts for permalinks and by category currently. I'm doing this by manipulating DOM nodes in the XSL before applying it, seems to work alright anyway. This essentially paves the way for making a more fully featured search engine and navigation system. Maybe once it's working and I've run out of things to implement I might have more to say to justify its existence!

Radio Play list

While listening to internet radio stations, I found it a bit tedious to have to visit the radio station's site and find the link to tune in. This would then clear out the play list in media player.

My solution is a php page, which aggregates the play lists from various sites: http://www.trollied.org/~blimey/radio.m3u. Now I can channel-hop, just as I would when watching TV!

This wasn't so difficult to implement, the radio stations use either file format of m3u, pls or asx. The asx file format was tackled with some xsl, pls files are parsed with php's parse_ini() and m3u was absolutely effortless. I used the curl library in php to make a HTTP HEAD requests, to check each of the streams are up.

This is something I wrote for my own use, but I realised others might find it useful. I started a thread advertising this on the dogsonacid forum, so it will be interesting to see if there's any feedback.

Sanity checks for legacy browsers

I've been using a few sites which take screenshots of a website in different browsers for you. This sites are: http://browsershots.org , http://www.browsercam.com and http://www.browsrcamp.com/

This is a very useful service. It has enabled me to find and fix problems in legacy browsers. In many cases there is just a sanity check to detect whether the browser is capable of performing a required feature. Some problems I haven't yet solved because the browser simply crashed without giving me any kind of error message to go on.

XHTML document.writeln() imposter functions.

I thought it'd be a nice idea to include my del.icio.us tagrolls on my homepage. This is made possible by some JavaScript served up by their website. Unfortunately their implementation relies on document.writeln() which is not compatible with XHTML.

Undeterred, I created imposter versions of document.write and document.writeln. My implementations progressively concatenate the parameters into a buffer. When the web page loads, the buffered XHTML is positioned appropriately by using an empty placeholder tag.

I originally tried parsing the buffer as an XML document, with the intention of merging the XML nodes into the XHTML document. I tried using xmlDoc.documentElement.cloneNode(true) as a parameter for appendChild() on an XHTML node.

While this worked like a charm in both Firefox and Opera, Internet Explorer complains of "Interface not supported" and Safari has a fatal error! The failing browsers have an incompatibility of XML and XHTML DOM nodes, even though they both support a common DOM interface.

In the end I had to write my own version of cloneNode() to copy elements between the incompatible schemas and ensure valid nesting of elements. There's an exception handler that fails over to using innerHTML complete with IE kludges just in case.

If you're interested to see how this was achieved, please feel free to view the JavaScript source code.