Friday, 25 December 2009

Poloaroid Pogo and G1 with Android

This topic on the T-Mobile Forum was very helpful indeed as I'd just bought a Polaroid Pogo from Bentham Ltd Amazon (Excellent service - bought it on the morning of the 23rd December 2009 and it came on the next day!). Basically one needs to download a shareware application from the market (The app is free but supported by advertising, go figure!) and it'll work like a charm. All I need now is for Audible to do a version of their software for Android and I'd be a Happy Bunny (Did try Santosh's method from Android Forums, but I failed miserably.).

QR code for Bluetooth File Transfer:

QR code for Bluetooth File Transfer

Wednesday, 23 December 2009

Want one!

So 'im next door was talking about this issue of the The Food Program, which I missed when it was first on. He phoned a couple of minutes before the repeat and after listening to it I decided that I really wanted this COPPER POT STILL.

Thursday, 17 December 2009


Due to being nearly terminally incompetent I missed my first CMA for TT282 but I was sure to make sure that I submitted the other 2 early and really quite pleased to get 80% for each. Except... each time I’ve got an email from the OU saying that the papers have been rescored. The first time it got upped to 84%, the second went up to 85%.

Don't get me wrong, I was more than happy with 80% and ecstatic at 84% and 85% (especially now that my average is something like 56% over the 3 CMAs) but if the computer can get the marking wrong there must be something wrong.

Now I've got to see if they'll allow images in reports for my ECA.

Wednesday, 16 December 2009

Hosting Images

These images were created using Inkscape and The GIMP and represent the hierarchy of hosting (in my opinion):

Types of Hosting

Tuesday, 15 December 2009

Dexter rules, Rita cools!

Wow! Dexter series 4 episode 12 was just so cool. Didn’t see that coming at all. It’s like we’ve been hating Rita since series one but to finally get rid of her in such a shocking way was a little like wanting something so bad for Xmas and then finally getting it and realising it was a piece of crap. It seemed to me that the writers decided to kill her off and then worked backwards in order to get to that point, like the whole series was written backwards if you will.

And that in combination with Debra finding out that the Ice Truck Killer was Dexter’s brother… wow. It’s no great surprise that it had record number of viewers really as the past 2 or 3 episodes have been building the tension like Dexter and his garrotte.

Does this mean that his sprog is likely to be a killer as well? Birthed in blood indeed, aren’t we all?

Monday, 14 December 2009

Food and Sex Data Visualisation

Two articles took my fancy this week:

So I thought I'd do some messing around and see how well the agreed with each other:

Food and Sex Data Visualisation

Wednesday, 9 December 2009

I love Tesco's

As someone without a fridge I go to Tesco's at least once a day... quite often it's more than that as there is one right next-door to work that's open 24-hours a day (But that one isn’t my usual and doesn’t feel right, a bit alien if you see what I mean? A bit like wearing someone else’s still-warm underpants).

As such I’ve gotten to appreciate them. Not like ‘er indoors who "hates shopping" and takes ages to find anything (Having said that there is a bit at the back where I can never find what I’m looking for; it’s a bit like the Bermuda Triangle as no matter how sure I am that I’ve got the right aisle I always end up looking up and down at least 3 to find the four-cheese sauce). Or ‘im next-door who reckons it does him some good to avoid Tesco-land for weeks on end and visits Morrison’s instead.

I love the staff there:

  • There’s the Caribbean one who takes forever and tries to be helpful but ends up winding everyone up in the queue – I only use here check-out when I know I’ve got plenty of time and I’ve not bought over the daily limit of alcohol as she’ll start talking about how anyone can tell the difference between a bottle of Poacher’s or Star Bitter (I do keep buying it so that I don’t drink too much on my days off).
  • There’s the Asian bloke who, when I asked for some bags as I’d forgotten my trusty pannier, said that it was too late to do anything about the environment and that we were all doomed. Bless. I saw him not so long back shopping with his family smiling – I don’t think I’d ever seen him smile before and he looked like a different person altogether.
  • There’s the aging cowboy on the basket tills who is just so cool it hurts, so very disdainful of anyone under the age of 50.
  • There’s the gorgeous lass who looks like Kirsten Dunst only not so vague, I think she’s being trained up though as she’s not been on a till in ages. I do so swoon when I see her but she’ll not notice me as a fat, aging shopper who is too skint to afford a fridge and needs to go to Tesco’s everyday. I’m seeing less and less of her though so I think she’s stuck in some back office pouring over clubcard returns and trying to analyse why Poacher’s Choice still gets bought even after they upped the price.
  • There’s the gorgeous African lad who natters in French and make’s me wish, if not that I was gay, that I was a leggy 21-year-old blond with a figure like a swimsuit model so that he’d talk to me more.
  • There’s the lass we met feeding swans when we went to get water ages ago who looked terrified that we were mad when we asked if she wanted a cuppa. She still looks worried when we meet though at least she talks – if only about ‘er indoors. Could see her thinking that we were mad English people waiting to lure her aboard and sell her into a life of sexual slavery.
  • And so very many more that I’d end up boring you to tears.

