New feature in MSTest

Hopefully most of you are using VS 2010 as their primary development environment or are at least giving it a good shakedown.  One of the GREAT new features in MSTest is the ability to execute unit tests in parallel on multi-core machines.  However, there are a few caveats. Bruce from the VS Team Test put together a very good summary that is a definite must-read.  Check it out here.

Happy Coding!

Posted in Uncategorized | Leave a comment

Happy Birthday .Net!!

Can you believe it?  It’s been 10 years since Microsoft publicly demoed the .Net Framework and languages at the 2000 PDC in Orlando.  Wow, we’ve come so far in just a short time.  Well, maybe not so short if you think about it.  Microsoft was cooking the concept for quite a while.  As great as the concept was, I think the key ingredient was when they brought Anders Hejlsbert on in 1996.   However, you have to remember that one of Anders’ first accomplishments was J++ and the Windows Foundation Classes.  That was soon eclipsed by what he achieved with C#.  And it just keeps getting better with 4.0!   With things like Named & Optional Parameters, Dynamic binding, Variance and better support for COM with COM specific features (dynamic operations are no longer dispatched by the C# runtime binder but instead by a special COM runtime binder which is shared among multiple languages!).  And that’s just the C# language!  We get a bevy of great stuff in the 4.0 Framework like In-Process Side-by-Side execution, managed APIs to more accurately monitor CPU and memory resources, BigInteger (FINALLY!!), memory mapped files, MEF, Parallel Computing (PLINQ), support for NAT, MVC, VisualStateManager, and the list goes on!  It’s been great so far and it’s only getting better so Happy Birthday .Net and we’re all looking to many more!

Happy Coding!

Posted in Uncategorized | Leave a comment

Great resource for learning WPF

I’ve been getting more into WPF and found a fantastic site for resources.  It’s www.WindowsClient.net.  There are frequent articles, good community support and what I found better than any WPF book I’ve read so far are the Getting Started Videos!   Almost all of them are worth the watch and they are concise yet provide great explanations for the how and why of things.   If you’re new to WPF this is definitely the place to go. 

Happy Coding!

Posted in Uncategorized | Leave a comment

.Net version used with SQLCLR

Recently I’ve been working with SQLCLR and the experience has been great.  There are some absolutely fantastic things about SQLCLR such as about a 60% performance increase when shredding XML and the lovely SQLBulkCopy feature.   One thing that did surprise me was when I ran the select * from sys.dm_clr_properties i to see the CLR settings, the version it indicated v2.0.50727 !  This was a surprise.  However after a little digging I found out that not only was this intentional but that it was not going to change in SQL 2008 R2.   Doug Holland has a great post explaining the reasoning.  I’m guessing that the SQL team will have to do quite a bit of work to be able to support the multiple CLR hosting that .Net 4.0 will enable.   With that said, SQLCLR is still a wonderful thing!

Happy Coding.

Posted in Uncategorized | Leave a comment

Coming back to Live Site

OK, after a significant amount of frustration with the Community Platform v2.0 that MSDN blogs use, I have come back to my Live Spaces blog and it feels great.  I still have not been able to post a blog-move post on MSDN so it’s not showing up there yet.    Sorry for the move confusion.  I have so much to blog and I do not need to have to spend more time getting the blog going than I do blogging.   Thanks for your patience!
 
Posted in Uncategorized | Leave a comment

My Blog is on the move (again)…

Well, after three years at Microsoft, I finally decided it was time to move my blog to MSDN.  The old blogs (BlogSpot and this one) are still around for reference.  It’s interesting to see the stuff that’s gone one over the years.  There is just so much to blog about, so much to learn and so much fun to be had!  This is a very exciting time for developers!
 
Happy Coding and check out my blog on MSDN!!!!
Posted in Uncategorized | Leave a comment

LINQ – The Repeat Query Operator

