Sunday, October 15, 2006

Why using code samples from the internet is a bad idea

If you're anything like me, you don't know how to make a computer do almost anything, but you do know where to look for code samples that show you how.
Also, if you're anything like me, you don't often have a lot of time to play the code samples, see how they work, read the API documentation (if there is any!), or often even the article text that accompanies the code. Usually it's: google, download code, unzip, compile, run. Then a quick once over to see if it does what I want.
However, sample code should never make it into production. Why? Because it's SAMPLE CODE.
The aims of sample code are to illustrate how a technology/technique works.
What it doesn't aim to do is be ideal code that you can copy and paste straight into your application.
Here's a sample from devx.com:

string connectionString = "Data Source=MEDIACENTER;" +

"Initial Catalog=AdventureWorks;Integrated Security=SSPI;" +

"MultipleActiveResultSets=True";
string strSQLGetOrder = "Select * from Sales.SalesOrderDetail" +
"WHERE SalesOrderID = 43659";


string strSQLUpdateInv = "UPDATE
Production.ProductInventory " +
"SET Quantity=Quantity-@amt WHERE (ProductID=@pid)";

SqlConnection marsConnection = new SqlConnection(connectionString);

marsConnection.Open();

SqlCommand readCommand =
new SqlCommand(strSQLGetOrder, marsConnection);
SqlCommand writeCommand =
new SqlCommand(strSQLUpdateInv, marsConnection);

writeCommand.Parameters.Add
("@amt", SqlDbType.Int);
writeCommand.Parameters.Add
("@pid", SqlDbType.Int);
using (SqlDataReader rdr = readCommand.ExecuteReader())
{
while (rdr.Read())
{
writeCommand.Parameters
["@amt"].Value = rdr["OrderQty"];

writeCommand.Parameters["@pid"].Value = rdr["ProductID"];
writeCommand.ExecuteNonQuery();
}
}
marsConnection.Close ();
If I saw code like this in someone's production code, I'd see red. This is, frankly, shit.
What does is illustrate how you can use Multiple Active Recordsets in ADO.NET 2.0.
What's wrong with it?
  • Embedded SQL.
  • It doesn't clean up the open connection reliably.
  • Embedded column and parameter names.
  • Hard coded connection string.
  • No mention of Transactions.
  • Result would be better achieved in a simple SQL statement.
I could go on. I suppose the main problem with this sample is that it isn't integrated with the rest of your code. Because it is provided as a stand alone sample, it doesn't use any underlying framework that you're using. For example, if I was using the Data Access Application Block to underpin my data access, this code snippet is useless. Also, if I'm using an "n-tier", or layered, design, this code is pretty pointless.
So, we should use code samples to see how to use a specific technology or technique, but then go away and write our own code that fits in with your application.

Saturday, October 14, 2006

Work

Friday was my first day actually coding for my current employer.
However, I'm getting some bad feelings about the code base.
First, rather than use a closed source, but otherwise free, component, the developer I'm working with had decompiled it, and renamed the namespace.
Why? I have no idea. He'd certainly not touched, or even really looked, at the code.
Secondly, the other senior developer has a laptop and a desktop machine, and his code seems to be shewn across the two. If I had this, I'd be sure that I was using source control, even as a joint store between the two machines. But no. I asked him for some code that I was meant to be working on, and it took a full hour before it was in the company's code repository. This is the company's prime assets (it's a technology company), and it's not even under source control. WTF?
I've watched the programming team, and whilst they seem to get on, there's not a lot of "team" working. Everyone seems to work in isolation, then run into trouble when code sharing comes along. I presume this is because there used to be three of them, and now there are five, and an office/project manager. Information sharing becomes more and more important as the team grows.
I'm going to stick with it for a few days, then try and rock the boat a bit, and see what happens.

Scotland is off

Yeap, you heard it straight, Scotland is off.
After going back to work yesterday, both Amy & myself were absolutely drained last night, and realised that a dead early start, followed by 10 hours on a train, and then an hour car journey, may not be the best thing for our recoveries.
It's a pain, not least because of the money (I don't think we'll be able to get any money back on the cottage), but also because I was looking forward to getting away for a few days, getting some fresh air, and meeting up with Chris and Conrad. I think Amy was looking forward to finally meeting some of my Sheffield buddies - I think she thinks they're made up.
Despite not going, I'm still glad to have a few days off. I know I've been in bed for most of the last week, but I feel like everything's been hectic recently. I don't know, perhaps it's the fact I'm out of the house from 0730 to 1845, so I've effectively lost an hour of free time a day.

Friday, October 13, 2006

Fwd: weekly update friday the thirteenth of september two thousand and six

This week, brilliant indie record store Norman Records offered Max Richter cd for cost price. here's their explanation:


This week you may have noticed we put the Max Richter up on the site very cheap 'n all. In fact we are selling it at cost price so we're not making a bean on this. The reasons for this crazy phenomena are twofold:

1) It's a great album and you all need to hear it. Selling it at cost is a great way of spreading the music

2) Errr... we had no choice as Boomkat managed to get it a week early as they had struck up an exclusive deal with Fat Cat. I called Fat Cat who were very nice but they couldn't really help us in the way we wanted to be helped (ie we all get it at the same time to create a level playing field). This kind of behaviour is going to be the downfall of indie music stores as the big corporate style of said online store slowly takes over. It's fine for stores to have exclusives but on big properly distributed releases like this it just isn't fair at all. If everyone buys it from them, then no one buys it elsewhere thus taking important key sales away from the smaller indies. You can say what you like about the indie stores but without them you have no independent music. Thus, to support independent music you need to support the little stores otherwise both small labels and artists will suffer. Eventually it will get to a stage where there are no indies left and the lesser known artists will struggle to get their releases into the handful of stores left (they may not see it worthwhile as they won't 'shift enough units for them). I am not just romanticising here, this will happen! So we thought the only thing to do in this case was to sell it at cost price which may be suicidal but this is an important release for us this year. You may notice other shops have done this too so it is not just us who are aggrieved. The independent music store is the lifeblood of music. Without that you have a load of bland corporate places telling you what you should own. As indie stores shut down there will be less choice available and those in need of their fix will go straight to labels which is what kind of happens anyway. Only time will tell what will happen eh....
Fat Cat have released some of my favourite albums lately, and this behaviour is fucking ridiculous. I've sent them a rather rude message asking them how they like being a coporate gimp, and I'll let you know if I get a reply.

Running...or not

I'm back at work today. Trying to take it as it comes, but the first hour or so has been ok.
However, the forecast for Sunday's run isn't so hot. I'm still very flemmy, and I do have a cough still. Unless I get a lot better by tomorrow evening, I'm not going to be able to run, and even then, jumping up, after a week of virtual inactivity, and running 13 miles is perhaps over optimistic. I'm still stubbonly refusing to say that I'm not doing it, as the disappointment is too much to face. I've been training since May, and to have to pull out at such a late stage because of, let's face it, a cold, is a real bummer.
Ah feck, I'm not running, am I? Shit. I'll just have to sit and cry for the whole time.

Tuesday, October 10, 2006

shit

Was looking at http://flood.firetree.net/, which shows estimates for how sea levels could rise. Basically, a 14 meter sea level rise (yes, that is a lot) would see Leeds virtually on the coast, and even 5 meters sees Selby under water*.
*not necessarily a bad thing.

Monday, October 09, 2006

Sick

