<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Human-Debugger.net</title>
  <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/" />
  <link rel="self" href="http://www.human-debugger.net/blog/SyndicationService.asmx/GetAtom" />
  <icon>favicon.ico</icon>
  <updated>2010-08-24T13:07:42.9220078-07:00</updated>
  <author>
    <name>Shani Raba</name>
  </author>
  <subtitle>Raba - Defend your code</subtitle>
  <id>http://www.human-debugger.net/blog/</id>
  <generator uri="http://dasblog.info/" version="2.3.9074.18820">DasBlog</generator>
  <entry>
    <title>Delver – Shop With Your Friends</title>
    <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/2010/08/24/DelverShopWithYourFriends.aspx" />
    <id>http://www.human-debugger.net/blog/PermaLink,guid,11dbda26-ebaa-4858-98ce-150692bf9d01.aspx</id>
    <published>2010-08-24T13:07:42.9220078-07:00</published>
    <updated>2010-08-24T13:07:42.9220078-07:00</updated>
    <author>
      <name>Shani Raba</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Delver is a “Social Shopping Platform”, You are more than welcome to check our website
at <a href="http://www.delver.com">www.delver.com</a></p>
        <p>
We are still in “closed beta” but, leave me a comment or an email and I will send
you an invitation. 
</p>
        <p>
  
</p>
        <p>
We also opened our <a href="http://blog.delver.com">Blog</a> where we will post about
new features, technology and other cool stuff.
</p>
        <img width="0" height="0" src="http://www.human-debugger.net/blog/aggbug.ashx?id=11dbda26-ebaa-4858-98ce-150692bf9d01" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Video Streaming – installing on IIS and Apache</title>
    <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/2010/07/24/VideoStreamingInstallingOnIISAndApache.aspx" />
    <id>http://www.human-debugger.net/blog/PermaLink,guid,313de8b6-1ad9-4c66-ad4f-22de5d040285.aspx</id>
    <published>2010-07-24T15:01:30.8074063-07:00</published>
    <updated>2010-07-25T13:29:20.590441-07:00</updated>
    <category term="IIS7" label="IIS7" scheme="http://www.human-debugger.net/blog/CategoryView,category,IIS7.aspx" />
    <category term="Software Development" label="Software Development" scheme="http://www.human-debugger.net/blog/CategoryView,category,SoftwareDevelopment.aspx" />
    <category term="Web" label="Web" scheme="http://www.human-debugger.net/blog/CategoryView,category,Web.aspx" />
    <author>
      <name>Shani Raba</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
After we understand <a href="http://www.human-debugger.net/blog/2010/07/24/VideoStreamingIntroduction.aspx">what
video stream is all about</a> and we wrote <a href="http://www.human-debugger.net/blog/2010/07/24/VideoStreamingSWFObjectJQuery.aspx">our
first piece of SWFObject in Javascript</a>. let’s try to have this working on our
servers, of course that such things tend to fail. But let’s understand why…
</p>
        <p>
First thing we need to understand is whether such failures occur due to my code, file
format or server configuration. 
<br />
let’s have a simple check trying to access the file directly using our browser.
</p>
        <p>
          <strong>
            <u>IIS7:</u>
          </strong>
        </p>
        <p>
configure your IIS to serve the following files: swf and mp4 using Static Content
</p>
        <pre class="csharpcode">
          <span class="kwrd">&lt;</span>
          <span class="html">add</span>
          <span class="attr">name</span>
          <span class="kwrd">="FlashFiles"</span>
          <span class="attr">path</span>
          <span class="kwrd">="*.swf"</span>
          <span class="attr">verb</span>
          <span class="kwrd">="*"</span>
          <span class="attr">modules</span>
          <span class="kwrd">="StaticFileModule"</span>
          <span class="attr">scriptProcessor</span>
          <span class="kwrd">=""</span>
          <span class="attr">resourceType</span>
          <span class="kwrd">="File"</span>
          <span class="attr">requireAccess</span>
          <span class="kwrd">="Script"</span>
          <span class="kwrd">/&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">add</span>
          <span class="attr">name</span>
          <span class="kwrd">="VideoFiles"</span>
          <span class="attr">path</span>
          <span class="kwrd">="*.mp4"</span>
          <span class="attr">verb</span>
          <span class="kwrd">="*"</span>
          <span class="attr">modules</span>
          <span class="kwrd">="StaticFileModule"</span>
          <span class="attr">scriptProcessor</span>
          <span class="kwrd">=""</span>
          <span class="attr">resourceType</span>
          <span class="kwrd">="File"</span>
          <span class="attr">requireAccess</span>
          <span class="kwrd">="Script"</span>
          <span class="kwrd">/&gt;</span>
        </pre>
        <p>
          <br />
