Monthly Archives: November 2012

Microsoft Visual Studio 2012 and #disappointing lamda support #coding #programming #csharp

Two things I wanted in 2012, edit and continue on methods containing lambda expressions and also to be able to use them in the watch and immediate windows…

Modifying a statement which contains a lambda expression will prevent the debug session from continuing while Edit and Continue is enabled.

(new Object[] { 1, 2 })
[0]: 1
[1]: 2
(new Object[] { 1, 2 }).Select(x => x.ToString())
Expression cannot contain lambda expressions

Still disappointed!
Come on Microsoft, two features I’ve wanted since you first introduced lambdas, how long will it take?

Windows Forms or WPF UI updates from a different thread #coding #programming #csharp

OK, we’ve all wanted to update the UI from a different thread at some point, it is annoying, that damn exception you get…
{“Cross-thread operation not valid: Control ‘listBox1’ accessed from a thread other than the thread it was created on.”}

I tend to come back to the same approach time and time again, there may be others, but here’s an example I knocked up for a friend because this is easier to read than explain over the phone, upon clicking button1 I want to add some text to listBox1 without locking up the UI:

        private static void LogToList(SynchronizationContext ctx, ListBox listBox, String text)
            ctx.Post((t) => { listBox.Items.Add(t); }, text);

        private void button1_Click(object sender, EventArgs e)
            Task.Factory.StartNew((ctx) =>
                for (int i = 0; i < 10; i++)
                    LogToList((SynchronizationContext)ctx, listBox1, DateTime.Now.ToString());
            }, (Object)SynchronizationContext.Current);

For those who haven’t used it before, Task was introduced in .NET 4 under what is known as the Task Parallel Library (TPL), from what I can tell it is seen as the replacement for BackgroundWorker, but there’s no reason why you can’t do the same with a BackgroundWorker as we did before .NET 4.

In WPF I’ve previously also used System.Windows.Threading.Dispatcher.BeginInvoke in a similar-ish way. To get the Dispatcher instance, what you want is System.Windows.Application.Current.Dispatcher.

This also reminds me that if you’re doing a lot of logging / updating of a control then setting UndoLimit to zero is a good thing if you don’t want to leak / consume what can be vast amounts of memory for an undo buffer you don’t want or need.

I’ve not seen a Rohloff installed like this before, must have missed it #cycling

Checkout the Tollwut Stonedigga in action.

The best photos of the new wheels I could manage #cycling

No day light and free time to take decent photos, so a dark and gloomy shed is what I have…

This first one didn’t come out right, but I like it so I included it 20121123-215744.jpg

The full bike

The rear
Rigida Grizzly 26″ (559) MTB Rim – Black – 32 Hole with silver Sapim Race spokes

The front
Supernova-Mavic MTB Front Wheel Infinity S – XM 719 Hub Dynamo Center Lock/Canti


The new light
Busch + Müller Lumotec IQ Fly RT Senso Plus LED Front Light with DRL 174QRTSNDI.

I am very pleased to be back on Bluebell as the Nexus bike is plain awful, though it did OK as a replacement, so I shouldn’t knock it too much.

In summary, I’m happy with everything but I did want a bit more output from the Busch & Müller Lumotec IQ Fly RT Senso Plus.

Let me go into a but more detail…

Good points:

It is really nice is having a sharp rear brake, before it had to be fairly loose otherwise the wonky rear wheel would rub.

The front hub was like a clunky piece of crap in my hands, but when clamped into the forks the rotation is smoother, not completely smooth, there is noticeable resistance, but only when spining it on the maintenance stand, on the road I don’t notice a thing.

There are three positions on the Fly RT, so you can dip it down when you need more light closer to the bike e.g. bad weather. I really like this feature.

The standlight on the Fly RT is the two bottom DRL (Daylight Running Light) LEDs, not that bright, but they last long enough to give confidence and enough light to unlock the side gate and shed.