I'm off work today, with a cold. It sounds lame, but walking downstairs to phone work took it out of me, so I don't think that a 40 minute train ride, followed by a 15 minute walk was really feasible. Amy was feeling dodgy too, but she's managed to go to work. I hope she's ok.
So, because I've not put anything on my blog for ages, here's a quick summary of what's going on in my life:
Running
The big event is next weekend (argh!), but I managed to do 10 miles on Saturday, so hopefully should at least be able to make it round the course. It's looking possible that I'll be running it by myself, as Bill and Conrad didn't get round to entering, and Chris' ankle is still playing up. Still, I'm sure the other people running will provide inspiration, and Paul Radcliffe's tip about counting to 100 instead of constantly worry about how far you've got left seems to help too. It's just a bit difficult counting to 100 whislt breathing enough, but it did seem to help on saturday.
Cat
Henry gets his stitches out today, but his wound is still a bit scabby, so we're going to keep him in until he's healed properly. That should stop another fight opening up the wound again, but won't stop more wounds. He's been being really friendly, and a pleasure to have around (most of the time). He did knock an entire pint glass of water off the coffee table yesterday, but he was just sniffing around, and didn't do it intentionally.
Work
Yeah, work. Yeah. Been going ok. Just one day, when they said "you can all work an extra half hour a day for the next month, can't you?", has been bad, but it seems ok. Still haven't done any serious coding, and I can hardly wait. They don't seem to know about unit tests, loose coupling, or anything like that, so I'm looking forward to introducing some of those concepts. The manager seems quite keen on BUFD, almost done to the code level, which worries me slightly, but I can see that he'll be happy as long as the work gets done. I hope I never have to spend a month on requirements capture again.

I need to go and lie down now.

Thursday, September 28, 2006

Party Conferences

It's party conference "season" at the moment, and frankly I'm fed up with it. It's all a load of bollocks, but the Press seem to lap it up. I, for one, don't care about how the Parties reach their pointless policies, which they'll inevitably default on and change anyway.
Also, I don't understand what all the "Tony Blair's Leaving" shit is all about. Surely, if Party Politics was truly democratic, it wouldn't make any difference who the leader was, as they'd only be implementing the Party's will.
It all stinks of shit, and frankly there's a whole lot more going on in the world that the Press should be telling us about.

Wednesday, September 27, 2006

Henry vs Back Alley Cat

Well, Henry's been fighting, so I took him to the vet last night, as he had a really nasty wound on his back leg. The vet took one look and said he needs stitches, so I left him there overnight, and I'll get to hear a bit later on about how it's gone.
It was a bit strange, coming back to an empty house. He's only been with us for four weeks, but it already feels very strange not having him around, and both Amy and I were quite upset about it.

Thursday, September 21, 2006

Paging In TSQL

There's a lot of crap written about paging in TSQL (SQL Server's SQL). Then I found this article that uses SET ROWCOUNT to do it. Brilliant.
However, there's no error checking, so I've tweaked it a bit, and my results are below. Enjoy.

DECLARE @Start int, @End int

DECLARE @StartId int
DECLARE @NumRows int

SELECT @Start = 11, @End = 20

IF @Start <= @End
BEGIN
SET ROWCOUNT @Start
SELECT @StartId = addressid FROM Person.Address
order by addressid Asc

IF @@ROWCOUNT >= @Start
BEGIN

SELECT @NumRows = ( @End - @Start ) + 1

SET ROWCOUNT @NumRows

SELECT * FROM Person.Address
WHERE addressid >= @startId
order by addressid Asc
END
SET ROWCOUNT 0
END

Coghead

Anne2.0 posted a link to an article about coghead.
In their own words:

[Coghead is] A simple, powerful new way to create web-based business applications that can be used by anyone, anytime, anywhere!
[...]
Coghead developers don’t need to know how to code! With just a browser and an internet connection, they can create, modify, and deploy hosted business applications, and collaborate directly with their end-users all via the Coghead service.
Sounds like they're empowering the user - the person who wants to use the application. Sounds like a great plan.
With one major drawback. At the moment, there doesn't seem to any talk of sharing information with exisitng applications.
This is best illustrated with a story (sorry if you've heard this one before) about an organisation that allowed unrestrained use of Microsoft Access. Microsoft Access allows development of simple database applications without (too much) code. (This isn't a crack at Access, I'm sure you can do many marvellous things with it). Across this organisation, many people created applications (some quite complex) that many more people used to run the organisation.
This organisation had a a number of branches (about 300). Each branch had a number of staff, as well as a number of customers. There were about 120,000 customers in total. The organisation was required to keep track of all of this.
Now, if you can imagine, 300 Access Databases, some duplicates (because, after all, Access Databases are just files that can be copied as easily as a Word document), all with their own list of, at least these 300 clients, and all with a different (sometimes duplicate) bits information about the 120,000 customers.
The problem, of course, comes when details change (which they did on a very regular basis), or when somebody to use bits of information from across different databases. It was a nightmare.
Of course, maintianing these applications/databases was a constant struggle, because they'd usually been developed by a member of staff who was on holiday, or who had left, and almost invariable had no idea about normalisation, settling on a naming standard, or programming in general, after all, they'd just knocked this application up in their lunch break(s).
So, how does Coghead solve these problems? As far as I can tell, it doesn't. If you want to run your entire business on it, it's probably ideal, and I'm sure it'll work great, but there seems to be no emphasis on collabaration.
Now, I'm aware that there are businesses using Excel for their central database (bless), and I'm sure this is a giant leap away from that (I mean, it's got workflow tools and security). However, without addressing the collaboration issue, I think the probability of replacing a poor solution with a more powerful poor solution is too high.

Wednesday, September 20, 2006

Catch up...

Seeing as I've moved to blogger beta, which, as Gary pointed out, is a lot slicker than plain old blogger, and it no longer requires me to have a blogger and a google login (horray!) I though I'd better write some new content, which in fact most people will already know.
Green Man Festival - brilliant, despite having to put the tent up in the dark and rain, and taking 6 hours to get there, and the first night being a massive thunder storm, the first day being almost constant rain. Still brilliant. I think having the cottage to retreat to was a really nice extra - we got to get clean and relax comfortably. On the monday morning when we were woken up at 6am by a van stuck in the mud next to our tent, not having a six hour drive was also good.
Music-wise: julina molina was my favourite, especially as I'd never heard her before. Euros Childs (formerly Gorky's Zygotic Munkie) was very good too, albeit in a poppier, happier, more jumping round the room way that I usually go for. Tunng were brilliant too. Bat for Lashes was another good find - a bit Bjork like, which is no bad thing in my book. The dressing up was beyond the call of duty, too. Malcom Middleton played a blinding set, and Viking Moses entertained, especially with his cover of Whitney Huston's I Will Always Love You (no, it wasn't done seriously).
There's some bits and pieces on the bbc collective site.
After Green Man came Wales, or at least the Brecon Beacons. Really beautiful hills.
We were staying right by Table Mountain (near crickhowell), on the Breacons Way, and did one walk right from the door, which was brilliant. Also walked under a water fall, which was pretty neat, and up Pen Y Fan, which was really challenging, and then slightly disappointing - there's a really easy way up to the top, and so it was teaming with people who weren't out of breath. We went up the route that was shit scary, and my vertigo nearly got the better of me. The way down featured a 200ft drop on one side, which did get the better of me. The last day we did Sugar Loaf Mountain, which was a bit of a stroll. We meandered up there in about 1.5 hours, including stopping for lunch, then ran down in 30 minutes. I was quite exhilarating running down. I've put some photos over on flickr.
Coming back from Wales, we found Cate and Mike staying at our house. It was arranged, although at the last minute before we left, and they bought Henry up with them. It was cool to see them, even though we'd only seen them a fortnight before, and they were in house hunting mode... Still, hopefully they're going to based in Leeds for some time to come, so I should be able to see them more.
Henry's been cool, and I'm starting to enjoy having him around. Despite a few (nearly) sleepness nights, where he found he could get his paw under the bedroom door, and thus wake me up by scratching, it's been ok (we've kept him in the kitchen at night since). Last night, for the first time, he didn't come back before we went to bed, and hence caused no end of worry. He was outside this morning, acting like nothing had happened. He seemed quite tired when he came in and he ate all his breakfast in one go, which he hasn't done for a few weeks.
The new job, at million21 seems ok. It's actually application development, rather than web stuff, but with a strong bias towards web technologies, which is kind of my thing really. Also, there's a bloke who's fresh from Uni, who I'll probably end up taking under my wing. Been working on a project that's not connected with the rest of the company's work, so not got to see their coding standards, practises, etc... that's a treat to come. They do seem hooked on SPs though, which is something that's going to cause friction, no doubt.

Tuesday, September 19, 2006

Sorry

Blogger screwed up my blog (or, at least, it disappeared), so I've had to republish it all...so apologies for those syndicators who get all my content appear again.

Monday, August 14, 2006

Henry

