Mike's Thoughts on .Net and other things

My thoughts about life and development in the .Net world

I recently had to install Visual Studio 2005 on a Windows 8.  The solution used WSE 3.0, so I need to install the WSE tools.

It turns out the add-in doesn't get installed into Visual Studio 2005 properly.

I found that I had to manually tell Visual Studio to look for the add-in in another folder.

  1. Go to Tools -> Options -> Environment -> Add-in/Macros Security
  2. In the Add-in File Paths list, add the following path:

I couldn't find anything on the Internet about this, so I thought I would share my findings.

I always thought that setting up a SQL Server instance on an existing Virtual Machine (VM) in Azure would be simple, install SQL Server with the defaults and your done.  But Azure is a little different and a hard drive isn't the same as a hard drive in another environment.

A little background

I would not consider myself a DBA by any means.  I am a developer that can install SQL Server on my development machine and use it for projects.  The purpose of this post is a problem I ran into setting up Sitecore within an Azure VM.  

Sitecore uses SQL Server and MongoDB to store data.  A typical test server installs Sitecore into the inetpub folder on the default C: drive.  Within this folder, by default, Sitecore installs 3 (or more) SQL databases.  I will use Azure to setup test environments for various Sitecore projects.  Using the default installation from Sitecore doesn't work well in an Azure environment, so it needs to be modified.

This post is not about a "production" instance of SQL Server

This post will not go into the many tuning options you can do for SQL Server.  However, it can be a start for setting up a SQL Server in an existing VM.   There are many performance tuning options you can do to get SQL Server running smoothly and I would suggest reading the Microsoft documentation.

Setting up the Virtual Machine

Microsoft already has SQL Server template VMs in Azure and if you are starting from scratch, I recommend installing one of those VMs.  This post is more about adding SQL Server to an existing VM.  

When creating your VM, make sure it is a Standard Tier A2 VM or better.  This is recommended by Microsoft.  The relevant difference here is the Input/Output Operations Per Second (IOPs) between Standard and Basic.  Standard gives you more IOPs,

The default Windows VM has 1 hard drive, the operating system.  This hard drive is configured with caching and is optimized to run the operating system.  It is not optimized to run a SQL Server database.  So the first thing you should do is add another disk to your VM.

Creating the Virtual Hard Disk

For best performance, you will want to create 2 Virtual Hard Disks (VHDs), one for SQL data and one for SQL log files.   However, this isn't always necessary and for my case I only created 1 VHD.

Before creating your VHD, you want to make sure your storage account is created properly:
  • Make sure you storage account is in the same region
  • Geo-replication should not be set on the storage account
In Azure manager, select your VM and click on the "Attach" icon and select "Attach empty disk". This will prompt you for a storage location, file name, and size.  Select your appropriate values in these fields, but be careful about selecting the Host Cache Preference.

Azure has multiple caching preferences.  The operating system disk is set to READ/WRITE.  For SQL Server, you want to use "None"

Start your VM with the attached disk(s).  At this point, the disks should not be formatted, so start the Disk Management utility within Windows (Windows+X, Disk Management).

You should find your uninitialized disks.  Initialize your disk if it isn't already  (right clicking on the disk label and selecting initialize should get it done).

Format your disk by right clicking the partition that is not allocated.

In the format window, make sure you change the default to "64K".  This is the preferred allocation unit size for SQL Server.

You should now be ready to install SQL Server on your VM.

Installing SQL Server

I'm not going into the details about how to install SQL Server here.  But you are going to want to make sure the following is configured during your install:
  • Put all database and log files on the disks you created, not the system partition
  • Put the Data and Log files in separate folders.  This gives you dedicated IOPs.  Even better, put them on separate virtual disks.
  • Enable database page compression
  • Limit or disable database auto growth
  • Set the default database folder to your data partition

Modifying an existing SQL Server installation

You may be reading this and think, "I already setup SQL Server on my VM and I need better performance!"  Not to worry, you can modify your existing SQL Server install.

The trick is to move all of your databases to the new locations, including your system databases.

I have found the following process works to move the databases.  Your order and methods may vary.

Moving existing databases

The easiest method I have found is to detach the database, move the database files to the new location, then reattach the database files.

