Wednesday, November 08, 2006

SourceSafe has ruined my life.

Ok, so perhaps I went about this the wrong way, but...
Here's what I wanted to do: branch a project (well, solution) so that I can do some work on it that won't affect the main trunk.
Here's the problems: there's no "trunk" branch, so I can't easily branch the entire solution. There are 52 projects in the solution. Using Visual Studio 2003, SourceSafe, and ASP.NET Projects is like when you forget to wash your hands before going for a pee after chopping chillies - you don't notice anything straight away, but then it fucking bites.
 
My solution was to only branch the projects I needed to, which also meant branching the solution. It worked reasonably well, until I try and change the binding in Visual Studio, and get told "The operation has failed". How does that help me?
I've had to manually edit the solution file 20 times, and I still get problems with one project not loading properly.
 
God. My next project is using Subversion and TortoiseSVN. I might see about using AnhkSVN for convienience, but I've not had any problems without it at home.
 
That, and I'm buying "Pragmatic Source Control with SVN". Quicksmart.

Insulation

I spent most of Sunday putting more insulation in the loft. Despite the argument about climate change/global warming, nobody's denying that there are finite reserves of oil, gas and coal, and using less of them is subsequently a good idea. That, and the facts that the house gets really cold during winter, and that it'll save me money (possibly quite quickly), all seemed to make it appeal to me.
It was a relatively easy thing to do, but it did take about 5 hours, and most of that time was spent going up and down a ladder, and scooting about in the roof.
The real pain was that I couldn't get the whole rolls of insulation up into the roof, as the hatch is only about 30cm wide, and about 50cm long (yeah, I do only just fit up there!), and the rolls were about 40cm wide. There was also so compressed that I couldn't squeeze them at all. What I ended up doing was cutting up the rolls then having to partially unroll the pieces before I could tkae them into the roof. It was very messy, and I'm glad I wore a mask and gloves.
Our house was built in about 1890, and it didn't seem like much had been done up there for ages. There was signs of some rewiring going on: the original wiring was very neatly done and enclosed in pipes. TThe rewring was a mess of different gauges of wire (oh yes). There was one wire which I pulled and tripped out the whole of the lighting service. I was sure to neaten that up before I put the power back on. Apart from that, the main problem was the dirt: it was absolutely filthy. Some of this may have been soot, but I think a lot of it was general filth. Again, the gloves and mask were by friends.
Laying the insultation wasn't too hard - just strenuous. I found a length of pipe in the roof, which was really useful for pushing the insulation into the corners. The serated bread knife the last inhabitants left behind also proved useful: easily cutting through the insulation when I need to leave gaps for the chimey breast and loft hatch.
It was a messy messy job, and I ended up throwing away the old clothes I use for DIY - they were filthly and full of small bits of insulating.
So, was it worth it? I don't bloody know, as it's apparently been milder this week. Fucking weather.

Tuesday, November 07, 2006

Where does the day go?

In an effort to answer be question, here's what I did yesterday:

06:45: : Woke up got in shower, ate breakfast, blah blah

07:30: Leave the house

07:47: Get on the (8 minute delayed) train

08:35: Arrive into Manchester

08:50: Get to work

13:20: Go out for a wander at lunch time

14:00: Back at work

17:30: Leave work, and go via (argh!) Tescos on way to train station

17:57: On train

18:45: Arrive home. Finish cooking dinner (which Amy had already started)

19:10: Eat

19:30: Washing up/cleaning. Think I talked to amy for a minute or two

20:20: Running

21:20: back home, eat some pear and plum crumble, spend time with Amy + Henry

22:20: Go to bed



That's pretty much my typical weekday. Tuesday's there's not running, but I have to make the dinner, as Amy doesn't get back from work until late. And I don't have crumble every night.

That was a dull post, wasn't it?

Friday, November 03, 2006

SCOPE_IDENTITY() and ADO.Net

T-SQL's SCOPE_IDENTITY() always returns a "Numeric" value (this is a decimal).
 
If you're using ADO.NET, then you've got two choices:
 
Cast it as to the correct type in the consuming code:
(int) reader.GetDecimal
 
Cast it as an int in the T-SQL:
CAST ( SCOPE_IDENTITY() As int )
 
