<?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>Alkampfer&#039;s Place&#187; Tools and library</title>
	<atom:link href="http://www.codewrecks.com/blog/index.php/category/tools-and-library/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codewrecks.com/blog</link>
	<description>Wrecks of code floating in the sea of Internet By Ricci Gian Maria</description>
	<lastBuildDate>Wed, 08 Feb 2012 17:49:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>Red-Gate Webinars</title>
		<link>http://www.codewrecks.com/blog/index.php/2012/01/30/red-gate-webinar/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2012/01/30/red-gate-webinar/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 14:14:19 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Tools and library]]></category>
		<category><![CDATA[RedGate]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2012/01/30/red-gate-webinar/</guid>
		<description><![CDATA[If you work with Sql Server and like Red-Gate tools, you can find a couple of interesting webinars to see some features of their exceptional tools in action. If you are interested you can find all the details here; webinars are free and require only a registration, so go and take a look at what [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2012%2F01%2F30%2Fred-gate-webinar%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2012%2F01%2F30%2Fred-gate-webinar%2F&amp;source=alkampfer&amp;style=normal&amp;hashtags=RedGate&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>If you work with <a target="_blank" title="Sql Server" href="http://www.codewrecks.com/blog/index.php/category/programming/sql-server/">Sql Server</a> and like <a href="http://www.red-gate.com">Red-Gate</a> <a target="_blank" title="tools" href="http://www.codewrecks.com/blog/index.php/tag/tools/">tools</a>, you can find a couple of interesting webinars to see some features of their exceptional <a title="tools" href="http://www.codewrecks.com/blog/index.php/tag/tools/">tools</a> in action. If you are interested you can find <a href="http://www.red-gate.com/products/sql-development/sql-source-control/webinars">all the details here</a>; webinars are free and require only a registration, so go and take a look at what Red Gate can offer <img src='http://www.codewrecks.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</p>
<p>Gian Maria.</p>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2012/01/30/red-gate-webinar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion 1.7 and the new workspace</title>
		<link>http://www.codewrecks.com/blog/index.php/2011/10/21/subversion-1-7-and-the-new-workspace/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2011/10/21/subversion-1-7-and-the-new-workspace/#comments</comments>
		<pubDate>Fri, 21 Oct 2011 08:38:00 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Tools and library]]></category>
		<category><![CDATA[VCS]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2011/10/21/subversion-1-7-and-the-new-workspace/</guid>
		<description><![CDATA[Subversion 1.7 has a new format of the workspace, the first important stuff is that there are not a .svn folder for each mapped folder, but it has only a single .svn folder in the root of the local mapping of the repository. This lead to a tremendous improvement in performance with very big repository. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2011%2F10%2F21%2Fsubversion-1-7-and-the-new-workspace%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2011%2F10%2F21%2Fsubversion-1-7-and-the-new-workspace%2F&amp;source=alkampfer&amp;style=normal&amp;hashtags=VCS&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Subversion 1.7 has a new format of the workspace, the first important stuff is that there are not a .svn folder for each mapped folder, but it has only a single .svn folder in the root of the local mapping of the repository. This lead to a tremendous improvement in <a title="performance" href="http://www.codewrecks.com/blog/index.php/tag/performance/">performance</a> with very big repository. Actually doing an update from my SSD on a project that has thousands of folder is almost instantaneous. Just install the new version of tortoise, update the local workspace and you are done.</p>
<p>This demonstrates how much important it has the decision on how to map server data with local version in a&#160; Version Control System. The old workspace in Subversion, really suffer from poor <a title="performance" href="http://www.codewrecks.com/blog/index.php/tag/performance/">performance</a> when you have a lot of folders and really big repository, caused from a huge amount of disk reads to find and read all .svn folders scattered all around the repository. In a project where I’m working, people with a&#160; standard 7.200 RPM old disk, waits for almost a minute before the client was able to start downloading update from the server, and the pc is freezed due to the massive disk access. In my system with an SSD it taked 4 seconds, but now it is instantaneous. </p>
<p>I’m forcing all other dev to update <img src='http://www.codewrecks.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , so if you still use tortoise svn older than 1.7.x please take your time to update.</p>
<p>Gian Maria.</p>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2011/10/21/subversion-1-7-and-the-new-workspace/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Troubleshooting Microsoft Dynamic CRM 2011 connection with Outlook</title>
		<link>http://www.codewrecks.com/blog/index.php/2011/07/04/troubleshooting-microsoft-dynamic-crm-2011-connection-with-outlook/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2011/07/04/troubleshooting-microsoft-dynamic-crm-2011-connection-with-outlook/#comments</comments>
		<pubDate>Mon, 04 Jul 2011 14:11:14 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Tools and library]]></category>
		<category><![CDATA[CRM]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2011/07/04/troubleshooting-microsoft-dynamic-crm-2011-connection-with-outlook/</guid>
		<description><![CDATA[I should specify that I really do not know Microsoft Dynamic CRM 2011, but this morning a friend of mine called me to troubleshoot a problem with Outlook integration. The problem with Outlook connection is that it is based upon a WCF service and my friend told me that the service did not start, each [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2011%2F07%2F04%2Ftroubleshooting-microsoft-dynamic-crm-2011-connection-with-outlook%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2011%2F07%2F04%2Ftroubleshooting-microsoft-dynamic-crm-2011-connection-with-outlook%2F&amp;source=alkampfer&amp;style=normal&amp;hashtags=CRM&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I should specify that I really do not know Microsoft Dynamic CRM 2011, but this morning a friend of mine called me to troubleshoot a problem with Outlook integration. The problem with Outlook connection is that it is based upon a WCF service and my friend told me that the service did not start, each time he tried to browser to the service with a browser (<a target="_blank" href="http://crm.mycompany.com:5555/XRMServices/2011/discovery.svc">http://crm.mycompany.com:5555/XRMServices/2011/discovery.svc</a>) he got an error and watching the Event Viewer he found the exception message, but he was not able to understand what was wrong.</p>
<blockquote><p> Exception: System.ServiceModel.ServiceActivationException: The service &#8216;/XRMServices/2011/Discovery.svc&#8217; cannot be activated due to an exception during compilation.&#160; The exception message is: The value could not be added to the collection, as the collection already contains an item of the same type: &#8216;System.ServiceModel.Description.UseRequestHeadersForMetadataAddressBehavior&#8217;. This collection only supports one instance of each type.     <br />Parameter name: item. &#8212;&gt; System.ArgumentException: The value could not be added to the collection, as the collection already contains an item of the same type: &#8216;System.ServiceModel.Description.UseRequestHeadersForMetadataAddressBehavior&#8217;. This collection only supports one instance of each type.</p>
</blockquote>
<p>Since I work a lot with WCF, and the error is somewhat related to WCF I tried to solve the problem even if I never worked with CRM 2011. <img src='http://www.codewrecks.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  First of all this kind of error usually arise when the site in IIS has multiple binding, the first thing to verify is that in IIS the CRM site had only one binding (in default port 5555). It turns out that the configuration was indeed correct, the site had only one binding but the error is indeed related to multiple binding. </p>
<p>To solve this issue I decided to use the <a target="_blank" href="http://msdn.microsoft.com/en-us/library/bb924481.aspx">baseAddressPrefixFilters</a> configuration element of WCF, because it is used to pick the appropriate IIS bindings for WCF and even if the IIS only has one binding, I was convinced that the error is related to a wrong binding. I changed the system.servicemodel adding this node.</p>
<div style="margin: 20px 0px 10px; padding: 4px; border: 1px solid silver; width: 97.5%; text-align: left; line-height: 12pt; overflow: auto; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; cursor: text; direction: ltr; max-height: 200px; background-color: rgb(244, 244, 244);" id="codeSnippetWrapper">
<div style="padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);" id="codeSnippet">
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(96, 96, 96);" id="lnum1">   1:</span> <span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">serviceHostingEnvironment</span><span style="color: rgb(0, 0, 255);">&gt;</span>  </pre>
<p><!--CRLF--></p>
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);" id="lnum2">   2:</span>     <span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">baseAddressPrefixFilters</span><span style="color: rgb(0, 0, 255);">&gt;</span>  </pre>
<p><!--CRLF--></p>
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(96, 96, 96);" id="lnum3">   3:</span>         <span style="color: rgb(0, 0, 255);">&lt;</span><span style="color: rgb(128, 0, 0);">add</span> <span style="color: rgb(255, 0, 0);">prefix</span><span style="color: rgb(0, 0, 255);">=&quot;http://crm.mycompany.com:5555/&quot;</span><span style="color: rgb(0, 0, 255);">/&gt;</span>  </pre>
<p><!--CRLF--></p>
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: rgb(244, 244, 244);"><span style="color: rgb(96, 96, 96);" id="lnum4">   4:</span>     <span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">baseAddressPrefixFilters</span><span style="color: rgb(0, 0, 255);">&gt;</span>  </pre>
<p><!--CRLF--></p>
<pre style="margin: 0em; padding: 0px; width: 100%; text-align: left; color: black; line-height: 12pt; overflow: visible; font-family: &quot;Courier New&quot;, courier, monospace; font-size: 8pt; direction: ltr; background-color: white;"><span style="color: rgb(96, 96, 96);" id="lnum5">   5:</span> <span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">serviceHostingEnvironment</span><span style="color: rgb(0, 0, 255);">&gt;</span> </pre>
<p><!--CRLF--></div>
</div>
<p>Now I browse again on the service and it is still broken, but the event viewer showed me another type of error.</p>
<blockquote>
<p>Exception: System.ServiceModel.ServiceActivationException: The service &#8216;/XRMServices/2011/Organization.svc&#8217; cannot be activated due to an exception during compilation.&#160; The exception message is: The extended protection settings configured on IIS do not match the settings configured on the transport.&#160; The ExtendedProtectionPolicy.PolicyEnforcement values do not match.&#160; IIS has a value of WhenSupported while the WCF Transport has a value of Never.. &#8212;&gt; System.NotSupportedException: The extended protection settings configured on IIS do not match the settings configured on the transport.&#160; The ExtendedProtectionPolicy.PolicyEnforcement values do not match.&#160; IIS has a value of WhenSupported while the WCF Transport has a value of Never.</p>
</blockquote>
<p>The error changed, and luckily enough this is a very simple error to troubleshoot, because it is due to a mismatch between IIS <a title="security" href="http://www.codewrecks.com/blog/index.php/tag/security/">security</a> configuration for Windows Authentication and WCF configuration. You should open IIS Manager, select the site of the CRM, select the <em>Authentication</em> element and search for Windows Authentication. Windows Authentication should be Enabled, and then you should go to the Advanced Settings changing the Extended protection to Off and restart IIS. This finally solved the mismatch.</p>
<p>Now finally outlook is able to connect to the CRM without errors.</p>
<p>alk.</p>
<p>Tags: <a target="_blank" href="http://technorati.com/tag/CRM" rel="tag">CRM</a> <a target="_blank" href="http://technorati.com/tag/Microsoft" rel="tag">Microsoft</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2011/07/04/troubleshooting-microsoft-dynamic-crm-2011-connection-with-outlook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploy on remote machine during builds</title>
		<link>http://www.codewrecks.com/blog/index.php/2010/07/06/deploy-on-remote-machine-during-builds/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/06/deploy-on-remote-machine-during-builds/#comments</comments>
		<pubDate>Tue, 06 Jul 2010 07:21:21 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Tools and library]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/06/deploy-on-remote-machine-during-builds/</guid>
		<description><![CDATA[Clearly Lab Management is really good to manage virtual environments and give a lot of flexibility on how to deploy your application on virtual machines, but if you do not have Lab Management you can still use the same technique to deploy application in remote computer during a build with the use of a simple [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F06%2Fdeploy-on-remote-machine-during-builds%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F06%2Fdeploy-on-remote-machine-during-builds%2F&amp;source=alkampfer&amp;style=normal&amp;hashtags=ASP.NET&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Clearly <a target="_blank" title="Lab Management" href="http://www.codewrecks.com/blog/index.php/category/programming/team-foundation-server/lab-management-team-foundation-server-programming/">Lab Management</a> is really good to <a href="http://www.codewrecks.com/blog/index.php/2010/06/29/deploy-a-solution-and-a-database-in-a-lab-management-virtual-environment/">manage virtual environment</a>s and give a lot of flexibility on how to deploy your application on virtual machines, but if you do not have <a title="Lab Management" href="http://www.codewrecks.com/blog/index.php/category/programming/team-foundation-server/lab-management-team-foundation-server-programming/">Lab Management</a> you can still use the same technique to deploy application in remote computer during a build with the use of a simple scripts. The key is the ability to execute code on a remote computer with <a href="http://www.beyondlogic.org/solutions/remoteprocess/BeyondExec.htm">beyondexec</a> or similar tool. Suppose you need to deploy an application called demo, you have a <a target="_blank" title="Tfs" href="http://msdn.microsoft.com/en-us/vstudio/ff637362">Tfs</a> build called Demo, and you want to be able to deploy a specific build on a remote server, the solution could be this simple script</p>
<p><em><font size="2">@echo off</font></em></p>
<p><em><font size="2">set RemotePath= \10.0.0.220dropsdemo%1_PublishedWebsitesDemo_Package*.*       <br />set LocalPath=c:<a title="setup" href="http://www.codewrecks.com/blog/index.php/tag/setup/">setup</a>demo</font></em></p>
<p><em><font size="2">if exist %LocalPath% (       <br />rmdir /s /q %LocalPath%        <br />)        <br />mkdir %LocalPath%</font></em></p>
<p><em><font size="2">if not exist %RemotePath% (       <br />echo remote path %RemotePath% doesn&#8217;t exist        <br />goto Error        <br />)</font></em>    <br /><em><font size="2">xcopy /c %RemotePath% %LocalPath%.       <br />%LocalPath%Demo.deploy.cmd /Y</font></em></p>
<p><em><font size="2">echo Demo Copied to LocalPath %LocalPath%       <br />exit /b 0</font></em></p>
<p><em><font size="2">:Error       <br />echo Unable to Copy Demo Scripts        <br />exit /b 1</font></em></p>
<p>The script is really simple, it simply compose the drop folder <a target="_blank" href="file://\10.0.0.220dropsdemo">\10.0.0.220dropsdemo</a> with the single argument of the batch to find the path where the build had dropped the packages, then it creates a local directory where to copy all deploy plackage and run it.</p>
<p>Now you can store this script in source control, and use it with a <a target="_blank" title="tfs" href="http://msdn.microsoft.com/en-us/vstudio/ff637362">tfs</a> build, to deploy on a remote server, you can for example run from a command prompt:</p>
<p><strong><em>beyondexecv2 \10.0.0.220 -p &quot;pa$$wordâ€ -c DeployDeployWeb.bat demo_20100607.3</em></strong></p>
<p>This will copy the script on the 10.0.0.220 server, and launch the script with the argument demo_20100607.3 (the build number), here is the result.</p>
<p><em><font size="1" face="Consolas">BeyondExec V2.05 &#8211; Spawn Remote Processes on Windows NT/2000/XP WorkStations.       <br />Copyright(C) 2002-2003 Craig.Peacock@beyondlogic.org        <br />[10.0.0.220] Establishing Connection . . .        <br />[10.0.0.220] BeyondExec service already installed on remote machine.        <br />[10.0.0.220] Copying DeployDeployWeb.bat to \10.0.0.220ADMIN$tempDeployWeb.bat        <br />[10.0.0.220] Command Successfully Issued to 10.0.0.220 on Pipe 1.        <br />[win-y4onzs094up] Process started, ProcessID = 9780, ThreadID = 9788        <br />\10.0.0.220dropsdemodemo_20100607.3_PublishedWebsitesDemo_PackageDemo.deploy-readme.txt        <br />\10.0.0.220dropsdemodemo_20100607.3_PublishedWebsitesDemo_PackageDemo.deploy.cmd        <br />\10.0.0.220dropsdemodemo_20100607.3_PublishedWebsitesDemo_PackageDemo.SetParameters.xml        <br />\10.0.0.220dropsdemodemo_20100607.3_PublishedWebsitesDemo_PackageDemo.SourceManifest.xml        <br />\10.0.0.220dropsdemodemo_20100607.3_PublishedWebsitesDemo_PackageDemo.zip        <br />5 File(s) copied        <br />=========================================================        <br />SetParameters from:        <br />&quot;c:<a title="setup" href="http://www.codewrecks.com/blog/index.php/tag/setup/">setup</a>demoDemo.SetParameters.xml&quot;        <br />You can change IIS Application Name, Physical path, connectionString        <br />or other deploy parameters in the above file.        <br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-        <br /> Start executing msdeploy.exe        <br />&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-        <br /> &quot;C:Program FilesIISMicrosoft Web Deploy\msdeploy.exe&quot; -source:package=&#8217;c:setupdemoDemo.zip&#8217; -dest:auto,includeAcls=&#8217;False&#8217; -verb:syn        <br />c -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:&quot;c:setupdemoDemo.SetParamet        <br />ers.xml&quot;        <br />Info: Adding sitemanifest (sitemanifest).        <br />Info: Updating createApp (Default Web Site/Demo_deploy).        <br />Info: Adding contentPath (Default Web Site/Demo_deploy).        <br />â€¦        <br />Info: Adding setAcl (Default Web Site/Demo_deploy).        <br />Total changes: 37 (36 added, 0 deleted, 1 updated, 0 parameters changed, 737702 bytes copied)        <br />[win-y4onzs094up] Process terminated with exit code 0 after 00:00:03.850s        <br />[win-y4onzs094up] Removing C:WindowstempDeployWeb.bat</font></em></p>
<p>As you can verify, the beyondexec tool was able to connect to remote machine, copied the deployweb.bat script on the remote machine and launched it with the right argument, now I can verify with IIS that the new web application was created in target machine. </p>
<p><a href="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image9.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" class="wlDisabledImage" title="image" border="0" alt="image" src="http://www.codewrecks.com/blog/wp-content/uploads/2010/07/image_thumb9.png" width="322" height="265" /></a></p>
<p>Et voilÃ , we deployed a web application to a remote machine with a simple command. You can use this technique in a <a title="tfs build" href="http://www.codewrecks.com/blog/index.php/tag/tfs-build/">tfs build</a> to deploy to a remote server.</p>
<p>Alk.</p>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/06/deploy-on-remote-machine-during-builds/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Extremely slow operation and log4net</title>
		<link>http://www.codewrecks.com/blog/index.php/2010/07/05/extremely-slow-operation-and-log4net/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/07/05/extremely-slow-operation-and-log4net/#comments</comments>
		<pubDate>Mon, 05 Jul 2010 11:52:24 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Tools and library]]></category>
		<category><![CDATA[log4net]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/07/05/extremely-slow-operation-and-log4net/</guid>
		<description><![CDATA[&#160; Iâ€™m currently profiling a web application, and I noticed that for some combination of input, a specific search into the database is really really slow. After verifying that the query is not responsible for this problem I fire a profiler, load the page, issue the search and then verify with ant profiler the method [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F05%2Fextremely-slow-operation-and-log4net%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F07%2F05%2Fextremely-slow-operation-and-log4net%2F&amp;source=alkampfer&amp;style=normal&amp;hashtags=log4net&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>&#160;</p>
<p>Iâ€™m currently profiling a web application, and I noticed that for some combination of input, a specific search into the database is really really slow. After verifying that the query is not responsible for this problem I fire a profiler, load the page, issue the search and then verify with ant profiler the method that need more time to be executed. The result was that the method that needs more time to be executed is one called Send Alert, that simply logs with <a title="log4net" href="http://www.codewrecks.com/blog/index.php/tag/log4net/">log4net</a> to a specific logger called Alert.</p>
<p>I noticed a lot of SocketException, so I verify the configuration, and find that the Alert logger has a reference to a SmtpAppender that points to a wrong smtp server. The page was slow because it is waiting to send an alert with a wrong mailserver, then it waits for timeout before proceeding on.</p>
<p>Ok, this is a configuration problem, but I do not want my email alert to be sent synchronously, because there is no point in slowing the application if I need to send an alert. Remember that sending an E-Mail is a slow operation even if the smtp is ok. In this situation <a title="Log4Net" href="http://www.codewrecks.com/blog/index.php/tag/log4net/">Log4Net</a> has a specific appender called AsyncAppender that can be used to solve this problem. The AsyncAppender is a specific appender that is used to wrap any other appender, and make the log asyncronous. The only part I need to change is to add this to configuration</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">appender</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;AsyncSmtpAppender&quot;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #ff0000">type</span><span style="color: #0000ff">=&quot;SampleAppendersApp.Appender.AsyncAppender,SampleAppendersApp&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>   <span style="color: #0000ff">&lt;</span><span style="color: #800000">appender-ref</span> <span style="color: #ff0000">ref</span><span style="color: #0000ff">=&quot;SmtpAppender&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">appender</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p></p>
<p>and use the AsyncSmtpAppender in logger definition.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">&lt;</span><span style="color: #800000">logger</span> <span style="color: #ff0000">name</span><span style="color: #0000ff">=&quot;Alerter&quot;</span> <span style="color: #ff0000">additivity</span><span style="color: #0000ff">=&quot;false&quot;</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">level</span> <span style="color: #ff0000">value</span><span style="color: #0000ff">=&quot;WARN&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">&lt;</span><span style="color: #800000">appender-ref</span> <span style="color: #ff0000">ref</span><span style="color: #0000ff">=&quot;AsyncSmtpAppender&quot;</span> <span style="color: #0000ff">/&gt;</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #0000ff">&lt;/</span><span style="color: #800000">logger</span><span style="color: #0000ff">&gt;</span></pre>
<p><!--CRLF--></div>
</div>
<p>Then I reload the page again, and now, even with a wrong smtp server, the page loads almost instantaneously.</p>
<p>Alk.</p>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/07/05/extremely-slow-operation-and-log4net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Change return value of a mock based on parameters in Rhino mocks</title>
		<link>http://www.codewrecks.com/blog/index.php/2010/06/30/change-return-value-of-a-mock-based-on-parameters-in-rhino-mocks/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/30/change-return-value-of-a-mock-based-on-parameters-in-rhino-mocks/#comments</comments>
		<pubDate>Wed, 30 Jun 2010 14:07:41 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Testing]]></category>
		<category><![CDATA[Tools and library]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/30/change-return-value-of-a-mock-based-on-parameters-in-rhino-mocks/</guid>
		<description><![CDATA[Sometimes there is the need to change the return value of an expectation to a Mock with a value based on parameters used in the call. Suppose you need to create a mock, and want to verify that the method DoInt() gets called with a value greater than 42 and it should return the value [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F30%2Fchange-return-value-of-a-mock-based-on-parameters-in-rhino-mocks%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F30%2Fchange-return-value-of-a-mock-based-on-parameters-in-rhino-mocks%2F&amp;source=alkampfer&amp;style=normal&amp;hashtags=Testing&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Sometimes there is the need to change the return value of an expectation to a Mock with a value based on parameters used in the call. Suppose you need to create a mock, and want to verify that the method DoInt() gets called with a value greater than 42 and it should return the value augmented by one, how you can <a title="setup" href="http://www.codewrecks.com/blog/index.php/tag/setup/">setup</a> the expectation?</p>
<p>The secret is in the WhenCalled method exposed by the mock, that permits you to access the full MethodInvocation object that gets generated during the real invocation. Here is the solution.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> interface IDo</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     Int32 DoInt(Int32 param);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> [Test]</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> <span style="color: #0000ff">public</span> void Name()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     IDo mock = MockRepository.GenerateStub&lt;IDo&gt;();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     mock.Expect(m =&gt; m.DoInt(Arg&lt;Int32&gt;.Matches(param =&gt; param &gt; 42)))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>         .WhenCalled(mi =&gt; { mi.ReturnValue = (Int32) mi.Arguments[0] + 1; })</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span>         .<span style="color: #0000ff">Return</span>(99);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     Int32 retint = mock.DoInt(432);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span>     Assert.That(retint, <span style="color: #0000ff">Is</span>.EqualTo(433));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>As you can see in the WhenCalled Method I can modify the ReturnValue using the value of a parameter, so if I call mock.DoInt(900) it will return 901. This technique is really powerful, because in WhenCalled you specify a delegate that gets called at each invocation, so you can write code like this.</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> IDo mock = MockRepository.GenerateStub&lt;IDo&gt;();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> Int32 valueToIncrement = 2;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> mock.Expect(m =&gt; m.DoInt(Arg&lt;Int32&gt;.Matches(param =&gt; param &gt; 42)))</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     .WhenCalled(mi =&gt; { mi.ReturnValue = (Int32)mi.Arguments[0] + valueToIncrement; })</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     .Repeat.<span style="color: #0000ff">Any</span>()</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>     .<span style="color: #0000ff">Return</span>(99);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> Int32 retint = mock.DoInt(432);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span> Assert.That(retint, <span style="color: #0000ff">Is</span>.EqualTo(434));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span> valueToIncrement = 100;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; 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: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> retint = mock.DoInt(432);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> Assert.That(retint, <span style="color: #0000ff">Is</span>.EqualTo(532));</pre>
<p><!--CRLF--></div>
</p></div>
<p>I use a local variable to hold the quantity used to increment argument value, if I change the value between invocations, I can change returned value, showing that I can have full dynamic control on the value returned by an expectation on a Mock.</p>
<p>alk.</p>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/30/change-return-value-of-a-mock-based-on-parameters-in-rhino-mocks/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Repair Visual Studio template</title>
		<link>http://www.codewrecks.com/blog/index.php/2010/06/07/repair-visual-studio-template/</link>
		<comments>http://www.codewrecks.com/blog/index.php/2010/06/07/repair-visual-studio-template/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 17:12:17 +0000</pubDate>
		<dc:creator>alkampfer</dc:creator>
				<category><![CDATA[Tools and library]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.codewrecks.com/blog/index.php/2010/06/07/repair-visual-studio-template/</guid>
		<description><![CDATA[Some minutes ago I installed Expression studio 4.0, while Iâ€™m working with a couple of solution in VS2008, when I close the solution and open another solution I see that I was not able anymore to work with test projects. All test projects inside any solution appear as folder, and I was not able anymore [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a target="_blank" href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F07%2Frepair-visual-studio-template%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.codewrecks.com%2Fblog%2Findex.php%2F2010%2F06%2F07%2Frepair-visual-studio-template%2F&amp;source=alkampfer&amp;style=normal&amp;hashtags=Visual+Studio&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Some minutes ago I installed Expression studio 4.0, while Iâ€™m working with a couple of solution in VS2008, when I close the solution and open another solution I see that I was not able anymore to work with <a title="test" href="http://www.codewrecks.com/blog/index.php/2007/09/03/test/">test</a> projects.</p>
<p>All <a target="_blank" title="test" href="http://www.codewrecks.com/blog/index.php/2007/09/03/test/">test</a> projects inside any solution appear as folder, and I was not able anymore to create a test project. I do not know if something get wrong during installation of Expression <a title="tools" href="http://www.codewrecks.com/blog/index.php/tag/tools/">tools</a> while I have a couple of VS instances opened or there was some problem on my machine that happened for any other reason <img src='http://www.codewrecks.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , but whenever you got problem with project templates in <a title="Visual Studio" href="http://blogs.msdn.com/b/visualstudio/">Visual Studio</a>, such as missing project types, you can try to run </p>
<p><strong><em>devenv /InstallVSTemplates</em></strong></p>
<p>that restores all templates in <a target="_blank" title="Visual Studio" href="http://blogs.msdn.com/b/visualstudio/">Visual Studio</a>, it worked for me <img src='http://www.codewrecks.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>alk.</p>]]></content:encoded>
			<wfw:commentRss>http://www.codewrecks.com/blog/index.php/2010/06/07/repair-visual-studio-template/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