I'm a visual person, so I'll give instructions using SQL Management Studio (SSMS).  All of the following steps can be done with SQL Commands.

  1. Right click on the database in SSMS and select detach.

  2. In the Detach Database dialog, your database will be listed with three columns of interest:
    Drop Connections - Select to drop any existing connections to the database

    Update Statistics - Select to update the statistics on the database before dropping.

    Status - Should say "Ready" to indicate it can be dropped.  If anything else, you should investigate.
  3. Click the OK button to drop the databases.
  4. Depending on the size of your database, and if you checked the update statistics box, this may take some time.
  5. When complete, copy the Database and Log file to the new locations on the new data drive that you created above.
  6. Back in SSMS, navigate to your Databases folder
  7. Right click on the Databases folder and select Attach

  8. Click the Add... button and browse to the database file you moved earlier
  9. The MDF file location should appear in the grid.  The files associated with the database will appear in the grid at the bottom of the window.  Verify the Current File Path for each file listed.  If you moved the log file to a different location, you may need to adjust the path to the new location.
  10. Click the OK button to re-attach the database to your system.
  11. Look in your object explorer and the database should be in the tree.
  12. Repeat the above for each database you want to move to the new drive.

Moving the system databases (except master)

The system databases need to be moved a little differently.  You need to use classic SQL commands to notify the master database the location of the new system databases.

Open a new query window and run the following query for the system database you are moving.
SELECT name, physical_name AS CurrentLocation
FROM sys.master_files
WHERE database_id = DB_ID(N'tempdb');

The script above is for tempdb.  You will need to replace tempdb above with the database you are moving.  The script will return the logical name and path for each file associated with the database.

Run the following query, to move each logical file's path to the new location.
USE master;
MODIFY FILE (NAME = tempdev, FILENAME = 'E:\SQLData\tempdb.mdf');
MODIFY FILE (NAME = templog, FILENAME = 'F:\SQLLog\templog.ldf');

Change the script's database, logical file name variables, and path.  Be sure to use the path that will be the new location of the file.

This will move the location of the files in the database, but not the actual files.  Once you do the above for each system database (except master), stop and start your SQL Server service.

Go back into SSMS and verify that the databases are working properly.

Moving the master database

Since the master database is the all controlling database, you need to move this database manually and change the SQL Server service parameters to point to the new location of master.

In order not duplicate the instructions here that are already made by Microsoft, you can view Microsoft's documentation on this.


This post has given you a basic understanding of how to setup SQL Server on an Azure VM.  The methods listed above have worked for me without incident.  Your configuration and databases may need adjustments to the steps above.   I strongly recommend you review the documentation referenced below before attempting this move on your own system.

Referenced Resources

The following resources were used in developing this blog entry:

I attended my third CodeMash this past week and it was a great time.

For those that have never heard of CodeMash, it is a Software Developer conference in Sandusky, Oh at a water park.  Developers come to the conference to tune-up their skills or learn something new.  The best part about CodeMash is the conversations you have outside of the sessions.

ConfTron, the best conference app for Android!

Found in the Android Market, ConfTron is a great companion app for any tech conference, not just CodeMash.  One of the best things about ConfTron is the developer, Ben Von Handorf.  He attends CodeMash as well as many of the other conferences in his app.  Ben is very open to suggestions to improve his app.  People would pass him by and mention a suggestion or bug to him, and he would fix it before the end of the day.  I think he sent out 5 or more updates during CodeMash.


This year, CodeMash had celebrities attend and give sessions.  These were not the celebrities you see walking down Hollywood Blvd., but celebrities to software developers.  Scott Hanselman and Carl Franklin were among the attendees.  Carl Franklin co-hosts the popular .Net Rocks! podcast where Scott Hanselman is just a big .Net Guru that works for Microsoft.  I admittedly have not listened to .Net Rocks! in a while, but I do follow Scott Hanselman's blog and videos.  I think I will need to start listening to .Net Rocks! again.

My Thoughts

CodeMash is a great conference and I look forward to attending next year's conference.  My thanks goes out to the organizers of this conference.  All of them put this conference on in their spare time.  They don't get paid for it and they put a lot of hard work into it.  So a big thanks to Jim Holmes, Brian Prince, Jason Gilmore, Diane Marsh, and the many others that put this conference on.

