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.