Category Archives: Good to know

Switching from VMWare to VirtualBox

I have been using VMWare for a couple of weeks now. Unfortunately it was not a very good experience. Once in a while it crashed during startup or shutdown of the virtual machine, after which I manually had to remove the lock file in order to be able to use it again:

vbox1

But the most annoying issue was that in NAT mode the internet connection worked but I experienced several network related problems, and in bridged mode I simply had no internet connection. Trying to fix it with several solutions I found with google resulted in no solution.

Then I tried to quickly create a virtual machine with VirtualBox. After a few minutes I noticed that everything just worked out of the box, in NAT and bridged mode. So the decision was taken to move to VirtualBox.

I found that this does not mean that all of my virtual machines should be recreated, because VirtualBox also supports the VMWare hard disk format (vmdk)! It requires only some small manipulations to get this working.

First, power up the original virtual machine with VMWare, uninstall the VMware tools and shut down the machine:

vbox2

Start VirtualBox, create a new machine.

vbox3

Click next.

vbox4

Now copy all of the original VMWare hard disk files into the created folder:

vbox5

Click next to continue the creation of the virtual machine, and select the main vmdk file:

vbox6

Click create. Do not start the virtual machine yet!

Select the virtual machine and click settings:

vbox7

In storage, remove the SATA controller:

vbox8

In IDE controller, uncheck ‘Use host I/O cache’ and click the ‘add hard disk’ icon:

vbox9

Choose the existing hard disk file:

vbox10

That’s it! Start the virtual machine. Windows will now update its drivers accordingly, and a couple of restarts may be needed. Eventually, your virtual machine will be up and running in VirtualBox. Then, select ‘Install guest additions’ in the Devices menu, so that you unlock the full power of VirtualBox:

vbox11

After an hour of work, my four virtual machines were converted successfully:

vbox12

Hiding a user in Windows 7

Today I setup a virtual machine with Windows 7, Sql Server 2008 R2 and Visual Studio 2010. During installation of Sql Server, I had to specify a user account for the sql server and sql server agent services, . So I created a new user account (SQLSERVER), and used that one. Of course, this user account now shows up at the login screen of windows:

win1

So I wanted to hide this account, and it was actually quite easy to do. Go to ‘Administrative Tools/Local Security Policy’. In ‘Security Settings’, click on ‘Local Policies’ and then on ’User Rights Assignment’. Find the policy for “Deny log on locally’ , double click it and add the user you want to exclude to the list:

win2

If you now log in again, you should not see the user anymore:

win3

Trails – Find your way!

Today I discovered a nice app for the iPad/iPhone, called trails, that helps me find the fastest route to work (and back). It records the route I take, with time and distance, which allows me to compare them to alternatives I tried out.

The nice thing is that it works also without internet connection, because it caches the maps once it is connected. And you can also export and import maps, and much more… for more information, look here.

So how does it work… click the ‘+’ button to add a new track, enter a name and click ‘Save’:

1

Now you’re ready to start recording, just click the ‘Start recording’ button:

2

Start driving, walking or whatever you are doing. The app will track where you go. If you’re finished, click the ‘Stop recording’ button:

3

And then you see an overview of the route you took, elapsed time, distance, and even the ascent and descent:

4

And of course you can also use it to track your hikes, bike trips or jogs!

A list of useful libraries

One of my previous blog entries was about productivity tools, more specifically a list of tools I like to use during development. In this post I will do the same, but about libraries and frameworks I like to use. After all, the first thing you need to do before you start developing is to check whether it already exists – so that we don’t reinvent the wheel! So here goes… and of course, I’ll update this list if needed.

EPPlus

“EPPlus is a .net library that reads and writes Excel 2007/2010 files using the Open Office Xml format (xlsx).”

Reading and writing excel files is something I already needed to do a number of times, and this free library is the best I have found!

Fluent validation

“A small validation library for .NET that uses a fluent interface and lambda expressions for building validation rules for your business objects.”

Validation is part of every development you do, and this free library allows you to validate objects in a fluent way, using external validators.

StructureMap