Henry
Henry,
originally uploaded by b3ardman.
Saw Mike and Cate at the weekend. Was another weekend with too much time spent in the car, especially as we went the wrong way (twice) when we got to London, but it was good to see them.
The main purpose of the visit was to see Henry, who's going to come live with us once we get back from our holidays. Fortunately, Amy wasn't too allergic (she got a bit snotty, but her eyes seemed ok). Henry seems like a dude, he didn't seem to mind Amy fussing him, or me not fussing him. In fact, the only thing he seemed to be concerned at all about was his dinner (but then that's cats I suppose).
Amy and I are already looking forward to him coming to live with us. It'll be great to have the patter of paws around the house.

Friday, August 11, 2006

Cracked it.

Finally, found a way to AppUnload IIS sites using PowerShell.

New-Object System.DirectoryServices.DirectoryEntry "IIS:// servername/W3SVC" | %{ $_.get_Children() } | where { $_.get_SchemaClassName() -eq "IIsWebServer" } | where { $_.serverComment -eq " sitename" } | %{ $site=$_;"-----";$site.get_Name(); $site.ServerComment; $site.get_Children() | where { $_.get_SchemaClassName() -eq "IIsWebVirtualDir" } | %{ $_.Invoke("AppUnload") } }
where { $_.serverComment -eq " sitename" } is useful if you need to pick site via the "server comment", which is the name displayed in IIS. If you only have one site (like on XP), then you can remove/ignore this. Also, it prints out the site "name" (this will be a number) and "server comment", which isn't strictly necessary, but then at least you'll get an ideas what's going on.

The bit I got stuck on was that the full path to a the object that has "AppUnload" is "IIS:/localhost/W3SVC/1/ROOT" - I was trying to do it on the "IISWebServer" element...

Wednesday, August 09, 2006

OMG

so, after yesterday's childish reaction to rewriting the spec, I got told that the incomprehensible pile of shit that I had written was "a lot better", and the only comment I got was that "[what I posted yesterday] has to be the longest sentence [project manager has] ever seen".
Thank fuck I'm out of here.

Tuesday, August 08, 2006

too much?

I hate writing functional specifications, thus I write bollocks, like this sentence:

A Review Schedule is created for documents with the status of "Published" on the "Create Review Schedule" page by selecting the first review start date, which the system will check as being after a date in the future, the first review end date, which the system will check as being after the first review start date, thus also a date in the future, and the review frequency with which the document in the status of "Published" is to be reviewed, which may be monthly, quarterly, biannual, yearly, two yearly, or three yearly, but the system will ensure is greater than the period between the first review start date and the first review end date, then clicking on the "populate review schedule" button, which will populate the review schedule by initially calculating the next review state date as being the first review start date plus the review frequency and calculate the next review end date as being the first review end date plus the review frequency, then by calculating subsequent review start dates as being the previous review start date plus the review frequency and the associated review end date as being the previous associated review end date plus the review frequency, and continue this calculation until it has populated the review schedule with eleven further review start dates and eleven associated review end dates, which will be presented to the user to modify as they which, but which the system will ensure do not over lap, by checking that each review start date is before its associated end date and that each start date and associated review end date represent a discrete time period within the review schedule, and then allowing the user to save the populated review schedule once they have made any changes that may be required and which the system validates as representing a valid review schedule.
So far I've written 3 pages of this durge. I did follow Joel Spoelsky's advice, but I got told off, so they'll have to put up with this.

Monday, August 07, 2006

Bristol's a long way away

Nine hours travelling (there and back), which is a bit much for a weekend. Nice to see Amy's sister mind. Amy's got crazy ideas about living down there, so I had to take the scenic route back, the one over Pole Moor, where you can see all along the Colne Valley. Picture's of Clifton Suspension bridge. I was too scared to walk across it, it's fucking high up. Posted by Picasa

nvarchar(max)

Although I can find little information about it, nvarchar(max) is one of my favourite features, to-date, of SQLServer 2005. (It's not a LOB, it's a Large Value Datatype!)

Goodbye pens

I let Amy borrow my Muji pens which I'd kept hidden in my bag. I'll never see them again then.

Wednesday, August 02, 2006

PowerShell + sourcesafe = :D

gci -i "*.aspx" -r | select-string "searchstring" | %{ $_.RelativePath($(get-item .).FullName) } | %{ ss checkout $_ -i- -gf }

{checks out items from current project dependant if they contain the pattern searchstring}

Tuesday, August 01, 2006

Dorest Cereals

Dorest Cereals (their homepage doesn't work at time of writing) have redesigned their packaging, and it looks really good: check it out. (There's some pictures of the old style here).
Apart from fitting in the cupboard better, and being easier to close, they are  harder to recycle (due to the plastic windows), and contain more packaging, as there's a polythene bag inside of the box.
Aesthetically, however, they are very smart.

Monday, July 31, 2006

Camping

Bill's Rock Balancing
Bill's Rock Balancing,
originally uploaded by b3ardman.
I like camping.
I also like my SDL (past + present) buddies.
So, this past weeked proved to be most pleasurable, as I managed to do both.
Walking, beer and food all featured. As well as stone balancing and general tom-foolery.
Strangely, I think bouncing down the edge of Kinder Scout fixed my knee. Hooray.
Back to work today. Bum.

Thursday, July 27, 2006

All I want is a job where I don't feel like I'm compromising myself everyday.

So, I was offered a job, good pay, good benefits, but simply too far away.
Then, yesterday at interview, I failed to sell the non-technical side of my skills, and so failed to get a job nearer home.
It's the second part that I'm most fed-up about. I didn't have a job specification before the interview, and then, at the interview, they didn't really explain that the job would involve customer interaction, so I went all technical on them, and totally missed the target with the other side of the job, which I didn't even know existed.
I'm really hating my job at the moment. Everything I do is a fucking hack. Hack this, hack that. I'm a bit worried I'll forget how not to hack.
Fuck it. fuck fucky fuck fuck.
Time to put the CV on monster again, to hell with it.


Friday, July 21, 2006

2 job interviews, no job

Not because I didn't do well at interview (one have already come back indicating they're putting the final touches on a proposal), but simply because they're not right for me.
One, which seems like I might do well there is simply too far away (would require 1h15m drive, hence £++s on travelling, and less reading time). The manager seems to have a flexible attitude to working hours, even if the official company line difers, and when I had to give an inprotu presentation on something technical (they asked me to tell them something about SQL Server 2005, so I told them about Report Services), they seemed like they were actually thinking about how & where they could use it. It's a shame it's so far away, and they'd mentioned outsourcing things to India previously (although I think they got burned).
The other one is for an online games (read 'gambling-lite')(or should that be 'gambling-zero'?) company in Manchester. Seemed ok, although they stumbled when I asked about Test Driven Development (seemed to have looked at NUnit, but not grasped the nettle). No benefits (no pension, minimum holiday), and the £££s didn't seem to compensate for that. Had a bit of an argument with the agency guy about what he'd told me beforehand, but I think it's best left alone. Why do companies forget that employees are people, with wants and needs?
I've got another interview next week, where there's more benefits ( 25 days hols + 8 stats, Stake holder pension, subsidised Gym membership just up the road & bonus scheme payable upon individual performance), which is always good. Not read the job spec yet, but it's closer to home, which is always good.

Tuesday, July 18, 2006

Back buttons on webpages.

Don't do it. You know it's wrong.

My browser has a back button, so I don't need one on your webpage. Give me bread crumbs, help me see where in your site I am, but back buttons don't work.

Either they go to the page's referrer, or to the last page in the browser history (should be the same, but not always). How pointless is that? If I come to one of your pages from outside your site and the best you can do is send me back to where I came from, then frankly you're not trying hard enough.

So, pull your socks up and decide how you want me to navigate your site. Either that, or I'm going somewhere else.

Wednesday, June 28, 2006

Coastal - Halfway to you

I thought I'd mention this record, as it's absolutely brilliant.
This is wonderful slow-core, and any comparisions with Low are superficial at best. Yes there is both a male and female vocalist, and, yes, they do interact in the same way, but the song structure is completely different, being based around short, melodic loops, rather than the more traditional structure that Low follow. In essence, I'd say they're more like Empress than Low.
This album has a spaciousness to its sound. The whole things swathed in reverb, but rather sounding like it was recorded in an aircraft hanger, it creates a wonderful warmth.The whole sound makes me think of sitting in the cool shade on a hot summer day, with nothing to do but listen to the animal noises.
Go out and buy this now. Or better yet, get it from my favourite online record store (that is genuinely independant) www.normanrecords.com.

