Today Microsoft and Nokia announced they would be forming a global alliance. I have to wonder what this could bring to the future of mobile computing for the enterprise. The general consumer seems to love the iPhone (or the marketing around it), but the restrictions placed on the device and service leaves a lot to be desired for the enterprise customers. In my opinion vendor lock-in has always been the biggest obstacle to wider-spread adoption of Apple’s products.

Now I could consider Blackberry and Google Android to be the only other real competitors here, but I think the Nokia and Microsoft partnership opens up some bigger possibilities, like competition with HP, Asus, Acer and Lenovo (oh, I guess Dell is still around too).

Let’s face it, the features of a Netbook are practically already built into the Nokia N97, albeit at a slightly larger price tag. If Nokia plays this right, they could be the only provider to have their own device and operating system that runs Microsoft Office at an affordable price. Why is this important, well Microsoft Office generally runs most of the Fortune 1000. Nokia could become a serious player in the enterprise market overnight.

Copyright © Scott P. Rudy 2009 All Rights Reserved

If you are running the Business, Enterprise or Ultimate version of Windows Vista or Windows 7 you can use the Windows Backup and Restore Center to conduct full hard drive backups of your computer. All you need is enough storage media that can accommodate the used portion of your hard drive. While you could use CD or DVD storage, the simplicity of using a large external USB hard drive is much more convenient, especially with the size of some of the hard drives shipped out today.

This feature has been long overdue in the Windows world, but it now provides some great reassurance. Full backups simply place your files into VHD files. However, what happens when you backup your machine and then reinstall an OS from scratch? How do you get the files off of your VHD. Well, if you are running Vista you need to use a tool like VHDMount that ships inside the Windows Virtual Server 2005 R2 sP1, unless you have a Windows 7 install CD handy and you swap out the boot loader by looking at one of my previous posts.

You can’t install VHDMount on Windows 7, but you don’t need to either. The built-in DISKPART utility allows you to mount VHD files as a drive letter just like VHDMount. Simply locate your VHD file and use the following commands in a command prompt with elevated privileges.

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\users\scottrudy\>DISKPART

Microsoft DiskPart version 6.1.7600
Copyright (c) 1999-2008 Microsoft Corporation.
On computer: SCOTTRUDY

DISKPART> SEL VDISK file="E:\…\1c44c446-91c0-11dd-8709-806e6f6e6963.vhd"
DiskPart successfully opened the virtual disk file.

DISKPART> ATTACH VDISK
DiskPart successfully attached the virtual disk file.

When you are finished simply type DETACH VDISK to unmount the file.

Copyright © Scott P. Rudy 2009 All Rights Reserved

When applications display ASP.NET runtime error messages to the end user, the root cause of the problem is due to insufficient error handling within the application. To gain the most granular control over errors, ASP.NET page events should be wrapped in a try…catch block so that proper error handling can be performed. However, the runtime does not provide this by default, so it must be manually performed. Any time something must be done manually the potential exists for a human to forget. Fortunately there are other features provided by ASP.NET that can provide a higher level of control.

Note – While it is also possible to implement a custom IHttpModule to perform error handling, it is out of scope for this post.

The ASP.NET framework essentially adds three additional ways to perform error handling by using, page events, application events and custom error handling in the app.config file. The first of these three, page events, allows the developer to use the Page_Error event handler to process any unhandled exceptions by subscribing to the the Error event inherited from the System.Web.UI.TemplateControl class. This can be done on each page to allow for fine grained control over the error handling. However, as with any event, you must be sure to manually subscribe, or use the AutoEventWireup feature. Developers that use this method must also consider whether or not the error should be bubbled up to the application level. In order to prevent the propagation from happening the handler must make a call to Server.ClearError() once the exception is properly handled. Applications that use a custom base class for all pages can use this feature to catch all unhandled exceptions. However, since inheritance sometimes must be broken, ASP.NET provides a simpler way to do this.

The second error handling method provided by the ASP.NET framework, application events, performs nearly the same functionality as the page event handler. The difference is that the Application_Error will catch any unhandled exceptions within an application’s scope. This handler must subscribe to the System.Web.HttpApplication’s Error event in the application’s global.asax file. Note that the AutoEventWireup and the Server.ClearError() concerns from the Page_Error description above also apply to the Application_Error event handler. However, once the error is handled at the application level, it might be advisable to let the user know something happened so they can notify someone. If the Server.ClearError() method is not called then another feature of ASP.NET can be put to use.

The last handling method provided by the ASP.NET framework is the <customErrors /> element in the web.config file. This element allows for an application to specify a default page to go to when there is an unhandled exception by using the defaultRedirect attribute. Simply set the value of the attribute to a relative or fully qualified hyperlink that the application should use. In order for the application to use this page the value of the mode attribute must also be set to “On” or “RemoteOnly”. Setting the value to “RemoteOnly” allows a system administrator to log on to the machine where the error is occurring and allow the ASP.NET runtime error message to display in the browser. For development environments this value is often set to “Off” so that the developers can see the error messages that are occurring. This is extremely helpful when an application writes messages to the event log, but the developers don’t have the necessary privileges to view the event log. The customError element also allows a developer to tailor how various HTTP status codes are handled by nesting an <error/> element inside.

