Twitter Weekly Updates for 2009-11-15

  • Orange breakfast, toddler style #
  • Interviewing nearly done. One last group. Students seem better this year at least. #
  • Cv's reviewed. Whiskey drunk (not by me). Bed soon. #
  • In Wales, it is wet. #
  • My minions seem to not want their work monitors upgraded from 19" to 24". Strange employees. #
  • Stuck in traffic outside Newtown (powys). Grr. #
  • WordPress update time (2.8.6); svn update ftw. #
  • And another night of sweating like a pig in bed. Am I ill again or did @ChairmumMiaow leave the heating on? #
  • The toddler is now eating play dough. Tasty! #
  • First adventures with openid. Shame Zend_openid_consumer doesn't work with google. Wasted time *sigh* #zf #php #fail #
  • Hotel seem to be including free drinks and sweets. Now where are the people? #phpwm #
  • Php Training complete for this week. Now to get the train to @phpwm meeting in bham. Ajax server side push stuff. Greek to me #phpwm #comet #
  • And it's hard to hold a candle in the cold November rain. #
  • Via many… RT @mikebutcher: UK O2 iPhone people: unlock yours tomorrow o2++ #
  • RT @nixgeek Now hiring a Systems Admin at work (@GradwellTweets) — go see if interested and RT please! #
  • I've totally forgotten what I was going to say/tweet. Old age sucks. V 2009 looks good. #
  • Failed to resist buying ms Swiss chocolate. Again. Soon I will not fit through doorways. #

Initial foray into OpenId (Zend_OpenId_Consumer / PHP etc)

While updating some security training materials, I thought I’d include some more information on OpenId – with the hope of demonstrating how the typical username/password mess which web applications create can be countered (for example see here )

So, being a PHP type, and having seen that the Zend Framework supports OpenId, I thought I’d create a simple demo. The documentation looked good, and I quickly got a test script online (see below). So – to test it, I thought I’d try using Google as my OpenID provider (afterall StackOverflow does) and I obviously have a Google account.

So, the Zend Framework gives the following test code :

require_once(dirname(__FILE__) . '/Zend/OpenId/Consumer.php');
require_once(dirname(__FILE__) . '/Zend/OpenId/Extension/Sreg.php');
$sreg = new Zend_OpenId_Extension_Sreg(array(
 'fullname'=>false), null, 1.1);