Setting handler(s) won’t be good enough, requesting the server again will return “404.3
– mime type missing”.<br />
Don’t worry Adding new  mime type to IIS 7 - is easy:
</p>
        <pre class="csharpcode">
          <span class="kwrd">&lt;</span>
          <span class="html">configuration</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">system.webServer</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">staticContent</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;</span>
          <span class="html">mimeMap</span>
          <span class="attr">fileExtension</span>
          <span class="kwrd">=".mp4"</span>
          <span class="attr">mimeType</span>
          <span class="kwrd">="video/mp4"</span>
          <span class="kwrd">/&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">staticContent</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">system.webServer</span>
          <span class="kwrd">&gt;</span>
          <span class="kwrd">&lt;/</span>
          <span class="html">configuration</span>
          <span class="kwrd">&gt;</span>
        </pre>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <p>
          <strong>
            <u>Apache:</u>
          </strong>
        </p>
        <p>
While installing the static content on our static servers (apache) – we’ve found out
that requesting the files from firefox return with “no content length” and “incorrect
mime type”<br />
adding the correct mime type to the /etc/mime.type
</p>
        <pre class="csharpcode">video/mp4     mp4</pre>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <p>
Check the Request\Response we’ve found out that our servers are still returning compressed
response , googling it find out that Firefox cann’t handle gzipped video stream,<br />
compression was selectively disabled by adding the following line to /etc/httpd/conf.d/static.d/static.conf:
</p>
        <pre class="csharpcode">SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|mp4)$ no-gzip dont-vary</pre>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <p>
Apache solution provided by <a href="http://www.tomergabel.com/">Tomer G</a>. <img width="0" height="0" src="http://www.human-debugger.net/blog/aggbug.ashx?id=313de8b6-1ad9-4c66-ad4f-22de5d040285" /></p>
      </div>
    </content>
  </entry>
  <entry>
    <title>Video Streaming – SWFObject + JQuery</title>
    <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/2010/07/24/VideoStreamingSWFObjectJQuery.aspx" />
    <id>http://www.human-debugger.net/blog/PermaLink,guid,8b3912c9-9f13-4944-8cd4-f7d3dd794547.aspx</id>
    <published>2010-07-24T14:28:23.6214417-07:00</published>
    <updated>2010-07-25T13:36:10.7172433-07:00</updated>
    <category term="Web" label="Web" scheme="http://www.human-debugger.net/blog/CategoryView,category,Web.aspx" />
    <category term="Web / Ajax" label="Web / Ajax" scheme="http://www.human-debugger.net/blog/CategoryView,category,WebAjax.aspx" />
    <category term="Web / Javascript" label="Web / Javascript" scheme="http://www.human-debugger.net/blog/CategoryView,category,WebJavascript.aspx" />
    <author>
      <name>Shani Raba</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
You can read here my <a href="http://www.human-debugger.net/blog/2010/07/24/VideoStreamingIntroduction.aspx">introduction
about video streaming</a>.
</p>
        <p>
In order to embed rich media content into web pages and have our code compatible with
different browsers we will use the <a href="http://code.google.com/p/swfobject/">SWFObject
2.2</a>.<br />
The SWFObject will render the right tags for the right browsers.
</p>
        <p>
