June 2008 - Posts

INETA Champs Program

An XBox or MSDN Subscription to the 10 Most Active Contributors in the User Group Community each quarter.

How?  By doing what you are doing already, you stand to win:
a) Valuable Prizes: An MSDN Subscription.  And, if you already have one, you can choose an XBox instead.

XBoxMSDN Subscription

b) The Fame and Prestige of having an award to hang on your wall that shows that INETA recognizes your contributions to the User Group Community.

Champion Award

c) Official Recognition on the INETA Website  for one year.

All of your peers will be able to see that you stand out above the crowd. If the opportunity presents itself for you to show your dedication to the User Group Community in a public way, there is no better way than to show off your name highlighted on the website of a highly respected organization like INETA.

d) A Badge for your website showing that you are a Community Champion.

When folks visit your website, blog or any other place where you publicly post your work, they will see that you are a Community Champion.

Oooohhhh. Recognition by INETA? Valuable Prizes? An award to hang on my wall? A Badge?  How can I participate?

Well, I am glad that you asked.

INETA has long been known for it's support of User Groups and this year, there are a number of great new programs supporting the User Group Community.  The Community Champs program is one of them.  INETA wants to recognize individuals who are demonstrating their involvement in the User Group community.  The program is aimed at rewarding those that are the most active with the prizes and award mentioned above.  It is INETA's way of recognizing the ones that really bring the community together.  So, in short, if you are the kind of person who helps to run user group meetings, codecamps, or helps out in any number of other ways, you should let INETA know the kind of activities that you are involved in.  If you are very active, you may be recognized by INETA in a very public and spectacular way for the activities that you currently do to help the user group community.

INETA and Community-Credit are making it happen.

Community Credit has been helping to recognize fellow developers for the past number of years for their accomplishments and INETA has been the mainstay of User Groups for many years, so it is no surprise that the two would be working together to make this great program possible.  Best of all, the contributions that you record will also count toward Community Credit prizes, so you may even have a chance to be rewarded with a Geeky, Community Credit prize as an added bonus.

How do I submit my contributions?

Visit the INETA website and go to the Champions section, sign in and let INETA know what you are doing by recording your contributions.  The current quarterly period counts for contributions during period of  June 30th, 2007 to June 30th, 2008.  The final submissions can be made until July 14th.  Keep in mind that the end of this current quarter is coming up pretty soon, so if you have been very active over the last year, be sure to enter them soon so that you don't miss this great opportunity.

What are the benefits of participating?

If you are an individual who is always contributing to the User Group Community, you do it because you like it.  You don't do it because you expect to be rewarded.  At the same time, if you just happen to be rewarded and recognized then that makes it that much better.  Imagine playing on an XBox that you received as a thanks for all of your hard work.  It makes the games just a little bit more fun.  Using your MSDN subscription that you "earned" makes the tools just a little bit better and seeing the award hanging on your wall is a reminder to you and your colleagues just how committed you are.

Can anybody participate?

Unfortunately, the current period (being our first) is for participants in North America only.

Posted by sweisfeld | with no comments
Filed under:

Generics , Extension Methods, and XML Serialization

At the Jax SQL Saturday I was asked to turn a .NET object into an xml file and then reverse the process.

Step 1: Serialization with extension methods
C# 3.0 comes with this cool feature called extension methods. This is syntactical sugar for static methods that allows for you to “add” methods to other objects. To write one of these write a static class with a static method that takes the type you want to extend as the first parameter. The only difference from what you would do normally is to add the keyword “this” before the first parameter. The beauty is that it feels very natural for developers to just type the variable name and press dot and they get your new method in the statement completion in VS. (BTW you can still call the method the way you would in C# 2.0) So with the method below we now have added a Serialize method to Object thus it is inherited everywhere in the entire object model!

public static void Serialize(this object o, string filename)
{
    Type t = o.GetType();
    if (t.IsSerializable)
    {
        XmlSerializer serializer = new XmlSerializer(t);
        using (TextWriter tw = new StreamWriter(filename))
        {
            serializer.Serialize(tw, o);
            tw.Close();
        }
    }
    else
    {
        throw new InvalidOperationException(string.Format("Objects of type {0} are not serializable.", t.Name));
    }
}


