Mort, Elvis and Einstein don’t exist

Much has been said about the Mort, Elvis and Einstein controversy over the past few years (yes, years).  The past few days have been no exception.  One of our MVPs is apparently upset about them, and apparently some employees are not too happy about it either.  I’ve waited several days to comment until the screaming stopped.  Now that it has, it’s my turn to weigh in.  Most of this content about this topic is completely off-base and unfounded.  “Why?”, you might ask.  That’s because Mort, Elvis, and Einstein don’t exist.  That’s right, there is no one person on this planet that is meant to be exhibited by these personas.  The names depicted here are meant to represent behaviors — not people.  Trying to pigeon-hole people into one of these areas is just a misrepresentation of what the persona was meant to portray. 

Mort is not a VB developer, Elvis is not a C# developer, and Einstein is not a C++ developer.  Sure, the personas use these analogies because they do fairly closely resemble a large stereotypical audience, but it doesn’t “fit” to anyone. Then again, no description fits more than one developer.  These personas don’t drive features and they don’t do anything but serve as reminders that we have different types of developers who need different types of features, documentation, and applications.  Don’t think this is true?  Ask the average VB developer what a thread is and they may get the “word for word” answer, but a large part of that audience never has wanted to understand the intricate details of thread local storage, differences between the stack and the heap and why those are important in the context of application development.  Does that mean that all VB developers don’t care about threading? NO. Once again, there is plenty of evidence that einsteins exist in the VB community as well  — “Einsteins” meaning people who want detail!  Mort behaviors exist in the C++ community as well. I’m one of the people have have a mort mentality with C++. I know so little about C++ I’m amazed I’m allowed to breath the same air as the folks here at Microsoft.  That, indeed, is the Mort side of me.

Several people have asked “Why are there no definitions for these from Microsoft.” And they are hopping mad about it!  Quite frankly, its because the personas were not meant to be public information.  They were used to help mold and categorize functionality internally, and nothing more.  Because of that, the actual documents for these personas are not available externally.   If they were, they would also likely be taken out of context.

That said, this won’t be the last discussion about these fictional characters.  I imagine we’ll be hearing about them for some time.  Just remember to take everything you hear with a grain of salt, and if you think the way we construct software is wrong, by all means RESPOND!  Speak up, tell us how you would approach it. Better yet, apply to the team that interests you most and come implement those changes yourself! 

Free Training CDs from AppDev

AppDev is apparently giving away free training CDs.  I have not personally seen the training, but free is not typically a trait in a product that I hate, so AppDev already “has me at hello” with this offer!
http://www.appdev.com/promo.asp?page=SN00009

What’s wrong with MSDN documentation?

A large part of my job at Microsoft is to provide developers with the knowledge they need to make use of the IIS 7.0 SDK.  While the information about IIS 7.0 is not out yet for review, there are plenty of docs provided in other areas, such as the .NET Framework SDK and ASP.NET sections, which can be used as a benchmark.   In order to make the IIS 7.0 SDK a success, we must do more than just put out a good product. We must also describe how to use it properly or it just will not be used.  So I pose a question to anyone who has ever looked something up in MSDN, what is wrong with the documentation you have used so far?  What is good about it?  What would you like to see to a greater/lesser extent in our documentation?   Feel free to flame us, or praise us.  If you have suggestions, comments, or ideas, feel free to express them here.

Your feedback will help me understand how to increase your satisfaction with MSDN and Microsoft in general.

Or better yet, if you have some desire to play with new technology that isn’t documented yet and provide that content to a worldwide audience, why not apply

Protests in Seattle: anti-communist?