The Repeat Query Operator is one of those utilities that you’ll find very handy but can really bite you if you don’t fully realize what it’s doing.  The Repeat is NOT an extension method but rather a ‘Generation Operator’.  The definition indicates it creates an enumeration with a single repeated value.  That could trip you up.  It actually depends upon what you’re trying to repeat.  For instance, if you ‘repeat’ an integer, it is new instances of integers.  If you repeat an object, it is repeated references to that object.  Here is a code snippet that demonstrates this:

 

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:  using System.Text;
   5:   
   6:  namespace ConsoleApplication5
   7:  {
   8:      class Dummy
   9:      {
  10:          public int MyValue { get; set; }
  11:          public Dummy(int value) { MyValue = value; }
  12:      }
  13:   
  14:      class Program
  15:      {
  16:          static void Main(string[] args)
  17:          {
  18:              Console.WriteLine("Starting test...n");
  19:   
  20:              var listOfInts = Enumerable.Repeat(123, 2);
  21:   
  22:              // Show that the entries are actually instances and not repeated references
  23:              Console.WriteLine("Are the entries repeated references? {0}", 
  24:                  Object.ReferenceEquals(listOfInts.ElementAt(0), listOfInts.ElementAt(1)));
  25:   
  26:              var item = new Dummy(123);
  27:              var listOfObjects = Enumerable.Repeat(item, 2);
  28:   
  29:              // Show that the entries are actually repeated references to the same object.
  30:              Console.WriteLine("Are the entries repeated references? {0}",
  31:                  Object.ReferenceEquals(listOfObjects.ElementAt(0), listOfObjects.ElementAt(1)));
  32:   
  33:              Console.WriteLine("nnTest is complete.  Press any key to end program.");
  34:              Console.ReadKey();
  35:          }
  36:      }
  37:  }

 

The output of the above code is:

Starting test…

Are the entries repeated references? False
Are the entries repeated references? True

Test is complete.  Press any key to end program.

After you look at the code and consider what’s being repeated, you can understand why one is instances and the other is references.  However, it has tripped up folks.  More on LINQ and Lambdas to come!

 

Happy Coding!

Posted in Uncategorized | Leave a comment

The wonderful tool: VSTSDB

There is a great tool that comes with VSTSDB GDR that allows you to import and deploy databases from boxes where VS is not installed.  You can import, deploy and even generate scripts (both incremental and full).  However, it’s not as simple as just copying over the utility and running it.  There were quite a few blog posts about the ‘work arounds’ to get it to work.  I found a good blog post that covers all of the information that I came across in one straight forward post.  Thanks goes to Barclay for this!  

Happy Coding!

Posted in Uncategorized | Leave a comment

SharePoint 2010 – is it finally a real platform?

For years people have struggled with SharePoint.  The concept is a good one but the implementation left much to be desired (yes, I hear the huge roar of swearing).  Even with the current production release, something as simple as deployment of a Web Part was a real pain in the you-know-what. 

Well, it looks like things are finally looking up for SharePoint developers everywhere.  Enter SharePoint 2010.  Apparently Microsoft has seen that this tool can have a tremendous benefit in terms of saving companies money by centralizing and standardizing many different things from documents, workflows, group work and more.  The problem was that the tool was just too cumbersome and troublesome to work with.  SP2010 aims to make leaps and bounds to solve many of those problems.  SharePoint “14” (the code name) will finally provide some much needed and asked for features:

  • Tight integration with Exchange 2010
  • Ability to create, edit and collaborate on Office documents thru your browser
  • O P E N  A P I S!!!!!!   And even a (real) Client Object Model!
  • Deep support for developing with VS2010  (read here – NO MORE HAND ROLLING WEB PARTS AND XML)
  • One-Click deployment
  • Mapping image URLs to SharePoint environments
  • Better mobile support!

SharePoint 2010 is still only in Beta so it will be very interesting to see what it finally RTM’s with but the outlook (pardon the pun) is really looking good.  Here are some links that are worth scanning:

Happy Coding!!

Posted in Uncategorized | Leave a comment

A .Net 4.0 tidbit to whet your excitement!

This is just a very tiny item to stoke the coals of your excitement about the .Net 4.0!

 

I know this will seem pretty simple but dealing with COM objects or DOM or other externally bound type structures can be pretty tedious if you cannot statically bind to those type libraries.   For example, if you are calling a Calculator object, if you can statically bind and invoke, the code is pretty simple:

 

       // Static Invocation

       Calculator calc = GetCalculator();

       int sum = calc.Add(10, 20);

 

 

However, if you cannot statically bind, you have to go thru the tedious way of doing dynamic invocation.   The code would looks something like this:

 

       // v3.x .Net Dynamic Invocation

       object calc = GetCalculator();

       Type calcType = calc.GetType();

       object result = calcType.InvokeMember("Add", BindingFlags.InvokeMethod, null, new object[] { 10, 20 });

       sum = Convert.ToInt32(result);

 

 

The above works, but the code is messy and will look somewhat different across the different languages.  Here comes .Net 4.0 DLR!!  With the new dynamic keyword the code not only becomes MUCH simpler, but is almost consistent across the languages!!!  Take a look!

 

       // v4.0 .Net Dynamic Invocation using the DLR!

       dynamic calc = GetCalculator();

       sum = calc.Add(10, 20);

 

 

This is exciting stuff!    Happy Coding!!

Posted in Development | Leave a comment