Friday, August 14

How to Shoot Yourself in the Foot

The ideosynchracities of various programming languages, exposed through a crude metaphor. This joke has been around for a while, but I'm surprised to hear of some people who work with computers who haven't heard some of them yet..

So - for the benefit of those folk and others, here are a selection of some of my favorites.

You shoot yourself in the foot.

You accidently create a dozen instances of yourself and shoot them all in the foot. Providing emergency medical assistance is impossible since you can't tell which are bitwise copies and which are just pointing at others and saying "That's me, over there."

Find a gun, it falls apart. Put it back together, it falls apart again. You try using the .GUN Framework, it falls apart. You stab yourself in the foot instead.

You shoot yourself in the foot, but nobody can understand how you did it. Six months later, neither can you.

You've perfected a robust, rich user experience for shooting yourself in the foot. You then find that bullets are disabled on your gun.

Foot yourself in the shoot.

You shoot yourself in the foot; then spend all day figuring out how to do it in fewer characters.

You shoot yourself in the foot using bits of other guns you found on the web.

That took so long to get right, you must have shot yourself in the foot at least once by now.

Your foot is ready to be shot, but you just can't find anywhere to shoot it.

You crash the OS and overwrite the root disk. The system administrator arrives and shoots you in the foot. After a moment of contemplation, the administrator shoots himself in the foot and then hops around the room rabidly shooting at everyone in sight.

You shoot 583149 AK-47 teflon-tipped, hollow-point, armour-piercing bullets into even-numbered toes on odd-numbered feet of everyone in the building -- with one line of code. Three weeks later you shoot yourself in the head rather than try to modify that line.

You locate the Gun class, but discover that the Bullet class is abstract, so you extend it and write the missing part of the implementation. Then you implement the ShootAble interface for your foot, and recompile the Foot class. The interface lets the bullet call the doDamage method on the Foot, so the Foot can damage itself in the most effective way. Now you run the program, and call the doShoot method on the instance of the Gun class. First the Gun creates an instance of Bullet, which calls the doFire method on the Gun. The Gun calls the hit(Bullet) method on the Foot, and the instance of Bullet is passed to the Foot. But this causes an IllegalHitByBullet exception to be thrown, and you die.

You can't remember the syntax for anything in this language, so you spend five hours reading manual pages, then your foot falls asleep. You shoot the computer.

You shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds the gun with which you shoot yourself in the appendage which holds...

FROM Gun.Hand
WHERE Chamber = 'loaded'
AND Trigger = 'pulled'

Genetic Algorithms
You create 10,000 strings describing the best way to shoot yourself in the foot. By the time the program produces the optimal solution, humans have evolved wings.

You merely fail to shoot everything that isn't your foot.

You shoot yourself in each toe, iteratively, until you run out of toes, then you read in the next foot and repeat. If you run out of bullets, you continue anyway because you have no exception processing ability.

After realizing that you can't actually accomplish anything in the language, you shoot yourself in the head.

370 JCL
You send your foot down to MIS with a 4000 page document explaining how you want it to be shot. Three years later, your foot comes back deep fried.

Put the first bullet of the gun into foot left of leg of you. Answer the result.

Shoot self in foot with water pistol. On big systems, continue until entire lower body is waterlogged.

USEing a COLT45 HANDGUN, AIM gun at LEG.FOOT, THEN place ARM.HAND.FINGER on HANDGUN.TRIGGER, and SQUEEZE. THEN return HANDGUN to HOLSTER. Check whether shoelace needs to be retied.


Okay, it seems it works for OS too:

You shoot yourself in the foot.

Cannot locate foot. Bad command or sight line.

It's a nice gun, but nobody's made bullets for it for over a decade.

Windows 3.1
You have a gun selecter, bullet pop-up help, and shooting sound effects - but you're unable to open shoot.dll...

Windows 95
Your gun is not compatible with these bullets and you must install an upgrade before you can continue. Then you will be informed that you don't have enough memory.

