<?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>marthijn.</title>
	<atom:link href="http://www.marthijnvandenheuvel.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marthijnvandenheuvel.com</link>
	<description></description>
	<lastBuildDate>Thu, 23 Feb 2012 14:45:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Simple logger for NHibernate 3</title>
		<link>http://www.marthijnvandenheuvel.com/2012/02/20/simple-logger-for-nhibernate-3/</link>
		<comments>http://www.marthijnvandenheuvel.com/2012/02/20/simple-logger-for-nhibernate-3/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 17:37:25 +0000</pubDate>
		<dc:creator>Marthijn</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.marthijnvandenheuvel.com/?p=353</guid>
		<description><![CDATA[A logger is a very useful tool when developing a (web)application, especially when you&#8217;re using an object-relation mapping solution such as NHibernate or Entity Framework. In order to improve the performance of your application it is useful to analyze the SQL queries and other information (e.g. warnings, errors, caching) about the object-relation mapping. Since NHibernate [...]]]></description>
			<content:encoded><![CDATA[<p>A logger is a very useful tool when developing a (web)application, especially when you&#8217;re using an object-relation mapping solution such as NHibernate or Entity Framework. In order to improve the performance of your application it is useful to analyze the SQL queries and other information (e.g. warnings, errors, caching) about the object-relation mapping.</p>
<p>Since NHibernate 3 it is possible to implement a custom logger. Log4net is not necessary anymore. In this post I&#8217;ll describe how to implement your own logger.</p>
<p><span id="more-353"></span>First create a new class and implement the IInternalLogger and ILoggerFactory interface:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> CustomLogger <span style="color: #008000;">:</span> IInternalLogger, ILoggerFactory <span style="color: #008000;">&#123;</span> <span style="color: #008000;">&#125;</span></pre></div></div>

<p>In this example the ILoggerFactory will create a new instance of the CustomLogger:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> IInternalLogger LoggerFor<span style="color: #008000;">&#40;</span>Type type<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> CustomLogger<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> IInternalLogger LoggerFor<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> keyName<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> CustomLogger<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>In order to log messages to the debug console implement the functions of IInternalLogger like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> Debug<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> message, Exception exception<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #000000;">System.<span style="color: #0000FF;">Diagnostics</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Debug</span><span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>message<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">+</span> <span style="color: #666666;">&quot;: &quot;</span> <span style="color: #008000;">+</span> exception<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> Debug<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">object</span> message<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #000000;">System.<span style="color: #0000FF;">Diagnostics</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Debug</span><span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>message<span style="color: #008000;">.</span><span style="color: #0000FF;">ToString</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">void</span> DebugFormat<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> format, <span style="color: #0600FF; font-weight: bold;">params</span> <span style="color: #6666cc; font-weight: bold;">object</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #000000;">System.<span style="color: #0000FF;">Diagnostics</span></span><span style="color: #008000;">.</span><span style="color: #0000FF;">Debug</span><span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Format</span><span style="color: #008000;">&#40;</span>format, args<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>That&#8217;s all for a very basic custom logger. In the web.config add the following key to the appSettings:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;add</span> <span style="color: #000066;">key</span>=<span style="color: #ff0000;">&quot;nhibernate-logger&quot;</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;MyLibrary.CustomLogger, MyLibrary&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.marthijnvandenheuvel.com/2012/02/20/simple-logger-for-nhibernate-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to fix the map change crash in Battlefield 3</title>
		<link>http://www.marthijnvandenheuvel.com/2011/12/20/how-to-fix-the-map-change-crash-in-battlefield-3/</link>
		<comments>http://www.marthijnvandenheuvel.com/2011/12/20/how-to-fix-the-map-change-crash-in-battlefield-3/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 18:05:19 +0000</pubDate>
		<dc:creator>Marthijn</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Back to Karkand]]></category>
		<category><![CDATA[Battlefield 3]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.marthijnvandenheuvel.com/?p=346</guid>
		<description><![CDATA[Battlefield 3 owners could experience black (loading) screens during a map change when playing online. For me this only occurs when playing on Back to Karkand servers. I found this video explaining the solution: update PunkBuster manually. Update Dec. 30 2011: Since my BF3 crashes at a map change again it seems the PunkBuster solution [...]]]></description>
			<content:encoded><![CDATA[<p>Battlefield 3 owners could experience black (loading) screens during a map change when playing online. For me this only occurs when playing on Back to Karkand servers. I found <a href="http://youtu.be/coD2QpUd-tc">this video</a> explaining the solution: update PunkBuster manually.</p>
<p><strong>Update Dec. 30 2011</strong>: Since my BF3 crashes at a map change again it seems the PunkBuster solution (as explained below as well) was only a temporary fix, and there&#8217;s no permanent one yet. An official bug report can be found <a href="http://getsatisfaction.com/battlefield3/topics/black_screen_after_match_scoreboard_doesnt_load_the_next_map">here</a>.</p>
<p><span id="more-346"></span></p>
<ul>
<li>Go to the <a href="http://evenbalance.com/index.php?page=support.php">support page</a> of the PunkBuster website and download &#8220;pbsetup&#8221;</li>
<li>Run &#8220;pbsetup&#8221; and add Battlefield 3 by choosing &#8220;Add a game&#8221; in the menu</li>
<li>Select Battlefield 3 and choose &#8220;Check for updates&#8221;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.marthijnvandenheuvel.com/2011/12/20/how-to-fix-the-map-change-crash-in-battlefield-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to send an e-mail from your Android app</title>
		<link>http://www.marthijnvandenheuvel.com/2011/05/01/how-to-send-an-e-mail-from-your-android-app/</link>
		<comments>http://www.marthijnvandenheuvel.com/2011/05/01/how-to-send-an-e-mail-from-your-android-app/#comments</comments>
		<pubDate>Sun, 01 May 2011 09:43:19 +0000</pubDate>
		<dc:creator>Marthijn</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[E-Mail]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.marthijnvandenheuvel.com/?p=334</guid>
		<description><![CDATA[I&#8217;m developing an Android application where the user must be able to send a file stored on the SD Card to a specific e-mail address. By using Android&#8217;s Intent class this is very easy. The following code snippet will bring up an e-mail application choose dialog. String filename = &#34;file://&#34; + Environment.getExternalStorageDirectory&#40;&#41; + &#34;/file.txt&#34;; String [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m developing an Android application where the user must be able to send a file stored on the SD Card to a specific e-mail address. By using Android&#8217;s <a href="http://developer.android.com/reference/android/content/Intent.html" target="_blank">Intent</a> class this is very easy. The following code snippet will bring up an e-mail application choose dialog.</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #003399;">String</span> filename <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;file://&quot;</span> <span style="color: #339933;">+</span> <span style="color: #003399;">Environment</span>.<span style="color: #006633;">getExternalStorageDirectory</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;/file.txt&quot;</span><span style="color: #339933;">;</span>
<span style="color: #003399;">String</span> email<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span> <span style="color: #0000ff;">&quot;foo@bar.com&quot;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
Intent sendIntent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Intent<span style="color: #009900;">&#40;</span>Intent.<span style="color: #006633;">ACTION_SEND</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sendIntent.<span style="color: #006633;">putExtra</span><span style="color: #009900;">&#40;</span>Intent.<span style="color: #006633;">EXTRA_SUBJECT</span>, <span style="color: #0000ff;">&quot;My file&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sendIntent.<span style="color: #006633;">putExtra</span><span style="color: #009900;">&#40;</span>Intent.<span style="color: #006633;">EXTRA_EMAIL</span>, email<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sendIntent.<span style="color: #006633;">putExtra</span><span style="color: #009900;">&#40;</span>Intent.<span style="color: #006633;">EXTRA_STREAM</span>, Uri.<span style="color: #006633;">parse</span><span style="color: #009900;">&#40;</span>filename<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
sendIntent.<span style="color: #006633;">setType</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;text/plain&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
startActivity<span style="color: #009900;">&#40;</span>Intent.<span style="color: #006633;">createChooser</span><span style="color: #009900;">&#40;</span>sendIntent, <span style="color: #0000ff;">&quot;EMail file&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.marthijnvandenheuvel.com/2011/05/01/how-to-send-an-e-mail-from-your-android-app/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fix .NET 4 SocketPermission for MySQL driver in Medium Trust</title>
		<link>http://www.marthijnvandenheuvel.com/2011/04/14/fix-net-4-socketpermission-for-mysql-driver-in-medium-trust/</link>
		<comments>http://www.marthijnvandenheuvel.com/2011/04/14/fix-net-4-socketpermission-for-mysql-driver-in-medium-trust/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 18:57:38 +0000</pubDate>
		<dc:creator>Marthijn</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SocketPermission]]></category>

		<guid isPermaLink="false">http://www.marthijnvandenheuvel.com/?p=328</guid>
		<description><![CDATA[Most .NET 4 shared hosting providers offering their customers a medium trust environment. This is not a problem for most web applications unless the applications uses MySQL in combination with the .NET MySQL driver (MySQL.Data.dll). The MySQL driver connects to the MySQL database using a socket. However, sockets are not allowed in medium trust. The [...]]]></description>
			<content:encoded><![CDATA[<p>Most .NET 4 shared hosting providers offering their customers a medium trust environment. This is not a problem for most web applications unless the applications uses MySQL in combination with the .NET MySQL driver (<a href="http://dev.mysql.com/downloads/connector/net/" target="_blank">MySQL.Data.dll</a>). The MySQL driver connects to the MySQL database using a socket. However, sockets are not allowed in medium trust. The application will throw a SecurityException with the following message:</p>
<pre><code>Request for the permission of type 'System.Net.SocketPermission,  System, Version=4.0.0.0, Culture=neutral,  PublicKeyToken=b77a5c561934e089' failed.</code></pre>
<p><span id="more-328"></span><br />
In order to fix this there are three solutions:</p>
<p>1. Instead of MySQL, use Microsoft SQL server.</p>
<p>2. Move to a hosting provider that supports a full trust environment or get your own server.</p>
<p>3. Ask your hosting provider to update the medium trust policy with SocketPermission. The steps will be explained here:</p>
<p>Open the following file in a text editor:</p>
<pre>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\web_mediumtrust.config</pre>
<p>Or when you are running 64 bit:</p>
<pre>C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web_mediumtrust.config</pre>
<p>Inside the SecurityClasses tag, add the following line:</p>
<pre><code>&lt;SecurityClass Name="SocketPermission" Description="System.Net.SocketPermission, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/&gt;</code></pre>
<p>Scroll down and look for the following PermissionSet:</p>
<pre>&lt;PermissionSet version="1" Name="ASP.Net"&gt;</pre>
<p>Add the following inside this PermissionSet:</p>
<pre><code>&lt;IPermission class="SocketPermission" version="1" Unrestricted="true" /&gt;
</code></pre>
<p>That&#8217;s all, a restart of IIS is, as far as I know, not necessary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marthijnvandenheuvel.com/2011/04/14/fix-net-4-socketpermission-for-mysql-driver-in-medium-trust/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Home Theater PC part 2</title>
		<link>http://www.marthijnvandenheuvel.com/2011/04/02/building-a-home-theater-pc-part-2/</link>
		<comments>http://www.marthijnvandenheuvel.com/2011/04/02/building-a-home-theater-pc-part-2/#comments</comments>
		<pubDate>Sat, 02 Apr 2011 11:51:49 +0000</pubDate>
		<dc:creator>Marthijn</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Asus]]></category>
		<category><![CDATA[Atom]]></category>
		<category><![CDATA[HTPC]]></category>
		<category><![CDATA[Media Center]]></category>
		<category><![CDATA[Nvidia]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[XBMC]]></category>

		<guid isPermaLink="false">http://www.marthijnvandenheuvel.com/?p=316</guid>
		<description><![CDATA[Today I finally assembled my HTPC. There were some stock issues with the case I ordered, so after a week I ordered another. Although the motherboard is passively cooled I decided to enable one of the two case fans. Unfortunately the fans are very noisy when directly connected to the motherboard, so I placed a [...]]]></description>
			<content:encoded><![CDATA[<p>Today I finally assembled my <a title="Building a Home Theater PC part 1" href="http://www.marthijnvandenheuvel.com/2011/03/16/building-a-home-theater-pc-part-1/">HTPC</a>. There were some stock issues with the case I ordered, so after a week I ordered another. Although the motherboard is passively cooled I decided to enable one of the two case fans. Unfortunately the fans are very noisy when directly connected to the motherboard, so I placed a simple <a href="http://www.zalman.co.kr/ENG/product/Product_Read.asp?idx=206" target="_blank">Zalman fancontroller</a> between the fan and motherboard.</p>
<p><a href="http://www.marthijnvandenheuvel.com/wp-content/uploads/2011/03/IMG_2487_small.jpg" rel="lightbox[316]"><img class="aligncenter size-medium wp-image-317" title="HTPC 1" src="http://www.marthijnvandenheuvel.com/wp-content/uploads/2011/03/IMG_2487_small-300x225.jpg" alt="" width="300" height="225" /></a>After building the HTPC I first installed Ubuntu 10.10 using a USB stick. Then I used <a href="http://wiki.xbmc.org/index.php?title=HOW-TO_install_XBMC_for_Linux_on_Ubuntu,_a_Step-by-Step_Guide" target="_blank">this guide</a> to install XBMC.</p>
<p><span id="more-316"></span>In order to have smooth playback of movies you need to enable the NVidia drivers. I noticed some strange artefacts and glitches in Gnome (not XBMC) after a while. When the screen is refreshed (e.g. when you switch a user, or start XBMC) everything is normal again but after a while it starts to happen again. I haven&#8217;t found a solution yet&#8230;</p>
<p><a href="http://www.marthijnvandenheuvel.com/wp-content/uploads/2011/03/IMG_2488_small.jpg" rel="lightbox[316]"><img class="aligncenter size-medium wp-image-318" title="HTPC 2" src="http://www.marthijnvandenheuvel.com/wp-content/uploads/2011/03/IMG_2488_small-300x225.jpg" alt="" width="300" height="225" /></a>Finally some useful links to new XBMC users:</p>
<ul>
<li><a href="http://www.rieter.net/pages/XOT:Uzg" target="_blank">Uitzending gemist plugin including Dutch radio stations</a> (see also <a href="http://bigfoot87.com/xbmc/radiostreams/">this</a> page)</li>
<li><a href="http://www.maximumpc.com/article/features/xbmc?page=0,1" target="_blank">12 Essential Tips to Using XBMC as the Perfect Media Hub</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.marthijnvandenheuvel.com/2011/04/02/building-a-home-theater-pc-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a Home Theater PC part 1</title>
		<link>http://www.marthijnvandenheuvel.com/2011/03/16/building-a-home-theater-pc-part-1/</link>
		<comments>http://www.marthijnvandenheuvel.com/2011/03/16/building-a-home-theater-pc-part-1/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 10:58:44 +0000</pubDate>
		<dc:creator>Marthijn</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Asus]]></category>
		<category><![CDATA[Atom]]></category>
		<category><![CDATA[HTPC]]></category>
		<category><![CDATA[Media Center]]></category>
		<category><![CDATA[Nvidia]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[XBMC]]></category>

		<guid isPermaLink="false">http://www.marthijnvandenheuvel.com/?p=307</guid>
		<description><![CDATA[Last year I build a home server based on the Intel Atom platform. In my second post I mentioned building an HTPC with the same components, but I wasn&#8217;t really sure the current Atom processors and Nvidia ION platform could handle video decoding with a full HD resolution. Since a few weeks I&#8217;m looking for [...]]]></description>
			<content:encoded><![CDATA[<p>Last year I build a <a href="http://www.marthijnvandenheuvel.com/2010/02/24/building-a-home-server-part-1/" target="_blank">home server</a> based on the Intel Atom platform. In my <a href="http://www.marthijnvandenheuvel.com/2010/03/05/building-a-home-server-part-2/" target="_blank">second post</a> I mentioned building an HTPC with the same components, but I wasn&#8217;t really sure the current Atom processors and Nvidia ION platform could handle video decoding with a full HD resolution. Since a few weeks I&#8217;m looking for information how to build an HTPC running <a href="http://xbmc.org/" target="_blank">XBMC</a> based on the latest Atom processors with Nvidia ION 2. I found <a href="http://htpcbuild.wordpress.com/" target="_blank">this blog</a> and I think I will use more or less the same parts because it&#8217;s a very good price/value solution.</p>
<p><span id="more-307"></span>I will use the following parts:</p>
<ul>
<li>Motherboard: <a href="http://www.asus.com/product.aspx?P_ID=iIZKMXSj0jZKiebE" target="_blank">Asus AT5IONT-I</a> (<a href="http://rutten.me/20101124/htpc-testing-the-asus-at5iont-i/" target="_blank">review</a>)</li>
<li>Case: <a href="http://www.jetway.com.tw/jw/case_view.asp?productid=490&amp;proname=JC-110-B#" target="_blank">Jetway JC-110-B</a></li>
<li>Hard disk: <a href="http://www.wdc.com/global/products/specs/?driveID=773&amp;language=1" target="_blank">Western Digital Caviar GreenPower WD20EARS, 2TB</a></li>
<li>RAM: 2x <a href="http://www.ec.kingston.com/ecom/configurator_new/PartsInfo.asp?root=us&amp;LinkBack=http://www.valueram.com&amp;ktcpartno=KVR1333D3S9/2G">Kingston ValueRAM KVR1333D3S9/2G</a></li>
<li>Optical drive: <a href="http://www.sony-optiarc.eu/products/dvddrivesnotebooks/ad7700s.html" target="_blank">Sony NEC Optiarc AD-7700S</a></li>
<li>Remote: <a href="http://www.dealextreme.com/p/driver-free-universal-usb-ir-media-remote-controller-for-pc-2-aaa-27596" target="_blank">USB IR Media Remote</a></li>
</ul>
<p>The total price is around 300 Euro.</p>
<p><a href="http://www.asus.com/product.aspx?P_ID=iIZKMXSj0jZKiebE"><img class="alignnone" title="Asus AT5IONT-I" src="http://www.asus.com/websites/global/products/iIZKMXSj0jZKiebE/P_500.jpg" alt="" width="500" height="500" /></a></p>
<p><strong>Update March 24: </strong>The APlus Cupid 2 wasn&#8217;t available any more so I changed to the Jetway JC-110-B.<strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marthijnvandenheuvel.com/2011/03/16/building-a-home-theater-pc-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Possible solution for NHibernate many-to-many criteria</title>
		<link>http://www.marthijnvandenheuvel.com/2011/01/07/possible-solution-for-nhibernate-many-to-many-criteria/</link>
		<comments>http://www.marthijnvandenheuvel.com/2011/01/07/possible-solution-for-nhibernate-many-to-many-criteria/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 10:44:12 +0000</pubDate>
		<dc:creator>Marthijn</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.marthijnvandenheuvel.com/?p=299</guid>
		<description><![CDATA[How to query an NHibernate many-to-many relationship.]]></description>
			<content:encoded><![CDATA[<p>In one of my .NET projects I&#8217;m using the <a href="http://nhforge.org/" target="_blank">NHibernate</a> library for object-relational mapping. I&#8217;m mainly using the ICriteria interface to fetch data from the database. Unfortunately I ran into a function that got really complicated; how to query a many-to-many relationship. For example, I have a table containing posts and a table containing tags. The post datamodel contains a set with tags so in my mapping it&#8217;s a many-to-many relationship. I want my query to return all posts tagged with one or more specific tags. On <a href="http://forum.castleproject.org/viewtopic.php?p=15157" target="_blank">this forum</a> I found a solution. I&#8217;m not sure if this is the perfect solution, so feel free to suggest a better one.<br />
<span id="more-299"></span></p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">public</span> IList<span style="color: #008000;">&lt;</span>Post<span style="color: #008000;">&gt;</span> GetPostsByTags<span style="color: #008000;">&#40;</span>IList<span style="color: #008000;">&lt;</span>Tag<span style="color: #008000;">&gt;</span> tags<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
 ICriteria posts <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">this</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Session</span><span style="color: #008000;">.</span><span style="color: #0000FF;">CreateCriteria</span><span style="color: #008000;">&lt;</span>Post<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 <span style="color: #0600FF; font-weight: bold;">foreach</span> <span style="color: #008000;">&#40;</span>Tag t <span style="color: #0600FF; font-weight: bold;">in</span> tags<span style="color: #008000;">&#41;</span>
 <span style="color: #008000;">&#123;</span>
  posts<span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>Subqueries<span style="color: #008000;">.</span><span style="color: #0000FF;">Exists</span><span style="color: #008000;">&#40;</span>DetachedCriteria<span style="color: #008000;">.</span><span style="color: #0600FF; font-weight: bold;">For</span><span style="color: #008000;">&lt;</span>Post<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;p2&quot;</span><span style="color: #008000;">&#41;</span>
   <span style="color: #008000;">.</span><span style="color: #0000FF;">SetProjection</span><span style="color: #008000;">&#40;</span>Projections<span style="color: #008000;">.</span><span style="color: #0000FF;">Id</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
   <span style="color: #008000;">.</span><span style="color: #0000FF;">CreateAlias</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;p2.Tags&quot;</span>, <span style="color: #666666;">&quot;t&quot;</span><span style="color: #008000;">&#41;</span>
   <span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>Restrictions<span style="color: #008000;">.</span><span style="color: #0000FF;">Eq</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;t.Id&quot;</span>, t<span style="color: #008000;">.</span><span style="color: #0000FF;">Id</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
   <span style="color: #008000;">.</span><span style="color: #0000FF;">Add</span><span style="color: #008000;">&#40;</span>Restrictions<span style="color: #008000;">.</span><span style="color: #0000FF;">EqProperty</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;p2.Id&quot;</span>, <span style="color: #666666;">&quot;this.Id&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 <span style="color: #008000;">&#125;</span>
 posts<span style="color: #008000;">.</span><span style="color: #0000FF;">SetResultTransformer</span><span style="color: #008000;">&#40;</span>NHibernate<span style="color: #008000;">.</span><span style="color: #0000FF;">Transform</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Transformers</span><span style="color: #008000;">.</span><span style="color: #0000FF;">DistinctRootEntity</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 <span style="color: #0600FF; font-weight: bold;">return</span> posts<span style="color: #008000;">.</span><span style="color: #0000FF;">List</span><span style="color: #008000;">&lt;</span>Post<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.marthijnvandenheuvel.com/2011/01/07/possible-solution-for-nhibernate-many-to-many-criteria/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Using log4net to show NHibernate SQL in Visual Studio</title>
		<link>http://www.marthijnvandenheuvel.com/2010/12/02/using-log4net-to-show-nhibernate-sql-in-visual-studio/</link>
		<comments>http://www.marthijnvandenheuvel.com/2010/12/02/using-log4net-to-show-nhibernate-sql-in-visual-studio/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 10:15:28 +0000</pubDate>
		<dc:creator>Marthijn</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[log4net]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.marthijnvandenheuvel.com/?p=292</guid>
		<description><![CDATA[Configure log4net in order to show NHibernate SQL queries in Visual Studio's console.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently developing a web application in <a href="http://www.asp.net/mvc" target="_blank">ASP.NET MVC</a> and <a href="http://nhforge.org/" target="_blank">NHibernate</a>. Since the application was very slow at some points I wanted to know which SQL queries NHibernate was executing. Since the <a href="http://logging.apache.org/log4net/index.html" target="_blank">log4net</a> library was already included in the application I searched for a solution to output the SQL queries to the console in Visual Studio 2010 using log4net. I found the solution on <a href="http://nhforge.org/wikis/howtonh/configure-log4net-for-use-with-nhibernate.aspx" target="_blank">this wiki</a> and <a href="http://www.davesquared.net/2008/01/viewing-sql-generated-by-nhibernate.html" target="_blank">this blog post</a>.</p>
<p><span id="more-292"></span>First thing you need to do is add a log4net section in your web.config if you don&#8217;t have one yet.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;configSections<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 ...
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;section</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;log4net&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Config.Log4NetConfigurationSectionHandler,log4net&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
 ...
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/configSections<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Then add the log4net section, and configure an appender and logger.</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;log4net<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appender</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;DebugSQL&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Appender.TraceAppender&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;layout</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;log4net.Layout.PatternLayout&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;conversionPattern</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;%date [%thread] %-5level %logger [%property{NDC}] - %message%newline&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/layout<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appender<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;logger</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;NHibernate.SQL&quot;</span> <span style="color: #000066;">additivity</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;level</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;DEBUG&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appender-ref</span> <span style="color: #000066;">ref</span>=<span style="color: #ff0000;">&quot;DebugSQL&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
 <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/logger<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/log4net<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>That&#8217;s all. Don&#8217;t forget to configure log4net in the Global.asax.</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #6666cc; font-weight: bold;">void</span> Application_Start<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
 log4net<span style="color: #008000;">.</span><span style="color: #0000FF;">Config</span><span style="color: #008000;">.</span><span style="color: #0000FF;">XmlConfigurator</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Configure</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
 <span style="color: #008000;">...</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.marthijnvandenheuvel.com/2010/12/02/using-log4net-to-show-nhibernate-sql-in-visual-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to lookup MIDI notes of your MIDI controller</title>
		<link>http://www.marthijnvandenheuvel.com/2010/11/01/how-to-lookup-midi-notes-of-your-midi-controller/</link>
		<comments>http://www.marthijnvandenheuvel.com/2010/11/01/how-to-lookup-midi-notes-of-your-midi-controller/#comments</comments>
		<pubDate>Mon, 01 Nov 2010 14:10:33 +0000</pubDate>
		<dc:creator>Marthijn</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[Digital Jockey 2]]></category>
		<category><![CDATA[Midi controller]]></category>
		<category><![CDATA[Midi mapping]]></category>
		<category><![CDATA[Midi-ox]]></category>
		<category><![CDATA[Reloop]]></category>
		<category><![CDATA[Traktor]]></category>

		<guid isPermaLink="false">http://www.marthijnvandenheuvel.com/?p=280</guid>
		<description><![CDATA[How to lookup MIDI note and channel information of a MIDI controller using MIDI-OX.]]></description>
			<content:encoded><![CDATA[<p>Last week I helped <a href="http://www.basvandijk.eu/" target="_blank">Bas</a> verifying his <a href="http://www.basvandijk.eu/2010/10/30/reloop-digital-jockey-2-midi-layout-overview/" target="_blank">MIDI layout of the Reloop Digital Jockey 2</a> interface and controller edition. I used a program for Windows called <a href="http://www.midiox.com/" target="_blank">MIDI-OX</a>, a diagnostic tool for the <a href="http://en.wikipedia.org/wiki/Musical_Instrument_Digital_Interface" target="_blank">MIDI protocol</a>, to do this. In order to lookup the MIDI information sent by your MIDI controller turn on your device, start MIDI-OX and go to Options &gt; MIDI Devices.</p>
<p><span id="more-280"></span>In this window select your MIDI Controller inputs in the MIDI Inputs list. Press Ok and go to View &gt; Input Monitor to view the MIDI input of your controller.</p>
<p><a href="http://www.marthijnvandenheuvel.com/wp-content/uploads/2010/11/pcr_midiox.png" rel="lightbox[280]"><img class="aligncenter size-medium wp-image-282" title="MIDI-OX Input Monitor" src="http://www.marthijnvandenheuvel.com/wp-content/uploads/2010/11/pcr_midiox-300x240.png" alt="" width="300" height="240" /></a></p>
<p>For all buttons and keys on your controller the MIDI note is listed in the NOTE column. Unfortunately when using the knobs and sliders on my Digital Jockey 2 no information was shown about the channel used. Please post a comment if you know how to extract this information or if there are better tools to view MIDI data.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.marthijnvandenheuvel.com/2010/11/01/how-to-lookup-midi-notes-of-your-midi-controller/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Map Traktor&#8217;s Beat Phase Monitor to your Reloop Digital Jockey 2</title>
		<link>http://www.marthijnvandenheuvel.com/2010/10/16/map-traktors-beat-phase-monitor-to-your-reloop-digital-jockey-2/</link>
		<comments>http://www.marthijnvandenheuvel.com/2010/10/16/map-traktors-beat-phase-monitor-to-your-reloop-digital-jockey-2/#comments</comments>
		<pubDate>Fri, 15 Oct 2010 22:01:45 +0000</pubDate>
		<dc:creator>Marthijn</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[Digital Jockey 2]]></category>
		<category><![CDATA[Midi mapping]]></category>
		<category><![CDATA[Reloop]]></category>
		<category><![CDATA[Traktor]]></category>

		<guid isPermaLink="false">http://www.marthijnvandenheuvel.com/?p=273</guid>
		<description><![CDATA[How to map Traktor's Beat Phase Monitor to a LED on the Reloop Digital Jockey 2]]></description>
			<content:encoded><![CDATA[<p>In <a href="http://www.youtube.com/watch?v=ma7urvruR_Y" target="_blank">this video on YouTube</a> you can see the LED of the Load A and Load B button blink on the Beat Phase Monitor of Traktor. In this post I&#8217;ll describe how to add this functionality to your Reloop Digital Jockey 2 mapping in Traktor.</p>
<p><a href="http://www.marthijnvandenheuvel.com/wp-content/uploads/2010/10/r_dj2int.png" rel="lightbox[273]"><img class="aligncenter size-medium wp-image-274" title="Digital Jockey 2" src="http://www.marthijnvandenheuvel.com/wp-content/uploads/2010/10/r_dj2int-300x225.png" alt="" width="300" height="225" /></a><span id="more-273"></span>In Traktor open the Controller Manager (in the Preferences window). Now press the Add Out.. button and choose Output &gt; Beat Phase Monitor. For deck A modify the following settings:</p>
<ul>
<li>Note: Ch01.Note.G0</li>
<li>Type of controller: LED</li>
<li>Modifier Conditions are all empty</li>
<li>Interaction mode: Output</li>
<li>Assignment: Deck A</li>
<li>Controller range min: 0</li>
<li>Controller range max: 0.5</li>
<li>Midi range min: 0</li>
<li>Midi range max: 127</li>
<li>Both Blend and Invert are off</li>
</ul>
<p>Repeat this step for deck B, but now change Assignment to Deck B and Note to Ch01.Note.G5.</p>
<p><a href="http://www.marthijnvandenheuvel.com/wp-content/uploads/2010/10/traktor_beatphasemonitor.png" rel="lightbox[273]"><img class="aligncenter size-medium wp-image-275" title="Beat Phase Monitor mapping" src="http://www.marthijnvandenheuvel.com/wp-content/uploads/2010/10/traktor_beatphasemonitor-270x300.png" alt="" width="270" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.marthijnvandenheuvel.com/2010/10/16/map-traktors-beat-phase-monitor-to-your-reloop-digital-jockey-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

