<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://bloggingabout.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Ramon Smits</title><link>http://bloggingabout.net/blogs/ramon/default.aspx</link><description>Tell me your secrets and i&amp;#39;ll tell you mine</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>Why does NServiceBus sends subscription messages in my integration / unit tests?</title><link>http://bloggingabout.net/blogs/ramon/archive/2012/08/08/why-does-nservicebus-sends-subscription-messages-in-my-integration-unit-tests.aspx</link><pubDate>Wed, 08 Aug 2012 09:47:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:577957</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=577957</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=577957</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2012/08/08/why-does-nservicebus-sends-subscription-messages-in-my-integration-unit-tests.aspx#comments</comments><description>&lt;p&gt;When you reference the handlers assembly from your test assembly and this assembly initializes a bus instance and the endpoint to send messages to is a publisher it can happen that you see multiple messages being send to the endpoint. while you expected less messages. Inspecting the messages indicates subscription acknowledgement messages and you wonder why that is as you don&amp;#39;t want your test project to subscribe to anything at all! This happens because NServiceBus scans all available assemblies for messages handlers and when it finds these then it will subscribe to the events which results in the messages that you see in the (journal) queues.&lt;/p&gt;
&lt;p&gt;Luckily this behavior can be disabled by calling .DoNotAutoSubscribe() during bus initialization as shown in the following example:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;var bus = Configure.With()
	.DefineEndpointName(&amp;quot;integrationtests&amp;quot;)
	.DefiningCommandsAs(MessageNamingConvention.IsCommand)
	.DefiningEventsAs(MessageNamingConvention.IsEvent)
	.DefiningMessagesAs(MessageNamingConvention.IsMessage)
	.UnityBuilder()
	.XmlSerializer()
	.MsmqTransport()
		.IsTransactional(true)
		.PurgeOnStartup(false)
	.UnicastBus()
		.ImpersonateSender(false)
	.DoNotAutoSubscribe()	// Needed as otherwise the client will subscribe to event messages because handler assembly is references and scanned by NServiceBus.
	.CreateBus()
	.Start();
&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=577957" width="1" height="1"&gt;</description></item><item><title>NServiceBus v3 does not automatically create queues</title><link>http://bloggingabout.net/blogs/ramon/archive/2012/08/07/nservicebus-v3-does-not-automatically-create-queues.aspx</link><pubDate>Tue, 07 Aug 2012 09:39:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:577956</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=577956</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=577956</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2012/08/07/nservicebus-v3-does-not-automatically-create-queues.aspx#comments</comments><description>&lt;p&gt;Queues are not automatically created anymore since NServiceBus v3. Queues are now created during the installation phase which you usually do not have in web apps or test apps. You can still have the old behavior by triggering the installation during bus creation. Make the following change to trigger this.&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;// From:
.Start()
// To:
.Start(()&amp;nbsp;=&amp;gt;&amp;nbsp;Configure.Instance.ForInstallationOn&amp;lt;Windows&amp;gt;().Install());&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=577956" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/NServiceBus/default.aspx">NServiceBus</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/MSMQ/default.aspx">MSMQ</category></item><item><title>git-tfs differences between checkin, rcheckin and checkintool (ct)</title><link>http://bloggingabout.net/blogs/ramon/archive/2012/07/25/git-tfs-differences-between-checkin-rcheckin-and-checkintool-ct.aspx</link><pubDate>Wed, 25 Jul 2012 13:31:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:577940</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=577940</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=577940</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2012/07/25/git-tfs-differences-between-checkin-rcheckin-and-checkintool-ct.aspx#comments</comments><description>&lt;p&gt;I am using git-tfs for a couple of weeks now and had some issues with it that using the checkintool results in one tfs changeset that combines all previous commits. This can often be usefull but in my case I would like to push all individual local git commits seperately to tfs. This is exactly what rcheckin does and this way your git commit history is mirrored to tfs. As a reminder:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;git tfs checkin&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Performs one commit containing all previous commits where either the default commit message can be used (concatenation of all git commit comments) or a new custom comment.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;git tfs checkintool&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Same as git tfs checkin but now you can easily change which changed files to commit via the TFS checkin dialog. It shows the&amp;nbsp;concatenation of all git commit comments to use as a commit comment but can easily altered in the gui.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;git tfs rcheckin&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;Commits each previous git commit to tfs and reusing the git comment for each commit.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=577940" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/git/default.aspx">git</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/tfs/default.aspx">tfs</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/git-tfs/default.aspx">git-tfs</category></item><item><title>MVC *always* returns status code 200 when a max age is set while it can return with 304</title><link>http://bloggingabout.net/blogs/ramon/archive/2011/06/16/mvc-always-returns-status-code-200-when-a-max-age-is-set-while-it-can-return-with-304.aspx</link><pubDate>Wed, 15 Jun 2011 22:18:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:486918</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=486918</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=486918</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2011/06/16/mvc-always-returns-status-code-200-when-a-max-age-is-set-while-it-can-return-with-304.aspx#comments</comments><description>&lt;p&gt;Take a look at the following mvc csharp code:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;	Response.AddFileDependency(filename)
	Response.Cache.SetETagFromFileDependencies();
	Response.Cache.SetCacheability(HttpCacheability.Public);
	Response.Cache.SetMaxAge(TimeSpan.FromHours(1));
	return File(filename, &amp;quot;video/mp4&amp;quot;)
