17 Mar 2011

Visual Studio Recent Settings

When you use the import settings option inside Visual Studio, you may notice a long list of settings Recent Files with no way to clear them out.

If you do want to clear this out, you can do this by going to the following registry key:


Note this is completely unsupported, but I have done it without any issues.


21 Feb 2011

SharePoint Holiday Loader

March 19, 2012: This tool has had a major make over since the original release!


I’m sure, as a SharePoint power user, you’ve had the fun of your boss walking up to you and asking why the public holidays aren’t in your SharePoint calendar? (guess what happened to me last week)

You would think this would be easy, in fact Outlook supports adding holidays to calendars easily. So why isn’t SharePoint easy like that too?

I’ve had this asked a few times and never had a good answer to do it, so I decided that a simple tool needed to be built to solve this once and for all – Let me introduce SharePoint Holiday Loader (SHL).

SHL takes a standard holiday file (.hol) and allows you to publish that to a SharePoint list!


This tool is very easy to use (just need the file, the server and the calendar name) and it is free and open source. You can get the download the tool, source code, leave comments (or complaints) at: https://bitbucket.org/rmaclean/sharepoint-holiday-loader/

24 Jan 2011

Source Code Management for the Individual SharePoint Developer

imageWith SharePoint 2010 and Visual Studio 2010 the ability to be a productive developer was key and there is tight out-of-the-box integration and this means that it is easy for SharePoint developers to put code into source control easily. Hilton Giesnow covers this brilliantly in a video he has: http://bit.ly/g71Gnb

Imagine a number of dedicated SharePoint developers, they may have an enterprise ALM solution like TFS and on their own machines have SharePoint 2010 Developer and VS2010 installed and life is good – but what about the individual, or ad-hoc, developer?

The problem for him is that installing SharePoint 2010 is a resource hog and you may not want it running all the time (what Hilton nicely calls the 9 to 12 development) and what about if you switching between projects, how do you switch SharePoint? The solution I found, is to have a virtual machine (VM) for SharePoint with the dev tools installed and do all work on the VM. This is great because the overhead is only there when you need it and you can easily switch between different virtual environments. The downside: source code management.

Sure you can hook up the VM to the network and manage code using the source control as you are used too, but this isn’t always easy or possible, so what else you can do? I had this problem recently where the source control is on one domain and my development was another domain. I choose to use the Mercurial Distributed Version Control System (DVCS) and I thought I would share this experience with you.image

DVCS differs from “traditional” source control like TFS or SubVersion which has a client/server model where each developer is a client talking to a central server, however in DVCS every developer is their own server and does pushes/pulls (think like a sync) between other developers.

What this enables is a very lightweight set of tools installed along side SharePoint and the developer tools on the VM. At the end of each day I could run Mercurial on my machine and pull the source control down to my own machine. This meant the VM had the code and my “real” machine had the code. Then this code could easily be checked into the corporate source control system creating another backup and ensuring compliance with source management policies!

This has been a very exciting project and this configuration really made the management of the source code very smooth.

12 Jan 2011

Finally an AWESOME competition for South African Developers

logoI often find too many competitions from Microsoft ignore the southern tip of Africa or focus on specific markets, like education with the great ImagineCup event. Finally us hard working developers get a great competition: Internet Explorer 9 Top Developer Competition

This competition wants* developers to either create an awesome IE 9 add-on or light up a web site with some of the new awesome IE 9 features – so if you a web dev, html monkey, C++ or .NET developer you can take part!

The prize? A trip to PDC – the conference were two years ago everyone got hand build super laptops and last year Windows Phone 7 devices**, not to mention it is where the top Microsoft development speakers meet!

So get coding, you only have until March!!

Some things you may want to check out:

* Side note: “The competition wants” really sounds like the competition is a living entity and will punish you if you don’t do this… it isn’t and it won’t.

** My guess for this year at PDC is giving everyone tablets - just looking at what was announced at CES.

11 Jan 2011

Presentation Dump: End of 2010

Previous presentation dumps:

All slides can be found at: http://www.slideshare.net/rmaclean

This is the smallest presentation dump so far, mostly because a lot of the work I did in the second half of 2010 was at public events, like Tech-Ed, and those have already been upload.  One of the big pushes I did in the last part of the year was around design of the presentation and I think the T4 presentation is a highlight of that work for me.

