<?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>Head.SmackOnTable(); &#187; c#.net</title>
	<atom:link href="http://www.unauthorised-access.com/tag/cnet/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unauthorised-access.com</link>
	<description>Contains Nuts.</description>
	<lastBuildDate>Fri, 02 Jul 2010 17:46:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Comments considered harmful</title>
		<link>http://www.unauthorised-access.com/2010/05/comments-considered-harmful/</link>
		<comments>http://www.unauthorised-access.com/2010/05/comments-considered-harmful/#comments</comments>
		<pubDate>Mon, 10 May 2010 15:05:20 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Cleverectomy]]></category>
		<category><![CDATA[c#.net]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=455</guid>
		<description><![CDATA[I often have this discussion with less learned members of staff, with regards to commenting code. The main argument is &#8220;Comment code so I can see what is going on!&#8221; and &#8220;If you don&#8217;t comment the code, I dont understand&#8221;. In the first instance, I recommend refactoring the code and rewriting it, so you do [...]]]></description>
			<content:encoded><![CDATA[<p>I often have this discussion with less learned members of staff, with regards to commenting code. The main argument is &#8220;Comment code so I can see what is going on!&#8221; and &#8220;If you don&#8217;t comment the code, I dont understand&#8221;. In the first instance, I recommend refactoring the code and rewriting it, so you do not NEED the comments, and usually (99.99%) with the second argument for commenting is, If you do not understand the code, should you really be touching it?</p>
<p>There is the 3rd style of commenting I sometimes come across, and that is the Newbie Comment. Typically, the code has been lifted from a coding website, and someone has left the comments in there, because they either dont know how to use their text editor, or they dont understand the code they are coping and pasting. Both of which, to me at least, indicate that the person should not be writing code and should spend more time understanding the framework and how things work in general, like the following:</p>
<pre class="brush: csharp;">
//create file object
 FileInfo fi = new FileInfo(filePath);
 //read the file into a stream reader
 StreamReader sr = fi.OpenText();
 //store the contents in a string
 string emailBody = sr.ReadToEnd();
 sr.Close();
</pre>
<p>The most common comments I see are totally useless, and simply repeat what the line below will do, for example <em>i++; //increment i</em>. How is that comment at all useful? Its not, it just tells you what the line is doing, which the line itself should tell you. Its duplication of code, you are repeating yourself, which is violation of the DRY principle:</p>
<p><cite>Don&#8217;t Repeat Yourself</cite></p>
<p>From the wonderful book of <a href="http://www.amazon.co.uk/Pragmatic-Programmer-Andrew-Hunt/dp/020161622X/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1273503290&amp;sr=1-1">The Progmatic Programmer</a>. The comment adds nothing to the overall readability of the code, so it shouldnt be there, it is simply extra clutter to make things more difficult to read and maintain.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2010/05/comments-considered-harmful/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Making code easier to maintain, read</title>
		<link>http://www.unauthorised-access.com/2010/05/making-code-easier-to-maintain-read/</link>
		<comments>http://www.unauthorised-access.com/2010/05/making-code-easier-to-maintain-read/#comments</comments>
		<pubDate>Fri, 07 May 2010 15:05:58 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Cleverectomy]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[mvc]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=442</guid>
		<description><![CDATA[Often, when working with someone else&#8217;s code, it works, but it isnt easy to maintain and read. Basically its ugly, and sometimes its like an ugly bag of snakes. Take this example: Note: This code has been changed to protect the guilty. [HandleError] public ActionResult LogOn(string username, string password, bool rememberMe) { string failureText = [...]]]></description>
			<content:encoded><![CDATA[<p>Often, when working with someone else&#8217;s code, it works, but it isnt easy to maintain and read. Basically its ugly, and sometimes its like an ugly bag of snakes. Take this example:</p>
<p><strong>Note: This code has been changed to protect the guilty.</strong></p>
<pre class="brush: csharp;">
[HandleError]
 public ActionResult LogOn(string username, string password, bool rememberMe)
 {
 string failureText = _websiteService.Login(username, password, rememberMe);
 if (!string.IsNullOrEmpty(failureText))
 {
 TempData[&quot;LoginFailure&quot;] = failureText;
 return RedirectToAction(&quot;CheckoutAddress&quot;);
 }
 else
 Response.Redirect(Url.Action(&quot;CheckoutAddress&quot;, &quot;Orders&quot;));

 return View();
 }
</pre>
<p>Now, to me, this rings alarm bells, for multiple reasons. First off, you have failureText which claims to login, but actually gets you if it failed or not. Next thing you have is the &#8220;If there is no failure text, then it has worked&#8221;. Thirdly, you have the defunct return view, even though it shouldnt really be there.</p>
<p>How should this code be structured I hear you cry? Well, something like this:</p>
<pre class="brush: csharp;">
[HandleError]
public ActionResult LogOn(string username, string password, bool rememberMe)
{
 if (AreCredentialsValid(username, password) &amp;&amp; IsUserAllowedToLogin(username))
 {
 SetAuthenticationCookie(username,password);
 return RedirectToAction(&quot;CheckoutAddress&quot;);
 }
 else
 {
 ShowInvalidCredentialsPanel();
 return RedirectToAction(&quot;CheckoutAddress&quot;);
 }
}
</pre>
<p>Much more easier to read, much easier to maintain and modify, and no having to look for magic strings and just assuming someone can login because there wasnt an error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2010/05/making-code-easier-to-maintain-read/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a CI server using CC.Net Part 1</title>
		<link>http://www.unauthorised-access.com/2010/02/creating-a-ci-server-using-cc-net-part-1/</link>
		<comments>http://www.unauthorised-access.com/2010/02/creating-a-ci-server-using-cc-net-part-1/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 00:05:43 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[CycleMania]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[cc.net]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=386</guid>
		<description><![CDATA[For the CycleMania project, I previously used TeamCity, but I think it is more geared towards building static projects and running tests rather than deployment, so this time around im going to be using CruiseControl.NET Note &#8211; I am doing this and writing this at the same time To get started, you need to install [...]]]></description>
			<content:encoded><![CDATA[<p>For the CycleMania project, I previously used TeamCity, but I think it is more geared towards building static projects and running tests rather than deployment, so this time around im going to be using CruiseControl.NET</p>
<p><strong>Note &#8211; I am doing this and writing this at the same time <img src='http://www.unauthorised-access.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </strong></p>
<p>To get started, you need to install the following:</p>
<ul>
<li>Subversion for windows, command line, from Collab.NET</li>
<li>NAnt, I have version 0.85 installed, and put the path into the <em>PATH</em> environment variable, I am NOT using 0.86beta1 because of this error:</li>
</ul>
<pre class="brush: plain;">
NAnt 0.86 (Build 0.86.2898.0; beta1; 12/8/2007)
Copyright (C) 2001-2007 Gerry Shaw

http://nant.sourceforge.net

BUILD FAILED

Failed to initialize the 'Microsoft .NET Framework 2.0' (net-2.0) target framework.

 Property evaluation failed.
Expression: ${path::combine(sdkInstallRoot, 'bin')}
 ^^^^^^^^^^^^^^

 Property 'sdkInstallRoot' has not been set.

For more information regarding the cause of the build failure, run the build again in debug mode.

Try 'nant -help' for more information
</pre>
<p>Even though we do NOT need the .net 2.0 SDK! Very poor show indeed.</p>
<ul>
<li>CruiseControl.Net &#8211; you probably want to set the admin password to something else from the config file loctated in the <em>webdashboard</em> directory (inside where you installed cc.net), the file is <em>dashboard.config</em></li>
</ul>
<p>Once you have the above monkies installed, you want to do a checkout of the CycleMania source code to a directory, like so:</p>
<pre class="brush: plain;">

svn co https://cyclemania.svn.codeplex.com/svn/trunk E:\SVN\CycleMania
</pre>
<p>Replace the <em>E:\SVN\CycleMania</em> with wherever your subversion repository lives.</p>
<p>For sake of argument, I have my build scripts living in E:\SVN\CycleMania-BuildScript, and the file is called CycleMania.build</p>
<p>Once you have done that, go into the build script, and type in <em>nant</em>, and you should get the following:</p>
<pre class="brush: plain;">
E:\SVN\CycleMania-BuildScript&gt;nant -buildfile:CycleMania.build
NAnt 0.85 (Build 0.85.2478.0; release; 10/14/2006)
Copyright (C) 2001-2006 Gerry Shaw

http://nant.sourceforge.net

Buildfile: file:///E:/SVN/CycleMania-BuildScript/CycleMania.build
Target framework: Microsoft .NET Framework 2.0
Target(s) specified: build

build:

 [echo] Building Target
 [exec] Starting 'c:\Windows\Microsoft.NET\Framework64\v4.0.30128\MSBuild.exe ( E:\SVN\CycleMania\CycleMania.sln)' in 'E:\SVN\CycleMania-BuildScript'
 [exec] Microsoft (R) Build Engine Version 4.0.30128.1
 [exec] [Microsoft .NET Framework, Version 4.0.30128.1]
 [exec] Copyright (C) Microsoft Corporation 2007. All rights reserved.
 [exec] Build started 2/23/2010 3:47:11 PM.
 [exec] Project &quot;E:\SVN\CycleMania\CycleMania.sln&quot; on node 1 (default targets).
 [exec] ValidateSolutionConfiguration:
 [exec]   Building solution configuration &quot;Debug|Mixed Platforms&quot;.
 [exec] Project &quot;E:\SVN\CycleMania\CycleMania.sln&quot; (1) is building &quot;E:\SVN\CycleMania\Cyclemania.Web\Cyclemania.Web.csproj&quot; (2) on node 1 (default targets).

 [exec] E:\SVN\CycleMania\Cyclemania.Web\Cyclemania.Web.csproj(649,3): error MSB4019: The imported project &quot;C:\Program Files (x86)\MSBuild\Microsoft\VisualS
tudio\v10.0\WebApplications\Microsoft.WebApplication.targets&quot; was not found. Confirm that the path in the &lt;Import&gt; declaration is correct, and that the file exi
sts on disk.
 [exec] Done Building Project &quot;E:\SVN\CycleMania\Cyclemania.Web\Cyclemania.Web.csproj&quot; (default targets) -- FAILED.
 [exec] Done Building Project &quot;E:\SVN\CycleMania\CycleMania.sln&quot; (default targets) -- FAILED.
 [exec] Build FAILED.
 [exec] &quot;E:\SVN\CycleMania\CycleMania.sln&quot; (default target) (1) -&gt;
 [exec] &quot;E:\SVN\CycleMania\Cyclemania.Web\Cyclemania.Web.csproj&quot; (default target) (2) -&gt;
 [exec]   E:\SVN\CycleMania\Cyclemania.Web\Cyclemania.Web.csproj(649,3): error MSB4019: The imported project &quot;C:\Program Files (x86)\MSBuild\Microsoft\Visua
lStudio\v10.0\WebApplications\Microsoft.WebApplication.targets&quot; was not found. Confirm that the path in the &lt;Import&gt; declaration is correct, and that the file exists on disk.
 [exec]     0 Warning(s)
 [exec]     1 Error(s)
 [exec] Time Elapsed 00:00:05.22

BUILD FAILED

E:\SVN\CycleMania-BuildScript\CycleMania.build(7,4):
External Program Failed: c:\Windows\Microsoft.NET\Framework64\v4.0.30128\MSBuild.exe (return code was 1)

Total time: 12.9 seconds.
</pre>
<p>HUH?!? What the hell happened there? Well in the infinate wisdom of Microsoft (which I have <a href="http://www.unauthorised-access.com/2008/07/ms-build-microsoftwebapplicationtargets-was-not-found/">blogged about before</a>), they did not decide to include the Microsoft.WebApplications.targets file anywhere to be found on the hdd, and you have to dig it out from the vs.net install, or you can find it from <a href="http://www.unauthorised-access.com/wp-content/uploads/2010/02/MSBuild.zip">this handly link</a>! Unzip this into your <em>Program Files</em> or <em>Program Files (x86)</em> if you are fancy and have a 64bit proc.</p>
<p>Once you have unzipped that lovely glorious file, and run the NAnt script again, you should see a better output, with LOADS of stuff hapenning, and hopefully at the end, these GLORIOUS WORDS:</p>
<pre class="brush: plain;">

BUILD SUCCEEDED

Total Time: 11.6 seconds
</pre>
<p>Note: Your time may vary.</p>
<p>In Part 2, I will describe how to set up your SQL 2008 instance up, user accounts (NOTE, I would do this properly as opposed to the hacky &#8220;lets get the site to work&#8221; way), and IIS&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2010/02/creating-a-ci-server-using-cc-net-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resharper and its &#8220;Convert to LINQ expression&#8221;</title>
		<link>http://www.unauthorised-access.com/2010/01/resharper-and-its-convert-to-linq-expression/</link>
		<comments>http://www.unauthorised-access.com/2010/01/resharper-and-its-convert-to-linq-expression/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 13:50:43 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[resharper]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=375</guid>
		<description><![CDATA[I guess im a bit old fashioned, but I like to write code like: public static List&#60;string&#62; CovertLongListToString(IEnumerable&#60;long&#62; param) { List&#60;String&#62; returnList = new List&#60;string&#62;(); foreach (long l in param) { returnList.Add(l.ToString()); } return returnList; } But then resharper 5.0 gives me this lovely option of &#8220;Convert to LINQ Expression&#8221;, and it turns into: public [...]]]></description>
			<content:encoded><![CDATA[<p>I guess im a bit old fashioned, but I like to write code like:</p>
<pre class="brush: csharp;">
public static List&lt;string&gt; CovertLongListToString(IEnumerable&lt;long&gt; param)
 {
 List&lt;String&gt; returnList = new List&lt;string&gt;();

 foreach (long l in param)
 {
 returnList.Add(l.ToString());
 }

 return returnList;
 }
</pre>
<p>But then resharper 5.0 gives me this lovely option of &#8220;Convert to LINQ Expression&#8221;, and it turns into:</p>
<pre class="brush: csharp;">

public static List&lt;string&gt; CovertLongListToString(IEnumerable&lt;long&gt; param)
 {
 return param.Select(l =&gt; l.ToString()).ToList();
 }
</pre>
<p>Thats just brilliant! I LOVE YOU RESHARPER!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2010/01/resharper-and-its-convert-to-linq-expression/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deployment process on CycleMania</title>
		<link>http://www.unauthorised-access.com/2010/01/deployment-process-on-cyclemania/</link>
		<comments>http://www.unauthorised-access.com/2010/01/deployment-process-on-cyclemania/#comments</comments>
		<pubDate>Sat, 02 Jan 2010 20:34:19 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[CycleMania]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[nant]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=368</guid>
		<description><![CDATA[As I have mentioned earlier, I am using a NAnt script to do the building for CycleMania, as I believe that its more geared towards what I need it to do than TeamCity. While TeamCity is a great product in itself, I believe that it either cannot do, or doesn&#8217;t make clear, how to copy [...]]]></description>
			<content:encoded><![CDATA[<p>As I have mentioned earlier, I am using a NAnt script to do the building for CycleMania, as I believe that its more geared towards what I need it to do than TeamCity. While TeamCity is a great product in itself, I believe that it either cannot do, or doesn&#8217;t make clear, how to copy over files from the build directory into another directory (this being the wwwroot of the website).</p>
<p>The reason why I dont want to point the wwwroot at the subversion root, is for security (.svn folders are browsable by default, and not parsed by asp.net), and because of the way that TeamCity works – when it attempts to do an update, it isnt clear on how to get it to revert all changes made (i.e. to the database), and the database file will be locked, with no way of making it available on the fly.</p>
<p>So, in jumps in NAnt. I know, I could use MSBuild Scripts, or powershell scripting, but I have been using NAnt for some time, and I know it rather well, and its free and runs on machines fairly easily.</p>
<h2>A run down of the CycleMania NAnt Script</h2>
<p>To start off with, we build the solution file. There is no point doing anything at all if the solution does not compile, so we run the following, After setting a few variables:</p>
<pre class="brush: xml;">

&lt;echo message=&quot;Building Target&quot;/&gt;
&lt;exec program=&quot;${MSBuild.Path}&quot;  basedir=&quot;${BaseDir}&quot;  verbose=&quot;true&quot; &gt;
&lt;arg value=&quot;${SolutionPath}&quot;  /&gt;
&lt;/exec&gt;
</pre>
<p>For most of the tasks here, I have verbose set to true, because I want as much information as possible in the log file to see if everything worked, and if it didn&#8217;t, why not.</p>
<p>After this, it calls <em>deploy</em>, which has a dependency on <em>clean</em> which does the following:</p>
<pre class="brush: xml;">
&lt;target name=&quot;clean&quot;&gt;
 &lt;exec program=&quot;${AppCmdPath}&quot;  verbose=&quot;true&quot;&gt;
 &lt;arg value=&quot;STOP apppool  &amp;quot;${ApplicationPool.Name}&amp;quot;&quot; /&gt;
 &lt;/exec&gt;
 &lt;delete verbose=&quot;true&quot;&gt;
 &lt;fileset  basedir=&quot;${DestinationDirectory}&quot;&gt;
 &lt;include name=&quot;*.*&quot;  /&gt;
 &lt;include name=&quot;**/*.*&quot; /&gt;
 &lt;/fileset&gt;
 &lt;/delete&gt;

&lt;exec program=&quot;${AppCmdPath}&quot; verbose=&quot;true&quot;&gt;
 &lt;arg  value=&quot;START apppool &amp;quot;%{ApplicationPool.Name}&amp;quot;&quot; /&gt;
 &lt;/exec&gt;
&lt;/target&gt;
</pre>
<p>The reason why we insist on shutting down and starting the application pool back up is because of MSSQL and IIS and their relationship. For some reason, if you simply recycle the application pool, it dosent stop the database that is bound to it (a user instance), so you cannot simply update the file in the App_Data folder, as I found out the hard way, which eventually led me down this path. It seems that if you want to be able to properly delete everything, you can kill the app pool, and it will unlock all the files. Because we are ussing IIS 7.5 on this box, we have to ues <em>appcmd</em> (google for it!), which is alot better than using <em>iisreset</em>, especially since I have other sites running on the box <img src='http://www.unauthorised-access.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>One thing I have considered doing, but dont really have time for, is maybe copying over an app_offline file, so that if someone does hit the site while its being wiped, they can see a friendly error page as opposed to an empty directory listing, or something worse than that, but at the moment, that is low priority for me.</p>
<p>And now, <em>deploy</em> gets called:</p>
<pre class="brush: xml;">
&lt;target name=&quot;deploy&quot; depends=&quot;clean&quot;&gt;
 &lt;copy  todir=&quot;${DestinationDirectory}&quot; verbose=&quot;true&quot;&gt;
 &lt;fileset  basedir=&quot;%{BaseDir}\Cyclemania.Web&quot;&gt;
 &lt;include name=&quot;*.*&quot;  /&gt;
 &lt;include name=&quot;**/*.*&quot; /&gt;
 &lt;exclude name=&quot;*.cs&quot; /&gt;
 &lt;exclude name=&quot;*.resx&quot; /&gt;
 &lt;exclude name=&quot;*.csproj&quot; /&gt;
 &lt;exclude  name=&quot;*.projdata&quot; /&gt;
 &lt;exclude name=&quot;*.sln&quot; /&gt;
 &lt;exclude name=&quot;*.csproj.user&quot; /&gt;
 &lt;exclude name=&quot;*.suo&quot; /&gt;
 &lt;exclude name=&quot;*.scc&quot; /&gt;
 &lt;exclude name=&quot;*.load&quot; /&gt;
 &lt;exclude  name=&quot;*.vssscc&quot; /&gt;
 &lt;exclude name=&quot;*.vspscc&quot; /&gt;
 &lt;exclude name=&quot;obj\**&quot; /&gt;
 &lt;/fileset&gt;
 &lt;/copy&gt;
&lt;/target&gt;
</pre>
<p>Notice, it will only copy files that are not on the exclude list – 99.9% those files arnt needed on a live system, but you can tweak it as required. Im looking to keep the wwwroot of the application as clean as possible, and I dont see much need to copy those files over.</p>
<p>And there you have it! With this script (and the bits that I have missed out), you should have a fully functioning build script that will automatically build it for you, wipe the target directory, and copy over the new files. And yes, it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2010/01/deployment-process-on-cyclemania/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deeploading with NetTiers</title>
		<link>http://www.unauthorised-access.com/2009/12/deeploading-with-nettiers/</link>
		<comments>http://www.unauthorised-access.com/2009/12/deeploading-with-nettiers/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 15:40:23 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[NetTiers]]></category>
		<category><![CDATA[c#.net]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=357</guid>
		<description><![CDATA[Once you get your head around the DeepLoading and Inclusive/Exclusive Lists in NetTiers, its not too hard, but it isnt straightforward to start off with. Take this VERY simplified class, as an example: class Product { public TList&#60;Product&#62; ChildrenProducts {get;set;} public Product ParentProduct {get;set;} } If you want to deepload the ChildrenProducts collection, you think [...]]]></description>
			<content:encoded><![CDATA[<p>Once you get your head around the DeepLoading and Inclusive/Exclusive Lists in NetTiers, its not too hard, but it isnt straightforward to start off with. Take this VERY simplified class, as an example:</p>
<pre class="brush: csharp;">

class Product
{
public TList&lt;Product&gt; ChildrenProducts {get;set;}
public Product ParentProduct {get;set;}
}
</pre>
<p>If you want to deepload the ChildrenProducts collection, you think youd run the following:</p>
<pre class="brush: csharp;">

DataRepository.ProductProvider.DeepLoad(product,true,DeepLoadType.IncludeChildren, new []{typeof(Product)});
</pre>
<p>But that will load the ParentProduct product, and not your ChildrenProducts collection, even though its just a list of <em>Product</em>.</p>
<p>What you want to do is:</p>
<pre class="brush: csharp;">

DataRepository.ProductProvider.DeepLoad(product,true,DeepLoadType.IncludeChildren, new []{typeof(TList&lt;Product&gt;)});
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2009/12/deeploading-with-nettiers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using NAnt 0.85 with .net 4.0</title>
		<link>http://www.unauthorised-access.com/2009/12/using-nant-0-85-with-net-4-0/</link>
		<comments>http://www.unauthorised-access.com/2009/12/using-nant-0-85-with-net-4-0/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 11:02:14 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[CycleMania]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=354</guid>
		<description><![CDATA[Im guessing because the .net 4.0 framework is still in the beta stages, that&#8217;s why NAnt (and TeamCity) arnt supporting it, but from what I can tell, mstcthe method to build it hasnt changed since .net 2.0&#8242;s msbuild way of compiling a solution.  Basically, all you need to do is call msbuild from the command [...]]]></description>
			<content:encoded><![CDATA[<p>Im guessing because the .net 4.0 framework is still in the beta stages, that&#8217;s why NAnt (and TeamCity) arnt supporting it, but from what I can tell, mstcthe method to build it hasnt changed since .net 2.0&#8242;s msbuild way of compiling a solution.  Basically, all you need to do is call msbuild from the command line, give it the path of the solution, and off it goes to build it. You can specify additional information such as the build target etc, but its not essential.</p>
<p>Whereas normally, within NAnt, you would run the following:</p>
<pre class="brush: xml;">

&lt;solution configuration=&quot;release&quot; solutionfile=&quot;test.sln&quot; /&gt;
</pre>
<p>This aparently dosent work with the .net 4.0 framework, it seems to not detect it. From what I can tell, the quickest way around this is to do the following:</p>
<pre class="brush: xml;">

&lt;exec program=&quot;c:\Windows\Microsoft.NET\Framework64\v4.0.21006\MSBuild.exe&quot; basedir=&quot;C:\SVN\CycleMania\&quot;  verbose=&quot;true&quot; &gt;
 &lt;arg value=&quot;C:\SVN\CycleMania\CycleMania.sln&quot; /&gt;
 &lt;/exec&gt;
</pre>
<p>Obviously, change the path in the <em>program</em> attribute to suit where Windows is located, and change the <em>Framework64</em> to simply <em>Framework</em> if you are not running on a 64bit platform. One quirk that I fonud is that you have to have the <em>BaseDir</em> as where the solution is based, otherwise it throws errors about it cannot build properly.</p>
<p>And that should be it! If you are still struggling to compile on the .net 4.0 framework from within Nant, give me a shout.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2009/12/using-nant-0-85-with-net-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CycleMania&#8217;s Continuous Integration</title>
		<link>http://www.unauthorised-access.com/2009/12/cyclemanias-continuous-integration/</link>
		<comments>http://www.unauthorised-access.com/2009/12/cyclemanias-continuous-integration/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 14:37:48 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[CycleMania]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=349</guid>
		<description><![CDATA[Its now public knowledge that I have been working on getting a decent CI integration for the CycleMania project working on a publicly accessable server. For the record, we are using the following tech for the CI integration. Yes, I WILL write a very detailed how-to on how I set things up, but as I [...]]]></description>
			<content:encoded><![CDATA[<p>Its now <a href="http://twitter.com/LeeDumond/status/6767942229">public knowledge</a> that I have been working on getting a decent CI integration for the <a href="http://cyclemania.codeplex.com/">CycleMania project</a> working on a publicly accessable server.</p>
<p>For the record, we are using the following tech for the CI integration. Yes, I WILL write a very detailed how-to on how I set things up, but as I am on my lunchbreak here at work, heres a very quick overview of what we are using:</p>
<ul>
<li>TeamCity 5.0 Professional, a free download from JetBrains (Limit of 20 Projects and 20 Users)</li>
<li>.Net framework 4.0 Beta 2 (obviously)</li>
<li>Nant 0.85, not as a proper build script, but purely as a glorified as a batch script</li>
<li>APPCMD command to control IIS7&#8242;s App recycling (From inside Nant)</li>
<li>.Net 4.0&#8242;s MSBuild</li>
</ul>
<p>All this running ontop of Windows 2008 R2 Web Edition, and SQL Server 2008 Express.</p>
<p>Things I have learned is:</p>
<ul>
<li>TeamCity 5.0 isnt geared up for .net 4.0 YET, which is fair enough, they said support will be included in 5.1</li>
<li>TeamCity also seems to be simply geared for building projects and running unit tests, less so for copying files over to another directory with specific paths etc.</li>
<li>Nant&#8217;s contrib project is crap. Fair enough last time it was updated was 3 years ago, but it dosent work.</li>
<li>You cannot simply recycle an app pool to kill a user instance of SQL Server 2008, to update the .mdf file.</li>
<li>You really shouldnt run a site from the same directory as SVN, if you plan to update it (re above)</li>
<li>Nant is all good and well, but also dosent support .net 4.0.</li>
</ul>
<p>I promise I will expand on most of these points when I have time!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2009/12/cyclemanias-continuous-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Output all properties for any object</title>
		<link>http://www.unauthorised-access.com/2009/07/output-all-properties-for-any-object/</link>
		<comments>http://www.unauthorised-access.com/2009/07/output-all-properties-for-any-object/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 08:51:07 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[Code Snippet]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[Code Sample]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=325</guid>
		<description><![CDATA[private void outputValues(object inputObject) { List&#60;PropertyInfo&#62; propertyInfos = new List&#60;PropertyInfo&#62;(inputObject.GetType().GetProperties()); foreach (PropertyInfo info in propertyInfos) { try { object obj = info.GetValue(inputObject, null); if (obj == null) { continue; } Console.WriteLine(&#34;[{0}]:{1}&#34;, info.Name, obj.ToString()); } catch (Exception) { continue; } } } Replace the Console.WriteLine with whatever you want, log4net,  Debug, trace, etc, and it works!]]></description>
			<content:encoded><![CDATA[<pre class="brush: csharp;">

private void outputValues(object inputObject)
{
List&lt;PropertyInfo&gt; propertyInfos = new List&lt;PropertyInfo&gt;(inputObject.GetType().GetProperties());

foreach (PropertyInfo info in propertyInfos)
{
try
{
object obj = info.GetValue(inputObject, null);
if (obj == null)
{
continue;
}
Console.WriteLine(&quot;[{0}]:{1}&quot;, info.Name, obj.ToString());

}
catch (Exception)
{
continue;
}

}

}
</pre>
<p>Replace the Console.WriteLine with whatever you want, log4net,  Debug, trace, etc, and it works!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2009/07/output-all-properties-for-any-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LAB: Image Detection, Part 3</title>
		<link>http://www.unauthorised-access.com/2009/05/lab-image-detection-part-3/</link>
		<comments>http://www.unauthorised-access.com/2009/05/lab-image-detection-part-3/#comments</comments>
		<pubDate>Fri, 08 May 2009 00:19:47 +0000</pubDate>
		<dc:creator>Monty</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[R&D Lab]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c#.net]]></category>
		<category><![CDATA[R&D]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.unauthorised-access.com/?p=263</guid>
		<description><![CDATA[After writing some comparison code, we have the following output, thanks to log4net (I love log4net): Source Target . X:79 Y:156 W:17 H:23 X:73 Y:149 W:17 H:23 . X:337 Y:176 W:27 H:50 X:331 Y:169 W:27 H:49 . X:158 Y:249 W:32 H:31 X:152 Y:242 W:32 H:32 . X:446 Y:286 W:28 H:32 X:440 Y:279 W:27 H:32 . [...]]]></description>
			<content:encoded><![CDATA[<p>After writing some comparison code, we have the following output, thanks to log4net (I love log4net):</p>
<p><a href="http://www.unauthorised-access.com/wp-content/uploads/2009/05/output-3.jpg"><img class="alignnone size-thumbnail wp-image-265" title="output-3" src="http://www.unauthorised-access.com/wp-content/uploads/2009/05/output-3-150x150.jpg" alt="output-3" width="150" height="150" /></a></p>
<table id="tblMain_0" class="tblGenFixed" style="height: 220px;" border="0" cellspacing="0" cellpadding="0" width="493">
<tbody>
<tr>
<td class="s0"><cite><strong>Source</strong></cite></td>
<td class="s1"><cite><br />
</cite></td>
<td class="s1"><cite><br />
</cite></td>
<td class="s1"><cite><br />
</cite></td>
<td class="s2"><cite></cite></td>
<td class="s1"><cite><strong>Target</strong></cite></td>
<td class="s1"><cite><br />
</cite></td>
<td class="s1"><cite><br />
</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:79</cite></td>
<td class="s4"><cite>Y:156</cite></td>
<td class="s4"><cite>W:17</cite></td>
<td class="s4"><cite>H:23</cite></td>
<td class="s4"><cite>X:73</cite></td>
<td class="s4"><cite>Y:149</cite></td>
<td class="s4"><cite>W:17</cite></td>
<td class="s4"><cite>H:23</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:337</cite></td>
<td class="s4"><cite>Y:176</cite></td>
<td class="s4"><cite>W:27</cite></td>
<td class="s4"><cite>H:50</cite></td>
<td class="s4"><cite>X:331</cite></td>
<td class="s4"><cite>Y:169</cite></td>
<td class="s4"><cite>W:27</cite></td>
<td class="s4"><cite>H:49</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:158</cite></td>
<td class="s4"><cite>Y:249</cite></td>
<td class="s4"><cite>W:32</cite></td>
<td class="s4"><cite>H:31</cite></td>
<td class="s4"><cite>X:152</cite></td>
<td class="s4"><cite>Y:242</cite></td>
<td class="s4"><cite>W:32</cite></td>
<td class="s4"><cite>H:32</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:446</cite></td>
<td class="s4"><cite>Y:286</cite></td>
<td class="s4"><cite>W:28</cite></td>
<td class="s4"><cite>H:32</cite></td>
<td class="s4"><cite>X:440</cite></td>
<td class="s4"><cite>Y:279</cite></td>
<td class="s4"><cite>W:27</cite></td>
<td class="s4"><cite>H:32</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:398</cite></td>
<td class="s4"><cite>Y:339</cite></td>
<td class="s4"><cite>W:18</cite></td>
<td class="s4"><cite>H:26</cite></td>
<td class="s4"><cite>X:392</cite></td>
<td class="s4"><cite>Y:334</cite></td>
<td class="s4"><cite>W:16</cite></td>
<td class="s4"><cite>H:24</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:244</cite></td>
<td class="s4"><cite>Y:349</cite></td>
<td class="s4"><cite>W:47</cite></td>
<td class="s4"><cite>H:52</cite></td>
<td class="s4"><cite>X:238</cite></td>
<td class="s4"><cite>Y:342</cite></td>
<td class="s4"><cite>W:47</cite></td>
<td class="s4"><cite>H:52</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:38</cite></td>
<td class="s4"><cite>Y:374</cite></td>
<td class="s4"><cite>W:16</cite></td>
<td class="s4"><cite>H:15</cite></td>
<td class="s4"><cite>X:31</cite></td>
<td class="s4"><cite>Y:366</cite></td>
<td class="s4"><cite>W:17</cite></td>
<td class="s4"><cite>H:16</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:34</cite></td>
<td class="s4"><cite>Y:388</cite></td>
<td class="s4"><cite>W:16</cite></td>
<td class="s4"><cite>H:17</cite></td>
<td class="s4"><cite>X:148</cite></td>
<td class="s4"><cite>Y:423</cite></td>
<td class="s4"><cite>W:27</cite></td>
<td class="s4"><cite>H:24</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:154</cite></td>
<td class="s4"><cite>Y:430</cite></td>
<td class="s4"><cite>W:27</cite></td>
<td class="s4"><cite>H:24</cite></td>
<td class="s4"><cite>X:459</cite></td>
<td class="s4"><cite>Y:435</cite></td>
<td class="s4"><cite>W:24</cite></td>
<td class="s4"><cite>H:22</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:465</cite></td>
<td class="s4"><cite>Y:442</cite></td>
<td class="s4"><cite>W:25</cite></td>
<td class="s4"><cite>H:22</cite></td>
<td class="s4"><cite>X:119</cite></td>
<td class="s4"><cite>Y:450</cite></td>
<td class="s4"><cite>W:30</cite></td>
<td class="s4"><cite>H:46</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:126</cite></td>
<td class="s4"><cite>Y:457</cite></td>
<td class="s4"><cite>W:29</cite></td>
<td class="s4"><cite>H:46</cite></td>
<td class="s4"><cite>X:221</cite></td>
<td class="s4"><cite>Y:465</cite></td>
<td class="s4"><cite>W:17</cite></td>
<td class="s4"><cite>H:19</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:227</cite></td>
<td class="s4"><cite>Y:472</cite></td>
<td class="s4"><cite>W:17</cite></td>
<td class="s4"><cite>H:19</cite></td>
<td class="s4"><cite>X:250</cite></td>
<td class="s4"><cite>Y:594</cite></td>
<td class="s4"><cite>W:17</cite></td>
<td class="s4"><cite>H:18</cite></td>
</tr>
<tr>
<td class="hd">
<p style="height: 16px;"><cite>.</cite></p>
</td>
<td class="s3"><cite>X:256</cite></td>
<td class="s4"><cite>Y:601</cite></td>
<td class="s4"><cite>W:17</cite></td>
<td class="s4"><cite>H:18</cite></td>
<td><cite><br />
</cite></td>
<td><cite><br />
</cite></td>
<td><cite><br />
</cite></td>
</tr>
</tbody>
</table>
<p><cite><br />
Comparison<br />
S[X: 79, Y: 156, Width: 17, Height: 23] matched to T[X: 73, Y: 149, Width: 17, Height: 23]<br />
S[X: 158, Y: 249, Width: 32, Height: 31] matched to T[X: 152, Y: 242, Width: 32, Height: 32]<br />
S[X: 398, Y: 339, Width: 18, Height: 26] matched to T[X: 392, Y: 334, Width: 16, Height: 24]<br />
S[X: 38, Y: 374, Width: 16, Height: 15] matched to T[X: 31, Y: 366, Width: 17, Height: 16]<br />
S[X: 154, Y: 430, Width: 27, Height: 24] matched to T[X: 392, Y: 334, Width: 16, Height: 24]<br />
S[X: 126, Y: 457, Width: 29, Height: 46] matched to T[X: 31, Y: 366, Width: 17, Height: 16]<br />
S[X: 256, Y: 601, Width: 17, Height: 18] matched to T[X: 31, Y: 366, Width: 17, Height: 16]<br />
Non matched<br />
S[X: 34, Y: 388, Width: 16, Height: 17]<br />
S[X: 154, Y: 430, Width: 27, Height: 24]<br />
S[X: 465, Y: 442, Width: 25, Height: 22]<br />
S[X: 126, Y: 457, Width: 29, Height: 46]<br />
S[X: 227, Y: 472, Width: 17, Height: 19]<br />
S[X: 256, Y: 601, Width: 17, Height: 18]<br />
T[X: 148, Y: 423, Width: 27, Height: 24]<br />
T[X: 459, Y: 435, Width: 24, Height: 22]<br />
T[X: 119, Y: 450, Width: 30, Height: 46]<br />
T[X: 221, Y: 465, Width: 17, Height: 19]<br />
T[X: 250, Y: 594, Width: 17, Height: 18]<br />
</cite></p>
<p>I know its not perfect, I know its only matching about 50% of the blobs, but im working on it. I have a plan up my sleeve for this <img src='http://www.unauthorised-access.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.unauthorised-access.com/2009/05/lab-image-detection-part-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