&lt;/pre&gt;
&lt;p&gt;My intension of this was. Please cache this file for one hour (SetMaxAge) and then check if the file is still valid (SetEtagFromFileDependancy) and if it is then cache it again for one hour.&lt;/p&gt;
&lt;p&gt;However, it turns out that MVC thinks different :-). When the item is expired MVC returns status code 200 even though the clients submits a matching If-None-Match header. In such cases the webserver is allowed to respond with 304 and update the item with new information passed in the response header.&lt;/p&gt;
&lt;p&gt;It could be that I have forgotten something in the code above but the following is the workaround I created for this situation. It needs a custom etag to use so you cannot make use of&amp;nbsp;SetETagFromFileDependencies. The method basically does a Etag comparison and responds with a 304 if they match. If they do not match the method returns null but has set the above mentioned headers.&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;	ActionResult EtagFix(string etagResponse, HttpCacheability cachability, TimeSpan maxAge)
	{
		var cache = Response.Cache;
		cache.SetETag(etagResponse);
		cache.SetCacheability(cachability);
		cache.SetMaxAge(maxAge);

		if (!etagResponse.Equals(Request.Headers[&amp;quot;If-None-Match&amp;quot;])) return null;

		Response.StatusCode = 304;
		Response.StatusDescription = &amp;quot;Not Modified&amp;quot;;
		return new EmptyResult();
	}