Erlang

I had a little look at Erlang over the weekend. I was inspired by some articles on defmacro.org which I found through del.icio.us.
I've not done functional programming since Uni (apart from some XSLT, and that required some deep thought), and I don't think I really appreciated it at the time.
I'm not converted (yet), but there are a few concepts that I really like.
For example, I was debugging a (non-functional) program yesterday. Essentially, it was calling various functions (in some cases recursively) to build up a string. All these functions changed class level variables, rather than each function returning the bits to add onto the string.
The debugging was complicated because I had to step through each function because any function could append something to the class level variable.
It wasn't pretty. (I count this abuse of class variables - basically using them as global variables.)
What would have been better is if the functions returned the string to append to the class level variable, and one controlling function dealt with this.
So, instead of this:

var importantString = '';
function a(i) {
if ( i < 10 ) {
importantString += '' + i;
b(i);
}
}

function b(i) {
importantString += ',';
a ( i + i );
}
it should be this:
function a ( i ) {
if ( i < 10 )
return '' + i + b(i);
}
}


function b (i) {
return ',' + a(i);
}
I realise this is a trival example, but by eliminating the global variable, it makes it a lot easier to find problems, and to test. For example, we can expect a(1) to always return '1' + whatever b(1) returns - if we replace b with a mock version, then we can test it really easily. Similarly, testing b become equally as easy.
In Erlang, variables are immutable so we cannot recreate the first version The second version (easier to test, easier to debug) , therefore, becomes the way to do things.
I'm not saying you can't write some terrible code in Erlang, or with functional programming, but I wanted to demonstrate how features in one language can be usefull constructs in other languages.

Friday, June 23, 2006

Windows PowerShell

Apart from having a crap name, this is quite some tool [link].
Eg: I can add a registry value like this:
new-itemproperty registry::\HKEY_LOCAL_MACHINE\Software\CDS -name test -type string -value "monkey"
Brilliant!
Or I can stop the service that I'm developing without having to remember it's stupid name:
gsv ePIMS* | Stop-Service
Astounding.
There's a steep learning curve, and the WMI stuff is huge, but I think it's coding to be worth the effort.
(oooh, and just to clean up: rp registry::\HKEY_LOCAL_MACHINE\Software\CDS -name test)

Monday, June 19, 2006

AbeBooks.co.uk Greasemonkey Script

Abe Books is a great site, and I far prefer it to using other large, american based, online booksellers' sites.

However, their site is a little basic. For one thing, it doesn't show you a total price (price + shipping).
This GreaseMonkey script fixes that.

Sunday, June 18, 2006

Scafell Pike

View from the top
View from the top,
originally uploaded by b3ardman.
Had a nice short break (Friday night, Saturday and came back early this morning) away with Mike + Cate, who I've not seen for a while. Met some of their friends too, who seem really nice.
Saturday we walked up Scafell Pike. None of us were really prepared, and, in fact, Paul left his boots at the cottage, and had to go back and get them. Andy also insisted on carrying his 2.5kg tripod up there too.
It was a steep walk, and Amy, Tamsin and myself soon struck out in front.
We got to the top in about 4.5hours, and then spent about 3hours getting back again. The others took a bit longer.
Both Amy and I are absolutely knackered today.

Friday, June 16, 2006

Mikey

Do a Google Image Search for Mikey.
What's that first result about?

Running again

Did 60/60 again last night. Amy wore the gizmo and we noticed that her heart rate pattern is completely different to mine. Her heartrate went up to about 230 bpm tops, whereas mine only got up to just over 200.
This was the first time we'd been running after doing yoga the previous day, and I struggled. My legs were very sore.
Amy's got some proper running shoes now, and she was loving them, even thought they are a bit girly pink. She was suprised how much difference they made, and I was reminded that I really struggle when running for the train in my work shoes.
Overall, we ran at a steadier pace, but we actually went slightly further (only 0.02 miles/32 meters), and considering the extra effort it was for me to get going, I think we did quite well. I was noticable easier that saturday, when we started doing 60/60.
We're in Keswick on saturday, so if we do go out, it might be for 60/60 again. I think our hosts are planning a long (ie all day) walk, so we might not go running at all.
Side note: type 0.02 miles into Google. Brilliant.

Wednesday, June 14, 2006

Running Diary: Entry 8

60/60 again, for 20 minutes. Was a bit cooler than saturday, although did start off a bit quick. Have new toy (GPS + Heart Rate Monitor), which is suprisingly informative, and has meant that I can do away with carrying my phone.
Told me we'd covered about 3K, along with average speeds for each running session, as well as showing how my heartbeat peaked whilst running, and dropped back down again before we set off again. Of course, the Training Center software is the most usefull way to see all this.
More exciting is the prospect that it can be used to pace ourselves in the future, so we don't start off too fast, or so that the heart rate stays in a certain zone. Also, being GPS, it can guide us home if we get lost.
It also shows how many calories you've burnt, but I hadn't set it up properly.
I'm quite impressed, even if it does seem to need to find the GPS signal every time you turn it on (which takes a minute if you stand still, or much longer if you don't).

Monday, June 12, 2006

Apostrophes

Not meaning to be a captious pendant, or to blog about grammar, but...
There's a sign outside the pub, up the road from where I work, which says: "C'MON ENGLAND".
I say this, and did a double take. What does this mean? Surely it couldn't mean "Come on England!" (for the Football World Cup that's apparently going on), as that would be abbreviated "C'M' ON ENGLAND", or perhaps "COM' ON ENGLAND!".
The only thing that I could think it could mean is "Common England", which doesn't make any sense...although, the pub is The Three Legs, which has a bad reputation, so I wouldn't put it past them.

Saturday, June 10, 2006

Running 6 + 7

Thursday - 20 minutes of 50/70secs. Very hot. Very sweaty, as the heat was mostly hummidity.
Today - 20 minutes of 60/60. Managed to get out early, before breakfast. Was hard work, but we both made it through. And we got noticably further down the canal.

Wednesday, June 07, 2006

I'm not always right...

...no, I should probably say, I'm sometimes right, but often wrong.
A number of friends, who I worked with, but they're more than 'colleagues', anyway, I digress. We've been trying to arrange what has become an annual camping trip in Edale. In an email that was sent to all of the interested parties, I nonchalantly asked one of them (Chris) what 87 is in base 9.
He, correctly, replied 106, but another person on the list (Pete) replied 96. Chris called Pete a retard (for which he almost immediately apologised), but that's just Chris' nature.
Anyway, I, mistakenly, told Chris that Pete was right. I honestly thought he was. It took Chris to point out that you can't actually have 9 in base 9 before I conceded that I was, in fact, wrong.
Chris has won some lettuce for being right.
Anyway, I suppose I just wanted to point out that I'm not always right, and I should check my calculations before running head-long into something.
Oh, and I need to remember about number systems too...You don't have 2 in base 2 (Binary) do you? Am I some kind of retard?

Tuesday, June 06, 2006

Running Diary - Entry 4 + 5

Been better at running than keeping the diary.
Saturday and yesterday - 50 seconds running, 70 walking, 10 times. Also, did a 4.5 mile walk on Sunday that took in a 250m ascent. The running is more challenging, as expected, but I'm managing it. Amy's starting to struggle a bit. Hard to know what to do, as I want to move forward, but don't want to push Amy too hard. Going to do 50/70 again on Thursday and see how it goes for next saturday.

Thursday, June 01, 2006

Running Diary - Entry 3

