Programming Tip #1 – The “Why Does That Work!?” Effect

Hi All,

Most of you probably don’t know but I was quite early to the world of development (started at 11), and one thing I always thought would go away in time was those moments where you look at your own code and literally have NO idea why it works. It will defy everything you know to be true, break the laws of computing and sometimes even physics itself.

10 years on I still find myself looking at my own code and going “What the hell!?” and have come to realise that in 99.8% of cases (authentic and obviously non-made up statistic!) it’s 2 bugs in my code balancing each other out to make 0 bugs. Sounds great right!? Bugs fixing themselves!! Wrong! And here’s why:

This is an inevitable slippery slope between the perception of “working” and the fact that frankly you’ve coded a timebomb, and in Britain, bombs are illegal.

Just because your code sneaks past the compiler’s rigid checks or Visual Studio in all of it’s fancy gloriousness doesn’t highlight the error of your ways, doesn’t mean you’ve coded the 1st bug free piece of software in human history. If you get the “Why does that work” feeling chances are maybe even months down the line you’re going to be debugging 1 fault that is the result of a chain of bugs down the line; and that’s not pretty.

Imagine this:

private void DisplayNumber(string Number) {

try {

int intNumber = Convert.ToInt32(Number);


catch {




obviously a very simple bug to spot, but no error is generated and the program will tell the user a number they didn’t even type in. You can imagine then if GetNumber was a function in a large program and it returned a completely different value to what the user specified but still looks as if it worked. Could be at least month before a company realises their financial department is sending out automatic invoices with the value of £0 attached to them ;).


Working Early.

Morning All!

So due to me getting rid of my car ready for the big move I have to “carpool” to work, which through an unavoidable series of events, gets me to work at 7:25am…

This means I end up roughly 1 hour and 30 minutes early for work, the funny thing is originally this was not a problem and I handled it quite well. but with each passing week I am starting to feel the pain. I have no idea why it’s going in reverse to the expected cliché of being unable to cope at the start and then getting used to it but it is most definitely wearing me down, I refuse to let it beat me!

So with that in mind I have decided to “Keep Calm and Carry On” so to speak, made myself a mammoth coffee (it’s almost a sludge) and will continue to stick it out by starting my work for “the man” early; something I am sure he will be extremely happy about!

I almost forgot, here is the standard hipster shot of my coffee with laptop:


Hipster Coffee

Hipster Coffee


Love, Peace and all things awesome,


Fast Development Series #1: Data Importer

The fast development series is about taking a real world project and highlighting some of the more useful features of that project and detailing how I accomplished them. You will NOT see the whole project from start to finish but snippets of the more useful bits!

Language: VB.NET

Client has expressed a preference for VB.NET due to having somebody on site who may be able to tinker with/improve the code in future.

Project Scope:

  • Imports into a specific database (ProspectSoft CRM) from any datasource.
  • Easy wizard interface so users can use.
  • A focus on spreadsheets.
  • Have the ability to save projects so imports can be saved and run multiple times.
  • While technical ability will be required to CREATE an import project any standard user should then be able to open and run the saved project.

Considerations for the Future:

  • Ideally I’d like to continue this product on to use a “modular” system, allowing the open-source community to expand the products it supports.

Libraries Used:


I have built the skeleton for this project which just allows the user to select an ODBC and provide a username and password and perform a test connection. The code for this is relatively simple – at the end of the project I will provide full source code. Below is how that first page looks:

First Page (New Project Wizard)

First Page (New Project Wizard)

Some of the key UI changes I have made since this screenshot was taken is showing the two groups as unexpanded initially and also the progress bars are only visible when the connection test is being run.

The configure buttons show a stylish popup window to the user allowing them to select their desired settings:

Popup Configuration Windows

Allow the user to input their ODBC details.

I have made a note in my development roadmap to expand this selection to include a FULL range of ODBC selection options, the less configuration the user has to do from within odbcad32 the better. Will not make this initial scrum though.

What am I adding this session?:

  • The code that performs the test connection.
  • How to gather schema from an ODBC connection (does not work for some connections)
  • Basic error handling
  • Asynchronous operations (using background worker).

Watch the video here of how I stumbled through the process (I blame a preference for C#.NET over VB.NET), or make use of the snippet below in any way you wish! :). Don’t hesitate to make revisions/comment me any tips or pointers! I am always looking to learn something new from a veteran.

Dim ViewCount As Integer 'Used for summary at the end
 Dim TableCount As Integer 'Used for summary at the end

'There are 3 stages to this connection test, the 1st is the initial connection.
 'For this we simply need a connection object:
 Dim DestCon As New OdbcConnection(Me.DestinationDSN & "pwd=" & Me.DestinationPassword & ";")


Select Case DestCon.State
 Case ConnectionState.Open
 bWorkerDestinationTest.ReportProgress(WarningLights.SuccessLight, "Connection opened successfully - attempting to download schema.")
 Case ConnectionState.Closed
 bWorkerSourceTest.ReportProgress(WarningLights.ErrorLight, "Connection cannot be opened please check your ODBC settings.")
 Case Else
 bWorkerDestinationTest.ReportProgress(WarningLights.ErrorLight, "Unsupported state detected: " & DestCon.State)
 End Select

Catch ex As Exception
 e.Cancel = True

bWorkerDestinationTest.ReportProgress(WarningLights.ErrorLight, "Error detected - " & ex.Message)
 End Try

System.Threading.Thread.Sleep(2000) ' Allow user to soak in information.

'2nd stage is to attempt to gather schema from the database
 Dim TableSchema As DataTable = DestCon.GetSchema(OdbcMetaDataCollectionNames.Tables)
 TableCount = TableSchema.Rows.Count

Select Case TableCount
 Case Is > 0

bWorkerDestinationTest.ReportProgress(WarningLights.SuccessLight, TableCount & " Tables detected.")

Case Is <= 0

e.Cancel = True
 bWorkerDestinationTest.ReportProgress(WarningLights.ErrorLight, "0 Tables detected, or an unexpected error ocurred")

End Select

Catch ex As Exception
 e.Cancel = True

bWorkerDestinationTest.ReportProgress(WarningLights.ErrorLight, "Error detected - " & ex.Message)

End Try

System.Threading.Thread.Sleep(2000) ' Allow user to soak in information.

'3rd Stage is to gather the views (people may use views to do their import more efficiently)

 Dim ViewSchema As DataTable = DestCon.GetSchema(OdbcMetaDataCollectionNames.Views)
 ViewCount = ViewSchema.Rows.Count

Select Case ViewCount
 Case Is > 0

bWorkerDestinationTest.ReportProgress(WarningLights.SuccessLight, ViewCount & " Views detected.")

Case Is <= 0

bWorkerDestinationTest.ReportProgress(WarningLights.CautionLight, "0 Views detected, this may be by design.")

End Select

Catch ex As Exception
 e.Cancel = True

bWorkerDestinationTest.ReportProgress(WarningLights.ErrorLight, "Error detected - " & ex.Message)

End Try
 System.Threading.Thread.Sleep(2000) ' Allow user to soak in information.
 bWorkerDestinationTest.ReportProgress(WarningLights.SuccessLight, "Table Count: " & TableCount.ToString & vbCrLf _
 & "View Count: " & ViewCount.ToString & vbCrLf _
 & "Destination database details gathered successfully")

Smartwatch Market Could Be A Third The Size Of The Netbook Market This Year (Maybe)

As a firm advocate of Google I really would quite look forward to a watch that synced with my Android devices. I don’t wear wristwatches, but that’s only because I haven’t found one worth wearing… Until now that is!

Can you imagine the ease of use as a reminder pops up on your watch? Text messages syncing to your watch?

Google’s voice recognition is so advanced I wouldn’t even mind having a crack at replying to that text message using my voice!

So much to look forward to in the coming years, the human race truly is wonderful at times.

Check out this well written article from TechCrunch for more details :).

Peace love and all things good,

Work In Sweden – Top 5 Observations



So admittedly I haven’t been searching for work long but I feel like I have already learned some major differences in how the Swedes and the British operate; all this even before the interview stage! So below are some of the difficulties I am having:

1. Everybody speaks better English than you.

It’s no secret to us here in England that we don’t speak ‘propa’ English, it gets even worse when you add in the different dialects and little quirky sayings we so often use. So much so nobody on the international English platform has a full grasp of what I am saying, as much as I do try to adopt a neutral tone in my voice, being from Birmingham it’s only a matter of time before I slip up.

2. Everybody speaks more languages than you.

You’d be forgiven for not learning another language if your first language was English (, why bother right? Pretty much everything is in your language, even China makes an effort to translate.


Arguably better English than my equivalent knowledge of Chinese… In any case I feel this has immediately put me at a disadvantage, even if knowing a second language has nothing to do with the job it’s still fucking cool right!?

3. Everybody is more talented than you.

Now I am not here to make excuses for myself but I’d like to think that if my university education could’ve been funded for WITHOUT the repercussion of me having to pay for near the rest of my life I’d have probably given it more thought and not been worried by the impending wrath of student finance England. In Sweden this is not an issue because education is free and provided for by the state, they EVEN offer this to EU citizens (bless you!).

4. A Different Upbringing and Better Culture.

I am still trying to come to terms with just how different the point of view is here in Sweden, compared to them, we Brits almost seem self-destructive – while Swedes do experience the same lows in life we all do they have this glorious ability to blame nobody but themselves. Come to Britain of course and it’s the PM’s fault, the governments fault, the fault of the police or even your neighbour. On a whole though, they eat better, they feel better and think better and all in all their outlook on life and how they live makes me feel frankly a bit of a twat.

5. Dedication

From what I can see in Sweden, there is no middle class; this does not mean not everyone has access to the upper class. The long and short of it is you either work extremely hard or you’re punished for it with an extremely hard life, and this kind of do or die life has bred some seriously dedicated people. In Britain it’s all too common to see somebody drifting through life not really going anywhere but still managing to live a comfortable life, this breeds ignorant contentment and a kind of comfort in not bettering yourself.

No doubt I’ll learn more as I go about just how difficult this whole move is going to be….

Wish me luck!

Love, peace and all things good,


First Internet Explorer. Now Search Engines.

EU Flag

The grand and glorious European Dictatorship, sorry Union… Yes it’s a union…

So a recent debate I have come across is the EU (poking it’s nose where I feel it doesn’t belong) this time into Google’s business, ironically acting on complaints (amongst others) from Microsoft despite how the EU have screwed them over in recent months.

As I have stated on my LinkedIn I am more than “all for” a little competition, but believe you can’t create some where there frankly IS none – Bing does little to convince me to switch from Google, honestly after doing a few comparison searches I can only really say it’s a re-badged Google in terms of search results with less features and a more in-your-face-interface and don’t even get me started on how far behind Yahoo are in the search arena.

So the real question is why does the EU feel like it has to FORCE consumers to see something they don’t want to see? I know there are competitors there as do others, and I will choose Google every-time and so will millions because they’ve proven time and time again to be reliable, fairly priced and in most cases first to the post! (Nobody else quite excited about Google Glasses?). It isn’t like they don’t make mistakes, God forbid would I ever pick their social media platform (What’s it called? Circles? Plus?) over Twitter and Facebook.

Needless to say when these changes are implemented and you are trying to find directions “Would you like to try Apple Maps instead?” is just another pop-up window to close before going ahead and using another fantastic product, it will be right there underneath “Did you know this site uses cookies?” right behind that window that just opened up asking “What browser would you like to install?”

Well done to the EU, not only for stifling good companies and their hard work but for increasing my chance of getting RSI from these various pop-ups you want me to close under the banner of fair competition!

P.S. To further promote fair competition perhaps Mac users would like an annoying pop up too asking them what various browsers they would like to install? Or maybe even iOS users would like a choice??

Love, peace and all things good,


VPC to Hyper-V Migration

Hyper-V Logo

Microsoft’s Hyper-V Logo for roll-out with Windows 8

As any business who is beginning to use Windows 8 will notice, it isn’t QUITE at the epitome of it’s excellence at the moment, but despite the downfall of it’s design, it’s function is leagues ahead of it’s predecessors (once you finally find where that function is).

As a developer that has experience in both form and function I can appreciate it is difficult to bridge the gap, so rather focusing on the negative I will say this: Microsoft got it right with Hyper-V! What a lovely surprise it was to find the difficult to manage VPC had been replaced by something as familiar to me as Hyper-V is, and with completely the same interface. If a developer is reading this I don’t have to tell you how much easier it is to manage your various environments in this Hyper-V console!

Migration however, wasn’t without it’s harsh lessons, so I have decided to post my experience here in order to help those in the same position. “Virtual Machine additions can only be uninstalled from within a virtual machine”, and of course Hyper-V integration features cannot be installed without first removing Virtual Machine Additions….An impasse we have reached Hmmm?

So knowing a little about MSI technology I had a feeling that all that was stopping me was a PreCondition function, something that makes assessments on whether you can install/remove/repair or generally USE the MSI before it actually bothers doing anything; annoying in the fact that I often found installers that didn’t recognize Windows 8 as a valid OS but when the check was taken out the software ran great.

Unfortunately I have no VM’s left to demonstrate this on so the pictures step-by-step are cut short, but for those familiar with ORCA this should be a breeze, so let’s go hack this out shall we?

Step 0.5: Download Orca (

Installer Folder (Step 1)

Installer Folder (Step 1)

1. Find your installer folder (generally %windir%\Installer)

Title to Explorer (Step 2)

Title to Explorer (Step 2)

2. Add the title column to explorer

3. Search for the MSI responsible for the VM Additions

4. Open it in Orca and find the table called InstallExecuteSequence

5. Delete the entries CA_CheckForRunningInsideAVirtualMachine and Error_CheckForRunningInsideAVirtualMachine

6. Save the MSI and try the uninstallation again.

In all fairness to Microsoft it does state in the migration instructions to uninstall the additions BEFORE migration. Just another bad case of the techie not reading the manual…

MS Warning

The quite clear instructions from Microsoft on their migration help document.


Love, peace and all things good,