T4 Templates


Developing RESTful Services in .NET

Workflow Foundation 4

14 Dec 2010

Pulled Apart - Part XV: Understanding usage with Runtime Intelligence

Note: This is part of a series, you can find the rest of the parts in the series index.

A vital component of keeping a piece of software alive, is to keep it useful to your users – but how do you know what your users are thinking about your software and what do they think are valuable pieces of functionality?

Pull does this using a fantastic piece of software called Runtime Intelligence from PreEmptive Solutions which is easy to plug in to your application to get interesting and useful details on the usage of your application.

Lottery Winner?

Yesterday I blogged about DevExpress and today another toolset (which isn’t free) so maybe thinking I won the lottery recently – unfortunately I haven’t Sad smile 

What I found one July morning, is that PreEmptive gives away the software and services required for Runtime Intelligence FOR FREE,to CodePlex projects for them to use.

This may be the biggest secret of CodePlex and another fantastic reason to use CodePlex for your open source hosting.


imageThe first interesting stat given is how many times the application has run, for Pull that is over 700 times Open-mouthed smile It is always great to see that it is used.


You can then drill down on to the stats, which are publically available and provide details on what features are used, what OS’s and versions of the .NET Framework are available and also where in the world it is being used!


How do you add this to your application? It is really simple, just follow the official guide. My one word of warning is the ClickOnce, another great feature of CodePlex, doesn’t play well with this and so you want to be aware of that.

13 Dec 2010

Pulled Apart - Part XIV: DevExpress

Note: This is part of a series, you can find the rest of the parts in the series index.

I make no attempt to hide my love for a company called DevExpress which produces enhancements for Visual Studio and additional controls for WinForms, ASP.NET Web Forms, ASP.NET MVC, WPF & Silverlight.

When I started with Pull I used mostly the standard WinForm controls and over time have changed it be almost 100% DevExpress controls for a number of reasons:

  • Rudi Grobler, Silverlight expert sits across the partition from me and loves to point out how ugly standard WinForms is compared to Silverlight. DevExpress helps me make my applications look MUCH better.
  • Every line of code has a cost to it and the value of that line of code decreases overtime. So standing on the shoulders of giants means my cost of development is MUCH less. This also means I focus on the business aspects and not on the UI aspects.
  • There is a lot of parity between DevExpress controls over different platforms, so if I want to change platform (for example to Silverlight) then I know the feature set will be close, lot’s of code could be reused.

Below is the first public version of Pull, which uses just DevExpress GroupBoxes, the rest is all WinForms:


versus the UI currently in development (for the January 2011 release) where only the status bar and web browser control are not from DevExpress! I think you will agree it looks way better now, plus there are many new features there (like filtering grids) which were not supported previously.


Grid Extensions

For the January 2011 release we switched to the DevExpress grids, which meant a lot of code needed to be changed (or just deleted) and I ended up writing a few extensions for the grids which I believe may be of use to other people:

Return a collection selected items

Rather than working with a collection of selected rows, this allows you to get the values of the selected rows:

public static IEnumerable<T> SelectedItems<T>(this ColumnView view) where T : class
    foreach (int selectedRowHandle in view.GetSelectedRows())
        T item = view.GetRow(selectedRowHandle) as T;
        yield return item;

Select a collection of items

The grid normally lets you select a single row or a continuous range, however often I want to provide a list of item values and have the rows which match those values selected:

public static void SelectRows<T>(this GridView view, IList<T> selectedItems) where T : class
    foreach (T selectedItem in selectedItems)
        for (int counter = 0; counter < view.DataRowCount; counter++)
            T item = view.GetRow(counter) as T;
            if (item == selectedItem)

Layouts and Strings

You can persist the layout of the grid to a stream, the registry or XML file. However I have a settings file and I would like to save and restore the layout from strings so I can easily add it to my settings file:

public static string SaveLayoutToString(this GridView view)
    MemoryStream gridStream = new MemoryStream();
    view.SaveLayoutToStream(gridStream, OptionsLayoutBase.FullLayout);
    gridStream.Position = 0;
    using (StreamReader reader = new StreamReader(gridStream))
        return reader.ReadToEnd();