One of the oddest things about the place is the customers, going during the day you meet the strangest people – I haven’t been talked to as much since I was a kid and travelled on buses with my Ma (Everyone talks to my Ma, especially on buses – you can be sat on the trip back from Town on the X39 and get some old-girl’s life story in 25 minutes, their disappointments with life after their fiancĂ©e died during the war and the whole nine yards!). Today some old-fella (who had the 2nd nicest aftershave I’ve ever smelt – would have asked him what it was but didn’t want to encourage him – talked about how B&Q didn’t have the right-sized nut and bolt! He was odd: he was buying a Xmas cake, chicken, stuffing and gravy – it’s only the 9th of December and what about the veggies?

Monday, 23 November 2009

Solar Cells

I love the idea of solar cells, I really, really do, and I used to love Treehugger but I had to give it up, as well as my continued viewing of Hot UK Deals because of the amount of time I was wasting...

But one thing I can't give up is my browsing of Digg and so I was pleased to see this article about Cheap 3D Solar Cells Are 6x More Efficient, Work Underground. We just need to get to the point where we can apply them using a spray gun and all my energy needs will be sorted.

Speaking of which I'm just about finishing Stephen Baxter's Flood, I was sort of avoiding it because I thought it was just the thing that was on the telly but it isn't. It's actually much, much worse. Read it if you fancy but don't expect it to be a happy read, and what has he got against Tibet?

I'm enjoying messing about with VBScript for my lastest Open University module (I'm going to put some source code here later when FileZilla decides to work again):

Thursday, 12 November 2009

Fun Face Cam

This is really rather excellent:

Moon grin

I need this one on a black t-shirt so bad!

For a T-Shirt

Strangely affecting:


Sunday, 8 November 2009

Izaac's Shackleton Quiz

Think I need to look at the exportation model as it is a little messed up, the original is here: Izaac's Shackleton Quiz.

Friday, 6 November 2009

I can't be the only one to have noticed...

... how Cherie Blair and Christine Rose are nigh on identical twins:

Cherie Blair & Christine Rose - separated at birth?

I blame too many episodes of Heroes at once TBH! That and liking Morph Thing a lot!

Thursday, 5 November 2009

Jack's House

Blair Brown or Kate Mulgrew

So me and Sparkx are arguing about Fringe and about whether or not the actress playing Nina Sharp, the CEO of Massive Dynamic, and the actress who played Kathryn Janeway in Star Trek: Voyager are one and the same.

I reckoned not but he bet me a 4-pack of Hobgoblin that they were. So:

Blair Brown or Kate Mulgrew

The image above was generated using Morph Thing and the link the to page with the original images is here. And, while they are both similar, they really are not the same. Nina Sharp is played by Blair Brown and Kathryn Janeway is played by Kate Mulgrew.

Friday, 30 October 2009

Sci-Fi & Religion

I've had these links at the bottom of my starred list in Google Reader for ages with the intention of writing something about them, thing is... I don't think I can be arsed so I'll just put 'em here instead:

Thank goodness I've got them off my starred list, I was starting to worry a little bit with all that religious stuff there!

It's interesting that scientists are looking at LSD again, not sure it's quite up to the standard of Timothy Leary though... perhaps that isn't such a bad thing though?

Saturday, 24 October 2009

Busy old week

Just had a busy old week what with taking my driving test on Thursday the 22nd October 2009 and packing in smoking.

