You have reached the blog of Keith Elder. Thank you for visiting! Feel free to click the twitter icon to the right and follow me on twitter.

TechEd 2010 .NET From Scratch Slides

Posted by Keith Elder | Posted in .Net, Asp.Net, C#, Mobile Devices, Presentations, Smart Clients, Speaking, SQL Server, TechEd, Visual Studio, WCF, Web Services | Posted on 18-06-2010


TechEd 2010 was in New Orleans last week and I had the pleasure of doing a full day pre-conf session at TechEd.  Pre-confs are longer sessions where attendees can get into more details.  This year I did “.NET From Scratch” which was a one day session to introduce developers to the .NET platform. 

This seminar is for anyone who is starting at ground zero with .NET and wants a deep dive into the platform starting from scratch. It is designed for developers experienced in at least one other language, and starts with the basics of . NET and covers Microsoft Visual Studio, writing code in C#, and how to build applications in various technologies of the platform such as Windows, Web, Microsoft Silverlight, and Windows Mobile. If you are new to writing applications on Microsoft .NET, what better way to start your Tech·Ed experience?

As promised to the attendees, the slide decks and demos can be downloaded from the following URL:


Remember when learning a new platform as large as .NET the main thing to focus on are your immediate needs.  That may be a language and a framework and possibly web programming.  It is impossible to learn or know everything about a platform as large as .NET but knowing what is possible is half of the battle.  As engineers if we know it is possible it is just a matter of research to figure out how to make it happen. 

A big thank you to those that attended the session and I am truly sorry about how cold it was in the room.  If I’d known in advance I’d brought some firewood and blankets.  Enjoy.

.Net 4.0 – Start Reading Between the Lines – Learn Silverlight and Entity Framework

Posted by Keith Elder | Posted in .Net, Asp.Net, C#, Internet, Mobile Devices, MVP10, PC Software, Smart Clients, SQL Server | Posted on 30-11-2009


I started writing this as a general recap of PDC for team members but the more I thought about what was announced at PDC, the longer the email got.  Ultimately I decided to put it out so you dear reader could also gain some insight from things announced at PDC. 

For starters listen to the podcast we recorded with Scott Guthrie or “The Gu”, or “His Guness”, or “ScottGu” about Silverlight 4 announcements among other things while at PDC. 

The big stories out of PDC that I think everyone should take note of are Silverlight 4, Entity Framework 4 and Windows Mobile. Wait Windows Mobile 7? Yes.  Wait… I didn’t hear anything about Windows Mobile 7? Well I didn’t either and that is why this post is called “read between the lines”.  Call it speculation or whatever, but I think I can bring you up to speed on what is about to happen (and no I have no official behind the scenes information, I’m just a guy with a brain).  Before we get to Windows Mobile 7, let’s start with Silverlight.


Silverlight 4 had tons of announcements including:

  • Camera and microphone support
  • Trusted out of browser support.  This means one can access COM (for example, an application could access Outlook APIs)
  • Lots of line of business app controls
  • Added support for drag and drop
  • WCF RIA Services (this is basically what I’m calling the new CSLA, if you listen to the podcast you’ll find out that Rocky worked with the team closely on RIA Services)
  • Print natively
  • More…

Tim has a great recap of all the Silverlight announcements here with links to videos:


