<?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>of bits and bytes &#187; English</title>
	<atom:link href="http://blog.rolandbaer.ch/category/english/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rolandbaer.ch</link>
	<description>Der normale Wahnsinn in der Softwarewelt - The ordinary madness in the world of software.</description>
	<lastBuildDate>Sun, 05 Feb 2012 16:14:10 +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>Slippery When Wet #5: The Process object or Optimization? don&#8217;t do it!</title>
		<link>http://blog.rolandbaer.ch/2011/11/12/slippery-when-wet-5-the-process-object/</link>
		<comments>http://blog.rolandbaer.ch/2011/11/12/slippery-when-wet-5-the-process-object/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 10:40:07 +0000</pubDate>
		<dc:creator>Roland Bär</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Pitfall]]></category>
		<category><![CDATA[Slippery When Wet]]></category>
		<category><![CDATA[SWW]]></category>

		<guid isPermaLink="false">http://blog.rolandbaer.ch/?p=392</guid>
		<description><![CDATA[I proudly present to you the fifth in a infinite number of posts of “Slippery When Wet.” In these posts I show you a little bastard I stumbled on. To get the memory usage information you can use the System.Diagnostics.Process class. As I wantet to check the memory usage regularly I kept the reference to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.rolandbaer.ch/wp-content/uploads/2008/10/slipperywhenwet.gif"><img src="http://blog.rolandbaer.ch/wp-content/uploads/2008/10/slipperywhenwet-216x300.gif" alt="Slippery When Wet" title="Slippery When Wet" width="216" height="300" class="alignright size-medium wp-image-61" /></a>I proudly present to you the fifth in a infinite number of posts of “Slippery When Wet.” In these posts I show you a little bastard I stumbled on.</p>
<p>To get the memory usage information you can use the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx">System.Diagnostics.Process</a> class. As I wantet to check the memory usage regularly I kept the reference to the Process object in my class. But the value never changed anymore&#8230; Then I tried to get the Process object every time i needed the current memory size &ndash; and it worked. </p>
<p>So I read the documentation a little more carefully and got to this part:</p>
<blockquote><p>
The process component obtains information about a group of properties all at once. After the Process component has obtained information about one member of any group, it will cache the values for the other properties in that group and not obtain new information about the other members of the group until you call the Refresh method. Therefore, a property value is not guaranteed to be any newer than the last call to the Refresh method. The group breakdowns are operating-system dependent.</p></blockquote>
<p>So I changed my code again to not get the Process every time I wanted the current memory size but call the Refresh method.</p>
<p>And what did we learn from this episode? </p>
<p><a href="http://en.wikipedia.org/wiki/Michael_A._Jackson">Michael A. Jackson</a> (&#8220;<a href="http://en.wikipedia.org/wiki/Optimization_%28computer_science%29#Quotes">The First Rule of Program Optimization: Don&#8217;t do it (&#8230;)</a>&#8220;) and <a href="http://en.wikipedia.org/wiki/Donald_Knuth">Donald Knuth</a> (&#8220;<a href="http://en.wikipedia.org/wiki/Optimization_%28computer_science%29#Quotes">(&#8230;) premature optimization is the root of all evil (&#8230;)</a>&#8220;) are right. Don&#8217;t do optimization, especially not if you don&#8217;t really know what you are doing&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rolandbaer.ch/2011/11/12/slippery-when-wet-5-the-process-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slippery When Wet #4: this is it &#8211; the this keyword in Javascript</title>
		<link>http://blog.rolandbaer.ch/2011/07/13/slippery-when-wet-4-this-is-it-the-this-keyword-in-javascript/</link>
		<comments>http://blog.rolandbaer.ch/2011/07/13/slippery-when-wet-4-this-is-it-the-this-keyword-in-javascript/#comments</comments>
		<pubDate>Wed, 13 Jul 2011 19:57:48 +0000</pubDate>
		<dc:creator>Roland Bär</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Slippery When Wet]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[SWW]]></category>

		<guid isPermaLink="false">http://blog.rolandbaer.ch/?p=258</guid>
		<description><![CDATA[Coming from the C++/C#/Java world, the 'this' keyword is well known for accessing the instance of the class itself. In JavaScript, it's a little bit different...]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.rolandbaer.ch/wp-content/uploads/2008/10/slipperywhenwet.gif"><img src="http://blog.rolandbaer.ch/wp-content/uploads/2008/10/slipperywhenwet-216x300.gif" alt="" title="Slippery When Wet" width="216" height="300" class="alignright size-medium wp-image-61" /></a>I proudly present to you the fourth in a infinite number of posts of “Slippery When Wet.” In these posts I show you a little bastard I stumbled on.</p>
<p>Coming from the C++/C#/Java world, the &#8216;this&#8217; keyword is well known for accessing the instance of the class itself. For accessing members, it is not mandantory but often favored for clearness.</p>
<p>With this background, a first try could look like this (complete html page in the package, file this1.html):</p>
<div class="codecolorer-container javascript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> marc <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Marc&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; hello<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>visitor<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello &quot;</span> <span style="color: #339933;">+</span> visitor <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;, my name is &quot;</span> <span style="color: #339933;">+</span> <span style="color: #000066;">name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;!&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <br />
<span style="color: #009900;">&#125;</span><br />
<br />
window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; marc.<span style="color: #660066;">hello</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Peter&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>And the output is:</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Hello Peter, my name is !</div></div>
<p>OK, let&#8217;s try again!<br />
We call the name property explicit (this2.html):</p>
<div class="codecolorer-container javascript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello &quot;</span> <span style="color: #339933;">+</span> visitor <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;, my name is &quot;</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;!&quot;</span><span style="color: #009900;">&#41;</span></div></div>
<p>And the output is, as expected:</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Hello Peter, my name is Marc!</div></div>
<p>So, it&#8217;s a piece of cake, we have only to put the this keyword for all members, and we&#8217;re done&#8230;</p>
<p>Wait, not so fast, youngster!</p>
<p>Let&#8217;s try it with a function reference like in the next example (this3.html):</p>
<div class="codecolorer-container javascript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> marc <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Marc&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; hello<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>visitor<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello &quot;</span> <span style="color: #339933;">+</span> visitor <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;, my name is &quot;</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;!&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> greet <span style="color: #339933;">=</span> marc.<span style="color: #660066;">hello</span><span style="color: #339933;">;</span><br />
<br />
window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; greet<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Peter&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>And the output is:</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Hello Peter, my name is !</div></div>
<p>The name is lost again!</p>
<p>This problem occurs because JavaScript doesn&#8217;t support implicit binding in a way C++ and others do.</p>
<p>With calling the function through the function reference, the this inside the hello function points not to marc but to the window. To verify this thesis, we just add a name to the window:</p>
<div class="codecolorer-container javascript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> marc <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Marc&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; hello<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>visitor<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello &quot;</span> <span style="color: #339933;">+</span> visitor <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;, my name is &quot;</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;!&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> greet <span style="color: #339933;">=</span> marc.<span style="color: #660066;">hello</span><span style="color: #339933;">;</span><br />
<br />
window.<span style="color: #000066;">name</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Sue&quot;</span><span style="color: #339933;">;</span><br />
<br />
window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; greet<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Peter&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>And the output is:</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Hello Peter, my name is Sue!</div></div>
<p>But how can we solve this problem? The two easiest solutions are apply and call:</p>
<div class="codecolorer-container javascript geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> marc <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">name</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;Marc&quot;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; hello<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>visitor<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Hello &quot;</span> <span style="color: #339933;">+</span> visitor <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;, my name is &quot;</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #000066;">name</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot;!&quot;</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; <br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #003366; font-weight: bold;">var</span> greet <span style="color: #339933;">=</span> marc.<span style="color: #660066;">hello</span><span style="color: #339933;">;</span><br />
<br />
window.<span style="color: #000066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><br />
<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; greet.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span>marc<span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">&quot;Peter&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; document.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;&lt;br /&gt;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; greet.<span style="color: #660066;">call</span><span style="color: #009900;">&#40;</span>marc<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Peter&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
<p>And the output is:</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Hello Peter, my name is Marc!<br />
Hello Peter, my name is Marc!</div></div>
<p>With apply and call, you do an explicit binding. The object you pass as the first argument (in our example marc) does not need to have the function itself, but should of course have the members that are used inside the function.<br />
The difference of apply and call is only in the signature of the function. With apply, the parameter have to be passed inside an array. With call, the parameters are lined up after the explicit binding object.</p>
<p>This should give you some ideas to identify problems coming from the binding and some solutions to solve them.</p>
<p>For further reading i suggest the following articles:</p>
<ul>
<li><a href="http://www.alistapart.com/articles/getoutbindingsituations/">Getting Out of Binding Situations in JavaScript</a> </li>
<li><a href="http://www.webmasterpro.de/coding/article/javascript-what-is-this.html">What is this? &#8211; OOP in Javascript zähmen</a> (in german)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.rolandbaer.ch/2011/07/13/slippery-when-wet-4-this-is-it-the-this-keyword-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slippery When Wet #3: IIS Certification Authority Cache</title>
		<link>http://blog.rolandbaer.ch/2010/04/25/slippery-when-wet-3-iis-certification-authority-cache/</link>
		<comments>http://blog.rolandbaer.ch/2010/04/25/slippery-when-wet-3-iis-certification-authority-cache/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 17:49:18 +0000</pubDate>
		<dc:creator>Roland Bär</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Slippery When Wet]]></category>
		<category><![CDATA[Certificate]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[SWW]]></category>

		<guid isPermaLink="false">http://blog.rolandbaer.ch/?p=174</guid>
		<description><![CDATA[I proudly present to you the third in a infinite number of posts of “Slippery When Wet.” In these posts I show you a little bastard I stumbled on. For an Web Application I needed not only to check the user rights but also to limit the the allowed computers. For this I limited the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.rolandbaer.ch/wp-content/uploads/2008/10/slipperywhenwet.gif"><img src="http://blog.rolandbaer.ch/wp-content/uploads/2008/10/slipperywhenwet-216x300.gif" alt="" title="Slippery When Wet" width="216" height="300" class="alignright size-medium wp-image-61" /></a>I proudly present to you the third in a infinite number of posts of “Slippery When Wet.” In these posts I show you a little bastard I stumbled on.</p>
<p>For an Web Application I needed not only to check the user rights but also to limit the the allowed computers. For this I limited the access with a client certificate that has to be installed on the accessing computer.<br />
At the beginning I used a free client certificate from <a href="http://www.thawte.com/">Thawte</a>, as the server certificate was also from them. This certificate was only valid for one year. So I had to renew this certificate every year and all allowed computers had to be updated.<br />
But as Thawte ended their support for the free certificate I needed an other solution. I chose to use a self signed certificate as the client certificate but keep the server certificate from Thawte as on the server were also running other Web Applications that needed https.<br />
So I created the Certification Authority (CA) certificate and a client certificate signed with this CA certificate with <a href="http://www.openssl.org/">openssl</a>. Testing with this certificates worked as it should. But for Testing purposes I used the default values for the validity length. So I created a new CA and a new client certificate with a longer validity period. After removing the testing certificates and installing the new created certificates I thought it will work as before, but the client certificate was not selectable in the client certificate selection dialog of internet explorer.<br />
I tried several things like restarting IE, clearing the SSL cache and cursing. But nothing helped.<br />
Analyzing the communication between client and server with openssl brought the solution: The Internet Information Server (IIS) was still using the old, already removed CA certificate, probably from his cache, but not the new one, maybe because the were named similar. After restarting the IIS on the server the new client certificate was selectable in the client certificate selection dialog of internet explorer.<br />
<strong>Conclusion:</strong> After removing a (CA) Certificate from the IIS restart it to clear the cache!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rolandbaer.ch/2010/04/25/slippery-when-wet-3-iis-certification-authority-cache/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Syntax Highlighting with Plugin</title>
		<link>http://blog.rolandbaer.ch/2010/04/05/syntax-highlighting-with-plugin/</link>
		<comments>http://blog.rolandbaer.ch/2010/04/05/syntax-highlighting-with-plugin/#comments</comments>
		<pubDate>Mon, 05 Apr 2010 21:15:57 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://blog.rolandbaer.ch/?p=171</guid>
		<description><![CDATA[I&#8217;ve added today the plugin CodeColorer to provide syntax highlighting to the source code blocks in my blog. The plugin is based on the GeSHi &#8211; Generic Syntax Highlighter library. The old articles have been updated to use the new plugin]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve added today the plugin <a href="http://kpumuk.info/projects/wordpress-plugins/codecolorer/">CodeColorer</a> to provide syntax highlighting to the source code blocks in my blog. The plugin is based on the <a href="http://qbnz.com/highlighter/">GeSHi &#8211; Generic Syntax Highlighter</a> library.<br />
The old articles have been updated to use the new plugin</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rolandbaer.ch/2010/04/05/syntax-highlighting-with-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTC TyTN Factory Reset</title>
		<link>http://blog.rolandbaer.ch/2009/04/27/htc-tytn-factory-reset/</link>
		<comments>http://blog.rolandbaer.ch/2009/04/27/htc-tytn-factory-reset/#comments</comments>
		<pubDate>Mon, 27 Apr 2009 21:09:46 +0000</pubDate>
		<dc:creator>Roland Bär</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[mobile]]></category>

		<guid isPermaLink="false">http://blog.rolandbaer.ch/?p=87</guid>
		<description><![CDATA[As this Information is no more available on the HTC Website I store them here for me and everybody that needs this information: Hold both soft keys (the two keys that represent the options on the screen), push the reset button with the stylus and keep the two keys until the screen shows the options [...]]]></description>
			<content:encoded><![CDATA[<p>As this Information is no more available on the <a href="http://www.htc.com/">HTC Website</a> I store them here for me and everybody that needs this information:</p>
<p>Hold both soft keys (the two keys that represent the options on the screen), push the reset button with the stylus and keep the two keys until the screen shows the options to continue the operation.</p>
<p><strong>Warning:</strong> All data (contacts, sms, installed software, pictures etc) wil be ereased!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rolandbaer.ch/2009/04/27/htc-tytn-factory-reset/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Get the password of user IWAM_</title>
		<link>http://blog.rolandbaer.ch/2009/01/17/get-the-password-of-user-iwam_/</link>
		<comments>http://blog.rolandbaer.ch/2009/01/17/get-the-password-of-user-iwam_/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 17:00:17 +0000</pubDate>
		<dc:creator>Roland Bär</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[English]]></category>

		<guid isPermaLink="false">http://blog.rolandbaer.ch/?p=79</guid>
		<description><![CDATA[After trying some things in the IIS settings I wanted to change back to use the IWAM_* account. But for this I needed the password. I&#8217;ve searched and found some informations and tips to get the password that was used for the IUSR_* or IWAM_* accounts.]]></description>
			<content:encoded><![CDATA[<p>After trying some things in the IIS settings I wanted to change back to use the IWAM_* account. But for this I needed the password. I&#8217;ve searched and found some informations and tips to <a href="http://vittoriop77.blogspot.com/2006/06/iis-iusr-and-iwam-password.html">get the password that was used for the IUSR_* or IWAM_* accounts</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rolandbaer.ch/2009/01/17/get-the-password-of-user-iwam_/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slippery When Wet #2: SCOPE_IDENTITY and SqlDataReader</title>
		<link>http://blog.rolandbaer.ch/2008/10/25/slippery-when-wet-2-scope-identity-sqldatareader/</link>
		<comments>http://blog.rolandbaer.ch/2008/10/25/slippery-when-wet-2-scope-identity-sqldatareader/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 21:08:23 +0000</pubDate>
		<dc:creator>Roland Bär</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Slippery When Wet]]></category>
		<category><![CDATA[SWW]]></category>

		<guid isPermaLink="false">http://blog.rolandbaer.ch/?p=65</guid>
		<description><![CDATA[I proudly present to you the second in a infinite number of posts of “Slippery When Wet.” In these posts I show you a little bastard I stubled on. Imagine you have a database table with a cloumn id of the data type integer that has set the IDENTITY. You use a stored procedure to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.rolandbaer.ch/wp-content/uploads/2008/10/slipperywhenwet.gif"><img src="http://blog.rolandbaer.ch/wp-content/uploads/2008/10/slipperywhenwet-216x300.gif" alt="" title="Slippery When Wet" width="216" height="300" class="alignright size-medium wp-image-61" /></a>I proudly present to you the second in a infinite number of posts of “Slippery When Wet.” In these posts I show you a little bastard I stubled on.</p>
<p>Imagine you have a database table with a cloumn id of the data type integer that has set the IDENTITY. You use a stored procedure to insert a new entry into this table. Inside this stored procedure you use the SCOPE_IDENTITY() function to get the identifier created for this row. With RETURN SCOPE_IDENTITY() you give the identity to the caller.</p>
<p>You call this stored procedure from a SqlComand with ExecuteReader() that returns you an SqlDataReader object.</p>
<p>From this SqlDataReader you read now the identifier with GetInt32().</p>
<p><strong>Wrong ! </strong></p>
<p>This will give you an InvalidCastException. SCOPE_IDENTITY()&#8217;s return type is numeric, although your identifier column is an integer. SqlDataReader&#8217;s GetXY functions do not convert the data and throw the exception when the data is not already of the right type.</p>
<h3>The first solution</h3>
<p>You can read the value with GetDecimal() and cast the value to an int:</p>
<div class="codecolorer-container csharp geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #6666cc; font-weight: bold;">int</span> identifier <span style="color: #008000;">=</span> <span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">int</span><span style="color: #008000;">&#41;</span>reader<span style="color: #008000;">.</span><span style="color: #0000FF;">GetDecimal</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<h3>The second solution</h3>
<p>You cast the identifier inside the stored procedure und return it already as an integer:</p>
<div class="codecolorer-container sql geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">CAST</span><span style="color: #66cc66;">&#40;</span>SCOPE_IDENTITY<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#41;</span></div></div>
<p>Whatever solution you choose, take care that you use always the same inside your application.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rolandbaer.ch/2008/10/25/slippery-when-wet-2-scope-identity-sqldatareader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Slippery When Wet #1: Javascript&#8217;s GetMonth()</title>
		<link>http://blog.rolandbaer.ch/2008/10/11/slippery-when-wet-1-javascripts-getmonth/</link>
		<comments>http://blog.rolandbaer.ch/2008/10/11/slippery-when-wet-1-javascripts-getmonth/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 22:27:21 +0000</pubDate>
		<dc:creator>Roland Bär</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Pitfall]]></category>
		<category><![CDATA[Slippery When Wet]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[SWW]]></category>

		<guid isPermaLink="false">http://blog.rolandbaer.ch/?p=60</guid>
		<description><![CDATA[I proudly present to you the first in a infinite number of posts of &#8220;Slippery When Wet.&#8221; In these posts I show you a little bastard I stubled on. I had to reformat a date in Javascript. There were all this little nice functions of a date object like getFullYear(), getHours(), getMinutes() and also getMonth() [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.rolandbaer.ch/wp-content/uploads/2008/10/slipperywhenwet.gif"><img src="http://blog.rolandbaer.ch/wp-content/uploads/2008/10/slipperywhenwet-216x300.gif" alt="" title="Slippery When Wet" width="216" height="300" class="alignright size-medium wp-image-61" /></a>I proudly present to you the first in a infinite number of posts of &#8220;Slippery When Wet.&#8221; In these posts I show you a little bastard I stubled on.</p>
<p>I had to reformat a date in Javascript. There were all this little nice functions of a date object like</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">getFullYear(), getHours(), getMinutes()</div></div>
<p>and also</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">getMonth()</div></div>
<p>. Every of these functions returned the value as it would also be shown, but not getMonth(). getMonth() returns a value from 0 to 11, so 0 is January, 1 is February and so on untill 11, that is December.</p>
<p>I see a possible reason for this: With values from 0 to 11 you can use the value directly as the index for an array with the month names inside, like</p>
<div class="codecolorer-container text geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">alert(months[myDate.getMonth()]);</div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.rolandbaer.ch/2008/10/11/slippery-when-wet-1-javascripts-getmonth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>no update for database row if parameter is null</title>
		<link>http://blog.rolandbaer.ch/2008/10/03/no-update-for-database-row-if-parameter-is-null/</link>
		<comments>http://blog.rolandbaer.ch/2008/10/03/no-update-for-database-row-if-parameter-is-null/#comments</comments>
		<pubDate>Fri, 03 Oct 2008 20:46:37 +0000</pubDate>
		<dc:creator>Roland Bär</dc:creator>
				<category><![CDATA[database]]></category>
		<category><![CDATA[English]]></category>

		<guid isPermaLink="false">http://blog.rolandbaer.ch/?p=49</guid>
		<description><![CDATA[Sometimes you want write a stored procedure to update a database entry, but you want be able to leave some columns unchanged. If you don&#8217;t need to set them back to null you can use the following code: UPDATE TABLE &#160; SET Column1 = ISNULL&#40;@parameter1, Column1&#41;, Column2 = ISNULL&#40;@parameter2, Column2&#41; &#160; WHERE PrimaryKey = @KEY [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes you want write a stored procedure to update a database entry, but you want be able to leave some columns unchanged. If you don&#8217;t need to set them back to null you can use the following code:</p>
<div class="codecolorer-container sql geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span><br />
&nbsp; <span style="color: #993333; font-weight: bold;">SET</span> Column1 <span style="color: #66cc66;">=</span> ISNULL<span style="color: #66cc66;">&#40;</span>@parameter1<span style="color: #66cc66;">,</span> Column1<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> Column2 <span style="color: #66cc66;">=</span> ISNULL<span style="color: #66cc66;">&#40;</span>@parameter2<span style="color: #66cc66;">,</span> Column2<span style="color: #66cc66;">&#41;</span><br />
&nbsp; <span style="color: #993333; font-weight: bold;">WHERE</span> PrimaryKey <span style="color: #66cc66;">=</span> @<span style="color: #993333; font-weight: bold;">KEY</span></div></div>
<p>The command <code class="codecolorer text geshi"><span class="text">ISNULL</span></code> uses the first parameter, if it is not null, or the second parameter if the first is null. When you pass a value, this value is used, but when you pass null the current value of this column is used, so it overwrites it with the same value.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rolandbaer.ch/2008/10/03/no-update-for-database-row-if-parameter-is-null/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Open Software Wiki &#8211; SWiK</title>
		<link>http://blog.rolandbaer.ch/2008/08/20/open-software-wiki-swik/</link>
		<comments>http://blog.rolandbaer.ch/2008/08/20/open-software-wiki-swik/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 20:05:11 +0000</pubDate>
		<dc:creator>Roland Bär</dc:creator>
				<category><![CDATA[English]]></category>
		<category><![CDATA[Open Source]]></category>

		<guid isPermaLink="false">http://blog.rolandbaer.ch/?p=47</guid>
		<description><![CDATA[Found the Open Software Wiki &#8211; SWiK on the internet. Let&#8217;s see how it evolves.]]></description>
			<content:encoded><![CDATA[<p>Found the <a href="http://swik.net/">Open Software Wiki &#8211; SWiK</a> on the internet. Let&#8217;s see how it evolves.<a href="http://swik.net/"><br />
</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rolandbaer.ch/2008/08/20/open-software-wiki-swik/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

