Case Study: Migrating Microsoft's .NET Community Websites to Microsoft Azure

Have you ever wondered how much work is involved when migrating a traditionally-hosted production website to Microsoft Azure? If so, the following case study might be of interest to you:

Microsoft Azure Migration: Microsoft’s .NET Community Websites
Migrating Microsoft’s ASP.NET and IIS.NET Community Websites to Microsoft Azure

Here's a little background information on this migration case study: last fall Microsoft worked with two of it's hosting partners, Neudesic and Orcsweb, to migrate the and websites from a traditional web hosting scenario (e.g. websites hosted on physical servers) to virtual machines that are hosted in the cloud on Microsoft Azure. Here's what the web farm looked like before the migration:

After the migration, Microsoft had reduced both the hosting costs and the number of servers required by almost 50%.  Here's what the web farm looked like when the migration had been completed:

There are a lot of people who helped make this migration a success - and there are far too many to name here - but I would like to say a special "thanks" to everyone at Neudesic and Orcsweb for making this migration process as painless as possible.

Note: This blog was originally posted at

How Much is that Lizard in the Window?

I was sitting at the desk in my office when I heard scratching on my window, so I opened my blinds and I saw this guy trying to get in.

For those of you who have never seen one before, this is a Desert Spiny Lizard, and apparently he was confused by the window glass. Based on the fact that the slats in my window blinds are 1.75 inches apart, that places the length of this big guy at somewhere between 10 and 11 inches in size.

I am reminded daily that living in the desert is kind of an adventure... Smile

Simple Utility to Calculate File Hashes

I have to download various files from time-to-time, and it's nice when websites provide checksum hashes so I can validate that the file I just downloaded matches the version on the server. (ON a related note, I wrote a blog several years ago which showed how to create a provider for the IIS FTP service which automatically creates checksum files when files are uploaded to a server; see my Automatically Creating Checksum Files for FTP Uploads blog post for the details.)

