Freedom From Default Color Themes in Visual Studio 2012

I finally joined the ranks of those who’ve installed Visual Studio 2012 this week. The default Light color scheme is way too bright. The Dark color scheme is better, but the grays aren’t differentiated enough (just like the Microsoft Blend UI). Thankfully, some wonderful soul compiled this blog post, which details the changes necessary to save your eyes from the horrible default themes.

Following steps 1 and 2 will be enough, but you can go even further if you want the Visual Studio 2010 icons back in addition to the color scheme.

Deleting TFS Tasks

I changed the state of a TFS task I was working on recently, only to discover the workflow wouldn’t let me return it to it’s prior state.  Until today, I didn’t know it was possible to delete TFS tasks if you made a mistake in changing one.  But some Googling revealed a blog post that explained how to delete tasks.

The direction of the slashes for the URL can point forward (/) instead of backward () and the witadmin.exe destroywi /Collection:<TFS url> /id:<Task id> command still works.

PowerGUI and .NET Framework 4.0

On my current project, we use PowerShell scripts to automate our UI testing.  We’ve been writing and running the scripts in the PowerGUI Script Editor, an excellent tool that’s also free.  When we upgraded our application to run on version 4.0 of the .NET Framework from 3.5, we lost the ability to run PowerShell scripts in debug mode from PowerGUI.

The only work-around for this I’ve found (at least until a version of PowerGUI built on .NET 4.0 comes out), is a registry hack that forces all the .NET apps on the machine to use the latest version of the CLR.  You can find more details in this user discussion at powergui.org, or this discussion on stackoverflow.com.

My First PowerShell Cmdlet

We’ve been using PowerShell to write automated tests of the UI on my current project.  One of the tasks I took on today was creating a custom cmdlet to enable us to select radio buttons.

I already had an existing assembly of cmdlets to work with, so I just added a new class (SelectRadioButton) to it.  Next, I added references to System.Management.Automation and System.Windows.Automation. With these references in place, I could add this attribute to the class:

[Cmdlet(VerbsCommon.Select, "RadioButton", SupportsShouldProcess = true)]

The attribute determines the actual name of the cmdlet you’ll use in scripts (Select-Radiobutton).  The cmdlet needs an instance of AutomationElement to operate on, so that’s defined next:

[Parameter(Position = 0, Mandatory = true, HelpMessage = "Element containing a radio button control")]
[ValidateNotNull]
public AutomationElement Element { get; set;}

Finally, I adapted some of the logic for my override of the ProcessRecord from this article on using UI automation.  The end result looks something like this:

protected override void ProcessRecord()
{
try
{
if (Element.Current.ControlType.Equals(ControlType.RadioButton))
{
SelectionItemPattern pattern = Element.GetCurrentPattern(SelectionItemPattern.Patern) as SelectionItemPattern;
if (pattern != null) pattern.Select();
}
else
{
//Put something in here for handling something other than a RadioButton
}
}
catch (Exception ex)
{
// You could put some logging here
throw;
}

}

When default settings attack

When you first install SQL Server 2008 Express, the TCP/IP protocol is disabled by default.  Be sure the protocol is enabled (which requires restarting the service) before you try to run an application that depends on it, otherwise you could spend hours trying to figure out why your application won’t work.  It looks like SQL Server 2008 R2 Developer behaves the same way.

I suggested this awhile back to a co-worker who’d been struggling all day with why an application wasn’t working, and it turned out to be the solution.

Set-ExecutionPolicy RemoteSigned

When you first get started with PowerShell, don’t forget to run ‘Set-ExecutionPolicy RemoteSigned’ from the PowerShell prompt. If you try to run a script without doing that first, expect to see a message like the following:

File <path to file> cannot be loaded because execution of scripts is disabled on this system.  Please see “get-help about_signing” for more details.

The default execution policy for PowerShell is “Restricted” (commands only, not scripts).  The other execution policy options (in decreasing order of strictness) are:

  • AllSigned
  • RemoteSigned
  • Unrestricted

When I first tripped over this, the resource that helped most was a TechNet article.  Later, I found a blog post that was more specific about the execution policies.

App_Offline.htm

I came across a couple of useful posts from Scott Guthrie about App_Offline.htm. This page appears and disappears automatically when the “Publish Web Site” option is used. What I didn’t know is that it’s part of the .NET framework (not the IDE). This means the page can be added and removed manually. This will be especially useful in my current environment, where we depend on network engineers to deploy web applications to test and production sites.

Here are the posts:
App_Offline.htm and IE Friendly Errors

Announcing App_Offline.htm

Amazon.com and A9.com switch to Microsoft Search

I hadn’t noticed this until yesterday, but Google is no longer the guts of A9 & Amazon search. According to this article, A9’s contract with Google expired and they decided to go with Microsoft for the replacement.

I tried “v for vendetta” as a search in both A9.com and Google to see how the results differed (if at all). In my case, the top 6 links from A9 were to the V for Vendetta website by Warner Brothers (hits 1-2), its IMDB entry (hits 3-4), its Wikipedia entry, and its Rotten Tomatoes review. Google gave me the same hits, in almost the same order. The only difference was that the top result returned showtimes for the movie close to my zip code. A9 actually provides that info too, you just have to check the “Movies” option.

It looks like Microsoft’s search has actually improved somewhat since I last tried it. I’ll be curious to see what moves Google and Yahoo make to try and stay top two in market share.

Update:

When I talked to my friend Sandro about the switch and told him what search term I used, he suggested I use a tougher search term to test the relevance of lower-level results. We compared the results of searching for his name “Sandro Fouche” between Google and Live.com. With Google, I had to go to the 50th result to find the first irrelevant result. With Live.com, I got an irrelevant result as early as the 10th result.

Windows Live Beta vs Google Homepage

My office gives us the day off tomorrow, but it’s pretty much a ghost town already. I had a bit of time today to play with the Windows Live Beta. I was curious to see whether it was a step up compared to my.yahoo.com or google.com/ig.

At first glance, live.com looks like a clone of Google’s personalizable page (though live.com is even more streamlined). It’s easy to add content to the page, whether it’s “gadgets” (the Google homepage calls them sections) or individual RSS feeds.

One particularly nice touch live.com has that I haven’t found on Google yet is a way to import an OPML file. To test it, I exported an OPML file from my bloglines account and imported it into live.com. Very quickly it showed up under “My Stuff” as “Subscriptions”. From there, it was very simple to drag and drop individual RSS feeds onto my live.com home page. I didn’t realize right away that “>>” meant content would open in a new window, but once I did, I liked the functionality much better. I wouldn’t use this over bloglines right now, but I’d be very interested to see if someone could come up with a slick gadget for newsreading.

A second convenient feature live.com provides is the ability to add the results of search to your home page. It’s like the News Alerts feature at Google News, only instead of sending you an e-mail, you see the results right on your page.

live.com seems to work equally well in Firefox or IE. If I had to choose between google.com/ig and live.com right now, live.com has a slight edge in functionality.

If you’ve already got a Microsoft Passport (and/or a Hotmail account), live.com is worth trying out.

Microsoft doesn’t get Test-driven Development

That’s what Scott Bellware contends in this blog post. He does a very thorough job of explains what test-driven development in meant to accomplish and how Microsoft missed the mark. In my own experiences with test-driven development over the past couple of years, I’ve found it to be extremely helpful. The code I’ve written using this practice was quite a bit better than code written without it. The primary objection I’ve seen to using it is deadline pressure. Some developers I’ve worked with find it easier to develop test pages, since that’s what they’re used to. The idea of writing code to help them design the finished product (instead of merely testing it) doesn’t seem to appeal to them.