Here is a short, unobtrusive JS for showing your movie: 
</p>
        <div class="csharpcode">
          <pre>
            <span class="lnum"> 1: </span>$(<span class="kwrd">function</span>()
{</pre>
          <pre>
            <span class="lnum"> 2: </span>
            <span class="kwrd">var</span> videoBase
= <span class="str">'http://static-server/'</span>; </pre>
          <pre>
            <span class="lnum"> 3: </span>
          </pre>
          <pre>
            <span class="lnum"> 4: </span> $(<span class="str">'.VideoTeaserArea'</span>).click(<span class="kwrd">function</span>()
{ </pre>
          <pre>
            <span class="lnum"> 5: </span> $(<span class="kwrd">this</span>).openLightBox(<span class="str">"&lt;div
id='media'&gt;&lt;/div&gt;"</span>); </pre>
          <pre>
            <span class="lnum"> 6: </span> playMovie(<span class="str">'intro-movie.swf'</span>); </pre>
          <pre>
            <span class="lnum"> 7: </span> }); </pre>
          <pre>
            <span class="lnum"> 8: </span>
          </pre>
          <pre>
            <span class="lnum"> 9: </span>
            <span class="kwrd">function</span> playMovie(videoFile)
{ </pre>
          <pre>
            <span class="lnum"> 10: </span>
            <span class="kwrd">var</span> videoUrl
= videoBase + videoFile; </pre>
          <pre>
            <span class="lnum"> 11: </span>
            <span class="kwrd">var</span> att
= { data: videoUrl, width: <span class="str">"640"</span>, height: <span class="str">"378"</span>,
allowfullscreen:<span class="kwrd">true</span>}; </pre>
          <pre>
            <span class="lnum"> 12: </span>
            <span class="kwrd">var</span>
            <span class="kwrd">params</span> =
{ flashvars: <span class="str">"autostart=true"</span>}; </pre>
          <pre>
            <span class="lnum"> 13: </span>
            <span class="kwrd">var</span> id
= <span class="str">"media"</span>; </pre>
          <pre>
            <span class="lnum"> 14: </span>
            <span class="kwrd">var</span> myObject
= swfobject.createSWF(att, <span class="kwrd">params</span>, id); </pre>
          <pre>
            <span class="lnum"> 15: </span> } </pre>
          <pre>
            <span class="lnum"> 16: </span>});</pre>
        </div>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <p>
 
</p>
        <p>
- line 2: Our movie directory, better place such content on static server or even
CDNs.<br />
- line 4: VideoTeaserArea is a class name that we spread all over our site - clicking
on it will trigger the movie.<br />
- line 5: openLightBox – on our site the movie will be opened in a <a href="http://en.wikipedia.org/wiki/Lightbox_(JavaScript)">light
box</a>.<br />
- line 11: the videoUrl, will be seen in the configured size. allowfullscreen is false
by default. <a href="http://code.google.com/p/swfobject/wiki/documentation#How_can_you_configure_your_Flash_content?">read
more here</a><br />
- line 12: <em>flashVars</em> will be used here in order to have our movie start as
our light-box will be opened.<br />
- line 13: The placeholder we want to replace while loading the movie<br />
- line 14: Add reference to the swfObject.js in order to have its instance(read bellow).
The createSWF method is a low level API which enable combining with other Javascript
libraries.
</p>
        <p>
in order to have this code running we must add script tag:<br />
&lt;script type="text/javascript" src="swfobject.js"&gt;&lt;/script&gt; 
</p>
        <p>
Now, after having embedding SWF to our site  - Let’s understand <a href="http://www.human-debugger.net/blog/">how
to make this work on IIS and Apache</a>.
</p>
        <img width="0" height="0" src="http://www.human-debugger.net/blog/aggbug.ashx?id=8b3912c9-9f13-4944-8cd4-f7d3dd794547" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Video Streaming - introduction</title>
    <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/2010/07/24/VideoStreamingIntroduction.aspx" />
    <id>http://www.human-debugger.net/blog/PermaLink,guid,616d46ba-3c50-47f3-92d8-c3246d61bc08.aspx</id>
    <published>2010-07-24T14:25:34.7282635-07:00</published>
    <updated>2010-07-24T15:05:13.1641834-07:00</updated>
    <category term="Software Development" label="Software Development" scheme="http://www.human-debugger.net/blog/CategoryView,category,SoftwareDevelopment.aspx" />
    <category term="Web" label="Web" scheme="http://www.human-debugger.net/blog/CategoryView,category,Web.aspx" />
    <author>
      <name>Shani Raba</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
So our mission is to have our website play a short intro movie. 
</p>
        <p>
  
</p>
        <p>
          <strong>Wiki Definition</strong>
        </p>
        <p>
          <em>
            <font color="#808080">
              <b>“<a href="http://en.wikipedia.org/wiki/Progressive_download">Progressive
download</a></b> is a term used to describe the transfer of </font>
          </em>
          <a href="http://en.wikipedia.org/wiki/Digital_media">
            <em>
              <font color="#808080">digital
media</font>
            </em>
          </a>
          <em>
            <font color="#808080"> files from a </font>
          </em>
          <a href="http://en.wikipedia.org/wiki/Web_server">
            <em>
              <font color="#808080">server</font>
            </em>
          </a>
          <em>
            <font color="#808080"> to
a </font>
          </em>
          <a href="http://en.wikipedia.org/wiki/Web_client">
            <em>
              <font color="#808080">client</font>
            </em>
          </a>
          <em>
            <font color="#808080">,
typically using the </font>
          </em>
          <a href="http://en.wikipedia.org/wiki/HTTP">
            <em>
              <font color="#808080">HTTP</font>
            </em>
          </a>
          <em>
            <font color="#808080">
            </font>
          </em>
          <a href="http://en.wikipedia.org/wiki/Protocol_(computing)">
            <em>
              <font color="#808080">protocol</font>
            </em>
          </a>
          <em>
            <font color="#808080"> when
initiated from a computer. The consumer may begin playback of the media before the
download is complete. The key difference between </font>
          </em>
          <a href="http://en.wikipedia.org/wiki/Streaming_media">
            <em>
              <font color="#808080">streaming
media</font>
            </em>
          </a>
          <em>
            <font color="#808080"> and progressive download is in how
the digital media data is received and stored by the </font>
          </em>
          <a href="http://en.wikipedia.org/wiki/End_user">
            <em>
              <font color="#808080">end
user</font>
            </em>
          </a>
          <em>
            <font color="#808080"> device that is accessing the digital
media.”</font>
          </em>
        </p>
        <p>
  
</p>
        <p>
Actually the “progressive download” feature implemented in most media players allows
them to begin playing the file as soon as enough data received. 
</p>
        <p>
  
</p>
        <p>
          <strong>File formats: SWF VS. FLV</strong>
        </p>
        <ul>
          <li>
Both are Adobe formats. 
</li>
          <li>
FLV is a video container, intended to contain only audio\video 
</li>
          <li>
SWF can contain animations, games, applications and videos 
</li>
          <li>
SWF uses a lossless compression and is limited to a certain number of frames. Due
to it is not compressed some files can be too big for use in the internet. 
</li>
          <li>
Large websites like Google, Amazon are using the FLV file formats</li>
        </ul>
        <p>
          <strong>After this short explanation, we are ready to start:</strong>
        </p>
        <ol>
          <li>
Create a video file in a common streaming media format (in our case: Camtasia -&gt;
SWF, mp4) 
</li>
          <li>
Upload the files to your Web Server 
</li>
          <li>
            <a href="http://www.human-debugger.net/blog/2010/07/24/VideoStreamingInstallingOnIISAndApache.aspx">Check
whether this link is working from common browsers</a>
          </li>
          <li>
            <a href="http://www.human-debugger.net/blog/2010/07/24/VideoStreamingSWFObjectJQuery.aspx">Link
from you Web Pages (HTML tags or JS)</a>
          </li>
        </ol>
        <p>
In the next posts we will talk about steps 3 and 4. 
</p>
        <p>
For now you can keep reading about step 1 - <a href="http://www.techsmith.com/learn/camtasia/6/produce/produce-flash-video.asp">here</a></p>
        <img width="0" height="0" src="http://www.human-debugger.net/blog/aggbug.ashx?id=616d46ba-3c50-47f3-92d8-c3246d61bc08" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Beta Questions and Answers Site about GIS</title>
    <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/2010/07/24/BetaQuestionsAndAnswersSiteAboutGIS.aspx" />
    <id>http://www.human-debugger.net/blog/PermaLink,guid,b87fd705-54e8-4aea-8c6d-8663751add78.aspx</id>
    <published>2010-07-24T09:30:00-07:00</published>
    <updated>2010-07-24T02:30:57.5167154-07:00</updated>
    <category term="GIS" label="GIS" scheme="http://www.human-debugger.net/blog/CategoryView,category,GIS.aspx" />
    <author>
      <name>Shani Raba</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a title="Area 51 - GIS" href="http://area51.stackexchange.com/proposals/1425/geographic-information-systems">Area
51 – GIS</a> is a new place supported by the Stack Overflow to post your Qusetions
and Answers about Geographic information systems. Part of the questions are talking
about interesting issues like: Databases comparisons, Algorithms, New tools, GeoTagging,
GeoJson, Kml, Map Caching layers etc.
</p>
        <p>
Public beta will begin in 5 days.
</p>
        <img width="0" height="0" src="http://www.human-debugger.net/blog/aggbug.ashx?id=b87fd705-54e8-4aea-8c6d-8663751add78" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Dasblog 2.3 | GoDaddy.com</title>
    <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/2010/02/13/Dasblog23GoDaddycom.aspx" />
    <id>http://www.human-debugger.net/blog/PermaLink,guid,f252d9cb-8565-4e0e-82e6-d06f5810db12.aspx</id>
    <published>2010-02-13T05:49:30.4049487-07:00</published>
    <updated>2010-02-13T12:44:23.7875529-07:00</updated>
    <category term="My Site" label="My Site" scheme="http://www.human-debugger.net/blog/CategoryView,category,MySite.aspx" />
    <author>
      <name>Shani Raba</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Finally, after a long time I find time to upgrade my blog to the newly 2.3 version.
</p>
        <p>
I had many problems installing this version Go-daddy, Monorail and SecurityException.<br />
The last one was also the funny one, after Google-ing a little bit, I found this <a href="http://www.tomergabel.com/dasBlog23UpdateWoesDealingWithSecurityException.aspx">post</a> by
Gabel one of my co-workers.
</p>
        <p>
          <strong>What’s new?</strong>
        </p>
        <p>
So first I created my self a new homepage which you can see <a href="http://www.human-debugger.net/welcome.html">here</a>.<br />
Second, you can track my reading-list, my twitter statuses and my projects (will be
published later).
</p>
        <p>
          <a title="homepage" href="http://www.human-debugger.net/welcome.html">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="homepage" border="0" alt="homepage" src="http://www.human-debugger.net/blog/content/binary/WindowsLiveWriter/Dasblog2.3GoDaddy.com_D07E/homepage%5B1%5D_5.png" width="244" height="150" />
          </a>  <a title="reading-list" href="http://www.human-debugger.net/Books.html"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="readinglist" border="0" alt="readinglist" src="http://www.human-debugger.net/blog/content/binary/WindowsLiveWriter/Dasblog2.3GoDaddy.com_D07E/readinglist%5B1%5D_3.png" width="244" height="153" /></a></p>
        <p>
        </p>
        <p>
        </p>
        <p>
Have fun.
</p>
        <img width="0" height="0" src="http://www.human-debugger.net/blog/aggbug.ashx?id=f252d9cb-8565-4e0e-82e6-d06f5810db12" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Parameterize Tests - [TestCaseAttribute]</title>
    <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/2009/08/01/ParameterizeTestsTestCaseAttribute.aspx" />
    <id>http://www.human-debugger.net/blog/PermaLink,guid,cf9c0d76-5b51-47f5-be1b-e78ef20d3364.aspx</id>
    <published>2009-07-31T21:20:12-07:00</published>
    <updated>2009-08-02T13:25:05.6609565-07:00</updated>
    <category term=".Net 3.5" label=".Net 3.5" scheme="http://www.human-debugger.net/blog/CategoryView,category,Net35.aspx" />
    <category term=".Net 3.5/C#3.0" label=".Net 3.5/C#3.0" scheme="http://www.human-debugger.net/blog/CategoryView,category,Net35C30.aspx" />
    <category term="TDD" label="TDD" scheme="http://www.human-debugger.net/blog/CategoryView,category,TDD.aspx" />
    <category term="TDD/NUnit" label="TDD/NUnit" scheme="http://www.human-debugger.net/blog/CategoryView,category,TDDNUnit.aspx" />
    <author>
      <name>Shani Raba</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Test methods must be written as production code.<br />
While writing your tests you must act the same methods you write for your production
code which means:
</p>
        <ol>
          <li>
human-readable (code standard, pattern etc.) 
</li>
          <li>
code re-use (copy paste is never acceptable) 
</li>
          <li>
etc...</li>
        </ol>
        <p>
This is a code you will probably find in your test projects
</p>
        <div>
          <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 1:</span> [Test]</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 2:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">void</span> GetCommentsByQuery_LookFormHmmmText_FindAtLeaseOne()</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 3:</span> {</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 4:</span> SvnLogParser
parser = <span style="color: #0000ff">new</span> SvnLogParser();</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 5:</span>
              <span style="color: #0000ff">string</span> textToSearch
= <span style="color: #006080">"Hmmm..."</span>;</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 6:</span> var
results = parser.GetCommentsByQuery(comment =&gt; comment.Contains(textToSearch));</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 7:</span> CollectionAssertExtensions.IsNotEmpty(results);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 8:</span> }</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 9:</span>  </pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 10:</span> [Test]</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 11:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">void</span> GetCommentsByQuery_LookFormBugText_FindAtLeastOne()</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 12:</span> {</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 13:</span> SvnLogParser
parser = <span style="color: #0000ff">new</span> SvnLogParser();</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 14:</span>
              <span style="color: #0000ff">string</span> textToSearch
