PHP, Arrays and Lies…

We all know (well the coders amongst us so anyway) that while we might be very fond of PHP, it does not do Arrays properly.

I could go into great detail, but basically there are historic (and no doubt design) reasons for the way in which PHP handles the most useful of data structures, and while often very handy, there are times when I long for the whole thing to just work!

Arrays in PHP are all __actually__ hashes, and are only treated as Arrays if they have numeric keys that begin from 0.

I just wasted 2 hours of my life having forgotten the last point of the above. I was unable to work out why two apparently identical arrays were rendered into very different JSON by json_encode(). Well, it turns out that all I had to do was marshall the Hash with numeric keys (that I think I could be forgiven for expecting to behave as an array) into a fresh array (staring from 0), and hey presto!

I hope that someone else who is fighting with this delightful little idiosyncrasy will benefit from my having laid out my pain and dumbness for all to see…

That is all.
.
EOF


My daughter the driver…

P279

I snapped this on the way home and had to share 🙂


Why it’s time for Guido Fawkes to be un-masked and then sent to bed without any supper…

So the government has overhauled ePetitions – great…  I’ve got to be honest I’m not exactly 100% behind the focus-group come popularity contest of the general public influencing policy so directly, even if there are only 6 days available on the current parliamentary schedule for the next year upon which matters raised on ePetitions could be debated (*from the BBC News website article on the subject).

Still 2 things have come out of this so-called development…

1. The Government need to stop being in charge of anything to do with IT – the site is already incapable of coping with the Day #1 traffic-spike, despite the same thing happening to the Crime Map site last year… *shakes head*

2. Paul Staines (a.k.a. Guido Fawkes) has clearly had his course of LookAtMe Disease step up a gear.  Why do I say that?  Well, it would appear his first thought upon having a new ePetitions site available to him was to play to every stereotype of his adopted position as right-wing reactionary everyman with an internet connection; he has put up a petition requesting (essentially) that the Government bring back hanging.

Now I am all for free speech, and I believe that lively debate under public scrutiny is a cornerstone of an open, progressive and broadly democratic society, but this action on his part smacks of wanting to pick a fight rather than actually attempting to serve a deeply held political belief.  Sure, Mr. Staines may indeed be a hate-filled bully who believes that the risk of an irreversible miscarriage of justice is acceptable as long as he can pull the lever on paedophiles and cop-killers, but I have a feeling that as a small-government conservative with “free markets” tattooed on his unmentionables, he probably does not really believe in advocating a course of action that would expose the state to greatly increased public spending – right?  (Rational moral arguments against state-sponsored homicide aside, of course).  I mean if you are going to be a bark-at-the-moon pedagogue the very least you can do is pick your soap-box moments so that they are consistent with the rest of your politics, right?  Well, for my money if you don’t you do forfeit the right to be treated with any respect or even the veneer thereof, so to that end:

Mr. Paul Staines, you are hereby found guilty of being a second-rate attention-grabbing pseudo-journalist and a pedagogue.  Your actions and your output, such as they are, belie the truth that you are not interested in being a real part of any political process – you simply want the spotlight, no matter how far beyond the bounds of taste, ethics or sense you need to go.

Journalists report the news, columnists muse and editorialise about the news, but no one of any worth or stature has ever manufactured the news so that they can write about it or worse still, as in your case, write about it and prance about in the spotlight.

You are a fraud.

Please share this with anyone that you think might be prepared to spread the word – as far as I am concerned this individual’s “good run” in the blogosphere is in severe need of being curtailed, and I’m more than willing to bet that there are more people on this side of the issue (even from the right-wing politically) than people who can or will support this fraction of a man.

Also, for those who would like to balance the scales, here is a link to an ePetition that is diametrically opposed to the one Mr. Staines has created (it was put up specifically to counter his petition, though not by me).