Something Different

AA Rates Calculator For Windows Phone 7

Submitted by Robert MacLean on Thu, 08/11/2011 - 11:10
16 November 2011: This application has had a major update, see the details in this post

marketplace-tileOne of the most popular posts on my website is the AA Rate calculation spreadsheet I built in 2008. The goal of the spreadsheet is you provide the details about your vehicle and it tells you what the AA Rate for your vehicle is. So I decided to rebuild this for Windows Phone 7!

This was a lot of fun because it has some complex issues (matrixes of values) which had to be solved, so that tickled my developer brain.

This also allowed me the opportunity to update the calculations since they change every so often which is important for you!

An interesting thing that I learnt with this release is that the official/documented calculations is NOT equal to what the AA online calculator does. So there is an option now called “quirks mode” which runs it equal to the online calculator where if you turn it off, it runs it using the documented mode!



Nugget: Little compiler optimisation

Submitted by Robert MacLean on Wed, 08/03/2011 - 11:28

Found this little C# compiler optimisation which is really cool. Here is start code

int y = 0;
int x = 10;

if (x * 0 == 0)
    y = 123;


If you know a bit of math, anything multiplied by 0 always equals 0 (line 4). So the compiler optimises that out and then because x is never used that is also optimised out and you end up with

int y = 0;

if (0 == 0)
    y = 123;

So very smart Smile

Presentation Dump - Mid 2011: Windows 7 API CodePack, Development for Nokia, Mercurial, VS Tools, AOP, Multitasking, Cloud

Submitted by Robert MacLean on Tue, 07/19/2011 - 14:05

The fact we half way through the year snuck up on me this morning, so it is time again to share some of the presentations I have done in the last 6 months! For those new to the presentation dump, every 6 months or so I share all the slides I can (some I can’t because they contain NDA info, like the one about Microsoft’s Project Double Rainbow) so that you can take these slides and work with them yourself!

So what is included in this dump:

  • Windows 7 API Code Pack: This was a very fun session to do since it was showing off a bunch of cool Windows 7 features.
  • Development for Nokia: This is maybe one of the best looking slides, but one of the worst timed sessions since shortly after it Nokia announced their move to WP7 so not much could be taken away from this Sad smile
  • Mercurial: This is a difficult session, because the demo’s are so boring (how do you make source control sexy?) – however a ridiculous amount of animation about process made this entertaining to create and present.
  • Visual Studio Productivity Tools: This one started off from the idea of answering the question CodeRush vs. Resharper – which is a bit of religious debate more than a this one wins. It includes a bunch of other interesting content about other extensions too. For non-South African’s “Braai Rules” is the same as saying “BBQ Rules” or “Pub/Bar Rules”
  • Aspect Orientated Programming: This is a big one for me as I see general development using more of this and the frameworks, like .NET, moving to it more and more in future. Good to get an early look into it.
  • Multitasking in applications: This session looks at one of the themes of .NET 4 – TASKS. Why should you care, because multi threading is complex, but multi tasking gives the same benefits with less complexity.
  • WebMatrix: Microsoft’s new tool for hobbyist web developers. What is included in that tool? This presentation tells you.
  • Welcome to the cloud: I had a great opportunity to present at Tswane University of Technology with Rudi Grobler on the cloud & mobile. This was a very fun session and allowed me to also talk about why BBD is such an awesome place to work.

Slides available in the post! Click below for more

Windows 7 API Code Pack

Development for Nokia


Visual Studio Productivity Tools

Aspect Orientated Programming

Multitasking in applications


Welcome to the cloud

Security is hard for users, so let us clean up with NEAT & SPRUCE

Submitted by Robert MacLean on Mon, 07/11/2011 - 13:34

Microsoft used to be a horrid company with regards to their security, then they sat down and made security a quality gate – we do not ship if security is wrong. How do they know what is wrong? A 24 page guideline with 68 bullet points?! Perfect holiday reading Smile with tongue out

The security development lifecycle team has recently tried to help us developers improve our applications so we not the next company with a bad security issues with two acronyms which will improve security notices to our users: NEAT & SPRUCE