= <span style="color: #006080">"bug"</span>;</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 15:</span> var
results = parser.GetCommentsByQuery(comment =&gt; comment.Contains(textToSearch));</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 16:</span> CollectionAssertExtensions.IsNotEmpty(results);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 17:</span> }</pre>
          </div>
        </div>
        <p>
You can see that the two methods are pretty much the same, the only change is the
textToSearch variable.<br />
There are some excuses for such duplication:
</p>
        <ul>
          <li>
"We want two different names... to easily understand the failiure reason" 
</li>
          <li>
"we want it to be easy to read, without context switches..." (method calls and un-needed
inheritance complexity)</li>
        </ul>
        <p>
We, of course, can refactor this code, like this:
</p>
        <div>
          <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 1:</span> [Test]</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 2:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">void</span> GetCommentsByQuery_LookFormBugText_FindAtLeastOne()</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 3:</span> {</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 4:</span>
              <span style="color: #0000ff">string</span> textToSearch
= <span style="color: #006080">"bug"</span>;</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 5:</span> GetCommentsByQuery_AssertAllItemsStartsWith(textToSearch);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 6:</span> }</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 7:</span>  </pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 8:</span>  </pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 9:</span> [Test]</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 10:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">void</span> GetCommnentsByQuery_LookForHmmmText_VerifyInsideComment()</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 11:</span> {</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 12:</span>
              <span style="color: #0000ff">string</span> textToSearch
