<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://bloggingabout.net/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Ramon Smits</title><subtitle type="html">Tell me your secrets and i&amp;#39;ll tell you mine</subtitle><id>http://bloggingabout.net/blogs/ramon/atom.aspx</id><link rel="alternate" type="text/html" href="http://bloggingabout.net/blogs/ramon/default.aspx" /><link rel="self" type="application/atom+xml" href="http://bloggingabout.net/blogs/ramon/atom.aspx" /><generator uri="http://communityserver.org" version="4.0.30619.63">Community Server</generator><updated>2008-02-25T09:23:00Z</updated><entry><title>Appending data to a sql text or ntext column</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/06/20/appending-data-to-a-sql-text-or-ntext-column.aspx" /><id>/blogs/ramon/archive/2008/06/20/appending-data-to-a-sql-text-or-ntext-column.aspx</id><published>2008-06-20T11:52:53Z</published><updated>2008-06-20T11:52:53Z</updated><content type="html">&lt;p&gt;Today I came accross a problem where nvarchar data got larger than the maximum that can be stored in a record. I had to convert to a ntext column and append the data to it.&lt;/p&gt; &lt;p&gt;I quickly found out that I needed to use the UPDATETEXT function in combination with the TEXTPTR and DATALENGTH functions.&lt;/p&gt; &lt;p&gt;When you are working with the ntext type then the output of DATALENGTH must be divided by two to get the string length as it returns the length of the data in bytes.&lt;/p&gt;&lt;pre&gt;DECLARE @TextToAppend nvarchar(max)
SET @TextToAppend = &amp;#39;Append this piece of text&amp;#39;

DECLARE @pointer binary(16)
DECLARE @length int

SELECT
	@pointer = TEXTPTR(MyLargeTextColumn)
	,@length = DATALENGTH(MyLargeTextColumn)/2 -- Needed for ntext
FROM
	MyTableWithLargeTextColumn
WHERE
	ID = @ID

