Disable single-click file open in Visual Studio 2012 Solution Explorer

One of the first things I do when I install a Visual Studio 2012 is disable the preview tab. This is the single-click file open in the solution explorer.

Each time I have a hard time remembering where the setting is, so this is a reminder for myself:

TOOLS > Options > Environment > Tabs and Windows > Preview Tab > Single-click opens files in the preview tab in: Solution Explorer



More Agile Manifesto Wallpapers

The wallpapers I made for the Agile Manifesto got a few views, so I made some new ones for the 12 principles. Only one size again, if you want a different size, that would be easy to make, but just let me know in the comments!


If you have dual monitors, why not stick the manifesto on your left monitor and the 12 principles on the right? ūüôā



Agile Manifesto Wallpapers

As an agile developer the¬†Manifesto for Agile Software Development¬†is used to guide you in your agile workflow. Since it holds such a big importance for us, I thought I’d make some wallpapers so we can stick them on our desktop and get a constant reminder of these core values.

I’ve made two of the manifesto (a clean one and an outer space one). The size is 1024 x 768. Let me know if you like them!

If there’s interest I can make them on different sizes too. I can also make them for the twelve principles, again if you would like to see that.

Installing Windows 8 in a Virtual Machine

About a month ago, Microsoft released the RTM version of Windows 8 to MSDN subscribers or via a 90-day trail version. I thought about checking it out, so I decided to test it out in a Virtual Machine.

Warning: the trail version cannot be upgraded to the final version, so if you replace your current OS with it, you’ll have to do a complete reinstall! That’s why I’m going for the VM ūüôā

1. Get the bits
You can get the trail version from the dev center website. For the VM I’m using Oracle Virtual Box.

2. Create the VM
After installing Virtual Box you can add a new VM to it. The later versions explicitly have Windows 8 support, which is super for what we are doing here ūüôā Give it a fancy name (like ‘Windows 8’. Very original…) and decide how much memory and CPU’s you want to allocate. Don’t overspend, or your host operating system will start to slow down a lot.

After that it’ll ask you to create a hard drive. I created a VDI of 50 gigs. You could also create one that dynamically expands, but this is slower and you’ll need to monitor the size yourself.

3. Configure the VM
Once the machine is created, open up its settings.¬†Under System > Acceleration make sure “enable VT-x/AMD-V” is checked. This will allow your VM and host OS to directly share the processor resources, instead of the VM always going via the host OS.

Now you can make the Windows 8 ISO available to the VM via the Storage tab. Click on the empty IDE controller and mount your ISO into it.

4. Booting things up and down (problems)
Normally this should do the trick and you can start installing Windows 8 into the VM, but after startup I got this error:

VT-x features locked or unavailable in MSR. (VERR_VMX_MSR_LOCKED_OR_DISABLED).

Result Code:E_FAIL (0x80004005)

After tinkering with my VM a little I noticed I could get past this error if I decreased the allocated CPU’s to one. But that got me to the next error:

VT-x/AMD-V hardware acceleration has been enabled, but is not operational. Your 64-bit guest will fail to detect a 64-bit CPU and will not be able to boot.
Please ensure that you have enabled VT-x/AMD-V properly in the BIOS of your host computer.

And as the error predicted, the Windows installer gave me this message:

Your pc needs to be repaired.
This 64-bit application couldn’t load, because your PC doesn’t have a 64-bit processor.

Luckily the solution to my problem was in the second VM’s error message. When I opened up the BIOS of my laptop, virtualization was¬†indeed¬†disabled (apparently¬†this is the default).

After¬†enabling¬†it, I could once again bump up the number of CPU’s and start the VM¬†successfully.

5. Installing
Installation was a breeze.
The only part that was a bit confusing is the type of installation options. Default it suggests an Upgrade (which won’t do us much good in an empty VM). The other option is confusingly named ‘Custom (advanced)’. That’s the new install option ūüôā

6. Running
After you complete the install and registration, you can bask in the glory of your new Windows 8 installation. I’m going to look into the development of a Windows 8 metro style app, but I noticed that just running the clean Windows 8 VM gave too much of a performance hit on my humble laptop.

But I still have another option! I’m going to try to follow Scott Hanselman’s post on running Windows 8 inside of a Virtual HD. This means I get a minimal performance hit on my virtual drive, but all the rest works directly on your hardware.

The VHD is a bit more risky than a VM, so if you just want to take a peek at the new OS, but want to keep risks to a minimum, go for the VM. For development, which requires some performance, the VHD seems like a better option.

I’ll keep you posted on my progress!

ReSharper: my favorite 5 shortcuts

I admit it, I love ReSharper

Honestly, I’m not affiliated with JetBrains in any way, but I think they’ve got a fantastic tool, which makes a developers life a whole lot easier. If you are a C# developer, you should check it out.

I’m still discovering new functionality, even after using it for a few years. In this post I wanted to share my favorite shortcuts. They’ve saved me countless hours, so hopefully you’ll find some new ones, and save yourself some time too!