public static void RestoreLayoutFromString(this GridView view, string layout)
    if (!string.IsNullOrWhiteSpace(layout))
        using (MemoryStream stream = new MemoryStream(Encoding.Unicode.GetBytes(layout)))
            stream.Position = 0;
            view.RestoreLayoutFromStream(stream, OptionsLayoutBase.FullLayout);

Enum + Grid + Images = Headache

imageI have an enum for the podcast state and rather than show the text, which is the default, I want to show an image on the cell. However this is not the easiest thing to figure out since there is no designer support for this Sad smile However you can do most of this in the designer and then only need one line of code per enum value Smile.

Step 1

Set the Column Edit property of the column to an ImageComboxBoxEdit: image

imageStep 2

On the ImageComboBoxEdit editor settings set the small images (and/or large images) property to the image list which contains the items you want to show.

It is important that you know the position (or index) of image in the image list.

Step 3

Now all you need to do is add the item values for the editor in code using the Items.Add method, which takes an ImageComboBoxItem. That class has some overloads which accept an Object for the value and here you can put in the enum value. Once this is done it all works fantastically.

You’ll note in the demo code below that I have an image index of –1 for the first item, this is so that no image is shown!

editor.Items.Add(new ImageComboBoxItem("None", PodcastState.None, -1));
editor.Items.Add(new ImageComboBoxItem("Downloading", PodcastState.Downloading, 0));
editor.Items.Add(new ImageComboBoxItem("Pending", PodcastState.Pending, 1));
editor.Items.Add(new ImageComboBoxItem("New Episodes", PodcastState.NewEpisodes, 3));
editor.Items.Add(new ImageComboBoxItem("Error", PodcastState.Error, 2));
10 Dec 2010

Visual Studio Service Pack 1 - Beta: Field Guide

Brian Harry announced the availability of the service pack 1 beta which is fantastic news for all developers. This post is a field guide of me doing the installs.

Before that I wanted to point out a few key things included in this SP:

  • This can installed in production – this beta includes a “go live” license so it is supported and upgrades to the RTM of the SP will be supported.
  • This includes over 80 hotfixes for between 800 and 1000 bugs and many new features. For a full list see the link above, but here is a brief list:
    • Silverlight 4 tool support!
    • Unit testing can target the 3.5 framework now.
    • IntelliTrace support for 64bit and SharePoint!
    • Performance Wizard for Silverlight!
    • HTML 5 support
    • IIS Express support
    • SQL Compact Edition 4 Tooling

Details on the last three can be found on Hanselman’s blog.

  • Some third party systems may break with this, at this time known ones are:
    • ASP.NET MVC 3 RC 1 – this will be fixed in the next update.
    • Visual Studio Async CTP – this will break completely! No news, yet, on when it will be fixed.

The Process

For me there are three files you need to get:

  • Update for .NET 4
  • Update for Visual Studio
  • Update for Team Foundation Server (not covered in this post)

Step 1

.NET 4 installInstall the .NET 4 update first – this took on my machine 24 minutes to do. It is important to note that I did shutdown Visual Studio first but I had some other applications open, including Pull which is .NET 4.

At the end of the process I needed to restart!


This step is no specifically needed as the VS SP will include this automatically, however I personally like the idea of doing it manually and making sure .NET 4 apps continue to work before I continue to the VS install.

Step 2

imageOn to the Visual Studio install which after a few minutes tells you what will be updated and then, tells you that it wants to download 490Mb!


What I had done was to download the smaller installer version (less than 1Mb) which means it first figures out what is needed and then downloads the rest. This is great for some people as the download size is less, however since I live in South Africa (read: bandwidth is a luxury) and I work with 300+ other developers it is better for me to get the “DVD” labelled one which is bigger (in my case 103Mb bigger) but contains everything in one go so it can be shared easily and the bandwidth hit just once!


Step 3

We re-join the action a while later (when the “DVD” edition downloaded, approx. 1 hour 21 min later) we start process again and this time the download size is 0Mb Open-mouthed smile 


This took 29 min to process (remember this is without the download) this install and success!



I haven’t found anything in the many extensions I use daily that has broken! In particular my favourites all work