&lt;/pre&gt;
&lt;p&gt;This method should be pasted as a method in your controller and then it should just work. The reason that I return null is that you can do the following nifty trick:&lt;/p&gt;
&lt;pre class="brush: csharp;"&gt;	return EtagFix(&amp;quot;EtagValue&amp;quot;, HttpCacheability.Public, TimeSpan.FromHours(1)) ?? File(Server.MapPath(&amp;quot;~/Content/mylargefile.dat&amp;quot;);
&lt;/pre&gt;
&lt;p&gt;The reason that this is cool is that &amp;quot;File(Server.MapPath(&amp;quot;~/Content/mylargefile.dat&amp;quot;)&amp;quot; will ONLY be called with EtagFix returns null. This avoids &amp;#39;expensive&amp;#39; action result implementations to be created and do work that they do not have to do.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=486918" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/http/default.aspx">http</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/etag/default.aspx">etag</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/304/default.aspx">304</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/mvc/default.aspx">mvc</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/200/default.aspx">200</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/header/default.aspx">header</category></item><item><title>TortoiseSVN Subversion error "\ is not a working copy"</title><link>http://bloggingabout.net/blogs/ramon/archive/2011/05/04/tortoisesvn-subversion-error-quot-is-not-a-working-copy-quot.aspx</link><pubDate>Wed, 04 May 2011 17:18:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:486638</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=486638</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=486638</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2011/05/04/tortoisesvn-subversion-error-quot-is-not-a-working-copy-quot.aspx#comments</comments><description>&lt;p&gt;Today I got the following Subversion message via TortoiseSVN while I wanted to commit some changes.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;\ is not a working copy&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;It took me a while to figure this out but it has to do with the fact that &lt;b&gt;I subst&amp;nbsp;the root of the branch to my S: drive&lt;/b&gt;. When I went to my user folder (c:\users\ramon\src\*) and performed a commit it just worked as expected.&lt;/p&gt;
&lt;p&gt;The reason for the substition is that when I compile the sources that the S: drive paths are embedded into the PDB files. When another developer then attaches the debugger to any of the applications then he only needs to have the same substitution to find all source code files. Besides that, it doesn&amp;#39;t matter on which project I work on and no matter which drive or folder the paths stay the same. This is especially usefull as I am a console and keyboard junkie.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=486638" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/Subversion/default.aspx">Subversion</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/subst/default.aspx">subst</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/root/default.aspx">root</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/tortoisesvn/default.aspx">tortoisesvn</category></item><item><title>InternalsVisibleTo and PublicKey or PublicKeyToken</title><link>http://bloggingabout.net/blogs/ramon/archive/2010/10/27/internalsvisibleto-and-publickey-or-publickeytoken.aspx</link><pubDate>Wed, 27 Oct 2010 14:21:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:484234</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=484234</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=484234</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2010/10/27/internalsvisibleto-and-publickey-or-publickeytoken.aspx#comments</comments><description>&lt;p&gt;A long time since my previous blog as nowadays I often &lt;a href="http://twitter.com/ramonsmits"&gt;tweet&lt;/a&gt; my ramblings but this one does not fit a tweet :-)&lt;/p&gt;
&lt;p&gt;Sometimes you are working with strong named assemblies and when you are having unit tests and want to access internals then you have to use the &lt;strong&gt;InternalsVisibleTo&lt;/strong&gt; assembly attribute. So to discover the public key token I ran &lt;strong&gt;&amp;ldquo;sn.exe &amp;ndash;tp project.publickey&amp;rdquo;&lt;/strong&gt; and then you get the public key (long) and the public key&amp;nbsp; token (short).&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;Microsoft (R) .NET Framework Strong Name Utility  Version 4.0.30319.1
Copyright (c) Microsoft Corporation.  All rights reserved.

Public key is
0024000004800000940000000602000000240000525341310004000001000100ff6b089e3c4aaa
a96d775c3e431ea5b8b77fe2364be31793d0baf518ba39477e7fcfc027871d184e169d70ee2940
4dc26dc66c9ab970ad9a3d78be146716e10fdc4b4d3e821a7f402498ccb30f95eaca3922075354
ecdf7bb57b20a20579cba375de71e15f298f779aad7b421f4c0ee5f7c299b528f10574f64e5610
5ea3d7af

Public key token is 67178dccc283ce39&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;So I used the following attribute:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;[assembly: InternalsVisibleTo(&amp;quot;My.Project.Tests, PublicKeyToken=67178dccc283ce39&amp;quot;)]&lt;/pre&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And got this nice compiler error:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Friend assembly reference is invalid. Strong-name signed assemblies must specify a public key in their InternalsVisibleTo declarations.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then I pasted the long variant in the InternalsVisibleTo attribute and it compiled but I knew for 100% that the short version had to work. After investigation there seem two ways to pass the required strong name public key information. You can choose if you want to pass the whole public key or the public key token. 
  &lt;/p&gt;
&lt;p&gt;When both assemblies are signed then you need to pass the full PublicKey.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=484234" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/.Net/default.aspx">.Net</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/TDD/default.aspx">TDD</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/unittesting/default.aspx">unittesting</category></item><item><title>ThreadPool default thread count not useful for testing</title><link>http://bloggingabout.net/blogs/ramon/archive/2010/05/26/threadpool-default-thread-count-not-useful-for-testing.aspx</link><pubDate>Wed, 26 May 2010 11:23:02 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:483391</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=483391</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=483391</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2010/05/26/threadpool-default-thread-count-not-useful-for-testing.aspx#comments</comments><description>&lt;p&gt;Today I got reminded again that it is sometimes required to adjust thread pool settings. This time to test some possible connection issues and I required to open a number of connections simultaneously and also use them in parallel.&lt;/p&gt;  &lt;p&gt;The test system is a virtual machine which only has one core so the defaults that .net uses are based on that. I first thought that the problems were caused by nunit but pretty soon found out that the case had to do with the thread pool. When I queried the current values via ThreadPool.GetMinThreads it told me that the thread pool used just one thread as minimal. After forcing that with ThreadPool.SetMinThreads to a thread count in where I could test my scenario I still had issues.&lt;/p&gt;  &lt;p&gt;I am now using a custom &lt;a href="http://coding-time.blogspot.com/2008/03/implement-your-own-parallelfor-in-c.html"&gt;Parellel.For&lt;/a&gt; which I adjusted so that I can set a different ChunkSize (set to 1) and ThreadCount for testing purposes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=483391" width="1" height="1"&gt;</description></item><item><title>WCF and DateTime.Kind pitfall</title><link>http://bloggingabout.net/blogs/ramon/archive/2010/05/19/wcf-and-datetime-kind-pitfall.aspx</link><pubDate>Wed, 19 May 2010 08:48:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:483295</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=483295</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=483295</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2010/05/19/wcf-and-datetime-kind-pitfall.aspx#comments</comments><description>&lt;p&gt;At my job (&lt;a href="http://www.companywebcast.com"&gt;Company Webcast&lt;/a&gt;) we have several API&amp;rsquo;s for our customers to use. One of those API&amp;rsquo;s allow webcasts to be created and modified and that interface has data containing dates. Our platform works with UTC date time&amp;rsquo;s as we are an international operating company so it is logical for use to store those as UTC.&lt;/p&gt;
&lt;p&gt;We use WCF and yesterday we had a very weird issue where calls failed. After investigating the issue we found out that the cause was that how the date time got supplied to our service in the message&lt;/p&gt;
&lt;p&gt;The following values are valid in an XML message:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;lt;ns1:ScheduledStart&amp;gt;2010-05-26T17:00:00+02:00&amp;lt;/ns1:ScheduledStart&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;ns1:ScheduledStart&amp;gt;2010-05-26T15:00:00Z&amp;lt;/ns1:ScheduledStart&amp;gt; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A WCF service &lt;strong&gt;accepts both values but it treats them different&lt;/strong&gt; which I did not expect! The first value became 2010-05-26 17:00 where DateTime.Kind is set to Local and the second becomes 2010-05-26 15:00 with DateTime.Kind set to UTC. &lt;strong&gt;This amazed me a bit as I assumed that both would always result in either a UTC or Local DateTime&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;The reason it fails is that another argument states the time-zone from where the live webcast will be held. This is used in combination with the DateTime to convert the DateTime value to a local time to inform the viewer about the conditions of the event. This code assumed that the incoming DateTime value would always be of kind UTC.&lt;/p&gt;
&lt;p&gt;So now our front-end api&amp;rsquo;s convert incoming DateTime values to a DateTime value with kind UTC.&lt;/p&gt;
&lt;p&gt;This could also be a problem when you persist this DateTime to for example a database and your storage logic does not convert the DateTime from/to UTC or Local depending on your needs. We use NHibernate for storage and it does not by default has a way to set UTC/Local to a &amp;lt;property&amp;gt; definition. This can really become a problem when time is part of your business logic as it is in ours as we use it to schedule tasks and it is very important to know it a time is UTC or not especially when something happens on the other side of the world.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=483295" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/WCF/default.aspx">WCF</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/NHibernate/default.aspx">NHibernate</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/DateTime/default.aspx">DateTime</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/Validation/default.aspx">Validation</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/UTC/default.aspx">UTC</category></item><item><title>How to perform a not equals comparison with NHibernate criteria api</title><link>http://bloggingabout.net/blogs/ramon/archive/2010/04/20/how-to-perform-a-not-equals-comparison-with-nhibernate-criteria-api.aspx</link><pubDate>Tue, 20 Apr 2010 19:40:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:483132</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=483132</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=483132</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2010/04/20/how-to-perform-a-not-equals-comparison-with-nhibernate-criteria-api.aspx#comments</comments><description>&lt;p&gt;I often hear that NHibernate is not usable for selecting records as it is not possible to perform a not equal comparison with the criteria api. I must admin that it took me a while before I found out but it really is more logical when you know. Lets take a look at the following example:&lt;/p&gt;
&lt;pre&gt;// Select entries where name = &amp;quot;Ramon&amp;quot;&lt;br /&gt;var criteria = DetachedCriteria.For&amp;lt;MyCoolClass&amp;gt;()&lt;br /&gt;.Add(Restrictions.Eq(&amp;quot;Name&amp;quot;, &amp;quot;Ramon&amp;quot;));&lt;/pre&gt;
&lt;p&gt;Your first reaction it to find the opposite of Restrictions.Eq but then you are amazed that it does not exists. The solution is so simple that it will almost embares you:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre&gt;// Select entries where name != &amp;quot;Ramon&amp;quot;&lt;br /&gt;var criteria = DetachedCriteria.For&amp;lt;MyCoolClass&amp;gt;()&lt;br /&gt;.Add(!Restrictions.Eq(&amp;quot;Name&amp;quot;, &amp;quot;Ramon&amp;quot;));&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/pre&gt;
&lt;p&gt;Do you see the difference? I added an exclamation mark before Restrictions.Eq to invert the restrictions operator.&lt;/p&gt;
&lt;p&gt;So now you know and probably never forget ;-)&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=483132" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/NHibernate/default.aspx">NHibernate</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/criteria+api/default.aspx">criteria api</category></item><item><title>Speeding up startup time for applications that use NHibernate</title><link>http://bloggingabout.net/blogs/ramon/archive/2010/03/30/speeding-up-startup-time-for-applications-that-use-nhibernate.aspx</link><pubDate>Tue, 30 Mar 2010 20:57:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:483040</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=483040</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=483040</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2010/03/30/speeding-up-startup-time-for-applications-that-use-nhibernate.aspx#comments</comments><description>&lt;p&gt;I just read a very cool NHibernate trick to let your application start faster that was mentioned by Ricardo Peres:&lt;/p&gt;
&lt;pre&gt;Configuration cfg = new Configuration().Configure();
IFormatter serializer = new BinaryFormatter();

using (Stream stream = File.OpenWrite(&amp;quot;Configuration.serialized&amp;quot;))
{
   serializer.Serialize(stream, cfg);
}

...

using (Stream stream = File.OpenRead(&amp;quot;Configuration.serialized&amp;quot;))
{
   cfg = serializer.Deserialize(stream) as Configuration;
}
&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=483040" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/Performance/default.aspx">Performance</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/NHibernate/default.aspx">NHibernate</category></item><item><title>Amplitube 2 VST not loaded</title><link>http://bloggingabout.net/blogs/ramon/archive/2009/11/06/amplitube-2-vst-not-loaded.aspx</link><pubDate>Fri, 06 Nov 2009 21:42:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:482428</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>15</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=482428</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=482428</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2009/11/06/amplitube-2-vst-not-loaded.aspx#comments</comments><description>&lt;p&gt;Yet again a VST did not load in my Ableton Live DAW. This time it is the Amplitube 2 VST by IK Multimedia. It did work if I launched Ableton with administrator priviledge but we al know that we shouldn&amp;#39;t do that if it is not necessary and running as administrator to load a VST sure is not very useful. I launched the excellent process monitor and filtered for stuff coming from the ableton process that did not succeed and I found out that Amplitube 2 is writing to the file:&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;C:\Windows\msocreg32.dat&lt;/p&gt;
&lt;p&gt;A very naste way from IK Multimedia to put that file in the Windows folder as normal users cannot create or modify that file. The file is created by Amplitube so it must be some sort of timer file for the product evaluation.&lt;/p&gt;
&lt;p&gt;To fix this without running as administrator and with UAC enabled do the following:&lt;/p&gt;
&lt;p&gt;&lt;ol&gt;
&lt;li&gt;Launch your DAW by right clicking its icon and select &amp;quot;Run as administrator&amp;quot;.&lt;/li&gt;
&lt;li&gt;Rescan your VST folder for new plugins. Amplitube gets loaded and the above mentioned file is created. You should be able to use the VST.&lt;/li&gt;
&lt;li&gt;Quit your DAW.&lt;/li&gt;
&lt;li&gt;Go to c:\Windows with file explorer.&lt;/li&gt;
&lt;li&gt;Find the file &amp;quot;msocreg32.dat&amp;quot;, right click it and select properties from the context menu.&lt;/li&gt;
&lt;li&gt;Go to the security tab&lt;/li&gt;
&lt;li&gt;Click &amp;quot;Edit&amp;quot;. A UAC box will appear to ask you for permission and allow it.&lt;/li&gt;
&lt;li&gt;Select the &amp;quot;Users&amp;quot; group.&lt;/li&gt;
&lt;li&gt;Set a checkmark next to &amp;quot;Modify&amp;quot; in the lower list.&lt;/li&gt;
&lt;li&gt;Click twice on &amp;quot;OK&amp;quot; to close both dialogs.&lt;/li&gt;
&lt;li&gt;Launch your DAW as you normally would.&lt;/li&gt;
&lt;/ol&gt;&lt;/p&gt;
&lt;p&gt;Now you are running as a normal user with a function Amplitube VST. This happens to more VST&amp;#39;s like for example the Native Instruments collection required quite a lot of folders to be writable by the user. Because the files are located in the Program Files folder this is not allowed. Just do the above mentioned modification on *only* the &amp;quot;c:\Program Files (x86)\Native Instruments&amp;quot; folder and no more popups to select another folder to write to.&lt;/p&gt;
&lt;p&gt;The tool called &amp;quot;process monitor&amp;quot; by Sysinternals really helps to identify such permission problems so download it if you have similar problems with other VST&amp;#39;s in your favorite DAW.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482428" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/Security/default.aspx">Security</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/Permissions/default.aspx">Permissions</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/DAW/default.aspx">DAW</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/VST/default.aspx">VST</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/Ampitube/default.aspx">Ampitube</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/Ableton/default.aspx">Ableton</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/UAC/default.aspx">UAC</category></item><item><title>NHibernate bag did not delete records when IList.Clear() was called</title><link>http://bloggingabout.net/blogs/ramon/archive/2009/09/16/nhibernate-bag-did-not-delete-records-when-ilist-clear-was-called.aspx</link><pubDate>Wed, 16 Sep 2009 09:30:00 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:482200</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=482200</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=482200</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2009/09/16/nhibernate-bag-did-not-delete-records-when-ilist-clear-was-called.aspx#comments</comments><description>&lt;p&gt;I was having a problem where NHibernate did not automatically delete childs if a collection was emptied by calling &lt;i&gt;IList.Clear()&lt;/i&gt; like in the following code example:&lt;/p&gt;
&lt;pre&gt;var s = GetSession();
var parent = s.Get&amp;lt;Parent&amp;gt;(1);
parent.Childs.Clear();&lt;/pre&gt;
&lt;p&gt;What did work ofcourse was code like the following before executing clear which marked the records for deletion and NHibernate executed the correct delete statements when the session was closed or flushed.&lt;/p&gt;
&lt;pre&gt;foreach(var c in parent.Childs) s.Delete(c);&lt;/pre&gt;
&lt;p&gt;I searched the internet for quite a while and playing around with the &lt;strong&gt;cascade&lt;/strong&gt; and &lt;strong&gt;inverse&lt;/strong&gt; attributes in the &lt;strong&gt;.hbm&lt;/strong&gt; files as I knew it had be an error in the configuration.&lt;/p&gt;
&lt;pre&gt;&amp;lt;bag name=&amp;quot;Topics&amp;quot; &lt;b&gt;cascade=&amp;quot;all&amp;quot; inverse=&amp;quot;true&amp;quot;&lt;/b&gt;&amp;gt;
	&amp;lt;key column=&amp;quot;Webcast_Id&amp;quot;/&amp;gt;
	&amp;lt;one-to-many class=&amp;quot;AddonIndex&amp;quot;/&amp;gt;
&amp;lt;/bag&amp;gt;
&lt;/pre&gt;
&lt;p&gt;After searching for quite some time I found that the problem was &lt;b&gt;cascade=&amp;quot;all&amp;quot;&lt;/b&gt;&amp;nbsp;which should have been &lt;b&gt;cascade=&amp;quot;all-delete-orphan&amp;quot;&lt;/b&gt;&amp;nbsp;and when I read that on a forum I had a very bigy WTF moment. I *really* assumed that &lt;b&gt;all&lt;/b&gt;&amp;nbsp;would do the deletion of the orphans as that is what the keyword implies, that it does *all* while in reality it does all except deletion of orphans.&lt;/p&gt;
&lt;p&gt;So I would like to suggest the (N)Hibernate team to change the names of the cascade values or just ditch the all value.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=482200" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/NHibernate/default.aspx">NHibernate</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/WTF/default.aspx">WTF</category></item><item><title>Windows 7 midi</title><link>http://bloggingabout.net/blogs/ramon/archive/2009/05/29/windows-7-midi.aspx</link><pubDate>Thu, 28 May 2009 23:46:19 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:481722</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>21</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=481722</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=481722</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2009/05/29/windows-7-midi.aspx#comments</comments><description>&lt;p&gt;My midi hardware it working nice in my DAW home studio but today I noticed that I do not have the ability to change the default midi out device in Windows 7. After googling around it seems that this was also the case in Windows Vista. But luckily there are options to configure the default out device!&lt;/p&gt;  &lt;p&gt;The first that I found was the &lt;a href="http://akkordwechsel.de/15-windows-vista-und-der-midi-mapper/"&gt;Windows Vista MIDI Mapper control panel&lt;/a&gt; and minutes later the &lt;a href="http://www.benryves.com/products/vistamidi"&gt;Vista MIDI fix&lt;/a&gt;. The control panel application fixed my problem but only lists hardware midi stuff like my MIDI USB keyboards and the hardware midi output of my Creative card as the Vista MIDI fix application lists more midi out options but I haven&amp;#39; not tested those yet.&lt;/p&gt;  &lt;p&gt;Both applications run without any problems here on my Windows 7 RC x64 installation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=481722" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/MIDI/default.aspx">MIDI</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/Control+Panel/default.aspx">Control Panel</category></item><item><title>OpenSUSE 11.1 VirtualBox additions</title><link>http://bloggingabout.net/blogs/ramon/archive/2009/05/05/opensuse-11-1-virtualbox-additions.aspx</link><pubDate>Tue, 05 May 2009 08:55:54 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:481598</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=481598</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=481598</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2009/05/05/opensuse-11-1-virtualbox-additions.aspx#comments</comments><description>&lt;p&gt;I tried to install the virtualbox machine additions in my OpenSUSE guest but had some problems. Mouse integration worked but display resizing did not. It turned out that I just didn’t read the output from the additions package well.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Remove all &amp;quot;Modes&amp;quot; lines from the &amp;quot;Screen&amp;quot; section and any Option &amp;quot;PreferredMode&amp;quot; lines from &amp;quot;Monitor&amp;quot; sections.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Did that by removing the Option from the Monitor section and all Modes lines from the subsections of the Screen section and it now working as it should with display resizing. The only thing that does not work is clipboard sharing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=481598" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/OpenSUSE/default.aspx">OpenSUSE</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/VirtualBox/default.aspx">VirtualBox</category></item><item><title>Cool finalizer assert trick</title><link>http://bloggingabout.net/blogs/ramon/archive/2009/04/12/cool-finalizer-assert-trick.aspx</link><pubDate>Sun, 12 Apr 2009 13:24:11 GMT</pubDate><guid isPermaLink="false">813b6dfd-644e-4573-a816-eebab56ba0d0:481501</guid><dc:creator>Ramon Smits</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/rsscomments.aspx?PostID=481501</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://bloggingabout.net/blogs/ramon/commentapi.aspx?PostID=481501</wfw:comment><comments>http://bloggingabout.net/blogs/ramon/archive/2009/04/12/cool-finalizer-assert-trick.aspx#comments</comments><description>&lt;p&gt;I just saw a cool trick done in a finalizer of a class. When a class implements IDisposable then its creator needs to call Dispose when it is finishen. Lots of developers forget this and that usually results in system resources that are locked until the garbage collector thinks its time to do its work.&lt;/p&gt;  &lt;p&gt;The code construction I saw was:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;~MyCoolClass()     &lt;br /&gt;{      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; System.Diagnostics.Debug.Assert(false);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Dispose(false);      &lt;br /&gt;}&amp;#160;&amp;#160;&amp;#160; &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;I have never thought of doing this but it makes sense to just add a assert to a finalizer to get notified that you didn’t dispose the object. The finalizer will never be called if it would because of the GC.SuppressFinalize(this); statement that should be done when calling IDisposable.Dispose on the object.&lt;/p&gt;  &lt;p&gt;It could be that you are getting this in a service and then this doesn’t make any sense but then you could just log an error instead.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=481501" width="1" height="1"&gt;</description><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/.Net/default.aspx">.Net</category><category domain="http://bloggingabout.net/blogs/ramon/archive/tags/CSharp/default.aspx">CSharp</category></item></channel></rss>