Sunday, January 16, 2011

Fish Fight

Just watched Gordon Ramsey Shark bait. It quite upset me, sharks are amazing creatures so it was shocking to see the industry behind shark fin soup.
I remember diving and seeing sharks was incredible. The fact that they could be driven to extinction in the next few decades, and the manor in which the fins are extracted, cut off the live animal which is then thrown back into the water was harrowing to watch.
Personally I have never eaten shark fin soup and after seeing that video I would never. Anyone wanting to know more take a look at the shark trust and Channel Four big fish fight.

Tuesday, January 11, 2011

Tricks with Chmod

Found a helpful blog post with some tips on using chmod.

Just saved me ages in scripting time, excellent!

Monday, January 10, 2011

Sort Classes C#

I had a problem in C# where I needed to sort an array of classes based on one of the properties. It posed several issues, firstly the class definition came from a web service I wasn't in control of I couldn't implement IComparable which would have allowed me to use the sort routine. I suppose I could have made my own structure that implemented IComparable but given this was a quick fix I used a simple bubble sort. Not very efficient but simple and robust and given the datasets are usually less then 10 elements (and never more than 26) should be efficient enough. NB this is a cut down version that runs as a console application.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BubbleSort_2
{
class Program
{
///
/// Simple Structure to represent insight
///

public class insight
{
public Name_match_indicator nameMatchIndicator { get; set; }
}
///
/// Name Match Indicator, this is from the Equifax Project
///

public enum Name_match_indicator
{
A = 0,
B = 1,
C = 2,
D = 3,
E = 4,
F = 5,
G = 6,
H = 7,
I = 8,
J = 9,
K = 10,
L = 11,
M = 12,
N = 13,
P = 14,
Q = 15,
R = 16,
S = 17,
T = 18,
U = 19,
V = 20,
W = 21,
X = 22,
Y = 23,
Z = 24,
}

static void Main(string[] args)
{
Random random = new Random();
string tmp;
// array to hold values
insight[] a = new insight[10];
for (int i1 = 0; i1 < a.Length; i1++) { //Generate a random character tmp = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65))).ToString(); a[i1] = new insight(); //convert random char into Enumerated type a[i1].nameMatchIndicator = (Name_match_indicator)Enum.Parse(typeof(Name_match_indicator), tmp); } // number of elements in array int x = a.Length; int i; int j; insight temp = new insight(); for (i = (x - 1); i >= 0; i--)
{
for (j = 1; j <= i; j++) { //Make the Comparison if (a[j - 1].nameMatchIndicator.CompareTo(a[j].nameMatchIndicator) > 0)
{
// if they arnt comparable switch them.
temp = a[j - 1];
a[j - 1] = a[j];
a[j] = temp;
}
}
}

for (int k = 0; k < x; k++) { Console.WriteLine("{0}. {1}", k, a[k].nameMatchIndicator); } Console.Read(); } } }

Fibonacci Series Program using Recursion in C#

According to Wikipedia the Fibonacci numbers are the numbers in the following integer sequence:

0,\;1,\;1,\;2,\;3,\;5,\;8,\;13,\;21,\;34,\;55,\;89,\;144,\; \ldots\; (sequence A000045 in OEIS)

By definition, the first two Fibonacci numbers are 0 and 1, and each subsequent number is the sum of the previous two. Some sources omit the initial 0, instead beginning the sequence with two ones.

C#.NET Tutorial, C#.NET Basics - CSharpTalk.com: Fibonacci Series Program using Recursion in C#: "Fibonacci Series Program using Recursion Code"

The security gadget that UK bankers want squelched

The security gadget that UK bankers want squelched.

Sunday, January 09, 2011

Pounding

It was Andy's leaving do last night. We went to the Deaf Institute on Grosvenor Street.

I was a good evening lots of people turned out to wish him the best. I had a good chat with Ian, about the perils of long distance relationships and many others things. Dave and Claire were there, digging into some pita bread as I arrived. Its the first time I have met them since they got engaged.

I asked Andy if he had managed to learn any Chinese, he told me the only thing he learned so far was the word for dog, so that he could check that is not what he is eating! I think its more Korea that you have to worry about eating dog, though the Chinese do appear to eat pretty much anything.

Danny arrived later on with a wonderful hat. I haven't seen him for ages, and he appeared to be in a very good mood.

I cannot remember a huge amount about the evening, probably to do with the large amount of alcohol I imbibed. I caught a cab home with Ian, after a quick kebab in Abduls. Which actually turned out to be the biggest kebab I have had for a long time, I couldn't even finish it.

Friday, January 07, 2011

Show Solution in Visual Studio 2008

I recently converted all our projects to use Visual Studio 2008 (a bit behind I realise!) I needed to add another project to a solution however for some reason Microsoft have defaulted Visual Studio not to display a solution if there is only one project. Fortunately this can be redressed following the advice here

Sunday, January 02, 2011

Your Protector

Yesterday we went round to my parents for dinner for dinner. My parents made us a beef and yorkshire pudding dinner. It was really very tasty, we both enjoyed it very much. I love my parents house at this time of year, sitting in the living room warm by the fire.

We felt very lazy today, we stayed up last night watching bad movies on TV. So I made a nice spoiling breakfast of bacon and eggs then we played a bit of Super Mario Bros Wii. I have never really been into it but started playing it with Kath.

Andy G came round to pick up his data. I have been recovering it from Emily's old PC. The copy took a couple of hours, while we played Wii Sports. Kath surprised us both beating us at bowling, while Archery expert proved difficult for us all.

I just made dinner, tonight we had a stir fry and a bottle of White wine. Then we had some of Kath's amazing carrot cake with ice cream, heaven! Kath even took pity on me and did the washing up what an amazing girlfriend :)

Saturday, January 01, 2011

Night Terror

Last year I spent New Years Eve in Poland. This year I struggled to decide how to spend it. In the end decided to stay in and invite a few people round. Kath and I went out to Stockport to buy some nibbles ad alcohol. It was very busy people going crazy for the offers, 10 cans for £7.

We got back from Stockport and rearranged the furniture and put the nibbles out on the table. With just enough time for a quick sit down and a cuddle before anyone arrived.

Joe and Holly arrived first. Jo was driving as they planned to leave in time to celebrate midnight with Holly's mothers.

I tried to get the Wii on the go unfortunately Jo thrashed me at bowling and I managed to whack Kath with the remote. The Wiimote jacket stopped it hurting her but the sound of the impact was quite loud.

Phil and Caroline arrived next, ladened with Alpha, Archers and Cheesecake. Later in the evening after we had been snacking for a while Phil picked up a can of Beer and exclaimed "there is cheesecake in my beer!". It amused me so much that I made it my Facebook status!

At the stroke of midnight we headed out into the Garden to enjoy the fireworks. The firework display scared Cocoa. She had spent the evening being the centre of attention, with everyone using the mouse on a string toy to torment her. She seemed happy to have lots of play and to get lots of strokes and attention.

We toasted New Year with the Champagne that Martin and Charlotte gave me as a moving in present. The sky was full of Chinese lanterns and fireworks.

I tried to get Phil and Caroline a taxi home but the firs three numbers I called were busy and the final firm the guy actually laughed when I asked for a taxi, customer service Fail! Fortunately the distance to Phil's house is not much further than my parents so it should not have taken much more than an hour to get home. Plus the weather has improved finally with positive temperatures.

Sunday, December 26, 2010

In Sleep

Christmas Day I went round to my parents. I decided to walk, it was quiet refreshing in the snow and cold.

The walk takes about 50 minutes though there is the rather steep climb of Deanwater hill at the end. I as I crossed the bridge over the river Bollin, looking down the River was frozen over. I had never seen it Freeze before, but such has been the cold snap this year it was.

My parents did the full works of turkey, roast potatoes, roast parsnips home made chestnut stuffing, pigs in blankets, home made gravy, all very tasty.

After dinner I sat and watched TV with Storm, resting my rather overfull belly. I watch Casablanca a black and white classic. It is actually a very good film with some incredible characters and lines.

After that I headed home, had a few beers and watched from Paris with love. An enjoyable action film with John Travolta as an asskicking secret agent. Normally this is not the sort of film I would enjoy but as a brain off enjoyable film that didn't take itself too seriously.

Over And Out

Last Christmas Eve I went out to Bramhall and it was a bit of a disaster as the poor weather saw very few people turn out to Beluga in Bramhall.

This year we decided to go to the Governors House in Cheadle Hulme. Bruce picked me Nick and Ian up and we arrived about 8. The place was packed, several deep at the bar. Joe and Holly were already there nestled in a quiet corner. The only place we could all find to sit together was in the front room unfortunately there was a band setting up there. We started chatting catching up while more people arrived. The queue for the bar became 30 minutes. Bruce told me not only couldn't you get to the bar once there it was almost impossible to get back through the crush of people.

Then the band started up. Now firstly the were incredibly loud. So loud we were virtually unable to speak to one another. The band themselves weren't bad, however the choice of music was a little odd. I like Pink Floyd but I am not sure that they are the right sort of music for a Christmas Eve party. Most songs people requested were denied instead we were treated to a series of rather self indulgent (for the band) power ballad type songs. So unable to get to the bar or hold a decent conversation there evening got pretty old fairly quickly. By 11.30 we and (most other people near the band not that it gave them a hint left).

I hope we don't have some sort of Christmas Eve curse doomed to have rubbish Christmas eves! Next up of New Year, Kath will be here then so I want us to do something enjoyable, not sure what though, would welcome ideas!

Saturday, December 25, 2010

Pieces of what

Feeling a bit rough today, fortunately working from home so able to cope. I went out last night for a few drinks at the Magnet in Stockport. Due to its high level of Chav Scum I wouldn't normally entertain drinking Stockport, however this place is pretty special. They had a very nice Christmas, called Champagne Christmas Ale

They had a excellent range of beers on tap, it was a friendly place. They also do a nice line in Pork pies :)