20 minutes of 40 seconds run, 80 seconds walk. Was fine, and so was Amy. In fact, I found it a bit easy, so I did an extra sprint at the end.
What I mostly wanted to write about though was iterative design.
Before the first session, I wrote a little program for my phone. Basically, it allowed you to enter two numbers, one for run duration and one for walk duration, and then it would play a sound alternately after the run duration and the walk duration. Exactly what I needed.
However, after the second time out, I discovered that I don't always hear the sound (what with moving my arms about when I run). When this happened, there was no easy way to get back in synch, as there was no easy way to tell when the sound meant run and when the sound mean walk.
So, for the second iteration, I've changed it, so there are two distinct noises. The run sound is an octave higher than the walk sound. Also, just to be extra sure, my phone now vibrates at the end of each period.
The second version is a great improvement, I didn't miss a single alert, and I still just have a simple program that alerts me after the run and walk times.
I don't think I would have guessed about making the phone vibrate if I hadn't have been out a few times. This is the power of iterative design. I made something, I tried it out, and then I improved it. I'll keep doing this too. One idea I have is to make it so I only have to enter the run duration, and then it will work out the walk time ( given that it's a two minute cycle ), but this isn't a big deal at the moment, the alert thing was.
Perhaps, when I can run for the full 20 minutes, I'll need to make a new program that alerts me halfway through a run, so I can turn round and head homewards, and then at the end, so I know when to stop. I'll probably get a wrist watch with a timer on it for this though...

Tuesday, May 30, 2006

Is this insulting?

I just noticed the 'icon' that blogger uses for the accessibility feature for the word verification:

I'm sorry, but why would someone in a wheelchair need to use this feature? Surely this is more for partially sighted people?
On top of this, when I click it, Firefox claims it needs the Quicktime plugin, which I think breaks the idea anyway.
A case of the blind leading the blind? [Sorry, couldn't resist it]

Monday, May 29, 2006

Running Diary - Entry 2

Second run. 40 seconds running, 80 walking for 20 minutes. Felt ok afterwards, a bit snotty, but Amy was really suffering from hayfever and stopped after about the 8th repetition. She felt a bit low afterwards, but I think there may be other factors contributing to this too (something cyclic).
Realise I need to change my application for this so that I get a distinct tones for walk and run. Perhaps it needs to make my phone vibrate too, as it's easy to miss the noise and get out of synch with the walking/running part (as I found out after I ran for too long).
Also realise that I'm going to have to get on top of my hayfever this year, as it could hamper my training.

Saturday, May 27, 2006

Running Diary - First Entry

Running what? Eh? I shouldn't be writing a running diary. However, Bill's convinced me to run the Aviemore Highland Half-Marathon in October. I've been to the running shop in Huddersfield, and bought myself some fancy shoes (funny, they were cheaper in the shop than online!).
Went for a short run today, 20 minutes of 30 seconds running, 90 seconds walking. Wasn't too bad, but both Amy + I were feeling it as we walked up the hill home.

Thursday, May 25, 2006

Why do we write computer programs?

Ok, so beyond the core "because it's my job, and I get paid for it", I was thinking about why we write computer programs. (Yeah, ok, so "we" is used in a very loose sense).
The reason I could see was that they did something more efficiently that doing it by hand. Before you shout out "But I can write a letter with a pen and paper faster than I can load up Word and type it in", think about what the end result is. If you wanted the same output as Word produces, you'd have to either spend a long type with some old school type setting equipment, or learn to do caligraphy well. Neither would be faster than loading up Word and typing it in.
So, if programs are time saving devices, this puts them in the "tool" category. Sure, they're more complex than a hammer, but then they do more than a hammer does. (You could always go and look at the guys at 37signals, who think that computer programs should be a lot more focused). I digress...
Surely, then, we should be writing more computer programs, either to help us write computer programs, or to help us do something else that takes a long time.
An example of one of these programs is a SPAM filter - such as SPAMBayes. This has saved me loads of time in the past. Rather than having to spend hours (and I do mean hours - never publish your email address on the internet) trawling through emails, picking out the good ones, I set it up, show it some stuff that I already think is SPAM, and off it goes. Brilliant. Yes, it needs a little bit of help now and then, when my brother sends me a "forward this to 10,000,000 of your friends" email, but I think that's fair enough.
Back to the point - why is it so hard to write programs that automate existing programs? If you try programming any of the Office products using the macros, it gets really hard once you're past the "make this text bold" stage - mind you, getting the text to make bold in the first place is hard enough. Add to that the fact it forces you down the path of writing in a language which you might not be used to (VB sometimes makes me want to rip my own eyes out!), it leaves a bitter taste. Similarly, if you want to program Visual Studio.Net using macros, it's an uphill struggle, and some things that you think should be easy - such as finding out the function you're in, become very hard.
I suppose the problem here is that it's exposing the complexity of the underlying program. Sure, making a simpler wrapping on top of this would only increase the complexity, but when people like JetBrains (who write the amazing ReSharper) have to write their own C# parser, there's something very wrong.
Perhaps it'll get easier. Programming Google Maps is a doodle, once you get past the initial WTF. Similarly, programming Flickr is quite easy (especially if you use one of the already developed language specific libraries). As more and more programs/services expose APIs, perhaps we'll get better at writing them. Perhaps we'll need a common standard for APIs.
Anyway, this was going to be a rant about how, perhaps, we should be developing programs as though we were developing an API, and then write our front end on top of that. Certainly, that's not an original thought. But, perhaps, at the same time, we should be striving to write APIs that other people can use. Sure, there'll be a bit of learning to do for any API, but this should also be an understand of the problem domain, and the code behind the API should handle all the unnecessary detail.
I know I'm not there yet, but I'll keep on trying.

Argh! Hayfever!

These last couple of dayes, I've been feeling like I'm coming down with a horrible cold. Since it's been raining almost constantly for the past two weeks, I really didn't associate this with pollen. This morning I took a hayfever tablet, and suddenly I feel a lot better. Bloody pollen.

Sidenote: Outlook HTML email kills my blog layout.

Tuesday, May 23, 2006

Time Off Request

Time Off Request
Time Off Request,
originally uploaded by b3ardman.

I get round to booking time off today, which is done through the timesheet system.
What a terrible screen this is.

The required fields all have default values in them. This is one of my pet peeves. If something is required, it should either be blank or have a 'special' value in it, such as 'Select From Date'. How else can the computer tell if it's been filled in?

Time Off Code? What? These are all human readable values ('Bereavement', 'Holiday', 'Flexi leave'). I think this should be labelled 'Reason for Request', or something like that.
The default value for the Time Off Code (if there has to be one) is 'Bereavement'. So far, in 6 years of working live, I've taken precisely zero days off for 'Bereavement'. I've taken far more days off for Holiday than anything else, so why not default it to that?

From and To dates - now these really pissed me off. For one thing, they default to today's date. I'm in work, sitting at my desk, and the computer thinks I want to book today off. Also, I'm contractually obliged to give 2 weeks' notice of holiday requests.
Then, I select the From date (I have to click the little calendar to do this). Fine. I click to select the To date, and it show's today's date, rather than the from date I just selected (which it is also showing in the To date field). Argh!

I haven't used the Comments field. I can see, in certain situations, it may be necessary, but for the greater part, it's entirely superfluous. This said, it's still the largest field on the screen, and it's entirely optional. My preference would be to show a full calendar for the From and To date fields, and have a much smaller 'Comments' field.

Finally, the note about 'Partial days' is entirely superfluous as the system only allows you to book partial days on the first and last days of the request.

Sorry, did I say I read Krugg's Don't Make Me Think recently?

Friday, May 19, 2006

How to make your own test runner in NUnit

This isn't my cleanest piece of code, but it shows how you can write your own test runner in NUnit (V2.2.8). This is very dull if you don't do coding.

using System ;
using System.Reflection ;
using NUnit.Core.Builders ;
 
namespace NUnit.Core.Extensions
{
    [ AttributeUsage ( AttributeTargets.Method , AllowMultiple = false ) ]
    public class VagueExpectedExceptionTestAttribute : Attribute
    {
        protected Type _exceptionType ;
        public string _startsWith ;
        public string _endsWith ;
        public string _contains ;
 
        public Type ExceptionType
        {
            get { return _exceptionType ; }
            set
            {
                if ( !( value.IsSubclassOf ( typeof ( Exception ) ) ) )
                    throw new ArgumentException  
( "Type must be derived from Exception" ) ;
 
                this._exceptionType = value ;
            }
        }
 
        public string StartsWith
        {
            get { return _startsWith ; }
            set { _startsWith = value ; }
        }
 
        public string EndsWith
        {
            get { return _endsWith ; }
            set { _endsWith = value ; }
        }
 
        public string Contains
        {
            get { return _contains ; }
            set { _contains = value ; }
        }
    }
 
    [ TestCaseBuilder ]
    public class VagueExpectedExceptionTestBuilder : NUnitTestCaseBuilder
    {
        const string AttributeType =
"NUnit.Core.Extensions.VagueExpectedExceptionTestAttribute" ;
 
        public override bool CanBuildFrom ( MethodInfo method )
        {
            return Reflect.HasAttribute ( method , AttributeType , false ) ;
        }
 
        public TestCase Make ( MethodInfo method )
        {
            VagueExpectedExceptionTestAttribute testAttribute =
                ( VagueExpectedExceptionTestAttribute ) 
Reflect.GetAttribute ( method , AttributeType , false ) ;
            return
                new VagueExpectedExceptionTest (
method ,
testAttribute.ExceptionType ,
testAttribute.StartsWith ,
                                testAttribute.EndsWith ,
testAttribute.Contains
) ;
        }
 
        protected override TestCase MakeTestCase ( MethodInfo method )
        {
            return Make ( method ) ;
        }
    }
 
    public class VagueExpectedExceptionTest : TestMethod
    {
        private Type _exceptionType ;
        private string _startsWith ;
        private string _endsWith ;
        private string _contains ;
        private string _test = string.Empty ;
 
        public VagueExpectedExceptionTest (
MethodInfo method ,
Type exceptionType ,
string startsWith ,
string endsWith ,
                            string contains )
            : base ( method , exceptionType , null )
        {
            _exceptionType = exceptionType ;
            _startsWith = startsWith ;
            _endsWith = endsWith ;
            _contains = contains ;
        }
 
 
        protected override void ProcessException (
Exception exception ,
TestCaseResult testResult )
        {
            if ( exception.GetType ( ) == this._exceptionType )
                if ( TestMessage ( exception.Message ) )
                    testResult.Success ( ) ;
                else
                    testResult.Failure (
                        string.Format (
"Expected message to {0}, but actual message was {1}" ,
this.Test ,
                            exception.Message ) ,
null ) ;
            else
                testResult.Failure (
this._exceptionType + " was expected" ,
null ) ;
        }
 
        private string Test
        {
            get { return _test ; }
        }
 
 
        protected override void ProcessNoException ( TestCaseResult testResult )
        {
            testResult.Failure ( this._exceptionType + " was expected" , null ) ;
        }
 
        private bool TestMessage ( string message )
        {
            if ( !string.IsNullOrEmpty ( this._startsWith ) )
            {
                this._test = string.Format ( "start with '{0}'" , this._startsWith ) ;
                return message.StartsWith ( _startsWith ) ;
            }
            if ( !string.IsNullOrEmpty ( this._endsWith ) )
            {
                this._test = string.Format ( "end with '{0}'" , this._endsWith ) ;
                return message.EndsWith ( _endsWith ) ;
            }
            if ( !string.IsNullOrEmpty ( this._contains ) )
            {
                this._test = string.Format ( "contain '{0}'" , this._contains ) ;
                return message.Contains ( this._contains ) ;
            }
 
            return true ;
        }
    }
}


usage:

[VagueExpectedExceptionTest( ExceptionType=typeof(ArgumentNullException), StartsWith=DatasetResponseProcessor.LOG_DAL_NOT_SET)]
public void shouldThrowErrorWithoutDatasetDal ( )
{
    new DatasetResponseProcessor ( ).Process ( _response );
}

Google 'Quick Contacts'

Google 'Quick Contacts'
Google 'Quick Contacts',
originally uploaded by b3ardman.
In the 'Quick Contacts' area of Google Mail, you can set your own status for Google Chat. Entirely necessary, seeing as 'Away' and 'Busy' are the only two built-in options.
However, as this picture shows, it can be used to add a bit of personnality to an otherwise people-less screen.

Monday, May 15, 2006

null

null is always a perculiar concept.
In c/c++, NULL is #defined as 0, which seems fine, as a zero pointer is always invalid.
However, in object oriented languages, especially those with garbage collection, null no longer has this meaning.
null is a special value; at once both of no type and still of every type.
For example, in C#, you can't write
if  ( null is Object )
or
typeof(null)
and yet, any object can be null (we'll ignore value types).
I fully understand the need for null. It's a special flag that says there's nothing here. It's like a yes/no/unspecified thing.
It's at once an example of a broken abstraction (you can't have a value type that is null), yet at the same time overcomes a serious limitation of a binary system (having null allows a "tri-state" system, where null = unset/unspecified).
I'm loathed to say it, but I think I like the VB concept of Nothing better. Obviously, VB still has null, and it doesn't handle the difference between null, nothing and empty very well, but still, Nothing seems like a better name than null.

Wednesday, May 10, 2006

Ruth Kelly is Stalking me

...and she's getting closer.

First of all she moved into education, so I moved out of it. Then, when I'm working on the Office Of the Deputy Prime Minister (ODPM) website, she comes and takes over, in the process changing it to the Department for Community and Local Government (DCLG).

Politics aside, I'm worried about why she's stalking me. Has she not got anything better to do? She's not even got time to stay at a DCLG stakeholder meeting because she's too busy stalking me, or "joining the Prime Minister on a neighbourhood visit" as she calls it.

I'm going to seek legal advice if she tries to move in next door.

Friday, April 28, 2006

Select Item by Text (using Prototype)

Function to select an item in a <select> element by its text value. Using the Prototype Library.


function selectItemByText ( selectElement, nameToSelect ) {
nameToSelect = nameToSelect.toLowerCase();
( $A($(selectElement).options ).detect (
function ( option ) {
return
option.text.toLowerCase()
== nameToSelect ;
}
) || new Object() ).selected = true;
}


I love prototype

Thursday, April 20, 2006

why me?

Hmmm.

So yeah, I've been back at work for a few weeks now. coming up to the end of the 3rd week, although with illness and easter break, i'll have only actually have worked for 10 days. not bad.

The job? I thought it was ok. today I'm not so sure. I don't really know what to do. They seem to have me down as a vbscript/asp expert, which i'm not, and a lot of people there don't want to touch the stuff i'm doing. I can see that, unless i take drastic steps, i'm going to be cobbled with doing most of the legacy stuff and not get a chance to work on the newer bits. bummer.
So far, it's been reasonably challenging. The company have their own Content Management System, which is a piece of shit, but a piece of shit which they've made their money back on many times over, so they're reluctant to do any serious work. Decided today that I'm going to start refactoring its ass. At least that way it'll just be out of date, rather than an out-of-date piece of shit.

Homewise, everythings ok. spent the weekend travelling down to a's parents. Was ok, nothing spectacular happened. Went for a nice walk in the cotswolds, ate some food, but apart from that not a lot. Last night got out for a brief walk after work, for the first time this year. Going to try and do that more often, although it's been pouring down with rain so far this evening. Been spending too much time watching series five of six feet under, which amy bought on DVD, as she couldn't wait for it to come onto terestial telly. we didn't get the digi-box (thanks gary) until after it had finished on e4.

Looking forward to taking murray and hélène up on their offers of putting us up (in berlin and normandy respectively). Amy's already got the german phrase book out, but I'm sure I'll get away with a polite Halo! and then speaking english. That will at once both comfort and annoy me. I can use endless computer based languages, but I'm shit at natural languages. Perhaps i've not got the patence to abstractly learn lists of words. perhaps if I lived with the language i'd pick it up. but that's not likely to happen any time soon.

Need to write a few emails to people, as a couple of friends have sent me lots of long emails, and they're just sitting in my inbox waiting for some kind of response.

Gary's podcast was nice to hear, an awkward sign off, but it's genuinely interesting to get different perspective on things.

Right, better go and make some dinner. been trying to eat less gluten, although it's only been the last few days, and hasn't really involved a lot of chance in diet. it's mostly lunch - sandwiches are easy to make and transport. today, the salad i took to work had leaked all over my bag - garlic dressing seeping out. not nice, and means I need to wash my bag now. the sushi on tuesday was good though, even if it did take too long to make. i'm rambling now.

Wednesday, April 05, 2006

TSQL Script to Find All Identity Columns in a Database

select syscolumns.Name [Identity Column], sysobjects.Name [Table]
from syscolumns
inner join sysobjects on sysColumns.id = sysObjects.id
where autoval is not null


[Oh geeky joy!]

Wednesday, March 29, 2006

They only want me for the money

Finally, after a week and a half, I get some time to blog.
Well, notice was handed in last monday (20th) and I went into full time job seeking mode. Which meant agencies phoning me constantly for tuesday and wednesday.
I've grown to hate employment agencies; for the most part they seem to be liars and cheats. One particular agency have the habit of slagging off any company who they don't represent, reventing any communications between the candidate and the client (except for interviews), and generally telling lies to all an sundry. Certainly, from my experience of them, they advertise jobs they don't have, they apply unnecessary pressure to both parties, and generally mess everyone around.
Anyway, from the mess, managed to find a job in Leeds. The salary's not the best, but i'll be contracting for three months, at a slightly hire rate than the salary, so that should ease the pain. The company seems like a really top place to work though, and they're right in central leeds, where I want to be, basically.
Ordered Mr Beast LP from norman records. Those guys rule (both mogwai + the norman records guys). Norman Records have sold stuff for me, and they nearly always put treats in with the orders. Just the personal touch that makes it special.
Apart from that, everything's ok. Spoke to my mum for the first time in three months on sunday (mother's day), and caught up with the happenings they. They've got a really sound friend who's trying to persuade my mum to come off the millions of drugs she's on, or at least to cut down on them, which seems like a plan to me. Some of them she's been on for thirty years or more, which can't be good for her.
I've done fuck all else, as the job seeking literally has taken all of my time. Now I'm just trying to relax a bit before starting work.