UPDATETEXT MyTableWithLargeTextColumn.MyLargeTextColumn @pointer @length 0 @TextToAppend
&lt;/pre&gt;
&lt;p&gt;&amp;nbsp; &lt;p&gt;The above SQL code appends the text @TextToAppend to column MyTableWithLargeTextColumn.MyLargeTextColumn for the record with @ID.
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=460694" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="sql" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/sql/default.aspx" /><category term="UpdateText" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/UpdateText/default.aspx" /></entry><entry><title>Simplify string resources management for localization</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/06/05/simplify-string-resources-management-for-localization.aspx" /><id>/blogs/ramon/archive/2008/06/05/simplify-string-resources-management-for-localization.aspx</id><published>2008-06-05T09:29:05Z</published><updated>2008-06-05T09:29:05Z</updated><content type="html">&lt;p&gt;Every dotnet developer will eventually do something with localization. That is &amp;#39;working with multiple languages for presentation&amp;#39;. This post is not about solving lay-out related stuff which is about creating a good UI design which allows for RTL and LTR languages and variable with controls but about how to manage all that language data.&lt;/p&gt; &lt;h2&gt;Use a global language&lt;/h2&gt; &lt;p&gt;First you have to choose the main language used in your application. A lot of developer start with using their native language and add other translations. My native language is Dutch. If I wrote an application and want to translate it to for example Chinese. I admit that I should have knowledge about the Chinese language but it is a bit lacking. So often you want to get it translated by someone else. I think it is much easier to find somebody that can translate from English to different flavors of Chinese then from Dutch. So that would require me to first translate all Dutch literals to English. Second, if you want to stimulate people to work on your code as is often a requirement for a successful open-source project then you should use an accessible language in your code which is probably English too.&lt;/p&gt; &lt;h2&gt;Storing multi-lingual literals&lt;/h2&gt; &lt;p&gt;Microsoft thought about this and their solution for .net is the use of *.resx files. Each language has its own *.resx file and the way the designer works is that it creates a *.resx file per form/page. Maintaining these files for two or three languages for a small amount of forms or pages can be done manually but when the project becomes larger and literals are added, removed, updated or deleted then this becomes a burden.&lt;/p&gt; &lt;p&gt;You can create your own variation to store this. For example storing these literals in a format that has no references with the code or store everything in a database. A major drawback for any of these solutions is that it requires all developers to know how it works, you wont have designer support and it also needs to be as performing as the .net solution.&lt;/p&gt; &lt;p&gt;So it is best to just your the Microsoft way and remove its drawback which is all about the management of all those resx files.&amp;nbsp; &lt;/p&gt; &lt;h2&gt;Resx management&lt;/h2&gt; &lt;p&gt;So how can we maintain all those files. Visual Studio 2008 still doesn&amp;#39;t provide good support for this but luckily other people experienced the same problems and provide a solution.&lt;/p&gt; &lt;h3&gt;Synchronizing structure&lt;/h3&gt; &lt;p&gt;The first thing is about synchronizing resx files. This is where &lt;a href="http://www.screwturn.eu/ResxSync.ashx"&gt;ResxSync&lt;/a&gt; is a very nice tool. It is a command-line driven tool. It is not meant for maintaining your resx files content. It is about keeping your resx files in sync.&lt;/p&gt; &lt;p&gt;So why not do this with a editing tool? Well synchronizing is something you can do automated on for example a build server and because its XML you can easily perform checks on those synchronized files and add the results of such a scan in your build server results.&lt;/p&gt; &lt;p&gt;If you don&amp;#39;t have a build server then the other tools are of more use to you.&lt;/p&gt; &lt;h3&gt;Translating&lt;/h3&gt; &lt;p&gt;Then we still need to do the translation. Translating by hand requires you to open multiple resx files in your editor of choice. Visual Studio has a nice grid like editor but it really is a b***h to have multiple files opened. They are not in sync while editing so it takes too much time to translate.&lt;/p&gt; &lt;p&gt;There are two tools that I found that provide a similar editing experience are the &lt;a&gt;Zeta Resource Editor&lt;/a&gt; and &lt;a href="http://www.papadi.gr/Default.aspx?TabId=290"&gt;ResEx&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Differences:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;In Zeta you select multiple resx files that belong together and it loads it in one grid. ResEx is somewhat smarter because you only need to open the &amp;#39;base&amp;#39; resx and it automatically loads all translations.&lt;/li&gt; &lt;li&gt;Zeta has project support and can load multiple base resx files simultaneously.&lt;/li&gt; &lt;li&gt;Resx can hide fields which are already translated.&lt;/li&gt; &lt;li&gt;Resx has an option to add a new culture with ease.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I find Resx easier to work with as it has a simple and fast open base resx, translate missing values and close approach. Both tools miss the option to open a visual studio project file to easily edit the resx from from there. What probably would be even more cool would be that Resx be a editor within visual studio.&lt;/p&gt; &lt;p&gt;So my winner (for the moment) is &lt;a href="http://www.papadi.gr/Default.aspx?TabId=290"&gt;ResEx&lt;/a&gt;.&lt;/p&gt; &lt;h2&gt;Where to get those cool tools&lt;/h2&gt; &lt;p&gt;Zeta Resource Editor:&lt;br /&gt;&lt;a title="http://www.codeproject.com/KB/aspnet/ZetaResourceEditor.aspx" href="http://www.codeproject.com/KB/aspnet/ZetaResourceEditor.aspx"&gt;http://www.codeproject.com/KB/aspnet/ZetaResourceEditor.aspx&lt;/a&gt;&lt;/p&gt; &lt;p&gt;ResEx:&lt;br /&gt;&lt;a title="http://www.papadi.gr/Default.aspx?TabId=290" href="http://www.papadi.gr/Default.aspx?TabId=290"&gt;http://www.papadi.gr/Default.aspx?TabId=290&lt;/a&gt;&lt;/p&gt; &lt;p&gt;ResxSync:&lt;br /&gt;&lt;a title="http://www.screwturn.eu/ResxSync.ashx" href="http://www.screwturn.eu/ResxSync.ashx"&gt;http://www.screwturn.eu/ResxSync.ashx&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=459848" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="Resx" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Resx/default.aspx" /><category term="ResEx" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/ResEx/default.aspx" /><category term="Resources" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Resources/default.aspx" /><category term="Translating" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Translating/default.aspx" /><category term="ZetaResourceEditor" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/ZetaResourceEditor/default.aspx" /><category term="Localisation" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Localisation/default.aspx" /></entry><entry><title>Enso is now part of my must have list</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/06/01/enso-is-now-part-of-my-must-have-list.aspx" /><id>/blogs/ramon/archive/2008/06/01/enso-is-now-part-of-my-must-have-list.aspx</id><published>2008-06-01T13:59:00Z</published><updated>2008-06-01T13:59:00Z</updated><content type="html">&lt;p&gt;First of all what is &lt;a href="http://www.humanized.com/enso/"&gt;Enso&lt;/a&gt;? Enso is an application launcher and utility tool that uses the selected text as input and replaces it with its output (if necessary). Its a bit of a descriptive one liner and I think its better to navigate to the &lt;a href="http://www.humanized.com/"&gt;humanized&lt;/a&gt; website and look-up what it is about.&lt;/p&gt;
&lt;p&gt;I am now using it for almost one week and it really is a must have tool that I now using each and every day. Its that fast and intuitive that I feel that its productive. The whole select text and perform action approach that it uses is just too brilliant that you really get the feeling like &amp;quot;Why didn&amp;#39;t we have such a tool years ago?&amp;quot;.&lt;/p&gt;
&lt;p&gt;Nevermind.. just try it for a few days. You will definately keep it installed. If you are a keyboard fanatic that is.&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=459716" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="Tools" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Tools/default.aspx" /><category term="Enso" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Enso/default.aspx" /></entry><entry><title>My list of firefox extensions</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/05/30/my-list-of-firefox-extensions.aspx" /><id>/blogs/ramon/archive/2008/05/30/my-list-of-firefox-extensions.aspx</id><published>2008-05-30T07:31:58Z</published><updated>2008-05-30T07:31:58Z</updated><content type="html">&lt;p&gt;Firefox is my default browser and the add-ons make it even more powerful then it already is. I thought that it would be nice to share which extensions I&amp;#39;m using:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/722"&gt;NoScript&lt;/a&gt; - Easily enable java/javascript/flash per domain.&lt;/li&gt; &lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1865"&gt;Adblock Plus&lt;/a&gt; - Hide those frustrating flash ads etc.&lt;/li&gt; &lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/16"&gt;ChatZilla&lt;/a&gt; - Open an IRC link to ask a tech question in seconds.&lt;/li&gt; &lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/1843"&gt;Firebug&lt;/a&gt; - Tweak your html, JavaScript and CSS at run-time.&lt;/li&gt; &lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/5369"&gt;YSlow&lt;/a&gt; - Measure the load times of the website your developing.&lt;/li&gt; &lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/2464"&gt;FoxyProxy&lt;/a&gt; - Easily switch between proxy servers or automatically per domain.&lt;/li&gt; &lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/60"&gt;Web Developer&lt;/a&gt; - Show the lay-out of a website with/without CSS and w3c validate it in seconds.&lt;/li&gt; &lt;li&gt;&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/2410"&gt;Foxmarks&lt;/a&gt; - Synchronizes all my bookmarks between various computers at work and at home.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;The best thing is is that most add-ons work perfect in both Linux and Windows so I have the same surf experience in both worlds.&lt;/p&gt; &lt;p&gt;So which add-ons do you recommend?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=459605" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="chatzilla" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/chatzilla/default.aspx" /><category term="noscript" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/noscript/default.aspx" /><category term="FoxyProxy" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/FoxyProxy/default.aspx" /><category term="firefox" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/firefox/default.aspx" /><category term="extensions" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/extensions/default.aspx" /><category term="adblock" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/adblock/default.aspx" /><category term="Foxmarks" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Foxmarks/default.aspx" /><category term="Linux" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Linux/default.aspx" /><category term="Web Developer" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Web+Developer/default.aspx" /><category term="YSlow" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/YSlow/default.aspx" /><category term="Windows" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Windows/default.aspx" /><category term="Firebug" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Firebug/default.aspx" /><category term="add-ons" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/add-ons/default.aspx" /></entry><entry><title>PowerShell PowerTab</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/05/29/powershell-powertab.aspx" /><id>/blogs/ramon/archive/2008/05/29/powershell-powertab.aspx</id><published>2008-05-29T13:40:48Z</published><updated>2008-05-29T13:40:48Z</updated><content type="html">&lt;p&gt;Lately I found myself using the Microsoft PowerShell more often. But I am frequently missing intellisense. Especially when I want to access framework classes which I do not use that often. Luckily there is a very good extension script maintained by &lt;a href="http://thepowershellguy.com/blogs/posh/default.aspx"&gt;the powershell guy&lt;/a&gt; called &lt;a href="http://thepowershellguy.com/blogs/posh/pages/powertab.aspx"&gt;PowerTab&lt;/a&gt;. It adds all the intellisense mumbo jumbo to the powershell and make it even more usefull then it already is.&lt;/p&gt; &lt;p&gt;Go to the &lt;a href="http://thepowershellguy.com/blogs/posh/pages/powertab.aspx"&gt;PowerTab&lt;/a&gt; page&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=459584" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="Intellisense" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Intellisense/default.aspx" /><category term="PowerShell" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/PowerShell/default.aspx" /><category term="PowerTab" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/PowerTab/default.aspx" /></entry><entry><title>MonoDevelop 1.0 and Mono 1.9.1 on openSUSE 10.3</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/05/25/monodevelop-1-0-and-mono-1-9-1-on-opensuse-10-3.aspx" /><id>/blogs/ramon/archive/2008/05/25/monodevelop-1-0-and-mono-1-9-1-on-opensuse-10-3.aspx</id><published>2008-05-25T20:20:24Z</published><updated>2008-05-25T20:20:24Z</updated><content type="html">This weekend I moved from Ubuntu 7.10 to openSUSE 10.3 after using the distro in the vmware image that the mono-project hosts. I was impressed how quick it was installed and still impressed by the ease of use of its package management. I am now running the latest mono binaries (1.9.1) together with MonoDevelop 1.0. I needed to add the same repository for both and after upgrading most packages through yast I was finished.&lt;br /&gt;&lt;br /&gt;I tried opening a visual studio 2008 solution which contains an .net 2.0 project with nunit tests. It is a library used by a service. Ofcourse the service won&amp;#39;t work but the library uses sockets, generics and multi-threading code and wasn&amp;#39;t sure that my unit tests would all be successful but they did!&lt;br /&gt;&lt;br /&gt;Next test will be to see if the service can easily be ported and see if the nhibernate code will also work on mono and still get the same performance as the application on windows.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=459349" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author></entry><entry><title>Log4net Separate configuration file and custom data</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/05/15/log4net-separate-configuration-file-and-custom-data.aspx" /><id>/blogs/ramon/archive/2008/05/15/log4net-separate-configuration-file-and-custom-data.aspx</id><published>2008-05-15T07:47:41Z</published><updated>2008-05-15T07:47:41Z</updated><content type="html">&lt;h3&gt;Separate configuration file for log4net settings&lt;/h3&gt; &lt;p&gt;We always store the configuration stuff in the app.config or web.config files but at our current project we want to store settings that are different between environments outside of the default configuration files. Custom application settings and connectionstrings are stored in seperate configuration files and the log4net settings had to move too. Our configuration files are now named:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;web.config/app.config&lt;/li&gt; &lt;li&gt;connectionstrings.config&lt;/li&gt; &lt;li&gt;appsettings.config&lt;/li&gt; &lt;li&gt;log4net.config&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Getting log4net configured to read the settings from the log4net.config file was easy. It only needed the following attribute statement in the assembly info file:&lt;/p&gt; &lt;p&gt;[assembly: log4net.Config.XmlConfigurator(ConfigFile = &amp;quot;log4net.config&amp;quot;, Watch = true)]&lt;/p&gt; &lt;h3&gt;Custom properties&lt;/h3&gt; &lt;p&gt;We use the AdoNetAppender to log to the database but use several hosts to log to the same database table. We wanted to store additional information to each log message to identify which host is logging and which version it is running.&lt;/p&gt; &lt;h4&gt;Code:&lt;/h4&gt; &lt;p&gt;private void ConfigureLogging()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Reflection.Assembly assembly;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Diagnostics.FileVersionInfo versionInfo;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string versionText;  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; assembly = System.Reflection.Assembly.GetExecutingAssembly();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; versionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; versionText = versionInfo.FileVersion;  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;log4net.GlobalContext.Properties[&amp;quot;Host&amp;quot;] = System.Net.Dns.GetHostName();&lt;br /&gt;&lt;/strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;log4net.GlobalContext.Properties[&amp;quot;Version&amp;quot;] = VersionText;&lt;/strong&gt;&lt;br /&gt;}  &lt;h4&gt;Configuration:&lt;/h4&gt; &lt;p&gt;Most appenders set the &lt;strong&gt;ConversationPattern&lt;/strong&gt; parameter. To following conversation pattern uses the above custom properties. To use a custom property add &lt;em&gt;%property{&lt;strong&gt;CustomPropertyName&lt;/strong&gt;}&lt;/em&gt; to your conversation pattern.&lt;/p&gt; &lt;p&gt;&amp;lt;param name=&amp;quot;ConversationPattern&amp;quot; value=&amp;quot;%d [%property{Host}][%property{Version}][%t] %-5p %c - %m%n&amp;quot; /&amp;gt; &lt;/p&gt; &lt;p&gt;The AdoNetAppender only needs additional parameter mappings. Make sure that the parameter names match the custom property names.&lt;/p&gt; &lt;p&gt;&amp;lt;parameter&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;parameterName value=&amp;quot;@host&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dbType value=&amp;quot;String&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;size value=&amp;quot;50&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;layout type=&amp;quot;log4net.Layout.ExceptionLayout&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/parameter&amp;gt;&lt;br /&gt;&amp;lt;parameter&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;parameterName value=&amp;quot;@version&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;dbType value=&amp;quot;String&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;size value=&amp;quot;23&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;layout type=&amp;quot;log4net.Layout.ExceptionLayout&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/parameter&amp;gt; &lt;p&gt;Et voila! We now get the hostname and version info logged too.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=459006" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="Logging" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Logging/default.aspx" /><category term="Configuration" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Configuration/default.aspx" /><category term="Log4net" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Log4net/default.aspx" /></entry><entry><title>Low privileges IIS Application Pools</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/04/22/low-privileges-iis-application-pools.aspx" /><id>/blogs/ramon/archive/2008/04/22/low-privileges-iis-application-pools.aspx</id><published>2008-04-22T13:22:46Z</published><updated>2008-04-22T13:22:46Z</updated><content type="html">&lt;p&gt;When you want to create a new application pool you probably want to do this to create an application pool with least privileges for the application that you are going to run with it.&lt;/p&gt; &lt;p&gt;This article describes how to create a user account for use in an IIS application pool. This article is useful when you get one of the following messages:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;The identity of application pool is invalid, so the World Wide Web Publishing Service can not create a worker process to serve the application pool. Therefore, the application pool has been disabled.  &lt;li&gt;The identity of application pool, is invalid. If it remains invalid when the first request for the application pool is processed, the application pool will be disabled. The data field contains the error number.&lt;/li&gt;&lt;/ul&gt; &lt;h2&gt;User account&lt;/h2&gt;There are two accounts types:  &lt;ol&gt; &lt;li&gt;Domain accounts  &lt;ul&gt; &lt;li&gt;Useful when you run a web application on server A but it needs to access resource on another server within the domain. This account type can be created with the active directory users and computers management console on one of the domain controllers in your domain.&lt;/li&gt;&lt;/ul&gt; &lt;li&gt;Local accounts  &lt;ul&gt; &lt;li&gt;Useful when the application is only needs access to local files or/and accesses resources out-side of the domain with its own credentials.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ol&gt;&lt;a&gt;&lt;/a&gt; &lt;h3&gt;Create the account&lt;/h3&gt; &lt;ol&gt; &lt;li&gt;Create a user account and store its (complex) password at a &amp;#39;well known&amp;#39; but secure location.  &lt;li&gt;Remove it from the &lt;b&gt;User&lt;/b&gt; group.  &lt;li&gt;Add the user account to the &lt;b&gt;IIS_WPG&lt;/b&gt; (IIS Worker Process Group) group on the web server where you are going to run the web application.&lt;/li&gt;&lt;/ol&gt; &lt;h2&gt;Application pool&lt;/h2&gt; &lt;ol&gt; &lt;li&gt;Launch the IIS Manager  &lt;li&gt;Add an application pool  &lt;li&gt;Change the application pool and specify its identity by entering the newly created account.&lt;/li&gt;&lt;/ol&gt; &lt;h2&gt;File system&lt;/h2&gt; &lt;p&gt;The application pool probably needs read and or write access to the file system at the location where the web application is deployed. Give the account read access to the root of the web application folder and only &amp;#39;modify&amp;#39; rights to folders where it is actually needed. No need to use &amp;#39;Full control&amp;#39; rights at all.&lt;/p&gt; &lt;h2&gt;&lt;/h2&gt; &lt;h2&gt;Incorrect &amp;#39;Google&amp;#39; hits&lt;/h2&gt; &lt;p&gt;At some sites people mention that the user account needs to be part of the &amp;#39;Act as part of the operating system&amp;#39; policy but this is NOT necessary.&lt;/p&gt; &lt;h2&gt;Finished&lt;/h2&gt;You can now test this new application pool with a (new) web application.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=458327" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="Security" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Security/default.aspx" /><category term="Domain account" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Domain+account/default.aspx" /><category term="IIS" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/IIS/default.aspx" /><category term="Application Pool" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Application+Pool/default.aspx" /></entry><entry><title>Hibernate or standby wakes up computer in seconds</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/04/16/hibernate-or-standby-wakes-up-computer-in-seconds.aspx" /><id>/blogs/ramon/archive/2008/04/16/hibernate-or-standby-wakes-up-computer-in-seconds.aspx</id><published>2008-04-16T08:51:23Z</published><updated>2008-04-16T08:51:23Z</updated><content type="html">&lt;p&gt;I have this problem that when I wanted to enable one of the power-saving modes (hibernate or standby) that my computer wakes up in seconds. Sometimes almost immediately and sometimes after 10 seconds.&lt;/p&gt; &lt;p&gt;My first thought was that it had to do with my mouse but after disconnecting it I still had the problem. My second guess was the network adapter but I wanted to use the WOL feature to remotely wake up my computer.&lt;/p&gt; &lt;h3&gt;Wake On Lan&lt;/h3&gt; &lt;p&gt;Today I found out that &amp;quot;the default&amp;quot; option for my network adapter is to wake-up on any network activity instead of only WOL packets. To only wake-up when a WOL packet is send you have to make sure that the third checkbox is set. This is the same in XP and Vista.&lt;/p&gt; &lt;p align="center"&gt;&lt;a href="http://bloggingabout.net/blogs/ramon/WindowsLiveWriter/Hibernateorstandbywakesupcomputerinsecon_97CF/Eigenschappen%20van%20Broadcom%20NetXtreme%20Gigabit%20Ethernet_2.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="240" alt="Eigenschappen van Broadcom NetXtreme Gigabit Ethernet" src="http://bloggingabout.net/blogs/ramon/WindowsLiveWriter/Hibernateorstandbywakesupcomputerinsecon_97CF/Eigenschappen%20van%20Broadcom%20NetXtreme%20Gigabit%20Ethernet_thumb.png" width="210" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;h3&gt;Advanced power saving configuration&lt;/h3&gt; &lt;p&gt;I still had problems with my computer waking up at weird times and my mouse was causing this. There is a nice command-line tool to list the items that can wake up the computer and where you can disable the device its wake-up ability. &lt;/p&gt; &lt;p&gt;List the items that can wakeup the computer:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;powercfg -DEVICEQUERY wake_armed&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Disable a device:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;powercfg -DEVICEDISABLEWAKE &amp;quot;Logitech HID-compliant MX320 Laser Mouse&amp;quot;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;A commandline example:&lt;/p&gt; &lt;p align="center"&gt;&lt;a href="http://bloggingabout.net/blogs/ramon/WindowsLiveWriter/Hibernateorstandbywakesupcomputerinsecon_97CF/System%20(2)_2.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="107" alt="System (2)" src="http://bloggingabout.net/blogs/ramon/WindowsLiveWriter/Hibernateorstandbywakesupcomputerinsecon_97CF/System%20(2)_thumb.png" width="240" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p align="left"&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=458221" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="XP" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/XP/default.aspx" /><category term="Vista" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Vista/default.aspx" /><category term="Stand-by" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Stand-by/default.aspx" /><category term="powercfg" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/powercfg/default.aspx" /><category term="Hibernate" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Hibernate/default.aspx" /><category term="Power saving" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Power+saving/default.aspx" /></entry><entry><title>Reminder: For loop on the commandprompt</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/04/10/reminder-for-loop-on-the-commandprompt.aspx" /><id>/blogs/ramon/archive/2008/04/10/reminder-for-loop-on-the-commandprompt.aspx</id><published>2008-04-10T08:52:00Z</published><updated>2008-04-10T08:52:00Z</updated><content type="html">&lt;p&gt;I always forget how to loop through a set of files on the command prompt. For this reason I&amp;#39;m blogging this as a reminder for future reference.&amp;nbsp;&lt;/p&gt;&lt;p&gt;FOR %A IN (*.txt) DO ECHO %a&lt;/p&gt;&lt;p&gt;In a batch/command file the % character needs to be escaped with an additional %.&lt;/p&gt;&lt;p&gt;FOR %%A IN (%1) DO ECHO %a&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=458177" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="commandprompt" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/commandprompt/default.aspx" /></entry><entry><title>Don't hate soap use it for its standards</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/03/30/don-t-have-soap-use-it-for-its-standards.aspx" /><id>/blogs/ramon/archive/2008/03/30/don-t-have-soap-use-it-for-its-standards.aspx</id><published>2008-03-30T12:11:00Z</published><updated>2008-03-30T12:11:00Z</updated><content type="html">&lt;p&gt;I tried commenting on &lt;a href="http://udidahan.weblogs.us/"&gt;Udi Dahan&lt;/a&gt;&amp;#39;s blog on his article &amp;quot;&lt;a href="http://udidahan.weblogs.us/2008/03/28/i-hate-wsdl/"&gt;I hate wsdl&lt;/a&gt;&amp;quot; but it if failed so I respond from my blog.&lt;/p&gt;&lt;p&gt;Udi Dahan is ranting on soap after &lt;a href="http://blogs.tedneward.com/2008/03/28/Hangin+In+Vegas.aspx"&gt;Ted Neward&lt;/a&gt; article. Ted says:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;blockquote&gt;WSDL creates tightly-coupled endpoints precisely where loose coupling is necessary, WSDL encourages schema definitions that are inflexible and unevolvable, and WSDL intrinsically assumes a synchronous client-server invocation model that doesn’t really meet the scalability or feature needs of the modern enterprise. And that’s just for starters.&lt;/blockquote&gt;&lt;p&gt;Udi&amp;#39;s opinion is that soap prevents a few one-way messaging patterns where you have one request and multiple responsed. &lt;/p&gt;&lt;p&gt;I disagree with his opinion. First of all, soap *does* support one-way messages. Soap works good in fire and forget designs and the behavior is standardized. For an example in his one request multiple responses. This is the exact behaviour that you have with upnp routers with over udp. &lt;/p&gt;&lt;p&gt;The good thing of soap is that it is transport neutral and that it has *standard* ways in the messages level to add reliable messaging, routing, authentication and encryption. Ignoring these powerful attributes is just plain dumb! Soap is meant to lower communication between systems based on contracts including architectural decisions and all in transport neutral context! Loose coupling to the max without sacrifice&amp;#39;s in data *and* transport contract because the &amp;#39;transport&amp;#39; doesn&amp;#39;t support certain requirements.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m not a soap advocate and I don&amp;#39;t promote it at all. Lots of situations where you don&amp;#39;t need all this complexity but these are often the scenarios where you don&amp;#39;t need to think about a &amp;#39;service bus&amp;#39; solution at all. And if you do need it than I am a fan of a full soap aware servicebus. Too bad there are none on the market that comply to soap standards but it isn&amp;#39;t that difficult to write a soap broker for a few situations in a couple of days. &lt;/p&gt;&lt;p&gt;The only reason I hate soap is that there are several communication styles in the form of rpc/document format, the interoperability issues between frameworks and often the soap framework flexibility to easily add custom/pluggable behavior to influence all soap messages.&lt;br /&gt;&lt;br /&gt;Tim&amp;#39;s comments of soap indicate two things. The first is his inexperience with soap and the second is his assumptions that interfaces should be flexible (quote: &amp;quot;WSDL encourages schema definitions that are inflexible and unevolvable&amp;quot;). I always learned &amp;quot;interfaces once defined cast in stone&amp;quot;. If you want to change the interface then you need to define a new interface based on the original interface and change it. I surely hope Udi doesnt share Tim&amp;#39;s opinion on this as that would result in an immediate deletion of his blog in my feed reader! &lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=458104" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="soap" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/soap/default.aspx" /><category term="wsdl" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/wsdl/default.aspx" /><category term="servicebus" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/servicebus/default.aspx" /><category term="broker" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/broker/default.aspx" /><category term="webservices" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/webservices/default.aspx" /><category term="services" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/services/default.aspx" /></entry><entry><title>Watin 2.0 CTP adds Firefox support</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/03/12/watin-2-0-ctp-adds-firefox-support.aspx" /><id>/blogs/ramon/archive/2008/03/12/watin-2-0-ctp-adds-firefox-support.aspx</id><published>2008-03-12T08:48:57Z</published><updated>2008-03-12T08:48:57Z</updated><content type="html">&lt;p&gt;The developers of &lt;a href="http://watin.sourceforge.net"&gt;Watin&lt;/a&gt; released a ctp drop today of there upcoming 2.0 version. The current version only supports &lt;a href="http://www.mozilla.com/firefox/"&gt;firefox&lt;/a&gt; but that changed today.&lt;/p&gt; &lt;p&gt;Watin is a test framework which you can use from within your unittests to test your application behaviour throug internet explorer but now also with firefox.&lt;/p&gt; &lt;p&gt;&lt;a href="http://watin.sourceforge.net/firefox.html"&gt;Download Watin 2.0 CTP&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=458036" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="Browser" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Browser/default.aspx" /><category term="Testing" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Testing/default.aspx" /><category term="Framework" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Framework/default.aspx" /></entry><entry><title>Raytraced Juggler in real-time</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/03/11/raytraced-juggler-in-real-time.aspx" /><id>/blogs/ramon/archive/2008/03/11/raytraced-juggler-in-real-time.aspx</id><published>2008-03-11T09:54:10Z</published><updated>2008-03-11T09:54:10Z</updated><content type="html">&lt;p&gt;I just read a nice article from Jeff called &lt;a href="http://www.codinghorror.com/blog/archives/001073.html"&gt;Real-Time Raytracing&lt;/a&gt;. Todays desktop computers can &lt;u&gt;almost&lt;/u&gt; render the famous amiga raytraced juggler at 320x200 at real-time.&lt;/p&gt; &lt;p&gt;This says something about todays desktop power and what we can expect the coming decade especially concerning gpu&amp;#39;s.&lt;/p&gt; &lt;p&gt;If you have an interest in ray-tracing or get nostalgic feelings when you read anything about amiga then go read the article.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=458028" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="Amiga" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Amiga/default.aspx" /><category term="Raytracing" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Raytracing/default.aspx" /><category term="Gpu" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Gpu/default.aspx" /></entry><entry><title>Injected objects should not be disposed be the class that receives the instance</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/02/28/injected-objects-should-not-be-disposed-be-the-class-that-receives-the-instance.aspx" /><id>/blogs/ramon/archive/2008/02/28/injected-objects-should-not-be-disposed-be-the-class-that-receives-the-instance.aspx</id><published>2008-02-28T09:05:00Z</published><updated>2008-02-28T09:05:00Z</updated><content type="html">&lt;p&gt;I just read &lt;a href="http://hammett.castleproject.org/?p=252"&gt;Windsor: Component Burden described as a (bad) side effect&lt;/a&gt; but this is not how it should work.&lt;/p&gt;&lt;p&gt;&lt;u&gt;Disposable objects should be cleanup by its creator. This is the easiest way to define the disposing responsibility!&lt;/u&gt;&lt;/p&gt;&lt;p&gt;In the mentioned article they have a situation where&amp;nbsp; A injects X into B at construction and then worry that B doesn&amp;#39;t dispose X. Well the reason for that is that B shouldn&amp;#39;t. A should dispose X when it knows for sure that X will not be used anymore. Either at the end of the application of when it knows that B is already garbage collected.&lt;/p&gt;&lt;p&gt;&lt;b&gt;Lets start with an example by first defining X:&lt;/b&gt;&lt;/p&gt;&lt;span id="ctl00_ContentPlaceHolder1_output"&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;interface&lt;/span&gt; IX{&lt;br /&gt;    &lt;span class="rem"&gt;//...&lt;/span&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; X : IX, IDisposable{&lt;br /&gt;    &lt;span class="rem"&gt;//...&lt;/span&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;/span&gt;&lt;p&gt;&lt;b&gt;Example where A is responsible for disposing X:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span id="ctl00_ContentPlaceHolder1_output"&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; A{&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Test()    {&lt;br /&gt;        &lt;span class="kwrd"&gt;using&lt;/span&gt;(IDisposable x = &lt;span class="kwrd"&gt;new&lt;/span&gt; X()){&lt;br /&gt;            &lt;span class="kwrd"&gt;object&lt;/span&gt; b = &lt;span class="kwrd"&gt;new&lt;/span&gt; B(x);&lt;br /&gt;            &lt;span class="rem"&gt;//... doing cool stuff with b&lt;/span&gt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; B{&lt;br /&gt;    IX _x;&lt;br /&gt;    &lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; B(IX x)    {&lt;br /&gt;        _x = x;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    &lt;span class="rem"&gt;//... The cool methods of B&lt;/span&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Example where B is responsible for disposing X:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span id="ctl00_ContentPlaceHolder1_output"&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;abstract&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; A : IFactory{&lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Create&amp;lt;T&amp;gt;();&lt;br /&gt;    &lt;br /&gt;    &lt;span class="kwrd"&gt;void&lt;/span&gt; Test()    {&lt;br /&gt;        &lt;span class="kwrd"&gt;object&lt;/span&gt; b = &lt;span class="kwrd"&gt;new&lt;/span&gt; B(&lt;span class="kwrd"&gt;this&lt;/span&gt;);&lt;br /&gt;        &lt;span class="rem"&gt;//... doing cool stuff with b&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;class&lt;/span&gt; B : IDisposable{&lt;br /&gt;    IX _x;&lt;br /&gt;    &lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; C(IFactory factory)    {&lt;br /&gt;        _x = factory.Create&amp;lt;IX&amp;gt;();&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; Dispose()    {&lt;br /&gt;        IDisposable d = _x &lt;span class="kwrd"&gt;as&lt;/span&gt; IDisposable;&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(d==&lt;span class="kwrd"&gt;null&lt;/span&gt;) d.Dispose();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;In the example above you clearly see who&amp;#39;s responsible for disposing X. It&amp;#39;s creator cleansup and this is how it should be done everywhere in my humble opinion. If implementation is doing it in a different way then refactor your code asap to make it more readable and more maintainable. &lt;/p&gt;&lt;p&gt;Ofcourse these simple examples are not like the component architecture of windsor but the solution they describe there smells. If class A injects X into B at construction and B implements IDisposable then class B isn&amp;#39;t responsible for disposing X. A should do the cleanup so must know when X can be safely disposed. This implies that A should know something about B&amp;#39;s lifetime.&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Either dispose X when the application domain shutsdown; or&lt;/li&gt;&lt;li&gt;Knows when A is garbage colllected by checking for example its weak reference; or&lt;/li&gt;&lt;li&gt;Subclassing B at runtime to implement a callback or demanding B to implement a custom interface so A can subscribe to a dispose event. &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=457971" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="Design" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Design/default.aspx" /><category term="dependancy injection" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/dependancy+injection/default.aspx" /><category term="disposing" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/disposing/default.aspx" /><category term="patterns" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/patterns/default.aspx" /><category term="IDisposable" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/IDisposable/default.aspx" /><category term="responsiblity" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/responsiblity/default.aspx" /></entry><entry><title>Mssql: Cannot use bitwise operators on varbinary or numeric</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/02/25/mssql-cannot-use-bitwise-operators-op-varbinary-or-numeric.aspx" /><id>/blogs/ramon/archive/2008/02/25/mssql-cannot-use-bitwise-operators-op-varbinary-or-numeric.aspx</id><published>2008-02-25T08:23:00Z</published><updated>2008-02-25T08:23:00Z</updated><content type="html">&lt;p&gt;I want to perform bitwise operations on a varbinary colum. As it contains binary data I though that it would work but it didn&amp;#39;t&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;b&gt;This example works:&lt;/b&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;declare @a int&lt;br /&gt;declare @b int&lt;br /&gt;&lt;br /&gt;set @a = 1&lt;br /&gt;set @b = 2&lt;br /&gt;&lt;br /&gt;select @a | @b&lt;/p&gt;&lt;p&gt;&lt;b&gt;But this wont:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;declare @a varbinary(100)&lt;br /&gt;declare @b varbinary(100)&lt;br /&gt;
&lt;br /&gt;
set @a = 1&lt;br /&gt;
set @b = 2&lt;br /&gt;
&lt;br /&gt;
select @a | @b&lt;/p&gt;&lt;br /&gt;The same problem with numeric data type. So that currently leaves me without a mssql solution. I guess I have to fallback to code to perform the conversion that I need.&lt;br /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=457941" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="MSSQL" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/MSSQL/default.aspx" /><category term="bitwise operators" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/bitwise+operators/default.aspx" /><category term="sql" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/sql/default.aspx" /><category term="tsql" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/tsql/default.aspx" /><category term="varbinary" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/varbinary/default.aspx" /><category term="numeric" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/numeric/default.aspx" /></entry></feed>