I'd favour the method second, as other DBs might not have this nuance.

Thursday, November 02, 2006

What Generous Friends I Have

I never realised what generous friends I have. I'm going to be running the Leeds Abbey Dash 2006, and I've set up a site on Just Giving (http://www.justgiving.com/darkabbeydash) and I emailed a few folks about it. I hope I'd reach the £25 minimum entry, but thanks to the generousity of my friends and family, I'm currently at £40. And that's without having to hassle people with a sponsor form or anything.
Thanks everyone.

Tuesday, October 31, 2006

less is more vs being polite

Simplicity is widely associated with reduction. In fact, in his book the Laws of Simplicity, John Maeda states the first law as being Reduce.
However, there comes a point where you have to stop reducing.
This is the same with emails, blog posts, newspaper articles, computer programs, and probably anything.
Take emails.
Compare:
The widget - where is it?
To:
David, Where's the widget? Thanks.
As you can see, there's very little difference in length, but the whole tone is different, and I know I'd be more inclined to reply swiftly to the latter rather than the former.
If you're going to send an email, be brief, but don't forget to be polite.

Monday, October 30, 2006

Visual Studio Developers need to get out of the IDE more

So, been in the new job for 2 months, and it's finally come to setting up my machine for development on the company's main project.
Is it a case of "svn checkout http://*****/mainprojectname", followed by "build"?
Fuck it is!
These guys have never left the IDE, so wouldn't know what a build script was if it came up to them in the street and gave them a big wet sloppy kiss.
So, what do I have to do to get this project working?
First: Get the Enterprise Library. Fair enough. Except the Enterprise Library doesn't build because I have NUnit for .Net 2.0 and not .Net 1.1. Fuckers.
Then the Localization Toolkit. Fine. Except I have to manually install bits of this (the WMI bits). Again - WTF?
Ok. So that's there. Except, stupid me, didn't realise I needed to install all this before I got the project from SourceSafe. Jesus.
Now I can't load half the solution because IIS is returning a 500 error for those projects. Fucking hell.
So, I'm now at the stage where I'm going to remove all the mappings from IIS. Unstall, then reinstall, Enterprise Library, get the solution afresh, and cross my fingers.
All for the sake of someone spending 1/2 a day getting it setup to work from a blank slate with open source tools like nant that can be put in the source repository.
I might have it setup by this afternoon.

Friday, October 27, 2006

rude words

Why are words like Fuck, Feltch, Shit, Cunt, Cock, Arse, Tit, Rim, Smeg, Rimmer, and Rectum considered to be grotesque, crude, offensive or inappropriate? Surely, that's like having a heirarchy of words, where words and phrases like "damn", "Bother Boots" and "Excuse me, my personnal area appears to have made a noise like passing wind" are higher up than their equivalent "Arse", "SHIT!!!!", or "fuck me, I've just done a fanny fart".
Who made up the rules about which words we can and can't use? Frankly, they should be taken out the back and given a good hard slap in the balls (let's face it, it was, undoubtedly, a man.) It's just wordism - descriminating against some words because of your own prejudicies rather than anything they have done.
If a word's in the dictionary, then surely it's as valuable as the next one, and we shouldn't be put into the situation where calling your boss "a cock-sucking whore" is any worse them questioning their commitment to their staff and their ability to manage an office of intelligent, yet somewhat disfunctional, humans. To be honest, sometimes, it's more fitting to call someone a "shit-sucking fuck face" than "a bit of a nuisance".
So, get with the mother fucking program you arse rammer: No more discrimination against swear words.

Firefox 2.0