A spoke in my old (good) front wheel went ping as it just sat there in my lounge, I assume the spoke had sheared and was holing on by a hairs breadth, bringing it in the warm and changing tensions by deflating and removing the tyre must have pushed it over the edge.

The Fly RT isn’t very impressive, or maybe my Airbike is just more impressive, I was left underwhelmed. I’m sure it’ll be adequate for my needs as that extra spread the Airbike gives is wasted light anyway.

The Fly RT was a bit of a fiddle to fit because the bottom of the Orbit XL II headset on my Thorn Raven Sport Tour got in the way.

The modes on the light aren’t well explained anywhere, so here’s my findings:

0 – Off
T – Tagfahrlicht – DRL LEDs on, main beam slightly less
S – Senso – Automatic, same as T in daylight or night mode in poor light. Night mode is two DRL LEDs and the main beam on full.

I couldn’t see much difference between S and T at night so I probably won’t use the S mode as the DRL add a tiny bit of extra side lighting that I want (even more of).

The main use of duck tape? #cycling

There are many uses for Gaffer Tape, like fixing the kitchen blind as I am doing, but the box says it all….

Indeed my saddles are synthetic with holes in, it won’t be long before the gaffer tape comes in handy for them.

Sure, at some point I may spend on a Brookes saddle, but for now I’m stuck with what I have. The concern I will have with a leather saddle is the winter weather and being left outside while I’m in work.

The wait is over, two new wheels and a light #cycling

Finally, I’ve waited a long time for these wheels.

Firstly the lack of responsiveness, not replying to emails and forgetting to dispatch from bike24. They came good in the end, but beware if there’s a problem then you have to be patient and chase them up.

Supernova-Mavic MTB Front Wheel Infinity S – XM 719 Hub Dynamo Center Lock/Canti

Busch + Müller Lumotec IQ Fly RT Senso Plus LED Front Light with DRL 174QRTSNDI.


First impressions without riding it, the dynamo is clunky, huge resistance to wheel rotation, however I doubt it’s a problem.

The light will have it’s own review after testing, but the hub with very little rotation has enough juice to drive the daylight function, so it’s looking good so far.

Then there’s my laziness in sending off the Rohloff to SJS for a wheel build. Amazing service from them, they got the built wheel back to me within the same week, given they got it late on Monday, wheel guy was not in on Tuesday, they built it Wednesday and I had it first thing this (Friday) morning.

Rigida Grizzly 26″ (559) MTB Rim – Black – 32 Hole with silver Sapim Race spokes


The Rohloff sprocket was cracked, so I also had to buy a new one of those, it was only half worn, but better replace it rather than risk it.

The grizzly rim has an impressively large braking surface

But since I am a front wheel braker it’s neither here nor there.

So, tomorrow I put everything together, here’s looking forward to a rest ride in the dark.

It’s funny how they always credit (though it’s hard to find) an increase in cycling as a factor in the lower deaths in these sorts of articles. Yet at any other time they won’t be singing the praises of the transportation method.
What is the point of the article? Is it to fuel the fight against cars or is it to shame people who regularly use cars.

It’s not really a good news article unless car use continues to fall and cycling keeps increasing. The new cyclists better keep out of my way as I don’t want to be stuck in their traffic LOL

Surrey News

The economic downturn has dramatically cut the number of deaths on Britain’s roads, new research suggests.

Since Britain went into recession the number of people killed on the roads has fallen by more than a third, from 2,946 in 2007 to 1,901 in 2011.

The dramatic drop coincided with a general fall in traffic as cash-strapped motorists cut down on journeys, a reduction in drink-drive casualties as people sacrifice nights out and a drop in young males taking their driving tests.

According to the national research commissioned by road safety experts at Surrey County Council, other contributing factors included motorists cutting their speeds as they save fuel, rising prices at the pumps, an increase in the use of bikes and a reduction in HGV traffic.

Colder recent winters and advances in vehicle safety also played a part in making Britain’s roads safer, the Transport Research Laboratory (TRL) study showed.


View original post 312 more words