Copyright © Scott P. Rudy 2009 All Rights Reserved

I am normally one of the first to jump aboard and start playing with a new OS. For some reason, however, I have been holding off on running Windows 7. I imagine a big part of it has to with the length of time it took me to get my Vista image right and the fear that I would forget something by reinstalling the OS (I don’t usually do upgrades). I did try the first release of Windows 7 on a VM, but the performance of the PC I used was just abysmal.

Just last weekend I decided to try something I had heard Scott Hansleman mention on show #458 on .Net Rocks. Apparently it is possible to boot off a VHD (virtual hard disk) using the Windows 7 boot loader. What Scott mentioned though is that it is possible to overlay the Windows Vista boot loader with that of Windows 7. There a few hurdles to jump before you can even begin installing, however, as this isn’t as simple as creating a VPC VHD file (which doesn’t natively work)

Note – you will not be able to place the VHD file on a disk that is encrypted by BitLocker or some other encryption sofware. So if you don’t have another partition you might want to look at running DiskPart to shrink the encrypted partition and create a new unencrypted one at least 10 GB long (although I recommend at least 30 GB).

Step 1) First, you have get a copy of the Windows 7 image by downloading it from Microsoft. The file comes in the form on an ISO image and you need a way to get the files out of it. You can either burn the image to a DVD or use a tool that allows you to mount the image onto the file system. I recommend burning the image to DVD, as you will need it later anyway.

Step 2) The next step is the most tedious. You need to locate the boot loader. There are two ways to do this. The “easiest” way is to install Windows 7 somewhere, like a VPC image, and copy the files from the installed copy. If you do this you can skip to step 4.

Step 3) If you are feeling a bit more adventurous you might try to download the Windows 7 AIK (which contains the ImageX command line tool) and the gImageX tool. These two tools will allow you to open the WIM file that holds the boot loader, boot.wim. The boot.wim file is located at \sources on the Windows 7 install disk. In order to use gImageX I recommend you create a new folder called ImageX for the exe. Then I recommend copying the following files from the \Program Files\Windows AIK\Tools\platform folder into the new folder, imagex.exe, wimgapi.dll, winmount.inf, winmount.sys, winmountinstall.exe and wimserv.exe. Once you have done that double click the gImageX.exe file and click the Mount tab. You will need to choose a folder for the mountpoint and use the boot.wim file as the source. Leave the image as “1” and click the Mount button.

Step 4) To get the Windows 7 boot loader files you will need to create a new folder and go to the root of the Windows 7 installation (or mountpoint if you are following the adventurous path). You need to copy the \Windows\Boot\PCAT\bootmgr and the \Windows\System32\bcdedit.exe files to the new folder.

Step 5) Modifying the Windows Vista boot loader while Vista is running proves to be a difficult task, so the files need to be placed in some accessible place on the Vista machine you plan to install Windows 7 on. Make note where you copied these files as it will be important later. If you have disk encryption (e.g. BitLocker) running you will need to turn it off at this point in order to make modifications to the boot loader.

Step 6) Now you need to place the Windows 7 installation DVD (I told you would need it later) into your Windows Vista PC and reboot. You may have to go into your BIOS settings to ensure your PC can boot from a CD ROM, but you should see the Windows 7 installer come up.

Step 7) Click the next button on the intro screen and then choose “Repair your computer”. Then choose “Restore your computer using a system image that you created earlier” and click Next.  Windows may or may not find an image, but either way you need to click Cancel until you see a “System Recovery Options” window. At this point you will want to choose “Command Prompt”.

Step 8) At this point you will need to locate the boot loader files you copied earlier, in step 5. You will need to copy them over the existing files on the Vista OS drive. The driver letters at this command prompt are possibly different than the ones you usually see in Windows Vista, so you may need to look for the drive that has a Windows directory in it by using the “cd” (change directory) and “dir” (directory listing) commands. You will want to copy the bootmgr file to the \Windows\Boot\PCAT\ folder and the bcdedit.exe file to the \Windows\System32\ folder.

Okay now the boot loader is in place so you just need to prep a VHD file and start the install…

Step 9) I recommend creating the vhd file in a new folder on the partition you want the file to be stored(remember it cannot be BitLocker encrypted) . You can do this by executing a “mkdir” (Make Directory) command and then navigating to that folder using “dir”.  Type the following command set into the command line:

diskpart
create vdisk file=YourDriveLetter\YourPath\win7.vhd maximum=30270 type=expandable
attach disk
exit
exit

Step 10) Close the “System Recovery Options” window by clicking the [X] (DO NOT click the shutdown or restart buttons). Click “Install Now” and then select the newly create disk which show as a disk with unallocated space.

