<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Fiberglass flowers</title>
	
	<link>http://victorsergienko.com</link>
	<description>Software design and development: OOD, C++, .NET, Java, a little this and that</description>
	<pubDate>Thu, 20 Nov 2008 15:41:18 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/FiberglassFlowers" type="application/rss+xml" /><item>
		<title>“Project Dependencies” of Visual Studio 2008 broken in MSBuild</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/459679754/</link>
		<comments>http://victorsergienko.com/project-dependencies-of-visual-studio-2008-broken-in-msbuild/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 15:37:37 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[blog]]></category>

		<category><![CDATA[MSBuild]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=70</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/project-dependencies-of-visual-studio-2008-broken-in-msbuild/&t=&#8220;Project Dependencies&#8221; of Visual Studio 2008 broken in MSBuild&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Just dealt with another Visual Studio 2008 &#8220;feature&#8221;.</p>
<p>You can specify all the necessary &#8220;Project Dependencies&#8221; in Visual Studio, but will get &#8220;<em><strong>CSC : error CS0006: Metadata file FooBar.dll could not be found</strong></em>&#8220;. Even if your csproj files have correct references to other solution projects, <strong>msbuild will fail</strong>.<br />
Maybe it appears only if project output path is outside of project directory.</p>
<p>It appears that Visual Studio keeps the dependencies in two ways, only one of which is read by MSBuild. I see that because I still can specify dependencies in GUI, copy solution to other machine and build it with VS in correct order.</p>
<p>Not with MSBuild.</p>
<p>The data needed by MSBuild is a &#8220;<code>ProjectSection(ProjectDependencies) = postProject</code>&#8221; section of SLN file. Like this:</p>
<p><span id="more-70"></span>
<pre><code>Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{<strong>F0E0541E-F17D-430B-97C4-93ADF0DD284E</strong>}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
	ProjectSection(ProjectDependencies) = postProject
		{<strong>F0E0541E-F17D-430B-97C4-93ADF0DD284E</strong>} = {<strong>F0E0541E-F17D-430B-97C4-93ADF0DD284E</strong>}
	EndProjectSection
EndProject</code></pre>
<p>Note where to take the GUID of a referenced project.<br />
If you create this section by hand, your project will build.</p>
<p>Not too much fun, if you have over 20 projects, where you can have up to 190 project dependencies&#8230; Have fun.</p>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/project-dependencies-of-visual-studio-2008-broken-in-msbuild/&t=&#8220;Project Dependencies&#8221; of Visual Studio 2008 broken in MSBuild&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Just dealt with another Visual Studio 2008 &#8220;feature&#8221;.</p>
<p>You can specify all the necessary &#8220;Project Dependencies&#8221; in Visual Studio, but will get &#8220;<em><strong>CSC : error CS0006: Metadata file FooBar.dll could not be found</strong></em>&#8220;. Even if your csproj files have correct references to other solution projects, <strong>msbuild will fail</strong>.<br />
Maybe it appears only if project output path is outside of project directory.</p>
<p>It appears that Visual Studio keeps the dependencies in two ways, only one of which is read by MSBuild. I see that because I still can specify dependencies in GUI, copy solution to other machine and build it with VS in correct order.</p>
<p>Not with MSBuild.</p>
<p>The data needed by MSBuild is a &#8220;<code>ProjectSection(ProjectDependencies) = postProject</code>&#8221; section of SLN file. Like this:</p>
<p><span id="more-70"></span>
<pre><code>Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{<strong>F0E0541E-F17D-430B-97C4-93ADF0DD284E</strong>}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
	ProjectSection(ProjectDependencies) = postProject
		{<strong>F0E0541E-F17D-430B-97C4-93ADF0DD284E</strong>} = {<strong>F0E0541E-F17D-430B-97C4-93ADF0DD284E</strong>}
	EndProjectSection
EndProject</code></pre>
<p>Note where to take the GUID of a referenced project.<br />
If you create this section by hand, your project will build.</p>
<p>Not too much fun, if you have over 20 projects, where you can have up to 190 project dependencies&#8230; Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/project-dependencies-of-visual-studio-2008-broken-in-msbuild/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/project-dependencies-of-visual-studio-2008-broken-in-msbuild/</feedburner:origLink></item>
		<item>
		<title>Algorithmic quiz: check a 3-braces expression</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/429403318/</link>
		<comments>http://victorsergienko.com/algorithmic-quiz-check-braces/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 08:04:24 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[blog]]></category>

		<category><![CDATA[quiz]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=61</guid>
		<description><![CDATA[I just won a bet for $10 by solving a quiz:
Check the correctness of a braces, brackets and parentheses sequence. The solution should be of linear complexity (to say more, it's 1-pass).
It's basically solved in 15 lines, all others being auxiliary. Can you reproduce the algorithm?]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/algorithmic-quiz-check-braces/&t=Algorithmic quiz: check a 3-braces expression&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>I just won a bet for $10 by solving a quiz:</p>
<p>Check the correctness of a braces, brackets and parentheses sequence. The solution should be of linear complexity (to say more, it&#8217;s 1-pass).</p>
<p>For instance, these expressions are correct: &#8220;()&#8221;, &#8220;()()[]&#8220;, &#8220;([][][]{})&#8221;, &#8220;([])()[]&#8220;, and these are not: &#8220;][", "())(", "(()".</p>
<p><img class="alignnone wp-image-64" style="border-width:5px;" title="Ten dollars" src="http://victorsergienko.com/wp-content/uploads/s_ten_dollars_2.jpg" alt="Ten dollars" width="250" height="188" /></p>
<p>It's basically solved in 15 lines, all others being auxiliary. Can you reproduce the algorithm?</p>
<p>The solution follows.<br />
<span id="more-61"></span></p>
<pre style="color:#000000;background:#ffffff;"><span style="font-weight: bold; color: #800000;">import</span><span style="color: #004a43;"> java</span><span style="color: #808030;">.</span><span style="color: #004a43;">security</span><span style="color: #808030;">.</span><span style="color: #004a43;">InvalidParameterException</span><span style="color: #800080;">;</span>
<span style="font-weight: bold; color: #800000;">import</span><span style="color: #004a43;"> java</span><span style="color: #808030;">.</span><span style="color: #004a43;">util</span><span style="color: #808030;">.</span><span style="color: #004a43;">Stack</span><span style="color: #800080;">;</span>

<span style="font-weight: bold; color: #800000;">public</span> <span style="font-weight: bold; color: #800000;">class</span> Braces
<span style="color: #800080;">{</span>
    <span style="font-weight: bold; color: #800000;">private</span> <span style="font-weight: bold; color: #800000;">static</span> <span style="color: #bb7977;">boolean</span> isClosing<span style="color: #808030;">(</span><span style="color: #bb7977;">char</span> c<span style="color: #808030;">)</span>
    <span style="color: #800080;">{</span>
        <span style="font-weight: bold; color: #800000;">return</span> c <span style="color: #808030;">=</span><span style="color: #808030;">=</span> <span style="color: #0000e6;">')'</span> <span style="color: #808030;">|</span><span style="color: #808030;">|</span> c <span style="color: #808030;">=</span><span style="color: #808030;">=</span> <span style="color: #0000e6;">'}'</span> <span style="color: #808030;">|</span><span style="color: #808030;">|</span> c <span style="color: #808030;">=</span><span style="color: #808030;">=</span> <span style="color: #0000e6;">']'</span><span style="color: #800080;">;</span>
    <span style="color: #800080;">}</span>

    <span style="font-weight: bold; color: #800000;">private</span> <span style="font-weight: bold; color: #800000;">static</span> <span style="color: #bb7977;">boolean</span> isOpening<span style="color: #808030;">(</span><span style="color: #bb7977;">char</span> c<span style="color: #808030;">)</span>
    <span style="color: #800080;">{</span>
        <span style="font-weight: bold; color: #800000;">return</span> c <span style="color: #808030;">=</span><span style="color: #808030;">=</span> <span style="color: #0000e6;">'('</span> <span style="color: #808030;">|</span><span style="color: #808030;">|</span> c <span style="color: #808030;">=</span><span style="color: #808030;">=</span> <span style="color: #0000e6;">'{'</span> <span style="color: #808030;">|</span><span style="color: #808030;">|</span> c <span style="color: #808030;">=</span><span style="color: #808030;">=</span> <span style="color: #0000e6;">'['</span><span style="color: #800080;">;</span>
    <span style="color: #800080;">}</span>

    <span style="font-weight: bold; color: #800000;">private</span> <span style="font-weight: bold; color: #800000;">static</span> <span style="color: #bb7977;">char</span> matching<span style="color: #808030;">(</span><span style="color: #bb7977;">char</span> c<span style="color: #808030;">)</span>
    <span style="color: #800080;">{</span>
        <span style="font-weight: bold; color: #800000;">switch</span> <span style="color: #808030;">(</span>c<span style="color: #808030;">)</span>
        <span style="color: #800080;">{</span>
        <span style="font-weight: bold; color: #800000;">case</span> <span style="color: #0000e6;">'('</span><span style="color: #808030;">:</span> <span style="font-weight: bold; color: #800000;">return</span> <span style="color: #0000e6;">')'</span><span style="color: #800080;">;</span>
        <span style="font-weight: bold; color: #800000;">case</span> <span style="color: #0000e6;">'['</span><span style="color: #808030;">:</span> <span style="font-weight: bold; color: #800000;">return</span> <span style="color: #0000e6;">']'</span><span style="color: #800080;">;</span>
        <span style="font-weight: bold; color: #800000;">case</span> <span style="color: #0000e6;">'{'</span><span style="color: #808030;">:</span> <span style="font-weight: bold; color: #800000;">return</span> <span style="color: #0000e6;">'}'</span><span style="color: #800080;">;</span>
        <span style="font-weight: bold; color: #800000;">case</span> <span style="color: #0000e6;">')'</span><span style="color: #808030;">:</span> <span style="font-weight: bold; color: #800000;">return</span> <span style="color: #0000e6;">'('</span><span style="color: #800080;">;</span>
        <span style="font-weight: bold; color: #800000;">case</span> <span style="color: #0000e6;">']'</span><span style="color: #808030;">:</span> <span style="font-weight: bold; color: #800000;">return</span> <span style="color: #0000e6;">'['</span><span style="color: #800080;">;</span>
        <span style="font-weight: bold; color: #800000;">case</span> <span style="color: #0000e6;">'}'</span><span style="color: #808030;">:</span> <span style="font-weight: bold; color: #800000;">return</span> <span style="color: #0000e6;">'{'</span><span style="color: #800080;">;</span>
        <span style="font-weight: bold; color: #800000;">default</span><span style="color: #808030;">:</span>
            <span style="font-weight: bold; color: #800000;">throw</span> <span style="font-weight: bold; color: #800000;">new</span> <span style="font-weight: bold; color: #bb7977;">InvalidParameterException</span><span style="color: #808030;">(</span><span style="color: #0000e6;">"Not a brace"</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        <span style="color: #800080;">}</span>
    <span style="color: #800080;">}</span>

    <span style="font-weight: bold; color: #800000;">public</span> <span style="font-weight: bold; color: #800000;">static</span> <span style="color: #bb7977;">boolean</span> isCorrect<span style="color: #808030;">(</span><span style="font-weight: bold; color: #bb7977;">String</span> expression<span style="color: #808030;">)</span>
    <span style="color: #800080;">{</span>
        <span style="font-weight: bold; color: #bb7977;">Stack</span><span style="color: #808030;">&lt;</span><span style="font-weight: bold; color: #bb7977;">Character</span><span style="color: #808030;">&gt;</span> lastBrace <span style="color: #808030;">=</span> <span style="font-weight: bold; color: #800000;">new</span> <span style="font-weight: bold; color: #bb7977;">Stack</span><span style="color: #808030;">&lt;</span><span style="font-weight: bold; color: #bb7977;">Character</span><span style="color: #808030;">&gt;</span><span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>

        <span style="font-weight: bold; color: #800000;">for</span> <span style="color: #808030;">(</span><span style="color: #bb7977;">int</span> i<span style="color: #808030;">=</span><span style="color: #008c00;">0</span><span style="color: #800080;">;</span> i<span style="color: #808030;">&lt;</span>expression<span style="color: #808030;">.</span>length<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span> i<span style="color: #808030;">+</span><span style="color: #808030;">+</span><span style="color: #808030;">)</span>
        <span style="color: #800080;">{</span>
            <span style="color: #bb7977;">char</span> c <span style="color: #808030;">=</span> expression<span style="color: #808030;">.</span>charAt<span style="color: #808030;">(</span>i<span style="color: #808030;">)</span><span style="color: #800080;">;</span>

            <span style="font-weight: bold; color: #800000;">if</span> <span style="color: #808030;">(</span>isClosing<span style="color: #808030;">(</span>c<span style="color: #808030;">)</span><span style="color: #808030;">)</span>
            <span style="color: #800080;">{</span>
                <span style="font-weight: bold; color: #800000;">if</span> <span style="color: #808030;">(</span>lastBrace<span style="color: #808030;">.</span>size<span style="color: #808030;">(</span><span style="color: #808030;">)</span> <span style="color: #808030;">=</span><span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #808030;">)</span> <span style="font-weight: bold; color: #800000;">return</span> <span style="font-weight: bold; color: #800000;">false</span><span style="color: #800080;">;</span>
                <span style="font-weight: bold; color: #800000;">if</span> <span style="color: #808030;">(</span>lastBrace<span style="color: #808030;">.</span>peek<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #808030;">.</span>charValue<span style="color: #808030;">(</span><span style="color: #808030;">)</span> <span style="color: #808030;">!</span><span style="color: #808030;">=</span> matching<span style="color: #808030;">(</span>c<span style="color: #808030;">)</span><span style="color: #808030;">)</span> <span style="font-weight: bold; color: #800000;">return</span> <span style="font-weight: bold; color: #800000;">false</span><span style="color: #800080;">;</span>
                lastBrace<span style="color: #808030;">.</span>pop<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
            <span style="color: #800080;">}</span>
            <span style="font-weight: bold; color: #800000;">else</span> <span style="font-weight: bold; color: #800000;">if</span> <span style="color: #808030;">(</span>isOpening<span style="color: #808030;">(</span>c<span style="color: #808030;">)</span><span style="color: #808030;">)</span>
            <span style="color: #800080;">{</span>
                lastBrace<span style="color: #808030;">.</span>push<span style="color: #808030;">(</span><span style="font-weight: bold; color: #bb7977;">Character</span><span style="color: #808030;">.</span>valueOf<span style="color: #808030;">(</span>c<span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
            <span style="color: #800080;">}</span>
            <span style="font-weight: bold; color: #800000;">else</span>
            <span style="color: #800080;">{</span>
                <span style="font-weight: bold; color: #800000;">throw</span> <span style="font-weight: bold; color: #800000;">new</span> <span style="font-weight: bold; color: #bb7977;">InvalidParameterException</span><span style="color: #808030;">(</span>expression <span style="color: #808030;">+</span> <span style="color: #0000e6;">"["</span> <span style="color: #808030;">+</span> i <span style="color: #808030;">+</span> <span style="color: #0000e6;">"]="</span> <span style="color: #808030;">+</span> c<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
            <span style="color: #800080;">}</span>
        <span style="color: #800080;">}</span>

        <span style="font-weight: bold; color: #800000;">return</span> lastBrace<span style="color: #808030;">.</span>size<span style="color: #808030;">(</span><span style="color: #808030;">)</span> <span style="color: #808030;">=</span><span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #800080;">;</span>
    <span style="color: #800080;">}</span>
<span style="color: #800080;">}</span></pre>
<pre style="color:#000000;background:#ffffff;"><span style="font-weight: bold; color: #800000;">import</span><span style="color: #004a43;"> junit</span><span style="color: #808030;">.</span><span style="color: #004a43;">framework</span><span style="color: #808030;">.</span><span style="color: #004a43;">TestCase</span><span style="color: #800080;">;</span>

<span style="font-weight: bold; color: #800000;">public</span> <span style="font-weight: bold; color: #800000;">class</span> BracesTest <span style="font-weight: bold; color: #800000;">extends</span> TestCase <span style="color: #800080;">{</span>

    <span style="font-weight: bold; color: #800000;">public</span> <span style="color: #bb7977;">void</span> testIsCorrect<span style="color: #808030;">(</span><span style="color: #808030;">)</span>
    <span style="color: #800080;">{</span>
        assertTrue<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"()"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertTrue<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"[]"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertTrue<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"{}"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertTrue<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"([])"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertTrue<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"()()[]"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>

        assertTrue<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"([][][]{})"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertTrue<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"(()[()]())"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertTrue<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"([])()[]"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>

        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"([]"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"[]]"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>

        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"]["</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"(][)"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"(][)"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>

        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"(][)"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"[(){}}"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>

        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"]["</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"(("</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>

        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"(()))"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>

        assertFalse<span style="color: #808030;">(</span>Braces<span style="color: #808030;">.</span>isCorrect<span style="color: #808030;">(</span><span style="color: #0000e6;">"{}{}}{"</span><span style="color: #808030;">)</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
    <span style="color: #800080;">}</span>
<span style="color: #800080;">}</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/algorithmic-quiz-check-braces/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/algorithmic-quiz-check-braces/</feedburner:origLink></item>
		<item>
		<title>IListSource.ContainsListCollection explained</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/415476812/</link>
		<comments>http://victorsergienko.com/ilistsource-explained-howto/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 05:43:25 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[blog]]></category>

		<category><![CDATA[.net]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=49</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/ilistsource-explained-howto/&t=IListSource.ContainsListCollection explained&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Whenever you implement own datasource for .NET GUI binding, you&#8217;lll have the choice - whether to implement IList or IListSource.</p>
<p>IListSource is a simplistic interface with two members: <strong>IList&lt;T> GetList()</strong> and <strong>bool ContainsListCollection</strong>;</p>
<p>MSDN help <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ilistsource_members.aspx">about IListSource.ContainsListCollection</a> states it&#8217;s &#8220;indicating whether the collection is a collection of IList objects&#8221;.<br />
<strong>MSDN is not true here</strong>.</p>
<p>If IListSource.ContainsListCollection is <strong>false</strong>, GetList() just returns your IList.</p>
<p>If IListSource.ContainsListCollection is <strong>true</strong>, GetList() is expected to return <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.itypedlist.aspx">ITypedList</a>, which needs to provide a collection of <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.propertydescriptor.aspx">PropertyDescriptor</a>-s for every field of your collection.<br />
Its purpose is to provide field names (including by-name field access) in runtime.</p>
<p>Quoted below is a <a href="http://www.codenewsgroups.net/group/microsoft.public.dotnet.framework.aspnet.webcontrols/topic2404.aspx">code piece from a Microsoft newsgroup</a> that resolves both cases to a data list (field values list, in second case).</p>
<p>And yes, if you&#8217;re planning to mutate the UI-bound collection, use <strong><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ibindinglist.aspx">IBindingList</a></strong>&lt;> instead of <strong>IList</strong>&lt;>.<br />
<span id="more-49"></span><br />
<code>
<pre>
<FONT COLOR=RED><B>static</B></FONT> IEnumerable GetResolvedDataSource<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>object dataSource<FONT COLOR=BLUE SIZE=+1><B>,</B></FONT> string dataMember<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>
<FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
    <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>dataSource <FONT COLOR=BLUE SIZE=+1>!</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

    <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
        IListSource source1 <FONT COLOR=BLUE SIZE=+1>=</FONT> dataSource as IListSource<FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
        <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>source1 <FONT COLOR=BLUE SIZE=+1>!</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

        <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
            IList list1 <FONT COLOR=BLUE SIZE=+1>=</FONT> source1.GetList<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
            <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1>!</FONT>source1.ContainsListCollection<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

            <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                <FONT COLOR=RED><B>return</B></FONT> list1<FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
            <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
            <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>list1 <FONT COLOR=BLUE SIZE=+1>!</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> <FONT COLOR=BLUE SIZE=+1><FONT COLOR=BLUE SIZE=+1>&amp;</FONT><FONT COLOR=BLUE SIZE=+1>&amp;</FONT></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>list1 is ITypedList<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

            <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                ITypedList list2 <FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>ITypedList<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> list1<FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                PropertyDescriptorCollection collection1 <FONT COLOR=BLUE SIZE=+1>=</FONT> list2.GetItemProperties<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=RED><B>new</B></FONT> PropertyDescriptor<FONT COLOR=BLUE SIZE=+1><B>[</B></FONT><FONT COLOR=BROWN>0</FONT><FONT COLOR=BLUE SIZE=+1><B>]</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>

                <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>collection1 <FONT COLOR=BLUE SIZE=+1>=</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> <FONT COLOR=BLUE SIZE=+1><FONT COLOR=BLUE SIZE=+1>|</FONT><FONT COLOR=BLUE SIZE=+1>|</FONT></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>collection1.Count <FONT COLOR=BLUE SIZE=+1>=</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=BROWN>0</FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

                <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                    <FONT COLOR=RED><B>throw</B></FONT> <FONT COLOR=RED><B>new</B></FONT> HttpException<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>HttpRuntime<FONT COLOR=BLUE SIZE=+1><B>.</B></FONT>FormatResourceString<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=PURPLE>"ListSource_Without_DataMembers"</FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>

                <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
                PropertyDescriptor descriptor1 <FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>dataMember <FONT COLOR=BLUE SIZE=+1>=</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> <FONT COLOR=BLUE SIZE=+1><FONT COLOR=BLUE SIZE=+1>|</FONT><FONT COLOR=BLUE SIZE=+1>|</FONT></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>dataMember<FONT COLOR=BLUE SIZE=+1><B>.</B></FONT>Length <FONT COLOR=BLUE SIZE=+1>=</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=BROWN>0</FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

                <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                    descriptor1 <FONT COLOR=BLUE SIZE=+1>=</FONT> collection1<FONT COLOR=BLUE SIZE=+1><B>[</B></FONT><FONT COLOR=BROWN>0</FONT><FONT COLOR=BLUE SIZE=+1><B>]</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
                <FONT COLOR=RED><B>else</B></FONT>

                <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                    descriptor1 <FONT COLOR=BLUE SIZE=+1>=</FONT> collection1.Find<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>dataMember<FONT COLOR=BLUE SIZE=+1><B>,</B></FONT> true<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>

                <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>descriptor1 <FONT COLOR=BLUE SIZE=+1>!</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>
                <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                    object obj1 <FONT COLOR=BLUE SIZE=+1>=</FONT> list1<FONT COLOR=BLUE SIZE=+1><B>[</B></FONT><FONT COLOR=BROWN>0</FONT><FONT COLOR=BLUE SIZE=+1><B>]</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>

                    object obj2 <FONT COLOR=BLUE SIZE=+1>=</FONT> descriptor1.GetValue<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>obj1<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                    <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>obj2 <FONT COLOR=BLUE SIZE=+1>!</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> <FONT COLOR=BLUE SIZE=+1><FONT COLOR=BLUE SIZE=+1>&amp;</FONT><FONT COLOR=BLUE SIZE=+1>&amp;</FONT></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>obj2 is IEnumerable<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

                    <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                        <FONT COLOR=RED><B>return</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>IEnumerable<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> obj2<FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                    <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
                <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>

                <FONT COLOR=RED><B>throw</B></FONT> <FONT COLOR=RED><B>new</B></FONT> HttpException<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>HttpRuntime<FONT COLOR=BLUE SIZE=+1><B>.</B></FONT>FormatResourceString<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=PURPLE>"ListSource_Missing_DataMember"</FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT> dataMember<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>

            <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
        <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
        <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>dataSource is IEnumerable<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>
        <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
            <FONT COLOR=RED><B>return</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>IEnumerable<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> dataSource<FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>

        <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
    <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
    <FONT COLOR=RED><B>return</B></FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
<FONT COLOR=BLUE SIZE=+1><B>}</B></FONT></pre>
<p></code></p>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/ilistsource-explained-howto/&t=IListSource.ContainsListCollection explained&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Whenever you implement own datasource for .NET GUI binding, you&#8217;lll have the choice - whether to implement IList or IListSource.</p>
<p>IListSource is a simplistic interface with two members: <strong>IList&lt;T> GetList()</strong> and <strong>bool ContainsListCollection</strong>;</p>
<p>MSDN help <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ilistsource_members.aspx">about IListSource.ContainsListCollection</a> states it&#8217;s &#8220;indicating whether the collection is a collection of IList objects&#8221;.<br />
<strong>MSDN is not true here</strong>.</p>
<p>If IListSource.ContainsListCollection is <strong>false</strong>, GetList() just returns your IList.</p>
<p>If IListSource.ContainsListCollection is <strong>true</strong>, GetList() is expected to return <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.itypedlist.aspx">ITypedList</a>, which needs to provide a collection of <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.propertydescriptor.aspx">PropertyDescriptor</a>-s for every field of your collection.<br />
Its purpose is to provide field names (including by-name field access) in runtime.</p>
<p>Quoted below is a <a href="http://www.codenewsgroups.net/group/microsoft.public.dotnet.framework.aspnet.webcontrols/topic2404.aspx">code piece from a Microsoft newsgroup</a> that resolves both cases to a data list (field values list, in second case).</p>
<p>And yes, if you&#8217;re planning to mutate the UI-bound collection, use <strong><a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ibindinglist.aspx">IBindingList</a></strong>&lt;> instead of <strong>IList</strong>&lt;>.<br />
<span id="more-49"></span><br />
<code>
<pre>
<FONT COLOR=RED><B>static</B></FONT> IEnumerable GetResolvedDataSource<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>object dataSource<FONT COLOR=BLUE SIZE=+1><B>,</B></FONT> string dataMember<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>
<FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
    <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>dataSource <FONT COLOR=BLUE SIZE=+1>!</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

    <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
        IListSource source1 <FONT COLOR=BLUE SIZE=+1>=</FONT> dataSource as IListSource<FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
        <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>source1 <FONT COLOR=BLUE SIZE=+1>!</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

        <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
            IList list1 <FONT COLOR=BLUE SIZE=+1>=</FONT> source1.GetList<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
            <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1>!</FONT>source1.ContainsListCollection<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

            <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                <FONT COLOR=RED><B>return</B></FONT> list1<FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
            <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
            <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>list1 <FONT COLOR=BLUE SIZE=+1>!</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> <FONT COLOR=BLUE SIZE=+1><FONT COLOR=BLUE SIZE=+1>&amp;</FONT><FONT COLOR=BLUE SIZE=+1>&amp;</FONT></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>list1 is ITypedList<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

            <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                ITypedList list2 <FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>ITypedList<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> list1<FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                PropertyDescriptorCollection collection1 <FONT COLOR=BLUE SIZE=+1>=</FONT> list2.GetItemProperties<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=RED><B>new</B></FONT> PropertyDescriptor<FONT COLOR=BLUE SIZE=+1><B>[</B></FONT><FONT COLOR=BROWN>0</FONT><FONT COLOR=BLUE SIZE=+1><B>]</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>

                <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>collection1 <FONT COLOR=BLUE SIZE=+1>=</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> <FONT COLOR=BLUE SIZE=+1><FONT COLOR=BLUE SIZE=+1>|</FONT><FONT COLOR=BLUE SIZE=+1>|</FONT></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>collection1.Count <FONT COLOR=BLUE SIZE=+1>=</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=BROWN>0</FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

                <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                    <FONT COLOR=RED><B>throw</B></FONT> <FONT COLOR=RED><B>new</B></FONT> HttpException<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>HttpRuntime<FONT COLOR=BLUE SIZE=+1><B>.</B></FONT>FormatResourceString<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=PURPLE>"ListSource_Without_DataMembers"</FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>

                <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
                PropertyDescriptor descriptor1 <FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>dataMember <FONT COLOR=BLUE SIZE=+1>=</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> <FONT COLOR=BLUE SIZE=+1><FONT COLOR=BLUE SIZE=+1>|</FONT><FONT COLOR=BLUE SIZE=+1>|</FONT></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>dataMember<FONT COLOR=BLUE SIZE=+1><B>.</B></FONT>Length <FONT COLOR=BLUE SIZE=+1>=</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=BROWN>0</FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

                <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                    descriptor1 <FONT COLOR=BLUE SIZE=+1>=</FONT> collection1<FONT COLOR=BLUE SIZE=+1><B>[</B></FONT><FONT COLOR=BROWN>0</FONT><FONT COLOR=BLUE SIZE=+1><B>]</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
                <FONT COLOR=RED><B>else</B></FONT>

                <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                    descriptor1 <FONT COLOR=BLUE SIZE=+1>=</FONT> collection1.Find<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>dataMember<FONT COLOR=BLUE SIZE=+1><B>,</B></FONT> true<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>

                <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>descriptor1 <FONT COLOR=BLUE SIZE=+1>!</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>
                <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                    object obj1 <FONT COLOR=BLUE SIZE=+1>=</FONT> list1<FONT COLOR=BLUE SIZE=+1><B>[</B></FONT><FONT COLOR=BROWN>0</FONT><FONT COLOR=BLUE SIZE=+1><B>]</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>

                    object obj2 <FONT COLOR=BLUE SIZE=+1>=</FONT> descriptor1.GetValue<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>obj1<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                    <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>obj2 <FONT COLOR=BLUE SIZE=+1>!</FONT><FONT COLOR=BLUE SIZE=+1>=</FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> <FONT COLOR=BLUE SIZE=+1><FONT COLOR=BLUE SIZE=+1>&amp;</FONT><FONT COLOR=BLUE SIZE=+1>&amp;</FONT></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>obj2 is IEnumerable<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>

                    <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
                        <FONT COLOR=RED><B>return</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>IEnumerable<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> obj2<FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
                    <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
                <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>

                <FONT COLOR=RED><B>throw</B></FONT> <FONT COLOR=RED><B>new</B></FONT> HttpException<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>HttpRuntime<FONT COLOR=BLUE SIZE=+1><B>.</B></FONT>FormatResourceString<FONT COLOR=BLUE SIZE=+1><B>(</B></FONT><FONT COLOR=PURPLE>"ListSource_Missing_DataMember"</FONT><FONT COLOR=BLUE SIZE=+1><B>,</B></FONT> dataMember<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>)</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>

            <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
        <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
        <FONT COLOR=RED><B>if</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>dataSource is IEnumerable<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT>
        <FONT COLOR=BLUE SIZE=+1><B>{</B></FONT>
            <FONT COLOR=RED><B>return</B></FONT> <FONT COLOR=BLUE SIZE=+1><B>(</B></FONT>IEnumerable<FONT COLOR=BLUE SIZE=+1><B>)</B></FONT> dataSource<FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>

        <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
    <FONT COLOR=BLUE SIZE=+1><B>}</B></FONT>
    <FONT COLOR=RED><B>return</B></FONT> <FONT COLOR=RED><B>null</B></FONT><FONT COLOR=BLUE SIZE=+1><B>;</B></FONT>
<FONT COLOR=BLUE SIZE=+1><B>}</B></FONT></pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/ilistsource-explained-howto/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/ilistsource-explained-howto/</feedburner:origLink></item>
		<item>
		<title>Unit tests quickstart</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/318856617/</link>
		<comments>http://victorsergienko.com/unit-tests-quickstart/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 11:57:24 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[TDD]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=47</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/unit-tests-quickstart/&t=Unit tests quickstart&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>A friend asked me for it, so probably someone might need a jumpstart in unit tests.</p>
<p>Here&#8217;s a short list of short (though very deep, if not best) intros.</p>
<ul>
<li>Except for <a href="http://junit.sourceforge.net/doc/cookbook/cookbook.htm">JUnit cookbook</a> (~2 pages) (which has a lot of &#8220;ports&#8221;, like <a href="http://cppunit.sourceforge.net/doc/1.8.0/cppunit_cookbook.html">CppUnit cookbook</a>), I&#8217;d name:</li>
<li>&#8220;<a href="http://www.mockobjects.com/files/endotesting.pdf">Endo-Testing: Unit Testing with Mock Objects</a>&#8221; at mockobjects.com (Tim Mackinnon, Steve Freeman, Philip Craig) (7 pages);</li>
<li><a href="http://martinfowler.com/articles/mocksArentStubs.html">&#8220;Mocks aren&#8217;t stubs&#8221;</a> by Martin Fowler (about 7 pages);</li>
</ul>
<p>For deeper dive, take a &#8220;<a href="http://xunitpatterns.com/">xUnit patterns</a>&#8221; book (this one is longer).</p>
<p>For <a href="http://en.wikipedia.org/wiki/Kent_Beck">Kent Beck</a>&#8217;s <a rel="nofollow" href="http://en.wikipedia.org/wiki/Special:BookSources/0201616416">book on TDD</a>, shame on me - I never read it. Though after &#8220;XP explained&#8221; I don&#8217;t strive for reading his books.</p>
<p>// If you&#8217;re interested in XP and &#8220;XP explained&#8221; criticism, take a look at <a href="http://www.agilealliance.com/show/945">&#8220;Extreme Programming Considered Harmful for Reliable Software Development&#8221;</a> by Gerald Keefer.</p>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/unit-tests-quickstart/&t=Unit tests quickstart&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>A friend asked me for it, so probably someone might need a jumpstart in unit tests.</p>
<p>Here&#8217;s a short list of short (though very deep, if not best) intros.</p>
<ul>
<li>Except for <a href="http://junit.sourceforge.net/doc/cookbook/cookbook.htm">JUnit cookbook</a> (~2 pages) (which has a lot of &#8220;ports&#8221;, like <a href="http://cppunit.sourceforge.net/doc/1.8.0/cppunit_cookbook.html">CppUnit cookbook</a>), I&#8217;d name:</li>
<li>&#8220;<a href="http://www.mockobjects.com/files/endotesting.pdf">Endo-Testing: Unit Testing with Mock Objects</a>&#8221; at mockobjects.com (Tim Mackinnon, Steve Freeman, Philip Craig) (7 pages);</li>
<li><a href="http://martinfowler.com/articles/mocksArentStubs.html">&#8220;Mocks aren&#8217;t stubs&#8221;</a> by Martin Fowler (about 7 pages);</li>
</ul>
<p>For deeper dive, take a &#8220;<a href="http://xunitpatterns.com/">xUnit patterns</a>&#8221; book (this one is longer).</p>
<p>For <a href="http://en.wikipedia.org/wiki/Kent_Beck">Kent Beck</a>&#8217;s <a rel="nofollow" href="http://en.wikipedia.org/wiki/Special:BookSources/0201616416">book on TDD</a>, shame on me - I never read it. Though after &#8220;XP explained&#8221; I don&#8217;t strive for reading his books.</p>
<p>// If you&#8217;re interested in XP and &#8220;XP explained&#8221; criticism, take a look at <a href="http://www.agilealliance.com/show/945">&#8220;Extreme Programming Considered Harmful for Reliable Software Development&#8221;</a> by Gerald Keefer.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/unit-tests-quickstart/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/unit-tests-quickstart/</feedburner:origLink></item>
		<item>
		<title>On unit tests in Visual Studio 2008 vs NUnit</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/302947824/</link>
		<comments>http://victorsergienko.com/on-unit-tests-in-visual-studio-2008-vs-nunit/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 12:31:46 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[TDD]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=44</guid>
		<description><![CDATA[Comparison of Microsoft Visual Studio unit tests (MSTest) vs NUnit, mentioning PartCover and ]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/on-unit-tests-in-visual-studio-2008-vs-nunit/&t=On unit tests in Visual Studio 2008 vs NUnit&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>My not-so-humble evaluation of VS tests distinctions from NUnit is (in points on -10 to 10 scale).</p>
<ul>
<li>(-4) To run tests, VS launches an <strong>entire process</strong> which takes no less then 3 seconds to start. If you&#8217;re in &#8220;F5 hit breakpoint - Shift-F5&#8243; loop, that&#8217;s disgusting. <em>NUnit tests can be run in-process by Resharper or TestDriver.NET</em>;</li>
<li>(-2) GUI that shows where test failed is ugly. You don&#8217;t get to failed line on double-click, you first get to test log page. Status and call stack are necessary, but I&#8217;d like not to <strong>trash my document tabs</strong>, I already have enough of them open. You can&#8217;t make that kind of windows docked/floating;</li>
<li> (-1) You got a &#8220;<code>public TestContext TestContext;</code>&#8221; sticking in your code. You&#8217;ll need it only when it comes to <a href="http://msdn.microsoft.com/en-us/library/ms379625(VS.80).aspx#vstsunittesting_topic6">testing on data</a>, which doesn&#8217;t always happen, even in a data-driven application;</li>
<li>(-1) It&#8217;s a &#8220;<a href="http://en.wikipedia.org/wiki/Not_Invented_Here">not invented here</a>&#8221; technology, while <strong>NUnit</strong> was around for years;</li>
</ul>
<p>Edit: In a moment of madness, I mixed together coverage profiling and unit testing tools. May God and readers forgive my aberration.</p>
<p>Edit2: If you need a half-page <a href="http://victorsergienko.com/unit-tests-quickstart/">kickstart in unit testing</a> techniques, the next post can help.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/on-unit-tests-in-visual-studio-2008-vs-nunit/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/on-unit-tests-in-visual-studio-2008-vs-nunit/</feedburner:origLink></item>
		<item>
		<title>Please meet: Lua</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/290893776/</link>
		<comments>http://victorsergienko.com/please-meet-lua/#comments</comments>
		<pubDate>Thu, 15 May 2008 10:00:08 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[Lua]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=41</guid>
		<description><![CDATA[Lua language brief description, and the best Lua book in CHM.]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/please-meet-lua/&t=Please meet: Lua&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p><a href="http://www.lua.org/">Lua</a> recently became very popular. I encountered Lua scripting in several applications including popular games, I believe it&#8217;s used in even more then <a href="http://en.wikipedia.org/wiki/Lua_(programming_language)#Applications">Wikipedia says</a>.</p>
<p>It&#8217;s extremely simple:</p>
<ul>
<li>6 data types (that&#8217;s counting &#8220;nul&#8221; and &#8220;function&#8221;),</li>
<li>no C++-style OOP out-of-box (but you can program one, he-he),</li>
<li>400K of pure-C code</li>
</ul>
<p>but is loaded with in-fashion features like</p>
<ul>
<li>first-class functions,</li>
<li>closures,</li>
<li><a title="Coroutine" href="http://en.wikipedia.org/wiki/Coroutine">coroutines</a>&#8230;</li>
<li>again, <a href="http://en.wikipedia.org/wiki/Lua_(programming_language)#Features">Wikipedia</a> is the best.</li>
</ul>
<p>The only metaprogramming tutorial (with a ready code to implement virtual methods) is <a href="http://www.lua.org/pil/">&#8220;Programming in Lua&#8221; book</a>. <i>Still, I don&#8217;t see a code to implement <a href="http://en.wikipedia.org/wiki/Parametric_polymorphism#Ad-hoc_polymorphism">ad-hoc polymorphism</a>&#8230; Maybe it&#8217;s a reason for another post <img src='http://victorsergienko.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </i></p>
<p><i>Redistributed book removed: it violated copyright</i>.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/please-meet-lua/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/please-meet-lua/</feedburner:origLink></item>
		<item>
		<title>Another C++ quiz, simpler</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/289759670/</link>
		<comments>http://victorsergienko.com/cpp-quiz-simpler/#comments</comments>
		<pubDate>Tue, 13 May 2008 22:46:57 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[C++]]></category>

		<category><![CDATA[quiz]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=40</guid>
		<description><![CDATA[Simple C++ quiz about class member pointer.]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/cpp-quiz-simpler/&t=Another C++ quiz, simpler&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Did you ever think, what happens if you take a member pointer to a virtual function of a class, and then call it on <strong>another</strong> instance of derived class (that overrides that member)?</p>
<p>What if you do the same for <strong>nonvirtual</strong> function?</p>
<p>Here&#8217;s a test:</p>
<pre><tt><strong><span style="color: #000080;">#include</span></strong> <span style="color: #ff0000;">&lt;iostream&gt;</span>

<strong><span style="color: #0000ff;">class</span></strong> A
<span style="color: #ff0000;">{</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt><strong><span style="color: #0000ff;">public</span></strong><span style="color: #990000;">:</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt><strong><span style="color: #0000ff;">virtual</span></strong> <span style="color: #009900;">void</span> <strong><span style="color: #000000;">f</span></strong><span style="color: #990000;">(</span><span style="color: #990000;">)</span> <span style="color: #ff0000;">{</span> std<span style="color: #990000;">:</span><span style="color: #990000;">:</span>cout <span style="color: #990000;">&lt;</span><span style="color: #990000;">&lt;</span> <span style="color: #ff0000;">"A::f()\n"</span><span style="color: #990000;">;</span> <span style="color: #ff0000;">}</span><span style="color: #990000;">;</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt><span style="color: #009900;">void</span> <strong><span style="color: #000000;">g</span></strong><span style="color: #990000;">(</span><span style="color: #990000;">)</span> <span style="color: #ff0000;">{</span> std<span style="color: #990000;">:</span><span style="color: #990000;">:</span>cout <span style="color: #990000;">&lt;</span><span style="color: #990000;">&lt;</span> <span style="color: #ff0000;">"A::g()\n"</span><span style="color: #990000;">;</span> <span style="color: #ff0000;">}</span><span style="color: #990000;">;</span>
<span style="color: #ff0000;">}</span><span style="color: #990000;">;</span>

<strong><span style="color: #0000ff;">class</span></strong> B <span style="color: #990000;">:</span> <strong><span style="color: #0000ff;">public</span></strong> A
<span style="color: #ff0000;">{</span>
<strong><span style="color: #0000ff;">  public</span></strong><span style="color: #990000;">:</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt><strong><span style="color: #0000ff;">virtual</span></strong> <span style="color: #009900;">void</span> <strong><span style="color: #000000;">f</span></strong><span style="color: #990000;">(</span><span style="color: #990000;">)</span> <span style="color: #ff0000;">{</span> std<span style="color: #990000;">:</span><span style="color: #990000;">:</span>cout <span style="color: #990000;">&lt;</span><span style="color: #990000;">&lt;</span> <span style="color: #ff0000;">"B::f()\n"</span><span style="color: #990000;">;</span> <span style="color: #ff0000;">}</span><span style="color: #990000;">;</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt><span style="color: #009900;">void</span> <strong><span style="color: #000000;">g</span></strong><span style="color: #990000;">(</span><span style="color: #990000;">)</span> <span style="color: #ff0000;">{</span> std<span style="color: #990000;">:</span><span style="color: #990000;">:</span>cout <span style="color: #990000;">&lt;</span><span style="color: #990000;">&lt;</span> <span style="color: #ff0000;">"B::g()\n"</span><span style="color: #990000;">;</span> <span style="color: #ff0000;">}</span><span style="color: #990000;">;</span>
<span style="color: #ff0000;">}</span><span style="color: #990000;">;</span>

<strong><span style="color: #0000ff;">typedef</span></strong> <span style="color: #009900;">void</span> <span style="color: #990000;">(</span>A<span style="color: #990000;">:</span><span style="color: #990000;">:</span><span style="color: #990000;">*</span>VirtualFunctionPointer<span style="color: #990000;">)</span> <span style="color: #990000;">(</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>

<span style="color: #009900;">int</span> <strong><span style="color: #000000;">main</span></strong><span style="color: #990000;">(</span><span style="color: #990000;">)</span>
<span style="color: #ff0000;">{</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt>A a<span style="color: #990000;">;</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt>B b<span style="color: #990000;">;</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt>B<span style="color: #990000;">*</span> pb <span style="color: #990000;">=</span> <span style="color: #990000;">&amp;</span>b<span style="color: #990000;">;</span>

</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt>VirtualFunctionPointer p <span style="color: #990000;">=</span> <span style="color: #990000;">&amp;</span>A<span style="color: #990000;">:</span><span style="color: #990000;">:</span>f<span style="color: #990000;">;</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt><span style="color: #990000;">(</span>pb<span style="color: #990000;">-</span><span style="color: #990000;">&gt;</span><span style="color: #990000;">*</span>p<span style="color: #990000;">)</span> <span style="color: #990000;">(</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>

</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt>p <span style="color: #990000;">=</span> <span style="color: #990000;">&amp;</span>A<span style="color: #990000;">:</span><span style="color: #990000;">:</span>g<span style="color: #990000;">;</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt><span style="color: #990000;">(</span>pb<span style="color: #990000;">-</span><span style="color: #990000;">&gt;</span><span style="color: #990000;">*</span>p<span style="color: #990000;">)</span> <span style="color: #990000;">(</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>
</tt><tt><strong><span><tt><strong><span style="color: #0000ff;">  </span></strong></tt></span></strong></tt><tt><strong><span style="color: #0000ff;">return</span></strong> <span style="color: #993399;">0</span><span style="color: #990000;">;</span>
<span style="color: #ff0000;">}</span>
</tt></pre>
<p>Answer is in comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/cpp-quiz-simpler/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/cpp-quiz-simpler/</feedburner:origLink></item>
		<item>
		<title>C++ quiz from the past</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/289757983/</link>
		<comments>http://victorsergienko.com/cpp-quiz/#comments</comments>
		<pubDate>Tue, 13 May 2008 22:40:19 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[C++]]></category>

		<category><![CDATA[quiz]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=39</guid>
		<description><![CDATA[C++ quiz about streams, dynamic_cast, temporary values, default type conversions and more...]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/cpp-quiz/&t=C++ quiz from the past&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>One of my friends once encountered a C++ compilation issue.<br />
A program is given:</p>
<pre><tt><strong><span style="color: #000080;">#include</span></strong> <span style="color: #ff0000;">&lt;iostream&gt;</span>
<strong><span style="color: #000080;">#include</span></strong> <span style="color: #ff0000;">&lt;sstream&gt;</span>
<strong><span style="color: #0000ff;">using</span></strong> <strong><span style="color: #0000ff;">namespace</span></strong> std<span style="color: #990000;">;</span>

<strong><span style="color: #000080;">#define</span></strong> <strong><span style="color: #000000;">SFORMAT</span></strong><span style="color: #990000;">(</span>e<span style="color: #990000;">)</span> <span style="color: #990000;">(</span><span style="color: #990000;">(</span><strong><span style="color: #0000ff;">dynamic_cast</span></strong><span style="color: #990000;">&lt;</span><strong><span style="color: #0000ff;">const</span></strong> ostringstream<span style="color: #990000;">&amp;</span><span style="color: #990000;">&gt;</span><span style="color: #990000;">(</span><strong><span style="color: #000000;">ostringstream</span></strong><span style="color: #990000;">(</span><span style="color: #990000;">)</span> <span style="color: #990000;">&lt;</span><span style="color: #990000;">&lt;</span> e<span style="color: #990000;">)</span><span style="color: #990000;">)</span><span style="color: #990000;">.</span><strong><span style="color: #000000;">str</span></strong><span style="color: #990000;">(</span><span style="color: #990000;">)</span><span style="color: #990000;">)</span>

<span style="color: #009900;">int</span> <strong><span style="color: #000000;">main</span></strong><span style="color: #990000;">(</span><span style="color: #009900;">int</span> argc<span style="color: #990000;">,</span> <span style="color: #009900;">char</span><span style="color: #990000;">*</span> argv<span style="color: #990000;">[</span><span style="color: #990000;">]</span><span style="color: #990000;">)</span>
<span style="color: #ff0000;">{</span>
cout <span style="color: #990000;">&lt;</span><span style="color: #990000;">&lt;</span> <strong><span style="color: #000000;">SFORMAT</span></strong><span style="color: #990000;">(</span><span style="color: #ff0000;">"2 x "</span> <span style="color: #990000;">&lt;</span><span style="color: #990000;">&lt;</span> <span style="color: #ff0000;">" 2 = "</span> <span style="color: #990000;">&lt;</span><span style="color: #990000;">&lt;</span> <span style="color: #993399;">2</span><span style="color: #990000;">*</span><span style="color: #993399;">2</span><span style="color: #990000;">)</span><span style="color: #990000;">;</span>
<strong><span style="color: #0000ff;">return</span></strong> <span style="color: #993399;">0</span><span style="color: #990000;">;</span>
<span style="color: #ff0000;">}</span></tt></pre>
<p>No one asks you what it will print, unless you&#8217;re a god.</p>
<p>Question is: why is the first const char* printed as a pointer, instead of what we need?<br />
Two years ago, I couldn&#8217;t tell.<br />
Some guru from Apple answered this in a newsgroup.</p>
<p>Here, take another, simpler <a href="http://victorsergienko.com/cpp-quiz-simpler/">C++ quiz about member pointers</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/cpp-quiz/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/cpp-quiz/</feedburner:origLink></item>
		<item>
		<title>MSBuild don’ts</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/270673988/</link>
		<comments>http://victorsergienko.com/msbuild-tips-1/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 12:15:45 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[MSBuild]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=31</guid>
		<description><![CDATA[MSBuild tips: some things you shouldn't do, and what to do instead.]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/msbuild-tips-1/&t=MSBuild don&#8217;ts&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>A couple of notes how NOT to use MSBuild.</p>
<ol>
<li>Don&#8217;t generate files with <strong>AssemblyInfo task</strong>. It screws comments, screws <em><strong>InternalsVisibleTo</strong></em> attributes, and whatever else it doesn&#8217;t account for.<strong><br />
Instead</strong>: Use<br />
<code>&lt;FileUpdate Files="@(AssemblyInfoFiles)"<br />
Regex="AssemblyVersion\(".*?"\)\]"<br />
ReplacementText="AssemblyVersion("$(Major).$(Minor).$(Build).$(Revision)")]"<br />
/&gt;<br />
&lt;FileUpdate Files="@(AssemblyInfoFiles)"<br />
Regex="AssemblyFileVersion\(".*?"\)\]"<br />
ReplacementText="AssemblyFileVersion("$(Major).$(Minor).$(Build).$(Revision)")]"<br />
/&gt;</code></li>
<li>Don&#8217;t account for <strong>TfsXXXX community tasks</strong> - it won&#8217;t run on VS 2008 with Team Explorer 9.0.<br />
<strong>Instead</strong>:  Use &lt;Exec Command=&#8221;tf &#8230;&#8221;&gt;.<br />
And if you have domain authentication in TFS and don&#8217;t run integration under domain user (which happens), you even can&#8217;t run tf in cmd-line mode: stupid authentication dialog will pop up.</li>
<li>Do not use <strong>local files to store version number</strong>. You will lose them when moving build to another host, so use only source control-dependent files.<br />
Might seem evident, but strange how many people miss this.<br />
So you&#8217;ll need to<br />
<code>&lt;Attrib Files="version.txt" Normal="true" /&gt;</code></li>
<li>Per <a href="http://www.traceofthought.net/2008/01/02/CustomizingTFSTeamBuildBuildNumbers.aspx">Scott Colestock&#8217;s post</a>, <i>&#8220;since <strong>TfsVersion</strong> interrogates the build server&#8217;s workspace, and BuildNumberOverrideTarget comes early in the process&#8230; you might find that you don&#8217;t get the changeset number you expect&#8221;.</i></li>
<li>Don&#8217;t try to operate on <strong>XML node collections</strong> with tasks other then <strong>Xslt</strong>.<br />
For instance, XmlRead returns a Nodeset only as a string of &#8220;;&#8221;-joined<br />
Node.Value-s.<br />
<strong>XmlQuery</strong> supports <strong>Values</strong> property, though I wasn&#8217;t able to operate it&#8217;s results.<br />
Instead you can use ReadLinesFromFile (sadly, this will trim the lines).<br />
My personal choice for not-too-complex XML is&#8230; you can guess&#8230; yes, <strong>FileUpdate</strong>.</li>
<li>Don&#8217;t use <strong>FtpUpload</strong>. It won&#8217;t create folders for you.<br />
Just &lt;Exec&gt; a ftp&#8230;<br />
By the way, Windows&#8217; ftp.exe client is unable to upload in passive mode. You can download passively, if you issue &#8220;<strong>LITERAL PASV</strong>&#8220;, but it won&#8217;t help the client.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/msbuild-tips-1/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/msbuild-tips-1/</feedburner:origLink></item>
		<item>
		<title>Bootstrapper also can’t install your application after rebooting…</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/264164417/</link>
		<comments>http://victorsergienko.com/bootstrapper-also-cant-install-your-application-after-rebooting/#comments</comments>
		<pubDate>Fri, 04 Apr 2008 19:17:09 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[MSBuild]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=34</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/bootstrapper-also-cant-install-your-application-after-rebooting/&t=Bootstrapper also can&#8217;t install your application after rebooting&#8230;&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p><strong>Another <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=112820">problem with MSBuild bootstrappers</a> that can screw all your installation</strong>&#8230;</p>
<p>If scheduling reboot after installing .NET or other prerequisites, bootstrapper copies itself to run from TEMP on boot. Why not staying where it is - who knows. And definitely, all the other MSIs are not copied, so it won&#8217;t find them. Reproduced for me.</p>
<p>Now give up and go write own bootstrapper. I&#8217;m setiously considering going for <a href="http://www.blackhillsoftware.com/blog/2006/06/26/using-innosetup-with-the-dotnet-framework/">InnoSetup deployment</a>.</p>
<p>For now, I&#8217;m trying a crazy ting, to copy MSI to TEMP for Setup.exe to find it after reincarnation&#8230; It&#8217;s the way to use given tools.</p>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/bootstrapper-also-cant-install-your-application-after-rebooting/&t=Bootstrapper also can&#8217;t install your application after rebooting&#8230;&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p><strong>Another <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=112820">problem with MSBuild bootstrappers</a> that can screw all your installation</strong>&#8230;</p>
<p>If scheduling reboot after installing .NET or other prerequisites, bootstrapper copies itself to run from TEMP on boot. Why not staying where it is - who knows. And definitely, all the other MSIs are not copied, so it won&#8217;t find them. Reproduced for me.</p>
<p>Now give up and go write own bootstrapper. I&#8217;m setiously considering going for <a href="http://www.blackhillsoftware.com/blog/2006/06/26/using-innosetup-with-the-dotnet-framework/">InnoSetup deployment</a>.</p>
<p>For now, I&#8217;m trying a crazy ting, to copy MSI to TEMP for Setup.exe to find it after reincarnation&#8230; It&#8217;s the way to use given tools.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/bootstrapper-also-cant-install-your-application-after-rebooting/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/bootstrapper-also-cant-install-your-application-after-rebooting/</feedburner:origLink></item>
		<item>
		<title>Can’t run .NET bootstrapper from an MSI</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/262744931/</link>
		<comments>http://victorsergienko.com/dotnet-bootstrapper-from-msiexec/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 15:56:22 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[MSBuild]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=33</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/dotnet-bootstrapper-from-msiexec/&t=Can&#8217;t run .NET bootstrapper from an MSI&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Now I know it.</p>
<p>It&#8217;s Windows Installer error 1618 that I didn&#8217;t see somewhy when attempting to fix .NET bootstrapper. Either I was inattentive or it wasn&#8217;t there: &#8220;Another copy of msiexec is running&#8221;. <strong>You can&#8217;t have two Windows Installers running</strong>, at least if one of them installs .NET. Information is from this <a href="http://www.eggheadcafe.com/software/aspnet/31744087/launching-child-installer.aspx">maillist post</a>.</p>
<p>Why? Implementation limitations, I believe. No sane reasons for such a contract, no article mentioned this. Surely, who&#8217;s going to declare own &#8220;features&#8221; of that kind - just a gentle hints that &#8220;you should better use bootstrapper&#8221;. Another reason to long for a systems where setup is just a copy.</p>
<p>So go pack a MSI, then make a MSBuild bootstrapper.</p>
<p><strong>Oh wait, do I have to have 2 files in my installation?</strong> And my customers can&#8217;t download one file?</p>
<p>Yes. Or go for <a href="http://www.winzip.com/xsepedif.htm">WinZip Self-Extractor</a>, or <a href="http://www.rarlab.com/download.htm">WinRar</a>, or whatever else.</p>
<p><strong>What about build scripts?</strong> For WinRar, here&#8217;s a <a href="http://dotnet.dzone.com/news/use-nant-and-winrar-create-sel">nice sample</a>. For WinZip sfx, there&#8217;s also a command-line interface. Do a</p>
<p><code>wzipse32 %ARC_NAME% -setup -auto -runasuser -le -i ../icon.ico -wait msiexec -c ".\setup.exe"</code></p>
<p>WinZip will do the thing, though displaying some dialogs we don&#8217;t need at all.</p>
<p>Oh, <strong>WinRar won&#8217;t work</strong>, because it erases temporary files upon setup.exe completion. And we need to wait for msiexec, because setup.exe exits earlier. What a pity.</p>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/dotnet-bootstrapper-from-msiexec/&t=Can&#8217;t run .NET bootstrapper from an MSI&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Now I know it.</p>
<p>It&#8217;s Windows Installer error 1618 that I didn&#8217;t see somewhy when attempting to fix .NET bootstrapper. Either I was inattentive or it wasn&#8217;t there: &#8220;Another copy of msiexec is running&#8221;. <strong>You can&#8217;t have two Windows Installers running</strong>, at least if one of them installs .NET. Information is from this <a href="http://www.eggheadcafe.com/software/aspnet/31744087/launching-child-installer.aspx">maillist post</a>.</p>
<p>Why? Implementation limitations, I believe. No sane reasons for such a contract, no article mentioned this. Surely, who&#8217;s going to declare own &#8220;features&#8221; of that kind - just a gentle hints that &#8220;you should better use bootstrapper&#8221;. Another reason to long for a systems where setup is just a copy.</p>
<p>So go pack a MSI, then make a MSBuild bootstrapper.</p>
<p><strong>Oh wait, do I have to have 2 files in my installation?</strong> And my customers can&#8217;t download one file?</p>
<p>Yes. Or go for <a href="http://www.winzip.com/xsepedif.htm">WinZip Self-Extractor</a>, or <a href="http://www.rarlab.com/download.htm">WinRar</a>, or whatever else.</p>
<p><strong>What about build scripts?</strong> For WinRar, here&#8217;s a <a href="http://dotnet.dzone.com/news/use-nant-and-winrar-create-sel">nice sample</a>. For WinZip sfx, there&#8217;s also a command-line interface. Do a</p>
<p><code>wzipse32 %ARC_NAME% -setup -auto -runasuser -le -i ../icon.ico -wait msiexec -c ".\setup.exe"</code></p>
<p>WinZip will do the thing, though displaying some dialogs we don&#8217;t need at all.</p>
<p>Oh, <strong>WinRar won&#8217;t work</strong>, because it erases temporary files upon setup.exe completion. And we need to wait for msiexec, because setup.exe exits earlier. What a pity.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/dotnet-bootstrapper-from-msiexec/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/dotnet-bootstrapper-from-msiexec/</feedburner:origLink></item>
		<item>
		<title>MSBuild bootstrapper for .NET 3.0 broken?</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/261452889/</link>
		<comments>http://victorsergienko.com/msbuild-bootstrapper-for-net-30-framework-broken/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 18:45:52 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[MSBuild]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/msbuild-bootstrapper-for-net-30-framework-broken/</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/msbuild-bootstrapper-for-net-30-framework-broken/&t=MSBuild bootstrapper for .NET 3.0 broken?&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>After Microsoft didn&#8217;t include .NET 3.5 in any current release of Windows (read &#8220;Vista service pack 1&#8243;), some of us developers who believed in long-ago C# 3.0 ads, had to roll back to .NET 3.0 and C# 2.0.</p>
<p>Including me.</p>
<p>Not mentioning pain of rolling back all LINQ tasties in code and debugging our replacements (do you know why you can&#8217;t implement Where() just with <strong>yield</strong>-style function?), it means installing .NET 3.0.</p>
<p>It seemed to be not a problem, having a MSBuild code snippet that worked for 3.5 - just replace 3.5 with 3.0:</p>
<p><code> </code></p>
<pre>&lt;ItemGroup&gt;
&lt;BootstrapperFile Include="Microsoft.Net.Framework.3.0"&gt;
&lt;ProductName&gt;.NET Framework 3.0&lt;/ProductName&gt;
&lt;/BootstrapperFile&gt;
&lt;BootstrapperFile Include="Microsoft.Windows.Installer.3.1"&gt;
&lt;ProductName&gt;Windows Installer 3.1&lt;/ProductName&gt;
&lt;/BootstrapperFile&gt;

&lt;Target Name="Bootstrapper"&gt;
&lt;GenerateBootstrapper
ApplicationName="blah blah blah blah"
BootstrapperItems="@(BootstrapperFile)"
BootstrapperKeyFile=""
OutputPath="obj"
ComponentsLocation="HomeSite" CopyComponents="false"
SupportUrl="http://www.microsoft.com/downloads/details.aspx?familyid=10CC340B-F857-4A14-83F5-25634C3BF043"
Culture="en" Path="$(BootstrapperPath)"/&gt;
&lt;/Target&gt;</pre>
<p><strong>Won&#8217;t work</strong>.</p>
<p>Hell why? Who knows. Logs in temp don&#8217;t give proper diagnostics, nor system events do. WPF fails to install at some point onto every XP installations we have, including clean <strong>special test XP SP2 VMWare images downloaded from Microsoft</strong>.</p>
<p><strong>Update</strong>: <a href="http://victorsergienko.com/dotnet-bootstrapper-from-msiexec/">Here&#8217;s the answer</a>.</p>
<p>Now I rolled back to dotnetfx3setup.exe redistributable. It&#8217;s 2.8M compared to 300K bootstrapper generated by MSBuild, and it&#8217;s a pain to see installer grow&#8230;And if .NET 3.0 is already installed it starts to uninstall it&#8230; and there is no key to make it just &#8220;check or install&#8221;, need to trick it via WiX.</p>
<p>But we have to pay it. Oh my.</p>
<p>All over the Web I see no evidence that any man walked this path before. For.NET 2.0 - a lot of mentions and code samples. And completely empty for .NET 3.0.</p>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/msbuild-bootstrapper-for-net-30-framework-broken/&t=MSBuild bootstrapper for .NET 3.0 broken?&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>After Microsoft didn&#8217;t include .NET 3.5 in any current release of Windows (read &#8220;Vista service pack 1&#8243;), some of us developers who believed in long-ago C# 3.0 ads, had to roll back to .NET 3.0 and C# 2.0.</p>
<p>Including me.</p>
<p>Not mentioning pain of rolling back all LINQ tasties in code and debugging our replacements (do you know why you can&#8217;t implement Where() just with <strong>yield</strong>-style function?), it means installing .NET 3.0.</p>
<p>It seemed to be not a problem, having a MSBuild code snippet that worked for 3.5 - just replace 3.5 with 3.0:</p>
<p><code> </code></p>
<pre>&lt;ItemGroup&gt;
&lt;BootstrapperFile Include="Microsoft.Net.Framework.3.0"&gt;
&lt;ProductName&gt;.NET Framework 3.0&lt;/ProductName&gt;
&lt;/BootstrapperFile&gt;
&lt;BootstrapperFile Include="Microsoft.Windows.Installer.3.1"&gt;
&lt;ProductName&gt;Windows Installer 3.1&lt;/ProductName&gt;
&lt;/BootstrapperFile&gt;

&lt;Target Name="Bootstrapper"&gt;
&lt;GenerateBootstrapper
ApplicationName="blah blah blah blah"
BootstrapperItems="@(BootstrapperFile)"
BootstrapperKeyFile=""
OutputPath="obj"
ComponentsLocation="HomeSite" CopyComponents="false"
SupportUrl="http://www.microsoft.com/downloads/details.aspx?familyid=10CC340B-F857-4A14-83F5-25634C3BF043"
Culture="en" Path="$(BootstrapperPath)"/&gt;
&lt;/Target&gt;</pre>
<p><strong>Won&#8217;t work</strong>.</p>
<p>Hell why? Who knows. Logs in temp don&#8217;t give proper diagnostics, nor system events do. WPF fails to install at some point onto every XP installations we have, including clean <strong>special test XP SP2 VMWare images downloaded from Microsoft</strong>.</p>
<p><strong>Update</strong>: <a href="http://victorsergienko.com/dotnet-bootstrapper-from-msiexec/">Here&#8217;s the answer</a>.</p>
<p>Now I rolled back to dotnetfx3setup.exe redistributable. It&#8217;s 2.8M compared to 300K bootstrapper generated by MSBuild, and it&#8217;s a pain to see installer grow&#8230;And if .NET 3.0 is already installed it starts to uninstall it&#8230; and there is no key to make it just &#8220;check or install&#8221;, need to trick it via WiX.</p>
<p>But we have to pay it. Oh my.</p>
<p>All over the Web I see no evidence that any man walked this path before. For.NET 2.0 - a lot of mentions and code samples. And completely empty for .NET 3.0.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/msbuild-bootstrapper-for-net-30-framework-broken/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/msbuild-bootstrapper-for-net-30-framework-broken/</feedburner:origLink></item>
		<item>
		<title>C++ static code checker</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/258179735/</link>
		<comments>http://victorsergienko.com/cpp-static-code-checker-2/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 08:31:24 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[C++]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/cpp-static-code-checker-2/</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/cpp-static-code-checker-2/&t=C++ static code checker&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Did you ever try parsing C++? What about parsing for every combination of possible <em>define</em>-s at once?</p>
<p>Microsoft has a <a href="http://www.microsoft.com/windows/cse/pa_projects.mspx">static code checker tools for C++</a>, like FxCop for .NET.</p>
<p>That&#8217;s awfully complex task, you now see. In .NET you can analyze bytecode, and luckily don&#8217;t really need to account for conditional compilation. In C++ where everthing is about <em>#ifdef</em> - it&#8217;s hell.</p>
<p>I never heared of anything like that. Though <a href="http://www.parasoft.com/jsp/products/home.jsp?product=Insure">Insure++</a> or <a href="http://automatedqa.com/products/aqtime/">AQTime</a> do way more things when profiling runtime, they of course find only things that were on necessary execution paths.</p>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/cpp-static-code-checker-2/&t=C++ static code checker&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Did you ever try parsing C++? What about parsing for every combination of possible <em>define</em>-s at once?</p>
<p>Microsoft has a <a href="http://www.microsoft.com/windows/cse/pa_projects.mspx">static code checker tools for C++</a>, like FxCop for .NET.</p>
<p>That&#8217;s awfully complex task, you now see. In .NET you can analyze bytecode, and luckily don&#8217;t really need to account for conditional compilation. In C++ where everthing is about <em>#ifdef</em> - it&#8217;s hell.</p>
<p>I never heared of anything like that. Though <a href="http://www.parasoft.com/jsp/products/home.jsp?product=Insure">Insure++</a> or <a href="http://automatedqa.com/products/aqtime/">AQTime</a> do way more things when profiling runtime, they of course find only things that were on necessary execution paths.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/cpp-static-code-checker-2/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/cpp-static-code-checker-2/</feedburner:origLink></item>
		<item>
		<title>WiX linkdump: samples and howto-s I found, mostly .NET deployment</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/255208035/</link>
		<comments>http://victorsergienko.com/wix-net-linkdump-samples-howto-s/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 23:38:44 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[WiX]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/wix-net-linkdump-samples-howto-s/</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/wix-net-linkdump-samples-howto-s/&t=WiX linkdump: samples and howto-s I found, mostly .NET deployment&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Some pages that somewhy didn&#8217;t appear at top of Google searches for <a href="http://wix.sourceforge.net/">WiX</a> help.</p>
<ul>
<li><a href="http://www.wixwiki.com/">WiXWiki.com</a> - pretty useful and contains some snippets you won&#8217;t find in WiX manual or tutorial. <em>Many of rare code snippets</em></li>
<li><a href="http://wix.sourceforge.net/releases/">WiX development releases</a>; some broken (last two broken in VS 2008), some contain the very things you&#8217;ll need;</li>
<li>Justin Rockwood&#8217;s blog entry <a href="http://blogs.msdn.com/jrock/archive/2008/01/29/complete-list-of-candle-preprocessor-variables.aspx">with Votive (Visual Studio addon) preprocessor variables</a>. The blog itself is also thing to read;</li>
<li>Alex Shevcuk&#8217;s blog entry on <a href="http://blogs.technet.com/alexshev/archive/2008/02/10/from-msi-to-wix-part-3.aspx">checking pre- and postconditions in WiX</a>. <em>His whole <a href="http://blogs.technet.com/alexshev/archive/tags/WiX/default.aspx">cycle on WiX</a> - I also highly recommend it</em>;</li>
<li>Separately, <strong>.NET</strong>: WixWiki pages about <a href="http://www.wixwiki.com/index.php?title=Custom_Action_Type_2">checking for .NET</a> runtime and <a href="http://www.wixwiki.com/index.php?title=Deploying_Additional_Components">deploying it with a bootstrapper generated with MSBuild</a>;</li>
<li>Another WiX wiki on mindcapers.net, I particularily needed <a href="http://wix.mindcapers.com/wiki/ICE38">ICE38 error explanation</a>;</li>
<li>John Robbins&#8217; blog entry on patching <a href="http://www.wintellect.com/cs/blogs/jrobbins/archive/2007/12/10/cumulative-patching-with-wix-2-0.aspx">patching</a> with WiX. <em>You don&#8217;t want number of auto-update patches to grow quadratically</em>?</li>
<li>Last but not the least, <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/using_properties.asp">MSI properties reference</a> on MSDN.</li>
</ul>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/wix-net-linkdump-samples-howto-s/&t=WiX linkdump: samples and howto-s I found, mostly .NET deployment&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Some pages that somewhy didn&#8217;t appear at top of Google searches for <a href="http://wix.sourceforge.net/">WiX</a> help.</p>
<ul>
<li><a href="http://www.wixwiki.com/">WiXWiki.com</a> - pretty useful and contains some snippets you won&#8217;t find in WiX manual or tutorial. <em>Many of rare code snippets</em></li>
<li><a href="http://wix.sourceforge.net/releases/">WiX development releases</a>; some broken (last two broken in VS 2008), some contain the very things you&#8217;ll need;</li>
<li>Justin Rockwood&#8217;s blog entry <a href="http://blogs.msdn.com/jrock/archive/2008/01/29/complete-list-of-candle-preprocessor-variables.aspx">with Votive (Visual Studio addon) preprocessor variables</a>. The blog itself is also thing to read;</li>
<li>Alex Shevcuk&#8217;s blog entry on <a href="http://blogs.technet.com/alexshev/archive/2008/02/10/from-msi-to-wix-part-3.aspx">checking pre- and postconditions in WiX</a>. <em>His whole <a href="http://blogs.technet.com/alexshev/archive/tags/WiX/default.aspx">cycle on WiX</a> - I also highly recommend it</em>;</li>
<li>Separately, <strong>.NET</strong>: WixWiki pages about <a href="http://www.wixwiki.com/index.php?title=Custom_Action_Type_2">checking for .NET</a> runtime and <a href="http://www.wixwiki.com/index.php?title=Deploying_Additional_Components">deploying it with a bootstrapper generated with MSBuild</a>;</li>
<li>Another WiX wiki on mindcapers.net, I particularily needed <a href="http://wix.mindcapers.com/wiki/ICE38">ICE38 error explanation</a>;</li>
<li>John Robbins&#8217; blog entry on patching <a href="http://www.wintellect.com/cs/blogs/jrobbins/archive/2007/12/10/cumulative-patching-with-wix-2-0.aspx">patching</a> with WiX. <em>You don&#8217;t want number of auto-update patches to grow quadratically</em>?</li>
<li>Last but not the least, <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msi/setup/using_properties.asp">MSI properties reference</a> on MSDN.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/wix-net-linkdump-samples-howto-s/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/wix-net-linkdump-samples-howto-s/</feedburner:origLink></item>
		<item>
		<title>NAnt vs MSBuild funnies</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/255091825/</link>
		<comments>http://victorsergienko.com/nant-vs-msbuild-versioning-internalsvisibleto/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 19:11:49 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[MSBuild]]></category>

		<category><![CDATA[NAnt]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/nant-vs-msbuild-versioning-internalsvisibleto/</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/nant-vs-msbuild-versioning-internalsvisibleto/&t=NAnt vs MSBuild funnies&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>All the software is equally bad&#8230;</p>
<p>Well, I know some pieces of software that are good, but I won&#8217;t mention them today.</p>
<p>One of our <strong><a href="http://victorsergienko.com/msbuild-teambuild-vs-nant/">msbuild vs nant</a> choice criteria</strong> is  a product versioning support.</p>
<p>Sad or funny things are:</p>
<ul>
<li>both don&#8217;t include sane tool out of box;</li>
<li>both need installing <a href="http://nantcontrib.sourceforge.net/">NAntContrib</a> or <a href="http://msbuildtasks.tigris.org/servlets/ProjectMailingListList">MSBuild Community Tasks</a>;</li>
<li>even then <strong>both can&#8217;t sanely write AssemblyInfo.cs</strong> in order to leave other properties intact; if you had <a href="http://msdn2.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx">InternalsVisibleTo</a> satellite unit test assembly - it won&#8217;t build then;</li>
</ul>
<p><a href="http://nantcontrib.sourceforge.net/release/latest/help/tasks/version.html">NAntContrib Version task</a> is way more functional.</p>
<p>Additionally, MSDN page design where <a href="http://msdn2.microsoft.com/en-us/library/0k6kkbsd.aspx">MSBuild reference</a> manual lives, is awful.</p>
<p>I wonder if it&#8217;s the reason to choose a build tool, while they are approximately equal.</p>
<p>OTOH, MSBuild has a great <a rel="nofollow" href="http://www.wixwiki.com/index.php?title=Deploying_Additional_Components">GenerateBootstrapper</a> task to install .NET framework from MSI (WiX sample included in the referenced wiki).</p>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/nant-vs-msbuild-versioning-internalsvisibleto/&t=NAnt vs MSBuild funnies&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>All the software is equally bad&#8230;</p>
<p>Well, I know some pieces of software that are good, but I won&#8217;t mention them today.</p>
<p>One of our <strong><a href="http://victorsergienko.com/msbuild-teambuild-vs-nant/">msbuild vs nant</a> choice criteria</strong> is  a product versioning support.</p>
<p>Sad or funny things are:</p>
<ul>
<li>both don&#8217;t include sane tool out of box;</li>
<li>both need installing <a href="http://nantcontrib.sourceforge.net/">NAntContrib</a> or <a href="http://msbuildtasks.tigris.org/servlets/ProjectMailingListList">MSBuild Community Tasks</a>;</li>
<li>even then <strong>both can&#8217;t sanely write AssemblyInfo.cs</strong> in order to leave other properties intact; if you had <a href="http://msdn2.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx">InternalsVisibleTo</a> satellite unit test assembly - it won&#8217;t build then;</li>
</ul>
<p><a href="http://nantcontrib.sourceforge.net/release/latest/help/tasks/version.html">NAntContrib Version task</a> is way more functional.</p>
<p>Additionally, MSDN page design where <a href="http://msdn2.microsoft.com/en-us/library/0k6kkbsd.aspx">MSBuild reference</a> manual lives, is awful.</p>
<p>I wonder if it&#8217;s the reason to choose a build tool, while they are approximately equal.</p>
<p>OTOH, MSBuild has a great <a rel="nofollow" href="http://www.wixwiki.com/index.php?title=Deploying_Additional_Components">GenerateBootstrapper</a> task to install .NET framework from MSI (WiX sample included in the referenced wiki).</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/nant-vs-msbuild-versioning-internalsvisibleto/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/nant-vs-msbuild-versioning-internalsvisibleto/</feedburner:origLink></item>
		<item>
		<title>Auto-update with WiX</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/253586417/</link>
		<comments>http://victorsergienko.com/automatic-auto-update-and-wix/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 11:43:12 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[tools]]></category>

		<category><![CDATA[WiX]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/automatic-auto-update-and-wix/</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/automatic-auto-update-and-wix/&t=Auto-update with WiX&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Windows Installer on itself is a pain. <a href="http://wix.sourceforge.net/">WiX</a> saves you from it, mostly wrapping the complexity into XML constructs understandable to non-gurus.</p>
<p>Well, not completely - you still have to know:</p>
<ul>
<li>why the heck shortcut didn&#8217;t appear in start menu;</li>
<li>how to create a web site shortcut;</li>
<li>why to create RegistryValue for a program directory you create, and that&#8217;s the simplest things. <em>Still better then MFC&#8230;</em></li>
</ul>
<p>But a very good <a href="http://www.tramontana.co.hu/wix/">tutorial</a> exists, maillist is very active and it&#8217;s easy to get support.<br />
<em>Maybe it&#8217;s another reason to love Unix-es, where &#8220;install <strong>IS</strong> just a copy&#8221;.<br />
Though, one has to admit that installing Windows application involves somewhat more desktop integration</em>.</p>
<p>I was looking  for an auto-update, so that:</p>
<ul>
<li>application could say &#8220;<strong>New version available, download? Restart now?</strong>&#8220;;</li>
<li>would use MSI;</li>
<li>download should preferably use <a href="http://msdn.microsoft.com/msdnmag/issues/03/02/bits/TOC.ASP">BITS</a>.</li>
</ul>
<p>Simple automatic updaters like <a href="http://www.codeproject.com/KB/vb/Auto_Update_Revisited.aspx">this</a> on Codeproject won&#8217;t do, because you can&#8217;t just download necessary files: Windows Installer will revert them back. Or you would have to &#8220;<a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q303439">disable WI&#8217;s Resiliency</a>&#8220;, which is also a bad idea.</p>
<h3>Solution of my choice</h3>
<p><a href="http://wix.sourceforge.net/clickthrough.html">ClickThrough</a> subproject of WiX <a href="http://wix.sourceforge.net/ctvision.html">promises</a> that, but it&#8217;s still beta and crashes. Still you can easily compare two MSI files, generate a <a href="http://trentm.com/blog/archives/2007/05/29/wix-and-msp/">MSP patch</a>, and a RSS feed that client can check, download and even read by eye, so simple it is - a pretty tasty feature.</p>
<p>There is no .NET client code. For now, there is only a separate update.exe that will find, download and install new version. Still, you cannot ask user whether to download now or not, cannot tell what&#8217;s new, when to restart, etc.<br />
But you can painlessly add a Start menu shortcut that will update your application.</p>
<p>Come later, I&#8217;m going to create a C# code that will check for updates, and probably publish it.</p>
<h3>Other solutions</h3>
<p>You can use <a href="http://msdn2.microsoft.com/en-us/library/ms978574.aspx">Updater ApplicationBlock</a>, or more exactly, latest version now <a href="http://www.codeplex.com/smartclient/Wiki/View.aspx?title=Updater%20Application%20Block">lives at CodePlex</a>. But Enterprise Library wasn&#8217;t updated for .NET 3.5, and I believe it&#8217;s abandoned.</p>
<p>You can use <a href="http://nsis.sourceforge.net/">NSIS</a>. Though, it&#8217;s not Windows Installer MSI packager, it creates own files and scripts.</p>
<p>For ClickOnce application, you can use <a href="http://msdn2.microsoft.com/en-us/library/system.deployment.application.aspx">Application.Deployment</a>.</p>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/automatic-auto-update-and-wix/&t=Auto-update with WiX&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Windows Installer on itself is a pain. <a href="http://wix.sourceforge.net/">WiX</a> saves you from it, mostly wrapping the complexity into XML constructs understandable to non-gurus.</p>
<p>Well, not completely - you still have to know:</p>
<ul>
<li>why the heck shortcut didn&#8217;t appear in start menu;</li>
<li>how to create a web site shortcut;</li>
<li>why to create RegistryValue for a program directory you create, and that&#8217;s the simplest things. <em>Still better then MFC&#8230;</em></li>
</ul>
<p>But a very good <a href="http://www.tramontana.co.hu/wix/">tutorial</a> exists, maillist is very active and it&#8217;s easy to get support.<br />
<em>Maybe it&#8217;s another reason to love Unix-es, where &#8220;install <strong>IS</strong> just a copy&#8221;.<br />
Though, one has to admit that installing Windows application involves somewhat more desktop integration</em>.</p>
<p>I was looking  for an auto-update, so that:</p>
<ul>
<li>application could say &#8220;<strong>New version available, download? Restart now?</strong>&#8220;;</li>
<li>would use MSI;</li>
<li>download should preferably use <a href="http://msdn.microsoft.com/msdnmag/issues/03/02/bits/TOC.ASP">BITS</a>.</li>
</ul>
<p>Simple automatic updaters like <a href="http://www.codeproject.com/KB/vb/Auto_Update_Revisited.aspx">this</a> on Codeproject won&#8217;t do, because you can&#8217;t just download necessary files: Windows Installer will revert them back. Or you would have to &#8220;<a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q303439">disable WI&#8217;s Resiliency</a>&#8220;, which is also a bad idea.</p>
<h3>Solution of my choice</h3>
<p><a href="http://wix.sourceforge.net/clickthrough.html">ClickThrough</a> subproject of WiX <a href="http://wix.sourceforge.net/ctvision.html">promises</a> that, but it&#8217;s still beta and crashes. Still you can easily compare two MSI files, generate a <a href="http://trentm.com/blog/archives/2007/05/29/wix-and-msp/">MSP patch</a>, and a RSS feed that client can check, download and even read by eye, so simple it is - a pretty tasty feature.</p>
<p>There is no .NET client code. For now, there is only a separate update.exe that will find, download and install new version. Still, you cannot ask user whether to download now or not, cannot tell what&#8217;s new, when to restart, etc.<br />
But you can painlessly add a Start menu shortcut that will update your application.</p>
<p>Come later, I&#8217;m going to create a C# code that will check for updates, and probably publish it.</p>
<h3>Other solutions</h3>
<p>You can use <a href="http://msdn2.microsoft.com/en-us/library/ms978574.aspx">Updater ApplicationBlock</a>, or more exactly, latest version now <a href="http://www.codeplex.com/smartclient/Wiki/View.aspx?title=Updater%20Application%20Block">lives at CodePlex</a>. But Enterprise Library wasn&#8217;t updated for .NET 3.5, and I believe it&#8217;s abandoned.</p>
<p>You can use <a href="http://nsis.sourceforge.net/">NSIS</a>. Though, it&#8217;s not Windows Installer MSI packager, it creates own files and scripts.</p>
<p>For ClickOnce application, you can use <a href="http://msdn2.microsoft.com/en-us/library/system.deployment.application.aspx">Application.Deployment</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/automatic-auto-update-and-wix/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/automatic-auto-update-and-wix/</feedburner:origLink></item>
		<item>
		<title>Choosing MSBuild/TeamBuild vs NAnt</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/253586418/</link>
		<comments>http://victorsergienko.com/msbuild-teambuild-vs-nant/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 15:51:31 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[linkdump]]></category>

		<category><![CDATA[MSBuild]]></category>

		<category><![CDATA[NAnt]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/choose-msbuildteambuild-vs-nant/</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/msbuild-teambuild-vs-nant/&t=Choosing MSBuild/TeamBuild vs NAnt&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>We&#8217;re choosing a build tool for VS 2008 project.<br />
I&#8217;m not expert in any, only had put together a couple of <a href="http://nant.sourceforge.net/">NAnt</a> scripts. So I give no objective technical information in this post, just impressions.</p>
<ul>
<li><a href="http://forums.microsoft.com/msdn/showpost.aspx?postid=1044&amp;siteid=1&amp;sb=0&amp;d=1&amp;at=7&amp;ft=11&amp;tf=0&amp;pageid=0">First discussion</a> of this choice, back in 2005, is almost strictly in favor of NAnt. Though, read it to know about MSBuild differences and advantages.</li>
<li><a href="http://ayende.com/Blog/archive/2008/02/24/MsBuild-vs.-NAnt.aspx">Recent blog post by Oren Eini</a> and int comments are also generally for NAnt. Additionally, you can use &lt;msbuild&gt; task in NAnt.</li>
<li>The latter mentions Yahoo! <a href="http://tech.groups.yahoo.com/group/altdotnet/messages">ALT.NET</a> group <a href="http://tech.groups.yahoo.com/group/altdotnet/message/3436?threaded=1">discussion</a>. Newsgroup fan can read a lot there, I also had some. There are reasonable votes there for MSBuild because it&#8217;s just deployed with .NET, ant it&#8217;s nearly functionally equivalent to NAnt.<br />
Though, I can&#8217;t forget first discussion that mentioned lack of tasks like editing files or grabbing text output, or incrementing build number - (you know, devil is in details!) - it <strong>seems</strong> to me that NAnt wins.<br />
Here&#8217;s the <a href="http://tech.groups.yahoo.com/group/altdotnet/message/3476?threaded=1&amp;p=15">most useful message there</a>, as for me.</li>
</ul>
<p>You see, I didn&#8217;t go too deep down <a href="http://www.google.com/search?hl=en&amp;q=teambuild%20vs%20nant">simple Google search</a>. That was enough for me, you&#8217;re welcome to research deeper and to correct me&#8230; especially until I started creating build procedure &lt;grin&gt;</p>
<p>And I trust mature and popular opensource products.</p>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/msbuild-teambuild-vs-nant/&t=Choosing MSBuild/TeamBuild vs NAnt&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>We&#8217;re choosing a build tool for VS 2008 project.<br />
I&#8217;m not expert in any, only had put together a couple of <a href="http://nant.sourceforge.net/">NAnt</a> scripts. So I give no objective technical information in this post, just impressions.</p>
<ul>
<li><a href="http://forums.microsoft.com/msdn/showpost.aspx?postid=1044&amp;siteid=1&amp;sb=0&amp;d=1&amp;at=7&amp;ft=11&amp;tf=0&amp;pageid=0">First discussion</a> of this choice, back in 2005, is almost strictly in favor of NAnt. Though, read it to know about MSBuild differences and advantages.</li>
<li><a href="http://ayende.com/Blog/archive/2008/02/24/MsBuild-vs.-NAnt.aspx">Recent blog post by Oren Eini</a> and int comments are also generally for NAnt. Additionally, you can use &lt;msbuild&gt; task in NAnt.</li>
<li>The latter mentions Yahoo! <a href="http://tech.groups.yahoo.com/group/altdotnet/messages">ALT.NET</a> group <a href="http://tech.groups.yahoo.com/group/altdotnet/message/3436?threaded=1">discussion</a>. Newsgroup fan can read a lot there, I also had some. There are reasonable votes there for MSBuild because it&#8217;s just deployed with .NET, ant it&#8217;s nearly functionally equivalent to NAnt.<br />
Though, I can&#8217;t forget first discussion that mentioned lack of tasks like editing files or grabbing text output, or incrementing build number - (you know, devil is in details!) - it <strong>seems</strong> to me that NAnt wins.<br />
Here&#8217;s the <a href="http://tech.groups.yahoo.com/group/altdotnet/message/3476?threaded=1&amp;p=15">most useful message there</a>, as for me.</li>
</ul>
<p>You see, I didn&#8217;t go too deep down <a href="http://www.google.com/search?hl=en&amp;q=teambuild%20vs%20nant">simple Google search</a>. That was enough for me, you&#8217;re welcome to research deeper and to correct me&#8230; especially until I started creating build procedure &lt;grin&gt;</p>
<p>And I trust mature and popular opensource products.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/msbuild-teambuild-vs-nant/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/msbuild-teambuild-vs-nant/</feedburner:origLink></item>
		<item>
		<title>Why would Wait-Pulse-PulseAll need monitor lock</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/253586419/</link>
		<comments>http://victorsergienko.com/why-wait-pulse-pulseall-monitor-lock/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 12:57:35 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/why-wait-pulse-pulseall-monitor-lock/</guid>
		<description><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/why-wait-pulse-pulseall-monitor-lock/&t=Why would Wait-Pulse-PulseAll need monitor lock&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Till now, I did understand but didn&#8217;t remember the very situation, as I wasn&#8217;t the one creating thread pools and alike: all the core things were already there.<br />
It&#8217;s a blessing to work for start-up.<br />
You can think about</p>
<pre style="background: #ffffff none repeat scroll 0% 50%; color: #000000; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">Monitor<span style="color: #808030;">.</span>Wait<span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">)</span><span style="color: #800080;">;</span> <span style="color: #696969;">// will throw SynchronizationLockException</span></pre>
<p>Now, after a look into docs, I see that one needs to hold the monitored object lock to avoid <a href="http://en.wikipedia.org/wiki/Race_conditions#Real-world_examples">race conditions</a>: a thread wakes up already holding a lock for an object it needs. The thread that did <code>Pulse()</code> acquired that lock and safely passed it to <code>Wait()</code>ing one.<br />
Just watch out for <a href="http://www.yoda.arachsys.com/csharp/threads/deadlocks.shtml">deadlocks</a>: it&#8217;s easy to wake up with one object lock, try to acquire another and die then&#8230;</p>
<pre style="background: #ffffff none repeat scroll 0% 50%; color: #000000; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><span style="font-weight: bold; color: #800000;">lock</span><span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
  Monitor<span style="color: #808030;">.</span>Wait<span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">)</span><span style="color: #800080;">;</span> <span style="color: #696969;">// will throw SynchronizationLockException</span>
<span style="color: #800080;">}</span></pre>
<p>As Doug Lea recommends in his excellent eternal &#8220;<a href="http://g.oswego.edu/dl/cpj/">Concurrent Programming in Java</a>&#8220;, just make it impossible. Lock only on a single object. If you really really need two locks, make them ordered: always acquire A then B.</p>
<p>If you do:</p>
<pre style="background: #ffffff none repeat scroll 0% 50%; color: #000000; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><span style="font-weight: bold; color: #800000;">lock</span><span style="color: #808030;">(</span>a<span style="color: #808030;">)</span><span style="color: #800080;">{</span>
  <span style="color: #696969;">// :</span>
  <span style="font-weight: bold; color: #800000;">lock</span> <span style="color: #808030;">(</span>b<span style="color: #808030;">)</span>
  <span style="color: #800080;">{</span>
    <span style="color: #696969;">//:</span>
  <span style="color: #800080;">}</span>
  <span style="color: #696969;">// or:</span>
  b<span style="color: #808030;">.</span>SomethingThatLocks<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #800080;">}</span>

<span style="color: #696969;">//then will you never ever do</span>

<span style="font-weight: bold; color: #800000;">lock</span><span style="color: #808030;">(</span>b<span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
  <span style="color: #696969;">//:</span>
  a<span style="color: #808030;">.</span>SomethingThatMightLock<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #800080;">}</span></pre>
<p>as calling other objects&#8217; methods while holding a lock badly affects your karma.</p>
<p>For more in-detail look, read &#8220;<a href="http://www.bluebytesoftware.com/blog/2006/11/02/EventWaitHandleAndMonitorsHowToPickOne.aspx">EventWaitHandle and Monitors: how to pick one?</a>&#8221; by Joe Duffy. He goes very deep down to system details.<br />
He also did a nice brief overview of missed pulse problem - why do you always check wait condition in a loop:</p>
<pre style="background: #ffffff none repeat scroll 0% 50%; color: #000000; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><span style="font-weight: bold; color: #800000;">while</span> <span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">.</span>Count <span style="color: #808030;">=</span><span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
  <span style="font-weight: bold; color: #800000;">lock</span><span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">)</span>
  <span style="color: #800080;">{</span>
    Monitor<span style="color: #808030;">.</span>Wait<span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
  <span style="color: #800080;">}</span>
<span style="color: #800080;">}</span></pre>
]]></description>
			<content:encoded><![CDATA[<div class="diggthisplugin" style="float: right; width: 42px; padding-right: 10px; margin-left: 10px; margin-bottom: 0px;"><iframe src="http://digg.com/tools/diggthis.php?u=http://victorsergienko.com/why-wait-pulse-pulseall-monitor-lock/&t=Why would Wait-Pulse-PulseAll need monitor lock&c=programming&k=#FFFFFF" scrolling="no" style="border: none; height: 80px; width: 52px;"></iframe>
		</div><p>Till now, I did understand but didn&#8217;t remember the very situation, as I wasn&#8217;t the one creating thread pools and alike: all the core things were already there.<br />
It&#8217;s a blessing to work for start-up.<br />
You can think about</p>
<pre style="background: #ffffff none repeat scroll 0% 50%; color: #000000; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">Monitor<span style="color: #808030;">.</span>Wait<span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">)</span><span style="color: #800080;">;</span> <span style="color: #696969;">// will throw SynchronizationLockException</span></pre>
<p>Now, after a look into docs, I see that one needs to hold the monitored object lock to avoid <a href="http://en.wikipedia.org/wiki/Race_conditions#Real-world_examples">race conditions</a>: a thread wakes up already holding a lock for an object it needs. The thread that did <code>Pulse()</code> acquired that lock and safely passed it to <code>Wait()</code>ing one.<br />
Just watch out for <a href="http://www.yoda.arachsys.com/csharp/threads/deadlocks.shtml">deadlocks</a>: it&#8217;s easy to wake up with one object lock, try to acquire another and die then&#8230;</p>
<pre style="background: #ffffff none repeat scroll 0% 50%; color: #000000; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><span style="font-weight: bold; color: #800000;">lock</span><span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
  Monitor<span style="color: #808030;">.</span>Wait<span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">)</span><span style="color: #800080;">;</span> <span style="color: #696969;">// will throw SynchronizationLockException</span>
<span style="color: #800080;">}</span></pre>
<p>As Doug Lea recommends in his excellent eternal &#8220;<a href="http://g.oswego.edu/dl/cpj/">Concurrent Programming in Java</a>&#8220;, just make it impossible. Lock only on a single object. If you really really need two locks, make them ordered: always acquire A then B.</p>
<p>If you do:</p>
<pre style="background: #ffffff none repeat scroll 0% 50%; color: #000000; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><span style="font-weight: bold; color: #800000;">lock</span><span style="color: #808030;">(</span>a<span style="color: #808030;">)</span><span style="color: #800080;">{</span>
  <span style="color: #696969;">// :</span>
  <span style="font-weight: bold; color: #800000;">lock</span> <span style="color: #808030;">(</span>b<span style="color: #808030;">)</span>
  <span style="color: #800080;">{</span>
    <span style="color: #696969;">//:</span>
  <span style="color: #800080;">}</span>
  <span style="color: #696969;">// or:</span>
  b<span style="color: #808030;">.</span>SomethingThatLocks<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #800080;">}</span>

<span style="color: #696969;">//then will you never ever do</span>

<span style="font-weight: bold; color: #800000;">lock</span><span style="color: #808030;">(</span>b<span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
  <span style="color: #696969;">//:</span>
  a<span style="color: #808030;">.</span>SomethingThatMightLock<span style="color: #808030;">(</span><span style="color: #808030;">)</span><span style="color: #800080;">;</span>
<span style="color: #800080;">}</span></pre>
<p>as calling other objects&#8217; methods while holding a lock badly affects your karma.</p>
<p>For more in-detail look, read &#8220;<a href="http://www.bluebytesoftware.com/blog/2006/11/02/EventWaitHandleAndMonitorsHowToPickOne.aspx">EventWaitHandle and Monitors: how to pick one?</a>&#8221; by Joe Duffy. He goes very deep down to system details.<br />
He also did a nice brief overview of missed pulse problem - why do you always check wait condition in a loop:</p>
<pre style="background: #ffffff none repeat scroll 0% 50%; color: #000000; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><span style="font-weight: bold; color: #800000;">while</span> <span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">.</span>Count <span style="color: #808030;">=</span><span style="color: #808030;">=</span> <span style="color: #008c00;">0</span><span style="color: #808030;">)</span>
<span style="color: #800080;">{</span>
  <span style="font-weight: bold; color: #800000;">lock</span><span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">)</span>
  <span style="color: #800080;">{</span>
    Monitor<span style="color: #808030;">.</span>Wait<span style="color: #808030;">(</span>toRetrieve<span style="color: #808030;">)</span><span style="color: #800080;">;</span>
  <span style="color: #800080;">}</span>
<span style="color: #800080;">}</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/why-wait-pulse-pulseall-monitor-lock/feed/</wfw:commentRss>
		<feedburner:origLink>http://victorsergienko.com/why-wait-pulse-pulseall-monitor-lock/</feedburner:origLink></item>
		<item>
		<title>Multithreading in WPF: getting started</title>
		<link>http://feeds.feedburner.com/~r/FiberglassFlowers/~3/253586420/</link>
		<comments>http://victorsergienko.com/multithreading-in-wpf-getting-started/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 16:55:30 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
		
		<category><![CDATA[Main]]></category>

		<category><![CDATA[.net]]></category>

		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/multithreading-in-wpf-getting-started/</guid>
		<description><![CDATA[Couple of things to know when starting a new thread in WPF application]]></description>
			<conten