Passed with only the one fault (You're allowed up to 15 I think - just checked and you can, "make up to 15 driving faults and still pass the test (16 or more results in failure).") and it was the one of the best results my instructor, Mark Crisp, had ever had he said.

So, seeing as I'm now a proper grown-up I decided to stop the fags. I visited CAMQUIT on the Tuesday and got a prescription for 24-hour patches, also had some old gum that I bought for plane flights and such (such as not needing to relinquish my seat in the library) and some lozenges that you're supposed to take when the need for a fag becomes too intense. I've also got an e-cigarette... at least I would have if I knew where the bugger is!

Apparently it's not possible to OD on nicotine, but I'm gonna have a bloody good try.

Saturday, 10 October 2009

Undue criticism?

The Download Squad recently had a pop at google for releasing the following video:

They do note that the video is a response to this video:

Thing is, after having similar conversations with friends and family I'm not overly sure that them having a pop is valid, lots and lots of non-techy people don't know the difference.

Dominic is mortified he isn't more mortified...

... sat outside Eat in Cambridge and was talking about having a curry at the Pipasha for tea with 'er indoors whilst gazing off into the distance.

"Aye, that'd be tasty", says me and I'm confronted with a withering and most disapproving look from a student who's locking her bike up - whilst I'm gazing into the distance my gaze has intersected her mini-skirt and black-tight clad bum. It wasn't anything intentional as I'm too hung over and tired to be interested in anyone's bum, let alone hers, but I guess she thought I was discussing her.

Thing is, I'm pretty sure that I'd be mortally embarrassed if I were younger but I'm thinking that one of the advantages of getting old is that the mortification just doesn't last as long nor is it as intense...

Thursday, 8 October 2009

An end to blacking...?

I've just read this post on Mother Nature Network and was wondering whether it might be of use on inland waterways... not that we have barnacles as such (at least not on the boat) but it might stop the weed and mean that boats won't need blacking every couple of years... not sure what it'd do for rust though it might mean the end of anodes. I've heard of odd things being done to hulls like using a tiny amount of washing-up liquid on fenders to stop 'em rubbing on the hull but this would be well cool.

What sort of slime would be best though?

Tuesday, 6 October 2009

My route to work by car... apparently...

View Larger Map

Though if I'm cycling to work there is a better route. It's much shorter but not as nice as this one which I use to get home again.

5.3 miles by car, 3.76 by cycle and 4.42 by the scenic route. Cool, can do that in 20 minutes if I'm listening to something cool.

I hate interviews

I'm sure I'm not the only person who hates interviews... if they were easy anyone would have any job... but I really, really hate them.

I go in there thinking that I should think of everyone without clothes and then worry that I'm naked too!

And the questions... ohh the questions kill me!

Anyway, I've just had an interview and I'm going to put my presentation up here as I actually quite enjoyed it... not the interview mind, not even presenting the presentation, but the researching of the presentation was fun... actually, I'm not going to put it all up, just edited highlights. The process of creating it was fun as I used google Presentation which I guess is a lot like PowerPoint, my kids know how to use it but this was my first attempt and I'm quite pleased to be honest. Let me know how it could be improved please.

Monday, 21 September 2009

Red Diesel Tax Calculator for Narrowboat

The IWA has a Campaign to keep derogation on Red Diesel. Something that is close to my heart. They have on their site a nifty spreadsheet which can be used to calculate the amount that people should be paying... but I needed to calculate how much we were using for propulsion or other purposes; not being a continuous cruiser it'd not be anywhere near the 60/40% split that HMRC reckons (60% for propulsion and 40% for other purposes such as hot water and electricity generation).

Being a bit of a novice when it comes to spreadsheets I thought I'd try to work it out myself and, with a little (okay, a lot of!) help, I came up with the following schema on Google Docs:

  • Column A - The date, watch out for the localization here, make sure it's British (DD/MM/YYYY).
  • Column B - Purpose, if you want this to act as something of a log make sure that the non-propulsion purpose is obvious, mine is "Electricity & Water", everything else is ignored.
  • Column C - Is the hours on the clock when you turn the engine off.
  • Column D - This is calculated by entering something like "=CX-C(X-1)"; so it you're on line 10 the formula would be "=C10-C9".
  • Column E - Is the total hours used, or "=sum(D:D)".
  • Column F - Is the total hours used for non-propulsion reasons, or "=sumif(B:B, "Electricity & Water", D:D)".
  • Column G - Is the percentage used for non-propulsion reasons, or "=(F1/E1)".
Spreadsheet illustration

I started doing this ages ago (08/10/2008) and I'm now onto my second sheet so I've had to alter columns E, F and G to:

  • Column E (Sheet 2) - Total hours used: "=sum(sum(D:D),Sheet1!E1)".
  • Column F (Sheet 2) - Total hours used for non-propulsion reasons: "=sum(sumif(B:B, "Electricity & Water", D:D),Sheet1!F1)".
  • Column G (Sheet 2) - Percentage used for non-propulsion reasons: "=(F1/E1)".

Dead easy isn't it?

Saturday, 19 September 2009


We're back from Tallinn in Estonia where we spent 5 nights. It's a jolly good place though I was a little nervous when we got off the plane... the bus into Tallinn seemed to be full of Stag Parties and Babooshkas!

I'd spent ages looking for books on Amazon but finally downloaded and printed the TALLINN in your pocket guide which was excellent.

We went on Wednesday 9th September 2009 and came back on Monday 14th September 2009 and stopped at the Domina City Hotel, breakfast was provided at the hotel so we went out for tea usually and ended up drinking in the room reading and watching Estonian TV... which is jolly cool!

Upon arriving we were hungry and so we ate at the Schnitzel House and managed to overhear a number of people using English as a lingua franca which was funny as they were criticising the English for talking about the Second World War, most especially after their 3rd drink on an evening.

On the Thursday we went on a cycle tour which was also really rather good and got nattering to some TA guys who were on a "lads" holiday (apparently this means they can burp and fart without censure!). One was talking about the history of Estonia and for a people who've been invaded and occupied by nigh on every bugger for centuries then they're remarkably not bonkers... apart from the focus on singing.

The Saku was nice as was the A. Le Coq.

Cool name!

Overall a jolly good place to visit!

Sunday, 6 September 2009

Tuesday, 1 September 2009

Flying Dog Brewery

I'm really looking forward to a bottle of Gonzo Imperial Porter tomorrow morning when I get in from work.

When I first picked it up, along with my customary bottle of Poacher's, I thought it was brewed by Brew Dog (incidentally the only site served using PHP and quite possibly the slowest one), but it is actually from the USA instead.

Think this is top! The beer wasn't so nice though.

World Science Festival 2009: Bobby McFerrin Demonstrates the Power of the Pentatonic Scale from World Science Festival on Vimeo.

Sunday, 30 August 2009

1,230,939 more needed!

So, how many nukes are needed to destroy humanity?

And what's more, I'm never not drinking again seeing as teetotallers are more likely to be depressed.

The following picture is up at the gents at The Green Dragon with "If you were around in 1919 (just before prohibition started) you might have seen the following poster." above it and "Now honestly, would you quit drinking?" below:

Wednesday, 26 August 2009

Dublin Core

I'm not a great fan of metadata in the context of HTML, I really am not! When it is mentioned I get all sorts of visions of seedy little SEO guys playing with the placement of words in the head of HTML pages and getting excited by a 0.0001% increase in PageRank... makes my blood run cold and makes me feel not just a little poorly that does. Metadata on the whole is okay mind, information about information is how the Semantic Web will come about, but for the sake of SEO it's just not cool and puts me in mind of Witch Doctors demanding sacrifice to ensure a fruitful harvest.

So metadata doesn't have to be evil. Just like some Evangelical Christian like Harry Potter books/films, some metadata is a cool thing and will help intelligent agents of the future parse data and produce relevant information.

I've found the Dublin Core metadata editor and the Dublin Core Assistant are invaluable when it comes to generating metadata which isn't quite so nasty and, dare I say it, unclean.

The DCMI is an independent body which is seeking to standardize metadata and seems, at its heart, to be academic in focus rather than business orientated so - while I appreciate that some people use their websites to generate sales - while a purely business orientated way of adding metadata things leads me back to thinking of those scruffy, sweaty, slightly shambolic buggers crouched over their keyboards and frantically checking their PageRank after each tiny, little, minuscule iteration... using the DCMI's Dublin Core allows my academic leanings to embrace it and, hopefully, improve PageRank as well.

Leo Laporte covered this issue in a recent episode of the Tech Guy (check for "Hour 2") and I was impressed, especially with the 1500 character limit.

Thursday, 20 August 2009

Summer Holidays

We're just back from Compton Durville. We went from the 11th to the 18th of August and we sure did fit a lot in in that time:

Did I say that I did all the driving while we were away? No? Well... I did all the driving while we were away (except for a little bit when we'd stopped at a nice pub!).

Sunday, 2 August 2009

Barny's Stag Do Results

This is how you do it!

Went to Anglia Karting Centre for Barny's Stag weekend (as well as doing lots of other things) and I did pretty poorly. The results for the shooting section are thus (The shooting was divided into three sets of ten pigeons, the scores are in the far right column and totalled at the bottom. It would have helped if I'd have figured out that I needed to close one eye before my first set of ten):

Dom's Clay Pigeon Shooting Score
My Shoulder was black 'n' blue!

These are my lap times for the karting itself:

1 - 0:45.092 - 0:40.743 - 0:38.374 - 0:37.425 - 0:37.33
6 - 0:39.677 - 0:37.778 - 0:40.459 - 0:38.8410 - 0:40.07
11 - 0:37.3912 - 0:37.8413 - 0:37.9714 - 0:39.0015 - 0:50.52
16 - 0:39.8917 - 0:39.2018 - 0:38:5819 - 0:37.8820 - 0:38.65
21 - 0:38.6722 - 0:37.7323 - 0:39.7824 - 0:38.9125 - 0:39.01
26 - 0:37.2127 - 0:36.5528 - 0:38.4229 - 0:40.0530 - 0:37.35
31 - 0:36.82    

I started out in 5th place but remained in 7th place except for laps 10 through 14 when I got to 6th.

Gimp Extrude? Blargh!

This was my 1st attempt using Inkscape and it involved my nice bought typeface being "Put on Path" of a bezier curve then copied and moved down a little with the two layers being filled with different colours:

First attempt

My 2nd attempt - after trying and trying and finally failing to find a Extrude Filter for The GIMP (thus the "Blargh!") - involved a different program's extrude function but with the same two colours but it is ever so much better:

Second attempt

The 3rd, and I think final, attempt used the same programs extrude function but with lighting effects. Much better and will hopefully stand out ever so much more:

Third attempt

And here, just because I like animations, is all three combined with the power of The GIMP:

All three attempts

What is the Hex value of "MAILBOX RED" from B&Q? After taking a picture of the paint with the lid off and checking the hex value using the dropper tool it looks to be #FF2718, or rgb(255, 39, 24), and not #FF0000 as I was expecting.

Forth attempt

Gold is apparently #FFD700 (rgb(255, 215, 00)) or #FFCC33 (rgb(255, 204, 51)).


Fifth attempt with gold

UMM Gold:

Sixth attempt with UMM gold

Last one for now:

What it should look like!

Sunday, 26 July 2009

Perfect Water Filtration System for a Live-A-Board

In Thursday's Guardian IT supplement there was a fantastic article about Dean Kamen. I sort of remember a little about his water filtration system, which is apparently now code-named Slingshot, on an online video and I was fascinated by it, not least because the water on the boat was so undrinkable at the time! Try as I might I couldn't find out anything about it but it now seems as though the reason was is that it was a prototype and not available. The idea of having something with about the same mass as the water tank on the boat but that would create unlimited water from a source as oft-times filthy as the Cam was cool! It didn't seem as though it'd take much in the way of electricity either!

Then After looking at his website I came across his Sterling Engine design. All of my power and water requirements met in two handy packages... except... again it's a prototype!

There are plenty of cowpats on Stourbridge Common now that we've a load of bullocks grazing (It's why I have to leave my shoes outside). How cool would it be to get them all drying out in the beautiful Cambridge summer sun and burn 'em to reduce greenhouse gas emissions from the methane... not to mention saving the diesel I use going up to the end of Stourbridge common or Jesus Green every fortnight to fill up with fresh, potable, water. Could even use the Sterling Engine to provide for my limited electrical needs? I guess, what with it providing heat, I could cook with it and get rid of the Calor gas? Though we're doing pretty well on that front as it goes, at least until it goes up in price again.

