Tuesday, February 20, 2007

Cars

There was someone on the radio yesterday morning talking about the expansion of the London Congestion Charging Zone, and arguing that it was pointless, and that it's wrong to charge people to use their own cars.
This is very much in line with the 1.5+ million people who've signed the petition against charging road users per road use.
The fundamental issue in this seems, to me, to be about whether it's your right to use your car as much as you god well like.
This is the mindset that the years of Thatcher rule has instilled in us, providing society that, without a car, you are nothing. This mindset pervades pretty much everything.
However, if we take the view that simply owning a car does not mean you have the right to drive it, then things like Congestion and Pay Per Use make a lot more sense. You have to buy your right to use your car. If the cost of ownership remained about the same, but the cost of using your car suddenly skyrocketed, you'd have to whether it was worth it everytime you got in your car. Similarly, if you consider using your car a priviledge, not a right, you spend more time considering every journey.
Obviously, all of this is completely pointless without a reliable public transport system, which is the one thing we don't have in this country.
I honestly thought I had a coherent thought about this before I wrote this.

Monday, February 19, 2007

openssh-server

If apt-get offers to remove openssh-server, don't let it - especially if that's only method of accessing that server*.
* I felt really stupid when I did that this morning.

Wednesday, February 14, 2007

Intelligence

Hmm, something I read pointed to this intelligence test. I got 14 before I had to cheat (and yes, all the answers are on the internet, and quite easy to find). The test's creators say that a score of 14 = intelligent. I'm happy with that.

Monday, February 12, 2007

Whisky Tasting Night

Well, it finally happened. I finally managed to spend a weekend with some of my friends from SDL (I worked there 2000-2001). Seeming as one of them is the two readers of my blog I feel like I'm talking to people who already know about it, but this is as much a document of my life as for anyone else.
I managed to take a 12 year old Aberlour, bought from the web, and a 14 year old Scapa, bought from Czerwik's in Brighouse.
We started off with Chris' Highland Park, which is one of the ones I remember most. We then had a Japanese one, and had a period on some Speyside ones. This included the Aberlour, which tasted quite mellow by comparison to some of the others, but was plenty drinkable.
Along with some of Bill's wonderful homebrew, the exact order of what followed eludes me, but I can say with certainty that I did enjoy it, and chanting "Tim Howson", playing digeridoo, and feeling utter dispair at the fact that Chris owns a telecaster that he just keeps hung on the wall, all made for a great evening.
Sunday was understandably mellow. We ended up walking around a fair bit of Sheffield trying to find somewhere to get some lunch. This was hampered by the fact that most places were full. We ended up going to a place called 543 (five four three, not five hundred and forty three). No vegan options, so I made do with chips and boiled brocolli, as I couldn't be assed fighting for a vegan dish. The other food looked real good.
It was nice to meet Chris' girlfriend, Liv (I'm shit with names, oh yes). She seemed nice, and didn't seem too disturbed by the fact Bill and I were acting very strangely.
Then I drove home, listening to a think about Guido Fawkes' blog.

Sunday, February 04, 2007

Scare

Well, good news, in a wish it wasn't kind of way.
Henry went out yesterday morning and didn't come back last night, nor this morning. In fact, he hadn't come back this evening at 5:30pm either.
However, he's back now. Little git.

Saturday, February 03, 2007

Bridges and Tests

