<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Daniele Demichelis</title>
	<atom:link href="http://www.danidemi.com/mainwww/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danidemi.com/mainwww</link>
	<description>There are 10 types of people in the world: Those who understand binary, and those who don&#039;t...</description>
	<lastBuildDate>Wed, 14 Apr 2010 08:14:26 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Svn toolkit</title>
		<link>http://www.danidemi.com/mainwww/2010/04/svn-toolkit/</link>
		<comments>http://www.danidemi.com/mainwww/2010/04/svn-toolkit/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 08:14:26 +0000</pubDate>
		<dc:creator>danidemi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.danidemi.com/mainwww/?p=158</guid>
		<description><![CDATA[<p>This is a quick SVN reference I update regularly, with the commands I use more. I hope you&#8217;ll find it useful.</p>
Task: Browse a remote repository



&#160;svn ls svn+ssh://[alias]/[path]



Task: create a directory on a remote repository



&#160;svn mkdir -m &#34;[message]&#34; svn+ssh://&#91;alias&#93;/&#91;path_to_new_dir&#93;



Task: import a directory



svn import -m &#34;[message]&#34; &#91;path_to_be_imported&#93; &#91;repository_url&#93;



Task: check out



svn checkout [repository url]



]]></description>
			<content:encoded><![CDATA[<p>This is a quick SVN reference I update regularly, with the commands I use more. I hope you&#8217;ll find it useful.</p>
<h2>Task: Browse a remote repository</h2>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">&nbsp;svn ls svn+ssh://[alias]/[path]</div>
</li>
</ol>
</div>
<h2>Task: create a directory on a remote repository</h2>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">&nbsp;svn <span class="kw2">mkdir</span> -m <span class="st0">&quot;[message]&quot;</span> svn+<span class="kw2">ssh</span>:<span class="sy0">//</span><span class="br0">&#91;</span><span class="kw3">alias</span><span class="br0">&#93;</span><span class="sy0">/</span><span class="br0">&#91;</span>path_to_new_dir<span class="br0">&#93;</span></div>
</li>
</ol>
</div>
<h2>Task: import a directory</h2>
<div class="geshi no bash">
<ol>
<li class="li1">
<div class="de1">svn import -m <span class="st0">&quot;[message]&quot;</span> <span class="br0">&#91;</span>path_to_be_imported<span class="br0">&#93;</span> <span class="br0">&#91;</span>repository_url<span class="br0">&#93;</span></div>
</li>
</ol>
</div>
<h2>Task: check out</h2>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">svn checkout [repository url]</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.danidemi.com/mainwww/2010/04/svn-toolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Assert statement in Objective C</title>
		<link>http://www.danidemi.com/mainwww/2010/03/assert-statement-in-objective-c/</link>
		<comments>http://www.danidemi.com/mainwww/2010/03/assert-statement-in-objective-c/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 15:40:40 +0000</pubDate>
		<dc:creator>danidemi</dc:creator>
				<category><![CDATA[iPhone Development]]></category>
		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://www.danidemi.com/mainwww/?p=147</guid>
		<description><![CDATA[<p>Hi,
if you like to use assertions in your source code, but you miss this feature in ObjectiveC, give a look to this small class.
Assert.h</p>



#import &#60;Foundation/Foundation.h&#62;


@interface Assert : NSObject &#123;


&#125;


+&#40;void&#41;that:&#40;BOOL&#41;expr;


@end



<p>Assert.m</p>



#import &#34;Assert.h&#34;


@implementation Assert


+&#40;void&#41;that:&#40;BOOL&#41;expr&#123;


&#160;if &#40;!expr&#41; &#123;


&#160; &#91;NSException raise:@&#34;Failed assertion.&#34; format:@&#34;Failed assertion&#34;, nil&#93;;


&#160;&#125;


&#125;


@end



<p>As you can see, there&#8217;s only one static method that you can use wherever you want.
In this [...]]]></description>
			<content:encoded><![CDATA[<p>Hi,<br />
if you like to use assertions in your source code, but you miss this feature in ObjectiveC, give a look to this small class.<br />
<b>Assert.h</b></p>
<div class="geshi no objc">
<ol>
<li class="li1">
<div class="de1"><span class="co2">#import &lt;Foundation/Foundation.h&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">@interface</span> <span class="kw3">Assert</span> <span class="sy0">:</span> <span class="kw5">NSObject</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">+</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>that<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>expr;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">@end</span></div>
</li>
</ol>
</div>
<p><b>Assert.m</b></p>
<div class="geshi no objc">
<ol>
<li class="li1">
<div class="de1"><span class="co2">#import &quot;Assert.h&quot;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">@implementation</span> <span class="kw3">Assert</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">+</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>that<span class="sy0">:</span><span class="br0">&#40;</span><span class="kw4">BOOL</span><span class="br0">&#41;</span>expr<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>expr<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#91;</span><span class="kw5">NSException</span> <span class="kw4">raise</span><span class="sy0">:</span>@<span class="st0">&quot;Failed assertion.&quot;</span> format<span class="sy0">:</span>@<span class="st0">&quot;Failed assertion&quot;</span>, <span class="kw2">nil</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">@end</span></div>
</li>
</ol>
</div>
<p>As you can see, there&#8217;s only one static method that you can use wherever you want.<br />
In this snippet here&#8217;s an example how to use it.</p>
<div class="geshi no objc">
<ol>
<li class="li1">
<div class="de1"><span class="co2">#import &quot;Assert.h&quot;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="sy0">-</span><span class="br0">&#40;</span><span class="kw4">void</span><span class="br0">&#41;</span>doSomething<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#91;</span><span class="kw3">Assert</span> that<span class="sy0">:</span><span class="br0">&#40;</span>&lt;your_assertion&gt;<span class="br0">&#41;</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.danidemi.com/mainwww/2010/03/assert-statement-in-objective-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get rid of MantisBT date_default_timezone_get() warning</title>
		<link>http://www.danidemi.com/mainwww/2010/03/get-rid-of-mantisbt-date_default_timezone_get-warning/</link>
		<comments>http://www.danidemi.com/mainwww/2010/03/get-rid-of-mantisbt-date_default_timezone_get-warning/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 10:13:42 +0000</pubDate>
		<dc:creator>danidemi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.danidemi.com/mainwww/?p=137</guid>
		<description><![CDATA[<p>If you installed a MantisBT instance on a system with a recent PHP version, there&#8217;s the chance you get a warning saying:</p>
<p>SYSTEM WARNING: date_default_timezone_get(): It is not safe to rely on the system&#8217;s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods [...]]]></description>
			<content:encoded><![CDATA[<p>If you installed a MantisBT instance on a system with a recent PHP version, there&#8217;s the chance you get a warning saying:</p>
<blockquote><p>SYSTEM WARNING: date_default_timezone_get(): It is not safe to rely on the system&#8217;s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected &#8216;Europe/Berlin&#8217; for &#8216;CET/1.0/no DST&#8217; instead</p></blockquote>
<p>A quick way to get rid of this is to set an explicit time zone.</p>
<p>Just open the config_inc.php file and add the date_default_timezone_set() line.</p>
<div class="geshi no php">
<ol>
<li class="li1">
<div class="de1"><span class="kw2">&lt;?php</span></div>
</li>
<li class="li1">
<div class="de1">date_default_timezone_set<span class="br0">&#40;</span><span class="st0">&quot;Europe/Rome&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$g_hostname</span> <span class="sy0">=</span> <span class="st0">&#39;localhost&#39;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$g_db_type</span> <span class="sy0">=</span> <span class="st0">&#39;mysql&#39;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$g_database_name</span> <span class="sy0">=</span> <span class="st0">&#39;db_name&#39;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$g_db_username</span> <span class="sy0">=</span> <span class="st0">&#39;user&#39;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="re1">$g_db_password</span> <span class="sy0">=</span> <span class="st0">&#39;secret&#39;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">?&gt;</span></div>
</li>
</ol>
</div>
<p>Please refer to this <a href="http://www.php.net/manual/en/timezones.php">list</a> to discover the available time zones.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danidemi.com/mainwww/2010/03/get-rid-of-mantisbt-date_default_timezone_get-warning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Shell Survival Toolkit</title>
		<link>http://www.danidemi.com/mainwww/2010/03/linux-shell-survival-toolkit/</link>
		<comments>http://www.danidemi.com/mainwww/2010/03/linux-shell-survival-toolkit/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 10:00:24 +0000</pubDate>
		<dc:creator>danidemi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.danidemi.com/mainwww/?p=133</guid>
		<description><![CDATA[<p>Hi, having a strong Windows background, I hardly remember all options of the huge set of commands available in the Linux shell&#8230; so, I&#8217;m slowly but steadily building up this Survival Toolkit. Hope it helps.</p>
File and directory management
Symbolic link
<p>Sometimes it is useful to hide the real location of a directory. For instance you could have [...]]]></description>
			<content:encoded><![CDATA[<p>Hi, having a strong Windows background, I hardly remember all options of the huge set of commands available in the Linux shell&#8230; so, I&#8217;m slowly but steadily building up this Survival Toolkit. Hope it helps.</p>
<h1>File and directory management</h1>
<h2>Symbolic link</h2>
<p>Sometimes it is useful to hide the real location of a directory. For instance you could have various folders containing different versions of the same software. So, for instance you got /opt/package-1.2, /opt/package-1.3, /opt/package/1.4beta. But maybe you like to have an /opt/package folder that should contain the version that should be currently used, so, you can use a symbolic link:</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">ln -s &lt;existing_directory&gt; &lt;path_of_the_link_to_be_created&gt;</div>
</li>
</ol>
</div>
<p>In our case</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">ln -s /opt/package-1.3 /opt/package</div>
</li>
</ol>
</div>
<h2>Compressed files</h2>
<p>Often one downloads an open source project as a bundle which extension is .tar.gz. Here&#8217;s how to inflate it.</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">tar xvf [filename.tar]</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.danidemi.com/mainwww/2010/03/linux-shell-survival-toolkit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Playing around with twitter list</title>
		<link>http://www.danidemi.com/mainwww/2010/03/playing-around-with-twitter-list/</link>
		<comments>http://www.danidemi.com/mainwww/2010/03/playing-around-with-twitter-list/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 17:01:44 +0000</pubDate>
		<dc:creator>danidemi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.danidemi.com/mainwww/?p=131</guid>
		<description><![CDATA[An F1 related list on Tweetter. Just follow F1 without a [...]]]></description>
			<content:encoded><![CDATA[<p>Hi to you all, I was playing around with the twitter list feature. It happens I&#8217;m a big F1 fan, so, I built up a list with all tweetters that I think deserve to be followed. Here&#8217;s the link: <a title="F1" href="http://twitter.com/#/list/escher75/f1" target="_blank">http://twitter.com/#/list/escher75/f1</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danidemi.com/mainwww/2010/03/playing-around-with-twitter-list/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on CentOS</title>
		<link>http://www.danidemi.com/mainwww/2010/03/ruby-on-centos/</link>
		<comments>http://www.danidemi.com/mainwww/2010/03/ruby-on-centos/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 14:07:36 +0000</pubDate>
		<dc:creator>danidemi</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[operation]]></category>

		<guid isPermaLink="false">http://www.danidemi.com/mainwww/?p=121</guid>
		<description><![CDATA[Install a recent Ruby version in CentOS via Yum is almost impossible, since the packages are a little outdated. Maybe it is worth to give Enterprise Ruby a [...]]]></description>
			<content:encoded><![CDATA[<p>In these days I&#8217;m trying to install Ruby on Rails on our CentOS production server. What I really don&#8217;t like very much about CentOS are its pretty outdated packages installable via yum. This time proved to be the same&#8230; it&#8217;s seems that the Ruby available on CentOS via yum is a version released during 2006.<br />
In the first place I tried to compile Ruby from sources, but this proved a little too much messy for me. In the end I stumbled upon Ruby Enterprise Edition and I gave it a try.<br />
What I liked most about it was that it worked perfectly just out of the box and that all Ruby files go inside a single directory, so it&#8217;s pretty easy to move from a version to another even if not using yum.<br />
This is a brief tutorial about how to install Ruby Enterprise Edition on CentOS.</p>
<h1>Get rid of any Ruby previously installed</h1>
<p>First of all let&#8217;s remove any Ruby installation already present on our CentOS.<br />
We can ask Yum to give us a list of Ruby related packages currently installed.</p>
<div class="geshi no sh">
<ol>
<li class="li1">
<div class="de1">yum list | grep installed | grep ruby</div>
</li>
</ol>
</div>
<p>My server answered that way, but obviously yours can show other answers.</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">ruby.i386 1.8.5-5.el5_3.7 installed
</div>
</li>
<li class="li1">
<div class="de1">ruby-devel.i386 1.8.5-5.el5_3.7 installed
</div>
</li>
<li class="li1">
<div class="de1">ruby-libs.i386 1.8.5-5.el5_3.7 installed
</div>
</li>
<li class="li1">
<div class="de1">ruby-mode.i386 1.8.5-5.el5_3.7 installed</div>
</li>
</ol>
</div>
<p>Time to gently ask to Yum to remove all those Ruby packages.</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">yum erase ruby
</div>
</li>
<li class="li1">
<div class="de1">yum erase ruby-devel
</div>
</li>
<li class="li1">
<div class="de1">yum erase ruby-libs
</div>
</li>
<li class="li1">
<div class="de1">yum erase ruby-mode</div>
</li>
</ol>
</div>
<p>We can now start with the Enterprise Ruby installation.</p>
<h1>Download and install Enterprise Ruby</h1>
<p>There is really nothing deeply interesting here. Just download the sources, unpack them, compile them and set some useful links.</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">mkdir -p ~/Temp/Sources
</div>
</li>
<li class="li1">
<div class="de1">cd ~/Temp/Sources
</div>
</li>
<li class="li1">
<div class="de1">wget http://rubyforge.org/frs/download.php/68719/ruby-enterprise-1.8.7-2010.01.tar.gz
</div>
</li>
<li class="li1">
<div class="de1">tar xzvf ruby-enterprise-1.8.7-2010.01.tar.gz
</div>
</li>
<li class="li1">
<div class="de1">./ruby-enterprise-1.8.7-2010.01/installer</div>
</li>
</ol>
</div>
<p>At the end we should have a working Ruby installation.<br />
Let&#8217;s create some useful link.</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/rake /usr/bin/rake
</div>
</li>
<li class="li1">
<div class="de1">ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/gem /usr/bin/gem
</div>
</li>
<li class="li1">
<div class="de1">ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/rails /usr/bin/rails
</div>
</li>
<li class="li1">
<div class="de1">ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/ruby /usr/bin/ruby
</div>
</li>
<li class="li1">
<div class="de1">ln -s /opt/ruby-enterprise-1.8.7-2010.01/bin/irb /usr/bin/irb</div>
</li>
</ol>
</div>
<h1>Worth reading</h1>
<p><a href="http://cristian.livadaru.net/2009/01/12/howto-installing-ruby-enterprise-edition-and-passenger-on-debian-etch/">Cristian Livadaru&#8217;s blog post about the topic.</a><br />
<a href="http://articles.slicehost.com/2009/4/7/centos-ruby-on-rails">Install the available Ruby via Yum</a><br />
<a href="http://www.rubyenterpriseedition.com/download.html">Enterprise Ruby download page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.danidemi.com/mainwww/2010/03/ruby-on-centos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Database testing with Mono and NUnit</title>
		<link>http://www.danidemi.com/mainwww/2010/03/database-testing-with-mono-and-nunit/</link>
		<comments>http://www.danidemi.com/mainwww/2010/03/database-testing-with-mono-and-nunit/#comments</comments>
		<pubDate>Fri, 12 Mar 2010 16:03:37 +0000</pubDate>
		<dc:creator>danidemi</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Testing]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[integration testing]]></category>

		<guid isPermaLink="false">http://www.danidemi.com/mainwww/?p=107</guid>
		<description><![CDATA[A class to set the database in a well know status before running an integration [...]]]></description>
			<content:encoded><![CDATA[<p>In these days I&#8217;m trying to rewrite an old application using Mono.<br />
I&#8217;m currently a newbie about Mono and the .Net world, but I happily noticed that the Mono environment come with a bundled interface to NUnit, so I can keep on writing tests as I&#8217;m slowly but steadily getting used to.<br />
After having put together a bunch of classes and relative and unit tests, it was time to write the first integration test. I needed to put the development database in a known state before running the test, so I came up with the following class, that I&#8217;d like to share with you.</p>
<div class="geshi no csharp">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">using</span> <span class="kw5">System</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> <span class="kw5">System</span>.<span class="me1">Collections</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> NUnit.<span class="me1">Framework</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> <span class="kw5">System</span>.<span class="me1">IO</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> <span class="kw5">System</span>.<span class="me1">Data</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> <span class="kw5">System</span>.<span class="me1">Data</span>.<span class="me1">SqlClient</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">namespace</span> TellItMailer<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">public</span> <span class="kw4">class</span> TestDbSetup<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">public</span> <span class="kw1">void</span> SetUpDbForTest<span class="br0">&#40;</span><span class="kw4">object</span> test<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw4">String</span> path <span class="sy0">=</span> test.<span class="me1">GetType</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">FullName</span> <span class="sy0">+</span> <span class="st0">&quot;.sql&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;path <span class="sy0">=</span> path.<span class="me1">Replace</span><span class="br0">&#40;</span><span class="kw1">this</span>.<span class="me1">GetType</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="kw1">Namespace</span> <span class="sy0">+</span> <span class="st0">&quot;.&quot;</span>, <span class="st0">&quot;&quot;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;path <span class="sy0">=</span> <span class="st0">&quot;/home/danidemi/workspace/TellItMailer/Tests/&quot;</span> <span class="sy0">+</span> path;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="co1">//Read the script</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw4">String</span> script <span class="sy0">=</span> <span class="st0">&quot;&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">using</span> <span class="br0">&#40;</span>StreamReader sr <span class="sy0">=</span> File.<span class="me1">OpenText</span><span class="br0">&#40;</span>path<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw4">string</span> s <span class="sy0">=</span> <span class="st0">&quot;&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">while</span> <span class="br0">&#40;</span><span class="br0">&#40;</span>s <span class="sy0">=</span> sr.<span class="me1">ReadLine</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">!=</span> <span class="kw1">null</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;script <span class="sy0">=</span> script <span class="sy0">+</span> s;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw4">string</span> connectionString <span class="sy0">=</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&quot;Server=192.168.75.128<span class="es0">\\</span>SQLEXPRESS;&quot;</span> <span class="sy0">+</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="st0">&quot;Database=TellIt_test;&quot;</span> <span class="sy0">+</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;User ID=user;&quot;</span> <span class="sy0">+</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="st0">&quot;Password=password;&quot;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IDbConnection dbcon;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">using</span><span class="br0">&#40;</span>dbcon <span class="sy0">=</span> <span class="kw3">new</span> SqlConnection<span class="br0">&#40;</span>connectionString<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; dbcon.<span class="me1">Open</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span class="kw1">using</span> <span class="br0">&#40;</span>IDbCommand dbcmd <span class="sy0">=</span> dbcon.<span class="me1">CreateCommand</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;dbcmd.<span class="me1">CommandText</span> <span class="sy0">=</span> script;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp;dbcmd.<span class="me1">ExecuteNonQuery</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>It&#8217;s quite useful. Essentially this class loads a SQL script file whose name is the same of the test class, and execute it.<br />
In this way you have for example a TestFeature.cs file alongside a TestFeature.sql file. Nice if your IDE shows files sorted alphabetically.<br />
I found that the best place to use the class is inside the SetUp marked method. In this way the SQL script is run before each test. Doing it in a local development environment is not so bad, since the scripts are executed at high speed.</p>
<p>So, this is an example of how a test that uses TestDbSetup looks like.</p>
<div class="geshi no csharp">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">using</span> <span class="kw5">System</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> NUnit.<span class="me1">Framework</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> log4net;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> log4net.<span class="me1">Config</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">namespace</span> TellItMailer <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#91;</span>TestFixture<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">public</span> <span class="kw4">class</span> IntegrationTest <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#91;</span>SetUp<span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">public</span> <span class="kw1">void</span> SetUp<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw3">new</span> TestDbSetup<span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">SetUpDbForTest</span><span class="br0">&#40;</span><span class="kw1">this</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#91;</span>Test<span class="br0">&#93;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">public</span> <span class="kw1">void</span> TestCase<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;BasicConfigurator.<span class="me1">Configure</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Pretty useful, IMHO.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danidemi.com/mainwww/2010/03/database-testing-with-mono-and-nunit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Obtain the root logger programmatically in log4net</title>
		<link>http://www.danidemi.com/mainwww/2010/03/obtain-the-root-logger-programmatically-in-log4net/</link>
		<comments>http://www.danidemi.com/mainwww/2010/03/obtain-the-root-logger-programmatically-in-log4net/#comments</comments>
		<pubDate>Mon, 08 Mar 2010 11:15:35 +0000</pubDate>
		<dc:creator>danidemi</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://www.danidemi.com/mainwww/?p=113</guid>
		<description><![CDATA[<p>If you use log4net, you could have the need to configure the loggers programamtically. The problem arise when you want access to the root logger, since the documentation does not explain well how to obtain it.
So, here&#8217;s a snippet that show how to do it. Don&#8217;t forget to imort the log4net namespaces.</p>



using log4net;


using log4net.Core;


using log4net.Appender;


using [...]]]></description>
			<content:encoded><![CDATA[<p>If you use log4net, you could have the need to configure the loggers programamtically. The problem arise when you want access to the root logger, since the documentation does not explain well how to obtain it.<br />
So, here&#8217;s a snippet that show how to do it. Don&#8217;t forget to imort the log4net namespaces.</p>
<div class="geshi no csharp">
<ol>
<li class="li1">
<div class="de1"><span class="kw1">using</span> log4net;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> log4net.<span class="me1">Core</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> log4net.<span class="me1">Appender</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> log4net.<span class="me1">Layout</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> log4net.<span class="me1">Repository</span>.<span class="me1">Hierarchy</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">using</span> log4net.<span class="me1">Config</span>;</div>
</li>
</ol>
</div>
<div class="geshi no csharp">
<ol>
<li class="li1">
<div class="de1">Hierarchy h <span class="sy0">=</span> <span class="br0">&#40;</span>Hierarchy<span class="br0">&#41;</span>log4net.<span class="me1">LogManager</span>.<span class="me1">GetRepository</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">Logger rootLogger <span class="sy0">=</span> h.<span class="me1">Root</span>;</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.danidemi.com/mainwww/2010/03/obtain-the-root-logger-programmatically-in-log4net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH Cheat Sheet</title>
		<link>http://www.danidemi.com/mainwww/2010/02/ssh-cheat-sheet/</link>
		<comments>http://www.danidemi.com/mainwww/2010/02/ssh-cheat-sheet/#comments</comments>
		<pubDate>Fri, 19 Feb 2010 11:39:00 +0000</pubDate>
		<dc:creator>danidemi</dc:creator>
				<category><![CDATA[Aneddoti Informatici]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.danidemi.com/mainwww/2010/02/ssh-cheat-sheet/</guid>
		<description><![CDATA[Task: login to remote host with username and password
<p>Login to host:</p>



ssh &#160;-l &#160;[login] -p [port]



Task: login to remote host using a configured alias
<p>First of all you need to configure the alias. The SSH configuration file is normlly stored in ~/.ssh/config. This is an example.</p>

host


&#160;Hostname [hostname]



&#160;Port [port]



&#160;ForwardAgent [yes&#124;no]



&#160;ForwardX11 [yes&#124;no]



&#160;User [login]



<p>Once you have an alias, you can [...]]]></description>
			<content:encoded><![CDATA[<h2>Task: login to remote host with username and password</h2>
<p>Login to host:</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">ssh &nbsp;-l &nbsp;[login] -p [port]</div>
</li>
</ol>
</div>
<h2>Task: login to remote host using a configured alias</h2>
<p>First of all you need to configure the alias. The SSH configuration file is normlly stored in ~/.ssh/config. This is an example.</p>
<div class="geshi no shell">
<div class="head">host</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;Hostname [hostname]
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;Port [port]
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;ForwardAgent [yes|no]
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;ForwardX11 [yes|no]
</div>
</li>
<li class="li1">
<div class="de1">&nbsp;User [login]</div>
</li>
</ol>
</div>
<p>Once you have an alias, you can specify the alias name instead of specify all the options as parameters.</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">ssh [alias]</div>
</li>
</ol>
</div>
<h2>Task: login to remote host using key authentication</h2>
<ul>
<li>Put your private key in ~/.ssh/id_rsa</li>
<li>Ensure nobody can access it. After all it&#8217;s your private key.</li>
<li>Transfer your public key in your remote host home directory</li>
<li>On the remote host append the public key to the list of authorized ones with the following command.
<div class="geshi no shell">
<div class="head">cat  [public_key_file] &gt;&gt; ~/.ssh/authorized_keys</div>
<ol>
<li class="li1">
<div class="de1">&lt;/pre&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;/li&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;li&gt;Pay attention to the fact that the authorized_key file should be writeable only by the owner. If you forget that, the key based authentication will definitely fail.&lt;/li&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;/ul&gt;
</div>
</li>
<li class="li1">
<div class="de1">&lt;h2&gt;Task: copy a local file to a remote host&lt;/h2&gt;
</div>
</li>
<li class="li1">
<div class="de1">Copying file to host:
</div>
</li>
<li class="li1">
<div class="de1">&lt;pre lang=&quot;shell&quot;&gt;
</div>
</li>
<li class="li1">
<div class="de1">scp [local_file] [remote_user]@[remote_host]:[path]</div>
</li>
</ol>
</div>
<p>Copy the local file &#8220;readme.txt&#8221; on your remote host folder (don&#8217;t forget the &#8220;~&#8221;) using the &#8220;john&#8221; username. Let&#8217;s suppose the remote host is called &#8220;wonderland.org&#8221;.</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">scp readme.txt john@wonderland.org:~</div>
</li>
</ol>
</div>
<p>Copying file from host:</p>
<div class="geshi no shell">
<ol>
<li class="li1">
<div class="de1">scp scp [remote_user]@[remote_host]:[remote_file_path][local_file_path]</div>
</li>
</ol>
</div>
<div class="flockcredit" style="text-align: right; color: #ccc; font-size: x-small;">Blogged with the <a style="color: #999; font-weight: bold;" title="Flock Browser" href="http://www.flock.com/blogged-with-flock" target="_new">Flock Browser</a></div>
]]></content:encoded>
			<wfw:commentRss>http://www.danidemi.com/mainwww/2010/02/ssh-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First Facebook application</title>
		<link>http://www.danidemi.com/mainwww/2010/01/first-facebook-application/</link>
		<comments>http://www.danidemi.com/mainwww/2010/01/first-facebook-application/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 17:04:42 +0000</pubDate>
		<dc:creator>danidemi</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://www.danidemi.com/mainwww/2010/01/first-facebook-application/</guid>
		<description><![CDATA[<p>My first Facebook application &#8220;Car Pooling&#8221;, developed at Tmind, is currently on line and available to you all. Just browse to the following link http://apps.facebook.com/car_pooling/. I hope you&#8217;ll enjoy it. And if you have a comment, please let me know!</p>
]]></description>
			<content:encoded><![CDATA[<p>My first Facebook application &#8220;Car Pooling&#8221;, developed at Tmind, is currently on line and available to you all. Just browse to the following link <a title="Car Pooling Facebook application" href="http://apps.facebook.com/car_pooling/" target="_blank">http://apps.facebook.com/car_pooling/</a>. I hope you&#8217;ll enjoy it. And if you have a comment, please let me know!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danidemi.com/mainwww/2010/01/first-facebook-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
