an unknown filter was not added: DEFLATE

I looked in Apache’s error_log file and noticed multiple lines like this:

an unknown filter was not added: DEFLATE

After thinking a bit I recalled that I added the following line in the .htaccess file in the root directory for on one of my domains, but never tested it properly:

AddOutputFilterByType DEFLATE text/html text/plain text/xml

The fix is easy: enable mod_deflate. On Ubuntu:

$ sudo a2enmod deflate
Module deflate installed; run /etc/init.d/apache2 force-reload to enable.
$ sudo /etc/init.d/apache2 force-reload
* Forcing reload of apache 2.0 web server...

Why did I add the above filter line in the first place? It was suggested by YSlow.

Update Another kind of fix is of course to remove AddOutputFilterByType.

My first AJAX!

Probably years after everyone else, I’ve made my first AJAX-enabled web page today. As I do this from within Ruby on Rails, it was virtually painless to remove or replace a piece of HTML.

My next AJAX step was to get in_place_editing working. The first problem was the InvalidAuthenticityToken and the second issue was that I use a different controller, but now it works fine!

Sneak-peak at HTML 5 – no frames!

The page HTML 5 differences from HTML 4 (W3C Working Draft 22 January 2008) contains a long list of changes. The removal of frames was probably to be expected. Multiple elements and many attributes that only have a presentational function in HTML 4 are removed. There are also some elements that have slightly changed meaning, for example <i> and <b> are given a semantic rather than presentational function. Quote:

The b element now represents a span of text to be stylistically offset from the normal prose without conveying any extra importance, such as key words in a document abstract, product names in a review, or other spans of text whose typical typographic presentation is emboldened.

A “proxy” that converts a Real Player audio stream to MP3?

While working on creating an Atom feed from a web page I got the idea to create a proxy that takes an audio stream in Real Player format over RTSP/RTP/RDP and converts it to MP3 over HTTP. It should actually not be harder than to use mplayer to “play” the stream to lame and then output over HTTP. The selling point of this would be the possibility to save the MP3 stream to a file, so that you could for example have an hour of an Internet radio station downloadable as a podcast.

The decoding and subsequent re-encoding would take some bandwidth and CPU power, so there would need be more than one node and maybe both geographic and round-robin assignment of clients to nodes. As the Internet radio stations essentially only send 1 second of radio per second, the bandwidth per client connection would automatically be kept low. No audio data is stored on disk on the nodes, it just shuffled though the proxy.

There is also a potential security issue. If someone could craft a stream that caused mplayer to crash, they might be able to run code on the proxy server. The nodes should probably at least run mplayer chrooted.

An even simpler version would simply provide the Real Player stream over HTTP and that could probably support video quite easily. A more complicated system also re-encodes the video.

Creating an Atom feed from a web page

Most of my time at the computer yesterday was spent working on an unofficial syndication of the broadcast archive for the Swedish radio show P3 Rytm. It’s actually quite simple… đŸ™‚

  1. Use curl to download the web page broadcast archive for the show
  2. Use iconv to convert the page to UTF-8
  3. Use tidy to convert HTML to XHTML
  4. Use sed to adjust some URLs
  5. Use xsltproc and an XSLT script to transform the relevant parts of the web page to an XML that almost is an Atom feed
  6. Use sed to convert the dates in the XML so they are in the right format. It’s now a proper Atom feed.

Update Of course there are several online services to automate this. (Read the comments too.)

Good domain names are hard to find

As the The Project is a web site, I had to look around quite a while for suitable domain names. Many of my desired names were already taken, but IIRC none of them was actually used for something. Some are probably a case of domain name speculation, some may be registered by people with a project idea similar to mine. I found and registered a .se domain but I couldn’t find a good .com domain available.

Maybe .com and .se domain names are too cheap, so people buy them at a whim? I have another idea for a neat domain name that could contain a useful web site, requiring the .im TLD. The Isle of Man does not sell their domain names cheap! One year is £40, two years £68 — not including VAT! That’s actually not a lot of money, but when making web sites for fun like I do, you don’t get much revenue.

I’ve found two really good competing sites for the original use I intended for the .im domain name. If I get it I need to broaden the scope, but that might not necessarily be a bad thing. Most websites on related topics usually have really lousy web design, so even I could make something better! I have some ideas but when will I have time to realize them?