Squeaky Drawers

My children don’t have the patience to battle with a chest of drawers. They just pull harder until the drawers break. I solved this by putting shoe polish on the wooden runners. The drawers glide open and shut and now I can get on with the next thing on the DIY list. Hooray for shoe polish!

The Past, The Future, Omnipotence and Playstation Network

Introducing The Actors

The Past has plentiful experience but lacks resource (time) to participate. Makes a king of logic.

The Future has abundant time and energy but lacks control, easily led by emotion. Makes a prince of appearance.

Omnipotence is the collective corporate brain that lacks a concept of family. Makes a queen of process.

Synopsis

Throughout Omnipotence remains passive. Without the intervention of Omnipotence, The Past and The Future become locked in endless battle. Everyone aboard the Mother ship is plunged into conflict. There are no survivors.

Photo of a PS3

My Dad bought a PS3 for my thirteen-year old this Christmas. One of the features of the Sony package over Xbox was that Playstation Network (PSN) is free. So you pay more for the hardware, but the running costs are cheaper.

Depite a warning from the The Past (me), The Future created a Playstation Network Account without supervision (it was 7am on Boxing Day morning). This was the opening shot, a declaration of war. Omnipotence (Sony) rely on self-certification to govern access to it’s services. The Future had (accidentally, yeah yeah) certified himself as the-same-age-as-his-mates. They apparently are all allowed to play COD (Call Of Duty) on Playstation Network.

The accident involved typing a 97 not a 93. Although it wasn’t clear to ThePast until many weeks later this digit difference was going to become the axis of the conflict. Omnipotence disallow it’s subjects to change some key pieces of information about themselves (a) date of birth and (b) email address. Accounts may not be deleted.

Omnipotence doesn’t advertise these policies. In fact in the case of email addresses it looks as if you can change your email address but in reality you can only ever add new addresses. Once added an email is locked into the vault of Omnipotence’s blacklist. The old addresses are still remembered, so you can’t re-use them from any other account.

Despite Sony’s leaving all these trap doors everywhere I was determined not to give in. I did not want my son to pose as an adult whilst online. Here’s what happened.

The Chapters

  • The Future declares the PS3 is faulty
  • The Past investigates and concludes that the TV has an intermittent fault
  • The Past and The Future have serious dispute over where to put the PS3 in the bedroom
  • The Past locks the console in a cupboard as The Future has said too much

-- time passes --

  • The Past repents and use magic to install the PS3 in bedroom
  • The Future gets up the next morning and makes the Master (Adult) account
  • The Past finds out and makes himself a Master account
  • The Past changes the password of The Future’s Master account
  • The Past creates a Sub account as a replacement for The Future
  • But The Future failed to enter the realm of Omnipotence because the Sub account IS BROKEN (email addresses cannot be re-used Dad)
  • The Past locked the console away again as The Future has said too much
  • The Past procures a “Mains Conditioner” to fix the TV but it is a complete waste of money
  • The Future tells The Past he can shove the PS3

-- time passes --

  • The Past changed the Sub account (then hit date of birth rule, silly Dad)
  • The Future again failed to enter the realm of Omnipotence
  • The Past locked the console in a cupboard once again unalble to tolerate offence from TheFuture
  • The Past takes TheFuture shopping and buys him 2 new PS3 games
  • The Past meets an Angel who bears the gift of a working TV
  • The Future is bright
  • But The Future still cannot enter the realm of Omnipotence
  • The Past begged Omnipotence for mercy
  • Omnipotence remained impassive

Birds on the wire

I was driving along near my house and my son Ruben was in the car with me. Ruben is 5. He pointed up at some of those cables that go from telegraph post to telegraph post and asked me what they were. So I said that they were there so that people could make telephone calls. Ruben didn’t say anything but pointed to some birds that were sitting on the wire. He looked back at me and said but Daddy won’t the people fall off?

P1010001

bella, bella, bella

When my phone rang for the fourth time I knew something was up. So once I’d escaped a work-discussion about publishing image pyramids I phoned home. Sure enough there was a crisis. Nelson had taken Bella outside and now she was lost.

Bella the dog
Bella the dog

After much panic Bella was discovered INSIDE-THE-NEXT-DOOR-NEIGHBOURS-HOUSE. It turned out later that Bella had sneaked inside while Clare (our neighbour) had been unpacking and chatting with another neighbour. After the discovery, Clare was contacted and kindly cut-short a shopping trip to return home and release the imprisoned pooch.

As Clare explained later, there were thirty-five chocolates in the bag. The girls had had two, that’s one each leaving thirty-three for Bella plus various sherbert dips and packets of refreshers. All the sweets were gone, wrappers and all. I think Bella is expecting us to take her shopping next week.

M6 mania

Last Thursday we packed the kids and dog in The Mighty Berlingo (pronounced berrrLin-Goooo!) and headed for my parents place in Gatley, which is just south of Manchester. As with previous journeys I started to get stressed on the approach to Birmingham. It seems that none of the roadworks that wound me up six months earlier are any nearer completion. So on top of the driving rain, occassional snow-drifts and arguing kids we’re packed liked sardines into lanes that appear to be narrowing while the artics hang closer on to our bumpers. By the time I get to final dash (J15 – J20 M6 northbound is the 5th worst place to drive in the UK according to the RAC) I am barking. It really is complete insane. But like a party that went too far, we get up the next morning and wipe it from our collective consciousness. Until next time.

