Source code repositories are fantastic, powerful but simple things. They keep stuff in one place, and track revisions of the things in it so you can see ‘back in time’ at any point. Some systems are good, some are not so good – but the annoying thing I’ve discovered about most of them today is that they tend to work perfectly when I actually need them to fail.

My problem is a fairly dopey one – I want to be able to check if a file in a local working copy of a repository is different to the remote repository. Simple enough, because almost every system has a tool to do this, usually termed the diff command. If you ask your tool to diff against the repository, it’ll say yay or nay, and if it’s different it’ll probably tell you what’s changed too. Thing is, regardless of whether or not it’s different – the command always succeeds. In shell terms, it exits with status 0 – success. That’s all well and good, but when you want to test for the difference against the repository; you’re buggered for a boolean result.

This morning, I knocked this up to solve the problem in bash.

 

#!/bin/bash# accepts a single argument <filename> and checks if it’s different to the version in the repository.
# reports status 0 if it’s the same, and status 1 if it’s got differences.
usage=”Usage: ./checkrepo [-v] <filename>”

declare numberargs=$#
if [ $numberargs -gt 2 ] ; then echo ${usage};exit 2 ;fi
if [ $numberargs = 1 ] ; then localfile=$1;fi
if [ $numberargs = 2 ] ; then localfile=$2;fi
if [ "$1" = "-v" ] ; then
output=”/dev/stdout”
else
output=”/dev/null”
fi

filedir=`dirname ${localfile}`
filename=`basename ${localfile}`

repotype=`ls -a $filedir |grep -e CVS -e .svn`

case “$repotype” in
“CVS”)
repocmd=”cvs diff”
;;
“.svn”)
repocmd=”svn diff”
;;
*)
echo “Not in a working copy!”
exit 3
esac

# run diff
cd ${filedir}
${repocmd} ${filename} > results

# do something with the result and put it to stdout if verbosity is turned on
if [ -s results ] ; then
changes=”true”
else
changes=”false”
fi

# put the results out there
cat results > $output
rm results
cd – > $output 2>&1

# exit with status 0 if there’s no change
if [ "$changes" = "false" ] ; then exit 0; fi

# exit with status 1 if there is change
if [ "$changes" = "true" ] ; then exit 1; fi

It’s not hugely elegant, but it is quick. Anyone care to play golf with me to improve it?

When someone gets allocated to a project here at Cap One, it's never really set in stone how long you might be 'on' it due to the nature of the amount of waterfall-based packages of work in progress. The idea of Agile is, the core team is exactly that – a core team of uninterruptable individuals working together using high bandwidth communications to just get stuff done. There was all kinds of signoff and understanding that no-one would be pulled from an Agile project, everyone up on high agreed that it would neeeever happen.

Well, it just did. There's 3 people in my team with Middleware skills – me and 2 others. I've been regarded as something of an SME the past year or so now since my immediate manager left, but have stepped aside to allow others work on MW stuff to keep the team well cross skilled. One of those 2 others has just resigned, and the other is going on holiday for 2.5 weeks this Friday.

So, it looks like I'm on this Middleware project now for at least 2 weeks. I have 2 days to get up to speed on this thing, and work out how to fix it and hopefully make some things better too.

In other news, house move went as well as can be expected. Things still need a lot of shifting, but we'll get there. 

lavalampYesterday, I recieved my first 'Lava Lamp'. There's (apparently) long been a tradition in Cap One's IT department of giving a Lava Lamp to anyone who makes a particularly memorable schoolboy error. Mine was a pretty special one – launching the new Capital One Mortgages&Insurance website (planned and delivered in a ridiculously short space of time, helped in no small part by myself), I'd written a really noddy script to ssh to a series of boxes and create some new directories, touch some files and populate them with specific variables. I copied the same script I'd used for the SIT implementation, and put a nice big comment at the top saying 'PRODUCTION VERSION' for clearness.

Now, the first time we ran that script – we ran it on a rather special little Solaris box we keep sat in a DMZ with a bunch of routing rules to get at web server boxes. My script killed it in under a minute – and all it was doing was ssh'ing to 2 other boxes? It had run fine in SIT, no problem. One lengthy wander down to the server room and a reboot later – another attempt. We'd thought it must have been someone else killing the box, but no – same result. Third time, we looked to see what the script was doing – remarkably, my script spiralling out of control, forking processes left right and centre. Another reboot – and before running the script again, a quick check to see what it was doing. The first lines read:

 #!/usr/bin/ksh

***********************
*    PRODUCTION VERSION   *
***********************

Anyone who knows Unix should spot my utterly ridiculous error – asterisks! I'm not sure why I used them, but it quickly became apparent why this script was doing what it was doing: executing everything in the current directory, 48 times over… Oooops. Removing these lines made the script run fine – but earned me a Lava Lamp. :)

Yes, I've been assigned to this new Letter Ops project for 2 days now. I've not actually met anyone from the project team, I have no idea what's expected of me, and the last thing I've been told is that we've told the project management that we're not providing any Linux boxes because 'it's a platform issue, not an ECM one'. Goody goody. I'm already the bad guy! On the plus side, I am going to be colocated over in Trent – which means another beefy desktop to play about with. I think I'll stick the latest build of Ubuntu:Dapper Drake on it, assuming the project is going to have the Linux-y slant I expect it to.