The news has been reporting about China’s President Hu visiting Seattle, its businesses and, of course, Bill Gates’ home. What wasn’t widely publicised was the number of protesters in the area. Monday night, I had to run back up to my office and grab some paperwork I left in my desk. On my way up there, I saw several protesters at the corner of 40th and 156th in Redmond. Their banners decried alleged ill treatment of Falun Gong supporters, and, of all things, communism. Having only been in the Puget Sound area for a short while, I find myself wondering how this can be. They don’t call this side of the continental US the ‘left coast’ for nothing. That puts us square in the center of the pro-socialism crowd. So again, I ask, what are these people complaining about? This is what this side of the country yearns for — complete government control over what you can and can’t say at what time, in the presence of what company and with what tone. If government were a drug and communism were crack, socialism would definitely be cocain — the perfect gatway drug to ease you into the rest of your useless life as a crack adict. So I say, put your banners down and bring peace to this riddled puget sound area. Quit rocking my boat! The government of China knows what is best for their people and has every right to tell people what they can and cannot do with their money, their children, their weapons, and, of course, their voice. And don’t you worry with programs like social security, medicare, medicaid, welfair, unemployment, national endowment for the arts, Department of Education, FCC, minimum wage, income tax, tarrifs, gas taxes, sin taxes and the like, you will never have to worry about forming your own opinions on what is an appropriate income at retirement, what drugs are best for you, being responsible at work, painting something that someone is willing to pay to look at, what your children are and are not allowed to learn, what your radio DJs are and are not allowed to say, how much crack a single mother of four can afford to buy while holding down a part time job at McDonalds, how much you are allowed to earn for yourself, what you are allowed to buy from other countries, where you can afford to travel, or what habits infringe on another person’s rights so much that you have to pay extra for the right to continue it. Isn’t socialism fun?

Live from Redmond

A little over a year ago, I emailed Steve Ballmer at Microsoft directly about an idea to make a digital, online user group community. I wanted to be able to let user groups from across the country make their monthly presentations available via the web. Rather than being limited to what is available in local communities across the country, I thought it would be very beneficial to be able to watch any presentation at any user group on any given month: Community-created web-casts if you will. I was suprised to hear a response from Mr Ballmer direclty. I still have the email in my inbox because it reminds me just how much Microsoft DOES care — even the biggest guys in the company will handle customer-related issues. Mr Ballmer thought it was a great idea and gave me some contacts to discuss with INETA as well as several other groups. To be honest, I got way too involved with other things and sadly never followed up. Apparently, the idea wasn’t lost on the folks at INETA or MS though. Brad Abrams has just reported that this dream is close to a reality in a new offering called “Live From Redmond.”. Although it is not quite the community I was envisioning, it does at least make many user-group meetings available via live meeting. It’s a very exciting concept and I hope you’ll take advantage of it.

Threading issue with VB.NET Default Instances

Here is an issue that showed up for one of our customers in the Microsoft forums for Visual Basic .NET.  It is NOT the typical ”cross-threaded UI update” issue that you might think. No, this one, IMO, is slightly harder to catch since no exception is thrown to let you know something has gone wrong.

One of the many new features of Visual Basic .NET are default form instances.  As the feature lists explain, a default form instance prevents you from having to “new up” an instance of a form before acting on it.  So, instead of using:

Dim frm As New frmMain
frm.Show()

I can simply use:

frmMain.Show()

This is handy, particularly for the folks coming from VB6 who are used to forms that behave in this manner.  However, default instances present a very interesting problem.

Take, for instance, a project that I create with a form (named frmMain) and a module (named BackgroundMethods.vb) .  For the form, I have simply added a multi-line text box (named txtOutput) and a button control (named button1). 

Here is the code I have in my project:

[frmMain]

Imports System.Threading
Public Class frmMain
  Private Sub Button1_Click( ByVal sender As System.Object, _
                             ByVal e As System.EventArgs) _
                             Handles Button1.Click
     Dim t As Thread = New Thread(AddressOf GetData)
     t.Start()
     txtOutput.Text &= "Updates complete"
     ' Break after the call above to read the value
     ' in txtOutput.Text
  End Sub
End Class

[BackgroundMethods.vb]

Imports System.Threading
Module BackgroundMethods
   Public Sub GetData()
      WaitForData("Message 1")
      WaitForData("Message 2")
   End Sub
   Public Sub WaitForData(ByVal strMessage As String)
      ' Presumably this method would actually be
      ' waiting for data from a network connection,<
      ' serial port, or other source
      Thread.Sleep(2000)
      My.Forms.frmMain.txtOutput.Text &= (vbCrLf & Now().ToShortTimeString() & _
      vbTab & strMessage)
      ' Break after the call above to read the value
      ' in My.Forms.frmMain.txtOutput.Text
   End Sub
End Module

So the simple example is that I have a button which, when clicked, will execute the “GetData” method asynchronously in a module.  That method is going to call the WaitForData method that updates the UI with two different messages (“message1” and “message2”).  WaitForData is supposed to simulate a long-running process, so I threw in the typical “thread.sleep” call to make this illusion. 

If you run this code, you will notice that no exceptions are thrown, but the UI for your form is also not updated.  Why is this?  You would have at least expected a cross-thread exception, right?