I had been invited out to meet up with some friends back from my school days. Was really a fun evening catching up and reminiscing about old times.

Wednesday, December 22, 2010

Do You Want It All ?

Who knew condensing combination boilers were at risk from frozen condensate pipes? I woke up in the morning to a freezing cold house, the temperature outside was sub zero. There was water dripping from the bottom of my boiler (Valliant Ecotec), and a message on screen error F.28. I looked up in the manual and the error meant that the burner could not ignite. At this point I had visions of very expensive parts, assuming of course I could get anyone to come out at all.

I had Cocoa booked in to see the vet at 9.30. She needed her booster vaccinations and a general checkup. Her last vet was in Altrincham, and though her was very good it was very stressful to take her so so far stuck in a cat carrier. So this time we went to a more local place, in Handforth. Cocoa is a house cat so I was told I probably wouldn't have to treat her for fleas. Unfortunately it appear this is not the case as the vet found signs that she has managed to pick them up from somewhere.

So by 10am I had a broken boiler and fleas! Given the time of year and the poor weather all the plumbers I called were busy. I was starting to worry I would never find anyone, however I managed to find someone. I called up a local plumbers merchants and got a few numbers from them. So I finally got a plumber and after a few minutes they worked out the problem. The pipe that carries the condensate outside was frozen backing up water into the burning chamber. A few minutes with a blow torch heating was restored. I'll know what to look for next time, and I have already lagged the pipes to try and stop them freezing again.