I've been using Firefox 2.0 for the last few days. To be honest, I hadn't noticed any different to Firefox 1.5.0.7 that I was using. With one notable difference - Firefox 2.0 would randomly crash. So, bollocks to it. I've gone back to 1.5.0.7, and I'll hold off that oh so vital upgrade to things like Javascript 1.7 (like anyone's actually using that anyway.)

What's that on the left hand side?

Twitter now allow you to twitter via Jabber (and hence Google Talk). I can also show my latest twitter on my blog. So, for short messages, I can now update my blog the same as I chat to Chris, Gary or someone else. If you want more, there's my twitter page. Crazy.

Wednesday, October 25, 2006

The Perry Bible Fellowship

I know Chris has blogged about it before, but The Perry Bible Fellowship is one of my favourite comic strips. It used to be in the Guardian, but they axed it for some reason. Fortunately, I can still read it online, and there's regular enough updates to keep me hooked.
Sometimes I find the meaning of the strip to be vague on first inspection, but then I take time to look closer at it, and it reveals its meaning, more often than not to comic effect. I know jokes and gags are meant to be immediate, but I think that PBF (as it's known to those in the know) works by its opaqueness.
The only complaint I have is that the strips don't show up in the RSS feed, so I have to leave Google Reader and actually go to the site. I know this only takes 1 click, but the PBF site is a bit slow sometimes...
Anyway, if you've not done so already, go read The Perry Bible Fellowship (and then probably leave me a comment to the fact that I'm clearly a weirdo for liking it.)

Monday, October 23, 2006

New Google Reader

Google relaunched their RSS aggregator a few weeks ago. I was quite a fan of the old version, which was fairly simple - a list of all available messages down the lefthand side, and a big reading pane. Gary didn't like it, because it didn't allow you to view messages by feed, but I quite liked its simplicity.
Their new version is more like other aggregators I've seen - there's a hierarchical list of feeds down the lefthand side, and a scrolling list of messages. It works really well, especially the special functionality that automatically marks messages as read when you scroll past them.  It's still simple looking - a bit like Google Mail - but it works really well. There are two other screens: the home screen; and the all items screen. The home screen is a bit useless, as it only provides a list of the latest two unread messages... The all items is much better, showing all items, which you can filtered by read/unread.
There are two things I don't like about it: it doesn't work well with the SessionSaver/SessionManager plugins in Firefox - it invariably displays an error message when it's shown in a restored tab when FF starts up. It requires me to do a <ctrl>+<f5> to get it working again.
The other thing I don't really like is the "mark as read" check box - it doesn't really change when a message is read/unread. The "shared" icon lights up, the "starred" icon lights up, but the "mark as read" check box stays a very indistinct colour, and a difficult to see check appears.
The "Shared" items functionality is cool - you could do this with the old reader, but you had to do it by tagging messages with a distinct tag. It's much simpler now, and the integration with blogger beta is cool.

Sunday, October 22, 2006

Weekend End

Wow. That has to have been the busiest weekend I've had in a while - and certainly the drunkest one, seeing as I hadn't had an alcoholic drink since the beginning of September. The reason for this was Gary being over from China for a week. It was a bit unexpected, and certainly not the best of circumstances, but it was still great to see him - it's a bit weird when you see someone nearly every day, and then you don't see them at all for six months.
We'd already met for lunch in Manchester on wednesday, so I didn't stay out for that long on Friday night (I got the 2140 train home), and he was already drunk by the time I got there...not that I didn't try to catch up! The beer in the Victoria was quite nice - the Timothy Taylor's Landlord was good, and then I had a pint of a similarly bitter tasting one before I left. It was good to see some of Gary's friends too - I'd met most of them a few times before, and Antz is a really nice bloke.
So yeah, apart from the bizarre train home, which went about half a mile at 7 miles per hour before turning back, and then having to walk to a different platform and get on a different train, Friday night was pretty uneventfull. I'm glad I did leave early, as apparently they didn't stop until 4am on Saturday.
On Saturday evening, we went over to Leeds, and met Gary, Antz, Mike and Cate at Hansa's - one of my all time favourite places to eat. The food was amazing, as usual, and as usual, we all left feeling like we'd eaten too much. With it being Diwali, there were free sweets, the one I had tasted a bit like pistachio turkish delight. We had a chat, ate, and it was good. Anthony and Gary were both monged out...
Cate and Mike came back to ours to visit Henry and stay the night (not sure which order). It was nice to catch up with them, as we'd not seen them since the beginning of September, when they came to drop off Henry. They've just put an offer in on a house, which is quite an exciting time. They'd left by about 11am, and I've mostly pottered around and cooked today, although we did go out for a walk in the rain and discovered that there are allotments quite close by, and that most of them seem to be used, which is good in one way, as if we did get one we wouldn't have to fight against nature as hard as if it was all overgrown, but it also means that there might be a waiting list. Mind you, we've still got lots of house stuff to sort out before we should be thinking about getting an allotment.
The week ahead might be quite busy at work, with a project due at the end of the week - the three week project that's had about one week of work actually spent on it...oh well. Amy also starts her new job tomorrow, so it might be a bit hectic at home too.

Friday, October 20, 2006

email address regular expression

^[A-Za-z0-9!#$%&'\*\+\-\/\=\?\^_`\{\|\}\~][A-Za-z0-9!#$%&'\*\+\-\/\=\?\^_`\{\|\}\~\.]*@[0-9a-zA-Z\-]+(?:\.[0-9a-zA-Z\-]+)*$
complies to what wikipedia says on the subject

Why Refactor?

Because the aim of refactoring (in essence) is to reduce the amount of code, and less code = less chance for wrong code = less bugs.

Thursday, October 19, 2006

Wednesday, October 18, 2006

anonymous delegates in .net 2.0

This is a real quick sample of how anonymous delegates work in .Net 2.0.

your simple code:

delegate void test ();
public static void Main()
{
test r = null;
for ( int i = 1; i < 11; ++i )
{
int p = i;
test x = r;
r = delegate { Console.WriteLine ("{0}", p ); if(x != null) x(); };
}

r();
Console.ReadLine ();
}

gets translated to:
class tmpClass
{
test x;
int p;

public void Execute ()
{
Console.WriteLine ("{0}", p );
if(x != null)
x();
}
}

delegate void test ();
public static void Main()
{
test r = null;
for ( int i = 1; i < 11; ++i )
{
tmpClass tmp = new tmpClass();
tmp.x = r;
tmp.p = i;

r = new test(tmp.Execute);
}

r();
Console.ReadLine();
}

So, for this simple (contrived) example, you end up creating 10 temporary objects.
I really like the idea of anonymous delegates, but their use needs to be reviewed carefully.

Tuesday, October 17, 2006

Autumn. Yay!

I love autumn. It has to be my favourite time of year. Yes, it's a bit colder (it feels a lot colder at the moment), and, yes, I'll admit it's darker, and wetter, but I still love it.
Because the Sctoland trip was cancelled (boo!), I've managed to get out for a few mini day trips - yesterday to the Yorkshire Sculture Park, and today to HardCastle Crags and Hebden Bridge.
I love the sculpture park, and the James Turrell exhibition has been extended until January. I really do advise you to go and see it. Even if you've seen it already, going to see it again is still amazing. He's also go a permanent installation, in what was the deer shelter. This is so simple, yet so effective. It's essentially a hole in the roof, but the roof is so thin, and featureless, that it frames the sky, and makes it appear close enough to touch. It's as if it's a moving picture of the sky rather than the sky itself. The space is also so quiet, it was nice just to be sat in there, looking at the sky.
There's also an interesting Simon Whitehead exhibition - it's a bit wierd as it's about walks that he's taken, and there was a stuffed goose, which meant I had to leave before looking at videos and listening to the cds, but the book about it seems a lot more interesting, and given some guitar ideas to try (not with my aria though!).
We didn't really look at much else - just had a bit of a wander. It was a shame to see the absence of the Ronald Rae stuff, but I suppose it can't stay there forever. There were quite a few Shaggy Ink Caps around, but not where I could pick them.
HardCastle Crags was really pretty with all the autumn colours, and we saw quite a few mushrooms - as yet unidentified. Again, it was a shame to remember that the sculpture trail will no longer be happening, but it was still nice to wander around. We saw the biggest dog I have ever seen (it came up to my chest).
Hebden was a bit hippy-fied, but most of it was closed due to it being tuesday (they seem to open wednesday - sunday, which I suppose works better with the tourists). Saw Sam, and went to Organic House for lunch. It's an ok resturant (Amy liked it), but there was a feeble vegan choice (hummus, basically).
Yay, so get out and enjoy Autumn. Take your waterproofs, wear a jumper that you'll have to take off, and after a while come home and feel cosy, but, most importantly, get out and enjoy it before it turns into winter.

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.