<?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/"
	>

<channel>
	<title>Knowledge Base - .NET, C#, SQL Server 2005, PHP and Actionscript 2.0 / 3.0 etc</title>
	<atom:link href="http://knowledge.jamiehinton.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://knowledge.jamiehinton.co.uk</link>
	<description>Everthing I have found that might be useful in .NET, C#, SQL Server 2005, PHP and Actionscript 2.0 / 3.0 etc</description>
	<pubDate>Thu, 29 Jul 2010 17:53:43 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A potentially dangerous Request - MVC 1 / 2 - .NET 4</title>
		<link>http://knowledge.jamiehinton.co.uk/a-potentially-dangerous-request-mvc-1-2-net-4/</link>
		<comments>http://knowledge.jamiehinton.co.uk/a-potentially-dangerous-request-mvc-1-2-net-4/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 17:51:27 +0000</pubDate>
		<dc:creator>Jimbob</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[.NET 4]]></category>

		<guid isPermaLink="false">http://knowledge.jamiehinton.co.uk/?p=660</guid>
		<description><![CDATA[If you are running MVC 1/2 and have just upgraded to .NET 4 you may probably see this error:
A potentially dangerous Request.Form value was detected from the client
even in you have the attribute of
[ ValidateInput( false ) ]
set. This is due to some breaking changes in .NET 4. See this article for more details.
Basically all [...]]]></description>
			<content:encoded><![CDATA[<p>If you are running MVC 1/2 and have just upgraded to .NET 4 you may probably see this error:</p>
<pre>A potentially dangerous Request.Form value was detected from the client</pre>
<p>even in you have the attribute of</p>
<pre>[ ValidateInput( false ) ]</pre>
<p>set. This is due to some breaking changes in .NET 4. <a href="http://www.asp.net/learn/whitepapers/aspnet4/breaking-changes#_TOC4" target="_blank">See this article</a> for more details.</p>
<p>Basically all yo have to do is open your Web.config and add:</p>
<pre>&lt;httpRuntime requestValidationMode="2.0" /&gt;</pre>
<p>Inside the</p>
<pre>&lt;system.web&gt;</pre>
<p>section.</p>
<p>That is it and you are fixed. (you still need the</p>
<pre>[ ValidateInput( false ) ]</pre>
<p>attribute - it just makes it process as it was before ;))</p>
]]></content:encoded>
			<wfw:commentRss>http://knowledge.jamiehinton.co.uk/a-potentially-dangerous-request-mvc-1-2-net-4/feed/</wfw:commentRss>
		</item>
		<item>
		<title>using nunit to run tests built in .NET 4</title>
		<link>http://knowledge.jamiehinton.co.uk/using-nunit-to-run-tests-built-in-net-4/</link>
		<comments>http://knowledge.jamiehinton.co.uk/using-nunit-to-run-tests-built-in-net-4/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 14:41:46 +0000</pubDate>
		<dc:creator>Jimbob</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[NUnit]]></category>

		<guid isPermaLink="false">http://knowledge.jamiehinton.co.uk/?p=658</guid>
		<description><![CDATA[This almost caught me out so I thought that I would share what I found. By Default NUnit will not run tests from an assembly that has been built against v4 of the CLR.
You can however tell it you want it to by adding a few lines to the config files. So to fix it [...]]]></description>
			<content:encoded><![CDATA[<p>This almost caught me out so I thought that I would share what I found. By Default NUnit will not run tests from an assembly that has been built against v4 of the CLR.</p>
<p>You can however tell it you want it to by adding a few lines to the config files. So to fix it all you have to do is open the nunit.exe.config file and add the following:</p>
<pre>&lt;startup&gt;

&lt;requiredRuntime version="v4.0.20506" /&gt;

&lt;/startup&gt;</pre>
<p>Just inside &lt;configuration&gt;</p>
<p>and then add</p>
<pre>&lt;loadFromRemoteSources enabled="true" /&gt;</pre>
<p>just after &lt;runtime&gt;</p>
<p>Now if you are like me and are just using the nunit console to run tests with rake then you have to do the same as above in the nunit-console.exe.config</p>
<p>Simples!</p>
]]></content:encoded>
			<wfw:commentRss>http://knowledge.jamiehinton.co.uk/using-nunit-to-run-tests-built-in-net-4/feed/</wfw:commentRss>
		</item>
		<item>
		<title>A couple of useful libraries</title>
		<link>http://knowledge.jamiehinton.co.uk/a-couple-of-useful-libraries/</link>
		<comments>http://knowledge.jamiehinton.co.uk/a-couple-of-useful-libraries/#comments</comments>
		<pubDate>Tue, 11 May 2010 07:55:48 +0000</pubDate>
		<dc:creator>Jimbob</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://knowledge.jamiehinton.co.uk/?p=656</guid>
		<description><![CDATA[http://fbasync.codeplex.com/
http://hammock.codeplex.com/
http://tweetsharp.codeplex.com/
]]></description>
			<content:encoded><![CDATA[<p><a href="http://fbasync.codeplex.com/" target="_blank">http://fbasync.codeplex.com/</a></p>
<p><a href="http://hammock.codeplex.com/" target="_blank">http://hammock.codeplex.com/</a></p>
<p><a href="http://tweetsharp.codeplex.com/" target="_blank">http://tweetsharp.codeplex.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://knowledge.jamiehinton.co.uk/a-couple-of-useful-libraries/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rendering spark view templates</title>
		<link>http://knowledge.jamiehinton.co.uk/rendering-spark-view-templates/</link>
		<comments>http://knowledge.jamiehinton.co.uk/rendering-spark-view-templates/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 09:53:50 +0000</pubDate>
		<dc:creator>Jimbob</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[Spark View Engine]]></category>

		<guid isPermaLink="false">http://knowledge.jamiehinton.co.uk/?p=653</guid>
		<description><![CDATA[http://blog.edwardsdigital.com/category/Spark-View-Engine.aspx
]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.edwardsdigital.com/category/Spark-View-Engine.aspx">http://blog.edwardsdigital.com/category/Spark-View-Engine.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://knowledge.jamiehinton.co.uk/rendering-spark-view-templates/feed/</wfw:commentRss>
		</item>
		<item>
		<title>NHibernate, Castle IOC and MVC.NET 2 running in medium trust on shared hosting</title>
		<link>http://knowledge.jamiehinton.co.uk/nhibernate-castle-ioc-and-mvcnet-2-running-in-medium-trust-on-shared-hosting/</link>
		<comments>http://knowledge.jamiehinton.co.uk/nhibernate-castle-ioc-and-mvcnet-2-running-in-medium-trust-on-shared-hosting/#comments</comments>
		<pubDate>Sat, 28 Nov 2009 21:29:12 +0000</pubDate>
		<dc:creator>Jimbob</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[Castle]]></category>

		<category><![CDATA[IIS]]></category>

		<category><![CDATA[MVC.NET]]></category>

		<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://knowledge.jamiehinton.co.uk/?p=645</guid>
		<description><![CDATA[This has caused me a lot of pain today so I thought that I would share my findings!
If you intend to publish your site to shared hosting and they are restricting you to a Medium trust security policy (which is expected really on shared hosting) you need to have assemblies that work properly!
After finding the [...]]]></description>
			<content:encoded><![CDATA[<p>This has caused me a lot of pain today so I thought that I would share my findings!</p>
<p>If you intend to publish your site to shared hosting and they are restricting you to a Medium trust security policy (which is expected really on shared hosting) you need to have assemblies that work properly!</p>
<p>After finding the issue the first thing I did was to get a dev environment that replicated the problem. The easiest way to do this is to set the trust level in the web.config. You can do this by adding this within the system.web  element:</p>
<p>&lt;system.web&gt;<br />
&lt;trust level=&#8221;Medium&#8221;/&gt;</p>
<p>&#8230;other tastey elements&#8230;..</p>
<p>&lt;/system.web&gt;</p>
<p>In the future I will set this before I start programming anything - probably good practice when you know you will be deploying to a medium trust environment but I will put that down to a lesson learnt!</p>
<p>After that you need to build Castle from source with a few additional parameters to make it run in medium trust. To do this you need to check it out from SVN. I had a few problems here too with SVN externals. I ended up getting the latest version of tortoise and checking it out on a Windows 7 VM I had running.<br />
Check it out from here: http://svn.castleproject.org:8080/svn/castle/trunk/</p>
<p>Once fully checked out, open a cmd promt and navigate to the the root of the checked out directory. run this command:<br />
build.cmd -D:assembly.allow-partially-trusted-callers=true release quick build</p>
<p>Watch the window for any errors and please read the error messages if you get any. I got one in relation to not having the .NET 2.0 SDK installed, so guess what - I installed it and tried again and it worked!</p>
<p>OK great now we have some assemblies that will run under medium trust. Copy these over the old versions and make sure you perform a clean build. Thats Castle sorted right? WRONG! It still won&#8217;t work.</p>
<p>I then had an issue with Castle.Service.Transations. Read this for more information (http://stackoverflow.com/questions/1038914/using-castle-windsor-and-the-nhibernate-facility-on-shared-hosting). OK no probs got that sorted by registering it in my container:</p>
<p><code>container.Register(Component<br />
.For(typeof (IActivityManager))<br />
.ImplementedBy(typeof (TLSActivityManager)));</code></p>
<p>OK we are still not there - a couple more things to do in the web.config. You need to add the requirePermission=&#8221;false&#8221; attribute the the castel section:</p>
<p>&lt;section name=&#8221;castle&#8221; requirePermission=&#8221;false&#8221; type=&#8221;Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor&#8221;/&gt;</p>
<p>I also disabled the NHibernate reflection optimiser:</p>
<p>&lt;item key=&#8221;reflection-optimizer&#8221;&gt;false&lt;/item&gt;</p>
<p>OK almost there - the app will now run. Next was the problem of URL&#8217;s and the fact I was not allowed a wild card mapping - fine - no probs, lets update the routing. I changed my routing to the following:</p>
<p><code>routes.MapRoute(<br />
"Default",<br />
"{controller}.aspx/{action}/{id}",<br />
new {controller = "Home", action = "Index", id = ""},<br />
new[] {&#8221;ANAMESPACE.Core.Controllers&#8221;});</code></p>
<p>Yay! That works! There is only one more problem. If I go to / then it can&#8217;t find a route regardless of the default file settings. So a bit of a workaround was to add another route after the usual default:</p>
<p><code>routes.MapRoute(<br />
"",<br />
new { controller = "Home", action = "Index", id = "" },<br />
new[] { &#8220;ANAMESPACE.Core.Controllers&#8221; });</code></p>
<p>This feels very wrong and I don&#8217;t like it! There must be a better way.</p>
<p>Anyway - screw you shared hosting and medium trust!</p>
]]></content:encoded>
			<wfw:commentRss>http://knowledge.jamiehinton.co.uk/nhibernate-castle-ioc-and-mvcnet-2-running-in-medium-trust-on-shared-hosting/feed/</wfw:commentRss>
		</item>
		<item>
		<title>hard status for screen - me like screen!</title>
		<link>http://knowledge.jamiehinton.co.uk/hard-status-for-screen-me-like-screen/</link>
		<comments>http://knowledge.jamiehinton.co.uk/hard-status-for-screen-me-like-screen/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 14:57:57 +0000</pubDate>
		<dc:creator>Jimbob</dc:creator>
		
		<category><![CDATA[Unix]]></category>

		<guid isPermaLink="false">http://knowledge.jamiehinton.co.uk/?p=638</guid>
		<description><![CDATA[Thanks to Martin Gleadow:

stick this in your ~/.screenrc and smoke it
escape ^gg
hardstatus alwayslastline "%{=b}%{kG}&#124;g&#124; %H &#124; %t &#124;%{kb} %w %=%{G}&#124; %C%A"
the first line turns Ctrl-G into your attention character
the second line makes the following appear at the bottom of your screen:
&#124;g&#124; $server &#124; $current_window &#124; 0* $windowname ...  n $windowname     [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to Martin Gleadow:<br />
<code><br />
stick this in your ~/.screenrc and smoke it</p>
<p>escape ^gg<br />
hardstatus alwayslastline "%{=b}%{kG}|g| %H | %t |%{kb} %w %=%{G}| %C%A"</p>
<p>the first line turns Ctrl-G into your attention character<br />
the second line makes the following appear at the bottom of your screen:</p>
<p>|g| $server | $current_window | 0* $windowname ...  n $windowname     |  hh:mm<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://knowledge.jamiehinton.co.uk/hard-status-for-screen-me-like-screen/feed/</wfw:commentRss>
		</item>
		<item>
		<title>useful tool for windows when you have lots of &#8216;windows&#8217; open</title>
		<link>http://knowledge.jamiehinton.co.uk/useful-tool-for-windows-when-you-have-lots-of-windows-open/</link>
		<comments>http://knowledge.jamiehinton.co.uk/useful-tool-for-windows-when-you-have-lots-of-windows-open/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 15:07:16 +0000</pubDate>
		<dc:creator>Jimbob</dc:creator>
		
		<category><![CDATA[Windows'y stuff]]></category>

		<guid isPermaLink="false">http://knowledge.jamiehinton.co.uk/?p=636</guid>
		<description><![CDATA[WinSplit Revolution is a small utility which allows you to easily organize your open windows by tiling, resizing and positioning them to make the best use of your desktop real estate.
http://www.winsplit-revolution.com/
]]></description>
			<content:encoded><![CDATA[<p>WinSplit Revolution is a small utility which allows you to easily organize your open windows by tiling, resizing and positioning them to make the best use of your desktop real estate.</p>
<p><a href="http://www.winsplit-revolution.com/" target="_blank">http://www.winsplit-revolution.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://knowledge.jamiehinton.co.uk/useful-tool-for-windows-when-you-have-lots-of-windows-open/feed/</wfw:commentRss>
		</item>
		<item>
		<title>piping in a file to SQL Server 2005 on the command line</title>
		<link>http://knowledge.jamiehinton.co.uk/piping-in-a-file-to-sql-server-2005-on-the-command-line/</link>
		<comments>http://knowledge.jamiehinton.co.uk/piping-in-a-file-to-sql-server-2005-on-the-command-line/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 12:15:30 +0000</pubDate>
		<dc:creator>Jimbob</dc:creator>
		
		<category><![CDATA[SQL Server]]></category>

		<category><![CDATA[SQL Server 2005]]></category>

		<guid isPermaLink="false">http://knowledge.jamiehinton.co.uk/?p=627</guid>
		<description><![CDATA[This makes managing SQL server so much easier - especially when you have a HUGE sql file to run and enterprise manager won&#8217;t even open it for you!
SQLCMD/? will give you all the options available.
An example of piping in a file to a defined instance using a a username and password:
SQLCMD -S localhost\SQLSERVER2005 -U username [...]]]></description>
			<content:encoded><![CDATA[<p>This makes managing SQL server so much easier - especially when you have a HUGE sql file to run and enterprise manager won&#8217;t even open it for you!</p>
<p>SQLCMD/? will give you all the options available.</p>
<p>An example of piping in a file to a defined instance using a a username and password:</p>
<p>SQLCMD -S localhost\SQLSERVER2005 -U username -P password -i sql-file-to-run.sql</p>
<p>easy peasy! Just make sure the user you are logging in as has all of the permissions required to perform all of the actions in the sql file! (watch the console output!)</p>
]]></content:encoded>
			<wfw:commentRss>http://knowledge.jamiehinton.co.uk/piping-in-a-file-to-sql-server-2005-on-the-command-line/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Testing IE gets a little easier</title>
		<link>http://knowledge.jamiehinton.co.uk/testing-ie-gets-a-little-easier/</link>
		<comments>http://knowledge.jamiehinton.co.uk/testing-ie-gets-a-little-easier/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 11:40:46 +0000</pubDate>
		<dc:creator>Jimbob</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://knowledge.jamiehinton.co.uk/?p=614</guid>
		<description><![CDATA[http://www.my-debugbar.com/wiki/IETester/HomePage
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.my-debugbar.com/wiki/IETester/HomePage" target="_blank">http://www.my-debugbar.com/wiki/IETester/HomePage</a></p>
]]></content:encoded>
			<wfw:commentRss>http://knowledge.jamiehinton.co.uk/testing-ie-gets-a-little-easier/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Castle ISessionFactory can be resolved outside of a web request</title>
		<link>http://knowledge.jamiehinton.co.uk/castle-isessionfactory-can-be-resolved-outside-of-a-web-request/</link>
		<comments>http://knowledge.jamiehinton.co.uk/castle-isessionfactory-can-be-resolved-outside-of-a-web-request/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 20:42:55 +0000</pubDate>
		<dc:creator>Jimbob</dc:creator>
		
		<category><![CDATA[.NET]]></category>

		<category><![CDATA[Castle]]></category>

		<guid isPermaLink="false">http://knowledge.jamiehinton.co.uk/?p=625</guid>
		<description><![CDATA[I found this very useful today. I have a Quatz Job running that requires access to a repository. This repository is usually resolved by castle like so:

var repository = Registry.Get&#60;MyRepository&#62;();

In the case I have I cannot do this as &#8216;MyRepository&#8217; depends on having an ISessionManger injecting into it but in this context one does not [...]]]></description>
			<content:encoded><![CDATA[<p>I found this very useful today. I have a Quatz Job running that requires access to a repository. This repository is usually resolved by castle like so:<br />
<code><br />
var repository = Registry.Get&lt;MyRepository&gt;();<br />
</code><br />
In the case I have I cannot do this as &#8216;MyRepository&#8217; depends on having an ISessionManger injecting into it but in this context one does not exists. What I found out though (thanks to Thom) was that I can simply ask the container for an ISessionFactory like so:<br />
<code><br />
var sessionFactory = Registry.Get&lt;ISessionFactory&gt;();<br />
</code><br />
Now I can create a class that implements ISessionManager and instantiate my repository with this - top stuff!</p>
<p>Now I have found this I will be changing how my integration tests work!</p>
]]></content:encoded>
			<wfw:commentRss>http://knowledge.jamiehinton.co.uk/castle-isessionfactory-can-be-resolved-outside-of-a-web-request/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