What is NEAT?

  • N: Necessary – Only show messages that you need. If you can take a safe action automatically or defer the message, do that!
  • E: Explained – If you do interrupt the user, explain in everything to the user. EVERYTHING?! Yes, and the SPRUCE acronym will help explain what everything is.
  • A: Actionable – A message should only be presented to the user if there is steps the user can take to make the right decision.
  • T: Tested – A security message needs to be tested. TDD, Usability Testing, Visual Inspection, every test.

So, we need to show the message now – what do we put in there? SPRUCE:

  • S: Source – Why are we showing this message? Did a website do something or a file or a user action? Tell the user.
  • P: Process – Give the user the steps they need to go through to make sure they make the right decision.
  • R: Risk – Explain what the consequences of getting the decision wrong.
  • U: Unique – If your software knows everything, do the right thing automatically. So if you are showing the message, it means the user has unique information that is needed to make the decision. Explain what information is needed (slightly similar to P).
  • C: Choices – Show the user all the options and recommend the safer one.
  • E: Evidence – Provide any additional information that the user may need to make the decision.

Now that the training is done, let’s look at real implementations:

A web page contains secure & nonsecure content

Here is what the dialog looked like in the bad old days of IE6:


In IE 9 where this logic has been applied:


Let’s look at the differences:

  • N (Necessary) has been applied – previously this was a blocking model UI, which the user was forced to deal with to continue working. Today it shows discreetly with at the bottom and only if the user needs to work with this they have to, otherwise ignoring it.
  • E (Explained) has had been done with the What’s the risk? – which shows the dialog below. It is not perfect as it hasn't followed SPRUCE fully but it is a good improvement.
  • A (Actionable) has been applied – previously you had both a yes & no, now we have one action that can be done. Close or ignore and nothing happens.
  • T (Tested) there is some weird language issues with the old one especially if English isn’t your primary language because of the yes/no not being perfectly clear. The new dialog has a single very clear labelled button!

whats the risk


Now that we have looked at how it can help you and how to do it, attached is a nice simple 3 page document with more details and reminders about this. GO IMPROVE YOUR APPLICATIONS!


You do what at your job?

Submitted by Robert MacLean on Wed, 06/15/2011 - 13:44

imageI tweeted yesterday that my job can be a little weird because I had to sit in the kitchen at the BBD office and watch a TV for a while. This generated some confused discussion, so what was I doing?

Our team is experimenting with the idea of putting screens around the company to share content and information and I had to sit in the kitchen to make sure it worked by watching loop the content for a bit Smile


This is also a great opportunity to share some learning's from this with you:

TightVNC is still the best VNC option

Remote Desktop from Microsoft is THE best way to remote onto another machine but it has one downside, it locks other user out. For out screen we can’t have the login shown, and I don’t even know where it is to login manually – we need to see the content on the machine so we dropped to an older technology: VNC.

There is a lot of options in the VNC space, but ended on TightVNC as it actually runs as a service on a Windows 7 machine where other VNC clients run in the user space.

Auto Login to Windows

The login screen is also an issue with the machine when it boots and I don’t want to remote in every time to login – so we configured Windows to auto login to a specific account. This is thanks to the folks at Channel9 in particular Sarah Perez & Bradley Ward:

  1. Change the following registry key to 1: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon
  2. This enables the feature to be surfaced in Windows.
  3. Then run the following command: control userpasswords2
  4. In this UI you can UNTICK the option Users must enter a user name and password to use this computer and click OK
  5. It will then prompt you for the username & password to use and done! Note this is a bad security and so not recommended, but sometimes it is needed.

Open & Play slideshow

We are using Microsoft PowerPoint for the content and needed to auto run a slideshow at login, so we created a shortcut to run PowerPoint with the /S switch (see this for info on switches) and the filename: PowerPnt.exe /S c:\demo.pptx

That opens PowerPoint and starts the presentation!

Insert web content into PowerPoint

Lastly we wanted include some live web pages in it, which PowerPoint doesn’t support out of the box. MVP’s to the rescue! Some MVP’s created an add-in that allows it:

Really awesome!

Convert VirtualBox (vmi) to real disk?

Submitted by Robert MacLean on Tue, 05/31/2011 - 12:20

It is often the case I need to setup training machines and a sometimes I get VirtualBox images which I need to deploy to the machines. I tend to avoid virtualisation on the training machines because of driver related issues, especially with graphic cards and things like WPF (which powers Visual Studio). If you have a good graphics card & good drivers then you can get a decent perf improvement with WPF apps, but unfortunately some virtualisation drivers are too poor.

