Freitag, Dezember 14, 2007

play music stream with mpd

So far I played audio streams with xmms or mplayer. Music on my PC is played with mpd. I'm a friend of using the same program for the same task. Searching for an solution I found a desrciption on playing a playlist with mpd from the browser.

For a test I added an URL by hand and played it:
mpc clear
mpc add http://85.159.184.42:80
mpc play

The status showed the name of the stream, Virgin Radio - The music we all love.

The next step was to create a playlist (m3u) with more URL's. Unfortunately mpd will show you the URL used in the playlist. Only after the stream was played the name is displayed if you list the playlist.

Using an extended m3u (#EXTINF:-1,1.FM - 80s Channel) didn't change any thing at the behavior. To be able to see the name of a stream and not only the URL before playing is possible. But for this a m3u playlist for each stream is need and named appropriately.

Using mpc on a PC this is not a problem. But from remote with a palm listing the loaded playlist and select the stream to play would be much easier as to load a new playlist. My be there is a better solution for the palm.

Donnerstag, Dezember 06, 2007

get rid of floppy and zip backup

Searching for some old data I realized it was only stored on a floppy backup. As only may old computers still have a floppy drive, this is the last chance to read and save the data. The other thing to keep in mind is that the magnetic field on the floppy will decrease over time. Not sure after how many years a floppy will still be readable. And if you think about the HD sizes today, you will not notice the data you copy from your floppies.

The same is true for the zip media I have. As I have much less zips as floppies and the drive is external I decided to get rid of this first.


  • copy the data with rsync of each zip into a separate directory

  • backup all this data onto a second HD

  • calculate the md5sum of the files and remove the double ones



There is no need to spend (loose) some time and sort the data. There was no need to access the data for some years, there will be no need in the future. And if, the new index and search tools like beagle will find the data anyway - and quicker as I am, no matter how the data is sorted.

Why keep the data at all, if I think I will not need it in the future. Nostalgic, like the stuff from university. Reference, some mails, letters, etc. And as I said the data doesn't take any space. We still talk about Mega Bytes in a time where HD's start to be measured in Terra Bytes. Way spent time to reduce the space used for the old data from 0.1% to 0.05%?

Sonntag, November 18, 2007

backdoors in cryptography

Bruce Schneierin his blog about a possible backdoor in Dual_EC_DRBG. As I'm no security expert its difficult/impossible to follow all security discussions. I don't have the time and the knowledge.

One commenter maid a good point:
most of the programmers don't have crypto background and will just get the algorithm, test cases and go on implementing it
Probably the only thing I'm able to do about this is to use only a hand full of security programs and select very carefully one of the possible algorithm they provide.

But what is with the programs I have to use e.g. bank access. Are I'm now getting paranoid?

Donnerstag, November 08, 2007

write my own firefox plugin

As I don't use/like iTunes I download podcast directly from the RSS feed or the web page. Using Save Link As ... of the browser doesn't really work if you download a bulk of podcasts at the same time. So far I copy links by hand into a file and throw this at wget. This works fine. But to optimize this I would like to be able to add the link directly from firefox to the download file.

For this I need write my own plugin. I found the start point on how to write a firefox plugin on lifehacker some time ago.

This are the steps I used to write my plugin. In the lifehacker article and the referenced links you get the details.

create a new profile and set (about:config)
javascript.options.showInConsole = true
javascript.options.strict = true

not found:
nglayout.debug.disable_xul_cache = true
browser.dom.window.dump.enabled = true

install extensions:
JavaScript Debugger
Console
Chrome List
Firebug

Download the example from Mozilla knowledge base as a starting point.
install.rdf: increase the em:maxVersion to the firefox version used
overlay.xul: add the entry for your own context menu entry
  <popup id="contentAreaContextMenu"> 
<menuitem id="yb-context-tagLink"
insertafter="context-bookmarklink"
label="This is my right click"
class="menuitem-iconic"
oncommand="HelloWorld.onContextCommand(event);"/>
</popup>

overlay.js: add the function to be called from the context menu
  onContextCommand: function()
{
var file = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
file.initWithPath("/tmp/getPodcast");

var foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
.createInstance(Components.interfaces.nsIFileOutputStream);

foStream.init(file, 0x02 | 0x08 | 0x10, 0666, 0); // write, create if not exists, append
foStream.write(gContextMenu.linkURL+"\n", gContextMenu.linkURL.length+1);
foStream.close();
}

The defined functions are part of an arry initialisation. So don't forget the comma as I did the first time.

Examples on file I/O is on firefox code snippets. Adding an entry to the context menu and getting the URL is from the del.icio.us extension.

Sonntag, November 04, 2007

bittorrent and dht

So far I used Enhanced CTorrent. This client is a cli tool and runs fine on the NSLU2. A few weeks ago I tired to download a torrent but the tracker was never found. I asked a friend if the is able to download the torrent with Azureus. He was able to download the torrent. Therefor I checked the features of Azureus and ctorrent. Dht (distributed hash table) caught my attention.

The only client I found that supports dht and is able to run on the NSLU2 is rtorrent. The dht support is so far not part of the official distribution. A patch to add dht is provided by Josef Drexler.

First download the patch wget http://tk.ttdpatch.net/~jdrexler/dht/dht.diff to see what revision of rtorrent you need. The first time I downloaded the wrong revision as the web page was not updated. Download with svn co -r 987 svn://rakshasa.no/libtorrent/trunk the revision the patch was created from. Or check with svn info if the already downloaded revision is the correct one.

Start with libtorrent:

  • ./autogen.sh

  • ./configure

  • nice -n 19 make

  • make check

  • sudo make install


After this do the same steps for rtorrent. If all works fine apply the patch (patch -p0 < dht.diff in trunk) and build libtorrent and rtorrent again.

add to .rtorrent.rc:

  • dht = auto

  • dht_port = forwarded port