<?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>IT Weblog</title>
	<atom:link href="http://blog.klimczyk.pl/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.klimczyk.pl</link>
	<description>Software Development WebLog</description>
	<lastBuildDate>Mon, 20 Feb 2012 09:55:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Quotation of the day! 2012-02-20</title>
		<link>http://blog.klimczyk.pl/2012/02/20/quotation-of-the-day-2012-02-20/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quotation-of-the-day-2012-02-20</link>
		<comments>http://blog.klimczyk.pl/2012/02/20/quotation-of-the-day-2012-02-20/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 09:00:18 +0000</pubDate>
		<dc:creator>klimmass</dc:creator>
				<category><![CDATA[Quotes]]></category>
		<category><![CDATA[quotation]]></category>

		<guid isPermaLink="false">http://blog.klimczyk.pl/?p=123</guid>
		<description><![CDATA[Never trust a programmer in a suit. Tweet]]></description>
			<content:encoded><![CDATA[<p><em><strong>Never trust a programmer in a suit.</strong></em></p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://blog.klimczyk.pl/2012/02/20/quotation-of-the-day-2012-02-20/"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://blog.klimczyk.pl/2012/02/20/quotation-of-the-day-2012-02-20/" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://blog.klimczyk.pl/2012/02/20/quotation-of-the-day-2012-02-20/" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://blog.klimczyk.pl/2012/02/20/quotation-of-the-day-2012-02-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quotation of the day! 2012-02-10</title>
		<link>http://blog.klimczyk.pl/2012/02/10/quotation-of-the-day-2012-02-10/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quotation-of-the-day-2012-02-10</link>
		<comments>http://blog.klimczyk.pl/2012/02/10/quotation-of-the-day-2012-02-10/#comments</comments>
		<pubDate>Fri, 10 Feb 2012 10:34:29 +0000</pubDate>
		<dc:creator>klimmass</dc:creator>
				<category><![CDATA[Quotes]]></category>
		<category><![CDATA[quotation]]></category>

		<guid isPermaLink="false">http://blog.klimczyk.pl/?p=111</guid>
		<description><![CDATA[In the future, programming will be a basic course alongside reading and math. Tweet]]></description>
			<content:encoded><![CDATA[<p><em><strong>In the future, programming will be a basic course alongside reading and math.</strong></em></p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://blog.klimczyk.pl/2012/02/10/quotation-of-the-day-2012-02-10/"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://blog.klimczyk.pl/2012/02/10/quotation-of-the-day-2012-02-10/" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://blog.klimczyk.pl/2012/02/10/quotation-of-the-day-2012-02-10/" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://blog.klimczyk.pl/2012/02/10/quotation-of-the-day-2012-02-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Cult of Done Manifesto</title>
		<link>http://blog.klimczyk.pl/2012/02/05/the-cult-of-done-manifesto/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-cult-of-done-manifesto</link>
		<comments>http://blog.klimczyk.pl/2012/02/05/the-cult-of-done-manifesto/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 18:03:57 +0000</pubDate>
		<dc:creator>klimmass</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://blog.klimczyk.pl/?p=117</guid>
		<description><![CDATA[I hope this image is self-explaining Tweet]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.klimczyk.pl/wp-content/uploads/2012/02/cult-of-done-manifesto.jpg"><img class="aligncenter size-full wp-image-118" title="cult-of-done-manifesto" src="http://blog.klimczyk.pl/wp-content/uploads/2012/02/cult-of-done-manifesto.jpg" alt="" width="425" height="550" /></a></p>
<p>I hope this image is self-explaining <img src='http://blog.klimczyk.pl/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://blog.klimczyk.pl/2012/02/05/the-cult-of-done-manifesto/"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://blog.klimczyk.pl/2012/02/05/the-cult-of-done-manifesto/" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://blog.klimczyk.pl/2012/02/05/the-cult-of-done-manifesto/" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://blog.klimczyk.pl/2012/02/05/the-cult-of-done-manifesto/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quotation of the day!</title>
		<link>http://blog.klimczyk.pl/2012/02/03/quotation-of-the-day/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=quotation-of-the-day</link>
		<comments>http://blog.klimczyk.pl/2012/02/03/quotation-of-the-day/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 12:53:20 +0000</pubDate>
		<dc:creator>klimmass</dc:creator>
				<category><![CDATA[Quotes]]></category>
		<category><![CDATA[quotation]]></category>

		<guid isPermaLink="false">http://blog.klimczyk.pl/?p=108</guid>
		<description><![CDATA[Programming is like sex&#8230; one mistake and you support it forever! Tweet]]></description>
			<content:encoded><![CDATA[<p><em><strong>Programming is like sex&#8230; one mistake and you support it forever!</strong></em></p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://blog.klimczyk.pl/2012/02/03/quotation-of-the-day/"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://blog.klimczyk.pl/2012/02/03/quotation-of-the-day/" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://blog.klimczyk.pl/2012/02/03/quotation-of-the-day/" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://blog.klimczyk.pl/2012/02/03/quotation-of-the-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Programming Rules] Describe summited bugs in details</title>
		<link>http://blog.klimczyk.pl/2011/09/27/programming-rules-describe-summited-bugs-in-details/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=programming-rules-describe-summited-bugs-in-details</link>
		<comments>http://blog.klimczyk.pl/2011/09/27/programming-rules-describe-summited-bugs-in-details/#comments</comments>
		<pubDate>Tue, 27 Sep 2011 13:11:38 +0000</pubDate>
		<dc:creator>klimmass</dc:creator>
				<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://blog.klimczyk.pl/?p=72</guid>
		<description><![CDATA[&#8220;Some fields should be read-only&#8221;&#8230; Is this a good description? If you can read in other minds, then it&#8217;s ok&#8230;.. otherwise be more precise when submitting a bug report! The rule is: Describe the bug in as many details as &#8230;<p class="read-more"><a href="http://blog.klimczyk.pl/2011/09/27/programming-rules-describe-summited-bugs-in-details/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>&#8220;Some fields should be read-only&#8221;&#8230; Is this a good description? If you can read in other minds, then it&#8217;s ok&#8230;.. otherwise <strong>be more precise when submitting a bug report!</strong><br />
The rule is: Describe the bug in as many details as needed to be reproduced by software engineer. Attach some crash reports if possible. </p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://blog.klimczyk.pl/2011/09/27/programming-rules-describe-summited-bugs-in-details/"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://blog.klimczyk.pl/2011/09/27/programming-rules-describe-summited-bugs-in-details/" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://blog.klimczyk.pl/2011/09/27/programming-rules-describe-summited-bugs-in-details/" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://blog.klimczyk.pl/2011/09/27/programming-rules-describe-summited-bugs-in-details/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Showing IDataErrorInfo for NULL objects</title>
		<link>http://blog.klimczyk.pl/2011/09/24/showing-idataerrorinfo-for-null-objects/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=showing-idataerrorinfo-for-null-objects</link>
		<comments>http://blog.klimczyk.pl/2011/09/24/showing-idataerrorinfo-for-null-objects/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 11:50:04 +0000</pubDate>
		<dc:creator>klimmass</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://blog.klimczyk.pl/?p=3</guid>
		<description><![CDATA[WPF provides, fairly easy to implement, possibility to validate entered data and notify user when something is incorrect. An example is available in MSDN, so I will skip further explanation how does this work&#8230; Everything works like a charm till &#8230;<p class="read-more"><a href="http://blog.klimczyk.pl/2011/09/24/showing-idataerrorinfo-for-null-objects/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>WPF provides, fairly easy to implement, possibility to validate entered data and notify user when something is incorrect. An <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.idataerrorinfo%28v=vs.95%29.aspx" title="IDataErrorInfo example" target="_blank">example</a> is available in MSDN, so I will skip further explanation how does this work&#8230;</p>
<p><a href="http://blog.klimczyk.pl/wp-content/uploads/2011/09/screenshot.jpg"><img src="http://blog.klimczyk.pl/wp-content/uploads/2011/09/screenshot.jpg" alt="" title="screenshot" width="525" height="700" class="aligncenter size-full wp-image-82" /></a></p>
<p>Everything works like a charm till you validate data bounded to main object. For instance let&#8217;s examine code below:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> abstract <span style="color: #6666cc; font-weight: bold;">class</span> AbstractCity <span style="color: #008000;">:</span> ICity
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">string</span> name<span style="color: #008000;">;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> Country country<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Name
    <span style="color: #008000;">&#123;</span>
        get <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">return</span> name<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
        set
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>name <span style="color: #008000;">!=</span> value<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                name <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>PropertyChanged <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                    PropertyChanged<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span>, <span style="color: #008000;">new</span> PropertyChangedEventArgs<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Name&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">virtual</span> Country Country
    <span style="color: #008000;">&#123;</span>
        get
        <span style="color: #008000;">&#123;</span>
           <span style="color: #0600FF; font-weight: bold;">return</span> country<span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        set
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>country <span style="color: #008000;">!=</span> value<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
               country <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
               ExecutePropertyChanged<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Country&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#91;</span><span style="color: #6666cc; font-weight: bold;">string</span> columnName<span style="color: #008000;">&#93;</span>
    <span style="color: #008000;">&#123;</span>
        get
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">switch</span> <span style="color: #008000;">&#40;</span>columnName<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #666666;">&quot;Name&quot;</span><span style="color: #008000;">:</span>
                    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">IsNullOrWhiteSpace</span><span style="color: #008000;">&#40;</span>Name<span style="color: #008000;">&#41;</span> <span style="color: #008000;">?</span> <span style="color: #666666;">&quot;City name must be set&quot;</span> <span style="color: #008000;">:</span> <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">case</span> <span style="color: #666666;">&quot;Country&quot;</span><span style="color: #008000;">:</span>
                    <span style="color: #0600FF; font-weight: bold;">return</span> Country <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span> <span style="color: #008000;">?</span> <span style="color: #666666;">&quot;Country must be set&quot;</span> <span style="color: #008000;">:</span> <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">default</span><span style="color: #008000;">:</span>
                    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #6666cc; font-weight: bold;">String</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Error
    <span style="color: #008000;">&#123;</span>
        get <span style="color: #008000;">&#123;</span> <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">&#91;</span><span style="color: #666666;">&quot;Name&quot;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #6666cc; font-weight: bold;">void</span> ExecutePropertyChanged<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> propertyName<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>PropertyChanged <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            PropertyChanged<span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">this</span>, <span style="color: #008000;">new</span> PropertyChangedEventArgs<span style="color: #008000;">&#40;</span>propertyName<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">event</span> PropertyChangedEventHandler PropertyChanged<span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> CityNullCountry <span style="color: #008000;">:</span> AbstractCity <span style="color: #008000;">&#123;</span> <span style="color: #008000;">&#125;</span></pre></div></div>

<p>and binding in XAML:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>TextBox  Grid<span style="color: #008000;">.</span><span style="color: #0000FF;">Column</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;1&quot;</span> Grid<span style="color: #008000;">.</span><span style="color: #0000FF;">Row</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;0&quot;</span> Text<span style="color: #008000;">=</span><span style="color: #666666;">&quot;{Binding Path=City.Name, ValidatesOnDataErrors=True, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged}&quot;</span><span style="color: #008000;">/&gt;</span>
<span style="color: #008000;">&lt;</span>TextBox  Grid<span style="color: #008000;">.</span><span style="color: #0000FF;">Column</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;1&quot;</span> Grid<span style="color: #008000;">.</span><span style="color: #0000FF;">Row</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;1&quot;</span> HorizontalAlignment<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Left&quot;</span> Width<span style="color: #008000;">=</span><span style="color: #666666;">&quot;250&quot;</span> Text<span style="color: #008000;">=</span><span style="color: #666666;">&quot;{Binding Path=City.Country.Code, Mode=OneWay, ValidatesOnDataErrors=True, NotifyOnValidationError=True}&quot;</span> IsReadOnly<span style="color: #008000;">=</span><span style="color: #666666;">&quot;True&quot;</span><span style="color: #008000;">/&gt;</span>
<span style="color: #008000;">&lt;</span>ComboBox Grid<span style="color: #008000;">.</span><span style="color: #0000FF;">Column</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;1&quot;</span> Grid<span style="color: #008000;">.</span><span style="color: #0000FF;">Row</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;1&quot;</span> HorizontalAlignment<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Right&quot;</span> Width<span style="color: #008000;">=</span><span style="color: #666666;">&quot;100&quot;</span> SelectedItem<span style="color: #008000;">=</span><span style="color: #666666;">&quot;{Binding Path=City.Country}&quot;</span> ItemsSource<span style="color: #008000;">=</span><span style="color: #666666;">&quot;{Binding Path=Countries}&quot;</span> DisplayMemberPath<span style="color: #008000;">=</span><span style="color: #666666;">&quot;Code&quot;</span><span style="color: #008000;">/&gt;</span>
<span style="color: #008000;">&lt;</span>TextBox  Grid<span style="color: #008000;">.</span><span style="color: #0000FF;">Column</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;1&quot;</span> Grid<span style="color: #008000;">.</span><span style="color: #0000FF;">Row</span><span style="color: #008000;">=</span><span style="color: #666666;">&quot;2&quot;</span> Text<span style="color: #008000;">=</span><span style="color: #666666;">&quot;{Binding Path=City.Country.Name, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Mode=OneWay}&quot;</span> IsReadOnly<span style="color: #008000;">=</span><span style="color: #666666;">&quot;True&quot;</span><span style="color: #008000;">/&gt;</span></pre></div></div>

<p>in this code it is very easy validate and notify user when <strong>Name</strong> property in <strong>CityNullCountry</strong> object is NULL or empty. But there is no easy solution to validate <strong>City.Country.Name</strong> property. The reason is that Country object may not exists when City object is created.</p>
<p>So as up now we know that WPF needs Country class instance in order to validate it (using IDataErrorInfo in that class) and notify user when something is wrong. Some of you may ask, why I don&#8217;t check Country object in City class. The answer is simple. WPF validates bounded object and in that case it is Country object and it&#8217;s <strong>Name</strong> property. <strong>Text=&#8221;{Binding Path=City.Country.Name, ValidatesOnDataErrors=True, NotifyOnValidationError=True, Mode=OneWay}&#8221;</strong>. TextBox with such binding will check for IDataErrorInfo interface in Country class&#8230;. but Country object may be empty and nothing will be validated. User will be not aware of any errors at all.</p>
<p>So, my solution is fairly easy. I will simply provide an fake Country object when real object is NULL. Validation will run against my fake object and errors will popup in the user interface. One way to achieve that is to use Activator.CreateInstance() method. The whole mechanism implementation is showed below:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> CityNullIsDefaultCountry <span style="color: #008000;">:</span> AbstractCity
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> Country country<span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">protected</span> DefaultsTable defaults <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> DefaultsTable<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">override</span> Country Country
    <span style="color: #008000;">&#123;</span>
        get
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> defaults<span style="color: #008000;">.</span><span style="color: #0000FF;">GetObjectOrDefault</span><span style="color: #008000;">&#40;</span>country, <span style="color: #666666;">&quot;Country&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        set
        <span style="color: #008000;">&#123;</span>
            <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>country <span style="color: #008000;">!=</span> value<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">&#123;</span>
                country <span style="color: #008000;">=</span> value<span style="color: #008000;">;</span>
                ExecutePropertyChanged<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Country&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> DefaultsTable
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">readonly</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&gt;</span> defaults <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Dictionary<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">string</span>, <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
    <span style="color: #0600FF; font-weight: bold;">public</span> T GetObjectOrDefault<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span>T obj,  <span style="color: #6666cc; font-weight: bold;">string</span> propName<span style="color: #008000;">&#41;</span> <span style="color: #0600FF; font-weight: bold;">where</span> T <span style="color: #008000;">:</span> <span style="color: #6666cc; font-weight: bold;">class</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>obj <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> obj<span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>defaults<span style="color: #008000;">.</span><span style="color: #0000FF;">ContainsKey</span><span style="color: #008000;">&#40;</span>propName<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">&#40;</span>T<span style="color: #008000;">&#41;</span>defaults<span style="color: #008000;">&#91;</span>propName<span style="color: #008000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
        T defaultObject <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>T<span style="color: #008000;">&#41;</span>Activator<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateInstance</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">typeof</span><span style="color: #008000;">&#40;</span>T<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        defaults<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>propName, defaultObject<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">return</span> defaultObject<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p><strong>DefaultsTable defaults = new DefaultsTable();</strong> is responsible for providing fake object if it is NULL. When we set the Country property to some value, this value will be returned.</p>
<p>On of the challenges now is to determine what kind of object is returned when we access Country property on City class&#8230; I will discuss that somewhere in the future. In short: this can be determined by adding IsDefault flag and checking it.</p>
<p>Sample code for this example can by found <a href="http://blog.klimczyk.pl/wp-content/uploads/2011/09/IDataErrorInfoSample.zip" title="IDataErrorInfo sample code">here</a></p>
<p><a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fblog.klimczyk.pl%2f2011%2f09%2f24%2fshowing-idataerrorinfo-for-null-objects%2f"><img src="http%3A%2F%2Fwww.dotnetkicks.com%2FServices%2FImages%2FKickItImageGenerator.ashx%3Furl%3Dhttp%253a%252f%252fblog.klimczyk.pl%252f2011%252f09%252f24%252fshowing-idataerrorinfo-for-null-objects%252f" border="0" alt="kick it on DotNetKicks.com" /></a></p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://blog.klimczyk.pl/2011/09/24/showing-idataerrorinfo-for-null-objects/"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://blog.klimczyk.pl/2011/09/24/showing-idataerrorinfo-for-null-objects/" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://blog.klimczyk.pl/2011/09/24/showing-idataerrorinfo-for-null-objects/" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://blog.klimczyk.pl/2011/09/24/showing-idataerrorinfo-for-null-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[Programming Rules] Consider writing Unit Test for the bug you have fixed</title>
		<link>http://blog.klimczyk.pl/2011/09/18/programming-rules-consider-writing-unit-test-for-the-bug-you-have-fixed/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=programming-rules-consider-writing-unit-test-for-the-bug-you-have-fixed</link>
		<comments>http://blog.klimczyk.pl/2011/09/18/programming-rules-consider-writing-unit-test-for-the-bug-you-have-fixed/#comments</comments>
		<pubDate>Sun, 18 Sep 2011 17:54:30 +0000</pubDate>
		<dc:creator>klimmass</dc:creator>
				<category><![CDATA[Notes]]></category>
		<category><![CDATA[pr]]></category>

		<guid isPermaLink="false">http://blog.klimczyk.pl/?p=45</guid>
		<description><![CDATA[Remember! When you fix a bug and you feel that it may occur in the future, don&#8217;t waste time and write at least one Unit Test to check code against that bug. Tweet]]></description>
			<content:encoded><![CDATA[<p>Remember!<br />
When you fix a bug and you feel that it may occur in the future, don&#8217;t waste time and write at least one Unit Test to check code against that bug.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://blog.klimczyk.pl/2011/09/18/programming-rules-consider-writing-unit-test-for-the-bug-you-have-fixed/"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://blog.klimczyk.pl/2011/09/18/programming-rules-consider-writing-unit-test-for-the-bug-you-have-fixed/" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://blog.klimczyk.pl/2011/09/18/programming-rules-consider-writing-unit-test-for-the-bug-you-have-fixed/" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://blog.klimczyk.pl/2011/09/18/programming-rules-consider-writing-unit-test-for-the-bug-you-have-fixed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Logging Exception with StackTrace</title>
		<link>http://blog.klimczyk.pl/2011/09/15/logging-exception-with-stacktrace/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=logging-exception-with-stacktrace</link>
		<comments>http://blog.klimczyk.pl/2011/09/15/logging-exception-with-stacktrace/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 08:48:10 +0000</pubDate>
		<dc:creator>klimmass</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://blog.klimczyk.pl/?p=196</guid>
		<description><![CDATA[C# language has a great Exception Handling mechanism build-in. If something in not predictable during compile time developer can easily embed that piece of code in try{ (...) } catch{ (...) } and say &#8220;case closed&#8221;. Sample code taken from &#8230;<p class="read-more"><a href="http://blog.klimczyk.pl/2011/09/15/logging-exception-with-stacktrace/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>C# language has a great <a href="http://msdn.microsoft.com/en-us/library/ms173160.aspx" title="MSDN Exception Handling" target="_blank">Exception Handling</a> mechanism build-in. If something in not predictable during compile time developer can easily embed that piece of code in <code>try{ (...) } catch{ (...) }</code> and say &#8220;case closed&#8221;. Sample code taken from MSDN:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #6666cc; font-weight: bold;">class</span> ExceptionTest
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">double</span> SafeDivision<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">double</span> x, <span style="color: #6666cc; font-weight: bold;">double</span> y<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>y <span style="color: #008000;">==</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
            <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> <span style="color: #000000;">System</span><span style="color: #008000;">.</span><span style="color: #0000FF;">DivideByZeroException</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">return</span> x <span style="color: #008000;">/</span> y<span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">// Input for test purposes. Change the values to see</span>
        <span style="color: #008080; font-style: italic;">// exception handling behavior.</span>
        <span style="color: #6666cc; font-weight: bold;">double</span> a <span style="color: #008000;">=</span> <span style="color: #FF0000;">98</span>, b <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
        <span style="color: #6666cc; font-weight: bold;">double</span> result <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #0600FF; font-weight: bold;">try</span>
        <span style="color: #008000;">&#123;</span>
            result <span style="color: #008000;">=</span> SafeDivision<span style="color: #008000;">&#40;</span>a, b<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;{0} divided by {1} = {2}&quot;</span>, a, b, result<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">catch</span> <span style="color: #008000;">&#40;</span>DivideByZeroException e<span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span>
            Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Attempted divide by zero.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #008080; font-style: italic;">//Logger.Error(&quot;Attempted divide by zero.&quot;)</span>
        <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Works like a charm&#8230;. but this was very simple scenario. In more advanced scenarios we &#8211; developers &#8211; would like to get some more feedback, then just a logged information like:<i>Attempted divide by zero</i>. In business application a lot of other factors in involved. So it is necessary to have proper feedback information when something goes wrong. I&#8217;ve also faced that problem. Not sufficient information was provided with the bug description and we were unable to reproduce and fix the bug. </p>
<p>At that moment I&#8217;ve decided to do the obvious step. Serialize Exception object and save in separate log file <img src='http://blog.klimczyk.pl/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  </p>
<p>Code that realizes my idea is showed below:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> ExceptionXElement <span style="color: #008000;">:</span> XElement
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> ExceptionXElement<span style="color: #008000;">&#40;</span>Exception exception<span style="color: #008000;">&#41;</span>
            <span style="color: #008000;">:</span> <span style="color: #0600FF; font-weight: bold;">base</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> Func<span style="color: #008000;">&lt;</span>XElement<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">=&gt;</span>
            <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>exception <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    <span style="color: #0600FF; font-weight: bold;">throw</span> <span style="color: #008000;">new</span> ArgumentNullException<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;exception&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
                XElement root <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> XElement
                  <span style="color: #008000;">&#40;</span>exception<span style="color: #008000;">.</span><span style="color: #0000FF;">GetType</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>exception<span style="color: #008000;">.</span><span style="color: #0000FF;">Message</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    root<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> XElement<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Message&quot;</span>, exception<span style="color: #008000;">.</span><span style="color: #0000FF;">Message</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>exception<span style="color: #008000;">.</span><span style="color: #0000FF;">StackTrace</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    root<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span>
                    <span style="color: #008000;">&#40;</span>
                      <span style="color: #008000;">new</span> XElement<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;StackTrace&quot;</span>,
                        <span style="color: #0600FF; font-weight: bold;">from</span> frame <span style="color: #0600FF; font-weight: bold;">in</span> exception<span style="color: #008000;">.</span><span style="color: #0000FF;">StackTrace</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Split</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">'n'</span><span style="color: #008000;">&#41;</span>
                        let prettierFrame <span style="color: #008000;">=</span> frame<span style="color: #008000;">.</span><span style="color: #0000FF;">Substring</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">6</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Trim</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
                        <span style="color: #0600FF; font-weight: bold;">select</span> <span style="color: #008000;">new</span> XElement<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Frame&quot;</span>, prettierFrame<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>exception<span style="color: #008000;">.</span><span style="color: #0000FF;">Data</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Count</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    root<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span>
                    <span style="color: #008000;">&#40;</span>
                      <span style="color: #008000;">new</span> XElement<span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Data&quot;</span>,
                        <span style="color: #0600FF; font-weight: bold;">from</span> entry <span style="color: #0600FF; font-weight: bold;">in</span>
                            exception<span style="color: #008000;">.</span><span style="color: #0000FF;">Data</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Cast</span><span style="color: #008000;">&lt;</span>DictionaryEntry<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
                        let key <span style="color: #008000;">=</span> entry<span style="color: #008000;">.</span><span style="color: #0000FF;">Key</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
                        let value <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span>entry<span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span> <span style="color: #008000;">==</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">?</span>
                          <span style="color: #666666;">&quot;null&quot;</span> <span style="color: #008000;">:</span> entry<span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
                        <span style="color: #0600FF; font-weight: bold;">select</span> <span style="color: #008000;">new</span> XElement<span style="color: #008000;">&#40;</span>key, value<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>exception<span style="color: #008000;">.</span><span style="color: #0000FF;">InnerException</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
                <span style="color: #008000;">&#123;</span>
                    root<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span>
                    <span style="color: #008000;">&#40;</span>
                      <span style="color: #008000;">new</span> ExceptionXElement
                        <span style="color: #008000;">&#40;</span>exception<span style="color: #008000;">.</span><span style="color: #0000FF;">InnerException</span><span style="color: #008000;">&#41;</span>
                    <span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
&nbsp;
                <span style="color: #0600FF; font-weight: bold;">return</span> root<span style="color: #008000;">;</span>
            <span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
        <span style="color: #008000;">&#123;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #008000;">&#125;</span></pre></div></div>

<p>Code above is nicely wrapped in a function that saves XElement into single file.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://blog.klimczyk.pl/2011/09/15/logging-exception-with-stacktrace/"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://blog.klimczyk.pl/2011/09/15/logging-exception-with-stacktrace/" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://blog.klimczyk.pl/2011/09/15/logging-exception-with-stacktrace/" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://blog.klimczyk.pl/2011/09/15/logging-exception-with-stacktrace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iphone.klimczyk.pl website launch</title>
		<link>http://blog.klimczyk.pl/2011/08/03/iphone-klimczyk-pl-website-launch/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=iphone-klimczyk-pl-website-launch</link>
		<comments>http://blog.klimczyk.pl/2011/08/03/iphone-klimczyk-pl-website-launch/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 09:29:51 +0000</pubDate>
		<dc:creator>klimmass</dc:creator>
				<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://blog.klimczyk.pl/?p=224</guid>
		<description><![CDATA[I&#8217;m proudly to announce launch of my iphone games website. Website is located under: http://iphone.klimczyk.pl. We run this website together with my wife. If you are interested in some iphone games and apps please visit us there Tweet]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m proudly to announce launch of my iphone games  website. Website is located under: <a href="http://iphone.klimczyk.pl">http://iphone.klimczyk.pl</a>.<br />
We run this website together with my wife. </p>
<p>If you are interested in some iphone games and apps please visit us there <img src='http://blog.klimczyk.pl/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p><a href="http://iphone.klimczyk.pl"><img src="http://blog.klimczyk.pl/wp-content/uploads/2011/08/iphone-logo.png" alt="" title="logo" width="290" height="164" class="aligncenter size-full wp-image-227" /></a></p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://blog.klimczyk.pl/2011/08/03/iphone-klimczyk-pl-website-launch/"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://blog.klimczyk.pl/2011/08/03/iphone-klimczyk-pl-website-launch/" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://blog.klimczyk.pl/2011/08/03/iphone-klimczyk-pl-website-launch/" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://blog.klimczyk.pl/2011/08/03/iphone-klimczyk-pl-website-launch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using different .config file in .NET application</title>
		<link>http://blog.klimczyk.pl/2011/06/01/using-different-config-file-in-net-application/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-different-config-file-in-net-application</link>
		<comments>http://blog.klimczyk.pl/2011/06/01/using-different-config-file-in-net-application/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 08:03:15 +0000</pubDate>
		<dc:creator>klimmass</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://blog.klimczyk.pl/?p=216</guid>
		<description><![CDATA[In .NET world executable files using by default configuration file with special name. Microsoft has implemented following pattern: executable: program.exe and corresponding configuration file program.exe.config. In many scenarios this pattern is fitting well, but there are some cases when something &#8230;<p class="read-more"><a href="http://blog.klimczyk.pl/2011/06/01/using-different-config-file-in-net-application/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<p>In .NET world executable files using by default configuration file with special name. Microsoft has implemented following pattern: executable: program.exe and corresponding configuration file program.exe.config. In many scenarios this pattern is fitting well, but there are some cases when something else necessary. In my situation common configuration file was desirable! One configuration file with shared app settings, configuration strings, etc.</p>
<p>First solution I found was sharing AppSettings section between configuration files. This can be easily achieved by adding file attribute in appSettings tag. Like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008000;">&lt;</span>appSettings file<span style="color: #008000;">=</span>”commonSettings<span style="color: #008000;">.</span><span style="color: #0000FF;">config</span>”<span style="color: #008000;">&gt;</span></pre></div></div>

<p>But this doesn&#8217;t solve problem with connections string and custom sections&#8230; damn&#8230;</p>
<p>The solution that I end up with is:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">AppDomain<span style="color: #008000;">.</span><span style="color: #0000FF;">CurrentDomain</span><span style="color: #008000;">.</span><span style="color: #0000FF;">SetData</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;APP_CONFIG_FILE&quot;</span>, <span style="color: #666666;">@&quot;commonConfig.config&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
FieldInfo fiInit <span style="color: #008000;">=</span> <span style="color: #008000;">typeof</span><span style="color: #008000;">&#40;</span>ConfigurationManager<span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">GetField</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;s_initState&quot;</span>, BindingFlags<span style="color: #008000;">.</span><span style="color: #0000FF;">NonPublic</span> <span style="color: #008000;">|</span> BindingFlags<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">Static</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>fiInit <span style="color: #008000;">!=</span> <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
fiInit<span style="color: #008000;">.</span><span style="color: #0000FF;">SetValue</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">null</span>, <span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
ConfigurationManager<span style="color: #008000;">.</span><span style="color: #0000FF;">OpenExeConfiguration</span><span style="color: #008000;">&#40;</span>ConfigurationUserLevel<span style="color: #008000;">.</span><span style="color: #0000FF;">None</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>The AppDomain.CurrentDomain.SetData() method changes properties for current domain. So I simply change the APP_CONFIG_FILE property value to point to another config file. Rest of the code is necessary to re-read the configuration. With this solution I able to force .NET to use one configuration file between multiple executables. </p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://blog.klimczyk.pl/2011/06/01/using-different-config-file-in-net-application/"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://blog.klimczyk.pl/2011/06/01/using-different-config-file-in-net-application/" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://blog.klimczyk.pl/2011/06/01/using-different-config-file-in-net-application/" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://blog.klimczyk.pl/2011/06/01/using-different-config-file-in-net-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