//echo file_get_contents('');
$status = "";
$consumer = new Zend_OpenId_Consumer();
if (isset($_POST['openid_action']) && $_POST['openid_action'] == "login" && !empty($_POST['openid_identifier'])) {
 if (!$consumer->login($_POST['openid_identifier'], null, 'http://*', $sreg)) {
   //echo $consumer->getError();
   $status = "OpenID login failed.";
} else if (isset($_GET['openid_mode'])) {
 if ($_GET['openid_mode'] == "id_res") {
   if ($consumer->verify($_GET, $id, $sreg)) {
     $status = "VALID " . htmlspecialchars($id);
   } else {
     $status = "INVALID " . htmlspecialchars($id);
 } else if ($_GET['openid_mode'] == "cancel") {
   $status = "CANCELLED";

<?php echo "$status<br>" ?>
<form method="post">
<legend>OpenID Login</legend>
<input type="text" name="openid_identifier" value=""/>
<input type="submit" name="openid_action" value="login"/>

Which doesn’t work if you try to use [Google’s OpenID provider URL]. It just fails with a hopeless “Discovery Failed” error message. I spent an hour or two poking it, and making fruitless Google searches (or so it seemed). Then I gave up and tried using a different provider – success.. it all works.

Various postings imply there is/was a problem with the Zend Framework’s OpenId consumer – although to start with I thought it might have been due to my local PHP configuration (E.g. lacking support for openssl/mhash or something else, but this wasn’t the case). See also this and this

Thankfully the code does work when using other providers – e.g. MyOpenId. One nice feature of OpenId, which I wasn’t aware of, is that you (the web client application) can also request e.g. nickname, name, date of birth and country of residence from the OpenID provider (which is what the Zend_OpenId_Extension_Sreg stuff is all about – I’ve made the request parameters all optional, otherwise you get an auth failure when the provider doesn’t return the data you require).

Anyway, it’s really, really, easy to do. Shame about the poor support for Google though.

Twitter Weekly Updates for 2009-11-08

  • I now have a new pair of running shoes. New balance or something. Will have to take them out tomorrow. #
  • Clearly he wanted a drink. #
  • The toddler is trying to tell me something. I'm too stupid to understand him :-/ #
  • RT @guardiantech Penelope Trunk: Why I tweeted about my miscarriage #
  • Generally unimpressed with snow leopard. Laptop has had 2 kernel panics and stuff crashes more. Rock solid before (seemingly). #apple #osx #
  • Black opal licorice ftw #
  • Preparing to say goodbye to Milton Keynes and it's jungle of roundabouts. Hope the train doesn't get lost getting here…… #
  • Metro headline – [bnp] Griffin: I was racially abused. Stop feeding the racist troll media! #
  • Taxi driver: what's the big deal with windows 7 is it that you can run two programs at once? Me: errrr #
  • Someone failed to reinstall the delegates pcs. Stupid ou. #
  • I've arrived early – first time in memory? This must be a sign from the Great Spagetti Monster, who I can also thank for a safe journey. Thx #
  • All hail – King of the loosers! Sir blame it on your ISP. Ahh berushed. Food please. #
  • Finished diy radiator swap etc finally. Didn't spray over her bed and perhaps no leaks. Alternative career – very slow plumber! #

Yet another all in one update

A random weekly rambling.

Rowan’s started to draw, say more words and generally be far easier – we’ve been out to a couple of restaurants lately, and in each he’s been no hassle (as opposed to him wanting to roam around the room and generally sticking his hands in anything he can find). We’re also hoping he’s deciding to sleep more overnight as well – but two days does not make a pattern with a toddler, so who knows what’s going on there.

Last night we had some fireworks at Jenny’s – Rowan seemed to enjoy them quite a lot (“Oh wow!”) – I had feared he’d start crying when a bang went off, and that would be the end of the evening. Thankfully he behaved really well. I also managed to drink 5 bottles of beer (far more than normal, so I had a crap headache overnight/this morning).

Kat and Rowan have spent most of the last week going to various museums in London – and finding other toddler friendly spots. I was slightly worried that taking him to London would fail totally – but it seems to have worked quite well, and it’s nice for me to be able to see them during the week in the evenings (while I’m there training).So far they’ve found some child friendly park in Russel Square, and hands on water and wheelbarrows in the Science Museum.

Yesterday, I bought a new pair of running shoes. This time I was insistent that having a neutral pair of shoes was not good – and the assistant eventually realised I was correct and gave me some with appropriate support. Hopefully I’ll soon get a routine running around London and be able to halt my expanding chocolate biscuit fuelled waistline.

In other news – my employees appear to be handling work things quite well – as by Wednesday I’ll have been out of the office for 2-3 weeks. No doubt there will be a stack of stuff waiting for me, and customers wanting updates and I’ll be kept busy. One good thing is that this excess of training work has allowed me to be more selective over which work we do, and it seems BinaryKitten/Kathryn will remain a part time, remote employee (lucky her?!).

Now I just need to sort out our Pale Purple Christmas party thing – I’m tempted in doing some sort of clay pidgeon shooting type thing – perhaps in the start of January. Somehow I doubt we could find a live fire range where we can shoot targets/zombies, so clay pidgeons will have to be the next best bet.

Anyway, time to think about getting the bus to Birmingham and then the train to Euston. Oh, the joy.

Twitter Weekly Updates for 2009-11-01

  • I'll be running in the rain, just running In the rain. With a cold wet feeling, i hope it doesn't make me Ill again… #
  • Seen on tube advert:"I asked for fewer dicks. Now it takes fewer dicks. I've never been so influential. Windows 7" #windows #badeyesight #
  • Ticket booking fail. Virgin train packed. Imposing in first class. At least training went well. Hope mr toddler sleeps like a baby #
  • Soaked bed with sweat, slept on towel (now damp). Turned duvet over and soaked that too. I'm fed up now. #
  • Feel worse today. Stupid virus go to hell. #
  • Feels generally unwell. F. Off virus. #
  • Ah. Relief. My sinus just popped. Fscking cold thing. #
  • Delegates may take offense if I take fishermans friends. Lockets will have to do. #
  • Waiting for a train. I'm on a Night train. Bottoms up… #

PHP array and object addition and string indexing

While reading someone’s code, I came across the following sort of thing:

function foo($config = array()) {

$this->_config += $config;

To which I thought WTF? How does PHP cast an array to a number to perform addition?

A few random tests later, it appears PHP joins the two arrays together, only adding indexes that appear in the second (and not first) array.

(as per php manual – array operators)

Namely :

$array_1 = array(‘a’,’b’, 4=>’c’);
$array_2 = array(4=>’e’, ‘f’, ‘g’);

$array_1 += $array_2;


will give :
[0] => a
[1] => b
[4] => c
[5] => f
[6] => g

(Note; 4=>e is not in the resultant array, because 4=>c was in array_1).

After a round about conversation with Moobert on this on IRC – at which point he probably put me out of my misery, he also gave me the following :

$x = ‘test’;
echo $x[‘whatever’]; // outputs ‘t’

Which I can understand – as PHP allows for per-character access to a string (based on position) – hence ‘something’ gets casted to zero, and we get the first character back.

I know I can cast objects to arrays, and vice versa.

Seemingly Objects don’t follow any sort of ‘union’ rule however… as adding two objects results in ‘2’. Not sure how PHP converts an object into ‘1’… but there we are. I sort of expected to get an object back (assuming the inputs were the same type) with a union of properties, but no.

Twitter Weekly Updates for 2009-10-25

  • Was there enough Lego at #lrl2009 ? #
  • Bye bye #lrl2009 till next year perhaps ? #
  • Windows 7? Is that like ubuntu but non-free? #lrl2009 #
  • #lrl2009 where we play with Lego and the ninky nonk #
  • The wheels on the bus go round and round, round and round, round and round…. All day long. #
  • Fun times. Waiting for train at euston. #
  • Must not drop phone in bath… #
  • Must start using phpunit double/stubbing stuff. Shame the docs seem crap for it. Can has api? #phpunit #
  • WTF Is ironing water for m&s?? #
  • I am a chocolate biscuit pig #
  • Great. Runny nose, stupid throat and my body feels tired. Just what I do not want. Go away germs. #
  • Slug and lettuce dessert. Hopefully no slugs involved. Just dead apples and custard. #
  • Looking forward to ben&jerrys ice cream later … Shame mr toddler doesn't like it ….. *ahem* #

La Leche League Conference 2009

Breastfeeding extravaganza, well perhaps…. La Leche League conference 2009 in Alfreton

For Friday/Saturday, Kat and I went up north to the annual La Leche League conference. For those of you wondering – the La Leche League is all about breast feeding and any related child raising stuff. Suffice to say all the attendees were middle class, carrying their baby/toddler in a sling and touting Onya bags. I suspect a large proportion of the children there were also home schooled, judging from the few kids I overheard talking about it.

Kat went to various talks about attachment parenting, how milk is made and so on. One of the talks had something about a child being thrown out of the window to be caught by their father down below. An interesting idea, but I fear it might lead to social services visiting.Although I suspect I’m already going down this slippery slope as Rowan is starting to demand I throw him up in the air (“Jump! Up!”)

Rowan and I spent pretty much the entire time in the onsite soft-play room – he found plenty of balls to play with, and I wasted time on my iPhone eating chocolate biscuits. Unfortunately there wasn’t any wireless available :-/

I did go to one talk, helpfully titled ‘Dads’ which saw a few fellow soft-play inmates/fathers attend. It was a vaguely interesting talk, not surprisingly focussing on the role Dad’s have in breastfeeding. I think my attitude to breast feeding can be briefly summarised as :

  • Why would I be interested in bottle feeding? This would mean I’d have to do something in the night/day. I want Kat to do all of this. The stupid argument over the man feeling involved is rubbish – if I want to be involved with Rowan I could easily do something with him before/afterwards. Yes, I tend to get lumped with nappy changing when I’m around, but it’s not something that bothers me – it’s just something that needs doing.
  • Bottles are hassle – cleaning + sterlisation + worrying about whether you’ve given the baby enough/too much – no thanks.
  • Environmentally, breast milk is hard to beat. Formula is neither free or sterile.
  • From a health point of view, it’s good for my wife, and also for the baby. Apparently it makes the child more intelligent, less likely to be obese and so on. The longer they are breastfed the better all round.

The Dad’s talk also covered things like – “how to best support your breastfeeding wife” and so on. Someone raised the point of needing to be able to defend your wife/baby if challenged in public – personally I think this is a non-issue, as before I’d be able to open my mouth, Kat would be most of the way through her fifth or sixth argument as to why it’s none of their business or how it’s the natural thing to do for baby/toddler etc. Rowan has also probably been through a secret army special ops training course to bite any such people, given the correct key-word by Kat. Unfortunately for Kat, she’s been waiting 21 months for someone to challenge her over it, and it’s not happened yet. I hope they give me some warning they’re about to argue with her – so I can video it.

What was interesting was how some of the mothers there were still feeding 5-7 year old children. We’ve not really thought that far ahead yet – Rowan still isn’t two. He is now night weaned (and thankfully sleeping from around 8pm to 5am straight through), but still demands feeds in the morning and evening at the very least. If he’s somewhere strange then he’ll ask at random points throughout the day as well. But then, he won’t drink cows milk (not that I can blame him).

There wasn’t much, in the way of shops, in Alfreton – however it seemed to be doing far better than Bromsgrove as far as town centres go – and it had a big f*** off Tesco in the middle of it too – but still had two bakeries, a Curry’s and various other little shops.