<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.2" -->
<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/"
	>

<channel>
	<title>cmb-web.co.uk</title>
	<link>http://www.cmb-web.co.uk</link>
	<description></description>
	<pubDate>Sat, 07 May 2011 15:18:52 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>
	<language>en</language>
			<item>
		<title>Using NuGet with Ninject MVC3</title>
		<link>http://www.cmb-web.co.uk/index.php/2011/05/using-nuget-with-ninject-mvc3/</link>
		<comments>http://www.cmb-web.co.uk/index.php/2011/05/using-nuget-with-ninject-mvc3/#comments</comments>
		<pubDate>Sat, 07 May 2011 15:17:01 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.cmb-web.co.uk/index.php/2011/05/using-nuget-with-ninject-mvc3/</guid>
		<description><![CDATA[If you have not used NuGet yet I strongly recommend you have a look.  It&#8217;s a Visual Studio extension that simply takes the hassle out of having to download, install, reference etc. libraries and third party tools.  It will automatically update everything for you in your project.  Have a look here http://www.nuget.org.
Now I&#8217;m a fan [...]]]></description>
			<content:encoded><![CDATA[<p>If you have not used NuGet yet I strongly recommend you have a look.  It&#8217;s a Visual Studio extension that simply takes the hassle out of having to download, install, reference etc. libraries and third party tools.  It will automatically update everything for you in your project.  Have a look here <a href="http://www.nuget.org/" target="_new">http://www.nuget.org</a>.</p>
<p>Now I&#8217;m a fan of Ninject (<a href="http://ninject.org" target="_new">http://ninject.org</a>) an inversion of control dependency injection container, and a fan of ASP.NET MVC (<a href="http://asp.net" target="_new">http://asp.net</a>), so in order to use Ninject and MVC 3 you can use NuGet to setup it for you.</p>
<p>To do this run the following package install command in the Package Installer:</p>
<p><code>install-package ninject.mvc3</code></p>
<p>What&#8217;s really neat about NuGet is that it will also install any dependencies, so in this case will also install Ninject itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmb-web.co.uk/index.php/2011/05/using-nuget-with-ninject-mvc3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Error finding &#8216;log4net&#8217; library</title>
		<link>http://www.cmb-web.co.uk/index.php/2011/02/error-finding-log4net-library/</link>
		<comments>http://www.cmb-web.co.uk/index.php/2011/02/error-finding-log4net-library/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 20:08:10 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.cmb-web.co.uk/index.php/2011/02/error-finding-log4net-library/</guid>
		<description><![CDATA[When using log4net in a .NET 4 project, when you compile the project you can get an error saying that it cannot find &#8216;log4net&#8217; or ILog.
The solution seems to be that the framework for the project is set to &#8216;.NET Framework 4 Client Profile&#8217;, while what it needs is &#8216;.NET Framework 4&#8242;.  You can change [...]]]></description>
			<content:encoded><![CDATA[<p>When using <a href="http://http://logging.apache.org/log4net/" title="log4net" target="_blank">log4net</a> in a .NET 4 project, when you compile the project you can get an error saying that it cannot find &#8216;log4net&#8217; or <code>ILog</code>.</p>
<p>The solution seems to be that the framework for the project is set to &#8216;.NET Framework 4 Client Profile&#8217;, while what it needs is &#8216;.NET Framework 4&#8242;.  You can change this in the project properties page.</p>
<p>It seems to be something to do with <code>System.Web</code>, but haven&#8217;t narrowed it down more than that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmb-web.co.uk/index.php/2011/02/error-finding-log4net-library/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Multiple startup projects in Visual Studio 2010</title>
		<link>http://www.cmb-web.co.uk/index.php/2011/02/multiple-startup-projects-in-visual-studio-2010/</link>
		<comments>http://www.cmb-web.co.uk/index.php/2011/02/multiple-startup-projects-in-visual-studio-2010/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 20:07:32 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.cmb-web.co.uk/index.php/2011/02/multiple-startup-projects-in-visual-studio-2010/</guid>
		<description><![CDATA[If you want to debug more than one of the projects in your solution in Visual Studio 2010, you can set multiple startup projects.  Obviously this does not apply to projects such as class libraries, which will be loaded as per your single startup project, but if you have if you have multiple independent projects, [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to debug more than one of the projects in your solution in Visual Studio 2010, you can set multiple startup projects.  Obviously this does not apply to projects such as class libraries, which will be loaded as per your single startup project, but if you have if you have multiple independent projects, say a WPF project and a web service project, then this can be useful.</p>
<p>The option is  available from the right-click menu on the Solution:</p>
<p><img src="http://www.cmb-web.co.uk/wp-content/uploads/2011/02/setstartup.png" alt="setstartup.png" /></p>
<p>Which opens a dialogue allowing you to pick which projects to start:</p>
<p><img src="http://www.cmb-web.co.uk/wp-content/uploads/2011/02/multipleprojects.PNG" alt="multipleprojects.PNG" width="80%" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmb-web.co.uk/index.php/2011/02/multiple-startup-projects-in-visual-studio-2010/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Could not load file or assembly or one of its dependencies. An attempt was made to load a program with an incorrect format.</title>
		<link>http://www.cmb-web.co.uk/index.php/2011/02/could-not-load-file-or-assembly-or-one-of-its-dependencies-an-attempt-was-made-to-load-a-program-with-an-incorrect-format/</link>
		<comments>http://www.cmb-web.co.uk/index.php/2011/02/could-not-load-file-or-assembly-or-one-of-its-dependencies-an-attempt-was-made-to-load-a-program-with-an-incorrect-format/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 07:00:35 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.cmb-web.co.uk/index.php/2011/02/could-not-load-file-or-assembly-or-one-of-its-dependencies-an-attempt-was-made-to-load-a-program-with-an-incorrect-format/</guid>
		<description><![CDATA[When running a web application on Windows 64-bit you may receive the following the error message:
'Could not load file or assembly xxxxxx or one of its dependencies. An attempt was made to load a program with an incorrect format.'
The reason for this is the Appliction Pool in IIS is not allowing 32-bit application to run.
You can [...]]]></description>
			<content:encoded><![CDATA[<p>When running a web application on Windows 64-bit you may receive the following the error message:</p>
<p><code>'Could not load file or assembly xxxxxx or one of its dependencies. An attempt was made to load a program with an incorrect format.'</code></p>
<p>The reason for this is the Appliction Pool in IIS is not allowing 32-bit application to run.</p>
<p>You can fix this in IIS Manager by selecting the Application Pool and opening the Advanced Settings dialogue, link on the right of the IIS Manager:</p>
<p><img src="http://www.cmb-web.co.uk/wp-content/uploads/2011/02/advancedsettings.PNG" alt="advancedsettings.PNG" /></p>
<p> You can then toggle the option for 32-bit applications:</p>
<p><img src="http://www.cmb-web.co.uk/wp-content/uploads/2011/02/settings.PNG" alt="settings.PNG" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmb-web.co.uk/index.php/2011/02/could-not-load-file-or-assembly-or-one-of-its-dependencies-an-attempt-was-made-to-load-a-program-with-an-incorrect-format/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Formatting text directly in XAML</title>
		<link>http://www.cmb-web.co.uk/index.php/2010/08/formatting-text-directly-in-xaml/</link>
		<comments>http://www.cmb-web.co.uk/index.php/2010/08/formatting-text-directly-in-xaml/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 11:00:48 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.cmb-web.co.uk/index.php/2010/08/formatting-text-directly-in-xaml/</guid>
		<description><![CDATA[You can format text strings directly in the XAML code of a WPF application.
For example, you can use standard .NET formatting such as currency and date:
&#60;TextBlock Text="{Binding Amount, StringFormat={}{0:C}}"/&#62;
&#60;TextBlock Text="{Binding Date, StringFormat={}{0:dd/MM/yyyy}}"/&#62;
The empty {} after the StringFormat= escapes the text before the formatting string.
You can add text in front of the formatting string too, e.g.
StringFormat=Amount: [...]]]></description>
			<content:encoded><![CDATA[<p>You can format text strings directly in the XAML code of a WPF application.</p>
<p>For example, you can use standard .NET formatting such as currency and date:</p>
<p><code>&lt;TextBlock Text="{Binding Amount, StringFormat={}{0:C}}"/&gt;</code><br />
<code>&lt;TextBlock Text="{Binding Date, StringFormat={}{0:dd/MM/yyyy}}"/&gt;</code></p>
<p>The empty <em>{}</em> after the <code>StringFormat=</code> escapes the text before the formatting string.</p>
<p>You can add text in front of the formatting string too, e.g.<br />
<code>StringFormat=Amount: {0:C}</code><br />
in which case you don&#8217;t need to escape the string with the <em>{}</em>.</p>
<p>More advanced formatting options can be acheived using a multi-binding, for example:</p>
<p><code>&lt;TextBlock&gt;</code><br />
<code>  &lt;TextBlock.Text&gt;</code><br />
<code>    &lt;MultiBinding StringFormat="Date {0} Time {1}"&gt;</code><br />
<code>      &lt;Binding Path="DueDate" /&gt;</code><br />
<code>      &lt;Binding Path="DueTime" /&gt;</code><br />
<code>    &lt;/MultiBinding&gt;</code><br />
<code>  &lt;/TextBlock.Text&gt;</code><br />
<code>&lt;/TextBlock&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmb-web.co.uk/index.php/2010/08/formatting-text-directly-in-xaml/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Unit testing internal methods</title>
		<link>http://www.cmb-web.co.uk/index.php/2010/08/unit-testing-internal-methods/</link>
		<comments>http://www.cmb-web.co.uk/index.php/2010/08/unit-testing-internal-methods/#comments</comments>
		<pubDate>Mon, 02 Aug 2010 11:00:29 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.cmb-web.co.uk/index.php/2010/08/unit-testing-internal-methods/</guid>
		<description><![CDATA[When unit testing applications you write tests for the exposed public methods.  Philosophically this is correct as you need to test the functionality exposed by your class to the consuming application, and any private or internal functions that use functionality that also needs testing should be discrete from this class.  This functionality should be [...]]]></description>
			<content:encoded><![CDATA[<p>When unit testing applications you write tests for the exposed public methods.  Philosophically this is correct as you need to test the functionality exposed by your class to the consuming application, and any private or internal functions that use functionality that also needs testing should be discrete from this class.  This functionality should be &#8216;injected&#8217; into the class using some form of unit-testable framework; such as dependency injection using interfaces, allowing them to be tested separately.</p>
<p>However, there are occasions when you want to hide methods from external consumers for good reason, but still need to unit test them.  For example, producing a library to distribute to third-parties.</p>
<p>To do this with .NET you can mark the assembly with <code>InternalsVisibleTo</code> and specifiy the public key of the project allowed to view your internals.</p>
<p>For example, I have a project called <code>MyNewProject</code> and a project containing units tests for this called <code>MyNewProjectTests</code>, I can add the following code to the <code>assembly.cs</code> file in <code>MyNewProject</code> with the public key of the test project:</p>
<p><code>[assembly: InternalsVisibleTo("MyNewProject, PublicKey=0024...")]</code></p>
<p><em>Note, I&#8217;ve not included the entire public key here.</em></p>
<p>Now the internal methods are visible to the test project we have one more task. The unit test frameworks <em>Rhino Mocks</em> and <em>Moq</em> use a proxy class called <code>DynamicProxyGenAssembly2</code> to represent your object when testing. We therefore need to expose the internals to this class also. We do this in the same way with another entry in the <code>assembly.cs</code> file:</p>
<p><code>[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024")]</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmb-web.co.uk/index.php/2010/08/unit-testing-internal-methods/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Android numeric input</title>
		<link>http://www.cmb-web.co.uk/index.php/2010/07/android-numeric-input/</link>
		<comments>http://www.cmb-web.co.uk/index.php/2010/07/android-numeric-input/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 15:13:20 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
		
		<category><![CDATA[Android]]></category>

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

		<guid isPermaLink="false">http://www.cmb-web.co.uk/index.php/2010/07/android-numeric-input/</guid>
		<description><![CDATA[To restrict the input for an EditText to a numeric value, you can add the following to the layout file:
&#60;EditText
...
android:singleLine="true"
android:inputType="numberDecimal"
...
&#62;
Then use, for example, Double.parseDouble(&#8230;) to retrieve the value in code.
Incidentally, the documentation recommends avoiding floats and using double instead.
]]></description>
			<content:encoded><![CDATA[<p>To restrict the input for an EditText to a numeric value, you can add the following to the layout file:</p>
<p><code>&lt;EditText</code><br />
<code>...</code><br />
<code>android:singleLine="true"</code><br />
<code>android:inputType="numberDecimal"</code><br />
<code>...</code><br />
<code>&gt;</code></p>
<p>Then use, for example, Double.parseDouble(&#8230;) to retrieve the value in code.</p>
<p>Incidentally, the documentation recommends <a href="http://developer.android.com/guide/practices/design/performance.html#avoidfloat" title="Avoid floating point numbers in Android">avoiding floats</a> and using double instead.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmb-web.co.uk/index.php/2010/07/android-numeric-input/feed/</wfw:commentRss>
		</item>
		<item>
		<title>main.out.xml: Error parsing XML: no element found</title>
		<link>http://www.cmb-web.co.uk/index.php/2010/04/mainoutxml-error-parsing-xml-no-element-found/</link>
		<comments>http://www.cmb-web.co.uk/index.php/2010/04/mainoutxml-error-parsing-xml-no-element-found/#comments</comments>
		<pubDate>Sun, 11 Apr 2010 07:50:10 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
		
		<category><![CDATA[Android]]></category>

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

		<guid isPermaLink="false">http://www.cmb-web.co.uk/index.php/2010/04/mainoutxml-error-parsing-xml-no-element-found/</guid>
		<description><![CDATA[When you build and run your Android application in Eclipse you can get the following error message:
...res\layout\main.out.xml:1: error: Error parsing XML: no element found
This occurs when you try and run the application from the main.xml layout file. The application cannot run from here and needs to be run from the java file.
The answer is to [...]]]></description>
			<content:encoded><![CDATA[<p>When you build and run your Android application in Eclipse you can get the following error message:</p>
<p><code>...res\layout\main.out.xml:1: error: Error parsing XML: no element found</code></p>
<p>This occurs when you try and run the application from the <code>main.xml</code> layout file. The application cannot run from here and needs to be run from the java file.</p>
<p>The answer is to ensure that a java file is selected when you hit run, as you should run the java not the xml file.  The easiest way to ensure you don&#8217;t do this is to use the<code> Run History</code> options in Eclipse.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmb-web.co.uk/index.php/2010/04/mainoutxml-error-parsing-xml-no-element-found/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Error registering WCF host in Windows Vista (HTTP could not register URL http://+:80)</title>
		<link>http://www.cmb-web.co.uk/index.php/2010/03/error-registering-wcf-host-in-windows-vista-http-could-not-register-url-http80/</link>
		<comments>http://www.cmb-web.co.uk/index.php/2010/03/error-registering-wcf-host-in-windows-vista-http-could-not-register-url-http80/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 19:37:10 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.cmb-web.co.uk/index.php/2010/03/error-registering-wcf-host-in-windows-vista-http-could-not-register-url-http80/</guid>
		<description><![CDATA[This is an error encountered by one of my team when trying to run up a WCF host on a Windows Vista machine.  The actual exception is an
AddressAccessDeniedException
with the error message
HTTP could not register URL http://+:80/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)
The Microsoft site (http://go.microsoft.com/fwlink/?LinkId=70353) does have [...]]]></description>
			<content:encoded><![CDATA[<p>This is an error encountered by one of my team when trying to run up a WCF host on a Windows Vista machine.  The actual exception is an</p>
<p><code>AddressAccessDeniedException</code></p>
<p>with the error message</p>
<p><code>HTTP could not register URL http://+:80/. Your process does not have access rights to this namespace (see http://go.microsoft.com/fwlink/?LinkId=70353 for details)</code></p>
<p>The Microsoft site (<a href="http://go.microsoft.com/fwlink/?LinkId=70353" title="http://go.microsoft.com/fwlink/?LinkId=70353">http://go.microsoft.com/fwlink/?LinkId=70353</a>) does have a solution to the problem using <code>httpcfg</code> and <code>netsh</code>. However the far simpler solution is to run Visual Studio as Administrator</p>
<p>You can do that by right-clicking the shortcut for Visual Studio and selecting <code>Run as adminstrator</code>, or to permanently run as Administrator, right-click and select Properties. Find the Compatibility tab and check the <code>Run this program as administrator</code> checkbo€x.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmb-web.co.uk/index.php/2010/03/error-registering-wcf-host-in-windows-vista-http-could-not-register-url-http80/feed/</wfw:commentRss>
		</item>
		<item>
		<title>C# Image from a byte array (and back again)</title>
		<link>http://www.cmb-web.co.uk/index.php/2010/03/c-image-from-a-byte-array-and-back-again/</link>
		<comments>http://www.cmb-web.co.uk/index.php/2010/03/c-image-from-a-byte-array-and-back-again/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 12:27:05 +0000</pubDate>
		<dc:creator>Christian</dc:creator>
		
		<category><![CDATA[Development]]></category>

		<guid isPermaLink="false">http://www.cmb-web.co.uk/index.php/2010/03/c-image-from-a-byte-array-and-back-again/</guid>
		<description><![CDATA[Quick code sample for transforming a .NET System.Drawing.Image into a byte array:
public byte[] imageToByteArray(Image imageIn)
{
    MemoryStream ms = new MemoryStream();
    imageIn.Save(ms,System.Drawing.Imaging.ImageFormat.Gif);
    return ms.ToArray();
}
and conversely, turning a byte array into an image:
public Image byteArrayToImage(byte[] byteArrayIn)
{
    MemoryStream ms = new MemoryStream(byteArrayIn);
    Image returnImage = Image.FromStream(ms);
    return returnImage;
}

]]></description>
			<content:encoded><![CDATA[<p>Quick code sample for transforming a .NET <code>System.Drawing.Image</code> into a byte array:</p>
<p><code>public byte[] imageToByteArray(Image imageIn)<br />
{<br />
    MemoryStream ms = new MemoryStream();<br />
    imageIn.Save(ms,System.Drawing.Imaging.ImageFormat.Gif);<br />
    return ms.ToArray();<br />
}<br />
</code>and conversely, turning a byte array into an image:</p>
<p><code>public Image byteArrayToImage(byte[] byteArrayIn)<br />
{<br />
    MemoryStream ms = new MemoryStream(byteArrayIn);<br />
    Image returnImage = Image.FromStream(ms);<br />
    return returnImage;<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cmb-web.co.uk/index.php/2010/03/c-image-from-a-byte-array-and-back-again/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>