= <span style="color: #006080">"Hmmm..."</span>;</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 13:</span> GetCommentsByQuery_AssertAllItemsStartsWith(textToSearch);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 14:</span> }</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 15:</span>  </pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 16:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">void</span> GetCommentsByQuery_AssertAllItemsStartsWith(<span style="color: #0000ff">string</span> textToSearch)</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 17:</span> {</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 18:</span> SvnLogParser
parser = <span style="color: #0000ff">new</span> SvnLogParser();</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 19:</span> var
results = parser.GetCommentsByQuery(comment =&gt; comment.StartsWith(textToSearch));</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 20:</span>  </pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 21:</span> CollectionAssertExtensions.AllItemsSatisfy(results,
res =&gt; res.Comment.StartsWith(textToSearch));</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 22:</span> }</pre>
          </div>
        </div>
        <p>
This is better when you think of clone detection: less identical rows and the logic
was extracted to one method.<br />
But people might say that they can't see the AAA (Arrange, Act, Assert) and they want
it in one place,<br />
Moreover, in such code sample, it is harder to find all the input parameters, cause
they will be spread all over the TestFixture methods.
</p>
        <p>
 
</p>
        <p>
NUnit 2.5 added TestCaseAttribute, this can help us write tests that are:
</p>
        <ul>
          <li>