Tuesday, March 28, 2006

Spring!

Iris
Iris,
originally uploaded by b3ardman.
The weather's been a lot better these last few days, and all the flowers are coming out in the garden.
It means I need to sort the patio out, as we sat on the back step to eat our breakfast on Sunday morning.

Saturday, March 18, 2006

And I'm left wondering why the world is full of fuckwits and evil-doers.

"Hi David, it's Mr. X from The Agency.", and so starts another day full of dread. It wouldn't have been so bad had I not spoken to him everyday this week, and everyday brought another blow to my mental well-being.

First it was "be honest with me David", which was Monday morning. Tried to blag my way out of the situation, but realistically, I couldn't have said anything else other than the truth. I suppose I've got my mum to thank for that. That, and the fucking integrity that got me into this mess in the first place. So, I explain that I'm looking for another job, and that I'd appreciate it if this didn't get as far as my current employers. At least he was decent enough to forward my CV onto a couple of places.

Then, after that it was "they want to talk with you". Tuesday bought its own terrors. Why the hell 'they' (my current boss and the prj mgr) couldn't just speak to me direct, I've no idea, but anyway, that was the case. Arranged a meet for Thursday afternoon, 1530hrs, which ruined my plans to go to the beer festival, as that was the only time A + me could have gone. Apparently, the role is only ever going to be a code slave role, and they're looking for someone who's a dedicated (certifiable!) code-slave. Not where I'm at. So what does that mean? They're going to fire me? Well, technically they can't, as I've not done anything wrong. But that option is the one that I focus on, and it fills me with fucking dread. How am I going to pay the mortgage without a wage? I really don't want to loose the house, and it would put a lot of unneeded stress on the relationship between A + I. FUCK. FUCK. FUCK.

Wednesday: had a reasonably nice day in Manchester, a pleasant talk to a "Creative Group" company, and, of course, the earth cafe for lunch. I love that place. "It went well enough" was my comment to him. Still fucking shaking with fear.
A books us tickets to see Scuffer on Thursday evening, wasn't that enthusiastic about it, but it does mean an opportunity to go to Little Tokyo for tea!

Thursday: I'm fucking shaking even thinking about it. Was possibly one of the most fearful days in my whole life.
Fortunately, A dragged me out for a walk in the snow, which at least took my mind off of the possibilities that lay ahead of me. Was really nice watching the wall of snow drift up the valley towards us, and BUGGER, hit us, leave us cold and wet, then quickly pass on towards Manchester. Crazy weather this week. Absolutely crazy.
Anyway, the main event. The fucking show-stopping event of the bastard year. How did it fucking deteriorate into this?
So, I put on my best suit, sneak in the back door. Surprise my fellow work mates, but avoid the "What are you doing here" questions. Summoned into a room with Mr. X (agency), my boss and the prj mgr.
Bat around the issue with my boss for a while, him making statements rather than asking questions. Bastard raised questions about the quality of my code, which I think I at least managed to score one run off. He backs off when I asked for details about the issues he has. Eventually, it just gets to the point where he's makes a statement of fact, and I just sit there as tell him I don't really know what he expects me to say. Implied in that was "Do you want me to argue a point of fact that I agreed with, and make myself look like a wanker? Are you trying to trip me up and therefore give yourselves a way to fire me?". I thought I handled that part of the session reasonably well, coming away with a no-score draw.
So, round two starts with the prj mgr going all "Good cop" on me. "What I really need to know is are you going to stick around for the duration" (or words to that effect). Something inside me responds to this line of questioning. It's direct, and honest, and I answer it in the same way. To be fair, if I think I hadn't, I might have lost it at some point during the meeting and told them exactly what I thought of the bloody pair of them. Very uncool in front of Mr X (agency), who's in the position to help me find alternative employment.
So, after the "I'm looking for another job" reply, I'm told that my boss needs to talk to HR, and that I'll have a response by tomorrow morning. I'm then escorted off the premises. I was so full of rage, full of fear, full of dread. I walk up to the bus station in a real state, and manage to get the bus back. Txt A, rather than phone her, as I didn't want to start crying on the bus.
Get back in time to leave again. At least the play keeps my mind off of the whole affair, left quite happy by the time we get back home (the pint on the way home might have helped :)

"He's not in the office today, he's off skiing. Can I take a message?". Bollocks. Friday doesn't start well, especially as we discovered the boiler is fucked, so we're left without heating or hot water until someone can come out and sort it (which was meant to be in the morning, but turned into late afternoon). I'm constantly glad A sorted out the cover for the boiler and central heating, especially as this is the third time we've had to call them out.
A leaves early for her parents in the south. Should have fucking checked the situation, as there's a train strike, and what with one of her connections breaking down, it takes her over 8 hours for the planned 4.5hr journey.
Eventually get a call from Mr X, who's in Geneva, and he lays out the situation. "One week's pay, and an end to the whole affair, or else they'll get nasty." Nasty means disciplinary action, and eventually being sacked. Shakingly, I phone A, and she's not a lot of help, really, apart from saying that her folks have offered to help if we're in a financial whole (at times like this, I'm so glad she's upper middle-class). So I phone my little bro, who's the trade union representative at his work, and also an outside ear. Suggests I take the money and walk away. Also suggests that I could always ask my former employer if they've got any temp work I could do; they've three places vacant at the moment. Thank fuck I've got people like my bro I can speak to. It sets me straight, and I phone a few agencies to see what work there is. One puts it like this: I'm a reasonably cheap option (£29k cheap? fuck!), with extremely marketable skills and experience. Gives me the confidence I need. Phone my boss, who's off, eventually get to speak to the HR woman. She's quite unresponsive to my trying to wangle any other money out of them. Arrange a 9am meeting with her for Monday morning - which means going into work to hand in my notice. At least I can walk away intact, if a little bruised.

Apart from that whole debacle, there's at least three more job interviews lined up, with two more on the cards, so workwise I guess I should be able to sort something out. Heating's fucked until they come and fix it on Tuesday(?): cold and alone (woe is me ;) Life's sweet though, especially as I'm looking at having next week off two (well, looking for work, but you know).

I'm so glad that whole week's over.

Should probably blog this kind of thing is smaller bits, as its taken me about two hours to get all this down.

Friday, March 10, 2006

What a week

Well, yeah. As well as having a reasonably intense email conversation with Gary over whether we should be optimistic or pessimistic about the "end of oil" (not long now), work has been a peculiar beast.