So how can I take an virtual hard disk created in VirtualBox and easily convert it to physical disk so it can just run?


It is possible but it is not easy to a real disk but it is not easy.

  • Step 1: You need to use a tool from Microsoft called SysPrep to unload the drivers. Basically this means that it strips all the driver info out, and puts the image in a clean state so that the next time it boots Windows searches for the hardware again. If you do not do that Windows will freak out because the hardware it expects does not exist.
  • Step 2: Then you use a tool designed for disk imaging to create an image. Tools like Norton Ghost (paid) or CloneZilla (free) are designed for this purpose and the image they create is portable unlike the vmi (VirtualBox hard drive) format which can't do this well.
  • Step 3: You then restore that image to the real disk using the same tool and you are done.

Slightly more work than you would expect, but that is a solution which always works.


I have not tried this with Hyper-V or VirtualPC disks (vhd) yet, but I suspect VirtualPC will work fine. Hyper-V has an additional Hypervisor layer and I suspect that SysPrep will not remove that and the restoring process will fail.

Finally you also want to be careful with SysPrep as it can have some undesired effects with certain software, for example SQL Server. There are specific steps to go through if you want to use SysPrep & SQL Server:

So make the time to have the first few attempts fail and learn the nuances of the software you work with.

BBD Software: The Illustrated Story

Submitted by Robert MacLean on Tue, 05/31/2011 - 10:37

For DevDays, BBD Software arranged a special video to be created to tell the story of the company and why it is such a special place to be.

Pity they didn’t mention the free vending machines or the bar we have or the great parties – but at least they focused on the important one the awesome people Smile

It's official: Pepper uses Azure

Submitted by Robert MacLean on Wed, 05/04/2011 - 21:52

Bruce Kyle, a Microsoft evangelist, wrote an article recently about the “Powered By Microsoft Windows Azure” logo and how you can earn the right to display that.

That may sound odd to some people – why can’t you say you use Azure if you do? Of course you can, but if you jump a few hoops with Microsoft you can use the official logo Smile 


But that is not all! Doing this also helps towards an ISV competence with Microsoft which gets you great assistance and free software from Microsoft, the opportunity to get $250 for marketing and also some other pieces of useful tidbits. One of those tidbits is a press release template, which is so odd for me too see as I am not in marketing, press or anyone else who does those – so lower down you can find mine Winking smile

So about those hoops, you maybe wondering how hard or easy this is? I took Pepper through the testing for both SQL Azure & Windows Azure and it took about 30min, reading Bruce’s article & watching a video. It is RIDICULOUSLY easy to do once you have your application built – SO GO. DO IT. BE POWERED BY WINDOWS AZURE!

Enjoy reading my first press release Smile with tongue out

For Release 22:00 SAST

4 May 2011

Robert MacLean Becomes a “Front Runner” With the Release of Its Latest Application, Pepper

Johannesburg, South Africa — 4 May 2011 — Robert MacLean today announced it will launch a new application using the Windows Azure Platform. Pepper in combination with the Windows Azure platform helps enable customers to backup, share and synchronize your Visual Studio 2010 settings between multiple machines from directly inside Visual Studio 2010 without any costs or requirements for you. The Windows Azure platform, Microsoft’s cloud services platform, provides Pepper with the ability to build, manage, and deploy cloud based applications.

“Thru the technical and marketing support provided by the Front Runner program, we are excited to see the innovative solutions built on the Windows Azure platform by the ISV community,” said Doug Hauger, general manager for Windows Azure Microsoft Corp. “The companies who choose to be a part of the Front Runner program show initiative and technological advancement in their respective industries.”

“Windows Azure platform provides greater choice and flexibility in how we develop and deploy applications to all developers, both on-premises or in the cloud” said Robert MacLean, Developer of Pepper

Pepper automates critical processes such as synchronization and backup of settings to the cloud, eliminating the need for local storage and lowering the chances of losing them.


Product or service names mentioned herein are the trademarks of their respective owners.

For more information, press only:

Robert MacLean,

Social everywhere doesn't work

Submitted by Robert MacLean on Thu, 04/07/2011 - 16:50




Not being on a social network is like having a company which doesn’t appear in your favourite search engine - it is just a requirement of being online in our era and for a long time I have tried to get to the utopian world of an integrated social experience where everyone was everywhere and my updates, posts, pictures etc… trickled across all social networks, so no matter what you did you could hear what I had to say or was doing etc…

