<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.platinumbay.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Platinum Bay</title><link>http://www.platinumbay.com/blogs/</link><description>Peace, Love, and...</description><dc:language>en-US</dc:language><generator>CommunityServer 2007 SP2 (Build: 20611.960)</generator><item><title>Modifying Tree Node Text in the Umbraco Backend</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2011/04/13/modifying-tree-node-text-in-the-umbraco-backend.aspx</link><pubDate>Wed, 13 Apr 2011 11:23:43 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2960</guid><dc:creator>Steve</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I’m currently working on rebuilding the &lt;a href="http://dotnetda.org"&gt;http://dotnetda.org&lt;/a&gt; site using Umbraco and I have created the usual assortment of document types: speakers, meetings, sponsors, etc. For meetings, the name of the node is simply the session title. Unfortunately, this means that finding a meeting requires knowing the session title and I want the node text to be more descriptive and include the date as well. I can use the Umbraco API and write a little code to do this for me.&lt;/p&gt;  &lt;p&gt;To start, I added the following using statements:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;umbraco.BusinessLogic;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;umbraco.cms.businesslogic;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;umbraco.cms.presentation.Trees;&lt;/pre&gt;

&lt;p&gt;Then, I created a class that inherits from &lt;font face="Courier New"&gt;ApplicationBase&lt;/font&gt;. By simply inheriting from &lt;font face="Courier New"&gt;ApplicationBase&lt;/font&gt;, Umbraco will automatically load the class during initialization:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;TreeEvents &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;ApplicationBase
&lt;/span&gt;{
}&lt;/pre&gt;

&lt;p&gt;Next, I added a &lt;font face="Courier New"&gt;TreeEvents&lt;/font&gt; constructor and handled the &lt;font face="Courier New"&gt;BaseTree.BeforeNodeRender&lt;/font&gt; event:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;public &lt;/span&gt;TreeEvents()
{
    &lt;span style="color:#2b91af;"&gt;BaseTree&lt;/span&gt;.BeforeNodeRender += BaseTree_BeforeNodeRender;
}&lt;/pre&gt;

&lt;p&gt;And finally I implemented the &lt;font face="Courier New"&gt;BaseTree_BeforeNodeRender&lt;/font&gt; method with the necessary logic to update the node’s &lt;font size="2" face="Courier New"&gt;Text&lt;/font&gt; property if it’s a meeting:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;void &lt;/span&gt;BaseTree_BeforeNodeRender(
    &lt;span style="color:blue;"&gt;ref &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;XmlTree &lt;/span&gt;sender, &lt;span style="color:blue;"&gt;ref &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;XmlTreeNode &lt;/span&gt;node, &lt;span style="color:#2b91af;"&gt;EventArgs &lt;/span&gt;e)
{
    &lt;span style="color:blue;"&gt;if &lt;/span&gt;(node.NodeType == &lt;span style="color:#a31515;"&gt;&amp;quot;content&amp;quot;&lt;/span&gt;)
    {
        &lt;span style="color:blue;"&gt;var &lt;/span&gt;content = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Content&lt;/span&gt;(&lt;span style="color:blue;"&gt;int&lt;/span&gt;.Parse(node.NodeID));

        &lt;span style="color:blue;"&gt;if &lt;/span&gt;(content.ContentType.Alias == &lt;span style="color:#a31515;"&gt;&amp;quot;Meeting&amp;quot;&lt;/span&gt;)
        {
            &lt;span style="color:blue;"&gt;var &lt;/span&gt;startDate = content.getProperty(&lt;span style="color:#a31515;"&gt;&amp;quot;meetingStartDate&amp;quot;&lt;/span&gt;)
                .Value.ToString();

            &lt;span style="color:blue;"&gt;var &lt;/span&gt;date = &lt;span style="color:#2b91af;"&gt;DateTime&lt;/span&gt;.Parse(startDate);
            node.Text = &lt;span style="color:#2b91af;"&gt;String&lt;/span&gt;.Format(&lt;span style="color:#a31515;"&gt;&amp;quot;{0:MM/dd/yyyy} {1}&amp;quot;&lt;/span&gt;,
                date,
                node.Text
                );
        }
    }
}&lt;/pre&gt;

&lt;p&gt;First, I ensure that I’m dealing with a content node, then I grab the content item based on NodeID. If the content type alias is Meeting, I parse the meetingStartDate property and prepend it to the node’s existing text.&lt;/p&gt;

&lt;p&gt;The final result is that I can now see the meeting date which will make meetings much easier to find:&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image:none;border-bottom:0px;border-left:0px;padding-left:0px;padding-right:0px;display:inline;border-top:0px;border-right:0px;padding-top:0px;" title="image" border="0" alt="image" src="http://www.platinumbay.com/blogs/dotneticated/image_63E82348.png" width="189" height="334" /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Final Code&lt;/strong&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;umbraco.BusinessLogic;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;umbraco.cms.businesslogic;
&lt;span style="color:blue;"&gt;using &lt;/span&gt;umbraco.cms.presentation.Trees;