Windows Vista
Warning: Shooting yourself in the foot could potentially damage your foot. Are you sure you want to do this?

Windows 7
This gun does not come with bullets. Our marketing campaign will however recommend that you download bullets directly from us, maintaining our monopoly on both guns and bullets.


Some of these I wrote myself, some have been around longer than I have! Enjoy!

Thursday, May 14

Back to the Future

One point twenty one gigaWatts!

Time travel. Okay, so here's the deal. There's really nothing in the laws of physics which explicity prevent it under any circumstance. In fact, there's an abundance of loopholes and nifty tricks you can theoretically perform using current theories and exotic measures.

First, the future.

This is easy. Einstein's Theory of Special Relativity tells us (and this is totally 100% true) that the faster things move, the heavier they get, the thinner they get, and they experience less time than someone standing still. This effect is only really noticable when you get near to light speed.

So, you could zoom around in a spaceship at say 90% of the speed of light, return to Earth one year later - but you'd find it was actually two years later on Earth! The faster you go, the further you travel forward in time relative to everyone else.

Of course, going that fast takes a huge amount of energy, and the faster you go, the harder it gets to go faster. You can't reach light speed. So it'd generally be better to not have to go so fast in order to travel forwards. Thanks to Einstein's Theory of General Relativity - we don't have to. Instead, we bend space-time around ourselves to get a similar effect.

This is what's known as a gravity well. All matter bends space-time around it, and the more of it you get in one place (density), the steeper the sides of the well. If you could compact, say, a large planet like Jupiter down to... about the size of the Atomium in Brussels, then get inside - you'd get a very similar effect.

A lot of time travel tricks revolve around bending this space-time membrane in such a way that our normal everyday view of the world becomes warped, and things that seem completely impossible are in fact the only mathematically valid solution. We've demonstrated the future, is easy enough, but what about the past?

Coming Soon: Back To The Future II - wormholes, cosmic strings and other cheap tricks


Sunday, May 10

The Most Beautiful Equations

Sometimes mathematics is beautiful. It's a hard thing to observe; you need to peer through various mystifying levels of symmetries and distractions, until you finally arrive at that most elusive moment where you suddenly realise it's all really simple.

Many of the greatest equations, theories and postulates have relied on the power of their beauty. Einstein's E=mc2 has entered the public consciousness like no other, while many others intrigued and delighted the scientific community without much publicity.

Gauss's integral for example, reduces this technically baffling integral to a silly and simple number - albeit one which goes on forever.. 1.772453850905516027298167483314...

Comprehending the lateral method used to solve this problem was a major moment in my scientific education. The solution appears to be infinitely unsolvable, if you think of 'x' being a straight line, which as far as any really grasped, was mostly what integration seemed to be about.

However, if you instead think of this problem in two equal dimensions, you can bend the co-ordinates into a circle. Suddenly, as the circle closes, the difficult bit drops off and you can solve the bugger easily to get 1.77...

This identity is used heavily in quantum mechanics, in fact - the whole field is underpinned by the kind of logic used in this solution.


Euler also used circles to describe other strange and useful numbers. Imagine a second hand travelling round the clock face. Imagine a straight line drawn from 9 to 3. The question is, how far away from that line is the tip of the second hand, as it travels round? If you plot a graph of that distance against time, you'll get a sine wave:

If you instead imagine a straight line between 12 and 6, and plot that, you'll get the same thing, except the start point will be a quarter of a circle further round. These two waves, one '3 hours' out of phase with the other, are called sin and cos.

We would usually use an angle called a radian instead of the clock metaphor. A clock has 12 hours, a circle has radians - twice the number π. So the two waves are π/2 ( 2π / 4 ) out of phase, and the two waves are sinθ and cosθ where θ revolves all the way around from 0 to 2π, like the hand making a full revolution.

Euler showed us that you can treat sin and cos as really the same things, if you use something called an imaginary number.

Okay, I'm thinking of a number. What is it? "Well.. " you say, "it could be anywhere between zero and infinity!" What about negative numbers? "Well, minus infinity to infinity then!".