Last Friday, a lorry hit a railway bridge and I thought I wasn't going to get home (the bridge was between work and home). This is because they had to get a structural engineer to go and check the integrity of the bridge before they could let anymore trains go over it.
Bridges have been around for a long time, and the tools and techniques to test their integrity are well established.
Fortunately, the bridge was fine, and I got home around the normal time.
However, I thought this might may a good analogy for why it is important to create automated tests for your code (I'd prefer unit tests and integration tests, but other forms of testing are equally valid).
Consider your code as being the bridge.
The trains are analogous to the data that your code processes.
The tools and techniques used by the structural engineer are the tests (hopefully automated) that your code has to passed before being released.
And the lorry? Well, that's a change in the code, such as an additional feature, or a refactoring, or maybe even a bug fix.
So, the question is, after the lorry hits the bridge, would you be prepared to let the trains continue to run before you'd thoroughly tested it for integrity?
Or, in coding terms, after you've changed your code, should you be prepared to let your it process data before it's been thoroughly tested?
If you have automated, up-to-date tests in place, you can easily test your code (bridge?), and get the trains running (data processing) going as soon as possible.
Without them? Well, it's a long hard night in front of the monitor for you and your testing team*.

*In most places I've work, the coders are the testers, so it looks like another, long, lonely night at work for you.

Monday, January 29, 2007

funny dogs...wet and cold...early morning...

ugh. Was in work at 7am this morning for a product launch. Went smoothly, which is a good thing, as early starts don't usually equate to a productive day.
 
Went to see The Hound Of The Baskervilles in Leeds at the weekend. It was bloody hilarious. The actors seemed to be enjoying themselves so much, and even had to stop themselves from laughing at each other at some points. It's had average reviews, and the gent who I was sat next to said that, during the opening week, it had been a little stayed. He also said that now that they'd got into it, they were ad-libbing a lot, and it was a lot funnier than before. I particularly liked that, at the start of the second half, they did the whole of the first half again, but in about three minutes. It was made more funny, as all three members of the cast had to do all the costume changes two, and half the time they were running on half dressed as the character. A few times, a member of the cast would come on stage out of character, and the others would continue acting, which added to the hilarity. The comedy was very silly, in a Monty python, plain-ridiculous type of way.
If you want to go and see it, it's at the west Yorkshire playhouse, at the moment, and then it's on tour (details here). I heartily recommend it.
 
Sunday I went out for a walk with Amy and her friend Lauren. We went along the other side of the Colne Valley, and got very wet. In fact, it was so nasty that we decided to take the shortcut down into Marsden, to the tea shop, and then walked along the canal home. It might be better to do that walk when you can see more than half a mile...
 
Also had vegetarian haggis for tea, which was quite nice. It was a bit peppery, but not too much, and really flavoursome. The only annoying thing was cooking it. We had roast veg with it, which meant we had to have the oven on too hot for it, so we poached in on the hob, for 45 minutes. Unfortunately, none of the rings on our hob goes low enough to keep a pan of water just below boiling, so we kept on having to move it about. There's some left over which I'm going to fry as patties.

Friday, January 19, 2007

Foundation Schools

This is a little late, but it struck me this morning...
In one of its possible translations, the name Al-Qaeda means roughly base, or foundation.
At the moment, Tony Blair is backing Foundation Schools.
Foundation = Al-Qaeda.
Therefore, if my reasoning is not wrong, Foundation Schools are Al-Qaeda Schools, and therefore, Tony Blair is backing Al-Qaeda Schools - a bit like the Yanks did before the World Trade Centre was destroyed.
As you were.

Sunday, January 14, 2007

Woohoo! Working tap!


Woohoo! Working tap!, originally uploaded by b3ardman.

Woohoo! Working tap!

Wednesday, January 10, 2007

Taps...fans...work

Well, back at work after a New Year's break, and it's been hard work so far. Everyone else is up to speed, rested after Christmas, so I'm feeling a bit like they're all just zooming around me...I'll soon catch up. Just you wait and see.
Looks like I might be able to get a replacement bit for the extractor fan in the bathroom. Got an email from the manufacturer which seems to say they'll send it out for free, which is nice.
The kitchen tap is turning into a saga. In fact, it's a three journeys to B&Q (as much as I hate them, they're the only place I can get to after work) saga, with more trips in sight. This just to fix a dripping tap.
I've tried replacing the washer, but the whole valve on one of the taps is fucked. I thought I had fixed it b padding it with a load of 'o'-rings, but no. It just stops turning off after a while, which is when I have to get turn the water off and take it all apart again.
So, I got a new valve for it (I thought I'd get a ceremic disc valve rather than a compression valve, as they apparently have a longer life and are less troublesome), but the spindle is too small for the existing taps head. You could be turning that baby forever without anything happening.
At the moment, the tap head is padded with some chopped up bits of elastic band, which at least lets us use the tap, but isn't really a long term solution. So, I'll have to get some more new valves, this time with the right size spindle. Which means another trip to B&Q. Oh joy.

Monday, January 08, 2007

Back at work...glad to be alive...wondering what other electrical surprises the house has for me.

Yesterday I learned the importance of turning off the electricity before playing with wires.
The extractor fan in our bathroom has not been working for a long time, I thought I'd take it apart to see if it could be fixed easily.
It's attached to the lighting circuit, but has its own fuse, so I thought removing the fuse would mean I could safely crack the fan open and work with impunity.
BANG!
The lights went out, and once again I'm glad that the trip switches are working as they should.
Turns out, the fuse bit for the fan had the neutral connected through the earth terminal, and the earth connected through the neutral terminal. So, removing the fuse meant I completed the circuit.
At least it explained why the thing had stopped working - the big resistor in it was complete black - presumably because the fuse hadn't blown.
So, in future, any work involving the electrics in the house, or even going near any wires, will be pre-empted by me turning off the electric at the mains.

Friday, December 29, 2006

I've got a new camera


I've got a new camera, originally uploaded by b3ardman.

It's a Canon Powershot A710 IS, and already I've killed the batteries that came with it.
So far, it seems great. I'm loving the 6x Optical Zoom, and the all round photo quality seems great. I'm going to have to play with it some more. I took a picture of a christmas card from across the room, and you can read the writing in it and everything.
It does up to 7.1 Mega Pixel, and, although I'll probably never really need that power, it seems sharp as anything, so lower resolutions will be even better.
It appears to be simple enough in Point & Shoot mode, but the settings can be played with and tweaked. And, as it's a digital camera, I can erase it and put it back into P&S mode when it all goes stupidly wrong.
Best of all, is that it's about 1/2 the size of my old camera, which will hopefully mean I carry it around with me more, and thus take more pictures.

Google logging in and out

My blog is with Google, and I use Google Reader and Google Mail. They all share the same log in mechanism. This is great, as I only have one set of credentials to remember. However, it backfires massively when I have blogger, reader and gmail open in different tabs, and then sign out of one of them. Suddenly, it all stops working. Google Mail and Reader and Blogger all behave differently in this situation. Blogger and Mail behave okish - both requiring you to sign back in somehow. But Reader just kind of silently stops working. The worst thing is that I have to sign into each app separately, rather than it picking up that I'm signed in again and getting on with it.

Thursday, December 28, 2006

Putting methods in the correct place

Object-orientated programming is all about encapsulation - the principal whereby an object exposes only what is needed by other objects and, by doing so, remains in control of its state.
For example, your Collection class exposes methods to add, retrieve and remove items, as well as a Count property, which indicates how many items it contains.


In real life, however, the concept of an Item or a Collection are way too abstract. For example, you might have a collection of stamps, trains, pc components, mobile phones, screw drivers, or you may have a list of things to do, telephone numbers or groceries to buy (a shopping list!). The terms "collection" and "list" need qualifying - what is it a collection of? What does the list list?
In your program, you no longer have a collection, you have a Pupil Collection (first example that came to mind). This is exposed as a property of your Class class.

You've got this far, and then you find you need to check if a Pupil is in a Class, so you write code like this:
public class Class
{
    public PupilCollection Attendies;
    //other methods
    public bool ContainsPupil ( Pupil pupil )
{
for ( int i = 0; i < Attendies.Count; ++i )
{
if ( Attendies.GetPupil(i) == pupil )
return true;
}
return false;
}
}
Then, a few days later, you find another class needs to see if a Pupil Collection contains a Pupil. So, you write that same method again. And then, in another few days, you find another class that needs to do the same thing. In fact, checking whether a Pupil is in a Pupil Collection is a really common thing.
So, what could you have done differently?
How about if, instead of having the Class iterate through the Pupil Collection, have the Pupil Collection iterate through itself, like this:
public abstract class PupilCollection
{
    public bool ContainsPupil (Pupil pupil )
{
for ( int i = 0; i < pupils.Count; ++i )
{
if ( pupils[i] == pupil )
return true;
}
        return false;
}
}
public class Class
{
    public PupilCollection Attendies;
    //other methods
    public bool ContainsPupil ( Pupil pupil )
{
        return Attendies.ContainsPupil ( pupil );
    }
}

And the next time you need to see if a Pupil Collection contains a Pupil, the code's already there. Your code looses a whole load of duplication, and reads nicer, simply because you moved a method.
In this case, we can start to think about things like specifications [pdf], and other more intricate designs, because we no longer look at the code for the Class and have to think about how it's doing what it's doing.

Using tools (and Code Smells)
I've been using Resharper for the past two years, and I can hardly use Visual Studio without it (well, I can, but I always get frustrated that + and ++R do nothing).

Its Extract Method option is probably the one I use most. Not only does this decide what to have as parameters for the method, but the majority of the time, it's "Declare Static" box is checked too - meaning that the method it will create will be a class level method.

When it does this, I take it as a sign to assess whether this newly created method wouldn't be better off somewhere else. Sometimes it doesn't make sense to move it, but often, just thinking about what the new method does means I put it somewhere more appropriate, and I find my code reads a lot better for it.

So, next time you see a static/class level method, ask yourself if it doesn't belong elsewhere.

Seasonal stuff

Happy christmas and all that kind of thing.
I can write some other stuff now.

Wednesday, December 20, 2006

Monday, December 18, 2006

Veg Box

I've had veg boxes from several different sources, and invariably they are poor.
I can understand that, in the winter, it's going to be hard to put together locally sourced organic food for the same price as during the summer (and I suppose I'm surprised the price doesn't reflect this), but they are invariably full of stuff that you don't eat - either because you don't know what it is, or because there's so many of them (e.g.: one massive squash that you'd not even think about buying from the shop).
Even the "best ever veg box" that Amy and I had (from Goosemoor Organics, who don't deliver to where I live now) still had a large celeriac every week. They did leave it out when we asked, but there were a few that turned runny before we actually got to eating them.
The other thing is that they are not tremendously good value. This true of organic veg in general, but I've found that, from a £25 "mixed" box, typically I end up buying another £5-10 worth of veg. This is sometimes simply because there weren't basic things like onions, but also because, being vegan, I tend to eat a lot of fruit and veg, and there wasn't enough variety in the veg box to keep me healthy.
We tried doing a veg box where we got to choose what we got. It was a nice idea, but it turned out that, because the supplier was so unreliable, we'd usually only get half of what we ordered. Very annoying, especially if you were trying to get specific ingredients. Also, we had to order the new veg box the day after we got the old one, so we'd have to try and predict what we'd need a week in advance.
It's hard to know what to do, as the best places I've found for organic fruit and veg are Beanos (Leeds), Beanies (Sheffield), and On the Eight Day (Manchester), so it's not really viable to go and choose my own veg unless I want a two hour round trip. (I know I work in Manchester, but Eight Day is about 20 minutes from where I walk, and then the stuff would have to sit in my bag for 3-4 hours before being bumped around on the train, and so would be unlikely to last very long. Getting things like tomatoes just isn't practical.)
I currently get one from Carnival Organics in Manchester (they only sell boxes), which is conveniently situated between where I work and the station. It's not great, but it's just good enough to stop me getting one.

Friday, December 15, 2006

Coffee

I haven't really been drinking coffee lately. I quite like coffee - not nasty NesCrappy, but freshly brewed coffee, preferably from fresh grounds (although they're usually not quite so fresh).
I have to take my hat off to Union Coffee Roasters <http://www.unionroasters.com/> for having made the nicest coffee I've ever tasted. The packets I've tasted are smooth and fresh tasting, and have a pleasant citrus element. The only places I've found to buy it are Waitrose (nearest is either Otley or Sheffield), Beano and Just Bean (both in Leeds). It's subsequently a bit of a treat when I do get some.
Since I've been tired, I've been drinking coffee everyday this week - I think it was three cups on Monday. It started because I was shattered after staying out late on Saturday night, then waking up early on Sunday morning. So on Monday I drank lots of coffee to get me through the day. Monday night I had about five hours sleep.
Tuesday was a busy busy day - was at work by 8am, and, after taking the cat to the vet's, didn't get home until nearly 8pm. Not much coffee drunk, and I took some Nytol before bed, and I slept deeply.
Wednesday, I had 1 cup of coffee, felt really bad when I got home from work, but managed to drag myself out to Yoga, and unsurprisingly, slept really well, (and I managed to get up slightly later than usual). I felt really awake yesterday (Thursday), but I still had some coffee, and didn't sleep at all well last night.
So, from tomorrow, I'm going to stop the coffee, and hopefully I'll sleep better.
Right now, I just need one more cup now to get me through the day...

Wednesday, December 13, 2006

Holmfirth

On Saturdays, normally I end up going into Huddersfield for groceries. Mostly, this is because I think that supermarkets are evil, and Saturday is the only day when I'm not at work and the smaller, local, shops are open. 
However, last Saturday, as well as getting my delivery from Black Isle Brewery (more on that in another post), Amy + I went to visit the cattery Henry will be staying in over Christmas, and ended up doing our shop in Holmfirth.
I've not really been to Holmfirth that much. It's where Last Of The Summer Wine was filmed around, and apparently the Café capital of West Yorkshire. Apart from that, I've never really had reason to go there.
I have to say, I was pleasantly suprised. Not only is there a respectable wholefood shop, called Your Nuts, but behind Your Nuts is a veggie, organic cafe called WOW. There are also a few green grocers, and we ended up getting the things we couldn't get anywhere else from Co-op, which is one of the less evil supermarkets.
So, from now on, we're going to try going to Holmfirth for our groceries on Saturdays (and probably squeeze in a visit to WOW too!).