My Recent Visit to MS Research

A couple of weeks back (sorry still catching up) I had the great fortune of being invited to visit a MS Research event called TechFest. MS Research hosts this event annually for fellow MS Employees and opens up their doors so they can see what they've been working on, and for the first time in their 15 year history, they allowed those of us without the trademark MS employee blue-badge to attend. The "exhibit hall" was very "science fair" full of academic research geeks and no marketing folks.

MS Product teams have been going through an era of transparency over the past few years and it was nice to see this principle infect MSR. A few quick facts that impressed me about MSR:

  • MSR has been grown from 0 to 750 researchers over the past 15 years. This is the equivalent of creating a new Berkeley CompSci Faculty...each of those 15 years.
  • MSR has researchers in facilities located in Redmond, Silicon Valley, San Francisco, Cambridge, Beijing and Bangalore.
  • MSR runs the largest CompSci Ph.D. internship program. Currently there are 800 Ph.D. interns working worldwide in MSR labs. In the US last summer, MSR had 300 interns in their labs which is impressive considering that the US produces about 1200 CompSci Ph.D.'s annually

There was lots of interesting projects to learn about, some very space-age and cool, others kind of weird and hard to see any use for, and some that you wish were in a shipping product yesterday. Then there are some that caused attendees with certain allergies to get all stuffed up. Check out some of the videos here and here.

WebParts and the need for a Database

I'm doing some work creating WebPart components in ASP.NET 2.0 and discovered a dependency that I wasn't initially expecting...the need for a database.

It appears that in order to even place a WebPart onto a form, you need to have a database. Or at least a persistent data store. A little bit of investigation found this information available in a number of places. The WebPart isn't actually the problem, so much as the WebPartManager. The manager is responsible for keeping track of the various WebPartZones and which WebPart is in which Zone. To persist this information across iterations of the page, the location information is stored in a database. So, even when the page is displayed the first time, a database connection needs to be available.

While you can create your own provider, the easiest mechanism is to use the aspnetdb, which is also used by the Membership and Role providers. To add the database to an existing SQL Server instance (either SQL Server 2000 or 2005), use the aspnet_regsql command, which is found in c:\Windows\Microsoft.NET\Framework\v2.0.50215. Once the database is available, a connection string (call it AspNetDbConnectionString to match the upcoming example) should be defined in the web.config file, along with a webParts element that includes a personalization tag, similar to the following:

  <personalization defaultProvider="SqlPersonalizationProvider">
      <add name="SqlPersonalizationProvider"
        applicationName="/" />
      <deny users="*" verbs="enterSharedScope" />
      <allow users="*" verbs="modifyState" />

Microsoft Vista Launch in Toronto

One of the benefits of being an MVP is that occasionally you get to do really cool things. And, in this particular case, I'm using the traditional meaning of cool rather than the geeky.

This event is going on all week, but I get to spend Groundhog's Day in an ice house helping introduce Visa and Office to the community. I'm looking forward to the opportunity, although I do need to go out and get some long underwear before Friday. I've been told that the temperature inside the house is a few degrees below zero. Could be all the ice in the vicinity. ;)

Decrypting Stored Procedures

As part of work that I was doing recently, I had to generate the creation script for a SQL Server database. While running through the Generate Script task in Management Studio, I received an error that indicated that the stored procedure was encrypted. Never having running into encrypted stored procedures before, I was a little surprised. It turns out that encrypted stored procedures can’t be scripted. Could be that they’re encrypted. Duh!

Anyway, the documentation says that, for encrypted stored procedures, it is important to generate the creation script prior to encryption. So I started asking the client if they had the creation scripts. It turns out that a previous DBA had invoked the annoying ‘job security’ clause when creating the stored procedures, so the creation scripts were nowhere to be found.

