Thinkpad X300

The not yet released Lenovo Thinkpad X300 seems to be a worthy competitor to the Apple Macbook Air, but with more features than the Air and with Solid State Drive (SSD) as the only storage option makes it smell even more expensive.

It has been a bit too little about software development in this blog lately. I’ll try to remedy that soon!

Using F-Secure Health Check to save hard disk space

After my struggle to install Flash I finally managed to run F-Secure Health Check on the only computer running Windows in the house, my gaming computer with with 512 megabytes of RAM and only 40 gigabytes hard disk drive. It is almost ancient by today’s standards and I had old versions of numerous softwares. At first I thought of the suggested path, upgrading everything, but I quickly realized that I could just as well remove out-of-date programs that I didn’t even remember why I had installed them or when I last used them. Otherwise they might get out of date again before I needed them…

XSLT hacker

So far, this week has been a week of XSLT hacking. My favorite is probably the XSLT script that generates another XSLT script! 🙂

At one point I wanted to copy the default namespace (xmlns=…) from the source document to the destination document.

I did like this to retrieve the URI for the default namespace. Maybe there is a simpler way?

<xsl:variable name="uri" select="string(namespace::*[name(.) = ''])"/>

In order to set the default namespace I found the excellent Creating namespace nodes in XSLT 1.0 blog post. The most relevant part was this hack:

<xsl:attribute
  name="{ concat($prefix, ':dummy-for-xmlns') }"
  namespace="{ $uri }">
</xsl:attribute>

I’d also like to mention that Jing seems to work fine for validating an XML document against an XML schema definition (XSD).

On the bus, and not

I’m writing this on the bus on my way back home from work. The handwriting recognition on my Nokia 770 takes some getting used to but works quite alright. I’m thinking of buying a Nokia N810 but I’m not so sure.

Starting from this sentence I’m writing from the comfort of my study. The travel sickness chewing gum prevented me from yawning, getting a head ache and feeling sick, but my brain still feels foggy a few hours later, even after eating and taking a nap!

I won’t buy an Nokia N810 when I can’t use it on the bus. Damn travel sickness.

Maybe I should get a Macbook instead? 😉 I’m a bit tired of suspend/resume not working 100% correctly with Linux on my Thinkpad. The brand new MacBook Air seems cool but expensive!

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.)

Installing Adobe Flash Player on Windows XP: Problems and solution

Yesterday I wanted to run the excellent F-Secure Health Check web application on my gaming computer. The health check only runs in Internet Explorer, but I don’t use IE if I can avoid it and apparently I had no Flash Player working with Internet Explorer 7. When I tried to install the Flash Player from Adobe’s web site, it failed no matter how much I fiddled with the IE security settings. I found a stand-alone Flash installer on Adobe’s web site and when I ran that installer it failed at “Registering flash9e.ocx”. Registering means OLE/COM/ActiveX stuff, wonderful!

The flash9e.ocx file was nowhere to be found after I closed the installer, but when I ran it again and the error message above was shown the file was available in the directory c:windowssystem32macromed. I ran regsvr32 c:windowssystem32macromedflash9e.ocx and got error code 80070005, meaning “access denied”. Access to what? The registry maybe?

I downloaded and started RegMon with the string regsvr32 and errors only as log filters, ran the installer again and discovered a couple of registry entries that caused access denied errors. The first one was HKEY_CLASSES_ROOTFlashFactory.FlashFactory and that led me to a helpful message in a thread called cannot install flash ActiveX in the Flash Player forums. A number of registry keys for Flash were obviously owned by a different user account and with the instructions from the message I could start the tedious job of removing the registry keys. After going through all clicks for removing a few keys I tried to think of a simpler way.

My gaming computer has two user accounts apart from the Administrator, one for myself and one for my wife. All of these accounts are members of the Administrators group. I was logged in as my own user so I tried to run the registry editor with the Administrator user account instead, but got access denied too. I had probably installed Flash for my wife at some point, so maybe she owned the registry keys? When I started the registry editor as her user, I could remove the registry keys fine! Wonderful! I had to do another sweep with RegMon before I found all the keys I needed to remove.

I ran the installer as the Administator user so that the registry keys will be owned by that user account and now it installed fine. I ran Internet Explorer as the Administrator user too, but the F-Secure Health Check web site still said it couldn’t find the Flash Player. A after some fiddling with the web installation of the Flash Player I got the health check running! I was too tired to check if Flash worked properly for me and my wife in IE and Firefox after all of this so that might be an exercise for another day.

If I would install or upgrade Flash Player on a multiuser Windows XP machine again, I’ll do it as the Administrator user.

If I had too much time on my hands I would make a program that changed owner of all the relevant registry keys to the Administrators group. Others would have use for it.

A new keyboard for my Nokia 770 web tablet?

The Logitech diNovo Mini keyboard looks much better than the Nokia Wireless Keyboard SU-8W I got for my Nokia 770 but never use! If it works I could actually do some blogging to or from work, now when they have wireless Internet on the bus. I will also need a travel sickness chewing gum but that’s another issue. The $150 price tag keeps me away, but if I sell the old keyboard… no, I’d rather get the Nokia N810 web tablet instead and not only get a built-in keyboard but also GPS, web camera, etc. If only it cured my travel sickness too.

Rant about Ruby on Rails

Zed Shaw rants quite a bit, stating that Rails Is A Ghetto. Most things I read about RoR are good things, and I guess that some of it is written by the people that Zed grumbles at. It is quite refreshing to hear other opinions, even if they might not be what I want to hear.