A remarks before we begin: these are the default ReSharper mappings, but it’s possible that you’ve made some changes to these mappings. If they don’t work, head over to your Visual Studio settings and check your keyboard mappings

Here they are (in no particular order)

  • Alt-PageUp/Alt-PageDown and Alt-Enter¬†–¬†Next/Previous highlight and Quickfix
    It gives you a great feeling of power and control, just cruising over all the warnings in a file with Alt-PageUp/PageDown and fixing them with Alt-Enter. Clean code in no time.
  • Shift-Alt-L¬†– Locate in Solution Explorer
    When you need to quickly locate the file you have open in the Solution Explorer, this handy shortcut does the trick. You’ll be amazed at how many times you can use this!
  • Ctrl-F12¬†– Go to Implementation
    Navigating around my code with F12 (Go to Definition) was common practice, but on ¬†an interface most of the time I wanted to go to its implementation. You can imagine my joy when I discovered this shortcut ūüôā
  • Ctrl-Shift-R – Refactor this
    The mother of all refactoring shortcuts. This gives you a context menu with the possible refactorings in the current context.
  • Alt-Ins – Generate Code
    Quickly add code like constructors, properties or equality members (super handy on structs).

If you need a quick overview of the keymappings, you can download a PDF for your version from the JetBrains website. Or you can try the keymaps for ReSharper Visual Studio plugin.

Have you got any other favorite shortcuts? A favorite feature in Reshaper? Just love the tool and want to spread the love? Leave a comment!

Agile Fluency

Over the years our team has been working according to Agile pratices and we’ve slowly grown into them. The process took alot of effort on our part, to keep pushing us forward and keep learning from our mistakes. Having made these mistakes, we where more keen on implementing the practices and we can still reference back to them now when something starts to slide the wrong way.

An interesting¬†article was published on Martin Fowlers site called¬†Your Path through Agile Fluency. It hits quite a key point in the fact that Agile (and Scrum, XP, …) practices are easy to teach and understand in a classroom, but difficult to implement in real projects. They don’t provide a ‘silver bullet’ methodology which changes efficiency from one day to the next. Teams take years to progress trough the Agile Fluency path, and most of them never get¬†beyond level 1.

In our team, I think we now have a solid base in level 1 and our slowly working our way to level 2. Will we ever get to 3, or even 4? Is it even necessary for our team? ¬†Time will tell…

Are you working on an Agile team too? Have the same experience? What level do you think your team is on?

Refactoring keeps it tidy

This is a translation of the dutch post I did for my company’s blog.

Refactoring coverRecently a friend of mine handed me a copy of Martin Fowlers¬†Refactoring: Improving the Design of Existing Code¬†(that’s what friends are for). The book is considered a standard on refactoring en can still be seen as a must-read for every programmer, although it published in 1999.

Refactoring means to rewrite code, in small, safe (backed by unittests) steps. Doing this cautiously ensures that there is no loss of functionality and results in a decrease of error-proneness of the code and an increase in readability and maintainability. As Folwer mentions: the compiler reads your code once, while your and your colleagues will be gazing over it and changing it a lot times during coding. Making sure your code is readable (really readable, like a book) will save you and your coworkers a lot of time!

Fowlers book also helps you maintain the DRY (Don’t Repeat Yourself) principle. If you have to duplicate a piece of business logic in your code, it WILL cause you trouble. When the logic has to be altered, you can be sure that one of these places will be forgotten.

Before Fowler starts working on a piece of code, to fix a bug or add new functionality, he’ll often start with a refactoring to better understand the code. This may sound strange, but it is almost impossible to write perfect code from the start. I don’t mean working code, but code that is open enough to support all the possible questions, extensions or other changes and still is small enough to only do what it needs to do. If you accept the fact that you are going to have to refactor, and that it’s not a failure for you as a programmer, you can write better, cleaner code.

My favorite tool to do this (in .Net) is the fantastic ReSharper. A lot of the refactorings in the book can be done automatically and safely with this tool. It has an¬†enormous list of functionalities, and I’m¬†still discovering new uses every day.

An important note on refactoring is knowing when to stop. Knowing when to start is one thing, but at least as importing is knowing when you’ve refactored enough, or when a refactoring isn’t going as planned and the best thing to do is undo your changes. Huge reworks are done one refactoring at a time. You can always come back¬†tomorrow¬†to do the rest of them. As long as you leave the code in a better state than it was before, your good!

Refactoring fits perfectly in the iterative Agile process and is a corner-stone of¬†Extreme Programming¬†(XP). It’s no coincidence that¬†Martin Fowlers¬†can be found underneath the¬†Agile Manifesto. Clean code will also provide value for the customer.¬†Although¬†it sounds¬†counter intuitive, investing time in refactoring saves time writing code. A win-win!

If you haven’t, read the book and start refactoring.

You’ll love it, it’s a way of life.