more readable 
</li>
          <li>
shorter test-fixture 
</li>
          <li>
all-in-one-place tests</li>
        </ul>
        <div>
          <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 1:</span> [TestCase(<span style="color: #006080">"Hm..."</span>)]</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 2:</span> [TestCase(<span style="color: #006080">"bug"</span>)]</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060">2:</span> [TestCase(<span style="color: #006080">"bug"</span>)]</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 3:</span>
              <span style="color: #0000ff">public</span>
              <span style="color: #0000ff">void</span> GetCommentsByQuery_LookForText_FindAtLeastOne(<span style="color: #0000ff">string</span> textToSearch)</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 4:</span> {</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 5:</span> SvnLogParser
parser = <span style="color: #0000ff">new</span> SvnLogParser();</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 6:</span> var
results = parser.GetCommentsByQuery(comment =&gt; comment.Contains(textToSearch));</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 7:</span> CollectionAssertExtensions.IsNotEmpty(results);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 8:</span> }</pre>
          </div>
        </div>
        <p>
Here you can avoid the duplication and you won't need to refactor your Tests to more
than one method, while you still see them running using the given parameter, 
<br />
for example when the second parameter will fail you will see this output:
</p>
        <div>
          <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: black; margin: 0em; padding-left: 0px; width: 98.93%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; height: 208px; color: yellow; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">------ Test started: Assembly: App.Tests.dll ------

TestCase 'App.Tests.NewFolder1.SvnLogParserTests.GetCommentsByQuery_LookForText_FindAtLeastOne("Hm...")'
failed: 
  Expected: True
  But was:  False
    C:\ShaniData\ProjectsByTitle\Delver\App.Tests\NewFolder1\SvnLogParserTests.cs(75,0): at App.Tests.NewFolder1.CollectionAssertExtensions.IsNotEmpty[T]
    C:\ShaniData\ProjectsByTitle\Delver\App.Tests\NewFolder1\SvnLogParserTests.cs(33,0): at App.Tests.NewFolder1.SvnLogParserTests.GetCommentsByQuery_LookForText_Find...


4 passed, 1 failed, 0 skipped, took 0.78 seconds (NUnit 2.5).


</pre>
        </div>
        <p>
