Green Elf shot the potion!
Code News IconTue, 23 Sep 2008 10:05:23 GMT
Following on my new icons kick, while I'm feeling rough still. This time a new icon for the general topic of Code. That is source code, scripts, programs and the like, not secret codes, cyphers and cryptography.
Nice and simple, I wanted gears or cogs. So back to Wikimedia Commons to look for some public domain cogs.
Image:Cog-scripted-svg.svgPerfect.
And so, we get these.
Code JokesMon, 22 Sep 2008 11:51:50 GMT
Thanks to a link on the Bristol and Bath Perl mailing list, I stumbled over to this from xkcd.
I don't know why, but it stuck me as the funniest thing I've seen in ages.
For bonus Nerd points, here is the code as Perl.
Roleplay Tools in PerlThu, 04 Sep 2008 14:22:26 GMT
I've been collecting together the Perl versions of my various random stuff for roleplay programs, collecting the arrays and subroutines into a shared library of code so I can combine the effects in new ways.
I started this a while back, but the last few days I've got all the old code moved over.
As a first step, here are the old programs, tavern, dishoftheday, names-male and names-female converted to use the combined library.
As an example, here is the new version of tavern:
The $RealBin finds the directory where you've put the program and finds the library there.
Then it's simple calling the tavern() function from library and printing the result.
To install all this stuff, just dump it in a directory together and run the programs from a terminal.
If terminals aren't you're thing, there are still the web based Javascript versions here:
As well as these roleplay tools, I've converted the technobabble generator in the same way. The sitebuild tools that create this page now use the babble library for the blog pages.
The plan is to create more kinds of technobabble and add them to the babble library soon.
Roleplay Library, contains the meat of the code and is required by all the tools
lib-rf-roleplay.pl
Programs, these are the individual programs
tavern
dishoftheday
names-female
names-male
Babble Library, required by the babble tool
lib-rf-babble.pl
Program, the babble program
babble
HTML5Tue, 02 Sep 2008 00:13:55 GMT
Playing about with my sitebuild code, a switch to HTML5 would be so easy now.
My sitebuild code is a collection of Perl and Bash scripts I use to simplify the creation and updating of this website.
To go from HTML 4.01 Strict to HTML5, I have to switch this code:
For this:
A simple change to the code and all my pages validate as HTML5, so mechanically I'm all set.
Only slight problem is that the HTML Validator extension for Firefox I rely on, doesn't cover HTML5 yet. Being based upon algorithms by the W3C, who now have HTML5 checking in beta, it should gain HTML5 compatibility when that firms up.
W3C Markup Validation Service BETA
I'll wait on the HTML Validator extension to get HTML5 support, then move over.
Random Tavern and NPC Generators updated to Pathfinder Beta 1Tue, 26 Aug 2008 11:24:11 GMT
The Pathfinder Beta 1 book arrived today, so I've updated the Random NPC and Random Tavern generators in line with it.
Creates a tavern complete with prices, detailed staff and a menu.
Tavern
This is a more elaborate NPC generator, so far is creates any PC class and race from 1st to 20th level
other than Gnome, who I left out to spite them.
NPC
Behind the scenes at the moment it's just a patch I can remove easily, should Pathfinder not work out for us. But it's working and if all goes well I'll update the main scripts with the changes.
You can access the new code here:
npc-pathfinder.js
With the D&D 3rd Ed code here:
npc.js
iPlayer search tools updatedSat, 12 Jul 2008 23:54:32 GMT
When the iPlayer was updated recently it broke my old search tool. I fixed it up and here is the new lib.
The tools are still fine, just replace the old lib file with this one:
Bristol & Bath PM map, Temple Meads to The WatershedThu, 15 May 2008 23:02:50 GMT
The route from Temple Meads to The Watershed, the base is from Google Maps and I added a route in The GIMP.
Clicky-clicky the image for a bigger version.
iPlayer toolsSat, 03 May 2008 13:47:47 GMT
I've been fiddling with a bit more Perl code and built two versions of a quite useful tool for searching the BBC iPlayer.
There is no system for subscribing to shows so I can see when new episodes appear.
So I made one.
It's very simple, runs as a cron job and sends me an e-mail when episodes of of shows I'm interested in appear.
All these tools require LWP::Simple, which Ubuntu/Debian users can install from the console with:
sudo aptitude install libwww-perl
Everyone else can use CPAN.
perl -MCPAN -e 'install LWP::Simple'
As I have a few tools that search the iPlayer and tell me about it in different ways, I moved the actual searching subroutine into a shared file.
So first up, here is the simple iPlayer search tool modified to use this.
This presents the results in a nicely colour coded way, like this:
BBC iPlayer search results search term: QI QI: Series 5 - Europe http://www.bbc.co.uk/iplayer/page/item/b0082hyx.shtml
While this looks nice, I needed a version that is silent when there is no hits, iplayer-search always returns the header and the search term, also the ANSIColor details make no difference when viewed with a mail client, so I can leave them out too.
The quiet and plain version is called iplayer-notify:
This I add as cron jobs, using:
crontab -e
Like this:
# BBC iPlayer notifications, searches run every day
# m h dom mon dow command
00 05 * * * /home/gav/bin/iplayer-notify Doctor Who
03 05 * * * /home/gav/bin/iplayer-notify Spooks
06 05 * * * /home/gav/bin/iplayer-notify Waking the Dead
09 05 * * * /home/gav/bin/iplayer-notify QI
12 05 * * * /home/gav/bin/iplayer-notify Timewatch
15 05 * * * /home/gav/bin/iplayer-notify Torchwood
18 05 * * * /home/gav/bin/iplayer-notify Have I Got News for You
So each morning I get e-mails about any available episodes of shows I may like to see.
Make sure you set your actual email address in the crontab file, like this:
MAILTO="revford@blueyonder.co.uk"
Obviously use your own address not mine. You need it to tell you when your shows are on, not me. :)
Hopefully that will be a bit helpful to someone.
Bristol and Bath Perl m[ou]ngersFri, 02 May 2008 20:59:40 GMT
Like the Constructicons before them, the BristolPM and BathPM lists rise from their slumber and combine to form Devastator.
Well, not Devastator, but the BristolBathPM.
It's a mailing list for Perl coders in the Bristol & Bath area. Now hosted on bristolbath.org.
iplayer-searchThu, 17 Apr 2008 01:51:46 GMT
Some new code here, a nice simple tool for searching the BBC iPlayer written in Perl.
Wang in a few terms and it returns links to shows with descriptions.
Usage and results example:
$ iplayer-search Doctor Who BBC iPlayer search results search term: Doctor+Who Doctor Who Confidential: Series 4 - The Italian Job http://www.bbc.co.uk/iplayer/page/item/b009yy2z.shtml Doctor Who: Series 4 - The Fires of Pompeii http://www.bbc.co.uk/iplayer/page/item/b009wzbf.shtml Doctor Who Confidential: Series 4 - A Noble Return http://www.bbc.co.uk/iplayer/page/item/b009v6v3.shtml Doctor Who: Series 4 - Partners in Crime http://www.bbc.co.uk/iplayer/page/item/b009w049.shtml
Grab the code:
iplayer-search
Gauntlet II quotes script updatedSat, 12 Apr 2008 16:13:00 GMT
The random Gauntlet II quotes script used on the pages has been updated with more exciting variants.
Click on the quote at the bottom of the page for all new adventure.
Grab the code here:
gauntlet2.js
Random Name generators in PerlSun, 30 Mar 2008 02:50:45 GMT
A bit of an experiment here, a Perl version of the random Chondathan name generator. This time broken down into an included file with the subroutines in and two front end scripts.
lib-rf-names.pl
names-female
names-male
To make use of these as they are, you'll have to adjust the front ends, names-female and names-male to match where you installed lib-rf-names.pl.
I'm going to see about building a more portable module next.
iPlayer on Linux, Mac, iPhone and WindowsThu, 13 Mar 2008 17:59:45 GMT
The BBC iPlayer is a strange beast.
If you are a Windows user, you get to download shows and keep them for a month.
If you're not, you don't.
If you're an iPhone user, you get a better quality MPEG4 h.264 stream.
If you're not, you don't.
It's a strange arrangement. Providing a very different quality of service for different BBC licence payers.
The downloads issue first, as that covers parts of the other one.
It's all about DRM, that is Digital Rights Management. A system to enforce who can watch content and how long they can keep it.
The content providers who the BBC buy content from want DRM on the iPlayer downloads so people can't keep them. The fear being that if people download and keep shows from the BBC, they won't buy the DVDs as well.
The DRM selected by the BBC is available for Microsoft Windows only.
So the downloads of shows is Windows only for now. But the BBC Trust want this reviewed every six months.
Oh and like all DRM, this DRM doesn't work, you can simply remove it.
The BBC website told me so and what tool use.
So the BBC knows that DRM is worthless. So the deal they made with the content providers is based on the fantasy that DRM'ed files will help DVD sales.
Also, the BBC transmit all programs over the air DRM free in both digital and analogue formats.
So anyone can grab whatever they like from the BBC using a video recorder, DVR, DVD Recorder or any other simple and commonly available system.
So really, anyone who wants can save BBC content in whatever format they like using a selection of tech from the last 30 or more years.
So, why not just make the batter quality stream available to everyone?
While they're at it, let people download them too.
If you're telling Windows users how to remove the DRM, why put it on in the first place.
It's going to save the BBC some work, they only need encode two streams (MPEG2 for Set-tops and MPEG4 for everyone else) and they don't have to spend my licence money on a DRM system that they told me doesn't work.
Reference and Further Reading:
DefectiveByDesign.org
BBC Trust approves BBC's on-demand proposals
BBC iPlayer On iPhone: Behind The Scenes
Quick guide: Cracked DRM systems
Useful while it lasted, iPlayer downloads back to Windows onlyThu, 13 Mar 2008 11:32:30 GMT
Well, the BBC have changed something in their setup that stopping my iplayer-download tool working, this means that it's back to streaming only for me, for now.
I'll have a look at getting around this, but I don't see why I should have to.
I'm a British TV Licence holder, I've paid for this the same way as Windows users have, why should I get a lesser service?
And why should I have to fight the BBC website to get it?
They promised this service to us free software users within 2 years, I wrote a script to do it in twenty minutes and they've changed their setup to block it working.
Bad BBC.
Gauntlet II babbleTue, 11 Mar 2008 15:34:40 GMT
Political ranting over for a while, we now return to the usual Nerd content. :-}=
For some reason I've had "Yellow Wizard shot the food!" stuck in my head, so quickly bashed together some javascript to generate Gauntlet II babble. It's been added to the site so it should appear in little italic text at the foot of each page, next to the Creative Commons symbol.
Click the text to generate new babble.
If you want to add it to your own page, or just like to look at code, it's available here:
iPlayer downloadsMon, 10 Mar 2008 11:59:47 GMT
I need to point out a couple of things about the iPlayer download script.
First up, not all shows available for streaming are also available for download, it seems mostly random but with a better chance of more recent shows being up there.
If it's not available to the iPhone beta, it's not available to download.
Also these files do not contain DRM, but the BBC wants us to delete files after a month.
This is a way for free software and Mac people to get the same functionality as Windows people, not so we can loot the BBC.
So good people, I'm going to have to trust you to delete the files when you're done.
Please.
iplayer-download
Tue, 03 Feb 2009 17:32:36 GMT
Old and broken code removed.
iPlayer script last tweak for nowMon, 10 Mar 2008 00:04:09 GMT
Last tiny tweak for now, sorted out to it outputs to a sensible filename.
iplayer-download
Tue, 03 Feb 2009 17:33:03 GMT
Old and broken code removed.
iPlayer download script, cleaned upSun, 09 Mar 2008 23:52:04 GMT
Sorted out and cleaned up version of the script. Still calls wget for the work.
Pretending to be an iPhone isn't needed, so I can use LWP::Simple and not have to worry about the more complex LWP::UserAgent.
This trims the fat nicely and makes the whole thing read better.
I'll look at modules for downloading the file within the Perl script, rather than by calling wget soon.
iplayer-download
Tue, 03 Feb 2009 17:31:51 GMT
Old and broken code removed.
iPlayer download scriptSun, 09 Mar 2008 21:06:34 GMT
Okay, this is still a quick hack, but it works. Perl this time, should run on anything sensible.
It claims to be an iPhone, reads the show page, grabs the iPlayer ID, then calls wget to download it.
I'll work on this more later, but it's a working tool for now.
iplayer-download
Tue, 03 Feb 2009 17:31:01 GMT
Old and broken code removed.
iPlayer IDsSun, 09 Mar 2008 19:37:47 GMT
Seems I'm not exactly right on the iPlayer IDs. These don't always match.
I'm working on it...