I've been beating my head against Solaris networking and Resonate the last 2 days, in an attempt to get the SIT/UAT environment ready for a deployment of Capital One's new Mortgages/Insurance website. It's utter madness, the legalities around having to have a separate domain for selling different projects. The thing that really gets to me is the fact that no-one even thought to worry about how the redirection would work in dev/test, meaning that every environment we have with the code in points at the as-of-now-defunct capitalonemortgages.co.uk. This is such a simple thing to parameterise (thanks to our wonderful build/deploy tools, 'envmgr'), and the dev team seem adamant that it's too complicated to worry about for now. Muppets, frankly – it's as simple as simple can be, and I'd do it myself if it weren't for the new audit compliance junk that's recently hit us with regard to group write access within ClearCase.

Anyway – I've been struggling through some mad old documentation for our website/ecommerce setup, and have only just discovered that resonate requires a loopback logical address set up for the Virtual IP that it's hosting. I've scripted up the config and told my team – it's the kind of thing that shouldn't change, but will. So, I discovered that the DNS entries pointing to our shiny new resonate-clustered IPs hadn't had appropriate firewall mods raised. This meant that no internal desktop could even resolve the IP the new DNS entries pointed at. Thrilling stuff. I had a fumble about, and ended up hacking a different environment's main DNS/IP pair to host the new site code. No-one seems particularly bothered, which is a good thing for me. If this all goes smoothly on Thursday, it'll be one to remember for end-of-year performance ratings!

Angry with old letting agents for charging me for providing a reference to new letting agents. £22.50 'admin' fees are ridiculous, and should be banned. Time for a cup of decent tea.

Looks like I am going to be stuck on this new Letter Ops project, as a full time resource. Co-located in the 'other' building, Trent House. The one that everyone was rumouring would be turned into cinema if we all get outsourced. Which y'know, we're obviously not going to be. Because the rumour about 'Project Blue' (IBM! We all shouted.) got out, and then the powerpoint decks pretty much confirming it got out, and then a big ol' meeting was held where the senior management vehemently denied it all, with copies of the presentation slides without the 'preferred solution' watermarks on.

Anyway, Letter Ops. Good idea for a project, really – our snailmail spamfactory is ridiculously inefficient, and considering how much of it we generate, that's not a good thing. Now, everyone has had some vapid nonsense come through their letterbox from my employers, and there's actually a very complicated cross-selling and targeting or 'customer base segmentation' system underneath all that tat. Cap One pride themselves on the sheer amount of customer data they have, and hooboy, there's a lot of it. Reported on daily, sequenced and indexed and prepped for spamfactory loading. Hee hee hee, spam. It's not really that funny, is it. I can't stand the stuff, but for some companies, it just works. New system will replace current UNIX batch processing of mahoosive files with sensible Oracle based letter/mail merge. Probably going to require some heavy iron to live on, which is where I'll get interested. At least, the test/dev versions anyway. More as/if/when it happens.

Cheerfully, my girlfriend and I have found somewhere to live. After a series of variable disappointments of accomodation, we stumbled into a property across the road from another one we hadn't really been too keen on before. It was less shoddy, had 3 bedrooms and a huge kitchen. It's pretty much ours now, which is a great big relief.

LiveJournal has mysteriously become un-blocked by work's web filtering, so I can post/read there too now. I think I'll keep this going. Apologies for the colour scheme, incidentally – I canne change it, captain.

Monday morning, grey skies and rain. England can be an intensely depressing place to be when faced with the weather alone, and days like today certainly don't help matters any.

How come when places say they're open at 9am these days, they aren't? I'm looking for somewhere to live, dammit – and if you say you're open at 9am you'd best be opening at 9am if you're a lettings agent and you're on my list of establishments. Grrrrrr.

Due to a bit of unclever vendor management on one of the bigger projects I'm working on at the moment, it looks like I've got around 5-6 weeks of free time to point at another project called 'Letter Ops'. We've got a piss-poor but industry standard letter/enclosure production system here, and it's got Capital One UK's clunky as fuck™ customisations all over it. I've only ever really got involved with it a little last year to cover someone else, but now we're replacing the lot. Cool thing about it is, rather than using the usual project methodology we use on work here, this project is going 'Agile'. This appears to have brought some success with a few other little projects that have gone in recently, but tends to get people's backs up with it's slight disregard for CM processes. I for one can't wait to get involved, as it appears to actually get stuff done! Par example – Phase 2 of a large MIS remediation project will actually go live after Phase 3 because the latter has been developed and delivered as an Agile project. Woot.

Since LJ is still classified under 'Personals and Dating', I need to come up with a solution for reading an RSS of my own friendslist somewhere. I'm sure it's possible, I may have to look at scripting up a scraper of my own.

In other news, I ate too much BBQ meat this weekend when visiting my family with my Girlfriend. We bought some very cute books for my 18month old niece, which were well recieved. I am currently using my Dad's spare SE T290i as my old-ass T610 is on the proverbial blink.

Grey day continues to be all grey. Rain continues to rain. Tea from vending machine appears to be too brown to be tea. Same old story. :)

Having wanted to set up a wordpress blog for a while, I figured it might be easiest to just head to the people themselves and set up one of their hosted ones. It's very functional, and I've got less need to customise than I used to have. I could always just export the lot if I move to another host sometime I suppose!

I'm not entirely sure what I'm going to use this for, but it's nice to have a separate blog from my LiveJournal which I've been less great at updating recently. We'll see as I go, I guess.