Using Microsoft Virtual PC – Pros and Cons

Virtual PC Console

Microsoft’s Virtual PC is a virtualization software that allows you to create shell operating systems which run inside your main operating system. There are several similar products ranging from free/open source to high-end expensive software. I’d like to discuss a few of the pro’s and con’s of using Microsoft Virtual PC from the point of you as a single-use developer. This differs quite drastically to enterprise or commercial environments considering virtualization, and seperate considering of these pro’s/con’s should be taken. Consider this as a personal use, surface level evaluation only. Whew, now that the disclaimer is out of the way…

On the Bright Side

Running Multiple Operating Systems

From a developer’s point of view, having access to several different operating systems from a single PC is extremely useful. Software development requires constant testing on various platforms and browsers, as well as under specific conditions. Once you have a library of operating system images (images are emulations of a PC and inherently the operating system it is running on), you can readily launch any virtual PC in minutes (seconds?). Images are not relegated only to operating systems; they also include hardware setup’s as well, and can allow you to emulate specific hardware requirements to test development against.

Ubuntu running under Virtual PC

Snapshot Images

In addition to building your collection of operating systems or PC configurations through Virtual PC, you can also use Virtual PC as a complete system backup and pass PC’s back and forth between hosting computers. If something were to happen to one of your images, it is extremely easy to simply load the original Virtual PC image and begin again. Though Virtual PC images are large, you can conceptually share images back and forth between multiple users. This is particularly useful if you use multiple laptop/desktop combinations (say work and home?) and would like a common PC image on an external harddrive.

Sandbox

Another huge advantage of Virtual PC is the use of Images as sandboxes. There are two very common examples of sandbox usage. First, when developing code where you really don’t know what the end-result will be and worry that what you are working on could destroy your data/operating system/etc. during development or testing. Secondly, you’re installing software that you are not confident in it’s integrity; perhaps it’s open source, contains viruses/trojans, etc. Using Virtual PC as a sandbox is a pretty quick and easy way to limit exposure to possible damage.

You Can’t Always Win

Performance

Unfortunately, in most cases you will see a slight to moderate degradation in system performance depending on your particular system. I run a fairly capable machine, so performance was not a major issue; but it is noticeable that you are running inside a shell. At times, applications seem a bit choppy, and I’ve noticed that keystrokes and mouse movement are not always picked up as well as expected, which can become annoying and a bit of a disconnected experience.

Screen Resolution

Perhaps this is something that can be remedied easily, but I frequently run into screen display/resolution inconsistencies while running Virtual PC. Resolution will periodically resize to very small, and even when set manually do not fill the entire available monitor resolution like your main PC would. This is more of an irritation than anything else.

Filesize

Images are HUGE! If you don’t have excess amounts of file storage (harddrive capacity) then forget about it. My current development image (which I use for basic development as well as other common tasks), is 33Gigs… software-wise, the image is pretty lean. An image with additional data, several installed programs, etc. can really become heavy. So be conscientious as to how much harddrive space images take up.

Summary

These are just a few pro’s and con’s regarding Microsoft Virtual PC and virtualization in general. I will begin testing VMWare shortly, and look forward to releasing a post comparing the two. In the meantime, have a go at Virtual PC yourself by downloading it here for free!

Virtual Earth and the Windows Live CTP

Virtual Earth Map

From a developer’s perspective, Virtual Earth is hands down my favorite online mapping tool, bar none. I’ve worked with Virtual Earth for quite a while now, and though it was perfectly manageable via 100% clientside code as originally developed; the new ASP.NET controls provided in the Windows Live CTP is a fantastic addition.

Simplification of this tool is almost too good. Part of me worries that my once (more) novel idea of providing an online tool for logging fishing trips may have a few less barriers to reproduce simply by the release of this great tool.

Hello World of Virtual Earth

After installing the Windows Live CTP (November 2008 release here), open Microsoft Visual Studio (or Express), create a new ASP.NET 3.5 project and look for the newly added template called Windows Live Project.

This project adds the necessary setup and references to the Virtual Earth controls as well as some additional controls found in this packet.

To begin working with a map, simply drag and drop the map from the toolbar onto your webpage. At this point you should be able to see the designer view of the map or the following HTML in markup:

<ve:Map ID="Map1" runat="server" Height="400px" Width="400px" ZoomLevel="4" />

That’s it for absolute basics. You have a map. P.S., if not already added, you will need a ScriptManager as well or you may run into a server error.

Adding Pushpins

The Virtual Earth Map uses a collection of shapes which can be added to the map at any time. To add a very basic shape (a pushpin), please examine the following code:

//Add pushpin to map
double lat = 22.12345;
double lng = -81.12345;
LatLongWithAltitude point = new LatLongWithAltitude(lat, lng);
Shape shape = new Shape(ShapeType.Pushpin, point);
Map1.AddShape(shape);

Note: I added a using (using Microsoft.Live.ServerControls.VE;) to avoid long namespace declaration, if you have any problem from directly using this code, check your namespaces)

Panning to a Specific Longitude/Latitude

Another basic task is to pan to a specific location. You can do this by the following code:

//Pan to pushpin
map.PanToLatLong(new LatLongWithAltitude(lat, lng));

A Gotcha!

It may be intuitive for others to NOT place the virtual earth control inside an update panel, but I do remember doing this my first go with this control. Please note, I experienced several issues when doing this as the control still runs primarily on clientside code (I believe the .NET controls are really just wrappers for this clientside code – but maybe someone can check that for me), and it flakes when in an update panel.

To Microsoft’s credit, they probably have explicit instructions all over the place regarding this, but since I rarely read documentation thoroughly… well, you know how that goes.

For a Peak at a Ton of Usage in a Realworld App…

Take a gander at http://www.mycatchlog.com for examples of the Virtual Earth control in action. The purpose of this website is to allow angler’s to log their fishing trips, and based on the time and gps it keeps historically record as well as determines the closest source of reliable weather information for the time of the catch(es).

You can sign up for free (no commitment), or if you’re really lazy check out the free demo account!