In order to calculate hashes for files that I have downloaded, several years ago I wrote a simple command-line application for Windows which uses several of the built-in algorithms in .NET's System.Security.Cryptography. And while I realize that there are probably other tools that provide this same functionality, I have used this little utility for years, and I've had several people ask me for copies. With that in mind, I thought that it might make a nice blog topic if I shared the code with everyone. (Note: It's a really simple sample; the .NET framework does all the real work for this application.)

Without further fanfare, here's the source code. In order to use this code sample, you need to create a new C# project in Visual Studio and choose the Console Application template. When the new project opens, replace the template's code with the following:

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Security.Cryptography;

class Hash
    static void Main(string[] args)
        // Verify the correct number of command-line arguments.
        if (args.Length != 2)
            // Show the help message if an incorrect number of arguments was specified.
            byte[] hashValue = null;
            // Verify that the specified file exists.
            if (!File.Exists(args[1]))
                // Show the help message if a non-existent filename was specified.
                    // Create a fileStream for the file.
                    FileStream fileStream = File.OpenRead(args[1]);
                    // Be sure it's positioned to the beginning of the stream.
                    fileStream.Position = 0;
                    // Use the specified hash algorithm.
                    switch (args[0].ToUpper())
                        case "MD5":
                            // Compute the MD5 hash of the fileStream.
                            hashValue = MD5.Create().ComputeHash(fileStream);
                        case "SHA1":
                            // Compute the SHA1 hash of the fileStream.
                            hashValue = SHA1.Create().ComputeHash(fileStream);
                        case "SHA256":
                            // Compute the SHA256 hash of the fileStream.
                            hashValue = SHA256.Create().ComputeHash(fileStream);
                        case "SHA384":
                            // Compute the SHA384 hash of the fileStream.
                            hashValue = SHA384.Create().ComputeHash(fileStream);
                        case "SHA512":
                            // Compute the SHA512 hash of the fileStream.
                            hashValue = SHA512.Create().ComputeHash(fileStream);
                        case "BASE64":
                            // Compute the BASE64 hash of the fileStream.
                            byte[] binaryData = new Byte[fileStream.Length];
                            long bytesRead = fileStream.Read(binaryData, 0, (int)fileStream.Length);
                            if (bytesRead != fileStream.Length)
                                throw new Exception(String.Format("Number of bytes read ({0}) does not match file size ({1}).", bytesRead, fileStream.Length));
                            string base64String = System.Convert.ToBase64String(binaryData, 0, binaryData.Length);
                            Console.WriteLine("File: {0}\r\nBASE64 Hash: {1}", fileStream.Name, base64String);
                            hashValue = null;
                            // Display the help message if an unrecognized hash algorithm was specified.
                    if (hashValue != null)
                        // Write the hash value to the Console.
                        PrintHashData(args[0].ToUpper(), fileStream.Name, hashValue);
                    // Close the file.
                catch (Exception ex)
                    Console.WriteLine("Error: {0}", ex.Message);

    // Display the help message.
    private static void ShowHelp()
    {/>        Console.WriteLine("HASH.exe <hash algorithm> <file name>\n\n" +
            "\tWhere <hash algorithm> is one of the following:\n" +

    // Print the hash data in a readable format.
    private static void PrintHashData(string algorithm, string fileName, byte[] array)
        Console.Write("File: {0}\r\n{1} Hash: ", fileName,algorithm);
        for (int i = 0; i < array.Length; i++)
            Console.Write(String.Format("{0:X2}", array[i]));

When you compile and run the application, you will see following help message when you specify no command-line parameters:

HASH.exe <hash algorithm> <file name> Where <hash algorithm> is one of the following: BASE64 MD5 SHA1 SHA256 SHA384 SHA512

When you specify one of the supported hashing algorithms and a filename, the application will display something like the following example:

C:\>hash.exe SHA1 File: C:\ SHA1 Hash: 57686F6120447564652C20426F6220526F636B73

That's all there is to it. As I mentioned earlier, it's a pretty simple sample. ;-]

Note: This blog was originally posted at

Global Warming versus Common Sense

I have to admit, I love a good conspiracy theory. But I need to explain what I mean by that - I don't actually believe conspiracy theories, but I love to read articles and blogs from people who do. I typically think that most of the people who believe various conspiracy theories are kind of insane, and therefore they are a never-ending source of amusement for me.

This brings me to one of the biggest conspiracy theories that's circulating the planet right now: Global Warming and Climate Change.

I thoroughly love watching the endless debates that inundate the blogosphere about these two subjects. The bulk of the Internet appears fall into one of two ideological camps: there are "Deniers" who think that nothing is happening, and there are "Chicken Littles" who think that the world is coming to an end. (I personally fall into the group of amused spectators who are constantly laughing at everyone else's reactions. And mark my words people - I am not laughing with you, I am laughing at you.)

With that in mind, let's look at some of the actual science. To begin with, the following new article offers up a dire prediction that the Antarctic ice will melt and the oceans will rise as a result:

This should come as a shock to the NASA scientists who were reporting less than two years ago that the Antarctic ice had reached an all-time high:

With conflicting articles like these making their way around the Internet, what's a poor armchair scientist supposed to believe? Fear not, for I bring you undisputed truth: ice melts. That's pretty much it. Your scientific takeaway should be this: unless the sun burns out, we're going to have ice in some places of the planet, and no ice in other places. The ice in some places will eventually melt, and some places where there currently is no ice will eventually get ice. If you've studied the history of this planet, then you already know these facts. If you haven't studied the history of the planet, then be quiet until you do. Period. End of story.

That being said, it is an undeniable fact that the earth is getting warmer. Although it needs to be said that the global temperature is rising from one of the lowest temperatures that has occurred in the past several thousand years. 1,000 years ago the earth was considerably warmer than it is now, but 500 years before that it was cooler than it is now, and 500 years before that it was even warmer than it was 1,000 years ago. That's the way that our planet works: the earth heats up, then it cools, then it heats up again. This has been going on for millions upon millions of years. The questions with which we need to be concerned is how fast the temperature is rising, and what is causing the temperature to rise. Here's where I need to intercede once again: unless you are a scientist who is qualified to analyze these two questions based on the staggering volume of information available and years of professional research experience, then you need to be quiet and let someone who is qualified do their job.

As I mentioned earlier, we can easily see that the earth has gone through several demonstrable heating and cooling periods over the past several millennia. But there is one major difference between those periods and the present: we can now take detailed measurements of the process, and unfortunately the scientific world is filled with scientists who cannot agree on the severity of this new data. But what is far worse is that the media world is filled with reporters with nothing better to do than to create ominous predictions in order to drive traffic to their websites and thereby increase their advertising revenue. So we wind up with a situation where people can throw news articles back and forth all day long saying one thing or other without ever proving a valid point. Here's a perfect example:

As for me, the story gets better, because eventually the conspiracy theorists get involved. There are several theories out there, and they come from all sides. For example, there are some "deniers" who feel that all of this Global Warming stuff is a bunch of malarkey, and their position seemed to be reinforced when it was revealed that a lot of climatologists were faking their data. (It seems that some scientists believed that "The Ends Justify The Means," so they thought that it was acceptable for them to manipulate their data because "The World Will Eventually Thank Them." That may have been a noble cause in their minds, but unfortunately that's bad science.) Then there are the Global Warming proponents who believe that the real impetus behind the deniers is big business and the evil global corporate cabal who would sell their family members if it made a profit. (Unfortunately, there really are some people who are that heinous.) In either case, I love reading the theories from both sides of the argument, because it's not that simple. As a result, their competing theories bring me unending amounts of entertainment.

But at the end of the day, a few categorical facts remain in this debate:

  1. The average person is not an actual scientist, and is therefore unqualified to interpret the available data, so he or she is just repeating something they read. As I said earlier, these people need to either go back to school and study the subject in detail, or silence themselves because they're just adding useless noise to the debate. (Although I have pointed out in previous blogs that some people are just parroting whatever their political party of choice is saying, and those people look like idiots.)
  2. The actual scientists involved in measuring the data are fractured into opposing groups who think that either the sky is falling or this is a normal process which is nothing out of the ordinary. (And there are a host of other opposing theories, too.) These people are at least qualified to publish their findings in a place where the average person is free to read, (as long as these average people keep their unwelcome and uneducated comments to themselves).
  3. The earth is constantly changing as the continents move around, and as a result the global temperatures will be higher or lower than the present, weather zones will shift locations, volcanoes will erupt and spew greenhouse gasses into the atmosphere, tsunamis will devastate coastal regions, the ice caps will shrink and grow, earthquakes will change the landscape, and sea levels will rise and fall.

The only constant in all of this turmoil is change. But unfortunately when change is detected within our current ecosphere and subsequently over-represented by the press, opportunistic knee-jerk reactions from bone-headed idiots are the inevitable result. To quote the great philosopher John Osbourne, "The media sells it, and you live the role."

There is one last thought which I want to leave you with: regardless of your views on Global Warming and Climate Change, we only have one planet - so we only have one chance to get things right. If we destroy the planet, then it's gone. Forever. Period. The Boy Scouts teach that you should leave a place in better condition than you found it. That's a good rule to live by, and it's pretty easy to implement in your daily life through simple actions: recycle as much as you can, turn off lights when you leave a room, pick a car with better gas mileage (or ride a bike when possible), etc. Even if it turned out that humanity had no impact on Global Warming or Climate Change, everyone should still do their part to cut down on pollution and make the world a better place; that's just good stewardship.

UPDATE (October, 2015): The following information is a perfect illustration of why climatology articles cannot be taken out-of-context by their title alone:

To summarize the article, NASA's monitoring of Antarctica has revealed that snow accumulation exceeds the loss of ice shelves; however, if you walk away with this single talking point without reading the rest of the article, you are ignoring the fact that NASA fully acknowledges that Antarctica is actually losing ice. So even though the frozen regions of Antarctica are increasing in volume, that does not mean that glaciers in Antarctica have ceased melting.