I have compiled my "review" of the sessions I attended below.  I provide my feedback so that the presenters and organizers can get an idea of what I felt about the session.  CodeMash doesn't give you a way to give feedback, so I thought this would be a good way.  If you are the presenter, please take my comments as constructive criticism on how you can improve on or continue doing your presentations in the future.


Precompilers are focused sessions held before the main conference starts.  Some of these sessions are half day, some are full day.  I attended two half-day sessions.

Android Development Workshop

I have been interested in developing applications for Google TV as well as Android Tablets and Phones.  Now that my Google TV can load market apps, I was a little more interested.  Jeff McWherter and Scott Gowell tag teamed the session giving a brief introduction of concepts and then going into a live demo.  We were given the opportunity to download some sample code and then run them on our own machine.

Getting started with Android development requires a lot of setup on the PC, that isn't always straight forward.  Scott and Jeff did a great job in helping everyone to get their environment working.  While one was speaking, the other ran around the room helping people.  In my case, I had some additional challenges because I wanted to do development for Google TV and that requires a Linux Distro because it uses KVM for the emulator.  (Hmm, maybe I should write a blog about my experience setting this up...)

The only area I think needed more explanation was the use of Intents.  I was a little familiar with Intents, as Ben Von Handorf gave me a good overview before this session, but I would have liked more.  I think this is an important topic in Android development and should have been covered with more detail.

Overall, I enjoyed this workshop given by Jeff and Scott.

HTML5 is here, and the Web will never be the same

Brandon Satrom and Clark Sell gave this excellent talk about HTML5.  The number of attendees was so large, we had to move to a different room halfway through the session!

This session gave a good overview of all of the new HTML 5 features.  Brandon and Clark gave a good explanation of each feature, spending a lot of time on semantic tags.  They also tried to cover some of the changes to JavaScript, but we simply ran out of time.

In the usual Microsoft fashion (they are Microsoft employees) labs were included in the session.  As I understand the value in doing labs, I think they could have been left out.  This session had too much content to present with the labs in 4 hours.  Regardless, I did walk away with a lot of valuable information.

Main Sessions

Each session is about an hour long and presented in a classroom style environment.

What the heck are they doing over there? Inside the Microsoft Web Stack of Love

As I admitted, I am a fan of Scott Hanselman, so I had to attend one of his sessions.  I have seen Scott's sessions on Channel 9 or other conferences, but it's not the same as attending one live.  The room was full and entertaining has Scott showed several You Tube videos while we waited to get started.

I thought this session was going to be about things I already knew, but was I wrong.  Scott went over the new features that Microsoft is working on in ASP.Net vNext.  Some of the things presented I already knew about, but others I did not.  I was glad I attended this session.

Building Windows 8 Applications with HTML 5 and jQuery

There was some excitement about Windows 8 at the conference. On occasion you saw someone caring a Build Tablet, using it like any other tablet. Rich Dudley gave an overview of how to build Metro style apps using Html and Javascript.

Rich did a good job of giving a brief overview of the new architecture in Windows 8.  He explained the difference between WinRT and Win32 well as this has been a big concern for many developers.  He went over some sample code that he developed in a Windows 8 VM.  I did get something out of the session and Rich was a very good presenter.

Hands-On Responsive and Adaptive Web Design

Ben Callahan gave an excellent talk on how to build responsive and adaptable HTML 5 web sites.  I'll admit that I was expecting something different when I walked into this session, but I wasn't disappointed.  Ben gave good examples of how web sites need to adapt to the screen size rather than use a static grid.  He showed how you can make your website change dynamically from Desktop to mobile and anywhere in between.  I will diffidently start using some of the techniques he presented.

Windows 8 Metro App with Near Field Communication

The subject of NFC has always been an interest for me, so I wanted to hear what Parag Joshi had to say about it.  Parag presented his entire session from a Windows 8 tablet, which I thought was a great idea.  Unfortunately this presented problems because the tablet required an HDMI cable to the projector and none of the cables provided were long enough.  After about a 15 minute delay, he got his presentation up and running.

Parag went over the different technologies of NFC and showed off some code in a test project on how to communicate with the built-in NFC reader in the Build Tablet.  He had some sample tags and demonstrated a cash register concept application.  His presentation was well organized and informative.  Now I can't wait to get my own Windows 8 Tablet!

Android: Where you can stick your data

