Jul 2 2009

The beauty of PHP is that people can modify it to work however they want due to it’s open sourced nature…

If something annoys you about the programming language itself, you can just go ahead and change it. The upside to that is that you get the features you think are missing in PHP. The downside is that your code can potentially become incompatible with everyone else, and your code becomes quite unportable.

Nonetheless, Ilia Alshanetsky (author of php|architect’s Guide to PHP Security) has posted on his blog a patch of PHP 5.3 that provides proper, traditional, type hinting, currently unsupported for scalar types.

As he explains, type hinting is a controversial topic; what with the fluidity of PHP and it’s loosely-typed nature. However I think type hinting, especially strict type hinting would be more advantageous than disadvantageous. He explains how his patch adds a certain amount of flexibilty for numbers within strings (using the “numeric” pseudo-type) allowing a string to be passed off as a number (perfectly legal in PHP… e.g. “1″ + “1″ = 2), or alternatively using the stricter “int” type to specify a number and must be of integer type i.e. “1″ is not valid, but 1 is.

Unfortunately I don’t like delving into compiling stuff, so I’ll just have to hope it gets included in the main trunk of PHP… until then I can pretend I have type hinting, perhaps by adding comments such as this messy mess… *ahem*:

function foo(/* int */ $bar)

Jun 30 2009

I’m an advocate of tidy, well commented code, and something that has bugged me for a little while was the messiness of the ternary operator (?:) in PHP. With the introduction of PHP 5.3.0, we can now miss out the duplication messiness of using the ternary operator for existance checks for example. Instead of:

$value = $a_value ? $a_value : $b_value;

We can now simply do:

$value = $a_value ?: $b_value;

It goes without saying that one should still not nest ternary operators as they become messy and extremely difficult to understand, even with good commenting. Consider an if/elseif/else or switch instead.

There are a few other things in PHP 5.3.0 that I’m looking forward to as well, one of which is the bundling of ext/phar which is really rather cool.

There are other dubious things, which are covered (and argued) in great detail elsewhere such as the goto operator and the introduction of namespaces

Jun 28 2009

  • Aww don't like it when @babyfreyja is sick :/ poor ickle girl #
  • Thankyou @babyfreyja for lovely father's day prezzies :) #
  • Testy testy mctest tweet… #
  • Using Selective Twitter now so my Facebook doesn't get spammed with Tweets #fb #
  • Hope Summer Solstice at Stonehenge was fun for everyone, sorry we couldn't be there but Freyja's a bit young still! #fb #
  • I uploaded a YouTube video — Funny noises from Freyja http://bit.ly/tuYvy #
  • It's official, Windows Media Centre sucks. HD content can't be played.. m2ts, mts and mp4 can't be played. #
  • I uploaded a YouTube video — Freyja laughing again http://bit.ly/x4r4h #
  • Hehe, tickled @Hanzor until she didn't pull a face for Nana's picture-taking, that'll learn her. #fb #
  • Fixed toilet from leaking. Very proud of myself for attempting DIY. #
  • Bleh, hope Freyja goes back to sleep. #
  • RT @JofArnold: @Asgrim – Proving beyond a shadow of a doubt that all the best people have birthdays in June. #
  • RT @robertbasic: this is one *sick* digital painting! http://bit.ly/LQTAH in reply to robertbasic #
  • Everyone is having nice things except us :/ why can't we win the lottery… it would make life so much easier. #
  • Open question – what do you use for project management and/or bug/issue tracking? #
  • Budgeting, gnuff. #fb #
  • RT @benjiegillam: Did you know God kills a kitten every time you use automated DM responses filled with social media bullshitery? #
  • Gnarf, Waking the Dead was good, if a little unnerving… Can I stay awake to do some coding? #
  • Wow, actually got a little bit of coding done… now to join @Hanzor in bed *yawn* :) #fb #
  • Looking smart and sharp for meeting today, shiny new shirt and tie, oooh! #fb #
  • Off to Watford for fun meetings. #
  • On way back to office. #
  • yay! M27 traffic… #
  • Off to bed. Diary of the Dead is rubbish. #fb #
  • RT @boagworld: Just published a new post extolling the virtues of hand drawn wireframes – http://bit.ly/P5zta. RT if you like it :) #
  • Oh man, Vader covering Raining Blood = awesome at full volume… SLAAAYEEEERRRRRR. Must do it more often. #
  • Ooh, surprise visit from Phil! #fb #
  • The day goes on folks, his music career died long ago anyway… #fb #
  • http://twitpic.com/8g54m hmmm… not. So cute mummy…. #
  • http://twitpic.com/8g54m hmmm… not. So cute mummy…. #fb #
  • RT @Hanzor — @jaspertandy: @Asgrim I'm not normally a big fan of babies, but you have a very cute baby! — hells yeah :D She's gorgeous! #
  • Off to renew tenancy agreement… #fb #
  • Starting a daily intake of Bifidus Actiregularis…yum. #fb #
  • RT @jaspertandy @benjiegillam: WTF?! in reply to benjiegillam #
  • Why, little cute @babyfreyja,must you insist on waking up at 3:30am some days? #
  • RT @ChrisJDean: @Asgrim lol: http://bit.ly/u8uwa #
  • iz in ur computamatron, codin' ur PHP #fb #
  • Sat in the sun with beer and HTC Magic at sister & bro-in-law's with @babyfreyja, @hanzor, Finley and Amelie. Good times :) #fb #
  • On our way home, Freyja now mega hungry and mummy and daddy very tired! #fb #
  • Finally @babyfreyja is asleep. Gonna try and stay awake for 1001 Maniacs or something. #
  • Not sure what the fireworks I can hear are for… hope they don't wake @babyfreyja… #

