Tuesday, February 20, 2007
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.
at
14:00
0
comments
Friday, February 16, 2007
Wednesday, February 14, 2007
Intelligence
at
12:15
0
comments
Monday, February 12, 2007
Whisky Tasting Night
at
17:33
0
comments
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.
at
18:31
1 comments
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.
at
10:06
0
comments
Monday, January 29, 2007
funny dogs...wet and cold...early morning...
at
13:18
0
comments
Friday, January 19, 2007
Foundation Schools
at
09:40
0
comments
Sunday, January 14, 2007
Wednesday, January 10, 2007
Taps...fans...work
at
10:21
0
comments
Monday, January 08, 2007
Back at work...glad to be alive...wondering what other electrical surprises the house has for me.
at
09:43
1 comments
Friday, December 29, 2006
I've got a new camera
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.
at
15:39
0
comments
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.
at
11:34
0
comments
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 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 methodspublic bool ContainsPupil ( Pupil pupil )
{
for ( int i = 0; i < Attendies.Count; ++i )
{
if ( Attendies.GetPupil(i) == pupil )
return true;
}
return false;
}
}
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 methodspublic 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
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.
at
11:48
0
comments
Seasonal stuff
at
10:49
0
comments
Wednesday, December 20, 2006
I don't often post links, but...
Go and read "Code tells you how, Comments Tell You Why" on Coding Horror.
Go on.
at
09:17
0
comments
Monday, December 18, 2006
Veg Box
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.
at
10:57
0
comments
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...
at
11:37
1 comments
Wednesday, December 13, 2006
Holmfirth
at
10:10
0
comments