And you'd have me there. But suppose instead I was thinking of the square of a number, there'd be no point guessing a negative number because any number, positive or negative, gives you a positive number when you square it. In fact, if someone claims they've thought of one, well, it can't be real can it? No real numbers do that! Must be some kind of.. imaginary number, hah!

In mathematics, existing and being real thankfully don't have to mean the same thing, so we can imagine numbers which exist but aren't real. They'll actually really useful, and in fact have a lot to do with circles, and waves, and lots of really geeky physics stuff.

Don't worry if that's a bit confusing, The point is, when you combine in the radian idea, the sin and cos, the imaginary number idea, and the exponential (I won't go into that here - check the link at you arrive at the most startlingly simple statement:

This, I believe, is the most beautiful equation. The soaring exponential, the elusive imaginary, the reliable circle, the triumphant '1', then equality to nothing. It's the poetry of the universe, and it's just the first line.

Thursday, May 7

Learn PHP - 10 Things for a Beginner

I've been ranting about PHP quite a bit, demonstrating some of the ways I've used it in mashups and applications. I love it, because it's a great glue for ramming different bitz 'n' bobs into each other using the mimimum fuss.

I seem to have vomited scripts a bit too much, and thought it would be a good idea to get back to basics for anyone who doesn't know PHP but fancies learning - 10 simple things about it:

1 -- Variables! Put a dollar sign in front of any word. You'll need lots to hold all the data, e.g. $day for what day it is, $xml to hold an xml string, $salesLastWeek for.. you get the idea..

2 -- Arrays are variables that can hold lots of data - for example, an array $week which has seven values, the days of the week. So $week[0] is 'Sunday', $week[1] is 'Monday', or whatever you want really.

3 -- IF. If this, do that. If this, do that, if not, then if these, those, otherwise die. Or rather,

if($this == $everything)
$answer = that($it);
else if ($these == $those)
$answer = "those";

or something along those lines...

4 -- Say Hello! echo makes stuff come out the other end. echo "Hello World!";

5 -- Instead of IF you can SWITCH.

switch ($today) {
case 'Saturday'
$txt = "I told those fucks down at the league office
a thousand times that I don't roll on Shabbos! ";
case 'Friday'
$ txt = "cause it's Friday; you ain't got no job... and you ain't got shit to do.";
$txt = "I can't think of a funny quote.";

6 -- So what day is it? idate gives you the bits you need. So:
gives you the current year ie. 2009, and use a w intead of Y to get the day of the week. Sunday = 0 etc.

7 -- Make some IFS.
Greater than: if ($it > 45) { do_it($it); }
Or: if ($one > 1 || $two == 3) (do_something($one, $two); }
And is &&. Not is !, as in if (!$it > 45), otherwise known as <= 45.

8. Do Something. That was a function. You can tidy up your code by making bits of it functions. Particularily bits you use a lot or things that feel seperate.

function do_something($one, $two) {

There. Now we can "do something" with $one and $two. The dot makes the variables write next to each other. So if $one = 1, and $two = 2, we get 12+12 = 24 when we say:

do something($one, $two);

9 -- SimpleXML. I work with data, and lots of data is XML. $xml = simplexml_load_file($file);

10 -- FOREACH - one of my favourite words. You can loop through each item in an array, or each node in an XML file. Check the link, as always w3schools is an excellent source for basic PHP reference.

There you have it! Did anyone learn anything? Let me know!


Saturday, May 2

Please mind the gap between the software and the platform

Excuse the awful pun. developed this really neat graphical flash engine back in 2006, Google were quick to snap it up the following year, and have also been so graciously kind as to publish an API for it under the guise of Motion Chart.

You can use this engine freely to include whatever data you want, though getting data in and out can be a pain, if, like me, you want to enable non-programmers to experiment with their own data.

So, the first step might be reconfiguring the source from explicit javascript declarations, to something a little more familiar - xml. I used a structure like this:

<?xml version="1.0" encoding="UTF-8"?>

<title>Hello, this is my first motion chart!</title>
<Category>Canned Fruit</Category>
<Metrics>Items Sold</Metrics>
<Category>Canned Fruit</Category>
<Metrics>Sales Value</Metrics>
and so on..

Which gives you a nice extensible data platform, although it is quite verbose (duh.. it's xml!).
Each dataRow captures the time variable (WeekNo), the entity names (Category), along with the name and value of each metric.

You can then write a parser for the xml in your favourite scripting language, and embed the results into the javascript. Here's an example for PHP - verbatim:


$xmlfile = "dataYouWantToUse.xml";
$data = simplexml_load_file($xmlfile);

$categories = $data->xpath("dataContainer/dataRow/Category");
$timestamp = $data->xpath("dataContainer/dataRow/WeekNo");
$values = $data->xpath("dataContainer/dataRow/Value");
$metrics = $data->xpath("dataContainer/dataRow/Metrics");
$title = $data->xpath("title");

$uCatN = count(array_unique($categories));
$uTimeN = count(array_unique($timestamp));
$uMet = array_unique($metrics);
$uMetN = count(array_unique($metrics));
$rowCount = $uCatN*$uMetN*$uTimeN-1;
$googleCount = $uCatN*$uTimeN;

function listColumns($uMet)
echo "\n";
foreach ($uMet as $thisMet) {
echo "\tdata.addColumn('number', \"$thisMet\");\n";
function generateJs($categories, $timestamp, $values, $rowCount, $uMetN)
echo "\n";
$c = 0;
for ($i=0; $i<=$rowCount; $i+=$uMetN) {
if ($timestamp[$i] < 10)
$time = "0".$timestamp[$i];
$time = $timestamp[$i];
echo "\tdata.setValue($c, 0, '$categories[$i]'); \n" ;
echo "\tdata.setValue($c, 1, '2009W$time'); \n" ;
for ($j=$i; $j<=$i+$uMetN-1; $j++) {
$n = $j-$i+$uMetN-1;
echo "\tdata.setValue($c, $n, $values[$j]); \n" ;
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" xml:lang="en" lang="en">
<title><?php echo $title[0]; ?></title>
<script type="text/javascript" src=""></script>
<script type="text/javascript">
google.load('visualization', '1', {'packages':['motionchart']});
function drawChart() {
var data = new google.visualization.DataTable();

data.addRows(<?php echo $googleCount; ?>);
data.addColumn('string', 'Category');
data.addColumn('string', 'Time');
<?php listColumns($uMet);
generateJs($categories, $timestamp, $values, $rowCount, $uMetN); ?>

var chart = new google.visualization.MotionChart(document.getElementById('chart_div'));
chart.draw(data, {width: 800, height:460});
<style type="text/css">
body {text-align: center;}

<h3><?php echo $title[0]; ?></h3>
<p> data in motion</p>
<div id="chart_div"></div>
<h5><a href="">adam marshall 2009</a> | <a href=""></a> | <a href="">powered by google</a></h5>
That's set up to process time in the '2009W1' format - haven't got round to generalising that yet, but it's not too hard to modify if you want to use different formats. Likewise for the inclusion of text (colour category) metrics - you just need to modify the listColumns() function, and make sure you've got quotes around their values.
Phew! So, you can load that xml file directly into the page at runtime. Maybe you can get your IT guys to help making a current data source available as xml in this way; if not - here's a little script for converting a csv file to xml courtesy of Chris M over at, with just a few modifications to create the chosen format.


// define params
$containerLabel = "dataContainer";
$rowLabel = "dataRow";
$fileLocation = "csvdata/".$_GET["from"].".csv";
$fileDestination = "xmldata/".$_GET["to"].".xml";
$title = $_GET["title"];
* Converts a grid layout CSV to an XML
* Rows are nested within the container variable
* Column headers in the CSV become tags containing the data, within each row
function csv2xml($file, $container = 'data', $rows = 'row')
$r = "\t<{$container}>\n";
$row = 0;
$cols = 0;
$titles = array();

$handle = @fopen($file, 'r');
if (!$handle) return $handle;

while (($data = fgetcsv($handle, 1000, ',')) !== FALSE) {
if ($row > 0) $r .= "\t\t<{$rows}>\n";
if (!$cols) $cols = count($data);
for ($i = 0; $i < $cols; $i++) {
if ($row == 0) {
$titles[$i] = $data[$i];
$r .= "\t\t\t<{$titles[$i]}>";
$r .= $data[$i];
$r .= "</{$titles[$i]}>\n";
if ($row > 0) $r .= "\t\t</{$rows}>\n";
$r .= "\t</{$container}>\n";
return $r;

$xml = csv2xml($fileLocation, $containerLabel, $rowLabel);
$fullxml = '<?xml version="1.0" encoding="UTF-8"?>'."\n


I've added GET parameters to this, so if you had a csv file caled 'data1' in a folder on the server called 'csvdata', you can call using the parameters:
?from=data1&to=fileYouWantToUse&title=Hello, this is my first motion chart!
to create the xml file. Now, you should be able to use excel/analytics software/business intelligence tools to produce the csv, compile it to xml, and display it in a cool motion chart!

Why not show your CEO his company's history in motion, or your sales team the last few weeks of consumer trends?

Thursday, April 9

Mathematics, the Universe and Everything

A few weeks ago on Horizon, comedian Alan Davies went on a journey through time and space...

Boosh. No, actually - maths.

Marcus de Sautoy is an Oxford professor of mathematics; I've read through his book The Music of the Primes several times and it's an inspiring read - flowing with the genius of a man who's not only able to see the numbers clearly, but who can vividly communicate the beauty of maths - it's immortality, it's infallibility, it's truth.

Marcus was tasked with showing Alan this wonder, and convincing him that maths can actually be amazingly good fun! There's a common stereotype and cultural stigma associated with mathematics and the sciences, which you'll be familiar enough with that I shan't go into it.

The problem is, that to understand/contribute to most of the fun stuff, you need to learn a lot of the really quite difficult stuff; this can require a certain mindset and it's not always obvious what the pay off is going to be for putting in the effort.

The quick wins are the situations where you can demonstrate a fundamental and beautiful idea without using any of what most people would consider "maths". Marcus introduces Alan to a fourth dimension in space, using physical examples and discussion in the place of equations and laws. They then explore the shape of the universe, and describe some of the implications of Perelman's proof of the Poincaré Conjecture.

[That's to do with how the entire universe can be finite, but still not have any "edges" - there's no magical "end of the universe", much to Douglas Adam's and Metron's disappointment...]

The show is a wonderful insight into the true importance of mathematics, and seeing Marcus's energy and Alan's glee on grasping new concepts makes me proud to be a student of the sciences. More importantly, we end on the revelation that:

The universe seems like it might be the icing on a four dimensional doughnut. Believe.

Anyway, with luck it might still be on the iplayer - check it out!

Monday, March 30

It's the "Aaargh! Facebook!" Post

I really don't know whether I should just totally delete my account -

and spit vehemontly every time someone says the word, or -

continue using it as an incredibly useful communication tool; everyone I know is on it, therefore, it's remarkably universal.

I joined facebook "back in the good old days", and back then, it was a fairly simple business. It's great that it's become such a phenomena - but with the increased pressure from the media, marketing groups, affiliate programs, yadiyada.. I'm inclined to say I'm losing faith - slowly but surely.

Currently I'm trying to teach the damn advertising bar that I don't like Hot Dates! or Twatty Mobile Phones! whereas Joni Mitchell tee-shirts and cheap flights to weird places are actually okay in my book, and I'm happy for them to appear in my space. It doesn't seem willing to co-operate.

And that should be the whole point behind social marketing. There are things I'm interested in, for god's sake - just take the hint!

Look Facebook - this is all like.. "Hmm! Super interesting!"

Whereas this is all like "Fuck off Facebook!"
I'm off to hear Paul Cusick's debut CD. Sorry girls..

Friday, March 20

Don't ask questions you already know the answer to - REST apis part 3

Okay, let's have a look at something else.

You probably don't want to go trawling for data every time you need to process some, so let's look at saving some data.

State your REST source as usual, but instead of a simplexml load, do:


Which loads your resource, saves it to the server as xml (or whatever), then closes the connection. That's all you need to put it this file - end with ?> as usual and save as whatever - fetchdata.php

Then, whenever you need to refresh your source: include("fetchdata.php");

Whenever you want to use the data that's already there:

$sxmlobject = simplexml_load_file("somedata.xml");

if it's XML. If you have to deal with JSON you can still loop if you use an array, instead of a simplexml load.

Here's one last trick. On your main page, you can make it refresh the data in time intervals. Or specifically, you tell it to refresh if it's been at least X mins/hours/days since the last refresh.

//This function refreshes the data and records the time it does it.
function refreshData()
$t = time();

//This is now
$timenow = time();

//If you can't find that record, refresh anyway. This is so it works first time!

//Find out the last time you refreshed - might have been just a few lines above though!
$timeload = file_get_contents("lastupdate.txt");

//If it's been 10 hours - 36000 seconds - since refresh, refresh!
if ($timenow > $timeload + 36000)

$sxmlobject = simplexml_load_file("somedata.xml");
//and do something with it!


Sunday, March 15

Particularily Happy Place - REST apis part 2

Okay, if you want to start querying, you'll need a server to run your PHP code. I recommend giving XAMPP a look - you'll get Apache, MySQL and PHP support all ready to go out of the box (okay, almost - I think all I had to do was initialise openssl in apache/bin/ini.php - google it) for free!

Ready to go? I'm a big fan of PHP for it's pretty open typing - I hate having to declare everything, I find this language makes it relatively easy to juggle resources without actively having to keep track of everything and worrying about type conversions etc. Let's just jump in.

The first thing to do is define your source. Most apis will have a token system to stop malicious users abusing the system, so I'm going to add that string in here too. Something like this:

$call = "";

creates a variable called "$call" and inserts your resource address as the value. Note the dollar sign denotes a variable. You'll then want to insert some other query strings:

$call = $call."&country=uk";
$call = $call."&city=london";

Note we could have lumped all three of these together in one declaration, but we'll want to come back later to change these, as it'd be useful to actually change their values. I'll come back to this.

$xml = simplexml_load_file($call);

Keeping this really simple, in one line we've: contacted the server ( here, at, retrived the response and loaded it into a simplexml object called "$xml". If you look back to the last post, we had a response which contained one level of hierarchy - so we need to drill inside the "response" tag to get to the tags we want e.g. "temp"...

We can do this easily using a foreach statement, which looks at each child of the $xml variable (calling it $xmlchild). We then call the name of the tag $xmlname - and the print $xmlname and $xmlchild, with a hyphen between them, and a break at the end.

foreach($xml->children() as $xmlchild)
$xmlname = $xmlchild->getName();
echo $xmlname."-".$xmlchild."<br />";

Once the server executes this PHP page, it would output the following to the browser:


Of course, you'd also want to build in controls to alter the query, do calculations with the data, display it in a meaningful way etc. but this is the basic technique I've been using - use PHP to send a request to a third party server, process and parse the response on a local sever, and serve the results back to the browser.

Give It a Rest: REST apis part 1

So, first off I'm going to talk about one of the simplest ways to get a web service to send you data - it's called REST.

REST stands for representational state transfer and is an architecture, a way of laying out resources on a server. The idea is that the information you want to get at (the "resource") can be asked for by describing a "representation" of that data using HTTP calls. Services which do this are "RESTful".

For example, say you have a service which provides you with details of the weather in a specific location. One way to query this service might be:


Which is to say, what's it like in London, UK right now?
Another equally valid way to ask for this information might be:


Which refers to exactly the same place (resource), but in a different way. As long as the server accepts all of these query parameters, they're both fine to use.

The key here is that you don't have to send a HTTP header, you don't need any funny protocols, you just ask for a page with well defined query parameters saying what you need, and bing! that page contains the appropriate data.

The response itself can be in pretty much any format, indeed - you'd often use one query parameter for the response format, if you have a choice. Suppose it was XML, it might look like this:


Which I've just made up, but you get the idea. If you ask for the weather info for the city of "Gropiertegbun", you might instead get this:

<error>city not recognised</error>

With the possible exception that "recognised" would probably end up getting spelt the American way. That's because I made that city up, and even if I didn't, perhaps asking for a city without a country ID returns an error too. REST apis generally have fairly simple rules about which parameters you can use with which, and generally have defaults for when specific parameters are missing.

Part 2 will deal with how to use a server scripting language, in this case PHP, to make these calls and parse (read out) the results. I'll then probably follow on with details of how to build a user inteface to modify the queries, and how you can feed the results into other apis to display and use your data.

Tuesday, March 10

My First Ajax

As an analyst, I often see things which aren't "joined up", systems that don't talk to each other properly, tasks that people complete which are frustratingly manual (data entry sucks!) but the worst of all...

Things that people could do, but don't, because they're too tedious/complicated/etc..

With that in mind, I've been developing with an API published by a third party I work with. Don't get me wrong, they have a good system, but it tends to be a bit on the slooooowww side (they could do with some ajax upside their faces..) Not to mention the hastle of remembering your username and password, logging in, navigating menus... So I'm on a mission to create an easily usable interface to their API which we can use locally.

I'm relatively new to the techniques I'm using - but that was the main motivation in the first place! So, I've been learning all the HTML, XML, PHP, JavaScript needed to put together my own little ajax powered web app.

I'll be posting a few little stories about this as it develops, as well as hopefully providing some insight into what is needed for anyone that perhaps wants to try themselves!

Many companies (Google, Amazon, spring to mind) have open APIs which you can play with - so why not have a look?

Saturday, March 7

Kepler Mission is GO

In other news:
Kepler, a sophisticated space telescope, blasted off from Cape Canaveral, Florida, in the early hours of the morning, and separated from its carrier, a Delta II rocket, nearly 450 miles above the earth.
Kepler's job is to scrutinise the area of the part of the Milky Way near the Cygnus and Lyra constellations, looking for planets around the stars there. Specifically, it's hoped that it'll find a rocky Earth like planet - providing some solid evidence to back up speculations of exactly how common a solar system like ours is.. are we unique - or do similar systems, with similarly composed planets (with conditions suitable for life!) crop up all over the place?

All Fluxed Up

Flexy Frederick's been over, last night we recorded a few acoustic songs and this morning, I had the fortune of a tutorial of his OpenFlux value object model he's been working with, which provides easy integration with a client/server model like Cairngorm.

The value object (LinkVO) contains a few variables for holding necessary information about the views of the component, such as the user's name, location of his pic etc...

The link object inherits the properties of a List Item, with the get and set methods overriden to talk to the value object. In the same directory there's a Flux content variable for each view of the component, in this example it's a user name and a photo [degrafa handles the "brand" formatting for the photo, and both look at].

The controller sends the request to the client/server model - I'll have to read Part 2 to find out what happens next... Did I get that roughly right, Freddy? :)

Friday, March 6

Talk Talk

Tom Taylor makes things talk

This guy's responsible for the twitter account which tells you when Tower Bridge is raising and lowering, and has built a "feed printer" from an old receipt printer and an ethernet shield.


Thursday, March 5

Blinded by Greed and Religious Delusions

If there's a grand global warming conspiracy, this is it.

Watch some amusing but slightly terrifying videos

Also check out Ignorance Corner, and bask in the power of greed and stupidity.

I Wonder If He's For Sale?

Second Life vs Kingdom of Loathing

This isn't really a competition. SL is a nice fat download, which then proceeds to burn processor if you venture into a remotely complex environment. KoL is a PHP based browser game with hand drawn stick figure graphics. SL is boring as tits, because it's not exactly clear what you're supposed to be doing, and most places seem empty, unfinished and depressed. In KoL you have clearly defined quests, with ingenious solutions, and plenty of ironic monsters to beat on. SL has desperate marketing schemes, KoL has pop culture references, eating, drinking, gambling, stealing and sabre toothed limes.

I know where I'm off to tonight.

Wednesday, March 4

Eat, Live and Breathe in Real Time

I discovered this today.

Comet allows you to send data directly to your browser without having to ask for it.
You heard of AJAX? It's a combination of web technologies - which lets you change bits of web pages without having to reload a brand new page. It's been all the rage - though Google apparantly have declared the AJAX revolution complete.

So what's next? Comet's not dissimilar to AJAX - it's not really one thing, it's just various bits of technology used together in a fairly organised manner - the aim: reduce unneccessary processing and data transfer on the net. Simple!

The problem is, how do you know when there's new data available? The user can ask for it, but he'd rather have it appear automatically as soon as it becomes available. AJAX polling helps, because your machine (client side) will ask the website (server side) every now again whether anything's new. But if the answer is "no", it's basically a wasted trip.

Instead, a Comet framework allows the server to send the new data as soon as the event occurs, and have it AJAXed into the browser without you having to do anything, and with the minimim amount of effort.

So the web is going real time!

PS. This popped up on my tweetdeck. I've had a twitter revolution after intially discarding it, when I discovered the beauty of it's ability for memetic transfer, rather than something to do with "friends" (as intended). Ideas propogate, trends ebb and flow. I suspect meme growth in the twittersphere behaves much like fields in paramagnetic substances (incidently, the phenomena of clapping in crowds spreading and dying away is very similar too). So, if anything - it's the closest thing we've got at the moment to "the pulse".

Tuesday, March 3

The Spirograph of Everything

I've added this pic of an E8 Lie Group. Isn't is neat?

This is a mathematical symmetry - and the highest order (read: "most beautifully complex and simple at the same time") of it's type that can be constructed. I think it's really pretty, and what's more, it's a usable gauge group (read: "something that behaves nicely enough to use in hardcore physics") into which the Standard Model of Matter fits nicely. There's plenty of gaps left to fill - so do any of them really exist as symmetries of particles in our universe?

Bring the LHC, let's find out!

Garret Lisi discusses the implementations of this symmetry in his "theory of everything" on - check it out. The rotating visuals go a long way to showing you how it works.

ps. yeah, so the LHC needs a bit of tweaking before it can work properly. This was pretty much expected, if not hoped for. If only the journalists would pay attention.
On that note, no-one in physics calls the Higgs boson the "God Particle". Only sensationalist journalists do.
And thirdly, it was a chemist who started the whole "black hole" media frenzy. I use the following parallel:
Imagine you have a mole. You're a bit worried about it. You go to a gynocologist, he tells you it's dangerous melanoma - you go to an oncologist, he tells you "it's a spot, mate". Who are you going to believe? In other words, there is nothing wrong. The LHC won't create black holes which could somehow escape and swallow the world. It can't. Trust us.

Monday, March 2

Keep On Crunchin'

Layoffs.. sigh.

Gladly I'm not affected but still, it's generally causing commotion and I'm finding it hard to find the right position to take in these dark times...

Part of me just wants to shout "This is judgement day, this is what gross capitalisation does to a nation! Don't pretend you haven't seen the good times, now the chips are down - you can't just whine about it! Fight!

But then again, I'm speaking somewhat from the ivory tower, as usual. It seems the major burn is the fact that people run the risk of axing those whose departments they just don't understand - business is still basically an old boys club, and those of us whose roles fall outside of the classic dinosaur hierarchy unfortunately have the problem that the fat cat's literally don't realise what we do for them. Easy meat.

I'd like to think that if mass corporate culture managed to sort it's smeg out and actually let the people who knows what's going on run the show, we wouldn't have to deal with this kind of stuff. Everything would just function in a perfect natural equilibrium.

Although, maybe this is the equilibrium? Maybe we have to suffer now, in order for the next phase of humanity to flourish?