In any other managed language, this likely wouldn’t happen — namely because the “My” application is specific to VB, as well as default form instances!  In C#, if I try to update the UI from another thread, I would get an exception stating: “Cross-thread operation not valid: Control ‘txtSerialIn’ accessed from a thread other than the thread it was created on.” which could be solved by using the “Invoke” method.   

The issue with Visual Basic, in this instance, is that the default form instances are thread-specific.  So, when I try to access the form using My.Forms.frmMain from within the worker thread, a NEW default instance is created under the covers.  My calls to update the text box are then executed on the NEW instance of the form which resides in the same thread as the call to update it — hence it doesn’t throw a cross-thread exception. In the mind of the VB program, the request to update the textbox occurred without an error.  When the worker thread dies, the second instance of the form (which was never displayed) is now a candidate for garbage collection.  Meanwhile, back on the original thread and original form the textbox is left blank.  You can validate this by running the program (I have attached sample code to this blog post) and setting breakpoints on the textbox update line in the WaitForData method, and in the last line of the button1_click event handler of the code.  You will notice that after the second call to WaitForData (before the debugger exits the Sub) that My.Forms.frmMain.txtOutput.Text has been properly set to the value you expected.  However, remember that this is on a second background instance of the form, not the original one you expected.  Once the debugger hits the last line in the button1_click event handler, read the value of txtOutput.Text and realize THAT instance of the textbox was never updated.

So what is the solution?

First off, you still have to use the “Invoke solution” that is often times bandied about in threading discussions.  To do this in VB.NET (and particularly in our solution), do the following:

1. Add the following code to the top of your BackgroundMethods.vb file:

