Lovely test data

I’ve spent most of my weekend thinking up names. Am I having a baby? NO! Do I need a killa handle for my next l33t project? No. Am I thinking of running away and setting up a new life for my self living in a tree? Yes, but that not why.

The reason I’ve been thinking up new names is I’ve been testing my latest, greatest app and needed to fill it with test data. I hate thinking of test names. Normally I end up with bob, bob1, bob2 or my favourite piece of test data “rich is gay”. That’s fine if you just want a few test name, but what if you want say 1000 or 2000 or 10,000. That were Benjamin Keen‘s Data Generator comes in. It’s a little script that create random data perfect for shoehorning in to any app you want. It will even output CSV, MySQL, XML, Excel or HTML and best of all it’s GNU

I’ve put a copy at http://www.deaconsworld.org.uk/datagenerator/ to try and save him some bandwidth.

Extreme ASCII Art

LibcacaWhilst procrastinating over yet another dead line, I thought I’d have a play with libcaca, the completely useless yet completely brilliant Colour AsCii Art library. libcaca is a graphics library that output text rather than images. The genius part of it is that you can use it as a video output in mplayer and display all your wonderful HD videos as text!

I always love stuff like this. You can see how much work as gone even though it’s a complete waste of time. It’s a similar idea to NetQoS‘ Network management display which again is great but completely useless. Check that out here http://www.techcrunch.com/2007/04/10/watch-your-network-play-space-invaders/

whois who?

Anyone noticed that Verisign have changed their whois server recently (or not so recently)? It’s been bugging me for a while cos when I’m doing whois lookup, all I get is the abbreviated info form like this:

[adam@dyn89 ~]$ whois -n microsoft.com
[Querying whois.verisign-grs.com]
[whois.verisign-grs.com]

Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

Domain Name: MICROSOFT.COM
Registrar: TUCOWS INC.
Whois Server: whois.opensrs.net
Referral URL: http://domainhelp.tucows.com
Name Server: NS1.MSFT.NET
Name Server: NS2.MSFT.NET
Name Server: NS3.MSFT.NET
Name Server: NS4.MSFT.NET
Name Server: NS5.MSFT.NET
Status: clientDeleteProhibited
Status: clientTransferProhibited
Status: clientUpdateProhibited
Updated Date: 10-oct-2006
Creation Date: 02-may-1991
Expiration Date: 03-may-2014

Well I finally updated my jwhois.conf to include the following lines in the server-options section

"whois\\.verisign-grs\\.com" {
whois-redirect = ".*Whois Server: \\(.*\\)";
}
Wahoo! now I get useful whois data:

[adam@dyn89 ~]$ whois microsoft.com
[Querying whois.verisign-grs.com]
[Redirected to whois.opensrs.net]
[Querying whois.opensrs.net]
[whois.opensrs.net]

Registrant:
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052
US

Domain name: MICROSOFT.COM

Administrative Contact:
Administrator, Domain domains@microsoft.com
One Microsoft Way
Redmond, WA 98052
US
+1.4258828080

Converting Unix time to Time stamps

I’ve been busy with a lot of time dependant code this week and working in Unix Time (number of seconds since epoch) has been making my brain go a bit squishy. Here a nice little code snippet for converting unixtime to a proper timestamp

perl -e 'print scalar localtime($ARGV[0]),"\n"' [unixtime] so: perl -e 'print scalar localtime($ARGV[0]),"\n"' 1172160024
Thu Feb 22 16:00:24 2007

If you use this a lot, there’s nothing to stop you putting this in a nice little script, such as:

#!/bin/perl
print scalar localtime($ARGV[0]),"\n"

Recording RealAudio streams and converting them to MP3

A friend of mine recently had his 5 minutes of fame of Five Live and asked me to if I could covert the “Listen again” to an mp3 so it could be saved for the good of Humanity. Here how I did it:

  1. Finding the name of the stream can sometime be a bit tricky. If you can get it to play in the stand alone RealPlayer then you can just click on File->Clip properties->Clip source. This will then bizzarely open a webpage. You looking for an address like rtsp://rmv8.bbc.net.uk/radio5/anita_mon.ra. If you can’t open it then it’s a case of looking though the source of the page.
  2. Now you’ve got the address, run the following command:mplayer -noframedrop -dumpfile file.rm -dumpstream rtsp://rmv8.bbc.net.uk/radio5/anita_mon.ra
    This will save the clip as file.rm. Watch out though, this is recorded in real time. So a 3 hour radio show will take… 3 Hours!
  3. Next you need to covert the realmedia file to wav, again mplayer is your friend mplayer file.rm -ao pcm:file=file.wav -vc dummy -vo null
  4. Last stage is to convert from wav to mp3 using lame. I like to hedge my bets and encode it as VBRlame -V file.mp3 file.wav --tt "Title" --ta "author"

You should have have a shiny MP3 file for your troubles.

Return top