The output will point the given method and the parameter used - which will ease finding
the error.<br />
You can extend reading about the usage <a href="http://nunit.com/blogs/?p=60">here</a></p>
        <img width="0" height="0" src="http://www.human-debugger.net/blog/aggbug.ashx?id=cf9c0d76-5b51-47f5-be1b-e78ef20d3364" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Refactoring and code reviews</title>
    <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/2009/07/28/RefactoringAndCodeReviews.aspx" />
    <id>http://www.human-debugger.net/blog/PermaLink,guid,5f001a13-bcc2-4402-b303-5898fea1a612.aspx</id>
    <published>2009-07-27T23:05:03.713-07:00</published>
    <updated>2009-07-27T23:32:12.2555573-07:00</updated>
    <category term="Life" label="Life" scheme="http://www.human-debugger.net/blog/CategoryView,category,Life.aspx" />
    <category term="My Site" label="My Site" scheme="http://www.human-debugger.net/blog/CategoryView,category,MySite.aspx" />
    <category term="Software Development" label="Software Development" scheme="http://www.human-debugger.net/blog/CategoryView,category,SoftwareDevelopment.aspx" />
    <author>
      <name>Shani Raba</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://blogs.microsoft.co.il/blogs/yoavmichaeli/">Yoav</a> sent me this <a href="http://www.refactormycode.com/session">web
site</a>.
</p>
        <p>
I like the idea of sharing knowledge, 
<br />
I also like to read and learn from open sources.<br />
This is even better: daily -public- code review...
</p>
        <p>
          <br />
        </p>
        <img width="0" height="0" src="http://www.human-debugger.net/blog/aggbug.ashx?id=5f001a13-bcc2-4402-b303-5898fea1a612" />
      </div>
    </content>
  </entry>
  <entry>
    <title>StringTemplate Introduction</title>
    <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/2009/07/08/StringTemplateIntroduction.aspx" />
    <id>http://www.human-debugger.net/blog/PermaLink,guid,c3f5c330-eef4-4a20-804c-e2a02c0183a3.aspx</id>
    <published>2009-07-08T00:13:57-07:00</published>
    <updated>2009-07-07T17:26:36.6294629-07:00</updated>
    <category term=".Net 3.5" label=".Net 3.5" scheme="http://www.human-debugger.net/blog/CategoryView,category,Net35.aspx" />
    <category term="Scripting Technology" label="Scripting Technology" scheme="http://www.human-debugger.net/blog/CategoryView,category,ScriptingTechnology.aspx" />
    <author>
      <name>Shani Raba</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
For more background about when we use this API you can read my last post about <a href="http://www.human-debugger.net/blog/2009/06/07/RenderingObjectsToHtml.aspx">Rendering
Objects to Html</a></p>
        <p>
          <strong>Simple Rendering of query:</strong>
        </p>
        <div>
          <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 1:</span> var
