Archive for October, 2007

Oct 29 2007

Acquisitions

Published by under General,R1200GS

This past weekend I’ve been rather active on the shopping front.  First off, I’ve indulged myself and bought myself a new motorbike.  I had been thinking about getting a new one for a while now but, being my lazy self, I’ve not been bothered to do anything about it.  With my good friend Shane looking at getting a bike (possibly my Bandit 600) I finally got my act together.

BMW R1200GSWhen I started looking I was thinking about something like a GSX-R750 (again) or an R6.  Instead I’ve swung to the complete opposite end of the motorbike spectrum and have put a deposit on a BMW R1200GS.  I wasn’t looking for anything that big but I took one out for a test ride and have fallen in love with it.  Whilst it has got an engine twice the size of my Bandit, it is a lot more economical, most reviews seem to suggest it should manage 45mpg, so with a 33 litre tank I should be able to do 300+ miles.  That’s nearly double the range of the Bandit!  Now I just need to get the finance and insurance sorted out.

The other purchase was for the fish tank.  For some time now we have had a Gibbiceps Plec that was far too big for the tank – about 6 inches in a 45 litre tank.  So, this weekend we finally took him back to Bishes Fishes.  Unfortunately, getting rid of the plec meant that we lost out main algae eater, so we decided to get another smaller plec, although I can for the life of me remember the type.  As well as the new plec we also got two freshwater shrimps to help clean up the bottom of the tank.  As we were return the Gibbiceps, we got one of the shrimps for free ^_^

2 responses so far

Oct 24 2007

More Fun With QR-Codes

bomb I promise this will be the last post for a while to include a QR-Code.  If you don’t know what a QR-Code is, go read about it on wikipedia.  There are several QR-Code readers out there but I have personally chosen to go with the Kaywa Reader.  I also use the Kaywa QR-Code generator.

The reason for this post was to play with an idea I came up with after reading the Wikipedia article on QR-Codes.  One of the images they show is of an picture encoded into the code.  Whilst I haven’t yet been able to figure out how they encoded the image into the code I have made another discovery.  It turns out that QR-Codes contain a lot of redundancy.  It is possible to loose up to 30% of the code and still be able to read its content.

I’ve found that it is possible to paste an image over the top of the QR-Code.  My experiments so far indicate seem to indicate the image needs to cover less than 30%.  I haven’t had to time to find out how the QR-Codes are structured.  It may be possible in re-structure the data so that more of it can be lost to the embedded image.

Technorati Tags: , , ,

One response so far

Oct 22 2007

Now What?

Published by under General

semacode

No responses yet

Oct 21 2007

Daft Hands

Published by under General

I was finally getting around to catching up on Little Games from last month when I found this video on their site. I don’t normally repost videos but this one is quite incredible.

No responses yet

Oct 13 2007

Can I come?

Published by under Activities

qrcode

I thought I’d try a different type of blog post today.

No responses yet

Oct 12 2007

System.IO.Path.Combine()

Published by under .NET,Programming

Many, many times in my programming life I have seen people causing themselves all sorts of problems as the try and concatenate paths for file and directories.  They’re always trying to work if the path already ends with a directory separator or not.  And then there are the cross platform systems that try  to workout what the directory separator should be.

With the release of the .Net platform,  Microsoft gave developers that need to handle file system operations a wonderful, but underused, utility class: System.IO.Path.  One of the methods on this class is Combine().  It take two arguments: path1 (string) and path2 (string), and intelligently combines them.

That’s it!  No more messing around with string concatenation or endless if statements or figuring out if it should be a forward or backslash… just Path.Combine().

kick it on DotNetKicks.com

5 responses so far

Oct 10 2007

Debugging with Debug.WriteLine And StackTrace

Published by under General

I’m not sure if this is a well known feature of Visual Studio but it’s something I’ve used in the past and have just had need to use again.  When debugging an application in Visual Studio it is possible to use System.Diagnostics.Debug.WriteLine() or System.Diagnostics.Trace.WriteLine() to write messages to the output window in Visual Studio, I’m sure that’s nothing new to most .Net developers.

What you might not be aware of is the fact that if you output the full path to a file, you can then double click on the file name in the output window and it will be opened in Visual Studio.  Also, if you output a number in parentheses after the file name, Visual Studio will try to take you to that line number, e.g.:

C:\My Solution\Shared\ClientForms\Forms\frmRates.vb(547)

That’s great, but how could you use this IRL? I’ve just combined this with the System.Diagnostics.StackTrace class.  I have a method that gets called many times from many different locations in the code and, under certain circumstances, I’d like to know where the method is being called from.  You can use the StackTrace class to find out where the method is being called from, and the Debug.WriteLine() to output this information to the output window:

 1: StackTrace myStack = new StackTrace(true); 
 2: StackFrame lastFrame = myStack.GetFrame(1); 
 3: Debug.WriteLine(string.Format("{0}({1})", 
 4:                               lastFrame.GetFileName,
 5:                               lastFrame.GetFileLineNumber));

Normally if you are wanting to break out to the source code when you hit the line would probably put a break point, possibly with a condition, but sometimes you might not want to break execution and instead just want to record the fact that you hit that point and how you got to it, in which case this snippet could be useful.

kick it on DotNetKicks.com

4 responses so far