Wednesday 25 April 2012

Angry birds and mouldy Apples

This is a story of how my continuing quest to get Angry Birds Space on my iPod led me through a journey of rage, disappointment and finally, acceptance that everything is, in fact, just a bit crap.

dead ipod
I finally bit the bullet and updated my iPod touch. You may remember to do it from my Mac would basically require me to buy a new Mac, so I installed iTunes 10.6 on my PC, upgraded the iPod and got it running iOS 4.2.1

I tried installing Angry Birds Space again - the original reason for the upgrade - only to be told that it doesn't support that particular iPod HARDWARE because it needs better graphics capabilities..

A small red light began to blink in my brain as my rage inhibitor burnt out.

"You could've told me that....  "    I said quietly...

The skies darkened, the crackle of rage filled the air and everything fell eerily quiet. 

"...BEFORE I UPGRADED THE O/S!!!"  

Tuesday 10 April 2012

Parsing bookmark files using PHP and writing it out as an HTML link

Here's a code example of something I knocked together to import Windows .url shortcut files to a MySQL database on my home-server system that I'm building.

The shortcut files are actually just text, so you can read them really easily..  
They just contain a header, then the URL.. For example:

[InternetShortcut]
URL=http://www.hackerspace.co.uk


Here's a PHP code snippet... 


//  Create a function and give it the filename of the URL file.. 

function readurl($filename)
{

// Pull the .url off the end.. 
$filenamebits= explode(".url",$filename);

// Create a "Link Description" from the filename
$linkdesc=$filenamebits[0];

// Open the file to get at it's juicy contents
$file = fopen("$filename","r");

// Set up a counter
$linecount=0;

// Set up a "While there's still stuff in the file" loop
while (!feof($file) ) {

// Open the file and get stuff from it, line by line
$line_of_text = fgets($file);

// If you're on line number 1... 
if ($linecount==1)

// Explode the line of text into pieces
$pieces = explode("=", $line_of_text);

// Extract the bits we want and wrap it in some friendly HTML
$URLTOADD="<a href=\"$pieces[1]\">$linkdesc</a>";

// You can either then write this string out to the screen, or like I do, fire it 
// into a database for later use

}

// Increment the line count
$linecount++;

}

// Close the file. Otherwise the operating system gets cross. Probably. 
fclose($file);

}

Why I can't play Angry Birds Space.

I wanted to play Angry Birds Space.  It's a simple thing. Should've been a no-brainer.

I tried it on my iPod touch, but it doesn't have iOS 4, so I'm deemed not-worthy.  I can't upgrade to iOS 4 because to do that requires a newer version of iTunes than my Mac OS version will let me install.  I can't upgrade my Mac OS because it's an old Mac and won't RUN a newer version..   So, to play it on my iPod, I would need to buy a new Mac.
Not going to happen.

Or I could install iTunes on my Windows PC and struggle to sync my music over, and then struggle to get it to do anything because the Windows version of iTunes is just not very good. (Sorry)

So, I thought I'd try the Android version on my phone..  I went to the Google app store thing (or Google Play as it now appears to be called) and went to download it.  Glancing at the permissions made me stop in my tracks..

Concatenating CSVs the easy way

I was recently asked how to 'merge' a few CSV files into one, and if there was a script or tool that could do that. Lets say you h...