Since I'm new to Android Development, I thought I would attend Ted Neward & Jessica Kerr's session on saving data to the Android.  They gave an excellent overview on how to store data on your Android, focusing on SQLite.  Jessica gave an example of an application that stored data in a SQLite database and how we can retrieve that data using the emulator.  The session was very informative and I plan to use some of the techniques presented.

Bring the Users: Integrating UX into Your Organization

I walked into this session expecting one thing and got another.  I always viewed UX as how to create great interfaces that are intuitive for the user to use.  This session focused on another area of UX, finding how your users use your application.  Unfortunately for the presenter, Carol Smith, her laptop decided to reboot after doing a Windows Update at the beginning of her presentation.  As a result, she had to present from memory with no slides.  As a result, the presentation turned into a Q & A session about the topic.  The information was valuable even if the presentation material failed.

Dealing with Information Overload

I debated about attending another Scott Hanselman session, but the topic interested me enough to go to it.  As developers, we are constantly interrupted by others in the workplace, either through phone calls, emails, or the over-the-shoulder conversation.  Scott presented tips and tricks on how to manage your workday with these interruptions.  The great thing about his presentation was the explanation about the theories he presented with facts to back them up.  At times you felt he was an expert on social engineering and not software development.  I plan to start using some of these techniques right away, great session!

Putting Web API Security Issues to REST

API security has always been a challenge in my professional life.  You read about different methods for implementing security, but you are never sure if you are doing it right.  Adam Goodman gave a talk about security issues in API's.  Most of the material presented was mostly review of concepts I already knew, so I didn't get much out of it.  He had a long discussion about SSL and its vulnerabilities that I didn't think was necessary.  For me, the meat of the discussion should have been ways to implement Authorization and Authentication.  Unfortunately Adam did not spend a lot of time on this topic.  He explained that you shouldn't invent it yourself but to use something that has already been invented and works.  For his example, he suggested using Amazon's method of authentication with a little bit of explanation as to why.  Unfortunately this was my least favorite session.

Intro to RavenDB: NoSQL is Rapping at Your Door

I always have an interest in document databases.  David Neal gave an excellent presentation on RavenDB, the fully .Net developed document database.  He gave us a brief overview of how we went from SQL to NoSQL and some of the benefits of NoSQL.  He jumped into code giving us examples of how to do standard CRUD operations with RavenDB.  This session made me feel better about using a document database, so job well done David.

Someone recently pointed me to an article about PDC 10 and the lack of Silverlight.  I have followed Mary Jo Foley who follows everything that goes on within Microsoft and respect her work.

Here is my take on it...

Silverlight doesn't have anything to say yet. The focus has been on Windows Phone and Azure. I would say the Azure discussion was over 50% of the keynote. Micrososft has been silent about technologies in big conferences before, only later to announce something big at another conference.

IE has been a problem for developers for some time because of their history of not developing to web standards. Microsoft is trying to get on their good side by showing that the browser is keeping up to date with web standards, and right now, that's HTML 5.

There is also a big rift within Microsoft over HTML 5 and Silverlight. IE is developed by the Windows OS group, so their focus is on the OS elements and its interaction with the world. Bob Muglia is in charge of the Windows OS group, so it is natural for him to push IE 9 and HTML 5. Silverlight is a product of the Developer Division, that has different goals.

I was surprised that Scott Guthrie had a very small part in the keynote, since he is the head of the Developer Division and this was a developers conference (I'm not sure if he reports to Bob Muglia). I'm sure the responses from Scott Guthrie would be different than Bob's.

Azure is going through a big change right now.  During the demo of the keynote, it was mentioned that the Azure portal was re-written with Silverlight.  It appears the portal website is just a Silverlight app.  If Microsoft was only going to use Silverlight for the phone, why would they develop the Azure portal in Silverlight?

Personally, I don't see Silverlight going away anytime soon. Silverlight will always be ahead of HTML 5 in features and functionality (as will Flash). HTML 5 is just trying to catch up to Flash and Silverlight.  Regardless, everything we develop today has to support a browser that is at least a few years old.  As developers, we constantly have to worry about what version of Firefox or IE the client is using and then develop our application around it.  Until everyone is on IE 9 (or any HTML 5 browser) we will still need to develop this way.

If Steve Ballmer made similar statements, I think my viewpoint would be different.

There was an error in this gadget