Compling squashfs-source on Ubuntu Jaunty
Jun/091
Sometimes you need to compile the squashfs module by yourself, sadly this does not work out of the box at the moment in Ubuntu Jaunty. The first thing to know is that it depends on the lzma module as it has some patches in Ubuntu which add lzma compression to it. To start up we just install the needed packages with this command:
sudo aptitude install lzma-source squashfs-source
After that we simply compile the lzma module with these 3 commands:
sudo m-a prepare
sudo m-a build lzma
sudo m-a install lzma
If we would do the same steps with the squashfs module, the build will not work, we’ll have to fix some code as the supplied is not compilable against that kernel version. The source code for the squashfs module is stored at /usr/src/squashfs.tar.bz2 which we need to edit, so we temporarly extract it to /tmp
cd /tmp
sudo tar jxf /usr/src/squashfs.tar.bz2
The first change that we need to do is at line 693 in squashfs/inode.c where we need to replace the no longer existing function d_alloc_anon through d_obtain_alias. The other change is at line 2318 in the same file. The init_once function should only take one void* parameter instead of those two that are dcclared here, corrected line 2318 should equal to
static void init_once(void *foo)
After we are finished with the changes we have to repack the source code into the archive.
sudo tar jcf /usr/src/squashfs.tar.bz2 squashfs
Now, we are able to build the squashfs module with the already known commands:
sudo m-a build squashfs
sudo m-a install squashfs
Thanks to Carlos Costa who wrote an article how to fix this squashfs compile problem in general.
Simple filecaching of a method result in Ruby
Jun/090
With the new version of the Last.fm nationality statistics I’m scanning the content of the user’s whole music library. Since this is a task which needs a lot of time I needed to cache the result. First, I thought of caching it in the database, but as the cached data is a bit bigger and sending the data from the harddisk to the database server and then to the script would be too much overhead. I implemented a simple file caching algorithm.
My version could be easily used as you only need to supply the filename where the method result could be already be cached (the default lifetime of a cached result is one week) and the method that should be called if the cached result is outdated as a block. The following code shows how my algorithm is implemented and how it can be used:
New version of Last.fm nationality statistics
Jun/092
After some time of work, I’m proud to announce that I released the second version of my nationality statistics. There have been a lot of changes done in the last time:
- Added some various tag->country mappings
- Introduced United Kingdom as a nation instead of seperating it into England, Scotland and Wales
- Using my latest version of ruby-scrobbler
- Now the whole library is scanned for artists and their nations except than only the top 50 artists (This makes the script a bit slower but the result are now better)
- New caching algorithms and times: Your library is stored for 1 week, the result of “Which nation is artist # from?” 3 days and your charts get regenerated every 24 hours.
Last.fm nationality statistics
Apr/098
There was a webservice that made a chart showing which countries I listen to.
Some months ago it vanished.
Because I really like to see to which countries I listened to, I just wrote a similiar mashup using Last.fm, Freebase and Google Charts. I won’t go into detail, just check your Last.fm nations. If a artist’s country is classified as “Unknown” feel free to add it as a comment here, I will try to get it fixed
Broadcasting our Abistreich with Icecast2 und VLC #2
Mar/090
Still I am messing around with the combinations of Icecast2, ezstream configuration and well encoded videos delivered from ffmped2threora. Depending on which flags I set on the ffmpeg2theora command line, VLC stops to play, does a 2 second pause between 2 tracks or just continues seamlessly. I hope I get it managed till next week Monday but I am at the moment really scared that I have write my own app which displays the video.
One important thing that I found out is that VLC always has problem if a theora video stops unexpectedly, so using the SIGUSR1 signal with ezstream to skip to the next track is something which I shouldn’t use, so I will change my strategy from playing an hour long track between 2 Videos to playing a short 30 second track in the breaks which gets often repeated since this may be producing more cpu usage on client and server, but there is no need to skip parts of a video which could cause the mentioned bug.