Some additional research on the problem and I find a third party component that can decrypt the stored procedures. It’s called SQL Decrypter and it’s from Orbital Technologies ( I have to say, it’s a nice tool. Does exactly what it’s supposed to do, quickly, easily and painlessly. So the client gets the generation scription and Orbital gets another (I’m sure) satisfied customer.

DataFormatString doesn't seem to work on BoundField elements

I was using the BoundField element in ASP.NET 2.0’s GridView control. More specifically, I was attempting to use the DataFormatString element in order to change the look of dates and dollar amounts as they get displayed. Much to my dismay, it didn’t look like the format string was being applied to the data.

After digging around a bit (and making sure that my memory of the format codes was accurate), it turns out that the problem is caused by a combination of factors. The first is that the default value for the HtmlEncode is true. The HtmlEncode property determines whether the value of the bound field is HTML encoded before being transmitted to the browser. The second factor is that, when the DataFormatString is applied to the value, any HTML encoding takes place prior to the formatting.

When, for example, a date is rendered, the date value is converted to string using the ToString() method. The string is then HtmlEncoded. Finally, the String.Format method is used to format the string using your format codes. However, your date format codes won’t work because the ‘date’ is no longer a DateTime variable. It’s a string. So instead of formatting the data, it is displayed using the ToString() layout. The same problem exists for other non-string types, including currency, floats, etc.

The solution is to set the HtmlEncode attribute to false on the BoundField element. Now the value is not converted to a string prior to the Sting.Format method call, the result being that the String.Format method uses the typed value (not the ToString version) and the format string in the manner that you (and I) expect.

Tagging isn't just for walls anymore

You may or may not be aware of the current craze sweeping the (cringe) blogosphere. When you get tagged, you are supposed to reveal five things about yourself that the typical reader is unlikely to know. Since I was honoured by Rob Windsor with a tag, I feel compelled to continue the chain.

1.  My first job in the computer industry was also my first job ever. I was fifteen and I spent the summer writing computer games for the Oxford County Board of Education. On a Commodore Pet. The coolest part of this is that a number of the games that I designed were eventually converted into LOGO and were still being used by the province of Ontario more than 10 years later.

2.  I was a poor writer when I was in high school and university. Not that I’m a great writer now. Only that it comes much more easily than it used to. The key for me was a suggestion to write the way that I speak. Don’t worry about the grammar or coherence. That can be added in the editing process. Just get words down and work from there.

3.  I grew up in Canada and never learned how to skate. Not until this past December, when I laced up skates for the first time in over 35 years. Now I play in two hockey leagues. Not well, but not killing myself is my only bar to success in the sport.

4.  I love playing volleyball. I played the sport on and off for years, but took it up with a vengeance once I moved back to the Toronto area. My height (or lack thereof) means that I set when I’m playing court volleyball. But I also play beach volleyball in the summer, where I mostly play doubles.

5.  When I lived in Los Angeles, I tried out for a number of game shows. This includes a couple that never made it to air, as well as the venerable Jeopardy. I actually appeared on one show, QuickSilver. It was on the USA Network for a couple of seasons. I won the grand prize for the show that I was on, said grand prize being a week at a Dude ranch in Colorado. And I still have the tape to prove this.

Now to pass the baton on to others. I’ll start with one of my partners, Dave Lloyd. Next is Dave Totzke. The someone who probably doesn’t know that I read his blog: Eli Robillard. Finally I go way up the food chain to two blogs that I read to help me get better with my writing and presentation skills, And I know that they have no idea that I read their posts religiously: Kathy Sierra and Garr Reynolds.

A Nice New Year's Gift

So when I popped into my In-Box this morning, I received a nice gift from Microsoft: news that I have been re-upped as an MVP.

For those of you who have never heard of the MVP program, you can visit But it’s basically an award to for those who are active in the community. You don’t have to be a pure evangelist of Microsoft technologies. In fact, being honest and up front about the good and the bad is considered as part of the package. But you do have to offer help and advice to those who need it. There are many forms that community involvement can take, including writing blogs (such as this one), answering questions on forums, writing books/articles for magazines, and speaking at user groups. I’m lucky enough to enjoy participating in all of these activities, as well as working in an environment that encourages it.

So thanks Microsoft for the honour and I look forward the technology developments in the next year.

Why the Silence

Those of you who actually read my blog on a regular basis might have wondered what had happened to me. While I’ve never been a ‘post-a-day’ kind of writer, it’s rare to have two months go by without a post of any substance. Well, I do have a reason for my absence.

I have spent the past months working on three separate writing projects, specifically the training kits for the Web, Windows and Enterprise Pro exams that are part of the MCPD certification. The names are too long to include, but they are MCPD Self-Paced Training Kits for exams 70-547 (Web), 70-548 (Windows), and 70-549 (Enterprise). None of these books are available yet (Amazon has them being released on Feb 28th), but I put the final stamp of approval on my part a short time ago.

This isn’t the first book I’ve been involved in. The other one was called The ASP 3.0 Code Maintenance Handbook from Wrox. The Friday before it was release, Wrox went bankrupt, so you can imagine that it didn’t sell incredibly well. In one of life’s little ironies, all three of these unreleased books are already selling better than my first ever did. And I can’t imagine that I’m a bad enough writer to drive Microsoft press out of business.

Anyway, once the holiday season has passed, I fully expect to be increasing my blog post output. So look for topics of interest for people who are working with ASP.NET 2.0, as well as anything else that might catch my interest.

Visual Studio 2005 Service Pack(s) 1


As an early Christmas present, Microsoft released a welcome service pack for Visual Studio 2005 last week. There's downloads available for each appropriate edition including the team foundation server. Check the download pages for releases notes as well.

There is still another service pack/update in the wings to provider greater facilities for integration with Windows Vista. It is supposed to be available in the first quarter of 2007, but you can download the beta of that service pack now.

For sometime now, I've done almost all of my development exclusively in virtual machines such as VPC and VMWare. This has been the only sane way to minimize disruption with the transition from Windows XP to Vista on my primary notebook.

As an aside, I heard a rumour that the VMWare Workstation 6.0 beta now supports the option to run your IDE on your host OS, and then to deploy, run & debug inside a virtual machine. That is certainly going to open some interesting scenarios. I can see that being very helpful for automated unit testing on via a build server, testing out on multiple configurations, environments, operating systems, etc.

Building Cathedrals, Bazaar's, and Mystery Houses

Almost since software development has been a profession has the practice of software development been compared to the construction industry.

In this sphere of analogy, I often use the contrast in the process of architect cathedrals against the evolution of a bazaar during my lectures on software engineering. I often use this analogy in comparing waterfall-style, can't-have-too-much-uml monolithic architecture with a more organically evolving service oriented architecture.

I've heard others use the cathedral and the bazaar analogy for a few other software engineering comparisons, but I believe the first use can be attributed to Eric S. Raymond's book "The Cathedral and the Bazaar" where he observes how Linux was built with an open source model.

One must be careful not to use Bazaar-style engineering as an excuse for not maintaining a strong engineering discipline and a thoughtful planning process. Otherwise you risk having your Bazaar end up like the Winchester Mystery House, another common software-construction analogy, one you don't want to have your software compared to.