Step 11) After Windows 7 installs you should see a new boot menu on load that allows you to run Windows 7 (off a VHD with full hardware support) and one for Windows Vista.

Don’t forget to turn disk encryption (e.g. BitLocker) back on in your Windows Vista OS if you temporarily disabled it.

Copyright © Scott P. Rudy 2009 All Rights Reserved

I have been using Vonage for several years now and they offer features like forwarding, voice mail transcribing and unlimited calling from within the US and to several countries for a competitive price. Yet there are a few features, like SMS forwarding, that have never been incorporated into the service. Tonight I finally received my invite to Google Voice and I think the marriage of the two makes for unified communications as it should be with no additional cost beyond my already present Vonage service.

Many companies license and run Microsoft Exchange Server and Microsoft Office Communication Server which have the ability to do everything Google Mail, Voice and Talk can. I am not sure if this is a bandwidth issue or just a general cost issue, but very often those companies turn off those features that would make lives for their employees so much easier. It amazes me that Google is able to provide these services to the general public, for free (provided you can live with the targeted ads)!
Many employees travel frequently and sometimes are in places where cell phone coverage just isn’t that good. Being able to add a forwarding number with a few clicks of a mouse is a convenience that needs to be there. Let us not forget the many folks who are now working from home and are “required” to provide their own home networks, phone lines and mobile devices out of pocket. Then add in the fact that many folks have endured multiple income, health benefit and retirement reductions in the past year. Any cheaper alternative to paid long distance is a welcome perk.

Okay, so where I am going with all this. It has been well known that Google “uses” the content in email to render targeted ads. I can only imagine they will be doing something similar with voicemail transcriptions. The one concern that must be realized is that Google Voice will take over as your voice mail provider when you use their number. Anyone can realize that there “could” be potential security implications here if you have insider information being spouted out onto your voicemail. However, when employees have to pay for their own communication networks do corporations have the right to govern the activity? I am very curious to see how this technology will disrupt the status quo of communications in the corporate world.

Copyright © Scott P. Rudy 2009 All Rights Reserved

I am currently involved in a project that uses ASP.NET. The project is on its second implementation. During the first implementation the environment was controlled by the project team and they chose to turn on persistent sessions for the load balancers. This allowed the system to store session data in memory for the application.

Now the project is being rolled out for a new client where the environment is no longer controlled by the team. The client has specified that a central session server must be used so that the load balancers can be used without persistant sessions, as a recommended best practice by the vendor, F5 Networks.

I was tasked to assess the readiness of the product to be placed in this environment. After changing the web.config file to point to the new session server I immediately started seeing problems with pages not loading correctly. The problem was I couldn’t debug the issue because the .Net Framework was doing the work and I didn’t have source code or PDB files for the libraries. I guessed the issue dealt with serialization since objects that cannot be serialized will not go across the wire to the session server. So I took the first page the application hits and placed the following code into the Page_Load event handler (wrapped by a try…catch, of course):

IFormatter formatter = new BinaryFormatter();
using (System.IO.Stream stream = new System.IO.FileStream(
    "C:\\Users\\rudyscot\\desktop\\userstate.bin",
    System.IO.FileMode.Create, System.IO.FileAccess.Write,
    System.IO.FileShare.None))
{
    formatter.Serialize(stream, Session);
    stream.Flush();
    stream.Close();
}

Any issues with the serialization will throw an exception, so I was able to see what the issues were by looking at the Message property of the caught Exception. All of the issues turned out to be what I was expecting. They were all classes not marked with a Serialization attribute. Unfortunately, one of the objects turned out to be a .Net framework object though, so code changes needed to occur to move the needed properties of that control to an object that could be serialized.

Copyright © Scott P. Rudy 2009 All Rights Reserved

I was writing some unit tests the other day and wanted a way to compare an entire object for a test assertion. I also wanted to be able to hand write an object and then use it to compare a result in a test. I immediately thought of XML serialization in .Net and started writing the code.

Unfortunately, it was then that I realized that the XML Serializer has a few limitations. First of all, you must have a default constructor declared for all of your classes. Now I normally use this convention (especially with the C# 3.0 initialization features), but there were several classes I didn’t write in the project I am working on.

The second limitation had to do with properties in a class that were declared as interfaces (e.g. IList<T>). I don’t know why Microsoft didn’t include this as part of the serializer, but it is definitely missing.

I started thinking about WCF and serialization across the wire and realized this problem had to have been solved by the DataContractSerializer or people would be irate. So I created some code to use the DataContractSerializer instead. The code looked like this:

DataContractSerializer oDcs =
new DataContractSerializer(typeof(TypeToBeSerialized));
XmlWriterSettings settings =
new XmlWriterSettings() { Indent = true };
using (XmlWriter w = XmlWriter.Create(fileName, settings))
{
    oDcs.WriteObject(w, list);
}

That worked quite well.

Copyright © Scott P. Rudy 2009 All Rights Reserved