Monthly Archives: October 2011

What kind of idiot is best? My vehicle hate rule.

I was thinking, really, for once, what is worst:

A: An idiot walking
B: An idiot running
C: An idiot on a bicycle
D: An idiot on a motorbike
E: An idiot in a small car
F: An idiot in an average car
G: An idiot in a big car
H: An idiot in a massive/4×4 car

Naturally my decision is H, but then I do see a lot of idiots driving 4x4s, so maybe the two go hand in hand.

Cars do turn 99% of people into idiots.

I’m pretty sure people complain about C and D more than any other. And when they do complain about bicycles it will be because the cyclist is doing something the complainers think is really bad or dangerous (mainly) to the cyclist or even something they aren’t allowed to (or can’t) do in their cars. There is no defence for these cyclists and of course I don’t condone those cyclists’ behaviours (unless the cyclist is me), but car drivers are the bigger danger and nuisance, so please focus on that and of course remember that 99% of complainers are habitual speeders in their car thus endangering OTHERS in a much more severe way.

Of course I have no way to prove my percentages other than to say they are 100% correct and to swiftly move on from the subject.

My vehicle hate rule (doesn’t apply in cities – where everyone hates each other):
When walking I hate motor vehicles and rarely anything else (p.s. OK, add in dog poo).
When on my bike I hate motor vehicles and rarely anything else.
When in the car I hate everything except a few sensible lorry drivers.

Now, does the vehicle hate rule apply to you?
Think about it next time you are out and about and a car nearly runs you down or a car nearly drives into the side of your lovely (sensibly driven) car, how do you feel, what do you hate now, is it a cyclist? I didn’t think so.
You can try to keep score if you like, I tried on one drive to work, but the cars past 10 before I saw the tenth cyclist!

Advertisements

3 years cycling saved me £1845 in car costs

My biannual cycling mileage totals for the past three years:

2008 (H2) = 1600 miles
2009 (H1) = 1100 miles
2009 (H2) = 1400 miles
2010 (H1) = 1500 miles
2010 (H2) = 3500 miles
2011 (H1) = 3700 miles

of these 10060 miles were commuting miles or at least miles cycled instead of using my car, this roughly equates to £1845 (given the cost of petrol at the time plus 5p wear and tear per mile). Of course if I didn’t still have a car the savings would be three times this, but the car costs me money even if I don’t drive it anywhere!

The reality is that I took up cycling as my main hobby and stopped my other sporting activities, in doing so this money has paid for about half of my cycling hobby, which is a lot less than I was spending on either of my previous hobbies (football and badminton). Of course, most of the three years I’ve been collecting clothing, tools and a couple of bikes, so the hobby cost will keep falling (unless I keep buying bikes) and maybe even end up being a hobby that pays for itself (or even better; a hobby that truly saves me money).

SQL Server: See your print statements as they happen using raiserror

When writing long running SQL scripts the fact that a PRINT SQL statement is not immediately output to the Messages window can cause frustration and I can never remember the syntax for RAISERROR, so here it is:
RAISERROR('Hello there', 0, 255) WITH NOWAIT
See MSDN RAISERROR

Asynchronous code execution in .NET 2.0 – BackgroundWorker

When TPL (.NET 4.0) is not available and you want to asynchronously do some work you can resort to .NET 2.0:

BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += delegate(object s, DoWorkEventArgs args)
{
  // Do something here, any local variables you use will be cloned
};
worker.RunWorkerAsync();

See MSDN BackgroundWorker Class

Call private or internal constructors using reflection

Sometimes you want to get past the object oriented barriers that C# throws up.
A while ago now I wanted to instantiate a class that only had internal constructors, here is a useful snippet of how I achieved this:
// Use reflection to call private or internal constructors
Type ty = Type.GetType("assembly.name.space.name.myclass, assembly.name.space.name, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
ConstructorInfo ctor = ty.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic)[0];
var inst = ctor.Invoke(new object[] { param1, param2 });

Excel String concatenation

String Concatenation in Excel is just like VB, just ampersand the bits together e.g. A1 & “, ” & A2

Excel Replace with Substitute

In Excel if you want to replace a portion of a string with another string you might think Replace is the function to use, but it’s the Substitute function you need.
See Microsoft Online documentation