Delegate Sub UpdateTextHandler(ByVal strMessage As String

This allows you to create a delegate that can be invoked on the UI.

2. Add the following method to your frmMain file:

Public Sub UpdateTextMethod(ByVal strMessage As String)
   txtOutput.Text &= (vbCrLf & Now().ToShortTimeString() & vbTab & strMessage)
End Sub

This creates the method that will actually be executed via your delegate from the worker thread.

3. Change your WaitForData method as follows:

Public Sub WaitForData(ByVal strMessage As String)
    ' Presumably this method would actually be
    ' waiting for data from a network connection
    ' serial port, or other source
    Thread.Sleep(2000)
    Dim f As frmMain = My.Application.OpenForms("frmMain")
    f.Invoke(New UpdateTextHandler(AddressOf f.UpdateTextMethod), _
             New Object() {strMessage})
End Sub

This method now uses the form’s “Invoke” method (actually defined in Control) to execute UpdateTextMethod on the original form via the UpdateTextHandler delegate.

So what is happening is that your new thread is getting an instance to the existing frmMain instance by going through the OpenForms call.  Once I have that instance, I can invoke a delegate that points to the “UpdateTextMethod” of the existing form ( passing in the message in the object array ).  By invoking, I am able to get back on the UI’s thread and that call can execute any updates to the UI that it wishes.

Keep this in mind the next time you are not receiving errors and your UI isn’t getting updated how you would expect — particularly if you code communicates with the network, a serial device, or other device which communicates asynchronously.

What does it take to get a Microsoft MVP?

As many of you know, I received a Microsoft MVP award this year for C#. I’ve been asked a few times what makes an MVP — despite there being several pieces of information available to answer that question, I thought I’d answer it quickly myself.


There is no set formula for gaining an MVP. Some do it by participating in online communities such as forums, newsgroups, and other such public stomping grounds for technological communication. Some people do it by writing books, printed magazine articles, blog posts, or online articles. Some folks have obtained their MVP by simply participating in local community events, helping out in whatever way is necessary to make user groups, code camps, MSDN events, and the like go off without a hitch.


By participating in communities, I mean that you answer questions clearly, honestly, and completely — not simply respond to every post hoping to get a post count high enough to get noticed. You have to actually earn some respect in the community for having answers — not for posting useless information.


The same can go for blogs. Simply pointing to other sites or blog posts from yours — effectively becoming a technology aggregator — doesn’t work either. Have some original content. One method that is quite useful is to combine your community participation with your blogging. Instead of simply answering a question in a forum, try to write a coherent blog post about the issue, and then point the user in the forum to your blog post. Now, the question and the answer are made available to everyone in the forums as well as on your blog!


Another good idea is to take that same topic, and then use your solution as the topic for a user group meeting. Many user group meetings in smaller towns are in great need of speakers — either at the meetings themselves, or at Code Camps. Help them out by sharing what you’ve learned with the local community. Furthermore, find out who the Microsoft Developer Evangelists are in your area and see if there is anything they need help with at upcoming events. Being valuable to Microsoft is the whole point of the “V” in MVP. Helping your developer evangelists definitely adds value and will help get you on the radar screen if you persist for a good deal of time.


As you can see, you can solidify yourself as a subject matter expert quickly by studying one area and using that same information in blogs, forums, and user groups. It wouldn’t hurt to expand on those topics by contacting online article sites or even printed mags to see if they have an interest in your topic. As you can guess, a little effort can go a long way.


I don’t really know how I received mine other than some of the ways that I described. I wrote four books on .NET topics, participated in local and regional events, communicated with regional directors, developer evangelists, and community champions to find out what was needed to drive participation locally. I blogged, answered a few forum posts, and worked with Microsoft Learning to develop the new generation of certification exams and supporting eLearning workshops. Find your own mix and figure out what works for you, and what doesn’t. Don’t rely on the company you work for to get you there. MVP is an individual award and it depends on YOUR commitment and reputation , not the reputation or commitment of the company you work for — in many instances, that’s a plus for you!


This posting is provided “AS IS” with no warranties, and confers no rights. The content of this site are my own personal opinions and do not represent my employer’s view in anyway. In addition, my thoughts and opinions often change, and as a weblog is intended to provide a semi-permanent point in time snapshot you should not consider out of date posts to reflect my current thoughts and opinions.

Free Book: Microsoft VB.NET 2005 for Developers

Microsoft has a free book available for download for anyone who wants it.  Download the whole book, or download it chapter-by-chapter (8 in all).  Check it out at http://msdn.microsoft.com/vbasic/learning/introtovb2005/

Debugging Resources

It is my opinion that the difference between good developers and outstanding ones are the way that they debug applications. As such, I wanted to point you to some great debugging resources to get you well on your way to standing with the outstanding developers.

First off, there is the issue of understanding Windows to begin with that get a lot of people in trouble.  Many issues can be traced down to something that is “working as designed”. As such, I highly recommend the Microsoft Windows Internals book from MS Press.  This book will give you a great understanding of how Windows works.  Next, I would brush up on .NET debugging skills. To do so,  I recommend a .NET 2003 book, but most of the debugging skills still apply to 2005, so don’t be dismayed by the title: Debugging Applications for Microsoft .NET and Windows. Once again, John Robbins from Wintellect writes one awesome book.

Well, books are great, but what about free resources?  I have some of those too!

First, you can check out the windows debugging website at:
http://www.microsoft.com/whdc/devtools/debugging/default.mspx

Then there are a new series of webcasts that have just been released in the past week or so dealing with the very issue of debugging:

TechNet Webcast: Microsoft.com Operations Introduces Real World Debugging: Determining When You Have a Problem and Beginning the Initial Debugging (Level 300)

TechNet Webcast: Microsoft.com Operations Introduces Real World Debugging: Debugging CLR Internals

TechNet Webcast: Microsoft.com Operations Introduces Real World Debugging: Diagnosing Memory Leaks in ASP.NET Applications (Level 300)

TechNet Webcast: Microsoft.com Operations Introduces Real World Debugging: How to Tackle Problems in Dynamically Generated Assemblies (Level 300)

TechNet Webcast: Microsoft.com Operations Introduces Real World Debugging: Debugging Without the Debugger in IIS and ASP.NET (Level 300)

OK. So maybe I did not have a TON of debugging resources, but this is a great start for anyone who wants to make himself or herself into an outstanding SDE or SDET. So go work yourself into a “debugging guru”.  By the time you are done, hopefully John Robbins’ new book on debugging will be out.

202 VB.NET Samples

I just wanted to bring some attention to a resource that I think is extremely valuable for VB developers (and really, any .NET developer using any other language for that matter).  MSDN has a website with 101 Code Samples for VB.NET 2005.  There is also another website for those of you that haven’t upgraded to 2005 yet: 101 Code Samples for VB.NET 2003.  Both of these sites have very valuable sample code for doing things such as network programming, using regular expressions, executing transactions, handling/changing ACL’s on files, accessing data, performing bulk data transactions, executing asynchronous operations (one of my favorite topics), using ClickOnce, creating ASP.NET pages and more!  It is a great resource for those of you that just want to get it done and don’t want to waste a lot of time reading specifications on each class in System.Net or System.Data.  The samples are robust and provide some great starting points for anyone interested in the many topics available in these samples.  Check them out and let me know what you think!