<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Fabse-on-Blog</title>
	<atom:link href="http://blog.fabse.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fabse.net</link>
	<description>Was bewegt mich; was nicht!</description>
	<lastBuildDate>Thu, 03 May 2012 16:11:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>BizTalk: Optimizing For High Throughput</title>
		<link>http://blog.fabse.net/2012/05/03/biztalk-optimizing-for-high-throughput/</link>
		<comments>http://blog.fabse.net/2012/05/03/biztalk-optimizing-for-high-throughput/#comments</comments>
		<pubDate>Thu, 03 May 2012 16:11:48 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[architecture]]></category>
		<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=672</guid>
		<description><![CDATA[In a customer project we made the observation that receiving many large IDOCs from a SAP system was really slow. We were using a WCF-Custom receive location and the port had a map. The BizTalk group consists of multiple application &#8230; <a href="http://blog.fabse.net/2012/05/03/biztalk-optimizing-for-high-throughput/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In a customer project we made the observation that receiving many large IDOCs from a SAP system was really slow. We were using a WCF-Custom receive location and the port had a map. The BizTalk group consists of multiple application servers but it was clear that only one BizTalk server was receiving the IDOCs at a time. Neither the network nor the cpu were significantly used. There had to be something we could do to improve performance.</p>
<p>The real problem is the transactional model which BizTalk is using. The adapter needs to physically receive one IDOC. It constructs a well-understood XML message from it using the XML disassembler and performs a map. The result is published to the messagebox and the IDOC is signaled as received. Basically assuming Microsoft did a good job concerning their performance, most of the time should be lost inside the map:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image85.png" width="220" height="316" /></p>
<p>If you take a look at the physical connection between the SAP system and the BizTalk server you see a short transfer of one IDOC followed by a lengthy wait. To improve throughput we had the need to reduce these wait times. The extra challenge was to avoid introducing high costs or risks.</p>
<p>The solution was to remove the map and to replace the XML disassembler with the pass-through pipeline:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image86.png" width="220" height="159" /></p>
<p>This obviously changed the resulting messages. The receive port was directly bound to a MSMQ send port using a local queue. The queue exists on all BizTalk application server to increase load balancing. A second receive location was added to receive messages from that queue and to do the needed work (XML disassembler + map). </p>
<p>The solution even allows to switch between both behaviors on the fly through enabling/disabling the correct receive locations. We only used proven technology and already existing BizTalk artifacts.</p>
<p>The throughput increased by roughly 300% but your mileage may vary. You should also consider that using queues makes your application server stateful.</p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2012/05/03/biztalk-optimizing-for-high-throughput/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>BizTalk error: Data at the root level is invalid.</title>
		<link>http://blog.fabse.net/2012/05/02/biztalk-error-data-at-the-root-level-is-invalid/</link>
		<comments>http://blog.fabse.net/2012/05/02/biztalk-error-data-at-the-root-level-is-invalid/#comments</comments>
		<pubDate>Wed, 02 May 2012 11:35:13 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=668</guid>
		<description><![CDATA[Problem: My orchestration looks perfectly fine with no error symbols anywhere but whenever I try to build the solution I get: Error 1 Data at the root level is invalid. Line 1, position 1. C:\…\MyProject\MyOrchestration.odx 1 1 Cause: I was &#8230; <a href="http://blog.fabse.net/2012/05/02/biztalk-error-data-at-the-root-level-is-invalid/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p><strong>Problem: </strong>My orchestration looks perfectly fine with no error symbols anywhere but whenever I try to build the solution I get:</p>
<blockquote><p><strong>Error 1 Data at the root level is invalid.</strong> Line 1, position 1. C:\…\MyProject\MyOrchestration.odx 1 1</p>
</blockquote>
<p><strong>Cause:</strong> I was moving the orchestration file from one BizTalk project to another through holding shift and doing drag’n’drop in the solution explorer.</p>
<p>The btproj file has this new content:</p>
<blockquote><p>&lt;ItemGroup&gt;<br />&nbsp;&nbsp;&nbsp; &lt;<strong><font style="background-color: #c0504d">Schema</font></strong> Include=&#8221;MyOrchestration.odx&#8221;&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TypeName&gt;MyOrchestration&lt;/TypeName&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Namespace&gt;MyNamespace&lt;/Namespace&gt;<br />&nbsp;&nbsp;&nbsp; &lt;/<strong><font style="background-color: #c0504d">Schema</font></strong>&gt;<br />&lt;/ItemGroup&gt;</p>
</blockquote>
<p><strong>Solution:</strong> The move operation within Visual Studio is broken. You either have to do it in a different way (maybe add existing item?) or you adjust the project file after moving the orchestration:</p>
<blockquote><p>&lt;ItemGroup&gt;<br />&nbsp;&nbsp;&nbsp; &lt;<strong><font style="background-color: #9bbb59">XLang</font></strong> Include=&#8221;MyOrchestration.odx&#8221;&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;TypeName&gt;MyOrchestration&lt;/TypeName&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Namespace&gt;MyNamespace&lt;/Namespace&gt;<br />&nbsp;&nbsp;&nbsp; &lt;/<strong><font style="background-color: #9bbb59">XLang</font></strong>&gt;<br />&lt;/ItemGroup&gt;</p>
</blockquote>
<p>The error should be gone.</p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2012/05/02/biztalk-error-data-at-the-root-level-is-invalid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linq Kwik-e: Order by</title>
		<link>http://blog.fabse.net/2012/04/07/linq-kwik-e-order-by/</link>
		<comments>http://blog.fabse.net/2012/04/07/linq-kwik-e-order-by/#comments</comments>
		<pubDate>Sat, 07 Apr 2012 09:34:35 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[Linq]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=666</guid>
		<description><![CDATA[Imagine you are writing a SQL select statement to read all products from your database ordered by category and then by name, it would look like: SELECT *FROM productsORDER BY category, name Please note that my textual description follows the &#8230; <a href="http://blog.fabse.net/2012/04/07/linq-kwik-e-order-by/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Imagine you are writing a SQL select statement to read all products from your database ordered by <strong>category</strong> and then by <strong>name</strong>, it would look like:</p>
<blockquote><p>SELECT *<br />FROM products<br />ORDER BY <strong>category, name</strong></p>
</blockquote>
<p>Please note that my textual description follows the notation of the order statements.
<p>Now lets imagine we have a list of products in C# and want to sort them the same way using Linq:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image82.png" width="429" height="87">
<p>As you can see, it follows the natural description.</p>
<p>I like to directly use the Linq extension methods instead of Linq so I was used to write the same as:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image83.png" width="401" height="65"></p>
<p>To get the same ordered list as in the samples before, I had to reverse the order of the orderby statements. This feels very unnatural and is easy to get wrong. Luckily I discovered the ThenBy() method:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image84.png" width="421" height="88"></p>
<p>This way, I can write the statements in the same order as I was used to!</p>
<p><em>You may want to read my </em><a href="http://blog.fabse.net/2011/08/29/linq-kwik-e/"><em>earlier Linq Kwik-e</em></a><em> as well <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Zwinkerndes Smiley" src="http://blog.fabse.net/wp-content/uploads/wlEmoticon-winkingsmile7.png"></em></p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2012/04/07/linq-kwik-e-order-by/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silent Install Of Firefox [Windows Azure Compute]</title>
		<link>http://blog.fabse.net/2012/03/24/silent-install-of-firefox-windows-azure-compute/</link>
		<comments>http://blog.fabse.net/2012/03/24/silent-install-of-firefox-windows-azure-compute/#comments</comments>
		<pubDate>Sat, 24 Mar 2012 12:39:30 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Install]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=660</guid>
		<description><![CDATA[While developing in Windows Azure I am RDP-ing into the roles from time to time. It is quite handy to be able to browse the web from there as well. I decided to let my roles download and install Firefox &#8230; <a href="http://blog.fabse.net/2012/03/24/silent-install-of-firefox-windows-azure-compute/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>While developing in Windows Azure I am RDP-ing into the roles from time to time. It is quite handy to be able to browse the web from there as well. I decided to let my roles download and install Firefox on every publish. Here is how I did it:</p>
<p>I downloaded the <a href="http://bootstrap.codeplex.com/">Windows Azure Bootstrapper</a> and put it into my solution (type content, copy if newer):</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image81.png" width="204" height="64" /></p>
<p>The second and last step was adding the following startup-task to my ServiceDefinition.csdef:</p>
<blockquote><p>&lt;Task commandLine=&quot;StartupBins\BootStrapper.exe -lr c:\Resources\firefoxsetup.exe -get http://download.mozilla.org/?product=firefox-11.0 -run c:\Resources\firefoxsetup.exe -Args /S&quot; executionContext=&quot;elevated&quot; taskType =&quot;background&quot; /&gt;</p>
</blockquote>
<p>It downloads the current Firefox version to c:\Resources\ and executes the silent install.</p>
<p><strong>Publish!</strong> <em>Works! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blog.fabse.net/wp-content/uploads/wlEmoticon-smile4.png" /></em></p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2012/03/24/silent-install-of-firefox-windows-azure-compute/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Windows Azure Compute to host a proxy [Update]</title>
		<link>http://blog.fabse.net/2012/03/24/using-windows-azure-compute-to-host-a-proxy-update/</link>
		<comments>http://blog.fabse.net/2012/03/24/using-windows-azure-compute-to-host-a-proxy-update/#comments</comments>
		<pubDate>Sat, 24 Mar 2012 11:42:33 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[DIY]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=654</guid>
		<description><![CDATA[If you have admin access, you can disable the Windows Firewall with just with this small command: netsh firewall set opmode disable That’s it! At this point it is working out-of-the-box! The downside is that it uses a not secured &#8230; <a href="http://blog.fabse.net/2012/03/24/using-windows-azure-compute-to-host-a-proxy-update/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>If you have admin access, you can disable the Windows Firewall with just with this small command:</p>
<blockquote><p>netsh firewall set opmode disable</p>
</blockquote>
<p>That’s it! At this point it is working out-of-the-box! <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blog.fabse.net/wp-content/uploads/wlEmoticon-smile3.png" /> The downside is that it uses a not secured connection and basic authentication.</p>
<p>I invested some time trying to get a secure https connection working between my browser and the proxy but it just does not work (for me).</p>
<p>I was realizing, that I really wanted an VPN endpoint and not a proxy but I also decided to not work any longer on this!</p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2012/03/24/using-windows-azure-compute-to-host-a-proxy-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Windows Azure Compute to host a proxy [Sunday project]</title>
		<link>http://blog.fabse.net/2012/03/19/using-windows-azure-compute-to-host-a-proxy-sunday-project/</link>
		<comments>http://blog.fabse.net/2012/03/19/using-windows-azure-compute-to-host-a-proxy-sunday-project/#comments</comments>
		<pubDate>Mon, 19 Mar 2012 00:20:21 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Sunday Project]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=648</guid>
		<description><![CDATA[If you are following my blog for some time or you hear me talking in person, you know that my ISP (or only my specific internet connection) is fast, but I just am not able to watch youtube without waiting &#8230; <a href="http://blog.fabse.net/2012/03/19/using-windows-azure-compute-to-host-a-proxy-sunday-project/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>If you are following my blog for some time or you hear me talking in person, you know that my ISP (or only my specific internet connection) is fast, but I just am not able to watch youtube without waiting forever. I was playing around with some proxies in the past and the new task for this Sunday is to prepare a Windows Azure app hosting a proxy server for me. This blogpost does not point out the shortest way to do it but the steps I took to solve my task.</p>
<p>I started with installing Windows 8 Consumer preview into a virtual machine. I then installed Visual Studio 11 beta. Using the web plattform installer, I installed the Windows Azure SDK:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image62.png" width="654" height="400" /></p>
<p>and it fails:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image63.png" width="654" height="453" /></p>
<p>Google to the rescue: There is a way, you can <a href="http://www.windowsazure.com/en-us/develop/net/other-resources/windows-azure-on-windows-8/">install all of it manually</a>. Yeah! Only half an hour later:</p>
<blockquote><p>Visual Studio 11 does not yet support the Windows Azure SDK for .NET. </p>
</blockquote>
<p>So I switched back to my Visual Studio 2010 on Vista and created a new project:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image64.png" width="654" height="466" /></p>
<p>and I added a Web Role:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image65.png" width="643" height="402" /></p>
<p>The idea at this point is to have a working squid installation inside the web project and starting it using a startup task. I created a new folder called Squid:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image66.png" width="278" height="404" /></p>
<p>I downloaded and extracted a windows binary version of squid 2.7 into a subfolder of my new squid folder. There are <a href="http://squid.acmeconsulting.it/Squid27.html">some install and configuration steps</a>. I am going to do the configuration part within the downloaded stuff but I need to create a small commandline script to do the install part.</p>
<p>My folder looks now like so:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image67.png" width="219" height="354" /></p>
<p>And my startup script is:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image68.png" width="382" height="329" /></p>
<p>The squid.conf file is well documented but also very large. Here is an excerpt of my changes to the file:</p>
<blockquote><p>acl authenticated_users proxy_auth REQUIRED</p>
</blockquote>
<p>It creates a access control list with the name authenticaded_users which are somehow authenticated.</p>
<blockquote><p>http_access allow authenticated_users     <br />http_access deny all</p>
</blockquote>
<p>This tells squid to allow an authenticated user everything and all other can do nothing. My idea here is to create a proxy just for known users (…me) and not a public proxy.</p>
<blockquote><p>auth_param negotiate program C:/squid/libexec/mswin_negotiate_auth.exe     <br />auth_param negotiate children 5      <br />auth_param negotiate keep_alive on</p>
</blockquote>
<p>And finally I am telling squid to authenticate users against known windows users.</p>
<p>So I need to add a line to my startup script to add a new windows user account:</p>
<blockquote><p>net user fabse superLongAndSecretPassword /ADD</p>
</blockquote>
<p>I think, Squid is now completely configured and ready to go. I need to add my install batch as a startup task and I need to make the inbound port for squid accessible from the outside. This is done in the ServiceDefinition.csdef:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image69.png" width="650" height="359" />    </p>
<p>I am feeling lucky and are now going to deploy it in Windows Azure!</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image70.png" width="310" height="182" /></p>
<p>The first time you need to setup your certificate:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image71.png" width="650" height="437" /></p>
<p>You create a certificate, give it a name and you need to upload it into your windows azure subscription.</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image72.png" width="510" height="345" /></p>
<p>I am creating a new service:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image73.png" width="542" height="637" /></p>
<p>After this certificate-setup-trouble I am finally able to configure my publish settings:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image74.png" width="650" height="437" /></p>
<p>I think, I will need to have remote desktop access:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image75.png" width="425" height="318" /></p>
<p>Next and Publish! … and it failed <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://blog.fabse.net/wp-content/uploads/wlEmoticon-smile2.png" /></p>
<p>There is some trouble with my startup task. I have to change the command to:</p>
<blockquote><p>&lt;Task commandLine=&quot;Squid/InstallAndStartSquid.cmd&quot; executionContext=&quot;elevated&quot; taskType=&quot;background&quot; /&gt;</p>
</blockquote>
<p>The path was wrong and the publishing tool is verifying the path. I also had to change the batch script file-properties to “Copy always”. The script itself is now in another location as the squid source so I added a first step inside the script to change the directory:</p>
<blockquote><p>cd ..\..\Squid</p>
</blockquote>
<p>Please note as well that I changed the taskType to background. This change enables me to RDP into the role instance even if my task needs very long, fails or blocks.</p>
<p><strong>Ok Publish!</strong> It is busy now, should take around 15 minutes to completion.</p>
<p>and it failed…completely! It did not copy squid, it did not created the user account. I reproduced the execution on the target compute instance:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image76.png" width="650" height="320" /></p>
<p>The pathes are wrong! I was thinking the current path is in the Squid folder, were the batch file is, but is one folder up so I need to remove one “up” command. The second one is really obvious. My super long password is too long. Doooh!</p>
<p>Fixing these two small bugs and publish! The Publish wizzard notices that the current stage ist already running. I want to replace it. In real environments you would deploy to a staging instance in this case. it was some kind of inplace update. It is using the exact same compute instance without rebooting.</p>
<p>The user is there, squid was copied, the service is there but it is not running. Not all files of the squid distribution made it into the deployment package. It is just not handy to have a full app as solution files inside a Visual Studio solution. I am going to removal all project files and replace them with a zip archive.</p>
<p>My solution folder holds now a zip archive and the command line version of 7zip:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image77.png" width="236" height="97" /></p>
<p>I removed the xcopy step in my batch file and replaced it with:</p>
<blockquote><p>7z x -oc:\ squid.zip</p>
</blockquote>
<p><strong>aaaaannddd Publish!</strong> (I deleted the old deployment to get a fresh machine)</p>
<p>Everything is there and running but it does not work. So I RDPed into the compute instance again. I configured the IE on the server to use the proxy and it worked! So the problem could be the endpoint. I configured it as a TCP endpoint but I am now going to try HTTP. Quick change and <strong>Publish!</strong></p>
<p>Ok so there are two new problems: negotiate authentication is not really good working and I cannot bind squid to listen to a wildcard ip address.</p>
<p>Squid is able to handle multiple authentications methods, but all have their own pitfalls:</p>
<ul>
<li>Basic: I can get it working, but it transmits the password in cleartext over the wire and is therefor insecure</li>
<li>NTLM: Old. I did not tried it.</li>
<li>Negotiate: Newer. Works somehow, but it the browser tries to add a domain to the user all the time.</li>
<li>Digest: Improved version of basic, which does not transmit cleartext passwords over the wire.</li>
</ul>
<p>I decided to use Basic authentication for now and I am going to make a follow up project trying to establish a secure https connection between the browser and the proxy.</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image78.png" width="510" height="104" /></p>
<p>The second problem is that Azure does not allow wildcard IP addresses. I do not understand why this is the case, but nevertheless I need to workaround it. I removed the simple wildcard config “http_port 3128” and replaced it with an include statement:</p>
<blockquote><p>include c:/squid/http_port.config</p>
</blockquote>
<p>Now I need to have a way to create this config file. I borrowed some source from <a href="http://blog.smarx.com/posts/tutorial-running-the-mongoose-web-server-in-windows-azure">Steve Marx</a> and inserted them into my ServiceDefinition.csdef:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image79.png" width="654" height="189" /></p>
<p>This will (hopefully) provide the IP and port of my instance as an environment variable. The following command creates the needed config include file:</p>
<blockquote><p>echo http_port %ADDRESS%:%PORT% &gt; c:\squid\http_port.config</p>
</blockquote>
<p>So I included it in my startup batch script. <strong>Delete and Publish!</strong></p>
<p>It did not work, because the environment variables were not existing. I noticed the possibility to provide environment variables directly to the startup task:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image80.png" width="654" height="203" /></p>
<p><strong>Delete and Publish (again)!</strong></p>
<p>I could not connect to the instance using any method. I thought something went very wrong. So I deleted and published again! Same result. Looks like my ISP decided that this DNS name changes its address too often and blocked it completely(?). I changed my PC to the use the Google DNS 8.8.8.8 instead and I could connect again.</p>
<p>There is somehow an issue with the Windows Firewall on the server. This is the one last step to take to get this thing working. I need to investigate it and make everything work in a way which not requires me to shutdown the firewall completely. But this really needs to wait now, as it is not even Sunday anymore <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://blog.fabse.net/wp-content/uploads/wlEmoticon-winkingsmile6.png" /></p>
<p>But I was curious at last and measured the network bandwich and making a real world test watching a video on youtube. Both were terrible slow <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-sadsmile" alt="Sad smile" src="http://blog.fabse.net/wp-content/uploads/wlEmoticon-sadsmile.png" /> Maybe I should switch to an Azure data center in Europe?</p>
<p><em>This blog entry is getting really long anyway, I think no one will ever read it. But nevertheless I am publishing it. It will be at least a (good) reference for myself.</em></p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2012/03/19/using-windows-azure-compute-to-host-a-proxy-sunday-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Train your body AND brain</title>
		<link>http://blog.fabse.net/2012/03/18/train-your-body-and-brain/</link>
		<comments>http://blog.fabse.net/2012/03/18/train-your-body-and-brain/#comments</comments>
		<pubDate>Sun, 18 Mar 2012 14:41:24 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[Aus dem Leben]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[My Setup]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=624</guid>
		<description><![CDATA[&#160; I am lately into a serious body-shaping program. I started to do more fitness and changing my eating habits. It is working out quite nice for the last months. I am staying 2 or 3 evenings at the fitness &#8230; <a href="http://blog.fabse.net/2012/03/18/train-your-body-and-brain/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>&#160;</p>
<p>I am lately into a serious body-shaping program. I started to do more fitness and changing my eating habits. It is working out quite nice for the last months. I am staying 2 or 3 evenings at the fitness center&#160; for two or more hours every week. This is very much time! It bores me driving the bike for up to 60 minutes.</p>
<p><a title="BeyondPod Podcast Manager" href="https://play.google.com/store/apps/details?id=mobi.beyondpod"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://blog.fabse.net/wp-content/uploads/image60.png" width="244" height="201" /></a>I think, I found a solution to use this time to train my brain as well. I started to manually download interesting video content with my pc and sync it to the phone. I started with a <a href="http://www.hanselman.com/blog/DeveloperStandUpComedyCoding4Fun.aspx">fun talk</a> from Scott Hanselman. But the preparation needs to be done in advance and it is taxing to do this manually all the time.</p>
<p>I decided to subscribe for some video podcasts within my favourite web app <a href="http://www.google.de/reader">Google Reader</a>. While there exists an app for it on the phone, it is not really funny for videos because it does not download them in advance. My mobile data plan is to small and the network is not fast enough for video streaming. BeyondPod Podcast Manager solves this task nicely. I told it to update the subscribed feeds every evening when I am at home on WIFI only. Nice!</p>
<p>So far I subscribed to:</p>
<ul>
<li><a href="http://channel9.msdn.com/Shows/This+Week+On+Channel+9">This Week On Channel 9</a> </li>
<li><a href="http://channel9.msdn.com/Shows/Cloud+Cover">Cloud Cover on Channel 9</a> </li>
<li>Day[9] (<a href="http://day9.tv/">web</a>, <a href="http://blip.tv/day9tv/rss">feed</a>) </li>
</ul>
<p>I am going to need a larger SD Card in the future becaus of all the video content, but this is okay.</p>
<p>Viewing videos on a small sceen is less painful than I thought. If the video is displaying source code or the visual studio IDE, it is zoomed in anyway most of the time. And if there is a Starcraft game in the video, I am well aware of all units and I am able to distinguesh them using only some pixels <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://blog.fabse.net/wp-content/uploads/wlEmoticon-winkingsmile5.png" /></p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2012/03/18/train-your-body-and-brain/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Appfabric Caching: What is the DataCacheException really telling?</title>
		<link>http://blog.fabse.net/2012/02/23/appfabric-caching-what-is-the-datacacheexception-really-telling/</link>
		<comments>http://blog.fabse.net/2012/02/23/appfabric-caching-what-is-the-datacacheexception-really-telling/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 16:22:02 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[BizTalk]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[lessons learned]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=620</guid>
		<description><![CDATA[I had the opportunity to use Windows Server AppFabric Caching in a project which is successful running in production for some time now. I was able to collect some knowledge around using AppFabric Caching in development and in production. The &#8230; <a href="http://blog.fabse.net/2012/02/23/appfabric-caching-what-is-the-datacacheexception-really-telling/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I had the opportunity to use Windows Server AppFabric Caching in a project which is successful running in production for some time now. I was able to collect some knowledge around using AppFabric Caching in development and in production.</p>
<p>The usage of the cache is quite simple and you will find it well documented within the MSDN.</p>
<p>I consider the descriptiveness of the provided error messages as the real pain points. It basically always looks like this:</p>
<blockquote><p>Microsoft.ApplicationServer.Caching.<strong>DataCacheException</strong>
<p>ErrorCode&lt;ERRCA0017&gt;: SubStatus&lt;ES0006&gt;: There is a temporary failure. Please retry later.</p>
</blockquote>
<p>It feels like the hole caching project throws this exception no matter what the real reason is. I am thinking, I really managed to produce all of them <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smiley" src="http://blog.fabse.net/wp-content/uploads/wlEmoticon-smile1.png">
<p>Here is a short list for you to check against, if you managed to see this exception as well:
<ul>
<li><strong>Permissions:</strong> You are not permitted to connect to the cache server. You should check, whether you granted the calling user access.</li>
<li><strong>Security settings in client and server differ:</strong> You can configure message-level and transport-level security on client and server separately and they basically need to be identically.</li>
<li><strong>The cache service is not running:</strong> If your server which is running the cache service has a power cycle (planned or unplanned), the cache service will not be running anymore. The default setting is to start the service “manually”. My best advice is to change this to “automatically” immediately after installation.</li>
<li><strong>The cache is throttling:</strong> If the server is low on available physically memory, the service stops to accept new items.</li>
<li><strong>You disposed the Factory:</strong> While the DataCacheFactory implements IDisposable, you MUST NOT put it in a using-block. If you dispose the factory, the DataCacheClient stops working.</li>
<li><strong>You need at least one more free thread (?):</strong> This one involves some guessing and is maybe wrong, so your mileage may vary. We were instantiating the DataCacheFactory in a BizTalk-host instance with a high count of active processes starting at the same time. I used a static factory instance and double checked locking for creating it. So one process was creating the factory and all others were actively waiting for it to finish. If the number of active processes exceeds the number of allowed threads per CPU in total, it looks like the instantiation of the factory always times out. The solution was to replace the lock-statement with a Monitor.TryEnter / Monitor.Exit and throwing a <a href="http://msdn.microsoft.com/en-us/library/microsoft.xlangs.basetypes.retrytransactionexception%28v=bts.10%29.aspx" target="_blank">RetryTransactionException</a> if it was not possible to get the lock. This behavior made threads available again which in turn allowed the Factory creation to succeed. I really cannot tell if my guessed starting point was right, but after the change was made, the error was gone for good.</li>
</ul>
<p>But if you worked your way around all this error messages, you get a really stable product which is fun to work with.</p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2012/02/23/appfabric-caching-what-is-the-datacacheexception-really-telling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Visual Studio Achievements</title>
		<link>http://blog.fabse.net/2012/01/20/my-visual-studio-achievements/</link>
		<comments>http://blog.fabse.net/2012/01/20/my-visual-studio-achievements/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 22:06:34 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[Blogwelt]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=617</guid>
		<description><![CDATA[Finally, you can take a look at my achievements in Visual Studio as well! You may do this as well! --- Unterst&#252;tze mich und meinen Blog und kauf dir was Nettes (&#252;ber diesen Link)<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Finally, you can take a look at my achievements in Visual Studio as well!</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="My Visual Studio Achievements" border="0" alt="My Visual Studio Achievements" src="http://blog.fabse.net/wp-content/uploads/image59.png" width="171" height="244" /></p>
<p><a title="Channel 9 - Visual Studio Achievements" href="http://channel9.msdn.com/achievements/visualstudio">You may do this</a> as well!</p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2012/01/20/my-visual-studio-achievements/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>String.GetHashCode() Internals</title>
		<link>http://blog.fabse.net/2011/10/25/string-gethashcode-internals/</link>
		<comments>http://blog.fabse.net/2011/10/25/string-gethashcode-internals/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 18:11:56 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/2011/10/25/string-gethashcode-internals/</guid>
		<description><![CDATA[While I was eating dinner, I had this somehow suprising question in my mind: How is String.GetHashCode() implemented? Is it fast? It needs a linear time based on the length of the string. This is understandable if you think about &#8230; <a href="http://blog.fabse.net/2011/10/25/string-gethashcode-internals/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>While I was eating dinner, I had this somehow suprising question in my mind: How is String.GetHashCode() implemented? Is it fast?</p>
<p>It needs a linear time based on the length of the string. This is understandable if you think about what it is doing. It needs to generate a “Fingerprint”-number based on its content, so you need to take a look at all the content at least once. So it is O(N).</p>
<p>I was going to do something more useful while I noticed all the precompiler conditions. That is very interesting! The function returns different results whether it is compiled for 32bit or 64bit. The debug version of the framework (Microsoft internal only?) even changes its resulting hashcodes with every buildnumber.</p>
<blockquote><p>We want to ensure we can change our hash function daily.     <br />This is perfectly fine as long as you don&#8217;t persist the      <br />value from GetHashCode to disk or count on String A       <br />hashing before string B.&#160; Those are bugs in your code.      </p>
</blockquote>
<p>So you better avoid storing hashcodes and you should not exchange hashcodes across process-boundarys. Your communication partner may use a different number of bits!</p>
<p>Last but not least: the result is not stored but recomputed every time you call the function. The implementation is following the advice to not store its result itself.</p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2011/10/25/string-gethashcode-internals/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Youtube wieder schneller im Firefox</title>
		<link>http://blog.fabse.net/2011/10/19/youtube-wieder-schneller-im-firefox/</link>
		<comments>http://blog.fabse.net/2011/10/19/youtube-wieder-schneller-im-firefox/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 19:45:40 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[Allgemein]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/2011/10/19/youtube-wieder-schneller-im-firefox/</guid>
		<description><![CDATA[While I had decided to write new articles only in English, the following article has a pure German audience so I figured out to make an exception for this article. Wer wie ich seinen Internetanschluss bei der Telekom hat, dem &#8230; <a href="http://blog.fabse.net/2011/10/19/youtube-wieder-schneller-im-firefox/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p><em>While I had decided to write new articles only in English, the following article has a pure German audience so I figured out to make an exception for this article.</em></p>
<p>Wer wie ich seinen Internetanschluss bei der Telekom hat, dem kann nicht entgangen sein, dass Youtube Videos extrem langsam sind und man manchmal außer der drehenden Ladeanimation nichts zu sehen bekommt. Es war zuletzt wirklich sehr schlimm.</p>
<p>Es gab bis vor kurzem den <a href="https://addons.mozilla.org/de/firefox/addon/telekom-youtube-turbo/" target="_blank">Telekom Youtube Turbo</a>, der zwar funktionierte, dies aber sehr geheimnisvoll gemacht hat. Es gibt keine Einstellungen und auch keine Beschreibungen. Er ist auch für den Firefox 8 nicht verfügbar.</p>
<p>Frustriert habe ich mich umgeschaut und gelesen, dass der Telekom-Proxy wohl schneller ist. Vermutlich hat auch der Telekom Youtube Turbe den verwendet. Ich wollte aber nicht, dass alle meine Seitenaufrufe durch den Proxy laufen, daher habe ich mir FoxyProxy besorgt, was viele Optionen erlaubt. Die Einrichtung geht in wenigen einfachen Schritten:</p>
<p>1. Das AddOn <a href="https://addons.mozilla.org/de/firefox/addon/foxyproxy-standard/" target="_blank">FoxyProxy</a> in den Firefox installieren und den Firefox neu starten.</p>
<p>2. In den Optionen von FoxyProxy einen neuen Proxy anlegen* und ihn auf den Telekom-Proxy (www-proxy.t-online.de mit Port 80) einstellen.</p>
<p><a href="http://blog.fabse.net/wp-content/uploads/image56.png" rel="lightbox[605]"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Proxydetails einstellen" border="0" alt="Proxydetails einstellen" src="http://blog.fabse.net/wp-content/uploads/image_thumb10.png" width="244" height="171" /></a></p>
<p>3. Bei den Url-Mustern noch ein Muster für Youtube hinterlegen:</p>
<p><a href="http://blog.fabse.net/wp-content/uploads/image57.png" rel="lightbox[605]"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Url-Muster für Youtube hinterlegen" border="0" alt="Url-Muster für Youtube hinterlegen" src="http://blog.fabse.net/wp-content/uploads/image_thumb11.png" width="244" height="172" /></a></p>
<p>4. Der FoxyProxy-Modus sollte “Verwende Proxies entsprechend ihrer konfigurierten Muster und Prioritäten” sein. Das sollte bei euch dann alles so aussehen:</p>
<p><a href="http://blog.fabse.net/wp-content/uploads/image58.png" rel="lightbox[605]"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="Verwende Proxies entsprechend ihrer konfigurierten Muster und Prioritäten" border="0" alt="Verwende Proxies entsprechend ihrer konfigurierten Muster und Prioritäten" src="http://blog.fabse.net/wp-content/uploads/image_thumb12.png" width="244" height="187" /></a></p>
<p>Und nun wieder viel Spaß auf Youtube!</p>
<p>&#160;</p>
<p>*Es gibt Bonuspunkte, wenn man den Proxy Magenta färbt <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://blog.fabse.net/wp-content/uploads/wlEmoticon-winkingsmile4.png" /></p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2011/10/19/youtube-wieder-schneller-im-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dependency injection &amp; their Pitfalls*</title>
		<link>http://blog.fabse.net/2011/09/25/dependency-injection-their-pitfalls/</link>
		<comments>http://blog.fabse.net/2011/09/25/dependency-injection-their-pitfalls/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 17:32:56 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[dependency injection]]></category>
		<category><![CDATA[Prism]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/2011/09/25/dependency-injection-their-pitfalls/</guid>
		<description><![CDATA[After I had my dependency injection set up and running, I noticed a shift in my way of developing. I started to be more focused on only one class and their implementation at a time. If I felt the need &#8230; <a href="http://blog.fabse.net/2011/09/25/dependency-injection-their-pitfalls/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>After I had my dependency injection set up and running, I noticed a shift in my way of developing. I started to be more focused on only one class and their implementation at a time. If I felt the need for another service instance, I just added it to the constructor and would go on coding. I thought that the dependency injection container would take care of how to create the new service for me.</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image54.png" width="232" height="214" /></p>
<p>This is nothing fancy so far. After coding for straight 20 minutes without any testing in between I decided to test it. I noticed my machine was doing really nothing but burning cpu for a bunch of seconds and quitting then with a StackoverflowException. I had no idea what was going on.</p>
<p>The exception was not really telling too much about the problem. The only thing was a truncated stacktrace. It had something to do with the container trying to create an instance of a service. Without any further information it would be hard to pinpoint this so I decided to search for trace information. I am using <a href="http://compositewpf.codeplex.com/" target="_blank">Microsoft Prism</a> with the Unity container for inversion of control. So does Unity provide any traces of what is going on? Surprisingly, this is not the case! There is no magic switch.</p>
<p>So I had no choice but removing constructor arguments here and there until I found the root problem. I had managed to create a circular reference:</p>
<p><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image61.png" width="232" height="214" /></p>
<p><a href="http://msdn.microsoft.com/en-us/library/ff660897%28v=pandp.20%29.aspx" target="_blank">The MSDN</a> is telling me, that it is my responsibility to prevent this and it also warns of endless recursion. Endless recursion always ends with an StackoverflowException.</p>
<p>My solution was simple. I removed the circular reference through removing one reference. It was not used anyway.</p>
<p><em>*The name of this article is freely leaned on the name of the blog </em><a href="http://eai-technologies-and-their-pitfalls.blogspot.com/" target="_blank"><em>EAI Technologies &amp; their Pitfalls</em></a><em> of an ex coworker</em> <img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="http://blog.fabse.net/wp-content/uploads/wlEmoticon-winkingsmile3.png" /></p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2011/09/25/dependency-injection-their-pitfalls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make static legacy code testable</title>
		<link>http://blog.fabse.net/2011/09/09/how-to-make-static-legacy-code-testable/</link>
		<comments>http://blog.fabse.net/2011/09/09/how-to-make-static-legacy-code-testable/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 14:32:37 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[mocking]]></category>
		<category><![CDATA[unittesting]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/2011/09/09/how-to-make-static-legacy-code-testable/</guid>
		<description><![CDATA[I had the opportunity to work in a team developing and improving a large legacy application. The project had some unit tests already but there was a long way to go in terms of increasing the test coverage. Many internal &#8230; <a href="http://blog.fabse.net/2011/09/09/how-to-make-static-legacy-code-testable/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I had the opportunity to work in a team developing and improving a large legacy application. The project had some unit tests already but there was a long way to go in terms of increasing the test coverage.</p>
<p>Many internal services are implemented as a bunch of static methods like so:</p>
<pre class="code"><span style="color: blue"><strong>static</strong> class </span><span style="color: #2b91af">SeriousService
</span>{
    <span style="color: blue">public <strong>static</strong> int </span>DoSomething(<span style="color: blue">string </span>value)
    {
        <span style="color: green">//&lt;side effects here&gt;
        </span><span style="color: blue">return </span>17;
    }
}</pre>
<p>And the usages of these static classes are all over the place like so:</p>
<pre class="code"><span style="color: blue">class </span><span style="color: #2b91af">SomeModule
</span>{
    <span style="color: blue">public void </span>ExecuteOrder(<span style="color: #2b91af">Order </span>order)
    {
        <span style="color: green">//...
        </span><span style="color: #2b91af">SeriousService</span>.<strong>DoSomething</strong>(order.Name);
        <span style="color: green">//...
    </span>}
}</pre>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image51.png" width="423" height="88" /></p>
<p>The challenge was to write a unit test which would test ExecuteOrder() without side effects in SeriousService.</p>
<p>A state-of-the-art application would insert the service through dependency injection into SomeModule. You could provide a mock for the service and you would be ready to write your unittest.</p>
<p>Unluckily, changing the caller or the signature of the callee was no option to me. The chance to introduce incompatibilities somewhere in the huge family of applications and tools was to high.</p>
<p>After some thinking I came up with the idea to extract the functionality out of the static service:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image52.png" width="609" height="240" /></p>
<p>The “new” static service endpoint has now a private static reference to the service implementation and all public methods forward there calls to this implementation. The new service implementation is based on an extracted interface. Caller and callee are still unchanged (red rectangle). In code, it looks like so:</p>
<pre class="code"><span style="color: blue">interface </span><span style="color: #2b91af">ISeriousService
</span>{
    <span style="color: blue">int </span>DoSomething(<span style="color: blue">string </span>value);
}

<span style="color: blue">class </span><span style="color: #2b91af">SeriousServiceImpl </span>: <span style="color: #2b91af">ISeriousService
</span>{
    <span style="color: blue">public int </span>DoSomething(<span style="color: blue">string </span>value)
    {
        <span style="color: green">//&lt;side effects here&gt;
        </span><span style="color: blue">return </span>17;
    }
}

<span style="color: blue">static class </span><span style="color: #2b91af">SeriousService
</span>{
    <span style="color: blue">private static </span><span style="color: #2b91af">ISeriousService </span>_seriousService
                            = <span style="color: blue">new </span><span style="color: #2b91af">SeriousServiceImpl</span>();

    <span style="color: green">//Static endpoint
    </span><span style="color: blue">public static int </span>DoSomething(<span style="color: blue">string </span>value)
    {
        <span style="color: blue">return </span>_seriousService.DoSomething(value);
    }
}</pre>
<p>Until here, all we have done is to insert another level of indirection. But this enables us to replace the real functionality of the service with a mock:</p>
<p><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image53.png" width="634" height="247" /></p>
<p>This is possible if the service “endpoint” gets a public method to replace its implementation:</p>
<pre class="code"><span style="color: blue">static class </span><span style="color: #2b91af">SeriousService
</span>{
    <span style="color: blue">private static </span><span style="color: #2b91af">ISeriousService </span>_seriousService
                            = <span style="color: blue">new </span><span style="color: #2b91af">SeriousServiceImpl</span>();

<strong>    <span style="color: blue">public static void </span>ReplaceServiceImpl(<span style="color: #2b91af">ISeriousService </span>newImpl)
    {
        _seriousService = newImpl;
    }</strong>

    <span style="color: green">//Static endpoint
    </span><span style="color: blue">public static int </span>DoSomething(<span style="color: blue">string </span>value)
    {
        <span style="color: blue">return </span>_seriousService.DoSomething(value);
    }
}</pre>
<p>Having all of this in place you can write your unit test for the module without the fear of any unforseen sideeffects:</p>
<pre class="code">[<span style="color: #2b91af">TestFixture</span>]
<span style="color: blue">class </span><span style="color: #2b91af">SomeModuleTest
</span>{
    [<span style="color: #2b91af">Test</span>]
    <span style="color: blue">public void </span>ExecuteOrder_handles_condition_xyz()
    {
        <span style="color: green">//Setup
        </span><span style="color: blue">var </span>service = <span style="color: blue">new </span><span style="color: #2b91af">Mock</span>&lt;<span style="color: #2b91af">ISeriousService</span>&gt;();
        <span style="color: #2b91af">SeriousService</span>.<strong>ReplaceServiceImpl</strong>(service.Object);

        <span style="color: green">//Execute
        </span><span style="color: blue">new </span><span style="color: #2b91af">SomeModule</span>().ExecuteOrder(<span style="color: blue">new </span><span style="color: #2b91af">Order</span>());

        <span style="color: green">//Asserts here
    </span>}
}</pre>
<p>There is one more thing left to be done. Obviously the real instance of SeriousServiceImpl is gone for good after executing the test. So if you want to be able to reuse the current AppDomain for another test you either need to recover it somehow or you have to replace it in every test. I have a nice solution for this as well but this article is already long enough.</p>
<p>So summing up, we saw how to introduce another level of indirection into our architecture. We used it to swap the implementation of a static service as was needed to write unit tests without side effects.</p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2011/09/09/how-to-make-static-legacy-code-testable/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>String.Split() Kwik-e</title>
		<link>http://blog.fabse.net/2011/09/01/string-split-kwik-e/</link>
		<comments>http://blog.fabse.net/2011/09/01/string-split-kwik-e/#comments</comments>
		<pubDate>Thu, 01 Sep 2011 09:23:30 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[Kwik-e]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=580</guid>
		<description><![CDATA[While I was cleaning up some legacy code I found an overly complex usage of String.Split() in several places: var sentence = &#34;Hello World!&#34;; var words = sentence.Split(new char[] { ' ' }); If you take a look at the &#8230; <a href="http://blog.fabse.net/2011/09/01/string-split-kwik-e/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>While I was cleaning up some legacy code I found an overly complex usage of String.Split() in several places:</p>
<pre class="code"><span style="color: blue">var </span>sentence = <span style="color: #a31515">&quot;Hello World!&quot;</span>;
<span style="color: blue">var </span>words = sentence.Split(<span style="color: blue">new char</span>[] { <span style="color: #a31515">' ' </span>});</pre>
<p>If you take a look at the available overloads on Split() you may miss the params keyword. In fact it isn’t even visible on the overview page:</p>
<p><a href="http://msdn.microsoft.com/de-de/library/y7h14879%28v=VS.100%29.aspx"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image49.png" width="326" height="329" /></a></p>
<p>But if you take a closer look on Split(char[]) you will see this:</p>
<p><a href="http://msdn.microsoft.com/de-de/library/b873y76a.aspx"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://blog.fabse.net/wp-content/uploads/image50.png" width="229" height="53" /></a></p>
<p>The params keyword tells you that the method accepts any number of arguments of type char. So you could also provide only one, which will simplify the given sample to:</p>
<pre class="code"><span style="color: blue">var </span>sentence = <span style="color: #a31515">&quot;Hello World!&quot;</span>;
<span style="color: blue">var </span>words = sentence.Split(<span style="color: #a31515">' '</span>);</pre>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2011/09/01/string-split-kwik-e/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linq Kwik-e</title>
		<link>http://blog.fabse.net/2011/08/29/linq-kwik-e/</link>
		<comments>http://blog.fabse.net/2011/08/29/linq-kwik-e/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 21:19:46 +0000</pubDate>
		<dc:creator>Fabse</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[Kwik-e]]></category>
		<category><![CDATA[Linq]]></category>

		<guid isPermaLink="false">http://blog.fabse.net/?p=572</guid>
		<description><![CDATA[Really often I use the Linq extension methods to formulate a query to reduce a set of data to a single value. Most of the time I refer to the First() method for this use case. var fabse = myList.Where(p &#8230; <a href="http://blog.fabse.net/2011/08/29/linq-kwik-e/">Continue reading <span class="meta-nav">&#8594;</span></a><p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Really often I use the Linq extension methods to formulate a query to reduce a set of data to a single value. Most of the time I refer to the First() method for this use case.</p>
<pre class="code"><span style="color: blue;">var </span>fabse = myList.Where(p =&gt; p.Name == <span style="color: #a31515;">"Fabse"</span>).First();</pre>
<p>There are several ways to improve this scenario. First has an overload where it accepts a predicate function, so the following example yields the same result:</p>
<pre class="code"><span style="color: blue;">var </span>fabse = myList.First(p =&gt; p.Name == <span style="color: #a31515;">"Fabse"</span>);</pre>
<p>But what happens if your list has no elements fulfilling your filter? First() will throw an exception. It is considered bad style to use exceptions to handle program flow. But is quite hard sticking to First() and avoiding the exception at the same time.</p>
<p>It is better to use FirstOrDefault() if there is the possibility of not getting any result. If there is no result, the default for the inferred data type is used, which is null for all reference types and 0 (zero) or false for int/float/double/… and bool. Sample:</p>
<pre class="code"><span style="color: blue;">var </span>fabse = myList.FirstOrDefault(p =&gt; p.Name == <span style="color: #a31515;">"Fabse"</span>);
<span style="color: blue;">if </span>(fabse != <span style="color: blue;">null</span>)
{
    <span style="color: green;">//use fabse ;-</span><span style="color: green;">)
</span>}</pre>
<p>Today I discovered the functions Single() and SingleOrDefault() which have nearly the same semantics but they will test the data source for further hits regarding your predicate. If there are other hits, you will see an InvalidOperationException.</p>
<p>I like this behavior very much because I often search for the existence of a somehow special object and based on this existence I do something or not. If there is more than one of these special objects, there is most likely something wrong with the data and it is better to stop the process and to examine the data. So an exception feels right at this moment.</p>
<p>To finish up this kwik-e: First() will give you the first (duh!) element while Last() and LastOrDefault() will give you the last element.</p>
<p><br /><br />---<br />
<a href="https://www.amazon.de/?&tag=fabsenetfabse-21">Unterst&uuml;tze mich und meinen Blog und kauf dir was Nettes (&uuml;ber diesen Link)</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabse.net/2011/08/29/linq-kwik-e/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