query = <span style="color: #0000ff">new</span> StringTemplate(<span style="color: #006080">"SELECT
$column$ FROM $table$;"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 2:</span> query.SetAttribute(<span style="color: #006080">"column"</span>, <span style="color: #006080">"name"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 3:</span> query.SetAttribute(<span style="color: #006080">"table"</span>, <span style="color: #006080">"User"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 4:</span> var
data = query.ToString();</pre>
          </div>
        </div>
        <div>We will refactor this sample to handle the queries from an outside source:
</div>
        <div>
          <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 1:</span> var
group = <span style="color: #0000ff">new</span> StringTemplateGroup(<span style="color: #006080">"SimpleTemplates"</span>,<span style="color: #006080">@"C:\Templates\TemplateEngineTestCase"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 2:</span> var
query = group.GetInstanceOf(<span style="color: #006080">"1_simple"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 3:</span> query.SetAttribute(<span style="color: #006080">"column"</span>, <span style="color: #006080">"name"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 4:</span> query.SetAttribute(<span style="color: #006080">"table"</span>, <span style="color: #006080">"User"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 5:</span> var
data = query.ToString();</pre>
          </div>
        </div>
        <div>Rows 1,2 - loading the template data from a source file.  
</div>
        <div>Here is the Template (1_simple.st):
</div>
        <div>
          <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">//1_simple.st
SELECT $column$ FROM $table$;</pre>
        </div>
        <div> 
</div>
        <div>
          <br />
          <strong>Template Anonymous Type:</strong>
        </div>
        <p>
In the last template usage (1_simple.st) We bind the parameters using strings only.
but we also have a better options: let's assume we wrote down such template:
</p>
        <div>
          <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">//2_simpleObjects.st
Full Name: $Person.FirstName$ - $Person.LastName$</pre>
        </div>
        <p>
But let's assume that we don't have the Person class\instance, we can simply write
it using the anonymous types:
</p>
        <div>
          <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 1:</span> var
user = <span style="color: #0000ff">new</span> {FirstName = <span style="color: #006080">"Shani"</span>,
LastName = <span style="color: #006080">"Raba"</span>};</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 2:</span> var
group = <span style="color: #0000ff">new</span> StringTemplateGroup(<span style="color: #006080">"OOTempaltes"</span>, <span style="color: #006080">@"C:\Templates\TemplateEngineTestCase"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 3:</span> var
query = group.GetInstanceOf(<span style="color: #006080">"2_simpleObjects"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 4:</span>  </pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 5:</span> query.SetAttribute(<span style="color: #006080">"Person"</span>,
user);</pre>
          </div>
        </div>
        <div>You can also use this kind of bindings for setting template-attributes from each
one of the Person sub-classes.
</div>
        <div> 
</div>
        <div> 
</div>
        <div>
          <strong>Template list:</strong>
        </div>
        <p>
Till now it is all pretty simple to implement by yourself, but the real issue here
is the List binding feature.<br />
You can write such template:
</p>
        <div>
          <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">//3_simpleLoop.st
$items: {num1|
    <span style="color: #0000ff">&lt;</span><span style="color: #800000">li</span><span style="color: #0000ff">&gt;</span>$num1$<span style="color: #0000ff">&lt;/</span><span style="color: #800000">li</span><span style="color: #0000ff">&gt;</span> }$
$end$</pre>
        </div>
        <p>
and bind the list using this code:
</p>
        <div>
          <div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 1:</span> var
templateFolder = <span style="color: #0000ff">new</span> StringTemplateGroup(<span style="color: #006080">"SimpleLoopTemplates"</span>, <span style="color: #006080">@"C:\Tempaltes\TemplateEngineTestCase"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 2:</span> var
template = templateFolder.GetInstanceOf(<span style="color: #006080">"3_simpleLoop"</span>);</pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 3:</span>  </pre>
            <pre style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, 'Courier New', courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
              <span style="color: #606060"> 4:</span> template.SetAttribute(<span style="color: #006080">"items"</span>, <span style="color: #0000ff">new</span> List&lt;<span style="color: #0000ff">string</span>&gt;
{<span style="color: #006080">"Shani"</span>, <span style="color: #006080">"Doron"</span>, <span style="color: #006080">"Nati"</span>, <span style="color: #006080">"Yossi"</span>});</pre>
          </div>
        </div>
        <p>
          <strong>
          </strong> 
</p>
        <p>
          <strong>Conclusion:</strong>
        </p>
        <ul>
          <li>
The code is pretty simple, the templates engine implements good functionality and
is well documented. 
</li>
          <li>
The StringTemplate syntax is easy to learn and well documented. 
</li>
          <li>
I still don't like it when I need to learn a new language\syntax - it will sharpen
the newbie's curve. 
</li>
          <li>
StringTemplate is missing good Object2Template Designer. 
</li>
        </ul>
        <img width="0" height="0" src="http://www.human-debugger.net/blog/aggbug.ashx?id=c3f5c330-eef4-4a20-804c-e2a02c0183a3" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Israeli Scrum user group 2009 (15.07.09)</title>
    <link rel="alternate" type="text/html" href="http://www.human-debugger.net/blog/2009/06/14/IsraeliScrumUserGroup2009150709.aspx" />
    <id>http://www.human-debugger.net/blog/PermaLink,guid,c0238451-a762-4084-b45c-e01fc5ac0729.aspx</id>
    <published>2009-06-13T20:42:51-07:00</published>
    <updated>2009-06-14T13:44:59.3170788-07:00</updated>
    <category term="Software Development/Agile" label="Software Development/Agile" scheme="http://www.human-debugger.net/blog/CategoryView,category,SoftwareDevelopmentAgile.aspx" />
    <category term="Software Development/Agile/Scrum" label="Software Development/Agile/Scrum" scheme="http://www.human-debugger.net/blog/CategoryView,category,SoftwareDevelopmentAgileScrum.aspx" />
    <author>
      <name>Shani Raba</name>
    </author>
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Dr. Alistair Cockburn will be in Israel. 
<br />
I recommend you this user-group: <a href="http://72.249.86.225/Scrum-Event-150709">Scrum
Event</a>. come and learn from the best.
</p>
        <p>
See you there.
</p>
        <img width="0" height="0" src="http://www.human-debugger.net/blog/aggbug.ashx?id=c0238451-a762-4084-b45c-e01fc5ac0729" />
      </div>
    </content>
  </entry>
</feed>