Now what does this all mean? It means the line is blurring between client and server applications. It also means we are coming back full circle to “Smart Clients” (which were hot in 2005/2006 but were forgotten due to the Web 2.0 hype.  The only difference is this new breed of application (Silver Clients?) can run directly from a web site, or on a client’s machine.  It also means that Silverlight is going to finally fulfill the vision we heard about a long long time ago that was called WPF/e (WPF Everywhere).  A lot of people have forgotten this but we are seeing it take full shape now.  For businesses that are writing applications internally, I think we are going to start seeing a huge shift away from writing Asp.Net/MVC apps and a move towards the rich model with Silverlight.  I mean seriously, why wouldn’t you? If you get cross platform compatibility, rich data binding, write once and work in any browser, why would developers that are trying to build internal business applications continue to kill themselves writing JavaScript, fighting CSS and browser compatibility?  I can’t think of a reason either.  In my opinion this is just a waste of time (and always has been).  There is something extremely powerful putting a variable in memory and having it be there when you need it without having to worry about sessions, state, etc.  Yes we are FINALLY getting back to the client programming model, just coming at it a different way. 

Entity Framework

Let’s talk about Entity Framework 4.0 for a moment.  This is another big piece of news.  It is big because as .Net developers we will finally have one true way to access data that fits the multitude of ways we have to work.  Here’s a recap of announcements (not a complete list, watch the videos from PDC):

  • POCO – supports plain old clr objects
  • EDM designer enhancements
  • Better stored proc support
  • Model first (then gen database model)

Doug Purdy (who we also interviewed for Deep Fried Bytes while at PDC) has a list of the sessions that cover the Entity Framework 4.0.  Just start at the top and work your way down as far as you can.  At least watch the first video as it shows off all the features of EF.


With the number of features that were announced in EF4 I think we are on the verge of seeing the demise of NHibernate usage by developers in the .Net stack.  For those that have used NHibernate in the past, it is worth another look at the Entity Framework to be released in .Net 4.0.  About the only thing EF4 doesn’t do that NHibernate does do is built-in caching (which hey, there’s this caching thing that AppFabric does, hmm, wonder if they’ll use that? Why not! 🙂 ).  But the big thing to note between EF4 and NHibernate is we are starting to see where this whole modeling thing with OSLO is going (edm files are m fles and so on).  And of course there is the bigger picture of reusing this model in report services, BI and other areas (although we haven’t *seen* that really working yet, it is coming though see next sentence).  As EF4 makes it way into other products throughout the Microsoft ecosystem it is going to be extremely hard to avoid the Entity Framework.  Read between the lines, the writing is on the wall, LEARN THE ENTITY FRAMEWORK.

Just a side bar here because I know someone is going to ask me this at a later time.  Will the Entity Framework kill NHibernate? Answer: Nope I’m not saying that. 

Out of band developers that seem to have a knack for yelling the loudest will continue to use NHibernate but a much larger ecosystem will leverage the out of the box Entity Framework in .Net 4.0.  Think back for just a bit.  History is about to repeat itself all over again.  Remember when we got MSTest and or MSBuild?  Same thing is happening again. There is now an out of the box product for standardizing data access.  Are their alternatives? Sure.  Just as MSTest didn’t kill NUnit or MBUnit and MSBUILD didn’t kill NAnt, EF4 will not kill NHibernate.  However, if you look at the number of developers using MSBuild or MSTest it is high. Extremely high.  Why is that? Answer: pain, ease of use, integration, documentation.  MSTest is not the best testing framework out there (this is a proven fact), but it is good enough for 90% plus test cases.  Entity Framework 4.0 is going to put an ORM in the hands of developers.  And you know what, it doesn’t suck either. 

Windows Mobile 7

And now onto Windows Mobile 7. 

Is this WinMo 7 above?  I honestly don’t know, I found these screen shots on http://windowsphonemix.com/ web site.  BTW, notice that URL?  Mix? Yes Mix.  Mix is the first of the three major conferences Microsoft puts on each year.  The very last slide at PDC during the last keynote said, “Come to Mix 2010 for Windows Mobile 7 futures”.  A lot of people missed this because they were tuned out from the SharePoint demos and already packing to leave.  But there it was on the big screens.  Thus we know Mix is when we’ll see Windows Mobile 7.  Again, listen to the podcast to get some other insight. 

Here’s a quote:  “Three screens and the cloud”

We heard this over and over at PDC.  Let’s read between the lines a bit shall we?

I have three screens:  Windows Desktop, Web, Mobile.  Ok, if I want to write an app that will run on all three what do I as a developer have to do today?  Let’s see, well, we could write a ClickOnce deployed Smart Client for the Desktop that uses WPF.  For the web, well, we would have to switch gears completely and rewrite our app in Asp.Net or Asp.Net MVC to get that screen.  For mobile, even tougher, we have to rewrite the app again to get the mobile version.  Let’s think about this differently again.  Think about it, how many technologies would a developer have to know in order to an application for these three different screens;  WPF, JavaScript, HTML, and CSS will be used just to name a few.

Now, let’s switch gears.  What if I used Silverlight 4 to write my app?  Well, it could work in the browser no doubt.  Hmmm, it could also work on the Desktop using the out of browser experience with elevated permissions.  What about mobile? 

“Wait, didn’t you just say Keith that at Mix we’ll get to see Windows Mobile 7?”


“And hasn’t there already been talk of using Silverlight for mobile?”


“Aha! Three screens with Silverlight, I get it!”

That’s right my friendly .Net developers the writing is on the wall. The vision of WPF/e (WPF Everywhere) is about to come true.  We’ve waited for years but it is just around the corner as I predicted would happen years ago.


(ok, so it wasn’t right around the corner but 3+ years later)

Moral of the story?

LEARN SILVERLIGHT so you can make millions of dollars building Mobile applications just like the iPhone devs.  There, I just made you rich by putting this puzzle together for you, please send me 20% of all profits.

You are welcome.

How To Run a ClickOnce Application on Startup

Posted by Keith Elder | Posted in .Net, Smart Clients | Posted on 18-04-2009


When .Net 2.0 launched several years ago, WinForm developers got a brand new technology baked into the framework that allowed WinForm applications to be deployed similar to a Web application.  The technology was called ClickOnce.  ClickOnce has seen a few enhancements since it’s initial release such as the ability to add a desktop icon when an application is installed along with better support for ISVs.  One feature still missing from ClickOnce is to make an application start automatically after login.  Let’s solve this problem.

The Problem

When a ClickOnce application is installed the user doesn’t know the directory location it is installed in on their computer.  Honestly they shouldn’t care.  Not only does the user not know, but the developer doesn’t know either!  ClickOnce applications are installed in random directories on each computer in a hidden folder within the user account called the “AppData” folder.  For example, here is a screen shot where the ClickOnce version of Witty Twitter that I publish on this site is installed on my newly built machine.


As you can see it is in a random place and this is the problem because a ClickOnce application doesn’t have a fixed path like c:\program files\somewhere\myapp.exe.  Why?  Well, because the ClickOnce team at Microsoft didn’t build in the ability for Developers to specify a location as to where the application is installed, nor can the user select one.  The purpose of a ClickOnce app is the end-user clicks a URL that ends in .application and the application installs.  Simple, quick, easy.  If the application path was set outside of the user’s account it would require escalated permissions.  A feature of ClickOnce is it allows the user to install an application without administrative permissions on the computer (great for internal apps at companies for example).  Since the ClickOnce apps are installed in the user’s local directory and randomized as to their whereabouts, we can’t place a shortcut URL in the startup folder that points to the executable.

Now some of you might be thinking that a Developer can programmatically figure out the location of the executable and place the shortcut in the Startup folder within the menu, thereby allowing the application to start.  That would be the wrong thing to do.  The reason is ClickOnce applications version themselves as they are installed.  If you took this approach, the next time the application was updated, a new version would be installed and the old version still remains.  Essentially there are two versions on the machine (this is a feature because it allows end-users to roll back to the previous version if they want to in case the latest version of the application is broke).  As you see, creating a shortcut programmatically and placing it in the startup folder on the machine won’t work because it is constantly changing locations.

The Solution

The solution to the problem is actually really simple.  So simple in fact it escapes most.

Remember that a ClickOnce application is launched from a URL ending in .application.  For example, the Witty Twitter application I publish has a URL like the following:


The .application extension is something your computer knows how to process after the .Net framework gets installed. 

What most developers do is they open up the folder the location where the ClickOnce application installed the shortcut to view the shortcut in notepad.  Here’s an example  using Witty:


If we view the Witty shortcut in Notepad++ it looks like this:


The first thing you’ll notice is the extension of this shortcut is different, it ends with .appref-ms.  So what happens is developers copy this file to the startup folder, but then it doesn’t work in all cases.  It will work on some versions of Windows but not others.

Here’s the fix.  Right click on your desktop and in the menu create a new shortcut.


Next, enter the URL of your application.  Here’s a sample using Witty:


Click next and give it a name:


After saved, open the shortcut in notepad and remove everything but the first two lines.  You should have something like this left when you get done:


Now you have your shortcut.  Wait, that’s just a standard Internet Shortcut?  Right!  That’s all you need since the application is launched from a URL anyway.  You’ll notice after doing this the new shortcut is showing the default browser’s icon (not your application icon), this is perfectly ok.  Now that you have your file, simply drag and drop the shortcut into the Startup folder.  The next time the computer boots, the application will automatically launch. 

If you are a developer you are home free now because programmatically writing a file to the user’s Startup folder with this information is simple.  In your application you can place a menu option to start the application on startup or not. 

Their are two downsides using the method I can think of.  One, your application shows the default browser’s icon.  Secondly, when the computer launches the browser will open for a split second to launch the application but then it closes (at least that’s been our experience). 

Witty Twitter Published

Posted by Keith Elder | Posted in Internet, Smart Clients | Posted on 30-08-2008


Update to latest version of Witty Twitter here:


A new version of Witty Twitter was just published this morning, version


  There aren’t any major new features in this release but over the last several months there has been progress.  Here they are:


Witty supports Tourniquet which is a personal caching twitter proxy.  Tourniquet was written by the mad scientist Jason Follas.  Tourniquet solves a lot of the problems with Twitter being down and opens the door for a lot of other interesting things to happen.  Check out the project on Codeplex.

If you’ve ever been temporarily disconnected while Witty was it was running you’ve no doubt seen the error messages that Witty couldn’t update itself.  Witty checks every hour to see if there are any updates in the background if and there is it prompts you to do an update.  The error message was removed from Witty so you should no longer see this.

Pop up notifications now appear on the first display not the second (yeah!). 

If you need to use Witty through a proxy the UI was fixed so when the application starts for the first time this can be entered.

Additional exceptions that might occur when Twitter would be down are now accounted for along with several other changes.

In no particular order, the developers that contributed since the last update of Witty was published:

  • Alan Le (project founder)
  • Scott Koon
  • Jon Galloway
  • Keith Elder
  • Paul White
  • Jason Follas

Thanks to everyone that contributed, keep ‘em coming.

How To Update Witty

  1. If Witty is running go into the options screen of Witty and click update.  It will download and restart Witty.
  2. Click on the ClickOnce URL to install Witty if you’ve never installed it here:  http://keithelder.net/software/witty/witty.application
  3. If you already have Witty installed and it isn’t running, simply launch it, it should update.

DreamSpark – Fantastic Idea But Only The First Step

Posted by Keith Elder | Posted in .Net, Smart Clients, SQL Server, Windows, XBOX 360 | Posted on 27-02-2008


When I was in high school one of my math teachers took it upon himself to teach a few students about computer programming.  It wasn’t a real class it was just something he put together during our free period.  Instead of attending study hall we’d go to this computer programming class.  Basically other students in the school called the few of us taking the class the “Star Trek” club.  Honestly I didn’t watch Star Trek and never have.  It just never interested me.  I know that I just lost thousands of geek points by stating I am not a Star Trek fan publicly but when you grow up on a small farm in Mississippi things need fed, watered, and slopped.  Coming home from school and sitting down to vegetate to watch TV wasn’t in the cards of our household.  Anyway, I digress.  Even though Mr. Foley didn’t have a lot of support from the school in putting together this class, it was the one thing that really got me hooked on computers.  Mr. Foley was only one man though.  It takes a much larger effort to get students interested in technology.  To hook the next generation of students on programming Bill Gates recently announced DreamSpark.  It is a new project that will provide thousands of dollars of free software to students.  Students like me who didn’t have access to the tools companies were using while they learned can now install and leverage the same products for free.   As an educator I’m really excited to see this announcement.   Here are some thoughts as to why I think this is important and what should spark within the community.

What is DreamSpark?

DreamSpark is simple, it’s all about giving students Microsoft professional-level developer and design tools at no charge so you can chase your dreams and create the next big breakthrough in technology – or just get a head start on your career.

DreamSpark makes the following software available to students who register on the site.   The program is available in 11 countries giving millions of students access to professional developer tools.


All a student needs is a computer to get started.  They can load Windows Server 2003 onto the machine along with Visual Studio 2008, SQL Server 2005 and Expression Studio and have the same tools we are using today in enterprises across America.  If the student wants to build games for Windows or the XBox then they can install XNA Game Studio.  The amount of things that can be built with these technologies is amazing, especially when you think about WPF Windows Applications and Silverlight.

Ok students, Bill has done his part to give you the software.  What are you going to do with it now?  Someone has to replace a lot of the Elder generation as we age.  Even right now there is a huge demand for developers that know these technologies.  Here are some numbers from the popular online job engines.

Searching for .Net

  • Dice.Com – 11,131 jobs available
  • Monster.Com – Over 5,000 (max return value)
  • CareerBuilder.Com – 3,376

Searching for SQL Server

  • Dice.Com – 14,588
  • Monster.Com – Over 5,000 (max return value)
  • CareerBuilder.Com – 8357

Searching for Windows

  • Dice.Com – 15,480
  • Monster.Com – Over 5,000 (max return value)
  • CareerBuilder.Com – 16,933

Positives About DreamSpark

I Couldn’t Even Buy A Vowel

As I said earlier, the DreamSpark program is a great idea I just wish it was around when I was younger.  When I was in college I was still doing off to the side programming while pursuing my music degree.  I knew there were tools, IDEs, databases and other things that people in large companies used but I was broke.  I was financially embarrassed as my father used to say.  I was so broke I couldn’t even afford to buy a vowel on Wheel of Fortune.  The only option I really had was to learn open source tools.  Back then the open source tools were, well, hard.  There weren’t web pages full of documentation, books, and fancy editors.  You basically first had to learn the VI editor and then try to dig through the man pages and the source code.  To say the experience was painful would honestly be an understatement.  It was slow going.  The sad fact today is that a lot of students are in the same boat I was back then.  DreamSpark fills this gap and puts the latest technology in the student’s reach.  This is wonderful, I can’t express that enough. 

Challenges DreamSpark Faces

It is important that students be offered the opportunity to learn the tools we are using today but the sad fact is only a few will take advantage of it without the community getting in behind this effort.  If 1% of the students downloaded these tools, I would consider that a success.  A perfect benchmark to go against is every student enrolled in a Computer Science program and every student in high school taking computer programing.  If 100% of those students download and use the software then that is a perfect world. 

In order to achieve this goal, it is going to take a lot of effort from those of us in the community.  The following is an open letter to Microsoft, the community and educators who can effect change and help create the next generation of programmers.

Give It Away And They’ll Come

The first thing we must overcome is thinking free equals a lot of use.  Some have heard the line before “Build it, and they will come.”.  The reality is just because something is free doesn’t mean anyone will use it.  If this were the case, we wouldn’t need ads, marketing departments, or ad agencies.  This is the first thing we need to do, spread the word.

Ask yourself this question.  How many students will seriously go download this software?  How many of them will actually learn about it?  There are numbers in the industry I’ve heard repeated of the 5% geek rule.  The premise is take 100 computer science students and only 5% of them are truly dedicated to their profession.   This top 5% are the ones that will more than likely take advantage of DreamSpark, the rest will never know.

We (Microsoft, the community, and educators) need to make a concerted effort to spread the word about DreamSpark.   We need to establish DreamSpark Day events at schools and Universities in our local areas and get this information out.  By information I am not just talking about the bits, that isn’t enough. 

How Long Will It Take?

Here is a pondering question.  How long will it take the education institutions to realize they have thousands of dollars of software available they can build an entire curriculum around?  Unless a concerted effort is made the answer is years.  Why?  Well for starters very few of the professors know the technology.  Sad but true.  When I say “few”, I mean a very small percent. 

There are a few professors out there that are teaching .Net.  Those educators should have no problem, but the majority of professors I’ve encountered love to tell you how their first computer was the size of a house and how they punched cards to program it.  What really saddens me is the “dinosaur” professors as I like to call them are still doing things the way they have for years.  Thankfully this isn’t every professor out there, but there are professors at colleges that still rest on their laurels and just learn enough to teach out of a book.  The majority of these professors have no real world experience in technology except in academia because they have spent their entire lives in academia.  I know these types of professors exist because I had several of these “dinosaur” teachers in college.  I used to call them the “Punchcardasaurus”. 

“Punchcardasaurus – A professor who loves to tell you about the stone age of computers but doesn’t know anything about today’s current technology.”

I can’t begin to tell you how much of a waste of time it is for someone like myself to have to sit through a lecture from a Punchcardasaurus only to correct him or her about how the Internet really works and the Mosaic browser is not really the Internet (true story).  I’m starting to digress but hopefully the point is driven home.  A concerted effort needs to be made at the institutions of learning.

Educational Institutions Already Have Free Software – Open Source

I firmly believe that higher educational institutions should focus more of their efforts putting students in a position to get a job and succeed.  Sadly the curriculum of colleges don’t.  Someone graduating from college today should have experience with all sorts of technologies and languages.  Colleges that just teach C++ are doing their students a grave injustice.  Students should learn C, C++, C#, Obj-C, Java, and a variety of other languages including dynamic languages.  Each of these should expose students to the various types of platforms such as Windows, Unix and OS X. 

The majority of colleges use a lot of open source software to teach their students today because, well, the software doesn’t cost the college nor the students anything.  If a college is just focusing on open source software, they are really doing their students a major disservice.  Students should be educated on both sides of the fence and taught multiple platforms.  In the end it is the students who should decide which platform they feel will be the most valuable to their career or interest, not the educational institution.  The more this is done, the more the students  know and the better chance they have at getting a job.  DreamSpark of course helps to fight the cost factor argument with open source software but it is going to take time for the value to sink in.  Especially in institutions where open source software has a very strong hold with a lot of zealots to play devils advocate.  Yes, these zealots exist, to ignore this fact would not prove wise.

Train The Trainer

The Punchcardasaurus and other professors need help.  It has to start with those teaching others.  Here is another sad but true fact.  Even if a school wanted to build a curriculum around DreamSpark who’d teach it?  If it was offered the odds of it being taught with real world business experience on the platform is very small.  We need to do something to train the current educators how to use these new tools.  There are a variety of ways this could be done.

  1. Use the current Microsoft training curriculum and certification courses to offer classes to faculty and staff.  Schools are off in the summer and it would be a great time for re-educating.
  2. Help the teachers by putting together a standardized curriculum around the DreamSpark project so there is consistency to how the platform is taught.

I personally would be more than willing to spend my time during the summer to put together a train the trainer workshop for those educators willing to participate.  This could be run at night so not to interfere with work duties. 

Already Lagging Behind

Another sad but true fact is educational institutions are years behind in terms of the technology being taught.  I know when I was in college this was true.  For example the language called Java was started in 1991 and released in 1994/1995.   While this was a newly released technology it wouldn’t be taught in the classroom until many years later.  Back then they were teaching us Pascal.  The progression worked something like this.  Once you mastered Pascal, which at the time was already considered a dead language, you could learn C, and then after that C++ and if you stayed around to get your PhD they’d eventually mention Java as an experimental language.  Basic skills are an absolute must have but what chance does a student have at actually getting a job today in a company that uses a technology like .Net where the student has never used it?  Very few companies have a need for engineers that are highly skilled in assembly and compilers.  However, a company would be willing to hire someone who knows how to write applications using Windows Presentation Foundation, Silverlight, Windows Communication Foundation and Workflow Foundation.  All of which have been released in the last year.  I truly feel sorry for students graduating today because the industry changes so quickly.  They need our help.

What Can We Do To Help

There are a lot of challenges that need to be overcome no doubt.  All of them are challenges, not road blocks though.  They can be fixed.  To restate some of the ideas above here are the things we (Microsoft, the community, educators) need to start with.

  1. The Community / Microsoft – Organize some type of event at educational institutions to help spread the word.
  2. The Community / Microsoft – Help train the current educators.
  3. Microsoft – Help the educators standardize a curriculum using existing training information, labs, etc.
  4. Microsoft – Put together a program whereby students build something using the tools and award them with free trips to TechEd or Mix or other conferences.