Potatoes

I need to plant some. We are blessed with a couple of acres of unused land next to us and it needs to have potatoes growing in it. There are two obstacles. The brambles have stems like oak trees, and the land is owned by someone I’ve never met: but apparently he’s a real nasty. The brambles are lethal but armed with my mighty scythe and trusty rake I’m well on the way to clearing 48 square metres. Mr Nasty is something of an unknown but I feel quite determined that the growing of potatoes on someone else’s unused land is not a moral problem, even if it may become a legal one. Technically that makes me a guerrilla gardener which is quite exciting :-). I do actually think it’s rubbish that we import potatoes from places like Egypt. The only downside is that I will need to purchase 133 early and 211 maincrop seeders. This is an outlay of eighty quid. which is possibly more than I’ve spent on potatoes in my entire life.

The Great Flakes

daddy snapped by ruben
daddy snapped by ruben

After the long winter, like some ancestral awakening we were drawn to the outdoors. Lake Flake and it’s neighbour Lake Caramel was our destination. The watery sun, the mossy trees and the forgotten stream together with the happy sounds of carefree and muddy children. I was struck deep. And today a new discovery Lake Galaxy! The adventure continues.

How to make a media player

I was looking for a little project to keep me busy over Christmas and decided to have a look at organising the contents of /home/media. The media directory on my Red Hat Linux box holds:


3523 audio files
595 video files

It got called jplayer because its for private use (by the johnsons) and j follows i and the flash player I used is called jwplayer.

Some top-level ideas

  • Things should be bookmark-able
  • Editing and managing meta-data had to be possible during playback.
  • And some of the RESTful ideas that are running around from my day job should find their way into the design.

In the end it was made using: Perl, MySQL, Apache (XSSI), Javascript including SWFobject, Flash (JWplayer) and CSS. My background is in Perl and database so the challenges were going to be in the javascript and CSS. Here is a step-through the process of creating and playing a media file.

On the command line use

find

to make an input file. Looks like this:

file=/audio/morcheeba/shoulder_holster.mp3
file=/audio/morcheeba/fear_and_love.mp3
file=/audio/morcheeba/dungeness.mp3

And then use curl to upload those entries to the database using an HTTP PUT

$ curl -T .avlib http://localhost/cgi-bin/avlib.pl
added 3 rows ok

To start playing the files I have to use a browser and enter a search phrase. An onClick() event creates an Ajax call to the web service. It looks like jplayer/?q=morcheeba

The output from the web service produces a list.


<ul>
<li>
<a href="/jplayer/?playlist=/audio/morcheeba">morcheeba</a>
<div class="summary"></div>
<div class="small">audio/mpeg</div>
</li>
</ul>

Results are piped through a pager so you scroll through 5 items at a time. Selecting an item from the search results loads a new page (to get the bookmark) and displays the playlist. In this context a playlist is just all the files in a folder. Each file has a link that will load the movie into the player and displayer the meta-data in a webform. For example:


<a href=""
onclick="loadSWF( '/audio/morcheeba','shoulder_holster.mp3' , 'jwplayer');
updateForm( '/audio/morcheeba','shoulder_holster.mp3');
return false;">shoulder_holster>/a>

Playback is controlled through the Flash object. Once the meta-data is updated an Ajax calls generates a POST to send the new data to the server.

The web service


PUT /path/to/avfile
200 returns text summary of new rows added
400 returned zero rows

POST a set of REQUEST VARIABLES representing an item
200 returns string saying 'thanks'

GET ?q=Search+String
200 returns a paginated list of playlists matching string

?playlist=/path/to/file
200 returns data items as a web form

no parameters displays name and version

The Perl uses the HTML::Template module to create the presentation layer and the DBI modules to access the MySQL. Otherwise it’s hand-written, even the CGI functions (I was surprised that CGI.pm didn’t help do the PUTs).

Data schema


CREATE TABLE playlist (
pk_pldir varchar(255) NOT NULL,
playlist varchar(127) NOT NULL,
mimetype char(23) NOT NULL,
summary varchar(1023),
PRIMARY KEY (pk_pldir)
);

CREATE TABLE avfile (
pk_pldiravfile varchar(255) NOT NULL,
fk_pldir varchar(255) NOT NULL,
avfile varchar(255) NOT NULL,
title varchar(255) NOT NULL,
duration int(4),
thumbnail varchar(127),
PRIMARY KEY (pk_pldiravfile)
);

CREATE TABLE pldir__tag (
pk_pldirtag varchar(255) NOT NULL,
fk_pldir varchar(255) NOT NULL,
tag varchar(63) NOT NULL,
PRIMARY KEY (pk_pldirtag)
);

Web client

There are 3 main areas of the page.

  1. banner and search box
  2. SWF player window and playlist panel
  3. search results OR html form to update playlist metadata

I don’t have a server to host jplayer on tinternet, but here’s a screen grab:

screenshot

To do

  • Currently I’m using AVS to convert movies FLV. Have upgraded ffmpeg 0.5 and would prefer to use ffmpeg for scripting
    • a series of thumbnails (or if audio use album art or an icon)
    • calculate the duration
  • Improve search by filtering through audio or video

References

JW Player
HTML playlist
FFmpeg
Ajax
SWF Object