<?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-06-05T11:29:05Z</updated><entry><title>What's your worst day as a coder?</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/11/11/what-s-your-worst-day-as-a-coder.aspx" /><id>/blogs/ramon/archive/2008/11/11/what-s-your-worst-day-as-a-coder.aspx</id><published>2008-11-11T10:39:27Z</published><updated>2008-11-11T10:39:27Z</updated><content type="html">&lt;p&gt;&lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2008/11/07/what-s-your-worst-day-as-a-coder.aspx"&gt;Jeremy has a nice post called what&amp;#39;s your worst day as a coder&lt;/a&gt; and I needed to post my own list:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;When I need to fix a bug in a module and opening a 7500+ LOC (non generated) class file (that really happened somewhere in the past).&lt;/li&gt; &lt;li&gt;When I interview a candidate to find out he cannot reverse an array.&lt;/li&gt; &lt;li&gt;When I&amp;#39;m using a designer for more then 10% of my time.&lt;/li&gt; &lt;li&gt;Would forced to use sourcesafe.&lt;/li&gt; &lt;li&gt;When I broke the build.&lt;/li&gt; &lt;li&gt;Would not code a single line.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Just a brainflush. Will probably update the post in the near future :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=476838" 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>Profile / ProfileBase SetPropertyValue</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/11/06/profile-profilebase-setpropertyvalue.aspx" /><id>/blogs/ramon/archive/2008/11/06/profile-profilebase-setpropertyvalue.aspx</id><published>2008-11-06T17:41:47Z</published><updated>2008-11-06T17:41:47Z</updated><content type="html">&lt;p&gt;Just fixed a very nasty bug in one of the applications I&amp;#39;m developing. In the database world there is a name for this bug which at the moment does not come up in my mind, I think it is called a &amp;#39;lost write&amp;#39; but I&amp;#39;m not sure.&lt;/p&gt; &lt;p&gt;Somewhere in a class I did the following based on a passed username:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;var profile = ProfileBase.Create(username);&lt;br /&gt;profile.SetPropertyValue(&amp;quot;test&amp;quot;, value);&lt;br /&gt;profile.Save();&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;This code (by accident) was fired by the same user that requested the page. ASP.NET&amp;#39;s default behavior for profiles is that it loads the current user profile at page start and saves it at the end. And here lies my problem!&lt;/p&gt; &lt;p&gt;The code above first writes the updated &amp;quot;test&amp;quot; value but then the page overwrites it with the old version which looks like nothing had happened.&lt;/p&gt; &lt;p&gt;So the lesson learned today is to first check if the current user is the same user I want to modify the profile for and if so use the profile instance from HttpContext.Profile. Another lesson learned is that ASP.NET profiles don&amp;#39;t use optimistic concurrency control to prevent such write patterns.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=476578" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="Profile" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Profile/default.aspx" /><category term="ASP.NET" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/ASP.NET/default.aspx" /></entry><entry><title>WCF and http (gzip/deflate) compression and Silverlight</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/11/06/wcf-and-http-gzip-deflate-compression-and-silverlight.aspx" /><id>/blogs/ramon/archive/2008/11/06/wcf-and-http-gzip-deflate-compression-and-silverlight.aspx</id><published>2008-11-06T10:11:18Z</published><updated>2008-11-06T10:11:18Z</updated><content type="html">&lt;p&gt;The last couple of days I&amp;#39;ve tried to see if it was possible to make use of standard http compression on WCF services as I had very good experiences with WSE and even asmx webservices that used http compression to save bandwidth - but more important - and have better response times for large xml messages.&lt;/p&gt;&lt;!--more--&gt; &lt;h2&gt;Tracing request/response with Fiddler&lt;/h2&gt; &lt;p&gt;I created a small test project containing a contract and both a client and a service based on that contract and launched fiddler. I discovered that WCF does NOT add the &lt;strong&gt;Accept-Encoding:&lt;/strong&gt; header with &lt;strong&gt;gzip&lt;/strong&gt; and/or &lt;strong&gt;deflate&lt;/strong&gt; values. So I fired the request again from fiddler but now I manually entered the Accept-Encoding header and the result was not compressed so I needed to first enable http compression in IIS.&lt;/p&gt; &lt;h2&gt;Enable IIS http compression for WCF services&lt;/h2&gt; &lt;p&gt;To enable http compression in IIS (6) you need to do the following:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Launch the IIS mmc snapin&lt;/li&gt; &lt;li&gt;Select the properties of &lt;strong&gt;Web sites&lt;/strong&gt;&lt;/li&gt; &lt;li&gt;Go to the &lt;strong&gt;Service&lt;/strong&gt; tab&lt;/li&gt; &lt;li&gt;Enable &lt;strong&gt;Compression application files&lt;/strong&gt;&lt;/li&gt; &lt;li&gt;Select &lt;strong&gt;OK&lt;/strong&gt;&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;This enables http compression for dynamic content but now we need to let IIS know which dynamic content to compress. I will do this with the commandline &lt;strong&gt;adsutil.vbs&lt;/strong&gt; script. Here I add http compression for &lt;strong&gt;.svc&lt;/strong&gt; files and also change the default compression level from 0 to 9.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcScriptFileExtensions &amp;quot;asp&amp;quot; &amp;quot;dll&amp;quot; &amp;quot;exe&amp;quot; &amp;quot;svc&amp;quot;&lt;br /&gt;CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcScriptFileExtensions &amp;quot;asp&amp;quot; &amp;quot;dll&amp;quot; &amp;quot;exe&amp;quot; &amp;quot;svc&amp;quot;&lt;br /&gt;CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/GZIP/HcDynamicCompressionLevel 9&lt;br /&gt;CSCRIPT.EXE ADSUTIL.VBS SET W3Svc/Filters/Compression/DEFLATE/HcDynamicCompressionLevel 9 &lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;After changing these settings you will need to restart IIS by launching &lt;strong&gt;iisreset&lt;/strong&gt;. &lt;h2&gt;Add Accept-Encoding http header to request&lt;/h2&gt; &lt;p&gt;Here we have two possibilities. The first is the easiest by just adding the property to the operation context as shown below.&lt;/p&gt;&lt;span class="Apple-style-span" style="word-spacing:0px;font:12px consolas;text-transform:none;text-indent:0px;white-space:normal;letter-spacing:normal;border-collapse:separate;orphans:2;widows:2;-webkit-border-horizontal-spacing:0px;-webkit-border-vertical-spacing:0px;-webkit-text-decorations-in-effect:none;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0;"&gt;&lt;pre style="font-size:small;margin:0em;color:black;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; (&lt;span class="kwrd"&gt;new&lt;/span&gt; OperationContextScope(client.InnerChannel))&lt;/pre&gt;&lt;pre style="font-size:small;margin:0em;color:black;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;"&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;&lt;pre style="font-size:small;margin:0em;color:black;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;    var properties = &lt;span class="kwrd"&gt;new&lt;/span&gt; HttpRequestMessageProperty();&lt;/pre&gt;&lt;pre style="font-size:small;margin:0em;color:black;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;"&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    properties.Headers.Add(HttpRequestHeader.AcceptEncoding, &lt;span class="str"&gt;&amp;quot;gzip,deflate&amp;quot;&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="font-size:small;margin:0em;color:black;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="rem"&gt;//... call here&lt;/span&gt;&lt;/pre&gt;&lt;pre style="font-size:small;margin:0em;color:black;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;"&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;}&lt;/pre&gt;&lt;/span&gt;
&lt;p&gt;The second option is creating a client message inspector by inheriting from IClientMessageInspector and configure WCF to use the message inspector for a certain end-point. The message inspector would do exactly the same as the code above but then within the WCF pipeline. I will leave that as nice exercise ;-)&lt;/p&gt;
&lt;h2&gt;WCF client &lt;/h2&gt;
&lt;p&gt;I launched my client and there I saw that the Accept-Encoding header was set in the request and that the result now got compressed by IIS but there WCF failed to decompress the result automatically so I started searching for a &lt;b&gt;EnableDecompression&lt;/b&gt; like setting that web references have on the WCF client proxy and other WCF pipeline related settings but could not find a way to let WCF decompress the gzip/deflate response. The WCF technology samples contain a compression example and I modified it a bit. It uses &lt;strong&gt;gzip&lt;/strong&gt; but that did not seem to work in fiddler so I used &lt;strong&gt;deflate&lt;/strong&gt; in the example code and that worked and I also changed the code &lt;u&gt;to NOT alter the content-type&lt;/u&gt;. Here I learned that you &lt;u&gt;&lt;strong&gt;cannot&lt;/strong&gt; change the transport properties in a &lt;strong&gt;MessageEncoder&lt;/strong&gt;&lt;/u&gt;&lt;strong&gt;. &lt;/strong&gt;But this is only needed when you want to compress your request or compress your response if you do not want IIS to do it for you (because you don&amp;#39;t use IIS). So I used a message inspector implementing IClientMessageInspector and IDispatchMessageInspector to automatically set the AcceptEncoding and ContentEncoding http headers. This was working perfectly but I could not achieve to decompress the response on the server by first detecting the &amp;quot;ContentEncoding&amp;quot; header thus I used the work around to first try to decompress it and if it fails just try to process the request as normal. I also did this in the client pipeline and this also works.&lt;/p&gt;
&lt;h2&gt;Silverlight magic&lt;/h2&gt;
&lt;p&gt;I then tried to see the behavior of Silverlight as it delegates the http request to the browser to do the actual call and there I noticed that http compression works perfectly with Silverlight on a service reference. So the browser probably decompressed the response before Silverlight will get the data stream. Which accidentally is perfect for the scenarios in which we want to make use of http compression.&lt;/p&gt;
&lt;h2&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;I now ditched this as we also need to support clients that do not set the AcceptEncoding header so I really need the ability to read the http header in request and set a &amp;quot;context&amp;quot; value to (not) compress the response and I have not found out yet how to do that per multiple concurrent requests. &lt;u&gt;I really recommend to use the IIS http compression and not try to do this with WCF hacking as described here!&lt;/u&gt; If you want to compress your request than this is probably the only way to achieve this in the current WCF version.&lt;/p&gt;
&lt;p&gt;If you want to make use of http compression in .net clients to decompress the response then just use a web reference instead of a service reference and make use of the &lt;b&gt;EnableDecompression&lt;/b&gt; setting except when you use Silverlight as the client.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=476568" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="WCF" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/WCF/default.aspx" /><category term="gzip" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/gzip/default.aspx" /><category term="deflate" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/deflate/default.aspx" /><category term="fiddler" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/fiddler/default.aspx" /><category term="HttpCompression" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/HttpCompression/default.aspx" /><category term="http" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/http/default.aspx" /><category term="Silverlight" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Silverlight/default.aspx" /></entry><entry><title>Network Load Balancing (WLBS) and virtual machines</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/10/24/network-load-balancing-wlbs-and-virtual-machines.aspx" /><id>/blogs/ramon/archive/2008/10/24/network-load-balancing-wlbs-and-virtual-machines.aspx</id><published>2008-10-24T08:23:11Z</published><updated>2008-10-24T08:23:11Z</updated><content type="html">&lt;p&gt;We where having trouble configuring a new network load balancing (WLBS) cluster. We have several host machines that each run a guest where all guests should be part of one cluster.&lt;/p&gt; &lt;p&gt;We started by preparing the first guest:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Created diskimages&lt;/li&gt; &lt;li&gt;Installed the os&lt;/li&gt; &lt;li&gt;Installed software&lt;/li&gt; &lt;li&gt;Updated all software&lt;/li&gt; &lt;li&gt;Shutdown&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;We now have a virtual machine and then&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Copied it to all host machines&lt;/li&gt; &lt;li&gt;Started all guest&lt;/li&gt; &lt;li&gt;Add all guest to a domain&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;This is where weird behavior started to occur as some guest could not communicate and worst of all we could not create a network load balancing cluster with the network load balancing manager.&lt;/p&gt; &lt;p&gt;Turns out that all guests shared the same SID and NIC id&amp;#39;s. We forgot to&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Run SysInternal&amp;#39;s NewSid tool on each guest to reset the SID&lt;/li&gt; &lt;li&gt;Remove the virtual NIC&amp;#39;s and re-adding them to reset the NIC id&amp;#39;s.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;A bit of information can be found at the following knowledge base article:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;Network Load Balancing Manager does not work with imaged servers&lt;/p&gt; &lt;p&gt;No interfaces are available for installing a new cluster&lt;/p&gt; &lt;p&gt;&lt;a href="http://support.microsoft.com/kb/828258"&gt;http://support.microsoft.com/kb/828258&lt;/a&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;So what is the lesson learned? That after copying a virtual machine to remove all NIC&amp;#39;s at first startup, rebooting AND then running NewSid BEFORE adding the guest to a domain. I knew about the SID issues as I experienced similar behavior in the old days when you created Ghost images and restored them on several machines but what is new for me is the NIC stuff.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=476054" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="Networking" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Networking/default.aspx" /><category term="WLBS" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/WLBS/default.aspx" /><category term="SID" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/SID/default.aspx" /><category term="Virtual Server" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Virtual+Server/default.aspx" /><category term="NIC" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/NIC/default.aspx" /><category term="VM" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/VM/default.aspx" /><category term="Host" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Host/default.aspx" /><category term="Cluster" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Cluster/default.aspx" /><category term="NewSid" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/NewSid/default.aspx" /><category term="Network" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Network/default.aspx" /><category term="Guest" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Guest/default.aspx" /></entry><entry><title>Windows cannot access the specified device, path, or file.  You may not have the appropriate permissions to access the item.</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/10/22/windows-cannot-access-the-specified-device-path-or-file-you-may-not-have-the-appropriate-permissions-to-access-the-item.aspx" /><id>/blogs/ramon/archive/2008/10/22/windows-cannot-access-the-specified-device-path-or-file-you-may-not-have-the-appropriate-permissions-to-access-the-item.aspx</id><published>2008-10-22T13:57:59Z</published><updated>2008-10-22T13:57:59Z</updated><content type="html">&lt;p&gt;Anyone will get this message sooner or later so the normal steps I usually do are:&lt;/p&gt; &lt;p&gt;Check if I have read/execute permissions on the file&lt;/p&gt; &lt;p&gt;Check if it is blocked because it is an internet download and then unblock it&lt;/p&gt; &lt;p&gt;Check if I&amp;#39;m the owner&lt;/p&gt; &lt;p&gt;Well today I did this on a file that I downloaden on server A, copied to a storage server and then copying it to server B to run it again. I got this message and did the steps above without any success.&lt;/p&gt; &lt;p&gt;The almighty google helped me again but not in the first few hits on the error. It guided me to a forum where the solution was posted to the message &lt;a href="http://techrepublic.com.com/5208-6230-0.html?forumID=102&amp;amp;threadID=219160&amp;amp;messageID=2215701"&gt;Windows cannot access the specified device, path, or file.&amp;nbsp; You may not have the appropriate permissions to access the item&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&amp;quot;Un-install IE Enhanced security from Windows Components. Viola problem gone&amp;quot;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I tried it and I can now execute those files although it should have worked as all security attributes on the file where set correctly. Very weird...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=475831" 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="Windows" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Windows/default.aspx" /><category term="IE" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/IE/default.aspx" /></entry><entry><title>Remote Desktop Copy &amp; Paste</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/10/17/remote-desktop-copy-amp-paste.aspx" /><id>/blogs/ramon/archive/2008/10/17/remote-desktop-copy-amp-paste.aspx</id><published>2008-10-17T09:44:45Z</published><updated>2008-10-17T09:44:45Z</updated><content type="html">&lt;p&gt;In Microsoft Virtual PC you can drag &amp;amp; drop files between your host and the virtual machines and this was (I thought) missing in remote desktop. But this feature isn&amp;#39;t missing it is just disabled at default. To enable it you must share your local drive with the remote machine/desktop session.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Open the options for your remote desktop connection&lt;/li&gt; &lt;li&gt;Go to the &amp;quot;Local Resources&amp;quot; tab.&lt;/li&gt; &lt;li&gt;Select the &amp;quot;More...&amp;quot; button in the &amp;quot;Local devices and resources&amp;quot;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;A new dialog opens to configure the resource to share.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Check the &amp;quot;Drives&amp;quot; checkbox&lt;/li&gt; &lt;li&gt;Click &amp;quot;OK&amp;quot;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;See the below screenshots to guide you in locating the checkbox.&lt;/p&gt; &lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/ramon/Remote-Desktop-Connection_5F00_2.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="240" alt="Remote Desktop Connection" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/ramon/Remote-Desktop-Connection_5F00_thumb.png" width="214" border="0" /&gt;&lt;/a&gt;&amp;nbsp;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/ramon/Remote-Desktop-Connection-_2800_2_29005F00_2.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="240" alt="Remote Desktop Connection (2)" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/ramon/Remote-Desktop-Connection-_2800_2_29005F00_thumb.png" width="235" border="0" /&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;And presto! Copy and pasting files between local and remote desktop suddenly works!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=475650" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="RDP" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/RDP/default.aspx" /><category term="Remote Desktop" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Remote+Desktop/default.aspx" /><category term="Terminal Server" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Terminal+Server/default.aspx" /></entry><entry><title>ForEach method exceptions and events</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/10/02/foreach-method-exceptions-and-events.aspx" /><id>/blogs/ramon/archive/2008/10/02/foreach-method-exceptions-and-events.aspx</id><published>2008-10-02T09:58:53Z</published><updated>2008-10-02T09:58:53Z</updated><content type="html">&lt;p&gt;I just read this article by &lt;a href="http://weblogs.asp.net/gunnarpeipman/archive/2008/09/26/foreach-method-and-blonde-me.aspx"&gt;DigiMortal about List&amp;lt;T&amp;gt;.ForEach and exceptions&lt;/a&gt;. His assumption was that if an exception occurs while processing one of the items that the next item would still be processed which is not that case. Maybe he was aware of this (well he is now!) and somebody did not add exception handling to the method called (which by the way is not that methods responsibility IMHO).&lt;/p&gt; &lt;p&gt;Turns out that I had a similar problem a long time ago with events.&lt;/p&gt; &lt;p&gt;class Test&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public event EventHandler MyEvent;  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void DoMyEvent()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(MyEvent!=null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MyEvent(this, EventArgs.Empty);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;} &lt;p&gt;This example allows subscriptions to the MyEvent event. At a certain time I experienced weird application behaviour and the cause was that a subscription raised an exception causing other subscribers not receiving my precious event! As this implementation did not know how stable the subscribers were it needed a redesign and that was the following:&lt;/p&gt; &lt;p&gt;class Test&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private readonly List&amp;lt;EventHandler&amp;gt; _myEvent = new List&amp;lt;EventHandler&amp;gt;();  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public event EventHandler MyEvent&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; add { _myEvent.Add(value); }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; remove { _myEvent.Remove(value); }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }  &lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void DoMyEvent()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (var subscriber in _myEvent)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; subscriber.Invoke(this, EventArgs.Empty);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; catch (Exception)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Do some logging here or just BAN the subscription!&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;} &lt;p&gt;This could contain some errors as I just did this from notepad but you bet the idea. The cool thing is that you can rewrite the DoMyEvent method to invoke all subscriptions simultaneously which can be very neat if they do expensive remote calls.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=474996" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term=".Net" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/.Net/default.aspx" /><category term="events" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/events/default.aspx" /><category term="Exception handling" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Exception+handling/default.aspx" /><category term="Asynchronous" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Asynchronous/default.aspx" /></entry><entry><title>NHibernate implicit join quirk</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/09/19/nhibernate-implicit-join-quirk.aspx" /><id>/blogs/ramon/archive/2008/09/19/nhibernate-implicit-join-quirk.aspx</id><published>2008-09-19T09:14:28Z</published><updated>2008-09-19T09:14:28Z</updated><content type="html">&lt;p&gt;Recently I had a problem where in an HQL query the result contained duplicates. I used implicit joins in the my query and it looked like the following:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;from&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Order o&lt;br /&gt;where&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (o.Code like :literal&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR o.CustomData like :literal&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR o.Customer.Code like :literal&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR o.Customer.Name like :literal)&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;This HQL got translated to the following TSQL query:&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;select &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order0_.* -- all order columns removed for readability &lt;br /&gt;from &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nhtest.dbo.Order order0_, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; nhtest.dbo.Customer customer0_ &lt;br /&gt;where &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (order0_.Code like @p0 ) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR(order0_.CustomData like @p1 ) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;OR(customer0_.Code like @p2&amp;nbsp; and order0_.CustomerId=customer0_.Id) -- Incorrect join!&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR(customer0_.Name like @p3&amp;nbsp; and order0_.CustomerId=customer0_.Id) -- Incorrect join!&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;The join isn&amp;#39;t correct as it should have been the following:&lt;/p&gt; &lt;blockquote&gt;select &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order0_.* -- all order columns removed for readability &lt;br /&gt;from &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;nhtest.dbo.Order order0_, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; JOIN nhtest.dbo.Customer customer0_ ON (order0_.CustomerId=customer0_.Id)&lt;br /&gt;&lt;/strong&gt;where &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; order0_.Code like @p0 ) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR(order0_.CustomData like @p1 ) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR(customer0_.Code like @p2) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OR(customer0_.Name like @p3) &lt;br /&gt;) &lt;/blockquote&gt; &lt;p&gt;The (N)Hibernate documentation says that it is better to make use of the explicit join syntax and that is working correct. So do not use implicit joins (well, atleast not in version 2.0.0.GA)!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=474755" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="NHibernate" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/NHibernate/default.aspx" /><category term="HQL" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/HQL/default.aspx" /><category term="Implicit join" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Implicit+join/default.aspx" /></entry><entry><title>Google Chrome 'Paste and go'</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/09/18/google-chrome-paste-and-go.aspx" /><id>/blogs/ramon/archive/2008/09/18/google-chrome-paste-and-go.aspx</id><published>2008-09-18T13:30:19Z</published><updated>2008-09-18T13:30:19Z</updated><content type="html">&lt;p&gt;&lt;a href="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/ramon/New-Tab-_2D00_-Google-Chrome_5F00_2.png"&gt;&lt;img style="border-right:0px;border-top:0px;border-left:0px;border-bottom:0px;" height="268" alt="Google Chrome Paste and go" src="http://bloggingabout.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/ramon/New-Tab-_2D00_-Google-Chrome_5F00_thumb.png" width="255" align="left" border="0" /&gt;&lt;/a&gt;I already love all those nice little details in for example gmail but I just discovered a nice feature in Google Chrome. When you have an url on your clipboard that you want to paste in the address bar you just right click it and then this popup context menu appears.&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;There you have the &amp;#39;Paste and go&amp;#39; option! I tried this in Firefox and Internet Explorer but not Safari and Opera but I think Chrome is the first with such an option.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=474722" 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="Chrome" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Chrome/default.aspx" /></entry><entry><title>Import/export by using DataSet WriteXml and ReadXml</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/09/02/import-export-by-using-dataset-writexml-and-readxml.aspx" /><id>/blogs/ramon/archive/2008/09/02/import-export-by-using-dataset-writexml-and-readxml.aspx</id><published>2008-09-02T08:05:47Z</published><updated>2008-09-02T08:05:47Z</updated><content type="html">&lt;p&gt;I just tried to create a simpel import/export feature in one of our applications based on XML. My first thought was: Create a &lt;b&gt;typed dataset&lt;/b&gt; and for export just &lt;b&gt;serialize &lt;/b&gt;it to XML with the &lt;b&gt;WriteXml &lt;/b&gt;method and for import &lt;b&gt;deserialize&lt;/b&gt; it by using &lt;b&gt;ReadXml&lt;/b&gt;.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Well the write part created exactly the file that I wanted but the ReadXml did not work as expected. No exceptions occured but no data was read so I could not add the data to the database. I remembered that I probably had to do with a schema option. Either at the write or the read. I wanted the write to behave like it was doing now. So browsing MSDN gave me the answer that I had to use the &lt;b&gt;XmlReadMode.InferSchema&lt;/b&gt; parameter to the &lt;b&gt;ReadXml&lt;/b&gt; method. That uses typed dataset information to check for data consistency.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;So now my simple import/export is working again and it appears that my (typed) dataset knowledge was a bit rusted by not using it for quite a while.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=474419" 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>Just bought : Creative Zen Stone</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/08/29/just-bought-creative-zen-stone.aspx" /><id>/blogs/ramon/archive/2008/08/29/just-bought-creative-zen-stone.aspx</id><published>2008-08-29T08:44:52Z</published><updated>2008-08-29T08:44:52Z</updated><content type="html">I was browsing the internet for a couple of small mp3 players. There is ofcourse the Apple brand with several players. But I have something againts Apple behaviour towards their audio stuff. So my primary requirements were:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Volume adjustable&lt;/li&gt;&lt;li&gt;Must be recognized as a portable drive&lt;/li&gt;&lt;li&gt;Screen is not necessary as I want to use it for running&lt;/li&gt;&lt;li&gt;At least 2GB&lt;/li&gt;&lt;li&gt;Must support mp3, wma&lt;/li&gt;&lt;li&gt;Should be small and be able to strap it around my arm or clip it&lt;/li&gt;&lt;li&gt;It should not cost more the 50 EUR.&lt;/li&gt;&lt;li&gt;Should not a a weird design&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Ogg support would also be a good plus aswell as good earphones but I&amp;#39;ve never seen a review out of the box player with good earphones.&lt;br /&gt;&lt;br /&gt;So that got me this list: &lt;br /&gt;&lt;ul&gt;&lt;li&gt;Samsung YP-S2 2GB&lt;/li&gt;&lt;li&gt;Creative ZEN Stone 2GB (also available as Plus)&lt;/li&gt;&lt;li&gt;Philips SA2820&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Not that big.. &lt;br /&gt;&lt;br /&gt;Some thoughts about the list:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;I was hoping that an Cowon iAudio made it to the list as these are known for their excellent low noise output.I was hoping that an Cowon iAudio made it to the list as these are known for their excellent low noise output.&lt;/li&gt;&lt;li&gt;Both the Samsung and the Philips do not have a clip which the Creative has with a silicon skin where a clip is attached.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The Samsung is the only one with ogg support.&lt;/li&gt;&lt;li&gt;The Creative is the cheapest.&lt;/li&gt;&lt;li&gt;Creative has a bracelet as an accessory for the Zen stone.&lt;/li&gt;&lt;/ul&gt;I finally decided to buy the Creative Zen Stone 2GB with the bracelet.&lt;br /&gt;&lt;br /&gt;It got delivered yesterday and&lt;br /&gt;&lt;ul&gt;&lt;li&gt;It charged quit fast&lt;/li&gt;&lt;li&gt;Starts fast enough but it does a pop&lt;/li&gt;&lt;li&gt;The usb speed is good enough&lt;/li&gt;&lt;li&gt;I plugged in my Sennheiser headset to compare some low/hi bitrate mp3&amp;#39;s and the difference between VBR ~128kbps and ~250kbps was very noticable&lt;/li&gt;&lt;li&gt;The bracelet can stretch and is long enough to even put it around my neck!&lt;/li&gt;&lt;li&gt;The Zen Stone 2GB - by default - seems to have a small builtin speaker.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;So toninght my first run with the stone ;-)&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=474014" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="mp3 player" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/mp3+player/default.aspx" /><category term="Philips" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Philips/default.aspx" /><category term="Apple" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Apple/default.aspx" /><category term="Zen" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Zen/default.aspx" /><category term="Running" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Running/default.aspx" /><category term="Creative" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Creative/default.aspx" /><category term="Stone" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Stone/default.aspx" /><category term="mp3" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/mp3/default.aspx" /><category term="Hardware" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Hardware/default.aspx" /><category term="Samsung" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Samsung/default.aspx" /></entry><entry><title>WCF and large messages</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/08/20/wcf-and-large-messages.aspx" /><id>/blogs/ramon/archive/2008/08/20/wcf-and-large-messages.aspx</id><published>2008-08-20T11:46:00Z</published><updated>2008-08-20T11:46:00Z</updated><content type="html">&lt;p&gt;Today I got this nice InvalidOperationException:&lt;/p&gt;
&lt;blockquote&gt;System.InvalidOperationException: There is an error in XML document (11, 11657). ---&amp;gt; System.Xml.XmlException: The maximum string content length quota (8192) has been exceeded while reading XML data. This quota may be increased by changing the MaxStringContentLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader.&lt;br /&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;br /&gt;The reason was that the message contained an element that had more then 8k of textual data as seen in the exception message. Problem was that I could not adjust this as I am using WCF and it is using an XML reader internally. &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.basichttpbinding.readerquotas.aspx"&gt;Luckily MSDN comes to the rescue&lt;/a&gt;:&lt;br /&gt;&lt;br /&gt;I now set the values in code:&lt;/p&gt;
&lt;blockquote&gt;  var binding = new BasicHttpBinding(BasicHttpSecurityMode.None);&lt;br /&gt;  binding.MaxReceivedMessageSize = 256*1024;&lt;br /&gt;  binding.ReaderQuotas.MaxStringContentLength = 64 * 1024;&lt;/blockquote&gt;
&lt;p&gt;The only thing is that you need to reference System.Runtime.Serialization to set it from code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=472151" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="XML" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/XML/default.aspx" /><category term="Messages" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Messages/default.aspx" /><category term="Serialization" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/Serialization/default.aspx" /><category term="WCF" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/WCF/default.aspx" /></entry><entry><title>You want C:\Users on XP too? Read here how</title><link rel="alternate" type="text/html" href="/blogs/ramon/archive/2008/08/13/you-want-c-users-on-xp-too-read-here-is-how.aspx" /><id>/blogs/ramon/archive/2008/08/13/you-want-c-users-on-xp-too-read-here-is-how.aspx</id><published>2008-08-13T16:32:00Z</published><updated>2008-08-13T16:32:00Z</updated><content type="html">&lt;p&gt;At both home and work I use Vista and XP resulting me typing &lt;b&gt;&amp;quot;C:\Users&amp;quot;&lt;/b&gt; in XP and &lt;b&gt;&amp;quot;C:\Documents and Settings&amp;quot;&lt;/b&gt; in Vista which - of course - don&amp;#39;t work. You cannot really change those paths except when you install Vista or XP with the pre configuration tool.&lt;/p&gt;
&lt;p&gt;But there is a solution!&lt;/p&gt;
&lt;p&gt;Both Vista and XP can access NTFS volumes and the NTFS format has support for hardlinks. XP and 2003 do not have native support for all these NTFS features and you normally need a resourcekit tool to create such entries. The Link Shell Extension adds all support for these NTFS features to the Windows Explorer in XP, 2003 and Vista.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install the &lt;a href="http://schinagl.priv.at/nt/hardlinkshellext/hardlinkshellext.html"&gt;Link Shell Extension&lt;/a&gt;  &lt;/li&gt;
&lt;li&gt;Navigate to &lt;b&gt;&amp;quot;C:\&amp;quot;&lt;/b&gt;  &lt;/li&gt;
&lt;li&gt;Create a Junction from &lt;b&gt;&amp;quot;C:\Documents and Settings&amp;quot;&lt;/b&gt; to &lt;b&gt;&amp;quot;C:\Users&amp;quot;&lt;/b&gt; on XP and a Junction from &lt;b&gt;&amp;quot;C:\Users&amp;quot;&lt;/b&gt; to &lt;b&gt;&amp;quot;C:\Documents and Settings&amp;quot;&lt;/b&gt; on Vista&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;And Presto! I now have access to &lt;b&gt;&amp;quot;C:\Users&amp;quot;&lt;/b&gt; on XP which is a delight.&lt;/p&gt;
&lt;p&gt;This tool is also very useful when you manage an FTP server on Windows so you can put a large file in multiple paths while only have one hardcopy on disk (in this case create a hard or symbolic link).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://bloggingabout.net/aggbug.aspx?PostID=471478" width="1" height="1"&gt;</content><author><name>Ramon Smits</name><uri>http://bloggingabout.net/members/Ramon-Smits/default.aspx</uri></author><category term="NTFS" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/NTFS/default.aspx" /><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="junction" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/junction/default.aspx" /><category term="hardlink" scheme="http://bloggingabout.net/blogs/ramon/archive/tags/hardlink/default.aspx" /></entry><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></feed>