So: Monday
Talking to one of the developers, who informed me that he foresaw the project being a massive failure, more than one head rolling, and a lot of work fixing it all up. At the moment it's March; the main programming of the project is meant to end in august (although the schedule is already slipping behind), and then there's going to be testing, user acceptance, and then deployment in January 2007. Two months in to the programming and already one man of the 6 man squad is feeling less than hopeful. Not good. (I say six, but it actually works out around 4, due to other commitments.)


Tuesday, heads down, coding most of the day. Ask technical leader about a bit of the spec I'm not sure about; I was told that we'd need to record a URL or something. Turns out, the spec is actually for three diagrams (front, left side and right side), with the ability to click on certain parts and record details for that area. Not only this, but the areas are different in different scenarios, and different records needed different images. Great. So I play with some GDI+ stuff, and get a very simple (box based) example working by the end of the day.

Wednesday, turns out I don't actually need to do the whole "image map" stuff. That's actually on (yet another) document, and I only need to decide whether to show the button to display the image.
I do, however, need to call a business rule, which will, depending on various parameters, decide something else that I need to pass back to the container. (This really did call for MVC, but all of the code for this, apart from my little bit, is in one massive form, which is almost incomprehensible, takes 15 seconds to load in VS.Net 2005, and is very temperamental).
So, I take a look at getting the business rules set up, and the wrapper (a facade) for the business rules engine working on my machine.
No go, the business rules engines requires the schema to be in a certain directory on a D: drive, and the only D: drive my machine has is a DVD-ROM drive. Nice. Of course, the business rules engine (BRE) wouldn't tell me this directly, only throw format error exception.
So, in the end, I have to work remotely on the team's dev server. And it all works fine.

During the day, got a call from an agency I'd been in touch with before I took this job, and spoke to the nice lady there. Said I wasn't happy, and she said she might be able to arrange an interview for Friday morning.

Thursday morning, come in, rename my DVD drive to E:, push in my USB drive, and suddenly I have a writable D: drive (HURRAY!). Put schema on there, and it all works like a dream.
Decide to try and make the facade for the BRE use the BRE on a remote machine. No go. The API expects the component to be run on the same machine. This would require every user in the company to have an instance of the (expensive) BRE installed on the machine. However, the API does have a 'Test' function that allows you to execute rules on a remote server, so I use that. Doesn't seem to work. Pull hair, bash head, and eventually discover that the curious error I'm getting means that Service Packed and non-SPed versions of the BRE API are not compatible. Sort this out, and it works like a dream.
However, point this whole thing out to project lead, and I get landed the job of re-writing the whole BRE facade as a server component and a client component. ARGH. Surely this sort of thing should have been investigated before.
Struggle with using some Infragistics controls, which I really can't see the benefit of, but get some work done none-the-less.

Agency lady said the Friday interview wasn't going to happen, but I sent my CV to 'Agency B', who said they'd forward it on for me.

Today, well, that's been fun.
Coding aside, which hasn't been too challenging apart from a repeatable "Out Of Memory" error on a machine that clearly had at least 2GB of RAM available, phoned nice agency lady, who said she'd been chasing up some leads, but none of them sounded that great.
Email Agency B, but no progress had been made there. They phoned me later to say that their client wants to have a chat with me (well, I think they used the term 'interview', but that word is scary).
Spoke to my manager about not really being happy about the job, and that I felt I'd been a bit mislead about what the job was. He tried to deny it, totally misunderstood what I said I didn't like (he thought I wanted to do business analysis!?!), but it felt better to be honest with him rather than keep on avoiding the issue. He also seemed to say that he didn't want to use the skills and knowledge of the team, and that he didn't trust one of his 'senior' programmers to do some of the bigger parts of the project. Great.
This lead to having a, rather long, chat with the agency bloke (let's call him pete) who sorted out this job. I explained my feelings about this being a code monkey job, and feeling that was a step backwards. I also said about some of my reservations with the project (although didn't mention the peculiar management style). Pete, understandable, wanted me to say what I was going to do about the situation. Didn't mention job interview at this stage, as it's not certain, and the job is in a different arena from what I'm used to. Said I'd get back to him on Monday.

So, really, the new job isn't working out. There's so many things - mainly little things that probably seem petty, but they all add up. I don't want to be in the situation where I was 2 years ago where I was basically just surfing the internet all day and work, bored off of my brain box, and feeling really annoyed when anyone asked me to do any work. Conversely, I don't want to be in a situation, like at my previous job, where I didn't get support from higher up the food chain.

I'm a bit stuck to know what to do. In a way, I'm a bit narked. I didn't take the other job I'd been offered because I thought it might be what this job has turned out to be. However, at least with the other job, I would have had exposure to a forward looking team, rather than a whole company who reward long service rather than performance, and have a very much 'one size fits all' approach to working terms + conditions. If the company can't realise that the programmers have no need to be treated the same way as call center staff, then I don't really feel that encouraged that they'll meet my needs.

I realise this is a long, rambling post, but I needed to get some of this off my chest. I'll probably try and revise it tomorrow, but I should at least be able to get some sleep now.

Saturday, March 04, 2006

One Week In

Now that I've had one week in the new job, I must say I am a bit disheartened. There are a number of things that I'm dubious about, and other things that I'm downright outraged about.
The way the project is working is traditional waterfall model (oh no!), and the closest they've heard of agile methodologies is RUP (which, I didn't think, was an agile methodology).
What this means is that there's a business analyst (ba), who's creating use cases, which are then passed onto a project manager (pm), who then creates a project plan. Each use case has a time period associated with it (usually 5 day), which has been decided in association with the programmers.
When a use case is scheduled to start, there's ONE person who's creating the basis for it (more on this later). Then the programmer comes along and does the rest. In the programmer's schedule (well, included in the programmer's allotted days) is consultation with the users about the prototype. Any issues that arise that can't be fitted into the timeframe are written down and go back to the pm.
So far, so good?
Well, no. What this means in practice is that the ba creates a very vague description of what the system needs to do. The programmers have a pie-in-the-sky guess at how long this is going to take, and this gets written into the schedule. Then, once the programmer comes to start work on the specific functionality, they still have analysis to do, and this, inevitably, comes up with more work, that can't be fitted into the schedule, as the schedule is due to finish in Q3 2006. The programmer does their best to facilitate and changes in their allotted time schedule, which inevitably means they run over, which means the schedule is now behind.
At the moment, on the schedule, there's about 4 weeks for 'integration testing' and bug-fix, along the way. (I think this should be a continuous thing, but oh well). What this means, exactly, is anyone's guess, but they're now talking about using this time to work on the functionality that they've not got time on anywhere else. (ARGH).
On top of this, because of the dependencies in the project, when one use case runs over, it means that some others start late. In reality, this means overtime (which, frankly, I'm not prepared to do. Most of the programmers already work 20 minutes extra a day, which adds up over a week).
As well as this, there's only 1 programmer working on the old systems, which seem to need someone on them full time. He's got work scheduled in for the project, and because he's the junior programmer, and knows little, if anything, about the old systems, needs a lot of support, which uses up other programmers' time too. (I can see this being a real problem, especially as he's meant to be working with me on my items).

On top of the project side of things, they've asked me to take out my earring, because it's in an usual place, whilst other people (both men + women) are allowed to have more traditional lobe piercings.
Working hours is another issue. The contract they sent me states 37.5hrs a week, to be worked between 0800-1800 Monday to Friday. I, foolishly, took this to mean flexi-time. No fucking chance. The team manager (who's not the pm, so I can already see a conflict in interest coming on), stipulates that all the programmers work the same hours, which are 0900-1730, with an hour for lunch (which, frankly, I struggle to fill). This is extra annoying for me, as the trains mean I usually arrive at work at 0840, and leave work about 1745. That's an extra 35 minutes of work a day. I can't take the car at the moment, as it's busted, but I'm loathed to drive into work anyway (most of the other programmers drive 60 miles a day for work). I suppose I could cycle, but, at the moment, there's snow on the ground, (my least favourite cycling condition).
Oh well, at least, given my last job-search experience, it shouldn't be to hard to find something else if I decide this really isn't for me. (I shouldn't be saying that after only one week).