&lt;span style="color:blue;"&gt;namespace &lt;/span&gt;Netda.Umbraco
{
    &lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;TreeEvents &lt;/span&gt;: &lt;span style="color:#2b91af;"&gt;ApplicationBase
    &lt;/span&gt;{
        &lt;span style="color:blue;"&gt;public &lt;/span&gt;TreeEvents()
        {
            &lt;span style="color:#2b91af;"&gt;BaseTree&lt;/span&gt;.BeforeNodeRender += BaseTree_BeforeNodeRender;
        }

        &lt;span style="color:blue;"&gt;void &lt;/span&gt;BaseTree_BeforeNodeRender(
            &lt;span style="color:blue;"&gt;ref &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;XmlTree &lt;/span&gt;sender, &lt;span style="color:blue;"&gt;ref &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;XmlTreeNode &lt;/span&gt;node, &lt;span style="color:#2b91af;"&gt;EventArgs &lt;/span&gt;e)
        {
            &lt;span style="color:blue;"&gt;if &lt;/span&gt;(node.NodeType == &lt;span style="color:#a31515;"&gt;&amp;quot;content&amp;quot;&lt;/span&gt;)
            {
                &lt;span style="color:blue;"&gt;var &lt;/span&gt;content = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;Content&lt;/span&gt;(&lt;span style="color:blue;"&gt;int&lt;/span&gt;.Parse(node.NodeID));

                &lt;span style="color:blue;"&gt;if &lt;/span&gt;(content.ContentType.Alias == &lt;span style="color:#a31515;"&gt;&amp;quot;Meeting&amp;quot;&lt;/span&gt;)
                {
                    &lt;span style="color:blue;"&gt;var &lt;/span&gt;startDate = content.getProperty(&lt;span style="color:#a31515;"&gt;&amp;quot;meetingStartDate&amp;quot;&lt;/span&gt;)
                        .Value.ToString();

                    &lt;span style="color:blue;"&gt;var &lt;/span&gt;date = &lt;span style="color:#2b91af;"&gt;DateTime&lt;/span&gt;.Parse(startDate);
                    node.Text = &lt;span style="color:#2b91af;"&gt;String&lt;/span&gt;.Format(&lt;span style="color:#a31515;"&gt;&amp;quot;{0:MM/dd/yyyy} {1}&amp;quot;&lt;/span&gt;,
                        date,
                        node.Text
                        );
                }
            }
        }
    }
}&lt;/pre&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2960" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Umbraco/default.aspx">Umbraco</category></item><item><title>Chapters and Seasons</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2011/01/26/chapters-and-seasons.aspx</link><pubDate>Tue, 25 Jan 2011 22:29:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2941</guid><dc:creator>Steve</dc:creator><slash:comments>7</slash:comments><description>&lt;p&gt;As many of you know I stand firmly against the new TSA screening procedures and indeed I have been quite vocal about them. I cannot accept that men, women and children are forced to play russian roulette with their dignity and health. And I cannot accept that there is zero accountability or oversight for those making and enforcing these new policies. I do however accept that not everyone feels the same way I do. Yet for me this is a deeply personal issue&amp;nbsp;and I do not want to fly while these policies are in place.&lt;/p&gt;
&lt;p&gt;About four months ago, before the new airport screening procedures took effect, I took on the role of Developer Evangelist at DevExpress. This position entailed, along with other things, that I would be traveling regularly to speak at events across the country and perhaps the world. I was very excited to join the DevExpress team because, quite frankly, they have the best products on the market and an even better team of passionate people standing behind them.&lt;/p&gt;
&lt;p&gt;Unfortunately with the new air travel procedures I am no longer able to fulfill the requirements of the Developer Evangelist role. A secondary option was presented to move to Los Angeles&amp;nbsp;and be a Technical Evangelist, but I am passionately in love with the Seattle area and the new life I have been creating here. With great sadness I am no longer employed with DevExpress. I wish the team there all the best.&lt;/p&gt;
&lt;p&gt;What’s next for me? I have no idea. To be quite honest I’ve been running balls all for more than three years including &lt;a href="http://www.platinumbay.com/about.aspx" target="_blank"&gt;118 community events&lt;/a&gt;&amp;nbsp;and &lt;a href="http://geekroadtrip.com/" target="_blank"&gt;Geek Road Trip&lt;/a&gt;&amp;nbsp;and I’m starting to realize how tired&amp;nbsp;I am. Exhausted.&amp;nbsp;Burned out. Indeed you all were right that&amp;nbsp;it is impossible to maintain this lifestyle indefinitely. So I am going to start by getting some sleep. I also decided to take a vacation right after I found myself asking if I’m allowed to take a vacation. It’s been years since I last went on vacation though and to be honest I have no idea what a vacation looks like or where I’ll go. Among the things I’d like to do though are sleep, kayak, scuba dive, hike, bike, take pictures, enjoy fine dining, experience some concerts and shows and comedy, read, perhaps dance (poorly), go to a spa, and drink some red wine. And no computers.&lt;/p&gt;
&lt;p&gt;As for what’s next in my career I’ve been considering a number of options:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Doing technical training and consulting in the Seattle area. 
&lt;li&gt;I spoke to a non-profit attorney last week about formally registering &lt;a href="http://geekgive.org/" target="_blank"&gt;GeekGive&lt;/a&gt; as a 501(c)(3) and I have a few additional program ideas I’d love to see GeekGive implement. 
&lt;li&gt;I have also been considering my long-time fallback plan of being a truck driver. You all know I have gasoline running in my veins and I’m sure the conversion to diesel wouldn’t be too hard. Home on weekends, right? 
&lt;li&gt;I have a potential opportunity to get involved in a socially responsible&amp;nbsp;film company. 
&lt;li&gt;I&amp;#39;d love to do more with my music and songwriting. 
&lt;li&gt;And finally I have been thinking about going back to school for a theology degree.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;What I do know is that I do want to spend more of my time and energy on efforts to help change the world. Indeed my heart is broken daily with&amp;nbsp;truly abhorrent stories of human trafficking and fatherlessness.&lt;/p&gt;
&lt;p&gt;Human trafficking is now the world’s second most lucrative criminal endeavor having surpassed arms and outranked only by drugs. It is estimated that roughly 30,000,000 people worldwide are enslaved in sex and labor trafficking in 161 countries. 80% of the victims are women and girls, with roughly 1,000,000 children exploited by the sex trade. Human slavery is presently bigger than the entire 365 year trans-Atlantic slave trade (via &lt;a href="http://slavevoyages.org/tast/assessment/estimates.faces"&gt;http://slavevoyages.org/tast/assessment/estimates.faces&lt;/a&gt;). There is hope though. Many organizations including &lt;a href="http://www.notforsalecampaign.org/" target="_blank"&gt;Not For Sale&lt;/a&gt; have been working tirelessly to raise awareness and engineer solutions and governments, corporations, and societies are beginning to change. We can end slavery.&lt;/p&gt;
&lt;p&gt;Fatherlessness is also an epidemic. It is estimated that as many as 1 in 3 children in the United States will grow up without a father. To many it may seem inconsequential, but that is far from the truth.&amp;nbsp;In John Sowers’ book “&lt;a href="http://fatherlessgeneration.com/" target="_blank"&gt;Fatherless Generation&lt;/a&gt;” he states that “according to various sources, children from fatherless homes account for”:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;63 percent of youth suicides 
&lt;li&gt;71 percent of pregnant teenagers 
&lt;li&gt;90 percent of all homeless and runaway children (who are prime targets for human trafficking) 
&lt;li&gt;70 percent of juveniles in state-operated institutions 
&lt;li&gt;85 percent of all youth who exhibit behavior disorders 
&lt;li&gt;71 percent of all high school dropouts 
&lt;li&gt;75 percent of adolescents in chemical abuse centers 
&lt;li&gt;85 percent of all youths sitting in prison &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;“What’s more, children from fatherless homes are nearly twice as likely to struggle with hyperactivity, conduct, and emotional disorders and have a social impairment. They are nearly three times as likely to be struggling in school or to have to repeat a grade. They are five times more likely to be poor, thirty-three times more likely to be seriously abused (requiring medical attention), and seventy-three times more likely to be killed.”&amp;nbsp;– Fatherless Generation by John Sowers, p 36. The facts are staggering and profound. The biggest need other than for fathers to be Dads is for men to step up and mentor fatherless kids. That can make all the difference. Donald Miller in his book &amp;quot;&lt;a href="http://www.amazon.com/Father-Fiction-Chapters-Fatherless-Generation/dp/1439169160" target="_blank"&gt;Father Fiction&lt;/a&gt;&amp;quot; says that there is something profound that happens when a&amp;nbsp;child is&amp;nbsp;significant in&amp;nbsp;their father&amp;#39;s life; when a father takes the time to mentor and train his son to take responsibility and be honest and treat women with respect;&amp;nbsp;when a father takes the time to treat his daughter like a princess and tell her that she&amp;#39;s beautiful and special and deserving of a good man. And he is right: the world needs more good men and women.&lt;/p&gt;
&lt;p&gt;Whatever the next chapters and seasons of my life looks like, I hope you all continue to be in them, and I hope to see you in Redmond soon!&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2941" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Personal+_1320_+Off+Topic/default.aspx">Personal – Off Topic</category></item><item><title>NYC Give Camp</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/11/17/nyc-give-camp.aspx</link><pubDate>Wed, 17 Nov 2010 20:44:42 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2910</guid><dc:creator>Steve</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Next year, January 14-16, Microsoft is helping to organize a National Day of GiveCamp. We at DevExpress are proud to have been asked to help organize a GiveCamp in New York City.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;What is Give Camp?&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Give Camp is a weekend for software developers, designers, and other technical professionals to give back to local non-profits in their community.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;For more information, visit the Give Camp website: &lt;a href="http://nycgivecamp.org"&gt;http://nycgivecamp.org&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2910" width="1" height="1"&gt;</description></item><item><title>This operation requires IIS integrated pipeline mode</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/10/07/this-operation-requires-iis-integrated-pipeline-mode.aspx</link><pubDate>Thu, 07 Oct 2010 18:37:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2898</guid><dc:creator>Steve</dc:creator><slash:comments>5</slash:comments><description>&lt;p&gt;I’ve been working on a few ASP.NET MVC demos recently, one of which uses a custom ActionResult to send an iCal file back to the user. As part of the custom ActionResult I add a Content-Disposition header to the reply so the user is prompted to download the file.&lt;/p&gt;
&lt;p&gt;When I went to test the code in the browser however (Ctrl+F5), I received a “This operation requires IIS integrated pipeline mode” exception. What makes this particularly interesting is that I am not running in IIS, but rather the out-of-the-box ASP.NET Development Server that comes with Visual Studio so I don’t have control over the “pipeline mode”. Initially searching didn’t turn up anything helpful either.&lt;/p&gt;
&lt;p&gt;It turns out that the answer is really quick and easy; simply change:&lt;/p&gt;&lt;pre class="code"&gt;response.Headers.Add(…)&lt;/pre&gt;
&lt;p&gt;to&lt;/p&gt;&lt;pre class="code"&gt;response.AddHeader(…)&lt;/pre&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2898" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/debugging/default.aspx">debugging</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/MVC/default.aspx">MVC</category></item><item><title>Geek Food Drive Is Back In November</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/09/20/geek-food-drive-is-back-in-november.aspx</link><pubDate>Mon, 20 Sep 2010 12:00:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2891</guid><dc:creator>Steve</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I’m excited to announce that we’re back again this year with &lt;a href="http://www.geekfooddrive.com/" target="_blank"&gt;Geek Food Drive&lt;/a&gt;! The challenge is simple: for every user group to hold a food drive at their November meeting this year. So many folks go hungry during the holidays, this is our chance to help some of them have a happier holiday season.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What To Do&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Bring a non-perishable food item to your user group meeting in November and ask your user group leader to get involved.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;But That’s Not All&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We have prizes to give away as well. To start, every user group that participates will receive a voucher for five free eBooks from O’Reilly. In addition, we have prizes to give away for the groups that bring in the most items based on the following formula: Total Items Collected / Number of Attendees.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;More Info&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Check out the website for more info: &lt;a href="http://www.geekfooddrive.com/" target="_blank"&gt;http://www.GeekFoodDrive.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Let’s make this a great holiday season for some needy families!&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2891" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/geek+food+drive/default.aspx">geek food drive</category></item><item><title>Memo: Zune Desktop Software Usability</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/09/19/memo-zune-desktop-software-usability.aspx</link><pubDate>Sun, 19 Sep 2010 10:08:54 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2894</guid><dc:creator>Steve</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I am quite disappointed at how the Zune desktop software user experience has not improved and the product groups don’t drive usability issues.&lt;/p&gt;  &lt;p&gt;Let me give you my experience from this afternoon:&lt;/p&gt;  &lt;p&gt;I have the Zune desktop software installed and I checked that it was up to date even though that option is hidden in a lot of settings and I had to guess a couple of times to find it.&lt;/p&gt;  &lt;p&gt;I wanted to hear a song that was stuck in my head that I knew I had downloaded from the marketplace. I had forgotten the name of the song so I typed in some lyrics. After waiting for seven seconds some results started coming back, but none of them were the right one. After the rest of the results loaded I instead opened Internet Explorer and searched for the lyrics on Bing. The Microsoft search engine knew exactly what song I was after, but the Microsoft music software does not?&lt;/p&gt;  &lt;p&gt;After getting the title and artist of the song I went back to the Zune desktop software, typed in the name, waiting for almost ten seconds. I had to search for it through three columns and in the “zune results” column the song name was displayed three times. Which one is it?&lt;/p&gt;  &lt;p&gt;The screen also displayed a “collection results” area which I guess means it is on my computer? What is a “collection”? I click on the song name to play it. I am taken to another screen that shows me all of the artists and albums I have on my computer. On the right side is the name of the song along with ‘34’. Have I played it 34 times?&lt;/p&gt;  &lt;p&gt;I click on the song, but nothing happens. I then double-click on the song. Within a few seconds there is an exclamation point in a yellow circle displayed next to the song. What does that mean? Then I start getting exclamation points in yellow circles next to other songs in the album and then a song I didn’t choose starts playing. If I had wanted to hear that song I would have chosen it. I click the song I want again and the yellow circles disappear and then reappear next to different songs. Are the other ones now good? I tried, but they don’t play either.&lt;/p&gt;  &lt;p&gt;I also notice that some songs are in there twice. I have only gotten music from the Zune marketplace so why wouldn’t it tell me that I already had the song instead of allowing me to add it again?&lt;/p&gt;  &lt;p&gt;I figure out that I need to hover my mouse over the yellow circle to find out what is wrong. It says “Playback error: click for more information”. I don’t understand why I got an information message to send me to another place for information. I click on the yellow circle and a box pops up saying that the Zune desktop software can’t play the song and it needs to check usage rights and to sign in. I am signed in. It is error code C00D1365. What does this scary code mean and if it needs to check usage rights then why do some songs play?&lt;/p&gt;  &lt;p&gt;There is a link for web help so I click that. I am taken to Internet Explorer where it tells me I need to sign in on the desktop software using the account that was used to get the music. I only have one Zune account and I am signed in. I know I am signed in because the Zune desktop software shows my name in the top right corner along with my picture and how many credits I have. Web help didn’t tell me anything new and I was taken away from the software I was trying to use.&lt;/p&gt;  &lt;p&gt;I then thought I might try to play the song in my playlist. I go to my playlist and click on the song, but it also now has a yellow circle. I hover over and a message again tells me to go somewhere else for information. This time I’m told that the Zune desktop software can’t play the song possibly because there is an outdated link on the Zune marketplace. What does that mean? I am now worried that the site will change a lot and I won’t be able to play my music.&lt;/p&gt;  &lt;p&gt;I think that maybe the software could help me since it should know both what I have and what is on the Zune marketplace, but when I right-click the song none of the options allow me to fix the problem. I try the Properties option, but nothing happens; no dialog box appears or anything. I try it again. Again nothing happens. Is the it broken?&lt;/p&gt;  &lt;p&gt;I finally decide I should download the song again. It has been 30 minutes so far and I was very frustrated and had almost forgotten what song I wanted to hear. I type in the title, wait a few seconds, and am again presented with the artist name three times. I click one of them and find the song. The button next to the song says download which is weird because I know I already have it. I click download and the song downloads pretty quick.&lt;/p&gt;  &lt;p&gt;I then go to a playlist which has the song and click it, but another song starts playing and I have a yellow circle again. I don’t understand because I had just downloaded the song again. At this point I just give up and close the Zune desktop software after about 30 minutes of craziness and having to download songs I already had and taking me to other pieces of software. I still haven’t heard my song, and I’m not sure I should buy another song that I currently like; what if the website changes again?&lt;/p&gt;  &lt;p&gt;The lack of attention to usability represented by these experiences blows my mind.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;&lt;font size="1"&gt;* Some portions excerpted or modeled after Bill Gate’s famous leaked memo which you can read here: &lt;/font&gt;&lt;a title="http://gizmodo.com/5019516/classic-clips-bill-gates-chews-out-microsoft-over-xp" href="http://gizmodo.com/5019516/classic-clips-bill-gates-chews-out-microsoft-over-xp"&gt;&lt;font size="1"&gt;http://gizmodo.com/5019516/classic-clips-bill-gates-chews-out-microsoft-over-xp&lt;/font&gt;&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2894" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/UXFail/default.aspx">UXFail</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Zune/default.aspx">Zune</category></item><item><title>I’m a Rock Star!</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/09/18/i-m-a-rock-star.aspx</link><pubDate>Fri, 17 Sep 2010 21:14:16 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2885</guid><dc:creator>Steve</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;&lt;img style="border-bottom:0px;border-left:0px;margin:0px 0px 15px 20px;display:inline;border-top:0px;border-right:0px;" title="Silent-Night" border="0" alt="Silent-Night" align="right" src="http://www.platinumbay.com/blogs/dotneticated/SilentNight_thumb_6C97D2C8.jpg" width="124" height="124" /&gt;Ok, I might be exaggerating a little, no one is carrying my bags through the airport &lt;em&gt;yet&lt;/em&gt;, but I discovered today that my very first song is available at several premiere online music services! I’m really quite excited to have it out there and see it happen!&lt;/p&gt;  &lt;p&gt;The song is a short one minute and forty five second instrumental piano rendition of the holiday classic Silent Night I wrote quite a few years back. Friends have enjoyed hearing it and I thought it high time to officially ‘lay it down’ as it were.&lt;/p&gt;  &lt;p&gt;Check it out at your favorite online music service, and &lt;em&gt;just in time&lt;/em&gt; for the holidays: &lt;a title="http://social.zune.net/album/Steve-Andrews/Silent-Night/991a8c06-0100-11db-89ca-0019b92a3933/details" href="http://social.zune.net/album/Steve-Andrews/Silent-Night/991a8c06-0100-11db-89ca-0019b92a3933/details" target="_blank"&gt;Zune&lt;/a&gt;, &lt;a title="http://www.amazon.com/Silent-Night/dp/B0042J5ZYQ/ref=sr_shvl_album_1?ie=UTF8&amp;amp;qid=1284713924&amp;amp;sr=301-1" href="http://www.amazon.com/Silent-Night/dp/B0042J5ZYQ/ref=sr_shvl_album_1?ie=UTF8&amp;amp;qid=1284713924&amp;amp;sr=301-1" target="_blank"&gt;Amazon MP3&lt;/a&gt;, &lt;a title="http://home.napster.com/ns/music/artist_search.html?artist_id=11579837" href="http://home.napster.com/ns/music/artist_search.html?artist_id=11579837" target="_blank"&gt;Napster&lt;/a&gt;. The song should be available soon on other services including: IMVU, Rhapsody, MediaNet, Thumbplay, Spotify, Shockhound, Nokia, and eMusic.&lt;/p&gt;  &lt;p&gt;One goofy thing though, some of the stores are listing me with another Steve Andrews. If you see two albums listed they aren’t mine, unless they are really really good of course.&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;And lastly I don’t think I’ll be getting rich off the song either. Once the composer (me), performing artist (me), record company (me), and the publisher (me) get their cut, I won’t be left with anything.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2885" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Personal+_1320_+Off+Topic/default.aspx">Personal – Off Topic</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/music/default.aspx">music</category></item><item><title>The Power of Community</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/09/13/the-power-of-community.aspx</link><pubDate>Mon, 13 Sep 2010 19:03:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2877</guid><dc:creator>Steve</dc:creator><slash:comments>6</slash:comments><description>&lt;p&gt;Today is the day I finally get to announce something very exciting for me; I’ve joined &lt;a href="http://www.devexpress.com/" target="_blank"&gt;DevExpress&lt;/a&gt; as a Developer Evangelist! I’m super excited about it! To get all the details, check out my new &lt;a href="http://community.devexpress.com/blogs/steve-andrews" target="_blank"&gt;DevExpress blog&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2877" width="1" height="1"&gt;</description></item><item><title>Recursive Fields in Umbraco with XSLT</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/09/09/recursive-fields-in-umbraco-with-xslt.aspx</link><pubDate>Thu, 09 Sep 2010 02:12:26 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2875</guid><dc:creator>Steve</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;I’ve been working with Umbraco quite a bit lately and I’m really loving it as a content management framework. I’ve already converted &lt;a href="http://geekgive.org" target="_blank"&gt;GeekGive.org&lt;/a&gt;, &lt;a href="http://geekroadtrip.com" target="_blank"&gt;GeekRoadTrip.com&lt;/a&gt;, and I’m working on a few others. Being a developer though I often find myself outside the box and today is no different.&lt;/p&gt;  &lt;p&gt;I’m building a site where the homepage will actually reflect content from a subpage including the title. This means I have to get rid of my standard title block in the template and use XSLT.&lt;/p&gt;  &lt;p&gt;My standard title template block:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&amp;lt;title&amp;gt;&amp;lt;asp:placeholder runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;umbraco:Item field=&amp;quot;pageName&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/umbraco:Item&amp;gt; - &amp;lt;umbraco:Item field=&amp;quot;siteName&amp;quot; recursive=&amp;quot;true&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/umbraco:Item&amp;gt;&amp;lt;/asp:placeholder&amp;gt;&amp;lt;/title&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;I created a macro and set about to define the title text. Then it hit me, how do I recursively get the siteName field I defined on the homepage? It turns out this is really simple to do using XSLTs ancestor-or-self function in the value-of select:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;$currentPage/ancestor-or-self::node [string(data[@alias=&amp;#39;siteName&amp;#39;])!=&amp;#39;&amp;#39;] [1] /data[@alias=&amp;#39;siteName&amp;#39;]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The full macro is:&lt;/p&gt;  &lt;p&gt;&lt;font size="2" face="Courier New"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;UTF-8&amp;quot;?&amp;gt;     &lt;br /&gt;&amp;lt;!DOCTYPE xsl:stylesheet [ &amp;lt;!ENTITY nbsp &amp;quot;&amp;amp;#x00A0;&amp;quot;&amp;gt; ]&amp;gt;      &lt;br /&gt;&amp;lt;xsl:stylesheet       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; version=&amp;quot;1.0&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; xmlns:xsl=&amp;quot;&lt;/font&gt;&lt;a href="http://www.w3.org/1999/XSL/Transform&amp;quot;"&gt;&lt;font size="2" face="Courier New"&gt;http://www.w3.org/1999/XSL/Transform&amp;quot;&lt;/font&gt;&lt;/a&gt;    &lt;br /&gt;&lt;font size="2" face="Courier New"&gt;&amp;#160;&amp;#160;&amp;#160; xmlns:msxml=&amp;quot;urn:schemas-microsoft-com:xslt&amp;quot;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; xmlns:umbraco.library=&amp;quot;urn:umbraco.library&amp;quot; xmlns:Exslt.ExsltCommon=&amp;quot;urn:Exslt.ExsltCommon&amp;quot; xmlns:Exslt.ExsltDatesAndTimes=&amp;quot;urn:Exslt.ExsltDatesAndTimes&amp;quot; xmlns:Exslt.ExsltMath=&amp;quot;urn:Exslt.ExsltMath&amp;quot; xmlns:Exslt.ExsltRegularExpressions=&amp;quot;urn:Exslt.ExsltRegularExpressions&amp;quot; xmlns:Exslt.ExsltStrings=&amp;quot;urn:Exslt.ExsltStrings&amp;quot; xmlns:Exslt.ExsltSets=&amp;quot;urn:Exslt.ExsltSets&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; exclude-result-prefixes=&amp;quot;msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets &amp;quot;&amp;gt;      &lt;br /&gt;&amp;lt;xsl:output method=&amp;quot;xml&amp;quot; omit-xml-declaration=&amp;quot;yes&amp;quot;/&amp;gt;      &lt;br /&gt;&amp;lt;xsl:param name=&amp;quot;currentPage&amp;quot;/&amp;gt;      &lt;br /&gt;&amp;lt;xsl:template match=&amp;quot;/&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;xsl:if test=&amp;quot;$currentPage/data [@alias = &amp;#39;pageTitle&amp;#39;] != &amp;#39;&amp;#39;&amp;quot;&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;xsl:value-of select=&amp;quot;$currentPage/data [@alias = &amp;#39;pageTitle&amp;#39;]&amp;quot;/&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; -      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/xsl:if&amp;gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;xsl:value-of select=&amp;quot;$currentPage/ancestor-or-self::node [string(data[@alias=&amp;#39;siteName&amp;#39;])!=&amp;#39;&amp;#39;] [1] /data[@alias=&amp;#39;siteName&amp;#39;]&amp;quot; /&amp;gt;      &lt;br /&gt;&amp;lt;/xsl:template&amp;gt;      &lt;br /&gt;&amp;lt;/xsl:stylesheet&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Hope this helps!&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2875" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Tips/default.aspx">Tips</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Umbraco/default.aspx">Umbraco</category></item><item><title>Code Recovery Services</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/08/05/code-recovery-services.aspx</link><pubDate>Wed, 04 Aug 2010 23:07:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2859</guid><dc:creator>Steve</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;Do you have a .NET assembly that you’ve lost the source code for? Has the assembly been obfuscated thereby rendering tools like &lt;a href="http://www.platinumbay.com/controlpanel/blogs/www.red-gate.com/products/reflector"&gt;Reflector&lt;/a&gt; useless? I have done a few community talks entitled “May the Source Stay With You” based upon my work in code recovery and these services are available to you. If you have a .NET assembly and have lost the source code I can help. For more information, or to get a quote, &lt;a href="http://www.platinumbay.com/blogs/dotneticated/contact.aspx"&gt;contact me&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Some things to remember:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Proof of Ownership&lt;/strong&gt;: You need to be able to prove that you own the intellectual property contained in the assembly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;You can’t turn applesauce back into an apple&lt;/strong&gt;: While you will get functional code back, it may not be exactly the same as the original code due to optimizations made by the .NET compiler and the code recovery tools.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;You retain all rights&lt;/strong&gt;: Once the code recovery is complete you retain all rights to the source code and all files are deleted from my systems.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2859" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Community Event Website Tips</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/06/30/community-event-website-tips.aspx</link><pubDate>Wed, 30 Jun 2010 06:33:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:2844</guid><dc:creator>Steve</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;Every user group, conference, or other community event has a website. It’s a great way to provide easy accessibility to event information. Except a good number of sites don’t do that very well. I am increasing frustrated by the amount of effort required to find even the simplest detail about a user group such as a GPS-able address or contact information. Here are ten suggestions for community event websites:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;A GPS-able address should be on the homepage&lt;/strong&gt;. This is especially important for speakers who may or may not be running late and desperately searching over a mobile device connection for the venue location. The address should be in plain text to enable copying on supported devices. This should also include the venue name, building name, room number, etc.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The next upcoming event should be on the homepage&lt;/strong&gt;. Nothing is more frustrating than trying to find information about an event on a site built to share information about events. The event detail should include the speaker name, date, time, and location.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Provide a contact mechanism&lt;/strong&gt;. People need to be able to contact you. Some sites list the email addresses of the user group leaders, others have a contact form. I’ve had more luck getting in touch with people directly, but the method used for contact is up to you.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Have a list or previous and upcoming events&lt;/strong&gt;. This sounds obvious to most, but there needs to be a list of events on the site. And while a calendar is nice, there should also be a list view.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The official name of the group should be on every page&lt;/strong&gt;. You may have a great acronym, but the full official name of the user group should be on every page. If it’s selectable text that’s even better.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Have links to other local organizers&lt;/strong&gt;. You should display links to other local user groups, conferences, and events.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Meeting recurrence information&lt;/strong&gt;. If your meetings are regularly occurring such as the fourth Tuesday or first Thursday (and they should be), this information should be provided on the website, and preferably on the homepage.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Venue security information&lt;/strong&gt;. If your facility has access control, any instructions should be clearly provided.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Meeting schedule&lt;/strong&gt;. If your meeting follows a specific format or flow this should be provided to the website visitor.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Meeting resources&lt;/strong&gt;. After a meeting has concluded, you should provide any resources from the meeting such as slide decks and code demos as soon as possible. This includes hosting the materials yourself, or more preferably linking the the materials on the author’s site if possible.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;What suggestions do you have?&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=2844" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Community/default.aspx">Community</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/user+group/default.aspx">user group</category></item><item><title>Visual Studio Project and Solution Version Compatibility</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/05/01/visual-studio-project-and-solution-version-compatibility.aspx</link><pubDate>Sat, 01 May 2010 14:15:01 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:984</guid><dc:creator>Steve</dc:creator><slash:comments>76</slash:comments><description>&lt;p&gt;I should be able to open a Visual Studio 2008 solution in Visual Studio 2010 and still be able to open it in Visual Studio 2008 again. Currently, I cannot do incremental upgrades across a team of developers or share solutions with another developer with a newer version.&lt;/p&gt;  &lt;p&gt;Every release of Visual Studio I talk to countless developers who encounter this as a huge pain point in moving to the next version. And every release cycle we encounter this same problem, and every release we tell Microsoft, and every release it isn’t resolved. Microsoft is saying though that they listen to Connect votes. Today &lt;a href="http://twitter.com/kathleendollard" target="_blank"&gt;Kathleen Dollard&lt;/a&gt; created a Connect item for this issue, and I encourage you to vote. It’s important. It matters. And Microsoft says they take action based on Connect votes.&lt;/p&gt;  &lt;p&gt;Vote now: &lt;a href="https://connect.microsoft.com/VisualStudio/feedback/details/556267/projects-and-solutions-must-be-compatible-across-adjacent-releases" target="_blank"&gt;Projects and Solutions Must Be Compatible Across Adjacent Releases&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And remember, by not voting, you’re telling Microsoft this is not an important issue.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=984" width="1" height="1"&gt;</description></item><item><title>The Code Coverage Mirage</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2010/04/15/the-code-coverage-mirage.aspx</link><pubDate>Thu, 15 Apr 2010 13:13:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:977</guid><dc:creator>Steve</dc:creator><slash:comments>977</slash:comments><description>&lt;p&gt;In an online Q&amp;amp;A webcast with &lt;a href="http://twitter.com/shanselman" target="_blank"&gt;Scott Hanselman&lt;/a&gt; today the topic of Code Coverage was raised. One audience member asked what the optimal level of Code Coverage is. The answer is that there isn’t an optimal level because Code Coverage can be a misleading statistic. Take for example the following method:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="COLOR:blue;"&gt;public class &lt;/span&gt;&lt;span style="COLOR:#2b91af;"&gt;Math&lt;br /&gt;&lt;/span&gt;{&lt;br /&gt;    &lt;span style="COLOR:blue;"&gt;public static int &lt;/span&gt;Add(&lt;span style="COLOR:blue;"&gt;int &lt;/span&gt;num1, &lt;span style="COLOR:blue;"&gt;int &lt;/span&gt;num2)&lt;br /&gt;    {&lt;br /&gt;        &lt;span style="COLOR:blue;"&gt;return &lt;/span&gt;num1 + num2;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;You might then write the following unit test to validate the method:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="COLOR:#2b91af;"&gt;TestMethod&lt;/span&gt;]&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;public void &lt;/span&gt;AddTest()&lt;br /&gt;{&lt;br /&gt;    &lt;span style="COLOR:green;"&gt;// ARRANGE&lt;br /&gt;    &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;var &lt;/span&gt;num1 = 4;&lt;br /&gt;    &lt;span style="COLOR:blue;"&gt;var &lt;/span&gt;num2 = 8;&lt;br /&gt;    &lt;span style="COLOR:blue;"&gt;var &lt;/span&gt;expected = 12;&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="COLOR:green;"&gt;// ACT&lt;br /&gt;    &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;var &lt;/span&gt;actual = MathLib.&lt;span style="COLOR:#2b91af;"&gt;Math&lt;/span&gt;.Add(num1, num2);&lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="COLOR:green;"&gt;// ASSERT&lt;br /&gt;    &lt;/span&gt;&lt;span style="COLOR:#2b91af;"&gt;Assert&lt;/span&gt;.AreEqual(expected, actual);?&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;This test will pass, and will also yield 100% code coverage on the &lt;font size="2" face="Courier New"&gt;Add&lt;/font&gt; method:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.platinumbay.com/blogs/dotneticated/image_191749F9.png"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;" title="image" border="0" alt="image" src="http://www.platinumbay.com/blogs/dotneticated/image_thumb_0D818CBA.png" width="210" height="23" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;There is a crucial flaw though. What happens if you pass in &lt;span style="COLOR:blue;"&gt;int&lt;/span&gt;.MaxValue and &lt;span style="COLOR:blue;"&gt;int&lt;/span&gt;.MaxValue? To find out, let’s write another test:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="COLOR:#2b91af;"&gt;TestMethod&lt;/span&gt;]&lt;br /&gt;[&lt;span style="COLOR:#2b91af;"&gt;ExpectedException&lt;/span&gt;(&lt;span style="COLOR:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR:#2b91af;"&gt;OverflowException&lt;/span&gt;))]&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;public void &lt;/span&gt;AddMaxTest()&lt;br /&gt;{&lt;br /&gt;    &lt;span style="COLOR:green;"&gt;// ARRANGE&lt;br /&gt;    &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;var &lt;/span&gt;num1 = &lt;span style="COLOR:blue;"&gt;int&lt;/span&gt;.MaxValue;&lt;br /&gt;    &lt;span style="COLOR:blue;"&gt;var &lt;/span&gt;num2 = &lt;span style="COLOR:blue;"&gt;int&lt;/span&gt;.MaxValue;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="COLOR:green;"&gt;// ACT&lt;br /&gt;    &lt;/span&gt;MathLib.&lt;span style="COLOR:#2b91af;"&gt;Math&lt;/span&gt;.Add(num1, num2);&lt;br /&gt;}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Running this test yields the following failure:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.platinumbay.com/blogs/dotneticated/image_0D1559C5.png"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;" title="image" border="0" alt="image" src="http://www.platinumbay.com/blogs/dotneticated/image_thumb_37818AE2.png" width="644" height="16" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Apparently an OverFlowException wasn’t thrown after all. To understand why, let’s write one more test:&lt;/p&gt;&lt;pre class="code"&gt;[&lt;span style="COLOR:#2b91af;"&gt;TestMethod&lt;/span&gt;]&lt;br /&gt;&lt;span style="COLOR:blue;"&gt;public void &lt;/span&gt;AddMaxExceptionTest()&lt;br /&gt;{&lt;br /&gt;    &lt;span style="COLOR:green;"&gt;// ARRANGE&lt;br /&gt;    &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;var &lt;/span&gt;num1 = &lt;span style="COLOR:blue;"&gt;int&lt;/span&gt;.MaxValue;&lt;br /&gt;    &lt;span style="COLOR:blue;"&gt;var &lt;/span&gt;num2 = &lt;span style="COLOR:blue;"&gt;int&lt;/span&gt;.MaxValue;&lt;br /&gt;
    &lt;span style="COLOR:green;"&gt;// ACT&lt;br /&gt;    &lt;/span&gt;&lt;span style="COLOR:blue;"&gt;var &lt;/span&gt;actual = MathLib.&lt;span style="COLOR:#2b91af;"&gt;Math&lt;/span&gt;.Add(num1, num2);&lt;br /&gt;
    &lt;span style="COLOR:green;"&gt;// ASSERT&lt;br /&gt;    &lt;/span&gt;&lt;span style="COLOR:#2b91af;"&gt;Assert&lt;/span&gt;.Fail(&lt;span style="COLOR:#a31515;"&gt;&amp;quot;Expected Overflow, received: &amp;quot; &lt;/span&gt;+ actual);&lt;br /&gt;}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;The result is not what you might expect:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.platinumbay.com/blogs/dotneticated/image_76DF3E72.png"&gt;&lt;img style="BORDER-BOTTOM:0px;BORDER-LEFT:0px;DISPLAY:inline;BORDER-TOP:0px;BORDER-RIGHT:0px;" title="image" border="0" alt="image" src="http://www.platinumbay.com/blogs/dotneticated/image_thumb_642A44BB.png" width="644" height="19" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;In fact, the result of adding &lt;span style="COLOR:blue;"&gt;int&lt;/span&gt;.MaxValue and &lt;span style="COLOR:blue;"&gt;int&lt;/span&gt;.MaxValue into an int yields negative two. The reason for this, to the best of my knowledge, lies in how the .NET framework processes integer arithmetic. The int type is signed, meaning the last bit of it’s 32 bits is reserved for the positive/negative flag. When it’s processed under the covers however, it’s processed as unsigned, so as it rolls up adding int.MaxValue and int.MaxValue until it flips the flag bit producing a result of negative two.&lt;/p&gt;
&lt;p&gt;What does this have to do with Code Coverage? Our original test adding 4 and 8 and yielding 12 covers the Add method with 100% coverage. It does not however reveal the unexpected result of adding int.MaxValue and int.MaxValue.&lt;/p&gt;
&lt;p&gt;Code Coverage at a low value is a good metric for finding areas of your code in need of more validation. A high Code Coverage number though means nothing without full boundary checking.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=977" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/development/default.aspx">development</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Testing/default.aspx">Testing</category></item><item><title>What is Community?</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/12/24/what-is-community.aspx</link><pubDate>Thu, 24 Dec 2009 04:00:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:912</guid><dc:creator>Steve</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;I’ve travelled the world and the seven seas… ok, ok, just North America, but since September of 2007 I’ve had the opportunity to visit nearly 100 community events from user group meetings, code camps, micro-conferences to major tradeshows such as Tech-Ed and PDC. During my travels I’ve been able to talk one on one with numerous user group leaders and influentials and there are widely varying views as to what community is. A lot of community leaders base their metrics on how many butts in a seat they were able to achieve at their latest meeting. I’m here to tell you my friends that this is not community. Not in the slightest. It’s an association, a club.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;True community is what happens outside of organized events.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Here are a couple thoughts:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;How much time do you spend mentoring other developers?&lt;/strong&gt; &lt;a href="http://twitter.com/jeriley" target="_blank"&gt;Jesse Riley&lt;/a&gt; has a &lt;a href="http://blog.rileytech.net/post/2009/07/22/Mentorship-from-the-mentored-side.aspx" target="_blank"&gt;great post&lt;/a&gt; spawned by a &lt;a href="http://twitter.com/jimholmes" target="_blank"&gt;Jim Holmes&lt;/a&gt; talk on this. I’d recommend seeing Jim’s talk if you ever have the opportunity.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Do you invite your attendees out for food and/or adult beverages after each event?&lt;/strong&gt; This is a great way to not only build relationships, but to find motivated up-and-coming influentials and community leaders. Less than 10% of your attendees will regularly come out afterwards, but those that do tend to have the spark and can be mentored into strong community leaders themselves&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Is your Microsoft Developer Evangelist organizing all the events?&lt;/strong&gt; Some of the best Developer Evangelists I’ve met rarely organize events themselves, rather they support those that are already organizing events. If folks in your local community aren’t organizing events however, that’s a great opportunity to step up and be a leader.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Do you make yourself available?&lt;/strong&gt; I make it a habit to freely share my personal contact info, and unless I’m overdue on a deadline (hypothetically speaking of course), I try to make myself available. For the record:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Phone: (610) 883-7667&lt;/li&gt;
&lt;li&gt;Email and Live Messenger: steve [at] platinumbay [dot] com&lt;/li&gt;
&lt;li&gt;Twitter: &lt;a href="http://twitter.com/SteveAndrews" target="_blank"&gt;SteveAndrews&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;
&lt;p&gt;To me, community is not about a place to hang my hat and pat&amp;nbsp;myself on the back. It’s a place where I can both learn and teach, mentor and be mentored, and build meaningful and lasting relationships with my peers. I’d encourage you to do the same.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=912" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Community/default.aspx">Community</category></item><item><title>Tips for Releasing Sample Code</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/12/23/tips-for-releasing-sample-code.aspx</link><pubDate>Wed, 23 Dec 2009 15:24:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:941</guid><dc:creator>Steve</dc:creator><slash:comments>5</slash:comments><description>&lt;p&gt;When I’m learning a new technology, I’ll frequently download code samples that help me better understand the concepts. Often though I find myself frustrated by having to deal with formatting and extraneous information before even looking at the code. To that end I have some rules for releasing sample code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Format Every Document &lt;br /&gt;&lt;/strong&gt;The keyboard shortcut for this is Ctrl+K+D. Nothing is more frustrating than looking at unformatted code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code Order &lt;br /&gt;&lt;/strong&gt;Code&amp;nbsp;should be ordered in the following structure from top to bottom: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;events&lt;/li&gt;
&lt;li&gt;fields and automatic properties&lt;/li&gt;
&lt;li&gt;constructors&lt;/li&gt;
&lt;li&gt;abstract methods&lt;/li&gt;
&lt;li&gt;methods&lt;/li&gt;
&lt;li&gt;abstract properties&lt;/li&gt;
&lt;li&gt;properties&lt;/li&gt;
&lt;li&gt;subclasses&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Code Statements &lt;br /&gt;&lt;/strong&gt;Include a blank line before return statements and before and after decision blocks (including using, if, switch, while). In C#, opening and closing brackets&amp;nbsp;should be on their own line.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Remove Excess Blank Lines &lt;br /&gt;&lt;/strong&gt;There&amp;nbsp;should never be more than one consecutive blank line between any lines of code. With consecutive closing brackets as well as #endregion notations in C#, there should be no blank lines between them. There&amp;nbsp;should also be no blank lines between fields or at the beginning or end of method or property bodies.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Separate Code&lt;/strong&gt; &lt;br /&gt;There&amp;nbsp;should be one blank link between properties and methods to allow the user to see logical breaks in the code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Code Files&lt;/strong&gt; &lt;br /&gt;There&amp;nbsp;should only be one class, interface or enumeration per file.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;XML Comments &lt;br /&gt;&lt;/strong&gt;Always remove unnecessary XML comments from your code files. For example, this XML comment should be removed:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="COLOR:gray;"&gt;/// &amp;lt;param name=&amp;quot;param&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;strong&gt;Import Namespace Placement &lt;br /&gt;&lt;/strong&gt;Import (C#) or using (VB) directives should be placed above the namespace. Also use the &lt;em&gt;Organize Usings &amp;gt; Remove and Sort&lt;/em&gt; refactoring built-in to Visual Studio 2008 and Visual Studio 2010 to remove any unnecessary directives. This also helps to make the directives more readable.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Wrapping Lines &lt;br /&gt;&lt;/strong&gt;Don’t manually wrap long lines of code. Visual Studio has a feature to allow a user to wrap long lines if they so choose.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Properties &lt;br /&gt;&lt;/strong&gt;Use automatic properties in .NET 3.0 code and above whenever possible.&lt;/p&gt;
&lt;p&gt;These are a few of the rules. I’ll try to keep the list updated as I run across more frustrations.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=941" width="1" height="1"&gt;</description></item><item><title>Visual Studio Code Formatting</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/12/20/visual-studio-code-formatting.aspx</link><pubDate>Sun, 20 Dec 2009 04:39:13 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:933</guid><dc:creator>Steve</dc:creator><slash:comments>67</slash:comments><description>&lt;p&gt;Working on a website in Visual Studio I found myself annoyed again by the extra spaces around &lt;font face="Courier New"&gt;&amp;lt;script /&amp;gt;&lt;/font&gt; tags when I type Ctrl+K+D (Format Code). It turns out however that this is easy to change. As with most Visual Studio customizations, the answer lies in Tools &amp;gt; Options.&lt;/p&gt;  &lt;p&gt;Under Tools &amp;gt; Options &amp;gt; Text Editor &amp;gt; Html &amp;gt; Format, click the ‘Tag Specific Options…’ button. Under ‘Client HTML Tags’ find ‘script’. Finally, under ‘Line breaks’, change the default value from “2 Before opening, within, and 2 after closing” to “Before and After”, like the Rush song.&lt;/p&gt;  &lt;p&gt;This isn’t specific to HTML though, most of the languages under Text Editor support formatting options. Another change I typically make is for CSS to use the Compact rules.&lt;/p&gt;  &lt;p&gt;Happy Formatting!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.platinumbay.com/blogs/dotneticated/1220200962949_31E6FE18.png"&gt;&lt;img style="border-right-width:0px;display:block;float:none;border-top-width:0px;border-bottom-width:0px;margin-left:auto;border-left-width:0px;margin-right:auto;" title="12-20-2009 6-29-49" border="0" alt="12-20-2009 6-29-49" src="http://www.platinumbay.com/blogs/dotneticated/1220200962949_thumb_6E1F9D35.png" width="644" height="448" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=933" width="1" height="1"&gt;</description></item><item><title>Help Rebuild New Orleans At Tech·Ed NOLA</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/12/14/help-rebuild-new-orleans-at-tech-183-ed-nola.aspx</link><pubDate>Mon, 14 Dec 2009 20:29:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:927</guid><dc:creator>Steve</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;Just announced, &lt;a href="http://northamerica.msteched.com/default.aspx" target="_blank"&gt;registration is now open&lt;/a&gt; for Microsoft Tech·Ed 2010, June 7-10, in New Orleans, Louisiana. Tech·Ed isn’t the only reason you should come to New Orleans though.&lt;/p&gt;
&lt;p&gt;It has been four years since Hurricane Katrina devastated the gulf coast as the worst civil disaster in American history. It is estimated that 400,000 jobs were lost and 275,000 homes were destroyed, ten times as many as any other natural disaster in US history. The total cost is estimated at $100 billion in damages making Katrina&amp;nbsp;the most costly hurricane in US history. Up to 15 million people were affected by Hurricane Katrina, and New Orleans itself is still struggling to rebuild and&amp;nbsp;one of the biggest needs is for new housing.&lt;/p&gt;
&lt;p&gt;I&amp;#39;d like to help, so I have arranged for a volunteer group to work with Habitat for Humanity to help rebuild New Orleans on Saturday June 5th, 2010, the Saturday before Tech·Ed. This is your opportunity to help an area that still has immense need, as well as to network with fellow geeks and eat more shrimp and oyster poboys! You should try the fried alligator too.&lt;/p&gt;
&lt;p&gt;If you would like to volunteer to help rebuild New Orleans on Saturday, June 5th, 2010, please visit: &lt;a title="http://geekgive.org/geekgive/Project/techednola2010" href="http://geekgive.org/project/techednola2010"&gt;http://geekgive.org/project/techednola2010&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For more information about working with Habitat for Humanity, please read the &lt;a href="http://www.habitat-nola.org/files/1_FAQ.doc"&gt;FAQ&lt;/a&gt; (Microsoft Word) and &lt;a href="http://www.habitat-nola.org/files/NOAHH_Safety_Manual.doc"&gt;Safety Guidelines&lt;/a&gt; (Microsoft Word).&lt;/p&gt;
&lt;p&gt;I am also looking for sponsors to help with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Hotel Discounts&lt;/li&gt;
&lt;li&gt;Transportation&lt;/li&gt;
&lt;li&gt;Breakfast&lt;/li&gt;
&lt;li&gt;Lunch&lt;/li&gt;
&lt;li&gt;Water&lt;/li&gt;
&lt;li&gt;After-Party&lt;/li&gt;
&lt;li&gt;$50 suggested donation to Habitat for Humanity per person to help cover work gloves and other costs&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;If you can help sponsor this volunteer event, please contact me at steve [at] platinumbay [dot] com.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=927" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Tech+Ed/default.aspx">Tech Ed</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Volunteering/default.aspx">Volunteering</category></item><item><title>Serialization Generics</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/12/07/serialization-generics.aspx</link><pubDate>Mon, 07 Dec 2009 04:05:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:922</guid><dc:creator>Steve</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;I really dislike writing the same code over and over again. For my current project, this involves serialization and I ended up creating the following generic class to handle Xml serialization and thought it might be useful to someone else.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;using &lt;/span&gt;System.Xml.Serialization;

&lt;span style="color:blue;"&gt;public class &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;SerializationHelper&lt;/span&gt;&amp;lt;T&amp;gt; &lt;span style="color:blue;"&gt;where &lt;/span&gt;T : &lt;span style="color:blue;"&gt;class
&lt;/span&gt;{
    &lt;span style="color:blue;"&gt;public string &lt;/span&gt;SerializeXml(T o)
    {
        &lt;span style="color:blue;"&gt;var &lt;/span&gt;serializer = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;XmlSerializer&lt;/span&gt;(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(T));

        &lt;span style="color:blue;"&gt;var &lt;/span&gt;sb = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;StringBuilder&lt;/span&gt;();
        &lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color:blue;"&gt;var &lt;/span&gt;tw = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;StringWriter&lt;/span&gt;(sb))
        {
            serializer.Serialize(tw, o);
        }

        &lt;span style="color:blue;"&gt;return &lt;/span&gt;sb.ToString();
    }

    &lt;span style="color:blue;"&gt;public &lt;/span&gt;T DeserializeXml(&lt;span style="color:blue;"&gt;string &lt;/span&gt;text)
    {
        &lt;span style="color:blue;"&gt;var &lt;/span&gt;serializer = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;XmlSerializer&lt;/span&gt;(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(T));

        &lt;span style="color:blue;"&gt;using &lt;/span&gt;(&lt;span style="color:blue;"&gt;var &lt;/span&gt;tr = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;StringReader&lt;/span&gt;(text))
        {
            &lt;span style="color:blue;"&gt;return &lt;/span&gt;(T)serializer.Deserialize(tr);
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=922" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/development/default.aspx">development</category></item><item><title>UX Fail</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/11/30/ux-fail.aspx</link><pubDate>Mon, 30 Nov 2009 03:23:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:914</guid><dc:creator>Steve</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;I’ve been developing software for over ten years now. In those ten years software technology has grown by enormous leaps and bounds. User experience however has not. I’d argue that user experience has hardly improved at all, and I grow more and more frustrated at the wasted potential as indicated by these tweets from yesterday:&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Ok, ok, I love technology too, but mostly for it&amp;#39;s potential. I haven&amp;#39;t seen it live up to that yet.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;If I had to do it over, I&amp;#39;d be a loud and vocal critic of bad user experience. To that end, I registered uxfail.org.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;At the end of the day, most software *is* nothing more than user experience.&lt;/em&gt;&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I bought the domain name UXFail.org and set up BlogEngine.NET to rant, vent, and hopefully help people improve the user experience of their software solutions. Visit the site, read the posts, and feel free to submit your own fails from the battlefield.&lt;/p&gt;
&lt;h2 align="center"&gt;&lt;a href="http://uxfail.org/"&gt;http://uxfail.org&lt;/a&gt;&lt;/h2&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=914" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/UXFail/default.aspx">UXFail</category></item><item><title>Shotokan Development</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/11/28/shotokan-development.aspx</link><pubDate>Sat, 28 Nov 2009 18:07:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:909</guid><dc:creator>Steve</dc:creator><slash:comments>7</slash:comments><description>&lt;p&gt;&lt;em&gt;Note: There is still so much more I want to say on this topic, but that will have to wait for another post as I further distill my thoughts.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;At the end of my three week stint in Redmond, WA in October and November&amp;nbsp;I was thrilled to be able to support &lt;a href="http://twitter.com/saraford" target="_blank"&gt;Sara Ford&lt;/a&gt; as she tested for her second dan (second degree black belt) in Shotokan karate. Apart from being a cold and rainy night in Bellevue, it was a utterly humbling experience. The strength, speed, focus, and control of all those who tested for 1st, 2nd, and 3rd degree black belts was amazing. More so, what I experienced that evening has really started to change the way I think about software development and community in general.&lt;/p&gt;
&lt;p&gt;As an aside, Sara alone was so completely focused and exhibited such speed and control that I think my eyeballs melted and are just now recovering. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Dojos and Schools of Thought&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;“A &lt;b&gt;dojo&lt;/b&gt; (道場, &lt;i&gt;dōjō&lt;/i&gt;) is a Japanese term which literally means &amp;quot;place of the way&amp;quot;. Initially, dojos were adjunct to temples. The term can refer to a formal training place for any of the Japanese &lt;i&gt;do&lt;/i&gt; arts but typically it is considered the formal gathering place for students of any Japanese martial arts style to conduct training, examinations and other related encounters.” – &lt;a href="http://en.wikipedia.org/wiki/Dojo" target="_blank"&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Each dojo is unique, both taking practice and methodology from those before them, and molding in their own style and techniques. More importantly though, no dojo is inherently wrong. There are no ‘my camp is better than your camp’ mantras. In the software developer community however, I find people taking sides on any number of issues: databases, version control, testing, design patterns, and even hardware. Similarly, such arguments often fail to take into account all the variables and environmental issues that must be considered to make a decision. This has long troubled me as I tend to be very pragmatic. Sure, I nag the heck out of folks on Twitter about Team Foundation Server and MSTest, but at the end of the day if they’re using a tool and TFS doesn’t solve any pain points they have with that tool then there is absolutely no reason to change. There is no one right answer. There can’t be. Life isn’t that simple.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Philosophies and Mindsets&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&amp;quot;The ultimate aim of Karate lies not in victory or defeat, but in the perfection of the character of the participant.&amp;quot; - Gichin Funakoshi (1868–1957)&lt;/p&gt;
&lt;p&gt;In each Shotokan dojo, the precepts are displayed on a wall somewhere. These precepts typically include seeking perfection of character, being faithful, endeavoring to excel, and respecting others.&lt;/p&gt;
&lt;p&gt;Similarly, I believe that the goal of practicing software development should not be producing software, but rather to continually improve and subsequently solve real business needs. The real value of software is not technical. The real value of software is to improve someone’s life. Whether that involves automating a manual accounting system, building an e-commerce website to provide online revenue, or any other countless systems that software developers build. The philosophy of software development should also not just be about the technology. It should also encompass the attitude and character of the developer.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Senseis and Teachers&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;From Japanese 先生 &lt;i&gt;sensei&lt;/i&gt;, literally &amp;quot;one who lived before&amp;quot; - &lt;a href="http://en.wiktionary.org/wiki/sensei" target="_blank"&gt;Wiktionary&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;In Shotokan, the term Sensei is reserved for those who have achieved fourth dan or higher. Once achieving the sensei status, students are expected to start teaching others. It does not however mean the end of direct learning; senseis continue to be taught by those their senior. Teaching others is to be taught in return; I have been privileged to learn far more by teaching than by simply being taught.&lt;/p&gt;
&lt;p&gt;During the exam, I was immediately hit square in the face by the attitudes of the senseis: learning is never complete and the goal of any good teacher is to help the student improve. During the course of the exam, students were called out periodically for not having demonstrated a particular technique correctly. Many times they were made to re-do the technique solo with instruction from the senseis. Instead of ridiculing or degrading the student however, it was recognized as an important time to provide instruction to help the student become more proficient, and it was done in a loving and fatherly manner with the aim of helping the student improve, not improving the sensei’s position. In fact, it might even be considered shameful to dojo sensei in front of the guest seventh and ninth degree black belts who administered the exam. Nevertheless, the student’s success is their success.&lt;/p&gt;
&lt;p&gt;Unfortunately, I am seeing the opposite in software development. Mistakes or misunderstandings often seem to be used as opportunities to devalue someone and make them feel worthless, especially in non-physical environments such as Twitter and blogs. The underlying reasons for this lies in Relational Dynamics and the Lifeboat Syndrome (think high school), but that’s another topic entirely. At the end of the day though, anyone who attempts to teach or instruct without a real desire to help the student improve is not worthy the title sensei.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Exams and Measurement&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The exams were broken up into three parts: Kihon, Kata, and Kumite. Kihon, the basics, involves demonstrating individual techniques such as kicks, punches, sweeps, strikes, blocks, and throws. Kata, or forms, is a sequence of choreographed movements sometimes up to ten minutes long that demonstrate Kihon as well as stepping, twisting, turning, dropping to the ground, and jumping. Kata is the practical application of Kihon; understanding perfection via repetition. Kumite, or fighting, is the practical application of Kihon with a real opponent through non-scripted sparring.&lt;/p&gt;
&lt;p&gt;In software technology, our current methods of evaluating an individual’s proficiency in a particular technology has been largely limited to Kihon. Do you know what framework class to use to send mail and the appropriate properties to set? What is the precision of a decimal? And yes, I’ve been asked both questions. The problem with solely using Kihon to test someone’s ability is that no matter how any particular test may be structured, it comes down to nothing more than rote memorization. Anyone can memorize the .NET framework’s namespaces and classes and answer multiple choice questions, but said individual may not have a clue as to how to use them appropriately or use multiple Kihons together in a Kata to form a more perfect solution.&lt;/p&gt;
&lt;p&gt;We as an industry need to find ways to more thoroughly evaluate an individual’s proficiency in a particular technology area or multiple technology areas. This means formulating ways to test individuals at a Kata and Kumite level. Some industries have worked to address this by adopted the idea of apprenticeship or internship.&amp;nbsp; During such a period, an individual works hands-on with a sensei who not only can evaluate the person’s Kihon, but also their Kata: reasoning, decision making, thought process, practical application, and can provide guidance to help the person improve. Finally, we need to test at the Kumite level before someone can be called a master at any particular level. Microsoft provides some of this in the form of the Masters exams, hands-on Q&amp;amp;A with other recognized masters. But we need a way to provide Kata and Kumite level evaluation at every level of a person’s career, not just the architect level.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Belts and Expertise&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;While the belt system varies somewhat by school, there are 6 levels of colored belts in Shotokan as a student approaches dan, the black belt. There are also ten levels of black belt. One amazing tidbit I learned about belts is that one has to wait 3-5 years before advancing to the next belt level. This could mean 50 or 60 years before reaching tenth dan, a lifetime of dedication. As Sara pointed out to me, “Karate is a way of life,” even if it means missing a Saint’s game.&lt;/p&gt;
&lt;p&gt;Our industry has tried to establish levels of expertise, typically using job titles such as Junior, Mid-Level, Senior, Architect. However, these title can be rather arbitrary as typically no real measure of proficiency has been evaluated other than a simple Kihon interview. As was mentioned above, we need a way to more thoroughly evaluate an individuals proficiency beyond rote memorization. This may include pair programming as part of the interview process (Kata), complex situational analysis for an optimal solution (Kumite), and test-driven technical skills analysis (Kihon/Kata).&lt;/p&gt;
&lt;p&gt;[Similarly, many companies fall victim to the mentality that hiring a team of yellow belt (junior) developers will have the same result as one second degree black belt (senior or architect) developer. This is just simply not the case.]&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Shotokan Development&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So what would Shotokan development look like? Hypothetically:&lt;/p&gt;
&lt;p&gt;First, there would be dojos: schools of similar thought, each one able to reach the same goals though maybe through differing techniques and technology.&lt;/p&gt;
&lt;p&gt;Second, there would be senseis who are the proven masters of their domain who would teach, encourage, and instruct their students, always in a positive manner towards the betterment of the student.&lt;/p&gt;
&lt;p&gt;Finally, there would be belts: skills, techniques and attitudes demonstrated using Kihon, Kata and Kumite to earn the next level.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=909" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/development/default.aspx">development</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Community/default.aspx">Community</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/shotokan/default.aspx">shotokan</category></item><item><title>NotAtPDC is back!</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/11/16/notatpdc-is-back.aspx</link><pubDate>Sun, 15 Nov 2009 23:55:30 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:901</guid><dc:creator>Steve</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;It’s official, we’re back again this year. As you may recall, a bunch of tweeps got together last year to organize an online-only co-conference with PDC. The results and reaction where outstanding, and we’ve decided to do it again.&lt;/p&gt;  &lt;p&gt;Keep an eye on the website (&lt;a href="http://www.NotAtPDC.com"&gt;http://www.NotAtPDC.com&lt;/a&gt;) as well as the Twitter account (&lt;a href="http://twitter.com/notatpdc" target="_blank"&gt;@NotAtPDC&lt;/a&gt;) for details and info.&lt;/p&gt;  &lt;p&gt;Want to present? &lt;a href="http://www.notatpdc.com/Schedule/Propose" target="_blank"&gt;Sign up&lt;/a&gt; on the site with your session info.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=901" width="1" height="1"&gt;</description></item><item><title>Team Build Property Reference Guide</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/10/11/team-build-property-reference-guide.aspx</link><pubDate>Sun, 11 Oct 2009 19:46:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:892</guid><dc:creator>Steve</dc:creator><slash:comments>67</slash:comments><description>&lt;p&gt;&lt;a href="http://www.platinumbay.com/blogs/postimages/TeamBuildProperty_130F6/TeamBuildPropertyTargetReference.png"&gt;&lt;img src="http://www.platinumbay.com/blogs/postimages/TeamBuildProperty_130F6/TeamBuildPropertyTargetReference_thumb.png" title="TeamBuildPropertyTargetReference" style="border:0px none;margin:0px 0px 0px 20px;display:inline;" alt="TeamBuildPropertyTargetReference" align="right" border="0" height="451" width="192" /&gt;&lt;/a&gt;I’ve been working quite a bit with Team Build lately, and overriding properties is a method of customization I’ve found quite useful in certain scenarios. Along the way, I found Aaron Hallberg’s excellent &lt;a href="http://blogs.msdn.com/aaronhallberg/archive/2008/02/12/team-build-2008-property-reference.aspx" title="Team Build 2008 Property Reference by Aaron Hallberg" target="_blank"&gt;Team Build 2008 Property Reference&lt;/a&gt; blog post, but it didn’t show me where the properties were referenced. In fact, there isn’t an easy way to determine where any particular Property is being used or set other than reading through the 1,500 lines in the Microsoft.TeamFoundation.Build.targets file. I decided to spend a few hours, read through the file myself, and compile a chart of each Property, what Target it is referenced by, and how it is referenced.&lt;/p&gt;  &lt;p&gt;Hopefully the chart is self-explanatory, but here’s some tips:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Target names are along the horizontal axis&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Base represents the root of the Targets file where global Properties are set&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Property names are along the vertical axis&lt;/li&gt;    &lt;li&gt;Legend&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Set: The Property is Set inside the Target. In the case of &lt;/li&gt;      &lt;li&gt;Used: The Property is used inside the Target&lt;/li&gt;      &lt;li&gt;Condition: The Target or a contained Task references the Property in a condition&lt;/li&gt;      &lt;li&gt;Error If Exists: Team Build will throw an exception if the Property is set, or not set, under the right conditions&lt;/li&gt;      &lt;li&gt;Null Error: Team Build will throw an exception if the Property is null&lt;/li&gt;      &lt;li&gt;Depends On: The target has a DependsOn for the Property. The Property contains a semi-colon delimited list of Target names&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;I do not claim the chart to be 100% without error, so verify before you use it. Please send any updates or corrections to me.&lt;/p&gt;  &lt;p&gt; As a side note, if you are working with Team Build, Aaron Hallberg’s &lt;a href="http://blogs.msdn.com/aaronhallberg" title="MSDN - Aaron Hallberg" target="_blank"&gt;blog&lt;/a&gt; is choked full of Team Build goodness.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=892" width="1" height="1"&gt;</description><enclosure url="http://www.platinumbay.com/blogs/dotneticated/attachment/892.ashx" length="27893" type="application/vnd.openxmlformats-officedocument.spre" /><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/TFS/default.aspx">TFS</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Team+Foundation/default.aspx">Team Foundation</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Team+Build/default.aspx">Team Build</category></item><item><title>Neat Visual Studio Test Options</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/09/25/neat-visual-studio-test-options.aspx</link><pubDate>Thu, 24 Sep 2009 21:17:50 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:881</guid><dc:creator>Steve</dc:creator><slash:comments>27</slash:comments><description>&lt;p&gt;Digging around in Tools &amp;gt; Options today to find the answer to an inquiry I received, I found some stuff I didn’t know existed. If you work with Visual Studio Test Projects, you will want to know about these options. The Test Tools options are found in Tools &amp;gt; Options &amp;gt; Test Tools.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Test Execution Options&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;The original question I received was from someone asking how to reduce the number of test results that Visual Studio kept around after test runs. The answer lies in the Test Execution options under Test Result Management. There is an option there labeled “Limit number of old Test Results to.” By default, this value is set to 25. While 25 may be an ideal setting if you are running a multitude of test runs and want to compare results, for most of us this is overkill. Personally I set it to three, and that tells Visual Studio to clean up results older than three runs.&lt;/p&gt;  &lt;p&gt;Also take note of the checkbox below it labeled “Double-clicking a Failed or Inconclusive unit test result displays the point of failure in the test.” When you double-click on a failed or inconclusive unit test result, you will no longer be taken to a test result report. Rather, you will be taken to the line of code that failed in the test.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.platinumbay.com/blogs/postimages/VisualStudioTestOptions_11FB7/image.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="367" alt="image" src="http://www.platinumbay.com/blogs/postimages/VisualStudioTestOptions_11FB7/image_thumb.png" width="640" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Test Project Options&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I have always been frustrated when test projects were created with the “About Test Projects” introduction file and the Manual Test. The next step after creation for me was always to delete these items. In digging around today, I discovered that what files are created with test projects is configurable. Under the Test Project node, you will find a two side-by-side list boxes at the bottom of the settings pane. The left side allows you to select a language-specific test project, and the right side contains checkboxes allowing you to specify which files are included by default.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.platinumbay.com/blogs/postimages/VisualStudioTestOptions_11FB7/image_3.png"&gt;&lt;img title="image" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" height="367" alt="image" src="http://www.platinumbay.com/blogs/postimages/VisualStudioTestOptions_11FB7/image_thumb_3.png" width="640" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;I’m sure you will find these tips as useful as I have, I know they’ll be making their way into my Visual Studio Tips and Tricks talk.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=881" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Tips/default.aspx">Tips</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/MSTest/default.aspx">MSTest</category></item><item><title>jQuery and MVC: JSON Form Submission</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/31/jquery-and-mvc-json-form-submission.aspx</link><pubDate>Mon, 31 Aug 2009 19:33:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:865</guid><dc:creator>Steve</dc:creator><slash:comments>16</slash:comments><description>&lt;p&gt;In my last two posts (&lt;a href="http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/28/jquery-and-mvc-json.aspx" target="_blank"&gt;jQuery and MVC: JSON&lt;/a&gt; and &lt;a href="http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/29/favorite-image-icons-with-jquery-and-mvc.aspx" target="_blank"&gt;Favorite Image Icons with jQuery and MVC&lt;/a&gt;) I covered some basics of jQuery’s AJAX functionality to improve user experience. One of the scenarios which may not seem particularly asynchronous friendly is form submission. Fortunately, jQuery provides for asynchronous post, and in JSON format too.&lt;/p&gt;  &lt;p&gt;The complete code to perform this is:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;form&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;).submit(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;function&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(e) {&lt;br /&gt;    e.preventDefault();&lt;br /&gt;    $.post($(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;this&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;).attr(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;action&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;), $(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;this&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;).serialize(), &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;function&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(json) {&lt;br /&gt;        &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:green;"&gt;// handle response&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;}, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;json&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;br /&gt;});&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;First, get a jQuery reference to the form element and add a submit event handler:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;form&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;).submit(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;function&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(e) {&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;Next, we need to cancel the form’s default behavior by using the &lt;font face="courier new,courier"&gt;preventDefault &lt;/font&gt;function:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;e.preventDefault();&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Next, and this is the cool part, we call the post method in jQuery. The post method takes four arguments: url, data, callback, and type. The first three should be familiar from the previous blog posts, but the last one is new. The type parameter specifies the type of data and accepts &amp;quot;xml&amp;quot;, &amp;quot;html&amp;quot;, &amp;quot;script&amp;quot;, &amp;quot;json&amp;quot;, &amp;quot;jsonp&amp;quot;, or &amp;quot;text&amp;quot;. The example above is using JSON.

&lt;p&gt;Rather than hard coding the url, it can be retrieved from the form element itself:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;this&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;).attr(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;action&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;)&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;And rather than manually pulling form fields into the data object, as the form may change, we can call jQuery’s &lt;font face="courier new,courier"&gt;serialize &lt;/font&gt;function on the form itself:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;this&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;).serialize()&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Finally, we can tie it all together with an MVC action. This example uses the Employee entity from the Northwind database. Since the identifier on the Employee entity is EmployeeID and not ID, &lt;font face="courier new,courier"&gt;id &lt;/font&gt;needs to be specified as an action parameter in order to retrieve the correct employee from the database.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;[&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;AcceptVerbs&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;HttpVerbs&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;.Post)]&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;public &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;JsonResult &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Edit(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;int &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;id, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Employee &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;employee)&lt;br /&gt;{&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:green;"&gt;// do work&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;return new &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;JsonResult &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{ Data = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{ Success = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;true &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;} };&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;One common scenario for this functionality is to provide asynchronous searching within a page. Even asynchronous form submits are possible with jQuery, making your arsenal that much more powerful.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=865" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/jQuery/default.aspx">jQuery</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/MVC/default.aspx">MVC</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/JSON/default.aspx">JSON</category></item><item><title>Favorite Image Icons with jQuery and MVC</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/29/favorite-image-icons-with-jquery-and-mvc.aspx</link><pubDate>Sat, 29 Aug 2009 17:01:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:855</guid><dc:creator>Steve</dc:creator><slash:comments>8</slash:comments><description>&lt;p&gt;User experience, that’s the name of the game these days. Green screens and console applications are (hopefully) becoming a thing of the past. In the web world, this means a more fluid and asynchronous experience. In my &lt;a href="http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/28/jquery-and-mvc-json.aspx" target="_blank"&gt;last post&lt;/a&gt;, I gave a quick introduction to using jQuery and MVC to perform asynchronous requests to the browser. In this post, I will expand on that topic and show how to build a favorite image icon.&lt;/p&gt;  &lt;p&gt;The concept is pretty simple. For example, in the Twitter web UI, an empty star image appears on the right side of a tweet if you mouse over it.If the star is clicked, the icon changes to a flashing dot, and then to a yellow star indicating that the tweet has been favorited. It’s a neat, asynchronous effect, and it’s fairly simple to achieve.&lt;/p&gt;  &lt;p&gt;First, we need three images. Here are the images that Twitter uses:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.platinumbay.com/blogs/postimages/FavoriteImageIconswithjQueryandMVC_F909/icon_throbber.gif"&gt;&lt;img src="http://www.platinumbay.com/blogs/postimages/FavoriteImageIconswithjQueryandMVC_F909/icon_throbber_thumb.gif" title="" style="border:0px none;display:inline;" alt="" width="16" border="0" height="16" /&gt;&lt;/a&gt; &lt;a href="http://www.platinumbay.com/blogs/postimages/FavoriteImageIconswithjQueryandMVC_F909/icon_star_empty.gif"&gt;&lt;img src="http://www.platinumbay.com/blogs/postimages/FavoriteImageIconswithjQueryandMVC_F909/icon_star_empty_thumb.gif" title="" style="border:0px none;display:inline;" alt="" width="16" border="0" height="16" /&gt;&lt;/a&gt; &lt;a href="http://www.platinumbay.com/blogs/postimages/FavoriteImageIconswithjQueryandMVC_F909/icon_star_full.gif"&gt;&lt;img src="http://www.platinumbay.com/blogs/postimages/FavoriteImageIconswithjQueryandMVC_F909/icon_star_full_thumb.gif" title="" style="border:0px none;display:inline;" alt="" width="16" border="0" height="16" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Next, a CSS style is defined for the off, on, and loading states. The purpose of each style is to allow style switching to not only change the picture, but also to allow the state to be determined through the style class assigned.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;.favimgoff&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;.favimgon&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;.imgload&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{ &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;width&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;: &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;16px&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;height&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;: &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;16px&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;border&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;: &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;0px&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;background-repeat&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;: &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;no-repeat&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;}&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;.favimgoff &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{ &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;background-image&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;: &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;url(images/icon_star_empty.gif)&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;; }&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;.favimgon &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{ &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;background-image&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;: &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;url(images/icon_star_full.gif)&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;; }&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;.imgload &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{ &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;background-image&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;: &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;url(images/icon_throbber.gif)&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;; }&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;On the MVC side, an action is needed to handle the server processing.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;public &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;JsonResult &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;SetOrRemoveUserFavorite(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;int &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;favoriteId)&lt;br /&gt;{&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;JsonResult &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;JsonResult&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;();&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:green;"&gt;// do work here, and set SetOn to the proper state&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result.Data = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{ Success = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;true&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, SetOn = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;true &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;};&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;return &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result;&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Next, on the client side, add an image tag with the class attribute and id set. The image is set to a one pixel transparent gif otherwise certain browsers may not render the background image.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;img &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;class&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&amp;quot;favimgoff&amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;src&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;= Url.Content(&amp;quot;~/Content/images/spacer.gif&amp;quot;)&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;id&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&amp;quot;1&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Finally, jQuery on the client side takes care of the tying it all together:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;.favimgoff, .favimgon&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;).click(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;function&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;() {&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;var &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$favimg = $(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;this&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;if &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;($favimg.attr(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;class&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;) != &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;imgload&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;) {&lt;br /&gt;        $favimg.removeClass().addClass(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;imgload&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;br /&gt;        $.getJSON(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;&amp;lt;%= Url.Action(&amp;quot;SetOrRemoveUserFavorite&amp;quot;, &amp;quot;Services&amp;quot;) %&amp;gt;&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, {&lt;br /&gt;            favoriteId: $favimg.attr(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;id&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;)&lt;br /&gt;        }, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;function&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(json) {&lt;br /&gt;            &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;if &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(json.Success) {&lt;br /&gt;                &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;if &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(json.SetOn) {&lt;br /&gt;                    $favimg.removeClass().addClass(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;favimgon&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;br /&gt;                } &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;else &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{&lt;br /&gt;                    $favimg.removeClass().addClass(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;favimgoff&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;else &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{&lt;br /&gt;                alert(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;Favorite could not be set. Please refresh the page and try again.&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;br /&gt;            }&lt;br /&gt;        });&lt;br /&gt;    }&lt;br /&gt;});&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Let’s step through the jQuery script. First, define the click event handler for both classes, and get a reference to the image clicked:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;.favimgoff, .favimgon&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;).click(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;function&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;() {&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;var &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$favimg = $(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;this&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Next, to avoid any duplicate action taken while the process is run, make sure the image isn’t in the loading state. This is necessary because jQuery will still have an event reference to the original image even when the class changes from the original two classes of on or off.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;if &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;($favimg.attr(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;class&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;) != &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;imgload&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;) {&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Next, remove any existing class and add the loading class so the user gets feedback that their action is being processed:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$favimg.removeClass().addClass(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;imgload&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Then, make a server call to the action defined, and pass the id of the item as a parameter to the action:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$.getJSON(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;&amp;lt;%= Url.Action(&amp;quot;SetOrRemoveUserFavorite&amp;quot;, &amp;quot;Services&amp;quot;) %&amp;gt;&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, {&lt;br /&gt;    favoriteId: $favimg.attr(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;id&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;)&lt;br /&gt;}, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;function&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(json) {&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;if &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(json.Success) {&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Finally, based on the &lt;font face="courier new,courier"&gt;SetOn &lt;/font&gt;value returned from the server call, remove the loading class and set the appropriate class:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;if &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(json.SetOn) {&lt;br /&gt;    $favimg.removeClass().addClass(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;favimgon&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;br /&gt;} &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;else &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{&lt;br /&gt;    $favimg.removeClass().addClass(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;favimgoff&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;If by chance the server call fails and &lt;font face="courier new,courier"&gt;Success &lt;/font&gt;is false, alert the user:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;alert(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;Favorite could not be set. Please refresh the page and try again.&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;);&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;That’s it. Utilizing the baked-in goodness of jQuery and ASP.NET MVC, providing a rich, asynchronous user experience doesn’t have to be complex.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=855" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/jQuery/default.aspx">jQuery</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/MVC/default.aspx">MVC</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/JSON/default.aspx">JSON</category></item><item><title>jQuery and MVC: JSON</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/28/jquery-and-mvc-json.aspx</link><pubDate>Fri, 28 Aug 2009 16:09:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:852</guid><dc:creator>Steve</dc:creator><slash:comments>45</slash:comments><description>&lt;p&gt;I strongly dislike synchronous browser requests: the request has to be sent to the server, server action is performed, a server response is received, and the page is re-rendered which usually involves reloading images, style sheets, JavaScript files, etc. It takes time, sends an awful lot of traffic across the wire, and it doesn’t provide for the best user experience. In some scenarios this makes sense, but in most cases I find it to be an annoyance.&lt;/p&gt;  &lt;p&gt;Enter jQuery to the rescue. jQuery is the most exciting innovation to happen to JavaScript since, well, maybe JavaScript itself. One of the jQuery features I enjoy the most is the AJAX functionality which allows jQuery to talk to the server asynchronously, or behind the scenes.&lt;/p&gt;  &lt;p&gt;I personally like to use the JSON (JavaScript Object Notion) format, which is lighter-weight than XML. Using jQuery, a JSON GET request is written as:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$.getJSON(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;[url]&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, { [parameters] }, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;function&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(json) {&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:green;"&gt;// callback function code&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;});&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Let’s say I want to perform an asynchronous search in my web page for people names without having to reload the page. In MVC, I need an action to handle the request:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;public class &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;SearchController &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;: &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Controller&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;[] peopleNames = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;[] { &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Bob&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Steve&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Joe&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Frank&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Lou&amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;};&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;public &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;JsonResult &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Search(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;q)&lt;br /&gt;    {&lt;br /&gt;        &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;var &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;results = peopleNames.Where(n =&amp;gt; n.Contains(q));&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;if &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(results.Count() &amp;gt; 0)&lt;br /&gt;            &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;return new &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;JsonResult&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt; { Data = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{ Success = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;true&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, Results = results } };&lt;br /&gt;        &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;else&lt;br /&gt;            return new &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;JsonResult&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt; { Data = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{ Success = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;false &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;} };&lt;br /&gt;    }&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;font face="Courier New"&gt;&lt;/font&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;The first thing to notice is the built-in &lt;font face="courier new,courier"&gt;JsonResult &lt;/font&gt;type on the Search action. MVC understands and is able to handle JSON data. Simply return a &lt;font face="courier new,courier"&gt;JsonResult &lt;/font&gt;object and populate the &lt;font face="courier new,courier"&gt;Data &lt;/font&gt;property with the data to be returned. The serialization of that data is handled under the covers.&lt;/p&gt;

&lt;p&gt;Back in the MVC View, call &lt;font face="courier new,courier"&gt;getJSON &lt;/font&gt;to make a request to the action and handle the response:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;$.getJSON(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;&amp;lt;%= Url.Action(&amp;quot;Search&amp;quot;, &amp;quot;Search&amp;quot;) %&amp;gt;&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, { q: $(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;#39;input#search&amp;#39;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;) }, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;function&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(json) {&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;if &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(json.Success) {&lt;br /&gt;        &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:green;"&gt;// results found&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;}&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;else &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{&lt;br /&gt;        &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:green;"&gt;// nothing found&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;}&lt;br /&gt;});&lt;/span&gt;&lt;/pre&gt;
Note that &lt;font face="courier new,courier"&gt;Url.Action&lt;/font&gt; is used to get the virtual url. &lt;font face="courier new,courier"&gt;Url.Action&lt;/font&gt; and &lt;font face="courier new,courier"&gt;Url.Content&lt;/font&gt; are great ways to handle relative paths. Next, the search query is passed from an input field with an ID of search. And finally, the callback is handled. jQuery handles the deserialization under the covers, and the values can be handled as simple properties.

&lt;p&gt;The introduction of ASP.NET MVC and jQuery make asynchronous calls very quick and easy, and help to provide the end user with a better experience. In future posts, we’ll look at more specific examples of utilizing jQuery and MVC to provide a better user experience.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=852" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/jQuery/default.aspx">jQuery</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/MVC/default.aspx">MVC</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/JSON/default.aspx">JSON</category></item><item><title>Reflection-Based Performance Analysis</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/28/reflection-based-performance-analysis.aspx</link><pubDate>Fri, 28 Aug 2009 01:51:04 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:847</guid><dc:creator>Steve</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;Back in 2007, I took some SharePoint training from Todd Bleaker (MVP, owner of MindSharp, and SharePoint guru). At one point he posed a question about the performance of the following methods:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;OptionOne()
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;str = &lt;/span&gt;&lt;span style="background:#fefefe;color:#a31515;"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;;
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;return &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;str;
}

&lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;OptionTwo()
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;str;
    str = &lt;/span&gt;&lt;span style="background:#fefefe;color:#a31515;"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;;
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;return &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;str;
}

&lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;OptionThree()
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;str = &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;null&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;;
    str = &lt;/span&gt;&lt;span style="background:#fefefe;color:#a31515;"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;;
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;return &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;str;
}

&lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;OptionFour()
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;return &lt;/span&gt;&lt;span style="background:#fefefe;color:#a31515;"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;;
}&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;I took the challenge and wrote the above methods. Then to evaluate the probable performance I compiled the code and opened the resulting assembly in Reflector. Here is the Reflector output:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;OptionOne()
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;return &lt;/span&gt;&lt;span style="background:#fefefe;color:#a31515;"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;;
}

&lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;OptionTwo()
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;return &lt;/span&gt;&lt;span style="background:#fefefe;color:#a31515;"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;;
}

&lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;OptionThree()
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;return &lt;/span&gt;&lt;span style="background:#fefefe;color:#a31515;"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;;
}

&lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public string &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;OptionFour()
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;return &lt;/span&gt;&lt;span style="background:#fefefe;color:#a31515;"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;;
}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;You may notice that all the methods appear the same. What happened? Compiler optimization? To find out I checked the IL, shown below:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background:#fefefe;"&gt;.method public hidebysig instance string OptionOne() cil managed
{
    .maxstack 1
    .locals init (
        [0] string str,
        [1] string CS$1$0000)
    L_0000: nop 
    L_0001: ldstr &amp;quot;Hello World&amp;quot;
    L_0006: stloc.0 
    L_0007: ldloc.0 
    L_0008: stloc.1 
    L_0009: br.s L_000b
    L_000b: ldloc.1 
    L_000c: ret 
}

.method public hidebysig instance string OptionTwo() cil managed
{
    .maxstack 1
    .locals init (
        [0] string str,
        [1] string CS$1$0000)
    L_0000: nop 
    L_0001: ldstr &amp;quot;Hello World&amp;quot;
    L_0006: stloc.0 
    L_0007: ldloc.0 
    L_0008: stloc.1 
    L_0009: br.s L_000b
    L_000b: ldloc.1 
    L_000c: ret 
}

.method public hidebysig instance string OptionThree() cil managed
{
    .maxstack 1
    .locals init (
        [0] string str,
        [1] string CS$1$0000)
    L_0000: nop 
    L_0001: ldnull 
    L_0002: stloc.0 
    L_0003: ldstr &amp;quot;Hello World&amp;quot;
    L_0008: stloc.0 
    L_0009: ldloc.0 
    L_000a: stloc.1 
    L_000b: br.s L_000d
    L_000d: ldloc.1 
    L_000e: ret 
}

