<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>CodeForNothing</title>
	<atom:link href="http://codefornothing.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codefornothing.wordpress.com</link>
	<description></description>
	<lastBuildDate>Sun, 22 Jan 2012 20:49:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codefornothing.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>CodeForNothing</title>
		<link>http://codefornothing.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codefornothing.wordpress.com/osd.xml" title="CodeForNothing" />
	<atom:link rel='hub' href='http://codefornothing.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Building a grammar for the R Language</title>
		<link>http://codefornothing.wordpress.com/2012/01/22/building-a-grammar-for-the-r-language/</link>
		<comments>http://codefornothing.wordpress.com/2012/01/22/building-a-grammar-for-the-r-language/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 20:49:05 +0000</pubDate>
		<dc:creator>codefornothing</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">https://codefornothing.wordpress.com/?p=239</guid>
		<description><![CDATA[One of the less well known features of GeneXproTools is the ability for the users to add support for new &#8230;<p><a href="http://codefornothing.wordpress.com/2012/01/22/building-a-grammar-for-the-r-language/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=239&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the less well known features of GeneXproTools is the ability for the users to add support for new programming languages. Out of the box, GeneXproTools 4.3, can export the models it creates to fifteen or sixteen programming languages depending on the type of problem. The “secret” to this flexibility is the fact that, internally, GeneXproTools uses Karva notation which is a very compact language which is easily converted into a tree that can then be cross-compiled into almost any programming language. As in a traditional compiler, this component of GeneXproTools is divided into a backend and frontend. The frontend processes the Karva notation as I described above whereas the backend, assisted by a resource or grammar, recreates the model in the programming of choice. Adding a new programming language is as simple as creating a new grammar.</p>
<h3>What is a Grammar?</h3>
<p>A grammar is simply an XML file that tells GeneXproTools how each function is represented in the language of that grammar. For example, and choosing the javascript grammar as an example, the function such as the power is described as such:</p>
<p><font size="2" face="Courier New">&lt;function uniontype=&#8221;" terminals=&#8221;2&#8243; symbol=&#8221;Pow&#8221; idx=&#8221;5&#8243;&gt;Math.pow(x0,x1)&lt;/function&gt;</font></p>
<p>Let’s ignore the first parameter for the moment. The second one, terminals, defines the arity of the function (the number of inputs), the third and last parameters are fixed values used internally in GeneXproTools that cannot be changed. Finally, the inner text of the node is the description of the power function as is will appear in the code. Note that the inputs must always have the format x0, x1… x<font size="1">n</font> where n is the arity of the function. As of this writing each grammar defines 279 functions so it is a good idea to start the new grammar by copying one that resembles the new language as much as possible.</p>
<p>Some functions are special and require that the initial parameter, uniontype, be defined. These are the functions used to link the various genes in the model. At the moment there are four such functions per grammar and here is the javascript addition as an example:</p>
<p><font size="2" face="Courier New">&lt;function <strong>uniontype=&#8221;{tempvarname} {symbol}= {member}&#8221;</strong> terminals=&#8221;2&#8243; symbol=&#8221;+&#8221; idx=&#8221;0&#8243;&gt;(x0+x1)&lt;/function&gt;</font></p>
<p>It is quite simple. The uniontype contents match the beginning of each line of code in a model. A typical model in javascript would be:</p>
<p><font size="2" face="Courier New">function gepModel(d)<br />{<br />&nbsp;&nbsp;&nbsp; var vTemp = 0.0;</font></p>
<p><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp; vTemp = (d[0]*((Math.sqrt(d[3])+d[2])+(Math.sqrt(d[1])/d[2])));<br />&nbsp;&nbsp;&nbsp; <strong><font color="#ff0000">vTemp +=</font></strong> ((d[2]*d[3])*Math.sqrt((Math.pow(d[3],3)*(d[1]/d[2]))));<br />&nbsp;&nbsp;&nbsp; <strong><font color="#ff0000">vTemp +=</font></strong> (d[2]*(((d[3]*d[3])*(d[1]-d[3]))+((d[3]/d[1])/d[1])));</font></p>
<p><font size="2" face="Courier New">&nbsp;&nbsp;&nbsp; return vTemp;<br />}</font></p>
<p>The uniontype represents the code in bold and set to red (for good measure). When we translate the same model to MATLAB the result will be:</p>
<p><font size="2" face="Courier New">function result = gepModel(d)</font></p>
<p><font size="2" face="Courier New">varTemp = 0.0;</font></p>
<p><font size="2" face="Courier New">varTemp = (d(1)*((sqrt(d(4))+d(3))+(sqrt(d(2))/d(3))));<br /><strong><font color="#ff0000">varTemp = varTemp + </font></strong>((d(3)*d(4))*sqrt(((d(4)^3)*(d(2)/d(3)))));<br /><strong><font color="#ff0000">varTemp = varTemp +</font> </strong>(d(3)*(((d(4)*d(4))*(d(2)-d(4)))+((d(4)/d(2))/d(2))));</font></p>
<p><font size="2" face="Courier New">result = varTemp;</font></p>
<p>In this case the corresponding uniontype is defined as such:</p>
<p><font size="2" face="Courier New">&lt;function <strong>uniontype=&#8221;{tempvarname} = {tempvarname} {symbol} {member}&#8221;</strong> terminals=&#8221;2&#8243; symbol=&#8221;+&#8221; idx=&#8221;0&#8243;&gt;(x0+x1)&lt;/function&gt;</font></p>
<p>So the <em>tempvarname</em> is the variable that accumulates the models’ results, the <em>symbol </em>is the operator used to&nbsp; link the genes and the <em>member </em>represents the body of the gene. Again, if you choose a grammar that resembles the new language as a starting point then you can pretty much just leave this part unchanged.</p>
<p>Another important aspect of the grammars are the “helper functions”. These are functions that require a special implementation for that language. For example, Visual Basic does not have a native Mod function so we have to define it as a callable or helper function. In this case the function is defined as:</p>
<p><font size="2" face="Courier New">&lt;function uniontype=&#8221;" terminals=&#8221;2&#8243; symbol=&#8221;Mod&#8221; idx=&#8221;4&#8243;&gt;gepMod(x0,x1)&lt;/function&gt;</font></p>
<p>And the function gepMod is defined in the helpers section of the grammar as such:</p>
<p><font size="2" face="Courier New">&lt;helper replaces=&#8221;Mod&#8221;&gt;Function gepMod(ByVal x As Double, ByVal y As Double) As Double{CRLF}{TAB}gepMod = ((x / y) &#8211; Fix(x / y)) * y{CRLF}End Function{CRLF}&lt;/helper&gt;</font></p>
<p>As you can see there are special characters to help with formatting body of the function and the x character is also reserved and should be replaced with {CHARX}.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codefornothing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codefornothing.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codefornothing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codefornothing.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codefornothing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codefornothing.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codefornothing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codefornothing.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codefornothing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codefornothing.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codefornothing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codefornothing.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codefornothing.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codefornothing.wordpress.com/239/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=239&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codefornothing.wordpress.com/2012/01/22/building-a-grammar-for-the-r-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/441e58331067fb8538e3f9496fef3c8c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codefornothing</media:title>
		</media:content>
	</item>
		<item>
		<title>MS Chart workaround (1 of n)</title>
		<link>http://codefornothing.wordpress.com/2011/05/15/ms-chart-workaround-1-of-n/</link>
		<comments>http://codefornothing.wordpress.com/2011/05/15/ms-chart-workaround-1-of-n/#comments</comments>
		<pubDate>Sun, 15 May 2011 17:29:04 +0000</pubDate>
		<dc:creator>codefornothing</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[GeneXproTools]]></category>
		<category><![CDATA[MSChart]]></category>
		<category><![CDATA[User Interface]]></category>

		<guid isPermaLink="false">https://codefornothing.wordpress.com/?p=225</guid>
		<description><![CDATA[As I wrote before I am using the MS Chart for the more conventional charts in the development of the &#8230;<p><a href="http://codefornothing.wordpress.com/2011/05/15/ms-chart-workaround-1-of-n/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=225&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As I wrote <a href="http://codefornothing.wordpress.com/2011/05/07/and-the-best-wpf-chart-is/">before</a> I am using the MS Chart for the more conventional charts in the development of the next version of <a href="http://www.gepsoft.com/">GeneXproTools</a>. One particularly weak feature of this chart is the Zoom which is not very useful, has very cheesy scrollbars and also has  a few bugs here and there. One I came across recently was that when zooming in until the vertical line of the zoom cursor is not deleted when you stop dragging and release the mouse. It just stays there even if you zoom out completely. I don’t know if this is a side effect of hosting a Win32 component in WPF or if it is a bug but nevertheless I managed to come up with a very simple workaround. Maybe a bit too hacky for the more retentive but effective.</p>
<p>The solution was to handle the mouse down and mouse up events of the chart control and toggle the cursor colour between transparent and red (its default colour). Here is the XAML snippet:</p>
<pre class="csharpcode"><span class="kwrd">&lt;</span><span class="html">Charting:Chart</span>
    <span class="attr">x:Name</span><span class="kwrd">="chart1"</span>
    <span class="attr">MouseDown</span><span class="kwrd">="Chart1MouseDown"</span>
    <span class="attr">MouseUp</span><span class="kwrd">="Chart1MouseUp"</span> <span class="kwrd">/&gt;</span></pre>
<p>And here are the handlers:</p>
<pre class="csharpcode"><span class="kwrd">private</span> <span class="kwrd">void</span> Chart1MouseDown(<span class="kwrd">object</span> sender, MouseEventArgs e)
{
    <span class="kwrd">if</span>(e.Button == MouseButtons.Left)
    {
        var cursorX = chart1.ChartAreas[0].CursorX;
        cursorX.LineColor = Color.Red;
        var cursorY = chart1.ChartAreas[0].CursorY;
        cursorY.LineColor = Color.Red;
    }

}

<span class="kwrd">private</span> <span class="kwrd">void</span> Chart1MouseUp(<span class="kwrd">object</span> sender, MouseEventArgs e)
{
    var cursorX = chart1.ChartAreas[0].CursorX;
    cursorX.LineColor = Color.Transparent;
    var cursorY = chart1.ChartAreas[0].CursorY;
    cursorY.LineColor = Color.Transparent;
}</pre>
<p>I could not find a more elegant solution but this seems to work fine. The chart is a Scatter Chart and so far this is the only workaround. Let’s hope that the n in the title remains low.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codefornothing.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codefornothing.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codefornothing.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codefornothing.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codefornothing.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codefornothing.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codefornothing.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codefornothing.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codefornothing.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codefornothing.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codefornothing.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codefornothing.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codefornothing.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codefornothing.wordpress.com/225/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=225&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codefornothing.wordpress.com/2011/05/15/ms-chart-workaround-1-of-n/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/441e58331067fb8538e3f9496fef3c8c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codefornothing</media:title>
		</media:content>
	</item>
		<item>
		<title>And the best WPF chart is&#8230;</title>
		<link>http://codefornothing.wordpress.com/2011/05/07/and-the-best-wpf-chart-is/</link>
		<comments>http://codefornothing.wordpress.com/2011/05/07/and-the-best-wpf-chart-is/#comments</comments>
		<pubDate>Sat, 07 May 2011 10:14:35 +0000</pubDate>
		<dc:creator>codefornothing</dc:creator>
				<category><![CDATA[GeneXproTools]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">https://codefornothing.wordpress.com/?p=221</guid>
		<description><![CDATA[One of the the main features of the upcoming version of GeneXproTools is data visualization. Some of our charts, usually &#8230;<p><a href="http://codefornothing.wordpress.com/2011/05/07/and-the-best-wpf-chart-is/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=221&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the the main features of the upcoming version of <a href="http://www.gepsoft.com/gxpt.htm">GeneXproTools</a> is data visualization. Some of our charts, usually the more innovative, are home brewed but there is no point in rolling out yet another scatter chart when there are so many free and for pay high quality alternatives. Or so I thought.</p>
<p>We decided a while ago to migrate the front end of GeneXproTools to WPF a decision that so far we are happy with, so logically we should pick up a WPF chart component. After some searching I found this thread at <a href="http://stackoverflow.com/questions/428425/recommendation-for-high-performance-wpf-chart">stackoverflow</a> detailing most free and for pay alternatives but as soon as you dig into them you will find out they are divided into three groups:</p>
<ul>
<li>Very expensive charts</li>
<li>Very slow charts</li>
<li>Non WPF charts</li>
</ul>
<p>Of course there are non WPF charts that are very expensive (and possibly slow) but the point here is that I could not find a reasonably priced WPF chart that would be able to show a few tens of thousands of points in scatter mode without stuttering or loading delays. The WPF chart that came closest to it was Microsoft’s <a href="http://dynamicdatadisplay.codeplex.com/">Dynamic Data Display</a> which has an interesting API but in the end it was dropped due to UI inconsistencies and because it looks like a dead project. The paid for alternatives that are reasonably priced were a disappointment. Some <em><a href="http://www.scottlogic.co.uk/blog/colin/2010/12/visiblox-visifire-dynamicdatadisplay-charting-performance-comparison/">have good performance</a></em> characteristics but their focus is different from ours. They are very quick when redrawing a limited number of points but they take wall time to redraw large numbers of points (in the tens of thousands ballpark).</p>
<p>Well, then what is the alternative? The alternative is to go back in time and use the Microsoft Chart for WinForms. It draws tens of thousands, if not hundreds, without breaking a sweat, includes many different chart types including a FastPoint and even less mainstream ones such as a simple Histogram and it is free. The chart itself was licensed to Microsoft by Dundas which appears to have dropped it. That is a pity because it included a very nice configuration tool that is not available with Microsoft’s version. The downside is that you cannot use window transparency in the application and some flickering when the chart is loaded for the very first time but it seems to be a fair compromise.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codefornothing.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codefornothing.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codefornothing.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codefornothing.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codefornothing.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codefornothing.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codefornothing.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codefornothing.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codefornothing.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codefornothing.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codefornothing.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codefornothing.wordpress.com/221/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codefornothing.wordpress.com/221/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codefornothing.wordpress.com/221/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=221&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codefornothing.wordpress.com/2011/05/07/and-the-best-wpf-chart-is/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/441e58331067fb8538e3f9496fef3c8c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codefornothing</media:title>
		</media:content>
	</item>
		<item>
		<title>Minifying WPF. The MiniGrid.</title>
		<link>http://codefornothing.wordpress.com/2010/01/24/minifying-wpf-the-minigrid/</link>
		<comments>http://codefornothing.wordpress.com/2010/01/24/minifying-wpf-the-minigrid/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 20:00:01 +0000</pubDate>
		<dc:creator>codefornothing</dc:creator>
				<category><![CDATA[c#]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://codefornothing.wordpress.com/?p=211</guid>
		<description><![CDATA[We have been all composing Html by hand since Mosaic or Netscape hit the shelves late in the last century. &#8230;<p><a href="http://codefornothing.wordpress.com/2010/01/24/minifying-wpf-the-minigrid/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=211&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>We have been all composing Html by hand since Mosaic or Netscape hit the shelves late in the last century. Since then we have had a love and hate relationship with it. We love it because it is responsive and easy to compose by hand. We hate it because we have to do it by hand. But let&#8217;s drop Html for the moment since we have a newer and worst offender: WPF&#8217;s Xaml. Xaml is verbose and WPF&#8217;s Xaml is up there with the RSI gods. That is because, I guess, it was designed to be machine generated by Blend or Visual Studio but these two designers fall short of the mark in so many ways that it feels 1997 all over again with Blend for Frontpage and Visual Studio for Visual Interdev. No disrespect to the Visual Studio team implied, it is a hard problem to solve.</p>
<p>Meanwhile I got tired of writing RowDefinitions, ColumnDefinitions and VisibilityConverters by hand and decided to do something about it. That is how the MiniGrid was born. It is not a &#8220;minification &#8220;in the strict <a href="http://en.wikipedia.org/wiki/Minify">Wikipedian</a> sense of the word but an extension to WPF&#8217;s Grid. For this release I added three properties: Visible, RowsPattern and ColumnsPattern. Visible is Boolean and it flips Visibility between Visible and Collapsed to remove the need for Converters when binding to IsChecked or IsEnabled. The other two are bit more complex.</p>
<p><strong>RowsPattern and ColumnsPattern<br />
</strong></p>
<p>These two properties replace the need to define Grid.RowDefinitions and Grid.ColumnsDefinitions. Instead these definitions are defined inline as a pattern. The pattern can either be a series of &#8220;a&#8221; or &#8220;*&#8221; characters for Auto and Star or it can be a number for a pixel size. The definition of a grid with three rows and three columns could be:</p>
<p><span style="color:blue;font-family:Consolas;font-size:10pt;">&lt;Controls:MiniGrid RowsPattern=&#8221;aaa&#8221; ColumnsPattern=&#8221;a*a&#8221;/&gt;</span></p>
<p style="background:white;">This grid has three Auto rows, the first column is Auto, the second is Star and the third is Auto again. A definition with pixels would be:</p>
<p style="background:white;"><span style="color:blue;font-family:Consolas;font-size:10pt;">&lt;Controls:MiniGrid RowsPattern=&#8221;20 25 20&#8243; ColumnsPattern=&#8221;100 100&#8243;/&gt;<br />
</span></p>
<p style="background:white;">In this example the Grid will have three rows with 20, 25 and 20 pixels from top to bottom and two columns both 100 pixels wide.</p>
<p style="background:white;">The interesting bit is that the patterns work with the designer in both Visual Studio 2008 and 2010 Beta 2 and also in Blend 3 where the patterns can be changed in the property tab. The main limitation is that you cannot mix Auto/Star with numbers and I will remove this in a future version if I ever come across the need. The code is very simple, MiniGrid derives from Grid and adds three Dependent Properties that are intercepted when their value changes.</p>
<p style="background:white;">You can download the <a href="http://www.gepsoft.com/codefornothing/MiniGrid.cs.txt">code from here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codefornothing.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codefornothing.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codefornothing.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codefornothing.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codefornothing.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codefornothing.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codefornothing.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codefornothing.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codefornothing.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codefornothing.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codefornothing.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codefornothing.wordpress.com/211/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codefornothing.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codefornothing.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=211&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codefornothing.wordpress.com/2010/01/24/minifying-wpf-the-minigrid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/441e58331067fb8538e3f9496fef3c8c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codefornothing</media:title>
		</media:content>
	</item>
		<item>
		<title>Simple Multithreading 2.0</title>
		<link>http://codefornothing.wordpress.com/2010/01/20/simple-multithreading-2-0/</link>
		<comments>http://codefornothing.wordpress.com/2010/01/20/simple-multithreading-2-0/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 12:06:25 +0000</pubDate>
		<dc:creator>codefornothing</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://codefornothing.wordpress.com/2010/01/20/simple-multithreading-2-0/</guid>
		<description><![CDATA[Nearly one year ago I published an article on multithreading to share a library I had created. The point of &#8230;<p><a href="http://codefornothing.wordpress.com/2010/01/20/simple-multithreading-2-0/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=204&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Nearly one year ago I published an <a href="http://codefornothing.wordpress.com/2009/01/23/user-interface-and-multithreading-in-net/">article on multithreading</a> to share a library I had created. The point of that library was to simplify the usage of the BackgroundWorker by wrapping it with a micro-DSL. So far I used this library in two projects with very good results and since the code has evolved I am publishing a new version.
</p>
<p>The download is a VS.NET 2008 solution with a single project that includes two folders: Tests and Worker. The project has two external dependencies: MbUnit 2.4 and log4net 1.2. The library itself uses log4net for debugging purposes. If you don&#8217;t use log4net, delete the handful of _log.DebugFormat in the WorkerPool class and the _log declaration at the top. To use the library copy all the files in the folder Worker into your project.
</p>
<p>There are a few unit tests in the project and they all pass as long as you run them in isolation. If you run all tests in one go then some might fail. I am not 100% sure of the cause but it appears to be due to timing problems. When run in isolation they don&#8217;t fail at all. That is multithreading unit tests for you.
</p>
<p>I hope that the unit tests and the previous article are enough to get you started. I was planning to write a series on this subject but time has been short. If you have any questions or find bugs drop them in the comments.
</p>
<p>The <a href="http://www.gepsoft.com/codefornothing/WorkerPoolLib.zip">download is here</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codefornothing.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codefornothing.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codefornothing.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codefornothing.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codefornothing.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codefornothing.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codefornothing.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codefornothing.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codefornothing.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codefornothing.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codefornothing.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codefornothing.wordpress.com/204/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codefornothing.wordpress.com/204/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codefornothing.wordpress.com/204/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=204&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codefornothing.wordpress.com/2010/01/20/simple-multithreading-2-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/441e58331067fb8538e3f9496fef3c8c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codefornothing</media:title>
		</media:content>
	</item>
		<item>
		<title>Using microDSLs to Replace Helper Classes</title>
		<link>http://codefornothing.wordpress.com/2009/10/11/using-microdsls-to-replace-helper-classes/</link>
		<comments>http://codefornothing.wordpress.com/2009/10/11/using-microdsls-to-replace-helper-classes/#comments</comments>
		<pubDate>Sun, 11 Oct 2009 17:47:14 +0000</pubDate>
		<dc:creator>codefornothing</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[DSL]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://codefornothing.wordpress.com/?p=196</guid>
		<description><![CDATA[Helper classes are the dumping ground for more or less closely related methods that do not warrant a top level &#8230;<p><a href="http://codefornothing.wordpress.com/2009/10/11/using-microdsls-to-replace-helper-classes/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=196&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Helper classes are the dumping ground for more or less closely related methods that do not warrant a top level type by themselves. They tend to be not very well organized, semantically disjoint and hard to use. One particularly insidious type of helper class is the third party control helper. It hides all the knowledge required to link the controls with the application data behind a series of methods created piecemeal and consequently with poorly defined argument lists. Just today I was coding away yet another one of these helpers, this time to configure Telerik&#8217;s chart for WPF. After some time the code that called the helper was:</p>
<pre><span style="color:#008000;">RadChartHelper</span>.CollectionToPieChart(chart, myDataObject);</pre>
<p>And the helper was composed of a series of methods with names such as AddSeries , AddMapping, etc, etc. It was obvious that this was not going to end well, especially because I want to use this chart in many different places in the application.</p>
<p>The solution I came up with was the creation of a very small DSL (Domain Specific Language) to take care of the chart configuration. The DSL is composed through method chaining JQuery&#8217;s way and the main advantages of this approach are that it can enforce specific sequences of actions and can be extended in a predictable way. The resulting calling code needs to know more about Telerik&#8217;s structures and that is the price to pay for the expandability of the interface. On the other hand the intent is more clearly expressed, for example:</p>
<pre><span style="color:#008000;">RadChartBuilder</span>.Configure(chart)
    .AddSeriesDefinition(new <span style="color:#008000;">PieSeriesDefinition</span>())
    .AddMapping("Values", <span style="color:#008000;">DataPointMember</span>.YValue)
    .AddMapping("ColumnNames", <span style="color:#008000;">DataPointMember</span>.LegendLabel)
    .CloseMappings()
    .BindTo(myDataObject);</pre>
<p>Where &#8220;chart&#8221; is a RadChart control. I am re-using Telerik&#8217;s PieSeriesDefinition and DataPointMember which require some insider knowledge of the control but hopefully it is obvious that the first one defines the type of chart whereas the second one determines which property of the data source is bound to which part of a chart.</p>
<p>You may have noticed the CloseMappings() method which is not required for the chart but that is used to transition between &#8220;branches&#8221; of the DSL.  This is an interesting technique I applied by varying the returned type depending on the internal state of the configuration. There are two states in the process which I am calling branches: the main branch which is composed by AddSeriesDefinition and BindTo methods and the mappings branch which is composed by the IAddMapping interface (AddMapping and CloseMappings). The point here is that I want to enforce the addition of mappings after the addition of the series definition. So AddSeriesDefinition returns IAddMapping instead of RadChartBuilder forcing the developer to add mappings. CloseMappings returns to the main branch. It is hard to explain the mechanics of the process but the code is very simple and should be readily understandable.</p>
<p>This approach can be used for any type of configuration process and, I suspect, to most helper classes out there. Projects such as NHibernate and NInject use this approach which has been gaining support as a replacement for XML configuration files. I think this is a way to turn tedious code into a productive exercise in language definition.</p>
<p>You can <a href="http://www.gepsoft.com/codefornothing/RadChartBuilder.cs.txt">download the code from here</a>.</p>
<p>The usual caveats and disclaimers apply. The code is specific to <a href="http://www.telerik.com/products/wpf/chart.aspx">Telerik&#8217;s WPF RadChart</a> which is a commercial product.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codefornothing.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codefornothing.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codefornothing.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codefornothing.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codefornothing.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codefornothing.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codefornothing.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codefornothing.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codefornothing.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codefornothing.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codefornothing.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codefornothing.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codefornothing.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codefornothing.wordpress.com/196/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=196&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codefornothing.wordpress.com/2009/10/11/using-microdsls-to-replace-helper-classes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/441e58331067fb8538e3f9496fef3c8c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codefornothing</media:title>
		</media:content>
	</item>
		<item>
		<title>Big, Fast and (nearly) Silent</title>
		<link>http://codefornothing.wordpress.com/2009/08/02/big-fast-and-nearly-silent/</link>
		<comments>http://codefornothing.wordpress.com/2009/08/02/big-fast-and-nearly-silent/#comments</comments>
		<pubDate>Sun, 02 Aug 2009 09:13:20 +0000</pubDate>
		<dc:creator>codefornothing</dc:creator>
				<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://codefornothing.wordpress.com/?p=170</guid>
		<description><![CDATA[Building your own machine used to be a way to save money but recent price drops on entry and medium &#8230;<p><a href="http://codefornothing.wordpress.com/2009/08/02/big-fast-and-nearly-silent/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=170&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Building your own machine used to be a way to save money but recent price drops on entry and medium level PCs inverted the situation. It is actually cheaper to walk into PC World and buy a no frills box than to build something equivalent. That is not true in the high end of the market, though. Granted, you can buy a Dell with the latest iCore 7 for around £800 but it is housed in an anaemic box without any extra space for further expansion. It still makes sense to build your own if you are looking for some fun and good performance at a reasonable price.</p>
<p>When I set out to build a new PC I was using a cheap two core AMD based box that had been &#8220;supercharged&#8221; with extra memory, two reasonable graphics cards and an extra hard drive. This setup drove four monitors: two 24&#8242; plus two 19&#8242;, and did not cope very well with moving windows between monitors connected to different cards. This was a minor annoyance; the big issue were the ten plus seconds pauses whenever I started any WPF application, longer if started from within Visual Studio. For non developers this may sound irrelevant but when you start the same application over and over, hundreds of times a day the pauses can become rather painful. With this in mind and after looking at the alternatives I settled for the following components:</p>
<ul>
<li>Intel iCore 7 920 CPU</li>
<li>ASUS P6T motherboard with three PCI express 16/8x</li>
<li>6 Gb of Corsair Dominator RAM</li>
<li>Two Asus GeForce GTS 250 SLI 512MB graphics cards</li>
<li>Two Samsung 64GB 2.5&#8243; SATA-II MLC Solid State Hard Drives</li>
<li>Hitachi 500 Gb hard drive.</li>
<li>Antec 550 TruePower PSU</li>
<li>Antec Twelve Hundred case</li>
</ul>
<p>I considered a cheaper option built around AMD&#8217;s Phenom II but feared that the end result wouldn&#8217;t be such a big departure from what I already had. So I sacrificed another hundred pounds and went for the fastest processor in the market (crazy priced CPUs aside, of course). Altogether the grand total was close to nine hundred pounds but I did not have to buy the PSU, the DVD Drive and the Hitachi hard drive so it would have cost somewhere around the eleven  or twelve hundred pounds. This is not bad considering that Dell&#8217;s top of the line workstations start at £1,200 and don&#8217;t have SSDs or even space to install two graphics cards in some cases.</p>
<p>The components I am happier with are the SSDs and the CPU. The SSDs are installed in RAID0 and form the boot drive. With them Windows 7 takes a few (very few) seconds to reach login and there are no pauses after login. It is a huge departure from what I had where start up would take up to a minute and after login Windows would continue to hit the disk for a while. On the application side, Visual Studio Team System starts up in about three or four seconds despite having Resharper and several other add-ins enabled. SSDs are the single best upgrade ever and are worth the premium price. This is a game changer for the storage industry and it will not be very long before conventional hard drives are history.</p>
<p>This is the fastest PC I have ever built by a very long shot and it is does not run hot at all so I can keep it rather silent. The CPU is never maxed out and keeps a steady 45 degrees throughout the day with the odd 50 here and there. The iCore has eight hardware threads and four cores which is still overkill for most everyday computing including development. The most I have seen in CPU utilisation was 25% which is one core maxed out, nevertheless this will change very soon since one of the big new features in the next version of GeneXproTools is multi-processing.</p>
<p>The biggest disappointments were the graphics cards and the case. The graphics cards are quite good in the graphics department but noisy to the point of distraction and I nearly returned them as I could not find any aftermarket solution. After a lot of searching I found Artic Cooling&#8217;s Accelero Twin Turbo that, despite the name, is nearly silent. Not all bits of this cooler fit the Asus card perfectly so I had to improvise a bit but the end result was very good. One tip, the cooler has two power cables for the fans and you only need to connect one. Make sure you try both as one runs the fans faster and noisier than the other. At normal operation one GPU is at 49 degrees and the other at 55. Not sure why they are so different, maybe because one is closer to the CPU? Also in the cooling area, I bought an Xtreme Freezer for the CPU but, although it is less noisy, the standard cooler that came in the box was perfectly appropriate. The coolers added another ninety pounds to the grand total.</p>
<p>The case was another adventure. It looks stunning and has loads of space but it is a bit noisy so I had to turn off several fans. But the main problem was the top monster fan. It did not work. I asked for a replacement and was asked for pictures of the fan and then told to break it (!) and send a picture of the broken fan or they would not send a new one. In the end I received a new fan and although it starts it has to turn too fast to be silent. It is off at the moment. Antec&#8217;s customer service was not nice at all. Nobody likes to be assumed a liar after receiving a partly working  one hundred pounds case. I will avoid buying Antec products in the future despite quite liking them.</p>
<p>A final minor note: Setting up the RAID in the motherboard was quite a chore. The P6T BIOS was quite finicky and the instructions were not very clear. After a lot of wasted time I found out that the two first Sata connectors are dedicated to an easy to use RAID feature that did not recognise both SSDs. A side effect of using these two connectors was that the RAID start up prompt is hidden which caused endless reboots and frustration. The solution was not to use the two first ports but the poor instructions made me loose a couple of hours.</p>
<p>As for performance, I am quite happy with the result. The PC registers a 6.1 Windows Index for what is worth it, the lower being the graphics card and the higher at 7.2 the CPU. I am closing with a few pictures of the box and internals. Enjoy.</p>
<p>The case has several holes that allow passing all the wires to the back. A big plus.<br />
<img src='http://www.gepsoft.com/codefornothing/IMG_0714.JPG'></p>
<p>An overview of the front with the CPU to the right and the PSU to the left, which is the bottom of the case. The coolers of the graphics cards cover all the PCIe slots reducing the expandability of the system.<br />
<img src='http://www.gepsoft.com/codefornothing/IMG_0757.JPG'></p>
<p>The SSDs are still waiting for the rails to arrive&#8230;<br />
<img src='http://www.gepsoft.com/codefornothing/IMG_0759.JPG'></p>
<p>The original and very noisy cooler on the GTS 250 graphics card.<br />
<img src='http://www.gepsoft.com/codefornothing/IMG_0716.JPG'></p>
<p>Removing the original cooler was bit scary since it was quite well glued. In the picture you can see the small heat sinks that ship with the Twin Turbo. I had to improvise with the heat sinks on the far right because they did not fit very well between the capacitors that surround the voltage regulators.<br />
<img src='http://www.gepsoft.com/codefornothing/IMG_0725.JPG'></p>
<p>The final result: a very fat card that takes more than two slots.<br />
<img src='http://www.gepsoft.com/codefornothing/IMG_0730.JPG'></p>
<p>This cooler is huge with a 12 cm fan inside it.<br />
<img src='http://www.gepsoft.com/codefornothing/IMG_0761.JPG'></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codefornothing.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codefornothing.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codefornothing.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codefornothing.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codefornothing.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codefornothing.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codefornothing.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codefornothing.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codefornothing.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codefornothing.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codefornothing.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codefornothing.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codefornothing.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codefornothing.wordpress.com/170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=170&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codefornothing.wordpress.com/2009/08/02/big-fast-and-nearly-silent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/441e58331067fb8538e3f9496fef3c8c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codefornothing</media:title>
		</media:content>

		<media:content url="http://www.gepsoft.com/codefornothing/IMG_0714.JPG" medium="image" />

		<media:content url="http://www.gepsoft.com/codefornothing/IMG_0757.JPG" medium="image" />

		<media:content url="http://www.gepsoft.com/codefornothing/IMG_0759.JPG" medium="image" />

		<media:content url="http://www.gepsoft.com/codefornothing/IMG_0716.JPG" medium="image" />

		<media:content url="http://www.gepsoft.com/codefornothing/IMG_0725.JPG" medium="image" />

		<media:content url="http://www.gepsoft.com/codefornothing/IMG_0730.JPG" medium="image" />

		<media:content url="http://www.gepsoft.com/codefornothing/IMG_0761.JPG" medium="image" />
	</item>
		<item>
		<title>The mythical one hundred lines of code per day</title>
		<link>http://codefornothing.wordpress.com/2009/06/14/the-mythical-one-hundred-lines-of-code-per-day/</link>
		<comments>http://codefornothing.wordpress.com/2009/06/14/the-mythical-one-hundred-lines-of-code-per-day/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 08:50:36 +0000</pubDate>
		<dc:creator>codefornothing</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://codefornothing.wordpress.com/?p=150</guid>
		<description><![CDATA[If you want to start a flame war, mention lines of code per day or hour in a developer&#8217;s public &#8230;<p><a href="http://codefornothing.wordpress.com/2009/06/14/the-mythical-one-hundred-lines-of-code-per-day/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=150&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you want to start a flame war, mention lines of code per day or hour in a developer&#8217;s public forum. At least that is what I found when I started investigating how many lines of code are written per day per programmer. Lines of code, or loc for short, are supposedly a terrible metric for measuring programmer productivity and empirically I agree with this. There are too many variables involved starting with the definition of a line of code and going all the way up to the complexity of the requirements. There are single lines that take a long time to get right and there many lines which are mindless boilerplate code. All the same this measurement does have information encoded in it; the hard part is extracting that information and drawing the correct conclusions. Unfortunately I don&#8217;t have access to enough data about software projects to provide a statistically sound analysis but I got a very interesting result from measuring two very different projects that I would like to share.</p>
<p>The first project is a traditional client server data mining tool for a vertical market mostly built in VB.NET and WinForms. This project started in 2003 and has been through several releases and an upgrade from .NET 1.1 to .NET 2.0. It has server components but most of the half a million lines of code lives in the client side. The team has always had around four developers although not always the same people. The average lines of code for this project came in at around ninety lines of code per day per developer. I wasn&#8217;t able to measure the SQL in the stored procedures so this number is slightly inflated.</p>
<p>The second project is much smaller adding up to ten thousand lines of C# plus seven thousand lines of XAML created by a team of four that also worked on the first project. This project lasted three months and it is a WPF point of sale application thus very different in scope from the first project. It was built around a number of web services in SOA fashion and does not have a database per se. Its average came up around seventy lines of code per developer per day.</p>
<p>I am very surprised with the closeness of these numbers, especially given the difference in size and scope of the products. The commonality between them are the .NET framework and the team and one of them may be the key. Of these two, I am leaning to the .NET framework being the unifier because although the developers worked on both projects, three of elements on the team of the second project have spent less than a year on the first project and did not belong to the core team that wrote the vast majority of that first product. Or maybe there is something more general at work here?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codefornothing.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codefornothing.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codefornothing.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codefornothing.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codefornothing.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codefornothing.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codefornothing.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codefornothing.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codefornothing.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codefornothing.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codefornothing.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codefornothing.wordpress.com/150/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codefornothing.wordpress.com/150/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codefornothing.wordpress.com/150/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=150&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codefornothing.wordpress.com/2009/06/14/the-mythical-one-hundred-lines-of-code-per-day/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/441e58331067fb8538e3f9496fef3c8c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codefornothing</media:title>
		</media:content>
	</item>
		<item>
		<title>Visual Studio 2010 installation</title>
		<link>http://codefornothing.wordpress.com/2009/05/18/visual-studio-2010-team-system-installation-fails/</link>
		<comments>http://codefornothing.wordpress.com/2009/05/18/visual-studio-2010-team-system-installation-fails/#comments</comments>
		<pubDate>Mon, 18 May 2009 22:00:56 +0000</pubDate>
		<dc:creator>codefornothing</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Frameworks]]></category>
		<category><![CDATA[Visual Studio 2010]]></category>

		<guid isPermaLink="false">http://codefornothing.wordpress.com/2009/05/18/visual-studio-2010-team-system-installation-fails/</guid>
		<description><![CDATA[The Visual Studio 2010 Beta 1 download is about 1.2 G for Team System and a little less for the &#8230;<p><a href="http://codefornothing.wordpress.com/2009/05/18/visual-studio-2010-team-system-installation-fails/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=134&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The Visual Studio 2010 Beta 1 download is about 1.2 G for Team System and a little less for the professional edition. I started installation on my main development machine which is a dual core AMD running Windows 7. It required a restart after the installation of the framework itself and during the installation of Microsoft Help 3.0 Beta 1 it could not find the file helpviewer_ENU.exe which is not in the DVD at all (update: not true, it is but Windows 7&#8242;s search did not find it). I tried a few cycles of cancelling the dialog but no luck. Back to MSDN to download the professional edition and try my luck with that one&#8230;</p>
<p>I have the error log if anyone wants to have a look.</p>
<p>&#8230;<br />
Now installing the Professional Edition and it installed the Microsoft Help 3.0 Beta 1 without any problems and the file can be found in the Professional Edition DVD at &lt;drive&gt;:\WCU\Viewer</p>
<p>&#8230;<br />
And it is installed less than 20 minutes later which is an impressive short amout of time! VS 2008 seems to be working, at least I can open a large solution and rebuild normally.</p>
<p>In VS 2010 the first thing that stands out, is that the default font is now Consolas. Not sure but worth a try. The UI does not look too different from 2008 as everything appears to be in the same place. Unfortunately it will not open 2008 solutions without converting them to 2010.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codefornothing.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codefornothing.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codefornothing.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codefornothing.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codefornothing.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codefornothing.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codefornothing.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codefornothing.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codefornothing.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codefornothing.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codefornothing.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codefornothing.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codefornothing.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codefornothing.wordpress.com/134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=134&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codefornothing.wordpress.com/2009/05/18/visual-studio-2010-team-system-installation-fails/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/441e58331067fb8538e3f9496fef3c8c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codefornothing</media:title>
		</media:content>
	</item>
		<item>
		<title>Moved to Windows 7. Not Going Back.</title>
		<link>http://codefornothing.wordpress.com/2009/05/03/moved-to-windows-7-not-going-back/</link>
		<comments>http://codefornothing.wordpress.com/2009/05/03/moved-to-windows-7-not-going-back/#comments</comments>
		<pubDate>Sun, 03 May 2009 11:58:47 +0000</pubDate>
		<dc:creator>codefornothing</dc:creator>
				<category><![CDATA[Deployment]]></category>
		<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Patterns]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[User Interface]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://codefornothing.wordpress.com/?p=130</guid>
		<description><![CDATA[I quite like Windows Vista but was unable to move away from XP for a long time because Vista did &#8230;<p><a href="http://codefornothing.wordpress.com/2009/05/03/moved-to-windows-7-not-going-back/">Continue reading &#187;</a></p><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=130&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I quite like Windows Vista but was unable to move away from XP for a long time because Vista did not support the mix of graphic cards I had at the time. As soon as this was sorted I installed Vista x64 on my development machine and went through a series of hoops to make two graphic cards and four monitors work properly. The two graphic cards are a GeForce 9500 GT on a PCI Express slot and an older GeForce 6200 on a PCI slot. As far as I can remember I went through driver hell and it took a few tries to get everything right. My experience with Windows 7 RC couldn&#8217;t have been more different. It detected the cards automatically, installed the drivers and all I had to do was move them into the correct positions. It even detected the motherboard&#8217;s graphic card but I don&#8217;t have a fifth monitor handy to try it. Very impressive given my previous experience!</p>
<p><strong>OS Installation<br />
</strong></p>
<p>The installation itself was fast; I started it around 20.00 and was finished before midnight. And that included installing Visual Studio, Office and several other applications. The OS itself was ready in less than an hour and the only questions I remember answering were my location, whether my network was a home or work network and the name of the PC and first user.</p>
<p>I tried to put up with UAC for a while but ended up disabling it for the duration of the installations. Mind you, the place where it is managed was moved and all the web pages with instructions on disabling UAC pointed to a non-existent Control Panel link. The best way to find it is to cause a UAC prompt and click the link on the prompt that takes you to the correct screen. The new UI for UAC is very slick and easy to operate so much so that I even went back and re-enabled it. The only complaint I have is that when a UAC prompt pops up the monitors connected to the PCI card do not redraw properly for a few seconds after the prompt is dismissed. Not serious but a bit annoying and probably it is the drivers fault, not Windows&#8217;.</p>
<p>Another unexpected thing I came across was that my old Laserjet 6 was not listed in the printer list. It is a very old printer but it was listed in Vista. The solution was easy but I nearly missed it. The printer list &#8211; can you please make this dialog resizable at some point &#8211; has a button with the caption Windows Update and there&#8217;s some text elsewhere in the dialog which goes something like, &#8220;Click Windows update to see more models&#8221;. It would be more obvious if the button caption was &#8220;More Printers&#8221;, for example.</p>
<p><strong>Software<br />
</strong></p>
<p>I managed to install most of the software without any problems. The exceptions were SlickRun that installs but does not start and Chrome which needs a parameter (&#8211;in-process-plugins) added to the Target in its shortcut properties. Even with this change Chrome still fails regularly which is something I wasn&#8217;t used to in Vista. I have been using Chrome since the very first day of its release and it has been rock solid but there&#8217;s something not quite right with this installation. By the way, I am running Windows Seven Ultimate x64 on an AMD Athlon X2 4000+. The other application I was wary of was Visual Basic 6 but I ignored all the usual warning prompts and it installed and run just fine. It feels a little nimbler in the designer redrawing which was a dog under Vista. I just had Word 2007 SP2 crash for no obvious reason which is worrying but we will see how it goes. Our software, <a href="http://www.gepsoft.com/">GeneXproTools</a>, by the way, installs and runs perfectly on Windows 7 without any UI or performance degradation.</p>
<p><strong>The Shell<br />
</strong></p>
<p>The Windows 7&#8242;s shell is quite pretty and usable. I like that Microsoft is moving away from the dark mood of Vista into a pleasing bluish theme. Whoever created Vista&#8217;s unfortunate colour scheme moved to the Expression team but that&#8217;s a rant for another day. The background pictures are quite beautiful and the automated background changer was a pleasant surprise. I ended up turning it off because some of the pictures were too distracting in a multi monitor setup but I would use it in a laptop, for example.</p>
<p>The taskbar is way prettier than Vista&#8217;s or XP&#8217;s but I am still not used to the way it operates. The hardest part for me has been the window switching. I am always surprised when all the windows disappear and only the one I am hovering over shows up. I understand the idea but it looks a bit overkill. Interestingly, if I show off the feature to someone else it makes a lot of sense and is very pleasing but when I am working and switch windows I get distracted by the sudden change. The good part is that I really like the extra taskbar space and being able to preview IE&#8217;s tabs.</p>
<p>The window gestures are interesting but they only work at the edges of the monitors. This is unfortunate in multi monitor setups because the main monitor is in the middle and it&#8217;s where I do comparisons, for example. It would be useful to have this feature in any window although I am not sure if it would interfere with dragging windows between monitors. On the other hand, the maximize window gesture is annoying because when I move windows between monitors with different resolutions the window &#8220;grows&#8221; suddenly and is maximized. This has happened enough times that I have learned to avoid dragging windows along the top of the screen.</p>
<p>Perhaps the single best feature in Windows 7 is the changes to Explorer and the settings windows. The layout and headers are cleaner and simpler than in Vista and the sorting and resizing of folders lists is easier and less error prone. And a big pet peeve of mine with Vista went away: Now all folders seem to default to their proper type instead of randomly being assigned to music folder like in Vista. The control panel is also better focused and some of its applications are very pleasant and expertly designed. I quite like that when I connect my Sony MP3 player the icon matches the device appearance. Nothing earth shattering here but it highlights the attention to detail that went into Windows 7.</p>
<p><strong>Final Words<br />
</strong></p>
<p>I am sticking with Windows 7. I am very impressed with the interface and installation experience and so far I haven&#8217;t been compelled to switch off or change as many default settings as I used to in Vista and XP. So far I am only disabling the restore option on my C drive as I think this was the cause of a major slowdown in the previous Vista installation. This is not recommended but since I have daily backups I am fine even if I need to reinstall from scratch. Another minor annoyance is the Sleep function that does not work reliably. I always can make it go to sleep but sometimes it crashes and reboots. Nevertheless the boot time is quite acceptable and I only start the PC once a day. Finally, the performance on this PC, which is a low end PC, is quite good and certainly feels faster than my previous Vista installation.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codefornothing.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codefornothing.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codefornothing.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codefornothing.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codefornothing.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codefornothing.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codefornothing.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codefornothing.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codefornothing.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codefornothing.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codefornothing.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codefornothing.wordpress.com/130/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codefornothing.wordpress.com/130/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codefornothing.wordpress.com/130/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codefornothing.wordpress.com&amp;blog=1386579&amp;post=130&amp;subd=codefornothing&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codefornothing.wordpress.com/2009/05/03/moved-to-windows-7-not-going-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/441e58331067fb8538e3f9496fef3c8c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codefornothing</media:title>
		</media:content>
	</item>
	</channel>
</rss>