Jun 21 2009

  • Testing twit2go. Character counter doesn't update as you type… #
  • trying out twitterride.. seems nice, very android look. might use instead of twidroid… #
  • Liking that Freyja is starting to giggle when she's tickled (if she's in the right mood heh) #
  • RT @ChrisJDean @Asgrim Love if it's true!: http://is.gd/11T9h – that is insane!!! #
  • All sweaty from the hotness in the office. Wish people would shut the windows so we can put A/C on. #
  • Parcelforce's web developers are idiots: http://bit.ly/13diTN #
  • So Opera's reinvention of the web is Opera Unite… So Opera is now a Browser/UPnP Server/File Share/Web Server/IM system… interesting… #
  • Wish @Hanzor wasn't so stressed :/ #
  • I uploaded a YouTube video — Freyja is Queen http://bit.ly/4iilMM #
  • RT @siicockerill — @JofArnold: I'm selling our Mar09 unibody MBP. 2GHz, 4gb ram, 320GB (unused) hd. #
  • Happy birthday @linode :) #
  • RT @PaulGrahamRaven: is amused by the Fapple contingent jonesing loudly for their software updates. #
  • Teeheeheehee – mouth numb injections are teh funnies, can't say sausages very well. #
  • Well done iPhone users, your phones now finally have all the features every other mobile phone has had for ages… #
  • ARGH Head imploding, most likely due to anaesthetic wearing off, eep! #
  • Think I ate @boagworld's portion of lunch… feel like a little piggy now. Too much Gü. #
  • Freyja just drinking her evening milkies, me considering doing some of Jess's website, but have been told to do dinner instead :/ #
  • Addendum to last tweet: I was not told, I was asked kindly by my gorgeous wife-to-be who has unending amounts of love for me. #
  • Argh I have a trapped.co.uk nerve in my rib :/ #
  • RT @siicockerill: Passed a Google Street View car in Whiteley! #
  • I have just developed a croûton addiction… #
  • Sitting in Titchfield Mill with whingy baby :/ #
  • Baby asleep on my shoulder in Titchfield Mill, lovely :) –http://twitpic.com/7tq97 #
  • Sorry Twitdroid, think I prefer TwitterRide… more stable, faster and twitpic upload actually works… #
  • Can't believe this film doesn't have surround sound subtitles………. #
  • Listening to Amon Amarth while @babyfreyja has a little sleep and @Hanzor is out shopping with Nana, woo! #
  • Oh dear, @babyfreyja awake already… #
  • Sleepy sleepy, gonna shut down now and join @babyfreyja in the sleeping activity. #

Jun 16 2009

This sort of thing really angers me and displays the fact that the web developers of the Parcelforce website will happily display total ineptitude at developing websites. To block off an entire operating system for no reason whatsoever, is simply astounding, and I can’t believe companies still employ such idiots.

Why should I not be allowed to send a parcel, just because I use Linux? There is no reason for it – especially as they support Mozilla Firefox! There is no difference between Windows Firefox and Linux Firefox, and no reason to stop me using Linux to send a parcel. Thankfully plug-ins like the User Agent Switcher exist, to circumvent such inept and naive programming.

Parcelforce

Update: User Agent Switcher didn’t work. I used Firebug to enable the submit button though, which let me through happily…