Friday, December 17, 2010

Chilli Freak

Patents on software are something I have argued against for a long time. Apart from stifling innovation. Copywrite protect developers while patents grant a monopoloy sometimes on vary spurious grounds for 20 years. I also appears that only large companies are able to enforce patents anyway. The register has this article patents do not protect small firms/.

Civilisation 5 Patch now out

Firaxis is launching a massive patch for Civ 5 which addresses a lot of the criticisms about he clueless AI. This patch list has so many fixes but one of my personal favourites is
"New “Angry Genghis” loading screen (replaces the “fluffy-bunny Genghis” loading screen)."

There are also some fixes to reduce the memory footprint so hopefully that will stop the game from crashing later on (something which has all but stopped me playing.

Some commentary on Ars Technica here

Tuesday, December 14, 2010

Hannibal

Ever needed a fake number but worried about making one up that is actually somebodies real number? Ofcom has the answer, a list of Telephone Numbers for use in TV and Radio drama programmes

Friday, December 10, 2010

The lighthouse

Yesterday was full of unexpected surprised. I got two presents, Kath bough me a new sports bag. My old one was literally falling to bits, I have been uysing it since I was in high school. She got me a nice new Puma one, I really like can't wait to try it out at the gym tonight.

I also got a second parcel from Lulu. She sent me a CD with photos form her wedding and a cap from the Shanghai expo. I didn't have a chance to check out the photo yet so more on them later.

Not sure where this year has gone too, seems to have gone by so quickly, already nearly Christmas. Fortunately thanks to the internet I have already bought all but a few presents.

Thursday, December 09, 2010

Dry and Dusty

Ars Technica have an interesting look of the effect of cognitive dissonance . For those not familiar cognitive dissonance is the state of mind where you hold two conflicting views on a subject. This can be anything from buyers remorse after an expensive purchase, you wanted it but are then guilty. The study had people in an MRI scan while rating items then having them compare items with the same ratings. All goes to show the brain is a strange and complex beast.

Wednesday, December 08, 2010

Old Stone

Just in case you were worried about getting sued after clearing the snow away from your drive, the government have helpfully produced a best practice guide
There's no law stopping you from clearing snow and ice on the pavement outside your home or from public spaces. It's unlikely you'll be sued or held legally responsible for any injuries on the path if you have cleared it carefully. Follow the snow code when clearing snow and ice safely.

Tuesday, December 07, 2010

Profiler for Mono

Saw a great blog about writing a profiler for Mono. I would love to use something like this to profile our software. One day I will.