.method public hidebysig instance string OptionFour() cil managed
{
    .maxstack 1
    .locals init (
        [0] string CS$1$0000)
    L_0000: nop 
    L_0001: ldstr &amp;quot;Hello World&amp;quot;
    L_0006: stloc.0 
    L_0007: br.s L_0009
    L_0009: ldloc.0 
    L_000a: ret 
}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;What is really happening is that Reflector is making a best guess optimization as to what the original code looked like. We can clearly see in the IL that OptionFour is probably the most performant, and OptionThree is probably the least. This is because OptionThree is loading a null and storing it in local 1, then loading the string and storing it in the same location, making the first load unnecessary.&lt;/p&gt;

&lt;p&gt;Reflector can be a great tool to use for analyzing possible performance, as well as debugging assemblies. If you don’t have it, download it today: &lt;a href="http://www.red-gate.com/products/reflector/"&gt;www.red-gate.com/products/reflector/&lt;/a&gt;&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=847" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Reflector/default.aspx">Reflector</category></item><item><title>Running T4 Templates with MSBuild</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/28/running-t4-templates-with-msbuild.aspx</link><pubDate>Fri, 28 Aug 2009 00:55:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:846</guid><dc:creator>Steve</dc:creator><slash:comments>24</slash:comments><description>&lt;p&gt;If you haven’t explored T4 yet, you’re missing one of Visual Studio’s best, and best kept, secrets. T4, which stands for Text Templating Transformation Toolkit, is code generation built right into Visual Studio 2008. It is also available in Visual Studio 2005 if you install the Visual Studio SDK. It is a great feature that I use quite frequently to automate repetitive tasks.&lt;/p&gt;  &lt;p&gt;T4 template execution only occurs though when the template file is open in the editor and saved. In other words, template execution does not occur when you type &lt;font face="courier new,courier"&gt;Ctrl+B&lt;/font&gt; to build the project. There are scenarios however where execution of the templates at every build is the desired behavior.&lt;/p&gt;  &lt;p&gt;I did find several custom MSBuild tasks to perform this behavior, but I wanted to avoid additional assembly references. Instead, the following custom MSBuild target was created to address this.&lt;/p&gt;  &lt;p&gt;First and foremost, a .targets file is created in the MSBuild directory (%systemdrive%:\Windows\Microsoft.NET\Framework\v3.5):&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;xml &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;version&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;1.0&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;encoding&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;utf-8&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;?&amp;gt;&lt;br /&gt;&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Project &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;xmlns&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;http://schemas.microsoft.com/developer/msbuild/2003&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&amp;gt;&lt;br /&gt;    &amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Target &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;Name&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;ExecuteT4Templates&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&amp;gt;&lt;br /&gt;        &amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;ItemGroup&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&amp;gt;&lt;br /&gt;            &amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;T4Templates &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;Include&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;.\**\*.tt&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;/&amp;gt;&lt;br /&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;ItemGroup&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;        &amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Exec&lt;br /&gt;            &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;WorkingDirectory&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;C:\Program Files\Common Files\microsoft shared\TextTemplating\1.2\&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;br /&gt;            &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;Command&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;TextTransform &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;&amp;amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;%(T4Templates.FullPath)&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;&amp;amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;/&amp;gt;&lt;br /&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Target&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&amp;gt;&lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Project&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;There are a couple important things to note. First, a custom target is created, and an item group is added to the target. In the item group, we create a new item called T4Templates that will recurse the project and hold information for each text template that is found. Finally, an execute task is added which calls &lt;font face="courier new,courier"&gt;TextTransform.exe&lt;/font&gt; for each file found.&lt;/p&gt;

&lt;p&gt;Once the targets file is create, the project file is edited to import the new targets file using &lt;font face="courier new,courier"&gt;Import&lt;/font&gt;. I put it above the first &lt;font face="courier new,courier"&gt;PropertyGroup&lt;/font&gt; node so it’s visible when future maintenance is performed, but it can be placed anywhere within the root &lt;font face="courier new,courier"&gt;Project&lt;/font&gt; node:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Import &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;Project&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;$(MSBuildToolsPath)\T4Execution.targets&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Finally, the &lt;font face="courier new,courier"&gt;DefaultTargets&lt;/font&gt; attribute in the Project node is modified to include the ExecuteT4Templates target: Note: This change is required for any project where this behavior is desired.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:red;"&gt;DefaultTargets&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;=&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;ExecuteT4Templates;Build&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;&lt;/span&gt;&lt;/pre&gt;
Now whenever the project is built (&lt;font face="courier new,courier"&gt;Ctrl+B&lt;/font&gt;), template execution occurs. To be fair, there are several issues with the above approach, including:

&lt;ul&gt;
  &lt;li&gt;Template execution does not occur when Debug (&lt;font face="courier new,courier"&gt;F5&lt;/font&gt;) is triggered unless a project file or property has changed.&lt;/li&gt;

  &lt;li&gt;There is no built-in way to get the number of items in an &lt;font face="courier new,courier"&gt;ItemGroup&lt;/font&gt; to use conditional execution.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;How important is this functionality in your projects? How would you do it differently?&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=846" width="1" height="1"&gt;</description><enclosure url="http://www.platinumbay.com/blogs/dotneticated/attachment/846.ashx" length="3958" type="application/x-zip-compressed" /><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Visual+Studio+SDK/default.aspx">Visual Studio SDK</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/MSBuild/default.aspx">MSBuild</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Visual+Studio+2008/default.aspx">Visual Studio 2008</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/T4/default.aspx">T4</category></item><item><title>Pop Quiz: .NET Integers, Unit Testing, and Boundary Checking</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/26/pop-quiz-net-integers-unit-testing-and-boundary-checking.aspx</link><pubDate>Wed, 26 Aug 2009 17:10:40 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:838</guid><dc:creator>Steve</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;I ask this question in a bunch of my talks, mostly because most folks aren’t aware of this. What is the bug in the following method?&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public int &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;Add(&lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;num1, &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;num2)
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;return &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;num1 + num2;
}&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Do you see it? In a simple unit test, the method appears to work as expected:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background:#fefefe;"&gt;[&lt;/span&gt;&lt;span style="background:#fefefe;color:#2b91af;"&gt;TestMethod&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;()]
&lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public void &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;AddTest()
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:#2b91af;"&gt;MathHelper &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;target = &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;new &lt;/span&gt;&lt;span style="background:#fefefe;color:#2b91af;"&gt;MathHelper&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;();
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;num1 = 16;
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;num2 = 16;
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;expected = 32;
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;actual = target.Add(num1, num2);
    &lt;/span&gt;&lt;span style="background:#fefefe;color:#2b91af;"&gt;Assert&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;.AreEqual(expected, actual);&lt;/span&gt;&lt;span style="background:#fefefe;"&gt; &lt;/span&gt;&lt;span style="background:#fefefe;color:green;"&gt;// PASS&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;
}&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;However, what if we pass in a different set of parameters, say int.MaxValue?&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="background:#fefefe;"&gt;[&lt;/span&gt;&lt;span style="background:#fefefe;color:#2b91af;"&gt;TestMethod&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;()]
&lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;public void &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;AddMaxTest()
{
    &lt;/span&gt;&lt;span style="background:#fefefe;color:#2b91af;"&gt;MathHelper &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;target = &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;new &lt;/span&gt;&lt;span style="background:#fefefe;color:#2b91af;"&gt;MathHelper&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;();
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;num1 = &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;.MaxValue;
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;num2 = &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;.MaxValue;
    &lt;/span&gt;&lt;span style="background:#fefefe;color:blue;"&gt;int &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;result = target.Add(num1, num2);

    &lt;/span&gt;&lt;span style="background:#fefefe;color:#2b91af;"&gt;Assert&lt;/span&gt;&lt;span style="background:#fefefe;"&gt;.Fail(&lt;/span&gt;&lt;span style="background:#fefefe;color:#a31515;"&gt;&amp;quot;Expected an overflow exception. Received: &amp;quot; &lt;/span&gt;&lt;span style="background:#fefefe;"&gt;+ result);
}&lt;/span&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Any guesses on the outcome of this test? In actuality, no exception is thrown. The test fails with the output: “Assert.Fail failed. Expected an overflow exception. Received: -2”. The output from the fail assert is “-2”. What!? Is it a bug in the .NET framework? What’s going on?&lt;/p&gt;

&lt;p&gt;The answer lies in that I am passing in a signed int. In a signed int, the top bit is flag bit indicating positive or negative, leaving the other 31 bits to indicate the numeric value. When doing binary math that overflows the 31 bits, the 32nd bit is switched as though it is unsigned. In this case a positive becomes a negative and the result becomes –2. Let’s hope the system isn’t trying to deposit $100 into an account with $2,147,483,647.&lt;/p&gt;

&lt;p&gt;But what does this mean to the original method? How do we handle this scenario? The point of this experiment isn’t to demonstrate a potential issue with the .NET framework. Rather, I’d like you to take notice of the first unit test. The test does evaluate the method for proper functioning, 100% code coverage would be achieved on the Add method, and yet the issue at hand is not found. And to this I would like to make an important point:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Code Coverage is a misleading metric.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In order to properly test your code, it is important to not only make sure you test as much as possible, but to ensure you also perform boundary checking. If the max values weren’t tested, it might not have been found that the code could erase $2,147,483,749 from some pour soul’s bank account. Well, he’d be poor after the fact. Are here is my second point:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Boundary check everything.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To help solve this problem, there is a neat tool from Microsoft Research called Pex. From the Pex website:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Right from the Visual Studio code editor, &lt;strong&gt;Pex&lt;/strong&gt; finds interesting input-output values of your methods, which you can save as a small test suite with high code coverage. Pex performs a systematic analysis, hunting for boundary conditions, exceptions and assertion failures, which you can debug right away. Pex enables Parameterized Unit Testing, an extension of Unit Testing that reduces test maintenance costs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What I would really love to see someday is a combination of existing code coverage in Visual Studio Team System with parameter boundary checking in Pex to give a truer sense of test coverage. Maybe for Dev11?&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=838" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/.NET/default.aspx">.NET</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Testing/default.aspx">Testing</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Unit+Tests/default.aspx">Unit Tests</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/PEX/default.aspx">PEX</category></item><item><title>LINQ: Porting jQuery’s Each</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/26/linq-porting-jquery-s-each.aspx</link><pubDate>Wed, 26 Aug 2009 16:26:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:837</guid><dc:creator>Steve</dc:creator><slash:comments>8</slash:comments><description>&lt;p&gt;As some astute readers pointed out, this functionality does in fact exist in LINQ. The name isn’t terribly obvious however: Aggregate. I was able to update the original tests to use the Aggregate method. The main difference is that a non-generic IEnumerable does not contain this functionality. For that type I had to use:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;.OfType&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;gt;()&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;The updated test methods are here:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;IEnumerable&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;gt; collection = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;[] { &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;World&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;!&amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;};&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result = collection.Aggregate((str1, str2) =&amp;gt; (str1 + &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot; &amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;+ str2).Trim());&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;IEnumerable&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;int&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;gt; collection = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;[] { 1, 2, 3, 4, 5 };&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;int &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result = collection.Aggregate((num1, num2) =&amp;gt; num1 + num2);&lt;/span&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;IEnumerable &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;collection = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;[] { &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;World&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;!&amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;};&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result = collection.OfType&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;gt;().Aggregate((&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;str1, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;str2) =&amp;gt; (str1 + &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot; &amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;+ str2).Trim());&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;var &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;collection = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;List&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;gt; { &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;World&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;!&amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;};&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result = collection.Aggregate((str1, str2) =&amp;gt; (str1 + &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot; &amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;+ str2).Trim());&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;I love learning new stuff, thanks to Steve Gilham and Jordan Terrell for their comments below.&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;p&gt;&lt;strike&gt;I really like the Each function in jQuery, and I find myself wanting to use it in LINQ. Since it doesn’t exist I decided to write one. Here goes:&lt;/strike&gt;&lt;/p&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;pre class="code"&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;&lt;strike&gt;using &lt;/strike&gt;&lt;/span&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;System;&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;using &lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;System.Linq;&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;using &lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;System.Collections;&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;using &lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;System.Collections.Generic;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;public static class &lt;/span&gt;&lt;/strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&lt;strike&gt;ExtensionMethods&lt;br /&gt;&lt;/strike&gt;&lt;/span&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;{&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;public static &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;TType Each&amp;lt;TType&amp;gt;(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;this &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;IEnumerable&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;TType&amp;gt; collection, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Func&lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;TType, TType, TType&amp;gt; func)&lt;br /&gt;    {&lt;br /&gt;        &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;var &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;default&lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(TType);&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;foreach &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;var &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;queryable &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;in &lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;collection)&lt;br /&gt;            result = func(result, queryable);&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;return &lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;public static &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;TType Each&amp;lt;TType&amp;gt;(&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;this &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;IEnumerable &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;collection, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;Func&lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;TType, TType, TType&amp;gt; func)&lt;br /&gt;    {&lt;br /&gt;        &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;return &lt;/span&gt;&lt;/strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&lt;strike&gt;collection.OfType&amp;lt;TType&amp;gt;().Each(func);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/strike&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;strike&gt;You can then call these extension methods using any IEnumerable type, such as List, Collection, etc. I’m utilizing lambdas to define inline methods, though a delegate to an existing method could be passed in as well.&lt;/strike&gt;&lt;/p&gt;

&lt;pre class="code"&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;IEnumerable&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;gt; collection = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;[] { &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;World&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;!&amp;quot; &lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;};&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result = collection.Each((str1, str2) =&amp;gt; (str1 + &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot; &amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;+ str2).Trim());&lt;/span&gt;&lt;/strike&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;pre class="code"&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;IEnumerable&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;int&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;gt; collection = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new&lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;[] { 1, 2, 3, 4, 5 };&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;int &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result = collection.Each((num1, num2) =&amp;gt; num1 + num2);&lt;/span&gt;&lt;/strike&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;pre class="code"&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;IEnumerable &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;collection = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;[] { &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;World&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;!&amp;quot; &lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;};&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result = collection.Each((&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;str1, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;str2) =&amp;gt; (str1 + &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot; &amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;+ str2).Trim());&lt;/span&gt;&lt;/strike&gt;&lt;/pre&gt;

&lt;pre class="code"&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;var &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;collection = &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;new &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;List&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;gt; { &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;Hello&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;World&amp;quot;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;, &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot;!&amp;quot; &lt;/span&gt;&lt;/strike&gt;&lt;strike&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;};&lt;br /&gt;&lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:blue;"&gt;string &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;result = collection.Each((str1, str2) =&amp;gt; (str1 + &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;&amp;quot; &amp;quot; &lt;/span&gt;&lt;span style="-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;"&gt;+ str2).Trim());&lt;/span&gt;&lt;/strike&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;&lt;strike&gt;What do you think? Would you do it differently?&lt;/strike&gt;&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=837" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/jQuery/default.aspx">jQuery</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/LINQ/default.aspx">LINQ</category></item><item><title>Static Page Checking in ASP.NET MVC</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/08/21/static-page-checking-in-asp-net-mvc.aspx</link><pubDate>Fri, 21 Aug 2009 11:35:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:828</guid><dc:creator>Steve</dc:creator><slash:comments>47</slash:comments><description>&lt;p&gt;If you have built an ASP.NET web forms site of any substance, you have undoubtedly been bitten when code in the web form becomes outdated due to code change. It’s easy to see when the page is open in Visual Studio, as the code has red squiggles and the error shows up in the Error List tool window. As soon as the page is closed however, that error disappears. Even running a build will be successful. For some of my sites, which have over 150 pages, this can be very annoying to say the least.&lt;/p&gt;
  
&lt;p&gt;ASP.NET MVC has a neat hidden feature to solve this problem. The MVC team was most likely were stung by the same issue more than once. This feature is static page checking during compilation. Unfortunately, instead of being an option in the Properties window for the project (future release idea?), it is in the *.*proj xml file itself. To enable this feature:&lt;/p&gt;
  
&lt;ol&gt;   
&lt;li&gt;Right-click on the Project node in the Solution Explorer tool window&lt;/li&gt;
    
&lt;li&gt;Choose “Unload Project” - Note: If your project is under version control, you will be prompted to do a check-in. Simply click “Continue” to ignore the check-in request.&lt;/li&gt;
    
&lt;li&gt;Right-click the Project node again&lt;/li&gt;
    
&lt;li&gt;Choose “Edit *.*proj&amp;quot;, and the project file will now open in Visual Studio with color coding and IntelliSense&lt;/li&gt;
    
&lt;li&gt;In the first &lt;font face="courier new,courier"&gt;PropertyGroup &lt;/font&gt;node, there is a new node named &lt;font face="courier new,courier"&gt;MvcBuildViews&lt;/font&gt;&lt;/li&gt;
    
&lt;li&gt;By default this is set to &lt;font face="courier new,courier"&gt;false&lt;/font&gt;. Simply change the value to &lt;font face="courier new,courier"&gt;true&lt;/font&gt;&lt;/li&gt;
    
&lt;li&gt;Right-click the Project node and choose “Reload Project”&lt;/li&gt;
    
&lt;li&gt;If prompted that the file is already open, click yes to close the xml view.&lt;/li&gt;
    
&lt;li&gt;Build your project&lt;/li&gt;
 &lt;/ol&gt;
  
&lt;p&gt;You will notice that builds take longer than they did prior to this change. This is because under the covers, MSBuild is now making an additional call to aspnet_compiler in the AfterBuild MSBuild target:&lt;/p&gt;
  
&lt;p&gt;&lt;font face="courier new,courier"&gt;C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe -v temp -p &amp;quot;[physical path]&amp;quot;&lt;/font&gt;&lt;/p&gt;
  
&lt;p&gt;To avoid this delay in day-to-day development, you may choose to copy the &lt;font face="courier new,courier"&gt;MvcBuildViews &lt;/font&gt;node into the build-specific &lt;font face="courier new,courier"&gt;PropertyGroup &lt;/font&gt;nodes, and set it to &lt;font face="courier new,courier"&gt;false&lt;/font&gt; for Debug and &lt;font face="courier new,courier"&gt;true &lt;/font&gt;for Release.&lt;/p&gt;&lt;p&gt;Update: &lt;a href="http://twitter.com/jglozano" target="_blank"&gt;@jglozano&lt;/a&gt; points out that this only works with the default WebForms View Engine.&lt;br /&gt;&lt;/p&gt;
  
&lt;p&gt;Hope this helps&lt;/p&gt;
&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=828" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/MVC/default.aspx">MVC</category></item><item><title>Community Radio Episode Two</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/06/19/community-radio-episode-two.aspx</link><pubDate>Fri, 19 Jun 2009 01:38:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:808</guid><dc:creator>Steve</dc:creator><slash:comments>5</slash:comments><description>&lt;p&gt;I’m proud to announce that episode two of Community Radio has been published to &lt;a href="http://live.ineta.org/audio"&gt;http://live.ineta.org/audio&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this episode, Steve talks with Heather Kostes, Emily Freet, and Nicole Moser about their roles at Microsoft, the MVP program, MVP benefits, becoming an MVP, karaoke, and more. Narrated by &lt;a href="http://twitter.com/JohnBlumenauer" target="_blank"&gt;John Blumenauer&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;As always, your feedback is greatly appreciated.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=808" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/MVP/default.aspx">MVP</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Community+Radio/default.aspx">Community Radio</category><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/INETA+Live/default.aspx">INETA Live</category></item><item><title>European Union Says No to Free Dessert</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/06/14/europe-says-no-to-free-dessert.aspx</link><pubDate>Sun, 14 Jun 2009 15:42:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:799</guid><dc:creator>Steve</dc:creator><slash:comments>3</slash:comments><description>&lt;p&gt;As reported all over the web this week, Microsoft has decided to ship Windows 7 in Europe without Internet Explorer. For a long time, the EU has been complaining that Microsoft has been using their dominant position to hawk IE on unsuspecting computer users.&lt;/p&gt;  &lt;p&gt;Horseradish!&lt;/p&gt;  &lt;p&gt;Let’s bring this discussion back across the pond for a second, and look at new home construction. The Department of Justice had a quarrel with Microsoft awhile back over a similar matter. Of course, if they were really going after monopolies they would go after the micro-monopolies of new home builders for charging egregious fees for options. Take for instance the elegant and simple recessed light. The last time I bought a new house the builder wanted $125 for every single one I added. A quick trip to Home Depot confirmed that the hardware costs less than $10, and wiring was equally inexpensive. I wanted to put their lights out.&lt;/p&gt;  &lt;p&gt;And what about the auto industry that forces you to choose from their tires, or their radios, or their floormats. Shouldn’t they be spanked? And what about government in general? Shouldn’t I be able to choose a DMV that offers better service if I want to? I think my four year old nephew could do that, and I’d gladly pay him instead.&lt;/p&gt;  &lt;p&gt;But let’s take a step back for a second and remember that there is a major difference between these comparisons and Internet Explorer. Internet Explorer is free. Free as in no charge. Free as in ‘No sir, you can keep your money’. You buy the operating system, and you get a free browser. Restaurants do the same thing; buy a meal, get a free dessert. Is the European Union really that uptight to complain about getting their dessert for free? And a dessert that can easily be replaced by downloading another browser? Maybe they don&amp;#39;t like free things and will soon consider an air tax.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=799" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Personal+_1320_+Off+Topic/default.aspx">Personal – Off Topic</category></item><item><title>Community Radio Episode One</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/06/12/community-radio-episode-one.aspx</link><pubDate>Thu, 11 Jun 2009 23:45:13 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:793</guid><dc:creator>Steve</dc:creator><slash:comments>4</slash:comments><description>&lt;p&gt;I’m proud to announce that the inaugural episode of Community Radio has been published: &lt;a href="http://live.ineta.org/audio"&gt;http://live.ineta.org/audio&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In this inaugural episode, I talk with Richard, Carl and Sara about Speaker Idol, speaking at Tech-Ed, podcasting, .NET Rocks, Richard and Carl&amp;#39;s back stories, and more. Narrated by &lt;a href="http://twitter.com/csharpfritz"&gt;Jeff Fritz&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;As always, your feedback is greatly appreciated.&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=793" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Community+Radio/default.aspx">Community Radio</category></item><item><title>Results – Community Radio Narration Contest</title><link>http://www.platinumbay.com/blogs/dotneticated/archive/2009/06/10/results-community-radio-narration-contest.aspx</link><pubDate>Wed, 10 Jun 2009 17:01:00 GMT</pubDate><guid isPermaLink="false">643c9627-9341-4fbb-b075-f2ccb6a51baa:789</guid><dc:creator>Steve</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;The &lt;a href="http://www.platinumbay.com/blogs/dotneticated/archive/2009/05/24/community-radio-narration-contest.aspx" target="_blank"&gt;contest&lt;/a&gt; deadline has come and gone, and I received four submissions. After reviewing the submission I have determined that they were all great, so whoever sends me $500 first… just kidding. I’ve decided that the only satisfactory course of action is to use them all on a rotational basis. In fact, I’ve decided to use community contributions exclusively going forward because, well, this is your radio! The first four, in no particular (though apparently alphabetical) order, are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://twitter.com/csharpfritz" target="_blank"&gt;Jeff Fritz&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://twitter.com/JohnBlumenauer" target="_blank"&gt;John Blumenauer&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://twitter.com/fallenrogue" target="_blank"&gt;Leon Gersing&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Michael Diiorio&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Would you like to introduce an episode of Community Radio? Record yourself in high-quality MP3 or WAV format speaking the following phrases. I look forward to your submissions!&lt;/p&gt;  &lt;h4&gt;Intro:&lt;/h4&gt;  &lt;p&gt;&amp;quot;[Hey, Hi, Howdy, Hey Y’all, etc.], this is [your name] welcoming you to Community Radio: connecting the developer community everywhere. Community Radio is powered by INETA Live and hosted by Steve Andrews: Microsoft MVP for Visual Studio Team System, Director of Technology for INETA North America, and all-around Community Fanatic. And now… to the communitymobile! Enjoy the show!&amp;quot;&lt;/p&gt;  &lt;p&gt;&lt;i&gt;Note: In the second to last sentence, it&amp;#39;s communitymobile, as in &amp;quot;To the Batmobile.&amp;quot;&lt;/i&gt;&lt;/p&gt;  &lt;h4&gt;Outro:&lt;/h4&gt;  &lt;p&gt;&amp;quot;Thanks for listening to Community Radio: powered by INETA Live, and hosted by Steve Andrews. If you enjoyed this episode, pass us along to your friends and colleagues and check out our podcast archives at live.ineta.org. I’m [your name], join us next time for another edition of... Community Radio.&amp;quot;&lt;/p&gt;&lt;img src="http://www.platinumbay.com/aggbug.aspx?PostID=789" width="1" height="1"&gt;</description><category domain="http://www.platinumbay.com/blogs/dotneticated/archive/tags/Community+Radio/default.aspx">Community Radio</category></item></channel></rss>