<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Dev Station 971</title>
	<atom:link href="http://aero971.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://aero971.wordpress.com</link>
	<description>Mad about new software...</description>
	<lastBuildDate>Sun, 21 Aug 2011 07:11:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='aero971.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Dev Station 971</title>
		<link>http://aero971.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://aero971.wordpress.com/osd.xml" title="Dev Station 971" />
	<atom:link rel='hub' href='http://aero971.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Incrementing Performance Counters in Powershell</title>
		<link>http://aero971.wordpress.com/2011/05/24/incrementing-performance-counters-in-powershell/</link>
		<comments>http://aero971.wordpress.com/2011/05/24/incrementing-performance-counters-in-powershell/#comments</comments>
		<pubDate>Tue, 24 May 2011 14:52:47 +0000</pubDate>
		<dc:creator>aero971</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aero971.wordpress.com/?p=81</guid>
		<description><![CDATA[To complete and test the Powershell script for creating performance counters, you can use these Powershell commands: $counter = New-Object Diagnostics.PerformanceCounter; $counter.CategoryName = &#8220;My_Category&#8221;; $counter.CounterName = &#8220;Counter_1&#8243;; $counter.ReadOnly = 0; $counter.Increment(); $counter.Close(); A good read on performance counters can be found here: http://msdn.microsoft.com/en-us/library/ff650681.aspx<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=81&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To complete and test the Powershell script for creating performance counters, you can use these Powershell commands:</p>
<blockquote><p>$counter = New-Object Diagnostics.PerformanceCounter;<br />
$counter.CategoryName = &#8220;My_Category&#8221;;<br />
$counter.CounterName = &#8220;Counter_1&#8243;;</p>
<p>$counter.ReadOnly = 0;</p>
<p>$counter.Increment();<br />
$counter.Close();</p></blockquote>
<p>A good read on performance counters can be found here:<br />
<a href="http://msdn.microsoft.com/en-us/library/ff650681.aspx">http://msdn.microsoft.com/en-us/library/ff650681.aspx</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aero971.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aero971.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aero971.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aero971.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aero971.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aero971.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aero971.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aero971.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aero971.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aero971.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aero971.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aero971.wordpress.com/81/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aero971.wordpress.com/81/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aero971.wordpress.com/81/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=81&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aero971.wordpress.com/2011/05/24/incrementing-performance-counters-in-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3df55ae284744fd6e678c1efb0ccab32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aero971</media:title>
		</media:content>
	</item>
		<item>
		<title>Add performance counters through PowerShell</title>
		<link>http://aero971.wordpress.com/2011/05/24/add-performance-counters-through-powershell/</link>
		<comments>http://aero971.wordpress.com/2011/05/24/add-performance-counters-through-powershell/#comments</comments>
		<pubDate>Tue, 24 May 2011 11:46:16 +0000</pubDate>
		<dc:creator>aero971</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aero971.wordpress.com/?p=76</guid>
		<description><![CDATA[Although Powershell is probably not the recommended way of deploying performance counters into various environments, I had to follow this through and create a PowerShell script for deploying performance counters on Windows Server 2008 and Windows XP desktops. First, start up Powershell from either the start menu (Start &#62; Run &#62; powershell) or if you [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=76&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Although Powershell is probably not the recommended way of deploying performance counters into various environments, I had to follow this through and create a PowerShell script for deploying performance counters on Windows Server 2008 and Windows XP desktops.</p>
<p>First, start up Powershell from either the start menu (Start &gt; Run &gt; powershell) or if you have Windows 7, navigate to control Panel &gt; Administrative tools and run it from there.</p>
<p>Next, create the script to setup and create counters: </p>
<blockquote><p>#Global variable definitions<br />
$cntrColl</p>
<p>Write-Host &#8220;Remove category&#8221;;<br />
if([Diagnostics.PerformanceCounterCategory]::Exists(&#8220;My_Category&#8221;)) {<br />
 [Diagnostics.PerformanceCounterCategory]::Delete(&#8220;My_Category&#8221;);<br />
}<br />
$script:cntrColl = New-Object Diagnostics.CounterCreationDataCollection;</p>
<p>Write-Host &#8220;Add counter 1&#8243;;<br />
$counter = New-Object Diagnostics.CounterCreationData;<br />
$counter.CounterName = &#8220;Counter_1&#8243;;<br />
$counter.CounterHelp = &#8220;Help for Counter_1&#8243;;<br />
$counter.CounterType = [Diagnostics.PerformanceCounterType]::NumberOfItems64;<br />
$script:cntrColl.Add($counter);</p>
<p>Write-Host &#8220;Add counter 2&#8243;;<br />
$counter = New-Object Diagnostics.CounterCreationData;<br />
$counter.CounterName = &#8220;Counter_2&#8243;;<br />
$counter.CounterHelp = &#8220;Help for Counter_2&#8243;;<br />
$counter.CounterType = [Diagnostics.PerformanceCounterType]::NumberOfItems64;<br />
$script:cntrColl.Add($counter);</p>
<p>Write-Host &#8220;Add the counters to PerfMon&#8221;;<br />
[Diagnostics.PerformanceCounterCategory]::Create(&#8220;My_Category&#8221;, &#8220;Help for category&#8221;, $script:cntrColl);</p></blockquote>
<p>To check the counter has been created, start Performance Monitor (type perfmon in Powershell)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aero971.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aero971.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aero971.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aero971.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aero971.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aero971.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aero971.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aero971.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aero971.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aero971.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aero971.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aero971.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aero971.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aero971.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=76&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aero971.wordpress.com/2011/05/24/add-performance-counters-through-powershell/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3df55ae284744fd6e678c1efb0ccab32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aero971</media:title>
		</media:content>
	</item>
		<item>
		<title>Writing Clean Code</title>
		<link>http://aero971.wordpress.com/2010/12/20/writing-clean-code/</link>
		<comments>http://aero971.wordpress.com/2010/12/20/writing-clean-code/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 20:03:13 +0000</pubDate>
		<dc:creator>aero971</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">https://aero971.wordpress.com/2010/12/20/writing-clean-code/</guid>
		<description><![CDATA[This post covers a few key points picked up from reading the book “Clean Code” by Robert C. Martin and will serve as a reminder for myself. This isn’t meant to be a replacement for reading the actual book as there’s tons of information left out and the benefit of the book is ploughing through [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=66&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post covers a few key points picked up from reading the book “Clean Code” by Robert C. Martin and will serve as a reminder for myself. This isn’t meant to be a replacement for reading the actual book as there’s tons of information left out and the benefit of the book is ploughing through the worked examples!</p>
<p>Over all the book is pretty good excluding the starting chapters in which the author goes into a rant and throws a few tantrums. However, a good number of worked examples are provided which are helpful to explain the theory and the rationale provided is sound.</p>
<p>The topics below are ordered such that the more obvious one are towards the back.</p>
<h2>Why Clean Code?</h2>
<p>Why should we bother writing clean code? Why not just live on a coding high (with Pepsi and Pizzas) and thrive under the pressure of delivering against all the odds? The real problem is maintaining a steady rate of delivery after systems have gone live. If code is messy it becomes harder to understand / debug. Eventually, everyone becomes afraid of making changes since they don’t want to break the system.</p>
<p>Writing Clean Code takes practice and time. As I’ve said to my colleagues, development is an ever evolving cycle of iterations, new techniques and improvements as time progresses.</p>
<h2>Single Responsibility Principle (SRP)</h2>
<p>Classes / modules should only have a single responsibility and only one reason to change. This is one of the simpler OO principles, yet is widely abused. e.g. Car</p>
<blockquote><p>Car { Accelerate();</p>
<p>Break(); DisplayPassenger(); }</p>
</blockquote>
<p>Method DisplayPassenger() is not a responsibility for Car and should reside separately. The key purpose of applying SRP is to produce focused, small classes that have a dedicated purpose. When the classes are named adequately, it becomes easy for the reader to digest what is happening. The alternative is to have fewer large classes that are more difficult for readers to comprehend.</p>
<h2>Unit Tests (UT)</h2>
<p>Unfortunately, UT has often taken a back seat in development, especially when there’s an extortionate amount of pressure to deliver something quickly. The massive danger is that once the system has gone live without UT, there will be no time to back fill those missing UTs. Another developer who has to make a change on the code base has no confidence indicator that the changes won’t break the system. This is where UT steps up – if you bake these in early, you have some level of confidence that other developers won’t break the system.</p>
<p>UTs should be FIRST:</p>
<ul>
<li>Fast – quick to run otherwise they won’t get run often </li>
<li>Independent – test can run on it’s own with depending on other tests to pass</li>
<li>Repeatable – deterministic results based on the same environment settings </li>
<li>Self-validating – Simple success criteria, e.g. pass or fail </li>
<li>Timely – If you follow TDD (Test Driven Development), then write the test just before writing the code </li>
</ul>
<p>As the developer, you need to be sure your UT is comprehensive enough to ensure that another developer changing your class will fail the tests if something detrimental is implemented.</p>
<h2>Methods</h2>
<ol>
<li>Method names should be meaningful and ideally contain a verb</li>
<li>Methods should be single purpose – only do one thing and then return </li>
<li>When a method relies on another method within the same class, the distance between the methods should be small, (to save the reader from endless scrolling / searching). This is known as the method density. Keeping the density high makes easier reading </li>
<li>Avoid passing more than 3 parameters into a single method.</li>
</ol>
<h2>Comments</h2>
<p>There are a mixed set of views around the use of comments in code:</p>
<ul>
<li>On one side there is the agile group who say comments are necessary – write readable code </li>
<li>On another side, e.g. JavaDoc, comments were done so religiously, comments were often stated the obvious </li>
<li>From experience, I can recollect having to troubleshoot / change JavaScript code in files that were over 5,000 line of code and the only thing that saved me were the comments! </li>
</ul>
<p>My recommendation would be to use comments sensibly and explain things that would be difficult for a reader to gauge the perspective / scenario. Care needs to be taken that comments don’t become out dated and then eventually misleading. This is one of the drivers against comments.</p>
<h2>Variables</h2>
<ol>
<li>Variable names need to be meaningful, e.g. a, theItem or scd don’t mean anything to an external observer. Try things like account, itemsToCheck or secureCommunicationsDevice </li>
<li>Microsoft’s Hungarian notation is arguably bad, e.g. what if you changed the underlying data type? Would that also require variable name changes? That is the primary reason not to use.
<p>However, to contradict this, why are all Java / .Net interfaces prefixed with “I”?</p>
</li>
<li>
<p>Define a constant variable for integer values </p>
</li>
<li>Variable member prefix (m_) for class level variables is no longer required as the m_ is not essential information</li>
</ol>
<h2>Summary</h2>
<p>Hopefully, this short summary was appealing enough for you to investigate this further.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aero971.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aero971.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aero971.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aero971.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aero971.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aero971.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aero971.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aero971.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aero971.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aero971.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aero971.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aero971.wordpress.com/66/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aero971.wordpress.com/66/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aero971.wordpress.com/66/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=66&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aero971.wordpress.com/2010/12/20/writing-clean-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3df55ae284744fd6e678c1efb0ccab32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aero971</media:title>
		</media:content>
	</item>
		<item>
		<title>Microsoft.Practices.CompositeWeb.ServiceMissingException: Service</title>
		<link>http://aero971.wordpress.com/2010/06/19/microsoft-practices-compositeweb-servicemissingexception-service/</link>
		<comments>http://aero971.wordpress.com/2010/06/19/microsoft-practices-compositeweb-servicemissingexception-service/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 14:52:07 +0000</pubDate>
		<dc:creator>aero971</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://aero971.wordpress.com/2010/06/19/microsoft-practices-compositeweb-servicemissingexception-service/</guid>
		<description><![CDATA[Problem When working with WCSF (Web Client Software Factory) from Microsoft Patterns and Practice, it can be confusing to why core parts of the frame work throw service missing exceptions, such as: ISiteMapBuilderService and IAuthorizationService Microsoft.Practices.CompositeWeb.Interfaces.ISiteMapBuilderService is not available in the current context. Description: An unhandled exception occurred during the execution of the current web [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=62&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Problem</h3>
<p>When working with WCSF (Web Client Software Factory) from Microsoft Patterns and Practice, it can be confusing to why core parts of the frame work throw service missing exceptions, such as: ISiteMapBuilderService and IAuthorizationService </p>
<h4><i>Microsoft.Practices.CompositeWeb.Interfaces.ISiteMapBuilderService is not available in the current context.</i></h4>
<p><b>Description: </b>An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.     <br /><b>Exception Details: </b>Microsoft.Practices.CompositeWeb.ServiceMissingException: Service Microsoft.Practices.CompositeWeb.Interfaces.ISiteMapBuilderService is not available in the current context.     <br /><b>Source Error:</b> </p>
<p><code>An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code> </p>
<p><b>Stack Trace:</b></p>
<pre> [ServiceMissingException: Service Microsoft.Practices.CompositeWeb.Interfaces.ISiteMapBuilderService is not available in the current context.]</pre>
<pre>&#160;&#160; Microsoft.Practices.CompositeWeb.Collections.ServiceCollection.Get(Type serviceType, Boolean ensureExists) +377</pre>
<pre> . . . </pre>
<pre><a href="http://aero971.files.wordpress.com/2010/06/image.png"><img style="display:inline;border-width:0;" title="image" border="0" alt="image" src="http://aero971.files.wordpress.com/2010/06/image_thumb.png?w=644&#038;h=361" width="644" height="361" /></a> </pre>
<p>As usual, everything else from P&amp;P is really good, so it’s worth spending time to troubleshoot and sort these minor problems out.</p>
<h3>Solution</h3>
<p>To get round this problem, there are a couple of items which need changing.</p>
<p>The first part is to check the web.config files have the correct virtual path set in the &lt;Module /&gt; nodes. Further details on this have been blogged here:</p>
<p><a title="http://kiranpatils.wordpress.com/tag/wcsf/" href="http://kiranpatils.wordpress.com/tag/wcsf/">http://kiranpatils.wordpress.com/tag/wcsf/</a></p>
<p>Sometimes after an IIS RESET or restart, you need to ensure that the load order of modules is consistent and that any threading issues are avoided. This is done simply by ensuring that the ShellModuleInitializer Load Method loads services in a synchronized manner using lock(this).</p>
<p><font size="2"><font face="Courier New"><font color="#0000ff">public</font> <font color="#0000ff">class</font> <font color="#408080">ShellModuleInitializer</font>: <font color="#408080">ModuleInitializer</font></p>
<p>{</p>
<p>&#160;&#160;&#160; <font color="#0000ff">private</font> <font color="#408080">SiteMapBuilderService</font> _siteMapBuilderService;</p>
<p>&#160;&#160;&#160; <font color="#0000ff">private const string </font>AuthorizationSection = “compositeWeb/authorization”);</p>
<p></font></font><font face="Courier New"><font size="2">&#160;&#160;&#160; <font color="#0000ff">public override void </font>Load(CompositionContainer container) </p>
<p>&#160;&#160;&#160; {</p>
<p>&#160;&#160;&#160;&#160;&#160; //this locks the current instance of ShellModuleInitializer which is&#160; <br />&#160;&#160;&#160;&#160;&#160; //created by the framework, so you don’t need a static variable</font></p>
<p></font><font size="2" face="Courier New">&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">lock</font>(<font color="#0000ff">this</font>) </p>
<p>&#160;&#160;&#160;&#160;&#160; {</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <font color="#0000ff">base</font>.Load(container);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; AddGlobalServices(container.Parent.Services);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; AddModuleServices(container.Services);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; RegisterSiteMapInformation(container.Services.Get&lt;<font color="#408080">ISiteMapBuilderService</font>&gt;(true));</p>
<p>&#160;&#160;&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; }</p>
<p>}</font></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aero971.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aero971.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aero971.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aero971.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aero971.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aero971.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aero971.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aero971.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aero971.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aero971.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aero971.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aero971.wordpress.com/62/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aero971.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aero971.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=62&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aero971.wordpress.com/2010/06/19/microsoft-practices-compositeweb-servicemissingexception-service/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3df55ae284744fd6e678c1efb0ccab32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aero971</media:title>
		</media:content>

		<media:content url="http://aero971.files.wordpress.com/2010/06/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>ADO .Net Connection Pool Limit Reached</title>
		<link>http://aero971.wordpress.com/2009/11/18/ado-net-connection-pool-limit-reached/</link>
		<comments>http://aero971.wordpress.com/2009/11/18/ado-net-connection-pool-limit-reached/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 11:01:36 +0000</pubDate>
		<dc:creator>aero971</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aero971.wordpress.com/2009/11/18/ado-net-connection-pool-limit-reached/</guid>
		<description><![CDATA[When the number of threads ramp up quickly and make parallel connections to the database, you can start to see the following exception as connections are refused: Exception stack trace: Exception Source:&#160;&#160;&#160;&#160;&#160; System.Data Exception Type:&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.InvalidOperationException Exception Message:&#160;&#160;&#160;&#160; Timeout expired.&#160; The timeout period elapsed prior to obtaining a connection from the pool.&#160; This may have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=58&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When the number of threads ramp up quickly and make parallel connections to the database, you can start to see the following exception as connections are refused: </p>
<blockquote><p>Exception stack trace:      <br />Exception Source:&#160;&#160;&#160;&#160;&#160; System.Data      <br />Exception Type:&#160;&#160;&#160;&#160;&#160;&#160;&#160; System.InvalidOperationException      <br />Exception Message:&#160;&#160;&#160;&#160; Timeout expired.&#160; The timeout period elapsed prior to obtaining a connection from the pool.&#160; This may have occurred because all pooled connections were in use and max pool size was reached.      <br />Exception Target Site: GetConnection</p>
</blockquote>
<p>&#160;</p>
<p>Fortunately the solution is simple, you need to modify the connection string being passed to ADO / Enterprise Library Database block to include:</p>
<p><font color="#008000" face="Courier New">Min Pool Size=100;Max Pool Size=200</font></p>
<p>By default, these values are used:</p>
<p><font color="#008000" face="Courier New">Min Pool Size=0;Max Pool Size=100</font></p>
<p>As always, increase values slowly until the problems disappear as higher values for these will consume more resources on your server / client</p>
<p>Further reading:</p>
<p><a title="http://aspalliance.com/1099_Understanding_Connection_Pooling_in_NET.all" href="http://aspalliance.com/1099_Understanding_Connection_Pooling_in_NET.all">http://aspalliance.com/1099_Understanding_Connection_Pooling_in_NET.all</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aero971.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aero971.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aero971.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aero971.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aero971.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aero971.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aero971.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aero971.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aero971.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aero971.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aero971.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aero971.wordpress.com/58/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aero971.wordpress.com/58/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aero971.wordpress.com/58/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=58&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aero971.wordpress.com/2009/11/18/ado-net-connection-pool-limit-reached/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3df55ae284744fd6e678c1efb0ccab32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aero971</media:title>
		</media:content>
	</item>
		<item>
		<title>.Net Clean up tool</title>
		<link>http://aero971.wordpress.com/2009/11/13/net-clean-up-tool/</link>
		<comments>http://aero971.wordpress.com/2009/11/13/net-clean-up-tool/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 10:26:58 +0000</pubDate>
		<dc:creator>aero971</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aero971.wordpress.com/?p=56</guid>
		<description><![CDATA[Not something that comes to mind very often, but when a .Net 3.5 framework install fails on an end user&#8217;s PC, it can become a pressurised situation. The best way of avoiding failed installs is to run the .Net Clean up tool, which has been blogged about by various authors. A good one can be found [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=56&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Not something that comes to mind very often, but when a .Net 3.5 framework install fails on an end user&#8217;s PC, it can become a pressurised situation.</p>
<p>The best way of avoiding failed installs is to run the .Net Clean up tool, which has been blogged about by various authors. A good one can be found <a href="http://blogs.msdn.com/astebner/pages/8904493.aspx">here on MSDN</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aero971.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aero971.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aero971.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aero971.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aero971.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aero971.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aero971.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aero971.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aero971.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aero971.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aero971.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aero971.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aero971.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aero971.wordpress.com/56/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=56&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aero971.wordpress.com/2009/11/13/net-clean-up-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3df55ae284744fd6e678c1efb0ccab32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aero971</media:title>
		</media:content>
	</item>
		<item>
		<title>UI exception while running long background threads</title>
		<link>http://aero971.wordpress.com/2009/11/06/ui-exception-while-running-long-background-threads/</link>
		<comments>http://aero971.wordpress.com/2009/11/06/ui-exception-while-running-long-background-threads/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 13:19:38 +0000</pubDate>
		<dc:creator>aero971</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://aero971.wordpress.com/2009/11/06/ui-exception-while-running-long-background-threads/</guid>
		<description><![CDATA[While developing a multithreaded WPF application I got this “ContextSwitchDeadlock was detected” error. Additional error information: “The CLR has been unable to transition from COM context 0x1fafc8 to COM context 0x1fb138 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=55&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>While developing a multithreaded WPF application I got this “ContextSwitchDeadlock was detected” error. Additional error information:</p>
<p><a href="http://aero971.files.wordpress.com/2009/11/contextdeadlock.jpg"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="Context Deadlock" border="0" alt="Context Deadlock" src="http://aero971.files.wordpress.com/2009/11/contextdeadlock_thumb.jpg?w=457&#038;h=324" width="457" height="324" /></a> </p>
<p>“The CLR has been unable to transition from COM context 0x1fafc8 to COM context 0x1fb138 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.”</p>
<p>For this application, the main UI thread executes some business logic (BL) wrapped inside an assembly. The BL spawns of a number of background worker threads which fetch data and perform calculations. The UI thread which executes the BL needs to consolidate the results in each thread before returning control back to the user. </p>
<p>Thus, the UI thread is held in a loop until all of the background threads complete.</p>
<p><font face="Courier New"><font color="#0000ff">while</font>(isRunning())       <br />{      <br />&#160;&#160;&#160; System.Threading.<font color="#408080">Thread</font>.Sleep(1000);      <br />}</font></p>
<p>If this takes longer than 60 seconds, then the ContextSwitchDeadlock exception arises as no Window messages have been pumped.</p>
<p>Fortunately there is an easy fix – you can pump Window messages by using this call:</p>
<p><font face="Courier New">System.Threading.<font color="#408080">Thread</font>.CurrentThread.Join(1000);</font></p>
<p>Thus, for this specific problem, changing <font color="#408080">Thread</font>.Sleep to <font color="#408080">Thread</font>.CurrentThread.Join is sufficient to keep the application running without exceptions.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aero971.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aero971.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aero971.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aero971.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aero971.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aero971.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aero971.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aero971.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aero971.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aero971.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aero971.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aero971.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aero971.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aero971.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=55&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aero971.wordpress.com/2009/11/06/ui-exception-while-running-long-background-threads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3df55ae284744fd6e678c1efb0ccab32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aero971</media:title>
		</media:content>

		<media:content url="http://aero971.files.wordpress.com/2009/11/contextdeadlock_thumb.jpg" medium="image">
			<media:title type="html">Context Deadlock</media:title>
		</media:content>
	</item>
		<item>
		<title>WPFToolkit Grid formatting with dynamic columns</title>
		<link>http://aero971.wordpress.com/2009/07/06/wpftoolkit-grid-formatting-with-dynamic-columns/</link>
		<comments>http://aero971.wordpress.com/2009/07/06/wpftoolkit-grid-formatting-with-dynamic-columns/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 21:34:29 +0000</pubDate>
		<dc:creator>aero971</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPF Toolkit]]></category>

		<guid isPermaLink="false">http://aero971.wordpress.com/?p=50</guid>
		<description><![CDATA[After having spent a day looking into presentation options of the WPF Toolkit grid, this write-up may help some people save time on deciding the best path forwards. Overall, I would recommend the Microsoft WPFToolkit grid for most purposes. However, there are certain circumstances where this grid isn’t ready. This is what I intend to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=50&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>After having spent a day looking into presentation options of the WPF Toolkit grid, this write-up may help some people save time on deciding the best path forwards. Overall, I would recommend the Microsoft WPFToolkit grid for most purposes.</p>
<p>However, there are certain circumstances where this grid isn’t ready. This is what I intend to explain in this blog entry.</p>
<h3>Requirements</h3>
<p>For my current project, the primary requirements for the grid are listed below:</p>
<ul>
<li>Req1: Display information from a DataSet</li>
<li>Req2: Correct formatting of numbers and dates, e.g. two decimal places or thousand separator or proper dates, e.g. 01/04/2009</li>
<li>Req3: Columns are added dynamically at run time</li>
<li>Req4: Copy data into Excel</li>
</ul>
<h3>Req1: Display information from a DataSet</h3>
<p>This part is really easy, creating and binding the dataset works flawlessly in just a few line of code:</p>
<blockquote><p>//put some information in a DataTable</p>
<p>DataTable dt = new DataTable();</p>
<p>dt.Columns.Add(&#8220;Mon&#8221;, typeof(float));</p>
<p>dt.Columns.Add(&#8220;Tue&#8221;, typeof(float));</p>
<p>float flt = 10.001F;</p>
<p>for (int nLoop = 0; nLoop &lt; 10000; nLoop++)</p>
<p>{</p>
<p>  flt += 0.001F; // some increment to change values</p>
<p>  int nInt = Convert.ToInt32(flt) + nLoop + 1000;</p>
<p>  double dbl = (double)flt;</p>
<p>  dt.Rows.Add(flt + 1F, flt + 2F);</p>
<p>}</p>
<p> </p>
<p>// Binding the DataTable to the Grid – easy stuff!</p>
<p>dataGrid1.ItemsSource = dt;</p></blockquote>
<p>As with a previous blog, don’t forget to set the grid’s Virtualisation mode. Based on this above snippet, it’s straightforward to get things up and running quickly.</p>
<h3>Req2: Correct formatting</h3>
<p>Basically two approaches exist: XAML or code (C#). I tend to give preference to XAML and aim for less code intensive solutions</p>
<h4>XAML</h4>
<p><a href="http://aero971.files.wordpress.com/2009/07/image.png"><img style="display:inline;border-width:0;" title="image" src="http://aero971.files.wordpress.com/2009/07/image_thumb.png?w=644&#038;h=415" border="0" alt="image" width="644" height="415" /></a></p>
<p>Essentially this is creating a DataTemplate to allow the column to apply the StringFormat method. While this is good being done at a column level, this does need the Path attribute set in the Binding expression to work correctly. For fixed DataSets, this is not a problem – however, if you add / remove columns from the underlying DataSet at runtime, then you can’t set the Path and StringFormat values in XAML.</p>
<h4>Code</h4>
<p>The simplest way is to get a call back from the Grid via the AutoGeneratedColumns property and place code in the event handler e.g.</p>
<blockquote><p>AutoGeneratedColumns=&#8221;dataGrid1_AutoGeneratedColumns&#8221;</p></blockquote>
<p>The event handler lets you execute code for formatting each time after you bind the columns via ItemsSource</p>
<blockquote><p>//Change format as appropiate           <br />
foreach (DataGridTextColumn dgtc in dataGrid1.Columns)<br />
{<br />
  Style rightAlignStyle = new Style(typeof(DataGridCell));</p>
<p>  Setter setter = new Setter();<br />
  setter.Property = DataGridCell.HorizontalAlignmentProperty;<br />
  setter.Value = HorizontalAlignment.Right;<br />
  rightAlignStyle.Setters.Add(setter);</p>
<p>  dgtc.CellStyle = rightAlignStyle;</p>
<p>  //Depending on the column, set the format <br />
  dgtc.Binding.StringFormat = &#8220;{0:N0}&#8221;;</p>
<p>  dgtc.Binding.StringFormat = &#8220;{0:F2}&#8221;;<br />
}</p></blockquote>
<p>As you can see, 1 XAML line = several C# lines. A great article on styling the grid is XAML can be found at:</p>
<p><a href="http://blogs.msdn.com/jaimer/archive/2009/01/20/styling-microsoft-s-wpf-datagrid.aspx">http://blogs.msdn.com/jaimer/archive/2009/01/20/styling-microsoft-s-wpf-datagrid.aspx</a></p>
<p>In addition, a good list of those formats can be found at idunno.org: <a title="http://idunno.org/archive/2004/14/01/122.aspx" href="http://idunno.org/archive/2004/14/01/122.aspx">http://idunno.org/archive/2004/14/01/122.aspx</a></p>
<h3>Req3: Dynamic columns</h3>
<p>Here’s where thing start to break and get complicated. Adding columns to the DataTable and re-attaching to the DataGrid’s ItemsSource is straight forward – the grid even shows the new columns with no problem.</p>
<p>The problem is formatting of those columns.</p>
<p>In XAML, unless you know all of the columns beforehand and simply hide them, then this is difficult to achieve. This would also lead to lots of XAML code if you have many columns.</p>
<p>Thus, at this point, the code solution is looking more promising as you can simply switch the format in the AutoGeneratedColumns event handler.</p>
<h3>Req4: Copy to Excel</h3>
<h4>XAML</h4>
<p>Selecting the rows when XAML is used works really well – you could click on any text or any white space in the grid and that row was selected. However, cells which have formatting applied (via TextBlock or StringFormat method) don’t automatically copy over to Excel.</p>
<h4>Code</h4>
<p>When the code solution is used, the selection of rows dramatically goes down in user experience – if you select any white space, the row isn’t selected, you have to click on the actual text.</p>
<h3>Conclusion</h3>
<p>What would be really nice is for the grid to allow some simple programmatic access that formats cells readily and not have some aspect break! I have found a good alternative, but don’t want to bias vendors, so drop me a line if you want the results.</p>
<h3>Links</h3>
<p><a href="http://blogs.msdn.com/jaimer/archive/2009/01/20/styling-microsoft-s-wpf-datagrid.aspx">http://blogs.msdn.com/jaimer/archive/2009/01/20/styling-microsoft-s-wpf-datagrid.aspx</a></p>
<p><a href="http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx?msg=2883597">http://www.codeproject.com/KB/WPF/WPFDataGridExamples.aspx?msg=2883597</a></p>
<p><a href="http://sweux.com/blogs/smoura/index.php/wpf/2009/06/15/wpf-toolkit-datagrid-part-iv-templatecolumns-and-row-grouping/">http://sweux.com/blogs/smoura/index.php/wpf/2009/06/15/wpf-toolkit-datagrid-part-iv-templatecolumns-and-row-grouping/</a></p>
<p><a href="http://wpf.codeplex.com/Thread/View.aspx?ThreadId=61051">http://wpf.codeplex.com/Thread/View.aspx?ThreadId=61051</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aero971.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aero971.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aero971.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aero971.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aero971.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aero971.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aero971.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aero971.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aero971.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aero971.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aero971.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aero971.wordpress.com/50/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aero971.wordpress.com/50/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aero971.wordpress.com/50/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=50&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aero971.wordpress.com/2009/07/06/wpftoolkit-grid-formatting-with-dynamic-columns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3df55ae284744fd6e678c1efb0ccab32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aero971</media:title>
		</media:content>

		<media:content url="http://aero971.files.wordpress.com/2009/07/image_thumb.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF Custom UserControl errors in designer</title>
		<link>http://aero971.wordpress.com/2009/06/24/wpf-custom-usercontrol-errors-in-designer/</link>
		<comments>http://aero971.wordpress.com/2009/06/24/wpf-custom-usercontrol-errors-in-designer/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 22:15:55 +0000</pubDate>
		<dc:creator>aero971</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPF Toolkit]]></category>

		<guid isPermaLink="false">http://aero971.wordpress.com/2009/06/24/wpf-custom-usercontrol-errors-in-designer/</guid>
		<description><![CDATA[Problem It’s definitely worth mentioning a recent problem encountered during development. When a custom built user control was being rendered by the Visual Studio designer an exception was being thrown. Interestingly the application runs with no problems and the control functions normally. This is due to the fact that the control can’t determine who is [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=47&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Problem</h3>
<p>It’s definitely worth mentioning a recent problem encountered during development. When a custom built user control was being rendered by the Visual Studio designer an exception was being thrown. Interestingly the application runs with no problems and the control functions normally.</p>
<p>This is due to the fact that the control can’t determine who is the host – your application or the designer? </p>
<p>The control relied on the application configuration (app.config) being present and available for subsequent operations in the default constructor. Moving the code to an Loaded() event handler made no difference and designer exceptions were still thrown.</p>
<p>This means the designer is invoking both the default constructor and Loaded method (if available) – which is obvious when you think about it.</p>
<h3>Solution</h3>
<ul>
<li>Firstly put checks to see if all pre-requisites are available.
<ul>
<li>You may have to make the assumption that since the executable of the application is up and running, the config file must be present. Thus, if it’s not found by the control, exit the control’s constructor gracefully after a failed check </li>
</ul>
</li>
<li>If you are using Dependency Properties with the control (and you control the XAML file calling the control), you can place the offending code in the Set property method
<ul>
<li>A bit of care needs to be taken since the Dependency Property methods are static and you need access to the actual control instance </li>
<li>It’s good practice to have a call back handler for the property which was registered when the property was defined </li>
</ul>
</li>
</ul>
<p><a href="http://aero971.files.wordpress.com/2009/06/image3.png"><img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="image" border="0" alt="image" src="http://aero971.files.wordpress.com/2009/06/image_thumb3.png?w=404&#038;h=151" width="404" height="151" /></a> </p>
<ul>
<li>If possible create an overloaded constructor which takes parameters. This won’t get called by the designer and can be a safe haven. </li>
</ul>
<p><a href="http://aero971.files.wordpress.com/2009/06/image4.png"><img style="display:block;float:none;margin-left:auto;margin-right:auto;border-width:0;" title="image" border="0" alt="image" src="http://aero971.files.wordpress.com/2009/06/image_thumb4.png?w=454&#038;h=313" width="454" height="313" /></a> </p>
<h3>Links</h3>
<p><a title="http://msdn.microsoft.com/en-us/library/bb546934.aspx" href="http://msdn.microsoft.com/en-us/library/bb546934.aspx">http://msdn.microsoft.com/en-us/library/bb546934.aspx</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aero971.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aero971.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aero971.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aero971.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aero971.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aero971.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aero971.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aero971.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aero971.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aero971.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aero971.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aero971.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aero971.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aero971.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=47&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aero971.wordpress.com/2009/06/24/wpf-custom-usercontrol-errors-in-designer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3df55ae284744fd6e678c1efb0ccab32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aero971</media:title>
		</media:content>

		<media:content url="http://aero971.files.wordpress.com/2009/06/image_thumb3.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>

		<media:content url="http://aero971.files.wordpress.com/2009/06/image_thumb4.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
		<item>
		<title>Slow performing WPF Toolkit Grid</title>
		<link>http://aero971.wordpress.com/2009/06/24/slow-performing-wpf-toolkit-grid/</link>
		<comments>http://aero971.wordpress.com/2009/06/24/slow-performing-wpf-toolkit-grid/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 21:12:32 +0000</pubDate>
		<dc:creator>aero971</dc:creator>
				<category><![CDATA[WPF]]></category>
		<category><![CDATA[WPF Toolkit]]></category>

		<guid isPermaLink="false">http://aero971.wordpress.com/2009/06/24/slow-performing-wpf-toolkit-grid/</guid>
		<description><![CDATA[Problem While binding a large dataset to the WPF Toolkit Grid, the performance may appear to be very slow and unresponsive while the Grid renders the data. At my clients site, we experienced around a 20 seconds or so delay to render one view! The Data Access layer and business objects were timed to be [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=41&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h4>Problem</h4>
<p>While binding a large dataset to the WPF Toolkit Grid, the performance may appear to be very slow and unresponsive while the Grid renders the data. At my clients site, we experienced around a 20 seconds or so delay to render one view! The Data Access layer and business objects were timed to be only 2 seconds, thus the remainder was being eaten up by the Grid.</p>
<h4>Solution</h4>
<p>The WPF ListBox and ListView both suffer performance problems when many items are loaded, since they attempt to render all of the elements on load, including non-visible ones. The solution for them is to create a VirtualizingStackPanel. This works well and has been documented in several <a href="http://www.designerwpf.com/2008/02/12/listview-and-listbox-performance-issues/" target="_blank">blogs</a>.</p>
<p>For the Grid the solution is similar but all you need to do is set some attributes.</p>
<blockquote><p>EnableColumnVirtualization=&#8221;True&#8221;</p>
<p>EnableRowVirtualization=&#8221;True&#8221;</p></blockquote>
<p> </p>
<p><a href="http://aero971.files.wordpress.com/2009/06/image2.png"><img style="border-bottom:0;border-left:0;display:inline;border-top:0;border-right:0;" title="image" src="http://aero971.files.wordpress.com/2009/06/image_thumb2.png?w=404&#038;h=124" border="0" alt="image" width="404" height="124" /></a></p>
<p> </p>
<p>Note: In Visual Studio 2008, the RowVirtualisation may be ticked but not specified in the XAML. To ensure this gets used by the Grid, uncheck and then check RowVirtualisation .</p>
<p>After these two minor modifications, the Grid now renders in 4 seconds (remember 2 are lost on other layers)</p>
<h4>Appendix – Other Grids</h4>
<p>At the present moment, the WPF Toolkit Grid offered by Microsoft is fairly basic. when compared to <a href="http://www.syncfusion.com/products/wpf" target="_blank">SyncFusion</a> and <a href="http://xceed.com/Grid_WPF_Intro.html" target="_blank">Exceed</a>. In summary the Microsoft Grid lacks the UI wow factor that you expect from WPF. Key things to remember:</p>
<ol>
<li>The Microsoft grid truly follows Microsoft’s strategy around data binding and datasets, while leaving the programmatic APIs in a weak state. This said, I think this is a good thing and encourages best practice.</li>
<li>In this current deep dark recession, the Microsoft Grid is FREE! However, still be cautious over how long you spend on making the Grid look and feel the way you want as the development cost can rapidly diminish the savings</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/aero971.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/aero971.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/aero971.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/aero971.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/aero971.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/aero971.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/aero971.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/aero971.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/aero971.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/aero971.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/aero971.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/aero971.wordpress.com/41/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/aero971.wordpress.com/41/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/aero971.wordpress.com/41/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=aero971.wordpress.com&amp;blog=7526096&amp;post=41&amp;subd=aero971&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://aero971.wordpress.com/2009/06/24/slow-performing-wpf-toolkit-grid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/3df55ae284744fd6e678c1efb0ccab32?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">aero971</media:title>
		</media:content>

		<media:content url="http://aero971.files.wordpress.com/2009/06/image_thumb2.png" medium="image">
			<media:title type="html">image</media:title>
		</media:content>
	</item>
	</channel>
</rss>
