<?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>Ivan Krivyakov&#039;s Blog</title>
	<atom:link href="http://www.ikriv.com/blog/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.ikriv.com/blog</link>
	<description>Premature optimization is the root of all evil</description>
	<lastBuildDate>Wed, 01 Sep 2010 19:20:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>RedGate SQL Source Control</title>
		<link>http://www.ikriv.com/blog/?p=593</link>
		<comments>http://www.ikriv.com/blog/?p=593#comments</comments>
		<pubDate>Wed, 01 Sep 2010 19:20:44 +0000</pubDate>
		<dc:creator>Ivan</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.ikriv.com/blog/?p=593</guid>
		<description><![CDATA[Another tool I tried today. The idea is very cool, but I don&#8217;t like the fact that after I &#8220;link&#8221; the database I suddenly get gazillion changes to commit. I would think that &#8220;linking&#8221; means submitting current state to the DB. Also, it is not clear how to get rid of the users and roles [...]]]></description>
			<content:encoded><![CDATA[<p>Another tool I tried today. The idea is very cool, but I don&#8217;t like the fact that after I &#8220;link&#8221; the database I suddenly get gazillion changes to commit. I would think that &#8220;linking&#8221; means submitting current state to the DB.</p>
<p>Also, it is not clear how to get rid of the users and roles information, I don&#8217;t want it in source control.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ikriv.com/blog/?feed=rss2&amp;p=593</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RedGate SQL Compare</title>
		<link>http://www.ikriv.com/blog/?p=585</link>
		<comments>http://www.ikriv.com/blog/?p=585#comments</comments>
		<pubDate>Wed, 01 Sep 2010 19:19:29 +0000</pubDate>
		<dc:creator>Ivan</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.ikriv.com/blog/?p=585</guid>
		<description><![CDATA[As per this survey, RedGate SQL Compare is one of the best SQL comparison tools on the market. I downloaded a trial today. It works fast, produces safe synchronization scripts wrapped in transaction, and is generally cool. I did, however, stumble upon a stored procedure that it marked as &#8220;different&#8221;, although it could not show [...]]]></description>
			<content:encoded><![CDATA[<p>As per <a herf="https://nycspare5-lt/svn/RBMS/trunk/DB_Schema">this survey</a>, RedGate SQL Compare is one of the best SQL comparison tools on the market. I downloaded a trial today. It works fast, produces safe synchronization scripts wrapped in transaction, and is generally cool.</p>
<p>I did, however, stumble upon a stored procedure that it marked as &#8220;different&#8221;, although it could not show a single difference between two databases. Applying synchronization script once did not help, I need to apply it twice.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ikriv.com/blog/?feed=rss2&amp;p=585</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some anti-patterns I am experiencing first hand</title>
		<link>http://www.ikriv.com/blog/?p=575</link>
		<comments>http://www.ikriv.com/blog/?p=575#comments</comments>
		<pubDate>Tue, 31 Aug 2010 22:41:50 +0000</pubDate>
		<dc:creator>Ivan</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.ikriv.com/blog/?p=575</guid>
		<description><![CDATA[I am working on a rather interesting WPF project, which &#8220;implements&#8221; so many anti-patterns I had to blog about it. The most interesting thing about this project is that it was written by some of the best and smartest programmers I know, so the anti-patterns stem not so much from incompetence, but from general conditions [...]]]></description>
			<content:encoded><![CDATA[<p>I am working on a rather interesting WPF project, which &#8220;implements&#8221; so many anti-patterns I had to blog about it. The most interesting thing about this project is that it was written by some of the best and smartest programmers I know, so the anti-patterns stem not so much from incompetence, but from general conditions these programmers were forced to face and maybe general lazyness and go-with-the-flow.</p>
<p><b>1. Prototype-turned-project.</b> The code is simply not production quality. Logging is non-existent, errors are swallowed (as in &#8220;<code>try {...} catch {}</code>&#8220;), user facing messages have form of exception traces without headers and icons, database tables don&#8217;t have indexes, and so on, and so forth.</p>
<p>I was told that initially the customer gave the programmers a long list of features and a very short deadline (&#8220;demand the impossible if you want to get the maximum&#8221;). The results were good functionally, but code quality suffered. Of course, this is only one side of the story.</p>
<p><b>2. Cut-and-paste code.</b> Well, you know what I am talking about. When you have <code>SourceFilterButton</code> and <code>SourceFilterButtonA</code>, and everything in code has a regular version and an &#8220;A&#8221; version that differ ever so sligtly, you have a case of cut-and-paste programming.</p>
<p><b>3. Using generic <code>DataSets</code> all over the place</b>. This definitely takes the Object-Relational Mapping issues out of the way, because there are no objects. But then everything is just a glorified array, and the dependencies on data are implicit. E.g. by looking at</p>
<p><code>void ProcessScenario( DataRow dtScenario );</code></p>
<p>it is impossible to tell what columns this method expects to see in <code>dtScenario</code> and what types they should be. This dependency is implicit, and implicit dependencies are evil, because they are broken easily. This code also assumes that all information about a scenario can be coded in a single data row. If scenario becomes something more involved, e.g. it now includes an array of sub-scenarios with their own settings, this code will have to be heavily modified.</p>
<p>Also, as <code>DataTable</code> and <code>DataRow</code> become prevalent parameter types, they start to be used as a means of communication between different parts of the code, without ever going to the database:</p>
<p><code>
<pre>void ProcessScenario( DataRow row )
{
    int id = (int)row["ID"];
    double amount = (double)row["AMOUNT"];
    ...
}

void CallProcessScenario( double amount )
{
    DataRow row = scenarioTable.NewRow();
    row["ID"] = myId;
    row["AMOUNT"] = amount;
    ProcessScenario(row);
}</pre>
<p></code></p>
<p><code>
<pre>void ProcessScenario( DataRow scenario );</pre>
<p></code></p>
<p><b>4. Mixed business and presentation logic.</b></p>
<p>It is mauvais ton to pass data between two business logic units through UI. This makes writing unit tests impossible:</p>
<p><code>
<pre>moviesGrid.DataContext = SomeTable;
...
void LookupMovieById(string id)
{
    DataTable movies = (DataTable)moviesGrid.DataContext;
    ...
}</pre>
<p></code></p>
<p>The movies table should be stored in a model object and UI should not be involved:</p>
<p><code>
<pre>class Model
{
    public DataTable Movies { get; private set; }

    public void LookupMovieById( string id )
    {
         .... Movies ...
    }
}

class MyView
{
    Model _model;
    ...
    moviesGrid.DataContext = _model.Movies;
    ...
    _model.LookupMovieById(...);
}</pre>
<p></code></p>
<p><b>5. Pseudo Hungarian notation and abbreviations in variable names.</b> Names like <code>dtCurrVect</code> are evil. <code>currentVector</code> is better, <code>currentPriceHistory</code> is better still.</p>
<p><b>6. Big classes using #regions</b> Whenever you feel like you need to add a &#8220;#region&#8221; to your class, it probably has become too big. It should be split into smaller classes. I&#8217;ve seen a class responsible for three totally different (albeit) related screens, handling both business and presentation logic for all. Figuring out what depends on what was a nightmare.</p>
<p><b>7. Mixing data and UI concerns is evil</b> and makes business logic impossible to unit test. The data must be calculated in a manner totally segregated from UI, and then, if necessary, assigned as a data source to the UI object. WPF is property based, so exposing data sources as properties allows to use bindings in XAML and generally move closer to nirvana. E.g.</p>
<p><code>
<pre>void Bind( DataGrid grid, string filter )
{
   BindImpl(grid, fitler, field);
}

void BindImpl( DataGrid grid, string filter, string field )
{
   grid.ItemsSource = new DataView(... filter, ... field);
}

Bind(gird, "foo=3");</pre>
<p></code></p>
<p>is refactored to</p>
<p><code>
<pre>DataView GetData(string filter )
{
   return GetDataImpl(filter, field);
}

DataView GetDataImpl( string filter, string field )
{
   return new DataView(...);
}

grid.ItemsSource = GetData("foo=3");</code></pre>
<p>This way obtaining the data (business logic) is clearly separated from assigning this data to the grid (presentation).</p>
<p><b>8. Keeping logic in stored procedures.</b> Stored procedures are written in another language, they are difficult to debug, difficult to put in source control, difficult to refactor, and generally they belong to antoher world several light years away. If you need server-side processing, write a layer on top of your database (a web service perhaps?) and do it there. In my book stored procedures are warranted only in case of extreme performance problems, when they save tons of data going back and forth between the database and the web server.</p>
<p>In the course of this project, a significant piece of logic was moved from C# to a stored procedure (because it seemed more efficient that way), and then back, when we needed to add something a database cannot handle, like solving an equation using binary search. Each movement between C# and stored procedure required a lot of work and created a number of bugs.</p>
<p><b>CONCLUSION.</b> Never, ever let your prototypes to become product. If there is a remote chance of this happening, treat your prototype as the real thing, or you will be sorry later. Whenever a sales person approaches you asking to write "a little throw-away demo" know that they are most likely lying. They will never tell the customer this is a throwaway, and if they succeed in selling that demo, the customer will assume it's already a product, and will demand new features, that you will be pressed to deliver ASAP. So, you have a good chance to get stuck with that "throw-away demo" for a long time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ikriv.com/blog/?feed=rss2&amp;p=575</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Can&#8217;t have a binding to binding</title>
		<link>http://www.ikriv.com/blog/?p=581</link>
		<comments>http://www.ikriv.com/blog/?p=581#comments</comments>
		<pubDate>Wed, 25 Aug 2010 03:07:04 +0000</pubDate>
		<dc:creator>Ivan</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming & Admin]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.ikriv.com/blog/?p=581</guid>
		<description><![CDATA[Let&#8217;s say we want to display a list of countries, and depending on the user input we want to show either the capital city, population, or the language spoken in the country alongside the country name, like in the application below: The only way to achieve that is to change binding in code. You cannot [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s say we want to display a list of countries, and depending on the user input we want to show either the capital city, population, or the language spoken in the country alongside the country name, like in the application below:</p>
<p><a href="http://www.ikriv.com/blog/wp-content/uploads/2010/08/DynamicBinding.png"><img src="http://www.ikriv.com/blog/wp-content/uploads/2010/08/DynamicBinding.png" alt="Dynamic binding screen shot" title="DynamicBinding" width="525" height="350" class="alignnone size-full wp-image-582" /></a></p>
<p>The only way to achieve that is to change binding in code. You cannot have something like</p>
<p><code>&lt;Binding Path="{Binding SelectedField}" /&gt;</code></p>
<p>because <code>Path</code> is not a dependency property. <img src='http://www.ikriv.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ikriv.com/blog/?feed=rss2&amp;p=581</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPF: Merged dictionary parser depends on XML attribute order</title>
		<link>http://www.ikriv.com/blog/?p=543</link>
		<comments>http://www.ikriv.com/blog/?p=543#comments</comments>
		<pubDate>Fri, 13 Aug 2010 19:29:09 +0000</pubDate>
		<dc:creator>Ivan</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming & Admin]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.ikriv.com/blog/?p=543</guid>
		<description><![CDATA[Does attribute order in XAML matter? It should not, but sometimes it does. The following XAML compiles, but blows up at runtime with &#8220;Item has already been added&#8221; exception, both in .NET 3.5 and .NET 4.0: &#60;Window x:Class="MergedDictionaryKeyPosition.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"&#62; &#60;Window.Resources&#62; &#60;ResourceDictionary&#62; &#60;ResourceDictionary.MergedDictionaries&#62; &#60;ResourceDictionary&#62; &#60;Style TargetType="Button" x:Key="foo" /&#62; &#60;Style TargetType="Button" x:Key="bar" /&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Does attribute order in XAML matter? It should not, but sometimes it does. The following XAML compiles, but blows up at runtime with &#8220;<code>Item has already been added</code>&#8221; exception, both in .NET 3.5 and .NET 4.0:</p>
<pre><code>&lt;Window x:Class="MergedDictionaryKeyPosition.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300"&gt;
  &lt;Window.Resources&gt;
    &lt;ResourceDictionary&gt;
        <b><font color="red">&lt;ResourceDictionary.MergedDictionaries&gt;
            &lt;ResourceDictionary&gt;
                &lt;Style TargetType="Button" x:Key="foo" /&gt;
                &lt;Style TargetType="Button" x:Key="bar" /&gt;
            &lt;/ResourceDictionary&gt;
        &lt;/ResourceDictionary.MergedDictionaries&gt; </font></b>
   &lt;/ResourceDictionary&gt;
  &lt;/Window.Resources&gt;

  &lt;TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Hello" /&gt;
&lt;/Window&gt;</code></pre>
<p>What&#8217;s wrong with it? <span id="more-543"></span><code>Style</code> elements in resource dictionaries have a special feature: if explicit key is not present, <code>TargetType</code> (in this case <code>typeof(Button)</code>) will be used as a key. This allows overriding default style for a control type. It seems that in this case XAML parser sees <code>TargetType</code> first and ignores the explicit key, thus creating a conflict &#8211; it attempts to add two styles under the same key &#8220;Button&#8221;. </p>
<p>If I put <code>x:Key</code> in front of target type, everything works:</p>
<pre><code>&lt;Window x:Class="MergedDictionaryKeyPosition.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300"&gt;
  &lt;Window.Resources&gt;
    &lt;ResourceDictionary&gt;
        &lt;ResourceDictionary.MergedDictionaries&gt;
            &lt;ResourceDictionary&gt;
                &lt;Style <font color="red"><b>x:Key="foo" TargetType="Button"</b></font> /&gt;
                &lt;Style <font color="red"><b>x:Key="bar" TargetType="Button"</b></font> /&gt;
            &lt;/ResourceDictionary&gt;
        &lt;/ResourceDictionary.MergedDictionaries&gt;
    &lt;/ResourceDictionary&gt;
  &lt;/Window.Resources&gt;

  &lt;TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Hello" /&gt;
&lt;/Window&gt;</code></pre>
<p>This rule seems to apply only to merged resource dictionaries. For standalone dictionaries it is OK to have the key after the target type. The following XAML works:</p>
<pre><code>&lt;Window x:Class="MergedDictionaryKeyPosition.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300"&gt;
  &lt;Window.Resources&gt;
    <b><font color="red">&lt;ResourceDictionary&gt;
        &lt;Style TargetType="Button" x:Key="foo" /&gt;
        &lt;Style TargetType="Button" x:Key="bar" /&gt;
    &lt;/ResourceDictionary&gt;</font></b>
  &lt;/Window.Resources&gt;

  &lt;TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Hello" /&gt;
&lt;/Window&gt;</code></pre>
<p>as does this one:</p>
<pre><code>&lt;Window x:Class="MergedDictionaryKeyPosition.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300"&gt;
  <b><font color="red">&lt;Window.Resources&gt;
     &lt;Style TargetType="Button" x:Key="foo" /&gt;
     &lt;Style TargetType="Button" x:Key="bar" /&gt;
  &lt;/Window.Resources&gt;</font></b>

  &lt;TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="Hello" /&gt;
&lt;/Window&gt;</code></pre>
<p>I am not sure why merged resource dictionaries parser is different from regular resource dictionary parser. Also, the stack trace for the exception is quite different between .NET 3.5 and .NET 4.0, so this code must have been reworked, but the error is exactly the same in both cases. I will post this on MSDN forum and see whether Microsoft has an answer. </p>
<p><code>&lt;rant&gt;</code>Unfortunately, from previous experience I know that such things are rarely fixed, typical scenario being something like &#8220;oh, resource dictionaries are obsolete now, in .NET 5 they are replaced with hashed foobars&#8221;. <img src='http://www.ikriv.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <code>&lt;/rant&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ikriv.com/blog/?feed=rss2&amp;p=543</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClickOnce Publisher WTF</title>
		<link>http://www.ikriv.com/blog/?p=533</link>
		<comments>http://www.ikriv.com/blog/?p=533#comments</comments>
		<pubDate>Thu, 12 Aug 2010 13:55:19 +0000</pubDate>
		<dc:creator>Ivan</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.ikriv.com/blog/?p=533</guid>
		<description><![CDATA[Today ClickOnce publisher came up with this message: &#8220;The application platform does not match the existing application on the server. Do you want to overwrite it?&#8221; What is the platform on the server? What am I replacing it with? This would be one line of code to add this information. But alas, I am left [...]]]></description>
			<content:encoded><![CDATA[<p>Today ClickOnce publisher came up with this message:<br />
<font color="blue">&#8220;The application platform does not match the existing application on the server. Do you want to overwrite it?&#8221;</font></p>
<p>What is the platform on the server? What am I replacing it with? This would be one line of code to add this information. But alas, I am left in the dark about it. Someone saved 5 minutes while coding. It costs hundreds of programmings hours of grief.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ikriv.com/blog/?feed=rss2&amp;p=533</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Database proramming rant</title>
		<link>http://www.ikriv.com/blog/?p=526</link>
		<comments>http://www.ikriv.com/blog/?p=526#comments</comments>
		<pubDate>Sun, 08 Aug 2010 15:49:32 +0000</pubDate>
		<dc:creator>Ivan</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming & Admin]]></category>

		<guid isPermaLink="false">http://www.ikriv.com/blog/?p=526</guid>
		<description><![CDATA[After a long while I am back to dealing with databases directly from ADO.NET. Guys, this is ridiculous. Any serious library designed like that would be heckled. This is what I found (or rediscovered) in the course of one day: if your SqlConnection uses SQL Server local transaction, you must manually transfer the transaction to [...]]]></description>
			<content:encoded><![CDATA[<p>After a long while I am back to dealing with databases directly from ADO.NET. Guys, this is ridiculous. Any serious library designed like that would be heckled. This is what I found (or rediscovered) in the course of one day:</p>
<ul>
<li>if your <code>SqlConnection</code> uses SQL Server local transaction,  you must manually transfer the transaction to the <code>SqlCommand</code>s you use. If you don&#8217;t, you get <code>InvalidOperationException</code>.
<p><font color="red">ExecuteNonQuery requires the command to have a transaction when the connection assigned to the command is in a pending local transaction. The Transaction property of the command has not been initialized</font>.</p>
<p>You are on your own in determining what transaction that is: <code>SqlConnection</code> has this information, but it won&#8217;t tell you. More details <a href="http://stackoverflow.com/questions/417024/can-i-get-a-reference-to-a-pending-transaction-from-a-sqlconnection-object">here</a>.
</li>
<li>If you have a typed <code>DataSet</code> with a number of tables connected by relationship, there is no easy way to fill it from the database all at once. E.g. if I have customers and orders, there is no way to get &#8220;all orders for customers with State=&#8217;OK&#8217;&#8221; into the dataset. If you write a JOIN query, it will create one table, and the dataset won&#8217;t convert it into multiple tables. You can use OleDB proprietary SHAPE queries, but a) this is not standard SQL, and b) you get some weird table names, so I could not make it to work as well.
<p>So, you can build a relational structure in memory, but you cannot copy data from DB. The best you can do is filling the tables one by one. Ridiculous.</li>
<li><code>SqlDataAdapter</code> won&#8217;t automatically initialize insert, update, and delete commands when given the SELECT command. You must use <code>SqlCommandBuilder</code> object, which implicitly modifies the underlying adapter. Looks very weird.
<p>If their point was separation of concerns, then why the command builder cannot do it without the data adapter? Just take command text and return <code>SqlCommand</code>. More often than not, I do want the commands built if that&#8217;s possible. I would either have the adapter build the commands by default (which can be turned off if not desired), or at least have some adapter factory object.</li>
<li>If you use <code>SqlDataAdapter</code> to add new rows with identity columns, there is no way to get resulting identity values back. The only thing I found short of writing SQL by hand is to build the insert command, steal its text, append something like &#8220;; SELECT SCOPE_IDENTITY();&#8221; to it, and then execute it by hand, bypassing the adapter.</li>
<p>Bottom line: ouch. So much time spent on problems that simply should not be there in a decently designed system.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ikriv.com/blog/?feed=rss2&amp;p=526</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VS 2008 unit test host cannot run tests in one thread</title>
		<link>http://www.ikriv.com/blog/?p=524</link>
		<comments>http://www.ikriv.com/blog/?p=524#comments</comments>
		<pubDate>Tue, 06 Jul 2010 15:02:20 +0000</pubDate>
		<dc:creator>Ivan</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.ikriv.com/blog/?p=524</guid>
		<description><![CDATA[Our UI code is single threaded and UI classes use some shared static data. They work just fine, but the unit tests sometimes fail. Investigation led to threading issues. Visual Studio unconditionally runs tests in multiple threads simultaneously, and apparently there is no way to tell it not to do that. http://social.msdn.microsoft.com/Forums/en-US/vstswebtest/thread/4cdd4668-d99c-4699-8e1c-b775498593e7]]></description>
			<content:encoded><![CDATA[<p>Our UI code is single threaded and UI classes use some shared static data. They work just fine, but the unit tests sometimes fail. Investigation led to threading issues. Visual Studio unconditionally runs tests in multiple threads simultaneously, and apparently there is no way to tell it not to do that.</p>
<p>http://social.msdn.microsoft.com/Forums/en-US/vstswebtest/thread/4cdd4668-d99c-4699-8e1c-b775498593e7</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ikriv.com/blog/?feed=rss2&amp;p=524</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WPF: Is clone of Freezable frozen?</title>
		<link>http://www.ikriv.com/blog/?p=518</link>
		<comments>http://www.ikriv.com/blog/?p=518#comments</comments>
		<pubDate>Thu, 01 Jul 2010 14:36:54 +0000</pubDate>
		<dc:creator>Ivan</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.ikriv.com/blog/?p=518</guid>
		<description><![CDATA[WPF defines a Freezable type that is a base class for &#8220;almost immutable&#8221; objects. They can be setup in read/write mode and then &#8220;frozen&#8221; which makes them immutable and thread safe. Freezables are also cloneable. If I make a clone of a Freezable, will it be frozen? Fortunately, it won&#8217;t, so I can modify the [...]]]></description>
			<content:encoded><![CDATA[<p>WPF defines a <a href="http://msdn.microsoft.com/en-us/library/system.windows.freezable.aspx"><code>Freezable</code></a> type that is a base class for &#8220;almost immutable&#8221; objects. They can be setup in read/write mode and then &#8220;frozen&#8221; which makes them immutable and thread safe.</p>
<p>Freezables are also cloneable. If I make a clone of a Freezable, will it be frozen? Fortunately, it won&#8217;t, so I can modify the clone at will, and then freeze it if necessary. Here&#8217;s the passing unit test that proves that:</p>
<pre><code>
   [TestMethod]
   public void ClonedFreezableIsNotFrozen()
   {
      var brush = new SolidColorBrush(Colors.Red);
      brush.Freeze();
      var clone = brush.Clone();
      Assert.IsFalse(clone.IsFrozen);
   }
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ikriv.com/blog/?feed=rss2&amp;p=518</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>XSLT and Microsoft.NET</title>
		<link>http://www.ikriv.com/blog/?p=513</link>
		<comments>http://www.ikriv.com/blog/?p=513#comments</comments>
		<pubDate>Tue, 29 Jun 2010 18:28:08 +0000</pubDate>
		<dc:creator>Ivan</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.ikriv.com/blog/?p=513</guid>
		<description><![CDATA[While working on XML serializers I wandered into the XSLT land. It turned out that XSLT support in .NET is not stellar. Well, you may already know that, but it is new to me. First, only XSLT 1.0 is supported. It is useful for simple stuff, but even an iteration over a list of known [...]]]></description>
			<content:encoded><![CDATA[<p>While working on XML serializers I wandered into the XSLT land. It turned out that XSLT support in .NET is not stellar. Well, you may already know that, but it is new to me. First, only XSLT 1.0 is supported. It is useful for simple stuff, but even an iteration over a list of known values is difficult. There are two classes for XSLT in .NET: an obsolete class <code>XsltTransform</code> and a newer <code>XsltCompiledTransform</code>. Both of them are XSLT 1.0, the latter been allegedly faster and more secure (read: more items disabled). E.g. you cannot use <code>document()</code> function by default. Overall, I am disappointed. I wanted to use XSLT for simple things like show summary and results of XML serialization calls, and it turns out I have to use XSLT 2.0 (distinct-values) or non-standard stuff like node-set for even the simplest things.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ikriv.com/blog/?feed=rss2&amp;p=513</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