“StructureMap is a Dependency Injection / Inversion of Control tool for .Net that can be used to improve the architectural qualities of an object oriented system by reducing the mechanical costs of good design techniques. StructureMap can enable looser coupling between classes and their dependencies, improve the testability of a class structure, and provide generic flexibility mechanisms. Used judiciously, StructureMap can greatly enhance the opportunities for code reuse by minimizing direct coupling between classes and configuration mechanisms.”

Dependency injection is a technique I use by default in almost every application; and StructureMap is my favorite tool for that.

SQLite

“SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. SQLite is the most widely deployed SQL database engine in the world.”

An excellent standalone SQL server database engine, which I use for standalone client applications that need database functionality at the client’s side.

WPFLocalizeExtension

“The LocalizationExtension is the easiest way to localize any type of DependencyProperties or native Properties on DependencyObjects under WPF & Silverlight.”

This free library takes care of localizing any resource in your WPF/SIlverlight application based on the culture being set. It can be applied on the fly, which means your application doesn’t need to be restarted when culture is changed!

Prism

“Prism provides guidance designed to help you more easily design and build rich, flexible, and easy-to-maintain Windows Presentation Foundation (WPF) desktop applications, Silverlight Rich Internet Applications (RIAs), and Windows Phone 7 applications. Using design patterns that embody important architectural design principles, such as separation of concerns and loose coupling, Prism helps you to design and build applications using loosely coupled components that can evolve independently but that can be easily and seamlessly integrated into the overall application. These types of applications are known as composite applications.”

I have used this library to build WPF applications as a collection of loosely coupled and independent components. It takes a while to learn it, but once you get it, combined with MEF and MVVM it’s a powerful environment to write flexible applications.

Log4Net

“The Apache log4net library is a tool to help the programmer output log statements to a variety of output targets. log4net is a port of the excellent Apache log4j™ framework to the Microsoft® .NET runtime. We have kept the framework similar in spirit to the original log4j while taking advantage of new features in the .NET runtime.“

Whenever I need to log (and that is, well, almost always), I use log4net. It’s a powerful and flexible logging framework, that by default contains everything you need; and in case you need more it’s extensible by writing your own log4net adapters.

SignalR

“Async library for .NET to help build real-time, multi-user interactive web applications.”

I used this library because I needed real-time feedback on a web site from a long running process. It mimics a persistent connection between the UI of a web site and the backend.

GalleryView

GalleryView is capable of creating a wide variety of gallery types, and provides an extensive set of options to the user. Not only will the user be able to adjust photo and thumbnail sizes, and transition speeds, but he will also have the ability to choose from a selection of element positions, transition styles and other features.”

For a site I had to make I needed a picture gallery jquery plugin. There are so many free libraries available, and I tested a number of them, but I finally choose this one because it was very extensive and works very nice!

Running visual studio as administrator

Running visual studio as administrator is often required, especially if you use IIS as a host for your web site. Therefore, I like it to be started as an administrator by default. So instead of right clicking it and selecting ‘run as administrator’, you can hack it a little bit so that it always starts as administrator, no matter how you start it.

Step 1: change ‘devenv.exe’ compatibility

First go to C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE, right click on ‘devenv.exe’ and select properties, click ‘compatibility tab’, check ‘Run this program as an administrator’, and click ‘OK’:

runasadmin

Step 2: hack VSLauncher.exe

You have to hack VSLauncher.exe a little, because changing its compatibility settings won’t work with visual studio 2010:

  1. Backup C:\Program Files (x86)\Common Files\microsoft shared\MSEnv\VSLauncher.exe
  2. From within a Visual Studio 2010 Tools prompt (run as admin), extract the manifest from VSLauncher.exe:
    mt -inputresource:"VSLauncher.exe" -out:VSLauncher.exe.manifest
  3. Alter the VSLauncher.exe.manifest file:

    <requestedPrivileges>
    <requestedExecutionLevel level="requireAdministrator" uiAccess="false">
    </requestedExecutionLevel>
    </requestedPrivileges>
  4. Write back the manifest into VSLauncher.exe:
    mt -outputresource:VSLauncher.exe -manifest VSLauncher.exe.manifest

If you now start visual studio by its shortcut or by opening a solution file, it will start as an administrator.