- Can't be bothered to give up chocolate for lent. Pancakes on the other hand will not be missed. #lent #fb #
- Reminders:
* @PHPWM meeting tomorrow (free beer/pizza phpwm.org);
* It's Pie Week;
* Pancake today tomorrow.
Nom nom nom #Fatties #fb # - rah rah rah rah rah rah rah rah rah rah
I have to walk home today π #
- A new week, and my bike chain breaks again. Halfords were sold out of connector links and replacement chains. I feel it's a conspiracy #fb #
- β@StormySan: Every other sentence today is 'Oh my god that's disgusting'. She's just bleached her desk and keyboard.β #fb #
- Cw54 dmx – you tailed me on the m6 for 30miles; Learn to: dip headlights (not on full beam) & use left hand lane-it's not lorries only #fb #
- Hmm. I shouldn't have expected any better. On the ground next to the car is an untwisted coat hanger. Car seems ok #LiverpoolAirport #fb #
- Hello Liverpool. I'm back. Now to drive home. *yawn* happy flyings! #fb #flylo #
Twitter Weekly Updates for 2011-03-06
- β@gpjt: I always wondered what those buttons on my camera did: http://t.co/HV6rHhwβ #
- Landed: BCN. #
- Sarcasm seems lost on Liverpudlians. #
- Tweet tweet tweet #
- Tweet tweet tweet #fb #
- It's very relaxing listening to a baby sleeping on your chest. Slings rule. #
- β@chartoftheday: CHART OF THE DAY: Here's How The Xoom Stacks Up To The iPad 2 http://read.bi/eF9TGtβ <- interesting. Xoom > ipad2. #
- OMG – best cookie EVER from Catshill bakery. Meal in a cookie – Nom Nom Nom. #
- The king of hearts called for the tarts and beat the knave full sore. #
- http://stackoverflow.com/questions/1995113/strangest-language-feature – Javascript has some interesting features…. #
- Who will last longer: me cycling or Jenkins building a Php project? 1.5 hours and counting. No I understand large build servers.. #
- β@StormySan: Boss just used a whois lookup to find out a friend's address. I find this awesome. #geek
Twitter Weekly Updates for 2011-02-27
- β@GeneHunt: Had a plateful of Oysters and syrup of figs…didn't know whether I was coming or going.β #
- Thanks to the organisers for #phpuk2011 Free beer and knowledge are always appreciated. π #
- Shawn Hair eh ? #phpuk2011 you've won a prize … #
- Web scale reminder – http://www.youtube.com/watch?v=b2F-DItXtZs – #phpuk2011 #
- Yey. A web scale slide π go go mongo. #phpuk2011 #
- Php-jenkins.org looks like the way forward. sweet. #phpuk2011 #
- The "myspace are firing" t-shirts are great. #phpuk2011 #
- β@bookmeme: The Microsoft guy is struggling with the word 'interoperability' #html5 #phpuk2011β <- HAHA, nice. #
- wifi suffering – ssh connection almost unusable. boo hiss. #phpuk2011 #
- A better hands up question might have been : #phpuk2011 or #phpuk11 π #
- β@rowan_m: Woo! Made it to #stampex let's get licking. Wait… Hold on.β #phpuk2011 #
- All those weirdos going to stampex. Bloody geeks. #phpuk2011 #
- Right train. Right time. Onwards to #phpuk2011 #phpuk11 #
- It's not healthy getting up this early. #
- OH sales droid .."Tim Berners-Lee invented TCP"… #
- I'm switching to Oxfam for my water supply seeing as they can supply a family of four for Β£2, I reckon I'll save at least Β£1k a year… #
- Selenium RC setup; same IE6 doesn't seem to want to join in the fun. #
- Totaljobs just emailed asking if I'm "looking to train for a career in IT" … well, that sounds a good idea now… #fail #
- β@glynmoody: TSA Source: Armed Agent Slips Past DFW Body Scanner – http://bit.ly/dSm49C chocolate teapots, anyone? (v @laserfox) #security
Compsci Industrial placement year email
Now is obviously the time students are pulling their fingers out and thinking about industrial placement years.
Obviously I’d have a bias towards a certain university if I were looking for a student,Β but ignoring that, I received an email today from someone fishing for vacancies (this is ignoring the fact I’m not advertising for one, and I’m not sure we could accommodate one if we did).
“Dear PalePurple,
I am a second year student at Blah Blah University, studying Computer Science BSc. I would be delighted if you could consider my application to any web development or Linux systems development work placements you may have available.
Yours sincerely,
A. Student”
Anyway, here’s my response to them, which probably says enough on it’s own, without me having to selectively publish their CV.
“Hi,
For some random feedback: Your CV doesn’t really mention anything you may have done with your web development skills – aside from listing xhtml/css etc.
It’s also bare of anything you may have done with any sort of programming skill – what projects have you done inside/outside of university? You mention a group project, but gave me no idea what it involved.
Have you done anything outside of your course which shows some interest in the subject area (e.g. dabbled with Arduino devices, read about MVC/design patterns, been to an industry conference, joined a local user group, written some random program that does X in your spare time……… ).
If you are serious about web development, then you will need to mention sites you’ve created on your CV – these may just be sites of your own (i.e. they don’t have to be for real companies/entities) – all I would be interested in seeing is that you are interested in the field, have taken the time to learn about jQuery / CSS3 / HTML5 / whatever – which would put you towards the top of any potential interview shortlist and make you FAR, FAR more interesting as a potential employee!
Aside from the above, we’re not currently looking for an industrial placement student.
thanks,
David.”
I have been thinking about getting an industrial placement student this year, but I’m not sure we have room in our office for a student.
Twitter Weekly Updates for 2011-02-20
- Bromsgrove hockey 3xi vs Old Wulfs. Lost 11-2. #
- I'll never grow up…. (thanks @carolinegoodwin) http://twitpic.com/41dg39 #
- I'm sure that drinking one more beer will beat this cold into submission … #science #alcohol #germs #
- Ping me on @pingchat at ID: david-goodwin – Send text, photos, videos, and other media to my phone for free! http://pingchat.com #
- β@madeupstats: 40% of foreigners are racists*.
*Source: BNPβ #
- Yep, as predicted, Ann Summers are making the most of 'The Year of the Rabbit'. #
- …. Answer: soft play place. #
- Three guesses for what a "children's experience centre" is….. #
- 0b100000 aka 0x20 aka 2^5 aka 32. #
- β@madeupstats: David Cameron isn't out of touch: A third of his closest friends are unemployed (Heirs and landowners, mostly)β #
- Customer offered to pay me in beer. I declined, but he's still sending a case through. Result! #
- Walking. It's so slow. #iMissMyBike #
- The chain just snapped on my bike π It's only ~1 month old. Decathlon–
Luckily I was just arriving at my destination. *sigh*. # - β@birminghampost: Worcester hospital pays compensation to parents of stillborn baby http://bit.ly/fuFEVJ " #
- A mouse took a walk in a deep dark wood. A fox saw the mouse, and the mouse looked good….. "come and have tea in my underground house"… #
Automated snapshot backup of an Amazon EBS volume
I found the following Python script online, but it didn’t really work too well :
http://aws-musings.com/manage-ebs-snapshots-with-a-python-script/
EBS – Elastic Block Storage …
I had to easy_install boto, to get it to work.
I’m not sure the Debian python-boto package in Lenny is up to date.
Anyway, $server now has :
from boto.ec2.connection import EC2Connection from boto.ec2.regioninfo import RegionInfo from datetime import datetime import sys # Substitute your access key and secret key here aws_access_key = 'MY_AWS_ACCESS_KEY' aws_secret_key = 'MY_AWS_SECRET_KEY' # Change to your region/endpoint... region = RegionInfo(endpoint='eu-west-1.ec2.amazonaws.com', name='eu-west-1') if len(sys.argv) < 3: print "Usage: python manage_snapshots.py volume_id number_of_snapshots_to_keep description" print "volume id and number of snapshots to keep are required. description is optional" sys.exit(1) vol_id = sys.argv[1] keep = int(sys.argv[2]) conn = EC2Connection(aws_access_key, aws_secret_key, region=region) volumes = conn.get_all_volumes([vol_id]) print "%s" % repr(volumes) volume = volumes[0] description = 'Created by manage_snapshots.py at ' + datetime.today().isoformat(' ') if len(sys.argv) > 3: description = sys.argv[3] if volume.create_snapshot(description): print 'Snapshot created with description: ' + description snapshots = volume.snapshots() snapshot = snapshots[0] def date_compare(snap1, snap2): if snap1.start_time < snap2.start_time: return -1 elif snap1.start_time == snap2.start_time: return 0 return 1 snapshots.sort(date_compare) delta = len(snapshots) - keep for i in range(delta): print 'Deleting snapshot ' + snapshots[i].description snapshots[i].delete()
And then plonk something like the following in /etc/cron.daily/backup_ebs :
for volume in vol-xxxx vol-yyyyy vol-zzzz do /path/to/above/python/script.py $volume 7 "Backup of $volume on $(date +%F-%H:%m)" done
Which keeps 7 backups for each volume with a time/date stamp in each description.
Twitter Weekly Updates for 2011-02-13
- Cat poo on the windscreen. :-/ #
- I leave Rowan with his mum and look what happens ! http://twitpic.com/3z4gdn #
- β@ChairmumMiaow: Bribed toddler to leave me alone to paint my nails by doing his π http://yfrog.com/h0wlytjj β http://twitpic.com/3z17ek #
- Bromsgrove 3 xi hockey vs bridgenorth … We lost 10-0 π #
- It's the weekly "where is everyone? We're 2 men down" pre-hockey match discussion … #
- I think http://creativespring.co.uk need some help with the SEO service they claim to offer. #fail #imageAsHomePage #
- β@moobert: ♥ yo ho ho by Captain Dan & The Scurvy Crew #lastfm http://bit.ly/86WlBβ #
- Why is a customer asking me to delete their emails for them? Shift+arrow key too much work? #whatAmIMissing #
- β@w00teh: on #Nokia #039;s choices: http://i.imgur.com/dMX1f.png #epocalypse #feb11β #
- β@madeupstats: Costing only Β£85 per year, Ugg Boots are statistically the most reliable and best value female contraceptive.β LOL #
- "The train clock in bed" … What does
My son dream about ? # - Wondering how common it is for people to mis-spell their surname when sending an invite to linkedin….. #
- β@chedderz: The best and most appropriate name for a car ever – spotted in my work car park – genius http://yfrog.com/h71pzudjβ #
- β@GeneHunt: I find myself looking down on women who insist on showing their cleavage.β #
- .@aypok's latest purchase: Sega master system scope 3d set …. #sega #geek #retro http://twitpic.com/3xq049 #
- Crap start to the day: Internet banking login card has magically stopped working. #lloydstsb I hate you. #
- What does it say about mr if I dream of eating whiskers cat food? The taste seemed quite vivid when I woke. Yuck. #
- Now I'm wondering where the nut, which was on the floor, I saw the other day has gone…. #bike #
- Guess I'd better get cycling…. Perhaps an albums worth. Ocean machine is worth it π #
- A bread free day! Whatever next? Let's just gloss over the chocolate work biscuits ('customer') & the costa hot choc & half gingerbread man #
- Jobcentre a'review': "Had a useless trainee and a woman with the typing speed of a toddler giving me bad advice!" (no, I'm not signing on). #
Twitter Weekly Updates for 2011-02-06
- Upgraded my iphone4 to iOS 4.2.1 and re-jailbroken; exceedingly quick and easy process – thanks to greenpois0n etc. #
- oooh, looks like Squeeze is very close… good luck #debian #
- β@GeneHunt: My girlfriend says I'm ignorant. ….. I've absolutely no idea what she's talking about.β #
- What sort of idiot walks around in the dark & head-butts a corner. Oh wait … #PleaseDoNotBruise http://twitpic.com/3wjig4 #
- Nearly midnight is perhaps the wrong time to think about upgrading and re-jailbreaking my iphone. Until tomorrow…. #
- http://www.youtube.com/watch?v=oJagxe-Gvpw 'World's worst hacker'…. #
- Hopefully I'll manage to do the Aberystwyth -> Kington bike ride this year at least, and maybe next year London -> Paris or something abroad #
- 10th anniversary Dyfi Enduro registration opens on 10/02/2011. Almost regretting being mtb-less now http://t.co/vA4QJpQ #
- Interesting experimentation with 4square's API this evening #PHP #4sq #
- Wish 'normal' people would stop using the disabled / baby change toilet. Lazy … Grr. Grr. #
- Year of the Rabbit. I bet Ann Summers will make full use of this for marketing …. #
- Yes apple, I'm obviously going to read those 50+ pages of t&c's you've asked me to agree to on my phone. #
- Call to back UK's hi-tech talent – http://www.bbc.co.uk/news/technology-12326688 (software / games ) #
- β@scottsigler: Time for Rocket Fuel. Recipe: equal parts strong coffee, sugar and Red Bull…" @stormysan @aypok u r wimps in comparison #
- Happy mailman day. #
- Note to self: when leaving windows open to air place of residence avoid leaving the fan heater turned on. #fail #
- I wonder what significance there is to the tiles on my bathroom floor becoming loose. #
- Looks like I have a sea faring new employee … http://twitpic.com/3v4var #
The Post Office
Earlier today, I went to the Post Office in Bromsgrove, to buy some Euros.
The conversation I had with the minion behind the counter is paraphrased as follows :
- Me: Hi, I’d like to buy $x euros, please?
- Her: How do you wish to pay?
- Me: By card? <<waves debit card at her>>
- Her: We’ll need proof of ID (Passport etc)
- Me: <<sighs>> Why?
- Her: It’s an anti-fraud thing, you don’t think like a criminal do you?
- Me: Errr? <<WTF?>>
- Her: If you’ve stolen a card, the first thing you do is try and withdraw money using it … blah blah blah fraud blah blah blah ….
- Me: But, it needs a PIN number to be used…?
- Her: It’s ok, <<gestures at the card reader infront of me>> – that acts like a cash point. You can withdraw the right amount of cash to pay for your euros using it…
- Me: <<WTF?>>
- Her: Now, just put your card in the reader and type in your PIN when requested….
- Me: <<types in pin>>
- Her: <<hands over euros>>
I know I’m often a bit dim, but I’m failing to understand the ‘process’. Wasn’t I meant to have proof of ID to buy euros using my debit card?
How is me “withdrawing” cash for her, any different to me paying by card – especially when the process from my point of view is IDENTICAL.
PHP Serialization & igbinary
Recently I’ve been trying to cache more and more stuff – mostly to speed things up. All was well, while I was storing relatively small numbers of data – because (as you’ll see below) my approach was a little flawed.
Random background – I use Zend_Cache, in a sort of wrapped up local ‘Cache’ object, because I’m lazy. This uses Zend_Cache_Backend_File for storage of data, and makes sure e.g. different sites (dev/demo/live) have their own unique storage location – and also that nothing goes wrong if e.g. a maintenance script is run by a different user account.
My naive approach was to do e.g.
$cached_data = $cache->load('lots_of_stuff'); if(!empty($cached_data)) { if(isset($cached_data[$key])) { return $value; } } else { // calculate $value $cached_data[$key] = $value; $cache->save($cached_data, $cache_key); } return $value;
The big problem with this is that the $cached_data array tends to grow quite large; and PHP spends too long unserializing/serializing. The easy solution for that is to use more than one cache key. Problem mostly solved.
However, if the site is performing a few thousand calculations, speed of [de]serialisation is still gong to be an issue – even if the data involved is in small packets. I’d already profiled the code with xdebug/kcachegrind and could see PHP was spending a significant amount of time performing serialisation – and then remembered a presentation I’d seen (http://ilia.ws/files/zendcon_2010_hidden_features.pdf – see slides 14/15/16 I think)Β at PHPBarcelona covering Igbinary (https://github.com/phadej/igbinary)
Once you install the extension –
phpize ./configure make cp igbinary.so /usr/lib/somewhere #add .ini file to /etc/php5/conf.d/
You’ll have access to igbinary_serialize() and igbinary_unserialize() (I think ‘make install’ failed for me, hence the manual cp etc).
I did a random performance test based on this and it seems to be somewhat quicker than other options (json_encode/serialize) – this was using PHP 5.3.5 on a 64bit platform. Each approach used the same data structure (a somewhat nested array); the important things to realise are that igbinary is quickest and uses less disk space.
JSON (json_encode/json_decode):
- JSON encoded in 2.18 seconds
- JSON decoded in 9.83 seconds
- serialized “String” size : 13993
Native PHP :
- PHP serialized in 2.91 seconds
- PHP unserialized in 6.43 seconds
- serialized “String” size : 20769
Igbinary :
- WIN igbinary serialized in 1.60 seconds
- WIN igbinrary unserialized in 4.77 seconds
- WIN serialized “String” Size : 4467
The performance testing bit is related to this Stackoverflow comment I made on what seemed a related post