After much (fruitless) searching and reading trying to find a wireless adapter that works with Raspberry Pi (Specifically, one that works with Raspberry Pi running OpenElec XMBC) I decided to chance it a little and went for one I found on eBay that was reported to work with Raspberry Pi, but did not specify OpenElec XMBC.

Happy to say I plugged it it, configured the Wireless and it works!

I have included a photo of the one I am using below.

I am running OopenElec XMBC 12.0-RC3 Git:c47e925 released 03/01/2013

The WIFI adapters chipset is a Realtek 8188CU

Worth mentioning that many articles I read suggested that the SSID must be broadcast and not have spaces in it to work – Neither of these applied to me before I started, but something worth trying perhaps if you have problems.



SQL Server express is great – It lets me develop SQL databases on a system that very closely matches the ‘real thing’ for zero cost. One thing sadly lacking is profiler, which is a pain and in my opinion an odd move to leave it out. I use profiler on production systems for troubleshooting, and often during development when I have the luxury of working on a full SQL product.

I’ve found a workaround for this situation – Its far from ideal (i.e. Not as convenient or flexible as profiler), but does give you a log of server activity, which removes some of the uncertainty – e.g. At the moment I’m developing my first entity framework web site – I want to see what SQL queries the ORM is running on my behalf.

1) Connect to your SQL instance, open a query window, run: dbcc traceon(3605, -1)

2) Examine C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Log – You’ll find a log file for every day.

Raspberry Pi Recieved!

December 28, 2012

Got my Raspberry Pi today – Its been a long time coming too, after having one on back order for 10 weeks, giving up and cancelling then being unable to find stock, a friend emailed me Boxing day to say he had a brand new one going spare (Rev 2 with 512mb ram). Needless to say I snapped it up, along with an 8gb SD card.


I’ll be building it into an XMBC Media Centre, running Open Elec. I decided upon OpenElec against Raspbmc mainly due to the faster boot time, reported to be 45 seconds for OpenElec against 1m30s for Raspbmc. Another deciding factor was the install size – 900mb for Open Elec, against 3.7gb for Raspbmc. The other option was XBian, which came second place in my list due to the lack of auto-update functionality.

Read a great article comparing all three Raspberry Pi XMBC flavours

When writing SQL queries, there is a performance benefit to be had from qualifying the database schema (e.g. select fooField from dbo.fooTable).

I recently worked on a system where all SQL code was qualified with the database name – e.g. DatabaseName.Schema.TableName.

This in esscence is not a terrible idea – After all, it provides surity that we will always select from the correct database, but,  what happens we we want to rename the database? “I’ll never do that!” No? How about when you have a development copy on a server, and decide you want a second copy on the same server for some reason – Maybe testing two scenarios/builds, testing one one version whilst forward development occurs on the 2nd? Plus probably numerous other scenarios.

Basically – Don’t do it. I see no good reason for qualifying the database name in queries, although as ever I am open to friendly debate via comments!

I experienced a some what ambiguous Crystal reports error message today:

System.Runtime.InteropServices.COMException (0x80041811): Unsupported Operation. A document processed by the JRC engine cannot be opened in the C++ stack.
   at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
   at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()

Allow me to translate – Your report file (whatever.RPT) file is missing – In my case, I had published my site from Visual Studio, and the rpt file was not set to publish – So everything but my RPT files were published to the production server. For this reason, you may experience this error in production only – Whilst everything is fine back on the local development machine.

Arduino Hello World

October 22, 2012

I’m sat here looking at the mess on my usually tidy desk, comprised of LEDs, jumper wires, resistors and other such stuff…To be honest, I feel like MacGuyver right now!

I’ve completed the first two tutorials for my new Arduino Uno setup – Which came packaged as the Spark Fun Inventors Kit – So far, so good – I would highly recommend this kit – It comes with all sorts of goodies, including a 37 page manual – potentially the most useful item in the kit.

This slideshow requires JavaScript.

2-3 hours in, I have learnt how an LED works, what a resistor does, what an IC is, as well as learning what current means vs voltage and resistance and of course OHM’s law.

My second project is running happily along side me – 8 LEDs lighting on and off in sequence…Knight Rider style! I’ve got a few ideas brewing for projects, including one for halloween, and a pretty cool idea for Christmas too!

protected void DropDownListFoo_SelectedIndexChanged(object sender, EventArgs e)
    // Get the drop down list (Or any control that fired an event in the row we require the datakey from
    DropDownList dropDownListFoo = (DropDownList)sender as DropDownList;

    // Get the row the control was on (Its Naming Container)
    GridViewRow row = (GridViewRow)dropDownListFoo.NamingContainer as GridViewRow;

    // Get the DataKey value for the row
    int id = (int)GridViewFoo.DataKeys[row.RowIndex].Value;

    // Do something with id...

It seems that IE9, specifically v9.0.8112.16421 does not clear all cookies when you ask it to.
(Tools > Internet Options > Delete)

A fix to this, is to use the Internet Explorer developer tools:

  • Hit F12 to load developer tools
  • Cache > Clear Cookies for Domain

I recently had the following exception fire on a site I manage:

The specified string is not in the format required for an email addres
at: System.Net.Mime.MailBnfHelper.ReadMailAddress(String data, Int32& offset, String& displayName);

My immediate thought was to check the email address – Yup, valid!

The actual fix was to add the following to my web.config – Unfrotnatley I have no idea why this is required, as I was specifiying a from address within the C#. The email sent even came from the address specified in the C#, not the one I specified in the web.config.

        <smtp from=”” />

Object reference not set to an instance of an object.

Stack Trace:    at YourDataContext..ctor() in

This is caused by dragging a stored procedure/table onto the surface designer from a different connection in server manager to the one you used previously, which means the designer has used the new connection string (And created a new one in web.config), and the developer has subsequently deleted the connection string from web.config.

Solution: open the designer file for your datacontext (automatically generated file –  YourDataContext.designer.cs) – Around line 42 you’ll find a constructor (which takes 0 params), within this you’ll see a reference to the connection string in web.config – This will not match your actual connection string, change it to match and all should be good!

To avoid this in future, ensure that your connection in server manager is using the same server/credentials each time you add an object to the surface designer – e.g. Don’t drag sprocs/tables from a mixture of your live/development/staging/etc databases, stick to one database (Probably your development database) and add a connection string for the live one when you publish – Or better still, consider using Web.Config XDT (XML Data Transformations) to manage your connection strings between live/dev/staging etc which makes life much easier!

%d bloggers like this: