<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Infovark Underground &#187; .NET</title>
	<atom:link href="http://underground.infovark.com/category/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://underground.infovark.com</link>
	<description>The Infovark technology blog</description>
	<lastBuildDate>Thu, 12 May 2011 16:32:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Review: Brownfield Application Development in .NET</title>
		<link>http://underground.infovark.com/2011/04/04/review-brownfield-application-development-in-net/</link>
		<comments>http://underground.infovark.com/2011/04/04/review-brownfield-application-development-in-net/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 01:58:36 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Books]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[Review]]></category>

		<guid isPermaLink="false">http://underground.infovark.com/?p=802</guid>
		<description><![CDATA[If you're inheriting an old .NET application and don't know quite where to begin, Brownfield Application Development in .NET is an excellent guide to tools and practices that can help get you started. 


Related posts:<ol><li><a href='http://underground.infovark.com/2009/05/11/review-framework-design-guidelines/' rel='bookmark' title='Review: Framework Design Guidelines'>Review: Framework Design Guidelines</a></li>
<li><a href='http://underground.infovark.com/2008/11/07/review-working-effectively-with-legacy-code/' rel='bookmark' title='Review: Working Effectively with Legacy Code'>Review: Working Effectively with Legacy Code</a></li>
<li><a href='http://underground.infovark.com/2008/11/05/review-the-pragmatic-programmer/' rel='bookmark' title='Review: The Pragmatic Programmer'>Review: The Pragmatic Programmer</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I purchased my copy of <a href="http://www.amazon.com/Brownfield-Application-Development-Donald-Belcham/dp/1933988711%3FSubscriptionId%3DAKIAIU3RPTD7NQ47YK4A%26tag%3Dinfovark-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1933988711">Brownfield Application Development in .Net</a> almost as soon as it hit the shelves. I&#8217;ve been reading Kyle Baley&#8217;s entertaining posts about software development on <a href="http://codebetter.com">CodeBetter.com</a> for several years, so I thought I&#8217;d get his and co-author Donald Belcham&#8217;s consolidated development advice in a handy paperback form.</p>
<div class="wp-caption alignleft" style="width: 137px"><a href="http://www.amazon.com/Brownfield-Application-Development-Donald-Belcham/dp/1933988711%3FSubscriptionId%3DAKIAIU3RPTD7NQ47YK4A%26tag%3Dinfovark-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D1933988711"><img src="http://ecx.images-amazon.com/images/I/51nKKDUX4uL._SL160_.jpg" alt="Brownfield Application Development in .NET" /></a><p class="wp-caption-text">Brownfield Application Development in .NET</p></div>
<p>I was surprised to read that <a href="http://codebetter.com/kylebaley/2011/04/01/brownfield-application-development-one-year-later/"><em>Brownfield</em> has been out for a full year now</a>, and figured it was high time to post my review of it. (I&#8217;d been meaning to post a review of the book for several months, but it&#8217;s been on loan to several different people. I didn&#8217;t get it back into my possession until a few weeks ago, which should tell you something about its quality right away.)</p>
<p><em>Brownfield</em> is about the tools and techniques required to get an existing .NET application under control. Sadly, most of us developers have encountered development projects that were rushed, cobbled together, barely functional messes. This book is about reworking the application and its surrounding environment so that development work can continue on a sustainable footing.</p>
<p>The book is divided into two parts: the ecosystem and the code. The ecosystem describes all the necessary components to support modern software development:</p>
<ul>
<li>Source control</li>
<li>Continuous integration</li>
<li>Automated testing</li>
<li>Code analysis and metrics</li>
<li>Defect tracking</li>
</ul>
<p>This was the most valuable part of the book. You&#8217;ll see these topics covered elsewhere, but they&#8217;re often scattered across vendor sites, developer forms, and programmer blogs. Having all these best practices gathered in one place is worth the price of the book alone. It makes a great checklist to use to evaluate the status of your current development projects as well as any future work you undertake. </p>
<p>I&#8217;ve also found it helpful to get Java developers or development teams up to speed on the .NET suite of tools and practices. It&#8217;s saved me a lot of time translating the &#8220;we used to do it like this in Java&#8230;&#8221; conversations into their .NET equivalents.</p>
<p>The second part of the book concerns coding practices that can help sort out a legacy codebase. I found this much less useful than the first section. While <em>Brownfield</em> provides a useful summary, much of this is material that is covered in depth elsewhere. The whirlwind tour of coding practices includes:</p>
<ul>
<li>OO principles</li>
<li>Layers and tiers</li>
<li>Taming dependencies</li>
<li>User interface patterns</li>
<li>Data access patterns</li>
<li>Managing external dependencies</li>
<li>Keeping up momentum</li>
</ul>
<p>The final chapter in the list is the only one that touches on the project management aspects of getting an unruly development effort under control. Though it too is a topic that has been covered elsewhere, I was very glad to see that it was included in the book. I&#8217;ve found that a slapdash approach to application development reflects as much upon poor management practices as it does on a lack of programmer skills &#8212; if not more. </p>
<h4>In conclusion</h4>
<p>If you&#8217;re inheriting an old .NET application and don&#8217;t know quite where to begin, Brownfield Application Development in .NET is an excellent guide to tools and practices that can help get you started. </p>


<p>Related posts:<ol><li><a href='http://underground.infovark.com/2009/05/11/review-framework-design-guidelines/' rel='bookmark' title='Review: Framework Design Guidelines'>Review: Framework Design Guidelines</a></li>
<li><a href='http://underground.infovark.com/2008/11/07/review-working-effectively-with-legacy-code/' rel='bookmark' title='Review: Working Effectively with Legacy Code'>Review: Working Effectively with Legacy Code</a></li>
<li><a href='http://underground.infovark.com/2008/11/05/review-the-pragmatic-programmer/' rel='bookmark' title='Review: The Pragmatic Programmer'>Review: The Pragmatic Programmer</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://underground.infovark.com/2011/04/04/review-brownfield-application-development-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Modal Dialogs with a Splash Screen in WPF</title>
		<link>http://underground.infovark.com/2011/03/23/using-modal-dialogs-with-a-splash-screen-in-wpf/</link>
		<comments>http://underground.infovark.com/2011/03/23/using-modal-dialogs-with-a-splash-screen-in-wpf/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 01:17:45 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[modal dialog]]></category>
		<category><![CDATA[splash screen]]></category>

		<guid isPermaLink="false">http://underground.infovark.com/?p=792</guid>
		<description><![CDATA[Due to a snag in the way that Visual Studio implements its WPF Splash Screen feature, you can't use modal dialogs before your main window appears. Here are a few workarounds.


<i>No related posts.</i>]]></description>
			<content:encoded><![CDATA[<p>We ran into a strange problem while our Infovark application was starting up. If we displayed a modal dialog prior to our main window, it would appear briefly on the screen, then vanish. The user wouldn&#8217;t have any time to click any buttons, much less actually <em>read</em> the message on the dialog.</p>
<p>We&#8217;d been using modal dialogs in our startup routine for several purposes. We&#8217;d display an error message if certain application prerequisites hadn&#8217;t been met. We might inform the user that the system was performing an upgrade. Or, most important, we might show our trial/evaluation dialog. This last message tells the user how many days were remaining in the evaluation period, and provides a way for the user to visit our website and buy a copy. (Critical functionality for us!)</p>
<p>All of these messages had been working properly in our integration tests. And then one day they stopped working.</p>
<h4>Splish splash</h4>
<p>After looking through our check-in logs and hunting around online, we discovered that the problem had to do with the WPF Splash Screen mechanism. We&#8217;d followed the instructions in <a href="http://msdn.microsoft.com/en-us/library/cc656886.aspx">How To Add a Splash Screen to a WPF Application</a> and added a static image to our project to display to the user while the application was loading.</p>
<p>But apparently, this has a nasty side effect of clobbering any modal dialogs that you show before your first non-modal window. A few other folks have noted the same problem. It&#8217;s been submitted <em>twice</em> on Microsoft Connect as a bug:</p>
<ul>
<li><a href="https://connect.microsoft.com/VisualStudio/feedback/details/381980/wpf-splashscreen-closes-messagebox">WPF splash screen closes MessageBox</a></li>
<li><a href="https://connect.microsoft.com/VisualStudio/feedback/details/600197/wpf-splash-screen-dismisses-dialog-box">WPF splash screen dismisses dialog box</a></li>
</ul>
<p>But it&#8217;s not clear whether Microsoft&#8217;s going to address the issue. The cause of the problem is that a modal dialog without an explicit parent window set will automatically attach itself to an active non-modal window. It&#8217;s a nifty behavior in most cases, but if a modal dialog attaches itself to a splash screen, and the splash screen is dismissed &#8212; well, so is your dialog!</p>
<h4>All washed up</h4>
<p>So, what are our options? One is to avoid Visual Studio&#8217;s built-in splash screen feature entirely and create our own splash screen. <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/8dd49fd0-9cc9-43c6-b285-6f119ab8a32e/">This thread in the MSDN forums describes how that can be done.</a></p>
<p>That seemed like too much work for us, which left us with three possible workarounds:</p>
<ol>
<li><a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/116bcd83-93bf-42f3-9bfe-da9e7de37546/">Use a hidden window.</a> Create a tiny, non-modal window to act as a parent for your MessageBox or modal dialog.</li>
<li><a href="http://stackoverflow.com/questions/3891719/messagebox-with-exception-details-immediately-disappears-if-use-splash-screen-in/3892129#3892129">Create non-modal message windows.</a> Change your startup mode to explicit shutdown and use a non-modal window to display your message.</li>
<li>Call MessageBox twice. Apparently, the problem only affects the <em>first</em> modal dialog shown. So you could simply call your modal dialog twice, if you didn&#8217;t mind the flash of the first one opening and closing. </li>
</ol>
<p>I don&#8217;t recommend that last technique &#8212; though it <em>does</em> work &#8212; so I&#8217;m not going to provide a link to it. </p>
<h4>Drying off</h4>
<p>I found several custom implementations of splash screens on CodePlex, but at this stage, so close to our 2.0 release, I didn&#8217;t want to add any code to our project that I didn&#8217;t thoroughly understand.</p>
<p>Since our software licensing code come from a third party, we couldn&#8217;t easily modify all of the windows shown during start-up to be non-modal.</p>
<p>So ultimately we decided to use the hidden window workaround. It seemed the quickest way to get the behavior we wanted. It feels a bit dirty, but I can&#8217;t justify rolling my own splash screen implementation just to display a static &#8220;Loading&#8230;&#8221; image. </p>
<p>I&#8217;d really like to see Microsoft fix this one. If you think so too, <a href="http://connect.microsoft.com/VisualStudio/feedback/details/600197/wpf-splash-screen-dismisses-dialog-box">vote for the issue here</a>. Thanks!</p>


<p><i>No related posts.</i></p>]]></content:encoded>
			<wfw:commentRss>http://underground.infovark.com/2011/03/23/using-modal-dialogs-with-a-splash-screen-in-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to format the XAML Hyperlink NavigateUri</title>
		<link>http://underground.infovark.com/2010/12/30/how-to-format-the-xaml-hyperlink-navigateuri/</link>
		<comments>http://underground.infovark.com/2010/12/30/how-to-format-the-xaml-hyperlink-navigateuri/#comments</comments>
		<pubDate>Thu, 30 Dec 2010 17:58:09 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[hyperlink]]></category>
		<category><![CDATA[xaml]]></category>

		<guid isPermaLink="false">http://underground.infovark.com/?p=713</guid>
		<description><![CDATA[Have you ever wanted to construct a dynamic query string for your Hyperlinks in WPF or Silverlight? Me too. Here's how.


Related posts:<ol><li><a href='http://underground.infovark.com/2011/02/19/getting-xaml-hyperlink-text-to-wrap/' rel='bookmark' title='Getting XAML Hyperlink text to wrap'>Getting XAML Hyperlink text to wrap</a></li>
<li><a href='http://underground.infovark.com/2011/03/03/highlighting-query-terms-in-a-wpf-textblock/' rel='bookmark' title='Highlighting query terms in a WPF TextBlock'>Highlighting query terms in a WPF TextBlock</a></li>
<li><a href='http://underground.infovark.com/2009/02/18/using-wcf-to-return-html/' rel='bookmark' title='Using WCF to return HTML'>Using WCF to return HTML</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Have you ever wanted to construct a dynamic query string for your Hyperlinks in WPF or Silverlight? Perhaps it&#8217;s the web developer in me, but I find myself wanting to do this <em>all the time</em>.</p>
<p>Sadly, the Hyperlink element&#8217;s NavigateUri property makes this extremely difficult. Since the NavigateUri property&#8217;s target type is a Uri, not a string, you can&#8217;t use the convenient StringFormat syntax to create dynamic URLs. I started a StackOverflow question to discuss <a href="http://stackoverflow.com/q/3579127/19112">how to use StringFormat with the NavigateUri property</a>. The best approach for now appears to be to write an <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.aspx">IValueConverter</a> that will create the Uri from a string.</p>
<p>This works if you only need to apply a single value. But what if you need to supply multiple values to generate a querystring with several parameters? </p>
<p>A post from Paul Stovell pointed me in the right direction: prior to the introduction of special StringFormat syntax in .NET 3.5 SP1, you needed to <a href="http://www.paulstovell.com/wpf-string-format-multibinding">use multibinding to manipulate strings</a>. We can use this older method to generate the Uri we need for the Hyperlink. </p>
<p>First, create a converter that implements <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.imultivalueconverter.aspx">IMultiValueConverter</a>.</p>
<div class="geshi no csharp">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#91;</span>ValueConversion<span class="br0">&#40;</span><span class="kw3">typeof</span><span class="br0">&#40;</span><span class="kw4">String</span><span class="br0">&#41;</span>, <span class="kw3">typeof</span><span class="br0">&#40;</span>Uri<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">class</span> StringToUriConverter <span class="sy0">:</span> IMultiValueConverter</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">object</span> Convert<span class="br0">&#40;</span><span class="kw4">object</span><span class="br0">&#91;</span><span class="br0">&#93;</span> values, Type targetType, <span class="kw4">object</span> parameter, CultureInfo culture<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Uri result;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">string</span> input <span class="sy0">=</span> <span class="kw4">string</span>.<span class="me1">Format</span><span class="br0">&#40;</span>parameter.<span class="me1">ToString</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, values<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Uri.<span class="me1">TryCreate</span><span class="br0">&#40;</span>input, UriKind.<span class="me1">RelativeOrAbsolute</span>, <span class="kw1">out</span> result<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">return</span> result;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">public</span> <span class="kw4">object</span><span class="br0">&#91;</span><span class="br0">&#93;</span> ConvertBack<span class="br0">&#40;</span><span class="kw4">object</span> value, Type<span class="br0">&#91;</span><span class="br0">&#93;</span> targetTypes, <span class="kw4">object</span> parameter, CultureInfo culture<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">throw</span> <span class="kw3">new</span> NotImplementedException<span class="br0">&#40;</span><span class="st0">&quot;This converter cannot be used in two-way binding.&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Remember to add the converter application resources in your App.xaml file, so you can reference it throughout your application. </p>
<div class="geshi no xml">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;Application</span>.Resources<span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sc3"><span class="re1">&lt;ResourceDictionary<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sc3"><span class="re1">&lt;Manager:StringToUriConverter</span> <span class="re0">x:Key</span>=<span class="st0">&quot;stringToUri&quot;</span><span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sc3"><span class="re1">&lt;/ResourceDictionary<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;/Application</span>.Resources<span class="re2">&gt;</span></span></div>
</li>
</ol>
</div>
<p>Then you can use it wherever you need to dynamically create a URI within your WPF or Silverlight application.</p>
<div class="geshi no xml">
<ol>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;TextBlock<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sc3"><span class="re1">&lt;Hyperlink<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sc3"><span class="re1">&lt;Hyperlink</span>.NavigateUri<span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="sc3"><span class="re1">&lt;MultiBinding</span> <span class="re0">ConverterParameter</span>=<span class="st0">&quot;/Projects/ItemIndexPage.xaml?ProjectId={0}&amp;amp;TemplateType={1}&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="re0">Converter</span>=<span class="st0">&quot;{StaticResource stringToUri}&quot;</span><span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;Binding</span> <span class="re0">ElementName</span>=<span class="st0">&quot;ProjectId&quot;</span> <span class="re0">Path</span>=<span class="st0">&quot;Text&quot;</span><span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="sc3"><span class="re1">&lt;Binding</span> <span class="re0">Path</span>=<span class="st0">&quot;Template&quot;</span><span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="sc3"><span class="re1">&lt;/MultiBinding<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sc3"><span class="re1">&lt;/Hyperlink</span>.NavigateUri<span class="re2">&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sc3"><span class="re1">&lt;Run</span> <span class="re0">Text</span>=<span class="st0">&quot;{Binding LinkText}&quot;</span><span class="re2">/&gt;</span></span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sc3"><span class="re1">&lt;/Hyperlink<span class="re2">&gt;</span></span></span></div>
</li>
<li class="li1">
<div class="de1"><span class="sc3"><span class="re1">&lt;/TextBlock<span class="re2">&gt;</span></span></span></div>
</li>
</ol>
</div>
<p>Whew. That&#8217;s a lot of extra work just to generate a URL for a hyperlink! </p>
<p>Notice that I had to escape the ampersand in the format string supplied in the ConverterParameter. Since XAML is based on XML, not HTML, you must escape the ampersand within attribute values. This catches me every time.</p>
<p>Generating dynamic URLs is such a basic operation for building navigation-style WPF or Silverlight applications, I&#8217;m surprised the folks at Microsoft didn&#8217;t create a helper syntax to handle this cleanly.</p>


<p>Related posts:<ol><li><a href='http://underground.infovark.com/2011/02/19/getting-xaml-hyperlink-text-to-wrap/' rel='bookmark' title='Getting XAML Hyperlink text to wrap'>Getting XAML Hyperlink text to wrap</a></li>
<li><a href='http://underground.infovark.com/2011/03/03/highlighting-query-terms-in-a-wpf-textblock/' rel='bookmark' title='Highlighting query terms in a WPF TextBlock'>Highlighting query terms in a WPF TextBlock</a></li>
<li><a href='http://underground.infovark.com/2009/02/18/using-wcf-to-return-html/' rel='bookmark' title='Using WCF to return HTML'>Using WCF to return HTML</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://underground.infovark.com/2010/12/30/how-to-format-the-xaml-hyperlink-navigateuri/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reflecting on reflection in .NET</title>
		<link>http://underground.infovark.com/2010/07/06/reflecting-on-reflection-in-net/</link>
		<comments>http://underground.infovark.com/2010/07/06/reflecting-on-reflection-in-net/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 13:40:28 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[dependency injection]]></category>
		<category><![CDATA[factory]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[reflection]]></category>
		<category><![CDATA[service locator]]></category>

		<guid isPermaLink="false">http://underground.infovark.com/?p=678</guid>
		<description><![CDATA[System.Reflection is a big hammer in the .NET programmer's toolbox. And I have the sore thumbs to prove it!


Related posts:<ol><li><a href='http://underground.infovark.com/2010/04/20/avoiding-the-new/' rel='bookmark' title='Avoiding the &#8220;new&#8221;'>Avoiding the &#8220;new&#8221;</a></li>
<li><a href='http://underground.infovark.com/2010/06/18/the-service-locator-pattern-is-the-new-global-variable/' rel='bookmark' title='The Service Locator pattern is the new global variable'>The Service Locator pattern is the new global variable</a></li>
<li><a href='http://underground.infovark.com/2008/08/13/creating-dummy-targets-for-configuration-objects/' rel='bookmark' title='Creating Dummy Targets for Configuration Objects'>Creating Dummy Targets for Configuration Objects</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I cringe whenever I spot code that uses System.Reflection. It&#8217;s a powerful weapon in our arsenal of .NET programming techniques &#8212; and a dangerous one.</p>
<p>In two previous posts, I talked about <a href="http://underground.infovark.com/2010/04/20/avoiding-the-new/">the misuse of dependency injection</a> and the <a href="http://underground.infovark.com/2010/06/18/the-service-locator-pattern-is-the-new-global-variable/">problems with the service locator pattern</a>. I should include <a href="http://en.wikipedia.org/wiki/Factory_pattern">factories</a> among the list of dangerous patterns too.</p>
<p>These patterns get overused in many .NET frameworks and toolkits. Some of that stems from a desire to avoid complex configuration. Some of it comes from the natural envy programmers in stuffy statically typed languages feel regarding their freewheeling counterparts using dynamically typed languages. </p>
<p>(Wikipedia has a good article exploring the differences in <a href="http://en.wikipedia.org/wiki/Type_system#Type_checking">type checking in computer language type systems</a>, if you&#8217;re curious about the different paradigms. But I digress.)</p>
<h4>On reflection</h4>
<p>System.Reflection two main uses, as Marc Gravell points out in his <a href="http://stackoverflow.com/questions/1036928/what-problems-does-reflection-solve/1036990#1036990">answer regarding what problems Reflection solves on StackOverflow</a>:</p>
<ol>
<li>Investigating type information</li>
<li>Metaprogramming</li>
</ol>
<p>These two capabilities allow you to shoehorn dynamic or late-binding features into C# applications. In other words, it&#8217;s a <em>clever hack</em>.</p>
<p>Want to enable Ruby-style <a href="http://en.wikipedia.org/wiki/Convention_over_configuration">convention over configuration</a> in your C# framework? Use reflection! Want to reach into <code>private</code> or <code>internal</code> methods for unit testing? Use reflection! Want to add some duck typing goodness to your statically typed language? Use reflection!</p>
<h4>But on further reflection</h4>
<p>The System.Reflection API has some <strong>big</strong> drawbacks. The <a href="http://stackoverflow.com/questions/25458/how-costly-is-reflection-really">performance penalty incurred by reflection</a> is well known. Less well known is that the Reflection API is really difficult to use, especially when inspecting and creating constructor method parameters. So most framework developers skip the hard bits.</p>
<p>This means that most of these frameworks will <em>insist</em> on your using constructors without parameters in your classes. (Sometimes people call parameter-less constructors &#8220;default constructors&#8221; though it isn&#8217;t the same thing.) </p>
<p>But if you can&#8217;t use parameters in the constructors of your objects, <em>you&#8217;re doing object-oriented programming with one hand tied behind your back</em>.</p>
<p>For example, it&#8217;s difficult to achieve object immutability without using a constructor. You&#8217;ll also have a hard time enforcing business rules without constructors. And if you&#8217;re a fan of dependency injection, you&#8217;ll have to implement it via <code>Init()</code> methods or property setters, both of which can cause significant headaches.</p>
<p>So if you work with a framework or API that makes heavy use of reflection, and thus restricts the sort of constructors you use, prepare yourself for significant pain. </p>


<p>Related posts:<ol><li><a href='http://underground.infovark.com/2010/04/20/avoiding-the-new/' rel='bookmark' title='Avoiding the &#8220;new&#8221;'>Avoiding the &#8220;new&#8221;</a></li>
<li><a href='http://underground.infovark.com/2010/06/18/the-service-locator-pattern-is-the-new-global-variable/' rel='bookmark' title='The Service Locator pattern is the new global variable'>The Service Locator pattern is the new global variable</a></li>
<li><a href='http://underground.infovark.com/2008/08/13/creating-dummy-targets-for-configuration-objects/' rel='bookmark' title='Creating Dummy Targets for Configuration Objects'>Creating Dummy Targets for Configuration Objects</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://underground.infovark.com/2010/07/06/reflecting-on-reflection-in-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The Service Locator pattern is the new global variable</title>
		<link>http://underground.infovark.com/2010/06/18/the-service-locator-pattern-is-the-new-global-variable/</link>
		<comments>http://underground.infovark.com/2010/06/18/the-service-locator-pattern-is-the-new-global-variable/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 15:30:42 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[dependency injection]]></category>
		<category><![CDATA[inversion of control]]></category>
		<category><![CDATA[patterns]]></category>
		<category><![CDATA[service locator]]></category>

		<guid isPermaLink="false">http://underground.infovark.com/?p=672</guid>
		<description><![CDATA[Is the Service Locator pattern just a sneaky way of creating global variables?


Related posts:<ol><li><a href='http://underground.infovark.com/2010/07/06/reflecting-on-reflection-in-net/' rel='bookmark' title='Reflecting on reflection in .NET'>Reflecting on reflection in .NET</a></li>
<li><a href='http://underground.infovark.com/2010/04/20/avoiding-the-new/' rel='bookmark' title='Avoiding the &#8220;new&#8221;'>Avoiding the &#8220;new&#8221;</a></li>
<li><a href='http://underground.infovark.com/2008/11/19/the-curse-of-the-singleton/' rel='bookmark' title='The Curse of the Singleton'>The Curse of the Singleton</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Mark Seeman, author of an upcoming book about dependency injection, writes that <a href="http://blog.ploeh.dk/2010/02/03/ServiceLocatorIsAnAntiPattern.aspx">Service Locator is an anti-pattern</a>. He shows several code examples illustrating the difficulty of configuring and troubleshooting various implementations of the Service Locator pattern. His observations tally with my thoughts about the <a href="http://underground.infovark.com/2010/04/20/avoiding-the-new/">awkwardness of service locator implementations</a>.</p>
<p>As I was wrestling with yet another third-party software component that made heavy use of an inversion-of-control (IoC) container, I realized that service locators are the new global variable. </p>
<p>Global variables are a <a href="http://en.wikipedia.org/wiki/Code_smell">code smell</a> and should be used sparingly. </p>
<p>This means that you should use a service locator only as a <em>last resort</em>, not as the default way of wiring bits of your application together. </p>
<p>And if you&#8217;re using an IoC container, make sure that you are using it to inject dependencies through your object constructors, rather than calling its static   <code>Resolve<T>()</code> methods from within your classes.</p>


<p>Related posts:<ol><li><a href='http://underground.infovark.com/2010/07/06/reflecting-on-reflection-in-net/' rel='bookmark' title='Reflecting on reflection in .NET'>Reflecting on reflection in .NET</a></li>
<li><a href='http://underground.infovark.com/2010/04/20/avoiding-the-new/' rel='bookmark' title='Avoiding the &#8220;new&#8221;'>Avoiding the &#8220;new&#8221;</a></li>
<li><a href='http://underground.infovark.com/2008/11/19/the-curse-of-the-singleton/' rel='bookmark' title='The Curse of the Singleton'>The Curse of the Singleton</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://underground.infovark.com/2010/06/18/the-service-locator-pattern-is-the-new-global-variable/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Avoiding the &#8220;new&#8221;</title>
		<link>http://underground.infovark.com/2010/04/20/avoiding-the-new/</link>
		<comments>http://underground.infovark.com/2010/04/20/avoiding-the-new/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 15:34:02 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[dependency injection]]></category>
		<category><![CDATA[inversion of control]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://underground.infovark.com/?p=638</guid>
		<description><![CDATA[Dependency Injection is an important principle of software design, but it can be overused. My biggest concern with overusing inversion-of-control (IoC) containers is that it makes learning a framework ten times harder than it needs to be. 


Related posts:<ol><li><a href='http://underground.infovark.com/2010/07/06/reflecting-on-reflection-in-net/' rel='bookmark' title='Reflecting on reflection in .NET'>Reflecting on reflection in .NET</a></li>
<li><a href='http://underground.infovark.com/2010/06/18/the-service-locator-pattern-is-the-new-global-variable/' rel='bookmark' title='The Service Locator pattern is the new global variable'>The Service Locator pattern is the new global variable</a></li>
<li><a href='http://underground.infovark.com/2008/10/05/one-way-serialization/' rel='bookmark' title='One-Way Serialization'>One-Way Serialization</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In January, Robert Martin posted an article about <a href="http://blog.objectmentor.com/articles/2010/01/17/dependency-injection-inversion">the overuse of dependency injection</a> in many open source frameworks. At the time, I had only an academic interest in the subject. (And Uncle Bob&#8217;s rants are always a fun read.)</p>
<p>But that was <em>before</em> I started taking a look at several open source frameworks for WPF. Now I&#8217;m feeling ranty too!</p>
<p>Dependency Injection is an important principle of software design, but it can be abused. My biggest concern with overusing inversion-of-control (IoC) containers is that it makes learning a framework ten times harder than it needs to be. </p>
<p>First, you can&#8217;t tell precisely when an object gets created. Sure, it&#8217;s nice that your framework provides control over the lifetime of objects, but this should be an optional feature for advanced scenarios. Not every solution requires lazy loading. Sometimes a simple &#8220;new&#8221; will do.</p>
<p>Second, by placing all the wiring and object discovery in the container or service locator, you hide important information about how the framework components fit together. Yes, the global object factory knows what classes go with what types, but you don&#8217;t. That information is hidden among all the framework plumbing.</p>
<p>For similar reasons, Microsoft cautions against using factory methods in place of constructors in its <a href="http://www.amazon.com/Framework-Design-Guidelines-Conventions-Libraries/dp/0321545613%3FSubscriptionId%3DAKIAIU3RPTD7NQ47YK4A%26tag%3Dinfovark-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0321545613">Framework Design Guidelines</a>:</p>
<blockquote><p>Prefer constructors to factories, because they are generally more usable, consistent, and convenient than specialized construction mechanisms.</p></blockquote>
<p>I think that goes <strong>double</strong> for dependency injection and IoC containers. Eliminating constructors makes for less readable code. I can&#8217;t tell what classes other classes depend on to do their jobs. </p>
<h4>My errors should get thrown from my code</h4>
<p>Sure, IoC containers are great when everything gets wired together automagically. But when an error occurs, I want it to be thrown from my code, as close to the source of the error as possible. (Like Jeff Atwood, I assume it&#8217;s <a href="http://www.codinghorror.com/blog/archives/001079.html">always my fault</a>.) </p>
<p>Instead, frameworks that overuse dependency injection throw most of these setup, configuration, and instantiation from its internal IoC container, usually with some horribly generic error message. </p>
<p>Then it&#8217;s up to me to find which dependency failed to resolve, which constructor failed to bind, or which concrete implementation didn&#8217;t get registered. And in order to do that, I have to go spelunking in the framework code &#8212; which I don&#8217;t know well &#8212; rather than the code I was trying to write, which I know quite well.</p>
<p>Frameworks that rely on dependency injection and IoC containers practically <em>require</em> you to have the framework source available and for you to become an expert in its mysterious inner workings. If I need to step through the framework code or use reflector on it, the framework has failed me. </p>
<p>This is exactly what Uncle Bob was decrying in his article. I don&#8217;t <em>want</em> to become an expert in the XYZ framework for ABC. I just want to get my stuff done. </p>


<p>Related posts:<ol><li><a href='http://underground.infovark.com/2010/07/06/reflecting-on-reflection-in-net/' rel='bookmark' title='Reflecting on reflection in .NET'>Reflecting on reflection in .NET</a></li>
<li><a href='http://underground.infovark.com/2010/06/18/the-service-locator-pattern-is-the-new-global-variable/' rel='bookmark' title='The Service Locator pattern is the new global variable'>The Service Locator pattern is the new global variable</a></li>
<li><a href='http://underground.infovark.com/2008/10/05/one-way-serialization/' rel='bookmark' title='One-Way Serialization'>One-Way Serialization</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://underground.infovark.com/2010/04/20/avoiding-the-new/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Check out proposed enhancements to .NET core classes</title>
		<link>http://underground.infovark.com/2010/03/30/check-out-proposed-enhancements-to-net-core-classes/</link>
		<comments>http://underground.infovark.com/2010/03/30/check-out-proposed-enhancements-to-net-core-classes/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 00:37:43 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://underground.infovark.com/?p=632</guid>
		<description><![CDATA[The Base Class Library (BCL) team launched a CodePlex site to preview extensions to core .NET classes and gather community feedback.


Related posts:<ol><li><a href='http://underground.infovark.com/2008/07/21/256-character-filenames-should-be-enough-for-anybody/' rel='bookmark' title='256 Character Filenames Should be Enough for Anybody'>256 Character Filenames Should be Enough for Anybody</a></li>
<li><a href='http://underground.infovark.com/2008/08/13/creating-dummy-targets-for-configuration-objects/' rel='bookmark' title='Creating Dummy Targets for Configuration Objects'>Creating Dummy Targets for Configuration Objects</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Almost two years ago, I wrote a post expressing <a href="http://http://underground.infovark.com/2008/07/21/256-character-filenames-should-be-enough-for-anybody/">my frustration with the way that .NET handles long filenames</a>. Yesterday, the Base Class Library (BCL) team at Microsoft <a href="http://blogs.msdn.com/bclteam/archive/2010/03/30/bcl-codeplex-site-launch.aspx">announced</a> that they have launched a <a href="http://bcl.codeplex.com/">BCL CodePlex site</a> to gather feedback on proposed enhancements and extensions to core .NET components.</p>
<p>One of the first four features on preview is a new <a href="http://bcl.codeplex.com/wikipage?title=Long%20Path">Long Path</a> wrapper class, which will hopefully make some of the awkward hacks we&#8217;ve used in the past obsolete. Hooray!</p>
<p>The code is available for download, and they have documentation and samples as well. </p>
<p>I plan on giving the new Long Path class a <em>thorough</em> test drive.</p>


<p>Related posts:<ol><li><a href='http://underground.infovark.com/2008/07/21/256-character-filenames-should-be-enough-for-anybody/' rel='bookmark' title='256 Character Filenames Should be Enough for Anybody'>256 Character Filenames Should be Enough for Anybody</a></li>
<li><a href='http://underground.infovark.com/2008/08/13/creating-dummy-targets-for-configuration-objects/' rel='bookmark' title='Creating Dummy Targets for Configuration Objects'>Creating Dummy Targets for Configuration Objects</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://underground.infovark.com/2010/03/30/check-out-proposed-enhancements-to-net-core-classes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3 Useful Visual Studio Tricks for Spark Templates</title>
		<link>http://underground.infovark.com/2010/01/05/3-useful-visual-studio-tricks-for-spark-templates/</link>
		<comments>http://underground.infovark.com/2010/01/05/3-useful-visual-studio-tricks-for-spark-templates/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 15:33:37 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Spark View Engine]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://underground.infovark.com/?p=558</guid>
		<description><![CDATA[We demonstrate three tricks to improve the Spark template editing experience in Visual Studio 2008. This includes HTML syntax highlighting, Spark file icons, and Visual Studio item templates for Spark views.


Related posts:<ol><li><a href='http://underground.infovark.com/2009/12/09/using-spark-view-engine-with-c-webserver/' rel='bookmark' title='Using Spark View Engine with C# WebServer'>Using Spark View Engine with C# WebServer</a></li>
<li><a href='http://underground.infovark.com/2009/09/09/visual-studio-2008-and-the-copylocal-setting/' rel='bookmark' title='Visual Studio 2008 and the CopyLocal setting'>Visual Studio 2008 and the CopyLocal setting</a></li>
<li><a href='http://underground.infovark.com/2009/03/31/visual-studio-2008-and-its-copylocal-setting/' rel='bookmark' title='Visual Studio 2008 and its CopyLocal setting'>Visual Studio 2008 and its CopyLocal setting</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p><a href="http://sparkviewengine.codeplex.com/WorkItem/View.aspx?WorkItemId=3971">This issue on the Spark discussion board</a> inspired several tweaks to my Visual Studio setup. Gordon and I have found these quite useful, so we&#8217;d thought we&#8217;d share them here.</p>
<h4>Spark template file icons</h4>
<p>First, I made a couple registry files to give Spark templates a spiffy icon.</p>
<p>Visual Studio gets its icons from the same registry setting used in Windows Explorer. So all we need to do is register the file extension and associate it with a default icon.</p>
<p>I found a free-for-noncommercial-use &#8220;S&#8221;-shaped <a href="http://www.iconspedia.com/icon/lightning--580.html">lightning bolt icon</a> and used the instructions in <a href="http://stackoverflow.com/questions/771689/how-can-i-set-an-icon-for-my-own-file-extension">this StackOverflow question</a> to create the necessary registry entries. </p>
<div id="attachment_587" class="wp-caption aligncenter" style="width: 212px"><a href="http://underground.infovark.com/wp-content/uploads/2010/01/VS2008-Spark-icon.png"><img src="http://underground.infovark.com/wp-content/uploads/2010/01/VS2008-Spark-icon-202x300.png" alt="Add an icon for Spark templates in Visual Studio 2008" title="VS2008 Spark icon" width="202" height="300" class="size-medium wp-image-587" /></a><p class="wp-caption-text">Add an icon for Spark templates in Visual Studio 2008</p></div>
<p>You can download the SparkFile.zip package I created from Codeplex. Place the .ico file in C:\Program Files\Spark, and run the two .reg files, and you&#8217;ll have a nifty spark icon inside Visual Studio. </p>
<p>(All the usual caveats apply regarding modifying your registry.)</p>
<h4>Visual Studio template</h4>
<p>Next, I created an item template to use in the Visual Studio Add New Item menu, using this <a href="http://www.switchonthecode.com/tutorials/visual-studio-how-to-create-item-templates">guide to creating item templates</a>. </p>
<p>You can download my SparkVSTemplate.zip package from Codeplex as well. Place the SparkVSTemplate.zip file in <code>My Documents\Visual Studio 2008\Templates\ItemTemplates\Visual C#\Web</code> and you&#8217;ll be able to create a basic template from the VS menu. You don&#8217;t need to unzip it.</p>
<h4>HTML syntax highlighting</h4>
<p>Finally, I wanted to apply the standard syntax highlighting used for HTML pages. </p>
<p>In Visual Studio 2008, go to Tools | Options, then choose Text Editor, then associate files ending in <code>.spark</code> with the HTML editor.</p>
<div id="attachment_559" class="wp-caption aligncenter" style="width: 310px"><img src="http://underground.infovark.com/wp-content/uploads/2009/12/VS2008-Spark-settings-300x184.png" alt="Set up Spark View Engine templates to use the HTML Editor in Visual Studio 2008" title="VS2008 Spark settings" width="300" height="184" class="size-medium wp-image-559" /><p class="wp-caption-text">Set up Spark View Engine templates to use the HTML Editor in Visual Studio 2008</p></div>
<p>This will set all the colors properly. Unfortunately, it will also flag any Spark-specific attributes or elements as HTML validation errors. I figure this is a small price to pay for proper syntax highlighting.</p>
<h4>What&#8217;s missing?</h4>
<p>I&#8217;d really like to <a href="http://dev.dejardin.org/usage/intellisense">get intellisense working for Spark</a>. Though I tried the Visual Studio Integration Package, it won&#8217;t work right outside of VS Web projects. Syntax highlighting seems like the best I can do for the moment.</p>
<p>If you&#8217;ve got other tips and tricks for using Spark inside Visual Studio, I&#8217;d love to hear them.</p>


<p>Related posts:<ol><li><a href='http://underground.infovark.com/2009/12/09/using-spark-view-engine-with-c-webserver/' rel='bookmark' title='Using Spark View Engine with C# WebServer'>Using Spark View Engine with C# WebServer</a></li>
<li><a href='http://underground.infovark.com/2009/09/09/visual-studio-2008-and-the-copylocal-setting/' rel='bookmark' title='Visual Studio 2008 and the CopyLocal setting'>Visual Studio 2008 and the CopyLocal setting</a></li>
<li><a href='http://underground.infovark.com/2009/03/31/visual-studio-2008-and-its-copylocal-setting/' rel='bookmark' title='Visual Studio 2008 and its CopyLocal setting'>Visual Studio 2008 and its CopyLocal setting</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://underground.infovark.com/2010/01/05/3-useful-visual-studio-tricks-for-spark-templates/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Introducing the SparkServer Project</title>
		<link>http://underground.infovark.com/2009/12/18/introducing-the-sparkserver-project/</link>
		<comments>http://underground.infovark.com/2009/12/18/introducing-the-sparkserver-project/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 15:27:17 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C# WebServer]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Spark View Engine]]></category>

		<guid isPermaLink="false">http://underground.infovark.com/?p=554</guid>
		<description><![CDATA[It&#8217;s less than two weeks since I began my experiment using the Spark View Engine with C# WebServer. Even though it&#8217;s put a kink in our development schedule, I&#8217;m confident it was the right move. It&#8217;ll save us a lot of time in the long run. After posting messages to the Spark project and C# [...]


Related posts:<ol><li><a href='http://underground.infovark.com/2009/12/09/using-spark-view-engine-with-c-webserver/' rel='bookmark' title='Using Spark View Engine with C# WebServer'>Using Spark View Engine with C# WebServer</a></li>
<li><a href='http://underground.infovark.com/2010/01/15/support-the-jquery-project/' rel='bookmark' title='Support the JQuery Project'>Support the JQuery Project</a></li>
<li><a href='http://underground.infovark.com/2009/12/01/looking-for-an-iis-alternative/' rel='bookmark' title='Looking for an IIS Alternative'>Looking for an IIS Alternative</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s less than two weeks since I began my experiment <a href="http://underground.infovark.com/2009/12/09/using-spark-view-engine-with-c-webserver/">using the Spark View Engine with C# WebServer</a>. Even though it&#8217;s put a kink in our development schedule, I&#8217;m confident it was the right move. It&#8217;ll save us a lot of time in the long run.</p>
<p>After posting messages to the Spark project and C# WebServer project forums, I decided there was enough interest to make sharing my integration code worthwhile.</p>
<p>You can find it at: <a href="http://code.google.com/p/sparkserver/">http://code.google.com/p/sparkserver/</a></p>
<p>If you&#8217;d like to participate in the project, please let me know. Comments, suggestions, and <em>especially</em> fixes are always welcome! </p>


<p>Related posts:<ol><li><a href='http://underground.infovark.com/2009/12/09/using-spark-view-engine-with-c-webserver/' rel='bookmark' title='Using Spark View Engine with C# WebServer'>Using Spark View Engine with C# WebServer</a></li>
<li><a href='http://underground.infovark.com/2010/01/15/support-the-jquery-project/' rel='bookmark' title='Support the JQuery Project'>Support the JQuery Project</a></li>
<li><a href='http://underground.infovark.com/2009/12/01/looking-for-an-iis-alternative/' rel='bookmark' title='Looking for an IIS Alternative'>Looking for an IIS Alternative</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://underground.infovark.com/2009/12/18/introducing-the-sparkserver-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better ways to Encode HTML in C#</title>
		<link>http://underground.infovark.com/2009/12/11/better-ways-to-encode-html-in-c/</link>
		<comments>http://underground.infovark.com/2009/12/11/better-ways-to-encode-html-in-c/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 14:30:26 +0000</pubDate>
		<dc:creator>Dean</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[URI]]></category>

		<guid isPermaLink="false">http://underground.infovark.com/?p=547</guid>
		<description><![CDATA[Microsoft provides lots of different ways to encode HTML and URIs, but their newest library, called AntiXSS, is the best of the bunch.


Related posts:<ol><li><a href='http://underground.infovark.com/2009/02/18/using-wcf-to-return-html/' rel='bookmark' title='Using WCF to return HTML'>Using WCF to return HTML</a></li>
<li><a href='http://underground.infovark.com/2009/01/14/jquery-turns-3/' rel='bookmark' title='JQuery Turns 3'>JQuery Turns 3</a></li>
<li><a href='http://underground.infovark.com/2010/12/30/how-to-format-the-xaml-hyperlink-navigateuri/' rel='bookmark' title='How to format the XAML Hyperlink NavigateUri'>How to format the XAML Hyperlink NavigateUri</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Our move from Windows Communication Foundation to C# WebServer once again raised the difficult question of <a href="http://en.wikipedia.org/wiki/HTML_encoding">HTML character encoding</a>. </p>
<p>Since we&#8217;re not using Microsoft IIS, we wanted to avoid a dependency on System.Web, which has the popular but flawed <code>HttpUtility.HtmlEncode()</code> method.</p>
<p>In my research, I discovered Rick Strahl&#8217;s post about <a href="http://www.west-wind.com/Weblog/posts/617930.aspx">Html and Uri String Encoding without System.Web</a>. He points out the problems and inconsistencies in the mainstream encoding methods available in the .NET framework, and ultimately decided to roll his own encoding method.</p>
<p>But in this StackOverflow question on <a href="http://stackoverflow.com/questions/1631819/htmlencode-in-c">HTML Encoding in C#</a>, several folks suggested using Microsoft&#8217;s <a href="http://en.wikipedia.org/wiki/Cross-site_scripting">anti-cross-site scripting</a> library, <a href="http://www.codeplex.com/AntiXSS">AntiXSS</a>.</p>
<p>After spending some time working with the library, it seems like just the thing to solve the problem of web encoding.</p>
<p>The AntiXSS Library includes helpful methods for encoding HTML, URLs, JavaScript, and XML. It&#8217;s based on a secure <a href="http://en.wiktionary.org/wiki/whitelist">whitelist</a> model, so anything not allowed in the specifications is prohibited. </p>
<p>Microsoft has made the source of AntiXSS 3.1 available on Codeplex (http://antixss.codeplex.com/), but you can also get the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=051ee83c-5ccf-48ed-8463-02f56a6bfc09&#038;displaylang=en">official release of AntiXSS</a> direct from Microsoft. It includes a sample application and thorough documentation. </p>
<p>It&#8217;s <em>exactly</em> the solution I was looking for. </p>


<p>Related posts:<ol><li><a href='http://underground.infovark.com/2009/02/18/using-wcf-to-return-html/' rel='bookmark' title='Using WCF to return HTML'>Using WCF to return HTML</a></li>
<li><a href='http://underground.infovark.com/2009/01/14/jquery-turns-3/' rel='bookmark' title='JQuery Turns 3'>JQuery Turns 3</a></li>
<li><a href='http://underground.infovark.com/2010/12/30/how-to-format-the-xaml-hyperlink-navigateuri/' rel='bookmark' title='How to format the XAML Hyperlink NavigateUri'>How to format the XAML Hyperlink NavigateUri</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://underground.infovark.com/2009/12/11/better-ways-to-encode-html-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