Step 2: De-serialization with generics
I like generics for the process of de-serializing, this allows my method to return a strongly typed copy of the object that was serialized to the file.

public static T DeSerializeObject<T>(string filename)
{
    T t;
    XmlSerializer serializer = new XmlSerializer(typeof(T));
    using (TextReader tr = new StreamReader(filename))
    {
        t = (T)serializer.Deserialize(tr);
        tr.Close();
    }
    return t;
}

Use the method like this:
Serializer.DeSerializeObject<Customer>("customer.xml")

Customer c = new Customer { FirstName = "Shawn", LastName = "Weisfeld" };
c.Serialize("customer.xml");

Posted by sweisfeld | 3 comment(s)
Filed under: ,

C# 3.0 (.NET 3.5) Language Features & Delegates

Two more questions from the floor at TechEd.
Perhaps the most frequent question at TechEd is “What are the new features of C# 3.0?” Here is the short list:
• Implicitly typed local variables 
• Extension methods 
• Lambda expressions 
• Object and collection initializers 
• Anonymous types 
• Implicitly typed arrays 
• Query expressions 
• Expression trees 
Check out Anders presentation from last years TechEd here: http://www.microsoft.com/emea/msdn/spotlight/sessionh.aspx?videoid=319
And all the details in this word document:
http://download.microsoft.com/download/5/8/6/5868081c-68aa-40de-9a45-a3803d8134b8/CSharp_3.0_Specification.doc or this URL http://msdn.microsoft.com/en-us/library/bb383815.aspx

Also got a question about what a Delegate was. Here is the definition from the documentation. A delegate is a type that references a method. Once a delegate is assigned a method, it behaves exactly like that method. The delegate method can be invoked like any other method, with parameters and a return value. (http://msdn.microsoft.com/en-us/library/ms173171.aspx)

Posted by sweisfeld | with no comments
Filed under: ,

Silverlight Deep Zoom (aka SeaDragon)

In my second in the series of TechEd Questions I have a good one. Unfortunately it had nothing to do with C#, but that doesn’t diminish its cool factor.

The attendee, lets call her Suzie, volunteered to help organization working with an artist that recently passed away catalogue his work on the internet. She wanted a good way to post high resolution images on the web allowing the public to enjoy this persons artistic contribution. The first thing that jumped to mind with the Hard Rock Demo from Mix (http://memorabilia.hardrock.com) you have got to check this out! You can see the scratches on the guitars. Scott Hanselman has a great blog post with a how to if you want to create your own deep zoom images (http://www.hanselman.com/blog/DeepZoomSeadragonSilverlight2MultiScaleImagesAtMix.aspx). Remember to note that this technology is only as good as the original image so you will need good HighRes images to start with.   

 

Posted by sweisfeld | with no comments
Filed under: ,

Building a solution with many projects is SLOWWWWWWW

This week I am attending TechEd in Orlando FL and I was honored to be requested to work the C# booth by the MVP and C# teams. I got many great questions from attendees and I thought I would post some of the more interesting ones. So here goes.

An attendee, let’s call him Bob, came up and said that his builds were very slow. After some chatting Bob told me that he has a huge number of projects in his solution all “joined” together using project references. This is a convent feature of Visual Studio that provides for “cascading” builds. By that I mean if you change some code in a business library when VS does the build it will build that library first, copy the dll into any projects that reference it, then build those projects. This is very convent but as Bob noted when he changes one line of code in a method it causes the entire project to rebuild. This is not a big deal if the project is small and the builds are quick but if the project is large this could be a very painful experience. So we tossed around some things I would classify as workarounds like for example writing some post build steps that would move dll’s around and the like. But in my opinion the best solution is a properly architected solution. To that end I pointed Bob to an article put together by the P&P group at Microsoft that provides guidance for the architecture of large application with many projects and how to break them up into manageable chunks.

Structuring Projects and Solutions
http://www.codeplex.com/VSTSGuidance/Wiki/View.aspx?title=Chapter%203%20-%20Structuring%20Projects%20and%20Solutions%20in%20Source%20Control

 

Posted by sweisfeld | with no comments