fsck -y (or fsck yes…)

Tip for the day:

Edit /etc/default/rcS on Debian/Ubuntu servers, and set FSCKFIX=yes (default of no) so next time your server runs fsck at startup, and spends hours doing it to only moan when it finds an error, and tells you to waste more time by running fsck with ‘-y’ (to fix it).

Quite why fsck even asks me to say ‘yes’ to it’s “do you want to fix…?” questions is another matter. It really annoys me – it’s not like I have enough information to make any sort of informed choice – it’s not like I know the structure that’s present on the disk, in order to say “No! You’re wrong FSCK, inode xxxxx should be blahblahblah”. I can only say ‘yes’.

If only FSCKFIX=yes was the default setting….. I can’t imagine Windows or OSX ever asking someone to answer such questions.

All in a day’s work…. (magento and putty)

Here’s a random summary of some vaguely interesting techie things today.

Magento Migration

When exporting a Magento website from a third party (e.g 1&1), you’ll need to :

  1. Copy all files across; the ‘var’ directory can probably be omitted as it’s full of cache like stuff. ‘media’ and ‘var’ look like they need to be writeable by the web server.
  2. Edit the app/etc/local.xml file to specify the new database settings
  3. Check the various .htaccess files; the one in the root directory will probably need tweaking.
  4. Dump the database, and ensure that it has the following at the top of the dump file before restoring on the new host:
  • SET NAMES “utf8”
  • SET SQL_MODE=”NO_AUTO_VALUE_ON_ZERO”

Failure to do the ‘utf8’ one, will lead to £ symbols being slightly wrong.

Failure to do the second will ensure that all the foreign key references fail (so restoration will be hard to start with) and if you disable the foreign key checks (‘SET FOREIGN_KEY_CHECKS=0;’) you’ll find that Magento will b0rk on access – complaining about nulls and so on in parts of the configuration (the error message will likely mention app/code/core/Mage/Core/Model/Mysql4/Config.php ).

All of the above is ignoring the fact that the Magento instance I migrated was infested with some malware, and I’m not yet sure how it ‘got there’, though I shot an email over to my buddy at Bing (Bing Digital is a leading Magento agency run by my buddy of 15 years). However, when it does next get infected, which it is likely to, I will at least be able to see what’s changed thanks to git.

Putty on OSX

Well, it sort of exists; if you use ‘brew‘ – namely ‘brew install putty’ does something – but doesn’t (yet? can it?) build the GUI. However, all I needed was to convert a putty ssh keyfile (blahblah.putty.key) into an openssh variant, for which puttygen works perfectly :

  • puttygen blahblah.putty.key -O private-openssh -o test.key

Strangely there don’t seem to be any free apps on the app-store for SSH. I’m almost surprised no one hasn’t just compiled putty and put it on there for 50p or free.

The pain of bios updating (M3N78-VM / ASUS)

I’ve hopefully bought a new CPU to stick in the office server. All being well, it’ll be super quick and so on.

Looking at ASUS’s website, I made sure to choose a CPU the motherboard supports. I saw it required a BOS update, so fine… that shouldn’t be hard, right?

Think again.

  1. Downloaded BIOS file (possible from this link)
  2. Downloaded FreeDOS, burnt to CDR so I could boot into a DOS like environment.
  3. Copied BIOS file + AFUDOS update utility to USB stick.
  4. Rebooted, booted off CDR, chose to run LiveCD (No Drivers)
  5. Then tried to use AfuDos.
  6. Be good – take a backup first (afudos.exe /obiosbackup.rom
  7. Try and install a newer one (afudos.exe /iM3N78-~1.ROM) – fails with a message like “invalid bios id in rom”. Quite unhelpful.
  8. I tried various different .rom file names, but no combination of motherboard (M3N78) and bios version name seemed to work.
  9. Eventually, Googled a LOT more, and found that there is an ‘engineering’ version of the AfuDos tool, which allows you to force the update, and ignore any stupid check….
  10. For the sake of it, I tried to restore the backup I’d taken, using the original afudos.exe, but this didn’t work (WTF?)
  11. Downloaded ‘engineering’ afudos tool (try e.g. here)
  12. Ran with ‘afudos.exe /ibiosbackup.rom /n’ (the /n tells it to not do the stupid check) – worked… OK.
  13. Rebooted
  14. Entered back into DOS, and ran: ‘afudos.exe /iBiosIWantToUse.rom /n
  15. Crossed fingers, hoped I wasn’t going to brick the stupid motherboard…
  16. Success.
  17. Reboot. Carry on life.

The ‘onboard’ ez-flash utility ASUS provide seems totally useless.

Oh well, hopefully we’ll soon have 6 cores of goodness powering Jenkins.

Twitter Weekly Updates for 2011-03-13

  • 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/h0wlytjjhttp://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). #