This was a stupid idea and I thought I would share my learning’s about that process.

Problem 1 – He with the most friends wins

With Facebook I feel into the trap of accepting every friend request, loading my address book into it and basically any other “tricks” I could to increase my friend count. This meant that logging on to Facebook was a stream of conscience from people I really didn’t care about and so overtime I moved away from Facebook as the value I took out of it was low.

The solution to this was to create a set of guides for people to be my friends on Facebook. I am not going to cover all of them, I’ll just focus on two of them but I had about 5 or 6 which I use to decide who to keep or accept requests from:

  1. Time span rule – if I have seen you or had more than a Christmas email for 5 years or more, you are out.
  2. Override – I can keep anyone for any reason breaking any other rule Winking smile 

Using my rule set I trimmed from over 300 friends to less than 90 and Facebook is now a daily visit site because I do care about the thoughts of those 90 people.

Summary: Be very selective of who you follow on your social networks.

Problem 2 – The right tool for the the right job

110772_strip_sundayOne of the problems with Facebook friends, is that many of the those people were “frendors” or people who I just saw in the passages at work. Facebook isn’t meant for great communication around work however there is better choices for them:

  • LinkedIn – This is great for business partners, frendors, business contacts and key direct co-workers. This ensures that the value of the conversation is higher because it is more business focused and people do care deeply about their careers on there.
  • Yammer – This is for people I work with, regardless of anything else. This is also great because it is a walled garden so we can have those private conversations that are company/team specific.
  • Twitter – We met at an event, you want to hear from me or want me to hear from you but we don’t care about much else Twitter makes a great place to put people while I evaluate their value and should I try and add them to other networks. Many people start off here and move to the others.

Sure there are a few people who are on more than one network, but those are exceptions to the rule. Most people end up in one place.

Summary: Facebook for friends & family, LinkedIn for your professional career, Yammer for co-workers & Twitter for all else.

Problem 3 – Auto post is not your friend

I personally spend more time in Twitter than any other network, and I eventually had it setup that every tweet went to Facebook & LinkedIn too. The problem is Twitter is really unfiltered and I do post a lot of jokes or half baked ideas which detract from my professional value on LinkedIn or are so technical that my friends & family on Facebook scratched their heads with confusion.

Thankfully this can be fixed: Don’t auto post. LinkedIn supports this with a setting you must enable, Yammer does this by default and for Facebook don’t use the standard Twitter app rather use the Selective Tweets app. All these require you tag a tweet with a special tag, for it to auto post, i.e. Facebook it is #fb, Yammer is #yam & LinkedIn is #li

So if I post something on Twitter and want it on Yammer & LinkedIn I append the tags and it is on all three networks but not on Facebook!

Summary: Post selectively to the right social networks.

Introducing BBD

Submitted by Robert MacLean on Wed, 04/06/2011 - 12:20

BDDAny day I open my email and see an email from Peter Searle (the BIG boss at BBD, where I work) in there, I wonder if a trip to HR is in my near future Winking smile, today though is something far more awesome and rather that tell you myself I thought I would share Peter’s words because it is just fantastic:

More than 25 years ago Barone, Budge and Dominick, also known as BB&D, was begun by a group of people dedicated to delivering software solutions to clients. Initially, the work was done in an attic, and those people were Sandra Barone, Tom Budge and Ralf Dominick. 

The current corporate identity was created in the eighties with the founding of the company.

BB&D now employs more than 400 software professionals. We are South Africa’s largest independent custom software development company, and we serve customers in both South Africa and internationally.

In moving forward, we will never forget where we’ve come from. On the contrary, we will even further imprint the attitudes and values that have made BB&D what it is today.

We are taking the core values, achievements and expectations that have become so entrenched into the company’s make-up and are transitioning them into a fresh new identity that resonates with the next generation of the new BBD.

We are now BBD. And our brand line is – combined intelligence.

BBD work together with our clients, sharing knowledge and ensuring we can deliver solutions that improve their business.  This meeting of minds, connecting and building on each other’s brilliance enables us to design solutions for them that mark the way forward.

In essence, we are more than the simple sum of our parts. Our combined intelligence is the greater whole.

Very proud to be a BBDer Smile