Tuesday, 21 July 2009

Shadowed A

I'm trying to do a drop-shadow in Inkscape, but not any old drop-shadow... it's be easy to use Gimp... or perhaps not for the effect I'm looking for. This tutorial comes close but what I'm after is something like narrow boat sign-writing; An almost 3D effect where each letter is flat face towards us but has been extruded from below - if you see what I mean?

I've bought a lovely typeface called Modesto Expanded that would work a treat but just now I've no joy finding an example of the effect I want except the Grace Darling image on the Vimart Signwriting site.

Sunday, 19 July 2009

Install Flash to Portable Firefox without Admin Privileges

I run Portable Firefox from Portable Apps on a fairly regular basis but when I find myself on a machine where I haven't got Admin privileges I need to run another program (in this instance 7-zip), again from Portable Apps.

I download, open the flashplayer-win.xpi with 7-zip and extract the flashplayer.xpt and NPSWF32.dll files to the \FirefoxPortable\Data\plugins folder. Start up Firefox again and all should be well and you can browse YouTube to your hearts content.

I've learnt this trick from a number of sources and used to use it to get the now defunct Adobe SVG plugin to work nicely with Firefox... I did however refresh my memory using the answer posted on Acid-Labs: Installing Flash in Portable Firefox with no installer... particularly the one by Vishwesh Sharma (No. 12).

This got me thinking about installing the Adobe plugin in Firefox 3.5 and, despite following the instructions from 2006, I couldn't get it to work... such a shame Adobe stopped updating it as it's scripting support was excellent.

Wednesday, 15 July 2009

Brute force TrueCrypt when you sort of know the password.

So a friend asked me to generate all possible combinations of two words, he uses two words as passwords and mixes up the capitalisation of those words so that if he has the two words "apple" and "pears" as possible passwords then he could have something like "aPpRe"... there are loads of possibilities but not as many as there could be because each letter position would only have 4 possible letters. For example the third letter can only be "p", "P", "a" or "A". Mathematically we're looking at four possible outcomes for a one letter password, sixteen for a two letter word, 64 for a three letter word... 256... 1024... 4096... 16384... 65536... 262144... 1048576 for a ten letter password.

Doing it by hand is just about possible if you're only looking at a 3 letter combination but otherwise...

Seeing as I'm relearning Java I thought I'd have a crack (after getting lots and lots of help from - I did say relearning!) and after trying to get my head around recursion and realising I'd done something with it years ago using JavaScript to parse an OWL file representing the management structure of an organisation I came up with the following file:

public class WordComb {
  public static void main (String[] arguments ){
    if (arguments.length != 2) {
      System.out.println("This program requires two arguments, please try again.");
    else {
      if (arguments[0].length() != arguments[1].length()){
        char spaceChar = ' ';
        int argOne = arguments[0].length();
        int argTwo = arguments[1].length();
        if (argOne < argTwo) {
          for (int a = argOne; argOne < argTwo; argOne++){
            arguments[0] = arguments[0]+spaceChar;
        else {
          for (int a = argTwo; argTwo < argOne; argTwo++){
            arguments[1] = arguments[1]+spaceChar;
      char[][] words  = {arguments[0].toLowerCase().toCharArray(),
      char[] combo = new char[words[0].length];
      fill(combo, words, 0);
  public static void fill(char[] combo, char[][] words, int col) {
    if (col < combo.length) {
      for (char[] row : words) {
        combo[col] = row[col];
        fill(combo, words, col+1);
    else {
  public static String makeString(char... word) {
    return String.valueOf(word).trim();

All that needs is a little command-line redirection and you've a nice file to feed into your TrueCrypt cracker of choice...

Monday, 13 July 2009

Caravan Boat

A bit of a break here while I cogitate Java arrays.

Being a boater I'm always interested in these types of images:

Caravan Boat image
Caravan Boat image

The first links to the original article, I'm afraid that I've lost the source for the 2nd but I think I saw it on a LJ image trawl.

Saturday, 11 July 2009

for looping to infinity

I've an a 2-dimensional array that is best represented in the following tables; it has an arbitrary number of "columns" but only ever 4 "rows".

I need to produce the following "Possible" results programmatically.

+-+     Possible: a, A, x, X 
|a|               (4 * 1 = 4 possibles)

+-+-+   Possible: ab, aB, aX, aY, Ab, AB, AX, AY, 
|a|b|             xb, xB, xX, xY, Xb, XB, XX, XY
+-+-+             (4 * 4 = 16 possibles)

+-+-+-+ Possible: abc, abC, abz, abZ, aBc, aBC, aBz, aBZ,
|a|b|c|           ayc, ayC, ayz, ayZ, aYc, aYC, aYz, aYZ,
+-+-+-+           Abc, AbC, Abz, AbZ, ABc, ABC, ABz, ABZ,
|A|B|C|           Ayc, AyC, Ayz, AyZ, AYc, AYC, AYz, AYZ,
+-+-+-+           xbc, xbC, xbz, xbZ, xBc, xBC, xBz, xBZ,
|x|y|z|           xyc, xyC, xyz, xyZ, xYc, xYC, xYz, xYZ,
+-+-+-+           Xbc, XbC, Xbz, XbZ, XBc, XBC, XBz, XBZ,
|X|Y|Z|           Xyc, XyC, Xyz, XyZ, XYc, XYC, XYz, XYZ
+-+-+-+           (16 * 4 = 64 possibles)

I've been trying this now for about 2 days and I think about it and think about it and finally think I've got there but then try it out and it crashes and burns... I've tried rotating the array as well to no joy (perhaps that warrants further investigation?)

Help solicited here.

Friday, 10 July 2009


The title above is actually the matrix of the transformation I was looking for and corresponds the a 90° rotation and a vertical flip... it also corresponds to a 270° rotation and a horizontal flip.

Anyway, I've spent so long trying to figure it out using any number of egg boxes that I managed to lose sight of why I was trying to transform the array... I guess that it's because I hard-coded the elements of the array in its initial iteration and wanted the new non-hard-coded to be in the same format... whereas it doesn't have to be...

Thursday, 9 July 2009

Nearly rotating a 2-dimensional array in Java

I had a 2-dimensional array in a java program and I needed to rotate the structure of that array and place the elements of the array in a specific order, I'll illustrate what I mean with the following illustration:

|1,1 |1,2 |1,3 |
|   A|   B|   C|
|2,1 |2,2 |2,3 |
|   X|   Y|   Z|

So you can see the above as an egg box. I've got six hens you see and one day those six hens lay two eggs each... the poor bloody chickens haven't got nice names but instead have the names "A", "B", "C", "X", "Y" and "Z". So I've got twelve eggs and I've placed one of each of those hens eggs in an egg box like in the illustration above, I place the remaining six eggs in another egg box like in the following illustration:

|1,1 |1,2 |
|   A|   X|
|2,1 |2,2 |
|   B|   Y|
|3,1 |3,2 |
|   C|   Z|

There we have the illustrations and I knew that I'd need to use two loops to populate the new array but how?

I spent about 3 hours thinking about it and playing with possible solutions without really knowing what I was doing... thought it might be something like SVG matrix calculations and started to get even more confused until I sat down with a bit of paper... Imagine, if you will, that you need to describe to someone the placement of the eggs in the two boxes.

Because we're human we'd spend ages saying things like, "Put the first B egg in the top middle hole in the top box and the left-hand middle hole in the bottom box." Should the boxes get bigger... something like:

|    |    |    |    |
|    |    |    |    |
|    |    |XXXX|    |
|    |    |XXXX|    |
|    |    |    |    |
|    |    |    |    |

THen things get a little more complicated and we might decide to tell the other person what we mean by saying, "Put it in the hole two down and three across".

This is how we navigate a 2 dimensional array in fact; if we had a Java array like in the big egg box above we'd get to the big red "X" egg by saying bigBox[1][2] (don't forget that we're starting counting from 0 rather than 1).

Anyway, something interesting happens if we write down the places of each egg in each box:

    | BOX1 -- BOX2
A = | 1,1 -or- 1,1
B = | 1,2 -or- 2,1
C = | 1,3 -or- 3,1
X = | 2,1 -or- 1,2
Y = | 2,2 -or- 2,2
Z = | 2,3 -or- 3,2

And what do we notice? Sometimes it takes a pen and paper to get to the right answer... either that or a cycle ride with a nine-year-old who's rather smart!

So we get the following method:

  public static char[][] rotateArray(char[][] incoming){
    int width = incoming.length;
    int height = incoming[0].length;
    char[][] outgoing = new char[height][width];
    for(int x = 0; x < incoming.length; x++){
      for(int y = 0; y < incoming[0].length; y++){
        outgoing[y][x] = incoming[x][y];
    return outgoing;

I did look at these two pages: and Of the two the latter is the better I think... at least in terms of me thinking about the problem and prompting me to get my finger out.

Wednesday, 8 July 2009

First crack at 2 word permutation generator

A little while has come and I've started coding something that will work. The result is here and the final result (using command line redirection) is here.

Now to finesse the program so that it'll take command line arguments.

Prior to that though I've altered the workhorse bit where the chars are printed to instead of:


We can have:

String newWord = "";
newWord = newWord+a1[a]+a2[b]+a3[c]+a4[d]+a5[e];

A lot neater and it now allows us to do this:


Rather than use all the millions of lines in the pdf above.

Java char addition does seem to be a bugger though as this will throw an error.

String newWord = a1[a]+a2[b]+a3[c]+a4[d]+a5[e];

Odd ehh?

Command line redirection

This is going to be of use in a little while when I've finished writing a program to work through all possible combinations of 2 words.

For instance, if I have a java program called from the command line and I want to collate the output of that program then I could do something like this:

C:\java someProg > someResult.txt

Then anything that gets thrown out by someProg will get sent to the text file someResult.

Another thing to take into account is that if two angle brackets (>>) are used then the output is appended to the file if it already exists... then again the single angle bracket (>) will overwrite the file.

Getting back to the program that I need to write it's a little like this in that I need to get all possible permutations of 2 different words... in both upper and lower case, the thing that makes it easy is that the letters must be in the correct order... they can however be either upper or lower case. For instance all combinations of the words "a" and "i" are: "a", "A", "i", "I". Whereas all possible combinations of the words "ab" and "cd" are: "ab", "aB", "ad", "aD", "Ab", "AB", "Ad", "AD", "ib", "iB", "id", "iD", "Ib", "IB", "Id", "ID". I guess you can see where this is going.

So there are 4 possible combinations for 2 one letter words, 16 possible combinations for 2 two letter words, 64 possible combinations for 2 three letter words, 256 possible combinations for 2 four letter words, 1024 for 2 five letter words, 4096 for 2 six letter words, 16384 for 2 seven letter words and 65536 for 2 eight letter words!

Think I'll need to use java arrays to output 'em all rather than messing about by hand using pen and paper.

Monday, 6 July 2009

jQuery Zebra Highlighting for Tables

Cheers Tom for the driving lesson.

For my dissertation I used a number of tables to illustrate the modules on offer and some normalization. In order to make 'em a little less boring I used different classes for alterate rows... which was tedious to say the least. Then I came across the Zebra Widget for TableSorter, a rather cool jQuery plugin.

This was easy to include and added the benefit of allowing me to sort the data in the table by using the tablesorter functions... it might have been easier to just have the zebra highlighting but I wasn't sure if I'd ever need the facility of sorting the data... couldn't hurt now could it?

Anyway, to get it working I placed this in the head:

    <script type="text/javascript" src="../js/jquery-1.2.3.min.js">
    <script type="text/javascript" src="../js/jquery.tablesorter.min.js">
    <script type="text/javascript">
        $("table").tablesorter({widgets: ['zebra']});

Of course, if you've a number of tables on your page you can use the power of jQuery selectors to be a bit more choosey about which one/s you choose to have the script work on... I just had the one table on the page so just used "table".

Along with the script inclusion above you'll also need to alter your CSS to something like:

 background-color:      #999999;

This'll allow the script/widget/plugin to alter the appearance of your rows... of course it means that the default background-color of the rows will have to be something other than gray 60 wink.

Wednesday, 7 January 2009

SDHC formating

I keep killing SDHC cards cards in my Eeepc; I keep killing 'em where I haven't got admin rights to a Windows machine so I need to keep going back to google and searching for how to do it via the command line (re-reading Snow Crash!) on the said Eeepc. I've been doing this so many times that I thought I'd write down the process and save myself some time in the future:

Insert the card (make sure it's not cold or for some reason my Eeepc doesn't recognize that a card has been inserted...

/home/user> sudo mount

This will show where the SDHC card is mounted, usually (all the times I've done this but YMMV) it'll be /dev/sdb1.

/home/user> sudo umount /dev/sdb1
/home/user> sudo fdisk /dev/sdb1

We need to delete anything that is there and then create a new primary partition (keeping hitting "m" for ideas of how to do this) we then need to write this to the disk. Then we need to eject the card and reinsert it and do this:

/home/user> sudo mkfs.vfat -c -F 32 /dev/sdb1

That should be it though it's worth noting that sometimes we'll need to delete any existing partitions before creating new ones. Odd things SDHC cards, just wish I knew how I manage to keep killing 'em.

This story about child elopers nigh on made me melt.


The Caffeine Click Test - How Caffeinated Are You?