Enabling UEFI booting on a BIOS installed Windows

Just a short article this one. I just got a new motherboard that support UEFI after a long time with my old one. I didn’t want to reinstall Windows at this point and it did a great job of detecting all of the new devices and just booted no problems.

However I would like to take advantage of Windows’ ability to UEFI boot and use the Secure Boot feature on Windows 8. There is no supported way to migrate from BIOS booting to UEFI but it is possible to do it. This isn’t for the faint of heart and it’s always possible when messing around with things like this that it’ll leave you in an unsupported state or completely broken and require a rebuild.

It did work for me though. Check out this great article http://social.technet.microsoft.com/wiki/contents/articles/14286.converting-windows-bios-installation-to-uefi.aspx for the instructions.

Using Grids with ItemsControl in XAML

ItemsControl in XAML is a useful control that allows you to bind against multiple items and have them displayed using a repeating template (or templates). It forms the basis of the ListBox and other controls but can be used on its own where extra behaviour such as selection is not needed.

By default the ItemsControl uses a vertically aligned StackPanel as the layout panel for its items but you can override this by providing a template. It’s quite common to override this for example to use a VirtualizingStackPanel but in this instance I wanted to use a Grid for layout.

Dynamic SQL scripting on Windows Phone 7 with LINQ

I recently had cause to look into running dynamic SQL on WP7 for a customer. On a desktop this is easy, you just run some SQL statements through ADO.NET and you’re sorted. On Windows Phone 7 it’s a little trickier. This is because WP7 only exposes LINQ to SQL and it doesn’t support arbitrary SQL execution against your SQL CE databases.

So how to handle it when you have a corrupt DB and want to send a fix to a remote device or you just want to update the DB with some new data.

Connecting to SharePoint on Office 365 with Windows Phone 7

One of my colleagues recently asked me to look into connecting to a SharePoint site running on Office 365 from a Windows Phone 7 application. Now this is something that the phone has native support for but in this case he wanted to be able to build an application that had added functionality and then called into the SharePoint web service APIs to extract data from SharePoint.

Simulated Push Notifications on Windows Phone 7

I’m currently prepping for my TechEd Europe WP7 session and I like to prepare for the worst. My demo relies on some cloud services and also on WP7 push notifications. Push notifications are nice but they have one drawback for demos, I need an internet connection.

Now in the real world my application would indeed need an internet connection or it would actually be kind of useless, but in demoland I don’t need one as I can run the cloud services portion in the Azure DevFabric which is nice in case the internet connectivity in the demo room goes down, I have a backup.

The same isn’t true of push notifications, they are managed by Microsoft and if I can’t get to them I can run my demo even though my own cloud services are running locally. In order to get around this I wrote a simple WCF service that also runs in my Azure DevFabric along with my other services that can act as a push notification endpoint. It’s not totally seamless but it works quite nicely for me as I now have a fallback for push notifications as well as for my own cloud services.

Silverlight Navigation With the MVVM Pattern

I recently had a query from a customer that was one of those ones that you think “Aha! That’s easy, you just do this”. Then you think a bit more about it and realise that if you want to do it properly it’s not quite as simple as you first thought.

This particular query related to how to use the navigation framework introduced in Silverlight 3 with the MVVM pattern. For those that don’t know the Model-View-ViewModel pattern is a common pattern often used to build Silverlight and WPF applications since it has strong support for databound UIs and provides good abstraction for unit testing and keeping your view logic separate from the view and the model.

Performance Profiling .NET Applications Using the Visual Studio Profiler (Part 2)

In the first part of this article I discussed how to profile applications using the command line tools for Visual Studio. In this part I’m going to discuss how you can interpret the results from the profiling.

I’ve put together a small sample application that does a few maths calculations and ran the profiling tools in VS2010 against it. Once you have the the .vsp file that the profiler gives you all you need to do is open it in VS and away you go.

The first thing that you will see in VS is the summary report. This looks something like the one shown here.

Importing BlogML into WordPress from Subtext

I used the BlogML importer plugin from http://dillieodigital.net/2010/07/03/blogml-importer to import my BlogML from Subtext. However the output from Subtext included Base64 encoded content so I wrote a little C# application to convert the Base64 decode the content before importing it.

The source code is below, the usual caveats about if it blows up your computer don’t blame me etc. apply.

using System;
using System.Linq;
using System.Text;
using System.Xml.Linq;

namespace UnBase64BlogML
    class Program
        static void Main(string[] args)
            XDocument doc = XDocument.Load(@"blogml-b64.xml");
            XNamespace blogML = "http://www.blogml.com/2006/09/BlogML";

            var query = doc.Descendants(blogML + "content")
                .Where(node => (string) node.Attribute("type") == "base64");
            foreach(var item in query)
                string content = Encoding.UTF8.GetString(Convert.FromBase64String(item.Value));



            Console.WriteLine("Press a key to continue");