<?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/"
	>

<channel>
	<title>Ticklish Techs</title>
	<atom:link href="http://www.ticklishtechs.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ticklishtechs.net</link>
	<description>a mostly .NET but also some other cool techs blog</description>
	<pubDate>Tue, 28 Apr 2009 19:47:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Java for .net-guys or foreach in Java</title>
		<link>http://www.ticklishtechs.net/2009/04/28/java-for-net-guys-or-foreach-in-java/</link>
		<comments>http://www.ticklishtechs.net/2009/04/28/java-for-net-guys-or-foreach-in-java/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 19:09:44 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2009/04/28/java-for-net-guys-or-foreach-in-java/</guid>
		<description><![CDATA[Disclaimer: I’m absolutely not the person who can tell a lot about Java. I learned it a few years ago for university, but used it most of the time only for small example stuff. Never as deep as I’m working with .net. But maybe my newest discoveries are useful for more programmers with .net background.
I [...]]]></description>
			<content:encoded><![CDATA[<p>Disclaimer: I’m absolutely not the person who can tell a lot about Java. I learned it a few years ago for university, but used it most of the time only for small example stuff. Never as deep as I’m working with .net. But maybe my newest discoveries are useful for more programmers with .net background.</p>
<p>I started using Java 1.4 and until last week I never took a look at Java 5 or 6. The only thing I was aware of were generics in Java.</p>
<h3>iterators in Java</h3>
<p>I was always annoyed in the missing of a foreach loop in Java. There is a concept of <code>iterator</code>s in Java comparable to the .net <code>Enumerator</code>s. But to loop over a list you will find in millions of Java programs the following code:</p>
<pre class="code">Iterator&lt;Integer&gt; i = list.iterator();
<span style="color: #7f0055">while</span>(i.hasNext()) {
    Integer current = i.next();

    <span style="color: #3f7f5f">// do something with the current element
</span>}</pre>
<p>Sometimes build into a regular <code>for</code> loop, but I don’t think that is more readable or convenient:</p>
<pre class="code"><span style="color: #7f0055">for</span>(Iterator&lt;Integer&gt; i = list.iterator(); i.hasNext(); ) {
    Integer current = i.next();

    <span style="color: #3f7f5f">// just do something
</span>}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>By the way: Can anyone tell me why the method is called <code>iterator()</code> and not <code>getIterator()</code> as used everywhere else in Java?</p>
<h3>foreach in Java</h3>
<p>With Java 5 (or 1.5 – call it as you like) a foreach loop was introduced. This is about five years ago, so I’m very fast in getting news from the Java world.</p>
<pre class="code"><span style="color: #7f0055">for</span>(Integer i : list) {
    <span style="color: #3f7f5f">// just use i as the current element
</span>}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>I like it. It’s working for everything that implements <code>java.lang.Iterable</code> and for regular arrays.</p>
<p><a href="http://11011.net/software/vspaste"> </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2009/04/28/java-for-net-guys-or-foreach-in-java/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Access to modified closure</title>
		<link>http://www.ticklishtechs.net/2009/04/10/access-to-modified-closure/</link>
		<comments>http://www.ticklishtechs.net/2009/04/10/access-to-modified-closure/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 09:32:35 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[dotnet]]></category>

		<category><![CDATA[dotnet3.5]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2009/04/10/access-to-modified-closure/</guid>
		<description><![CDATA[Imaging a small C# winform app with just one ListBox and the following code:
private void Form1_Load(object sender, EventArgs e)
{
    for (int i = 0; i &#60; 5; i++)
    {
        Thread t = new Thread(() =&#62; AddToListbox(i));
       [...]]]></description>
			<content:encoded><![CDATA[<p>Imaging a small C# winform app with just one ListBox and the following code:</p>
<pre class="code"><span style="color: blue">private void </span>Form1_Load(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e)
{
    <span style="color: blue">for </span>(<span style="color: blue">int </span>i = 0; i &lt; 5; i++)
    {
        <span style="color: #2b91af">Thread </span>t = <span style="color: blue">new </span><span style="color: #2b91af">Thread</span>(() =&gt; AddToListbox(i));
        t.Start();
    }
}

<span style="color: blue">private void </span>AddToListbox(<span style="color: blue">int </span>i)
{
    <span style="color: blue">if </span>(<span style="color: blue">this</span>.InvokeRequired)
        <span style="color: blue">this</span>.Invoke(<span style="color: blue">new </span><span style="color: #2b91af">Action</span>&lt;<span style="color: blue">int</span>&gt;(AddToListbox), i);
    <span style="color: blue">else
        this</span>.listBox1.Items.Add(i);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a>A simple loop iterating over the numbers from 0 to 4 and adding these values asynchronous to a ListBox. What do you expect? I expected the numbers from 0 to 4 shown in the ListBox but in any random order since I do not control the threads in any way.</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2009/04/a.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="2 - 3 - 4 - 5 - 5" src="http://www.ticklishtechs.net/wp-content/uploads/2009/04/a-thumb.png" border="0" alt="2 - 3 - 4 - 5 - 5" width="183" height="154" /></a> <a href="http://www.ticklishtechs.net/wp-content/uploads/2009/04/b.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="4 - 2 -  2 - 4 - 5" src="http://www.ticklishtechs.net/wp-content/uploads/2009/04/b-thumb.png" border="0" alt="4 - 2 -  2 - 4 - 5" width="183" height="154" /></a></p>
<p>I didn’t expect any number to appear multiple times and I’m totally surprised to  see the number 5!</p>
<p>But <a href="http://www.jetbrains.com/resharper/">ReSharper</a> gave me a hint that I often saw but never understood:</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2009/04/u.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="&quot;Access to modified closure&quot; by  R#" src="http://www.ticklishtechs.net/wp-content/uploads/2009/04/u-thumb.png" border="0" alt="&quot;Access to modified closure&quot; by  R#" width="480" height="158" /></a></p>
<h3>So what’s going on?</h3>
<p>I use the syntax of an Lambda expression instead of a regular function call (e.g. using the ThreadStart class and a delegate). This Lambda expression is not evaluated until the thread uses it. And by this time, the loop can be in its next iteration. If the loop is already finished <code>i</code> will be 5.</p>
<p>That is exactly what R# tries to tell me: “Hey, you are accessing here a variable but change it later on. Maybe that is not a good idea.”. – It isn’t.</p>
<h3>The solution</h3>
<p>Just make a copy of <code>i</code> before passing it into the expression. This copy must be a private copy that will not be changed later. The easiest way to do so is declaring a variable inside the body of the loop. In every iteration of the loop a new integer will be created on the stack and the Lambda expression will access this one.</p>
<pre class="code"><span style="color: blue">for </span>(<span style="color: blue">int </span>i = 0; i &lt; 5; i++)
{
    <strong><span style="color: blue">int </span>copy = i;</strong>
    <span style="color: #2b91af">Thread </span>t = <span style="color: blue">new </span><span style="color: #2b91af">Thread</span>(() =&gt; AddToListbox(<strong>copy</strong>));
    t.Start();
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2009/04/10/access-to-modified-closure/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Permutations and the number 9 (proof)</title>
		<link>http://www.ticklishtechs.net/2009/02/27/permutations-and-the-number-9-proof/</link>
		<comments>http://www.ticklishtechs.net/2009/02/27/permutations-and-the-number-9-proof/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 16:47:06 +0000</pubDate>
		<dc:creator>Wolfram Bernhardt</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[algorithm]]></category>

		<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2009/02/10/permutations-and-the-number-9-proof/</guid>
		<description><![CDATA[Ten days ago I promised a proof why the differences of any permutation of the same digits is always a multiple of 9. Here it is
Let&#8217;s say x and y are digits and &#8216;xy&#8217; is not &#8216;x*y&#8217;, but the number that consist of the digits x and y.
xy - yx = multiple of 9.
Is it [...]]]></description>
			<content:encoded><![CDATA[<p>Ten days ago I promised a proof why the <a href="http://www.ticklishtechs.net/2009/01/21/permutations-and-the-number-9/">differences of any permutation of the same digits is always a multiple of 9</a>. Here it is</p>
<p>Let&#8217;s say x and y are digits and &#8216;xy&#8217; is not &#8216;x*y&#8217;, but the number that consist of the digits x and y.</p>
<p>xy - yx = multiple of 9.</p>
<p>Is it always true? Yes, it is:</p>
<p>(10x + 1y) - (10y + 1x) = multiple of 9?    <br />9x - 9y = multiple of 9?     <br />9(x-y) = multiple of 9? Yes, for sure.</p>
<p>I calculated the numeric values of <strong>xy</strong> and <strong>yx</strong> by &quot;10 times the higher position + 1 time the lower position&quot;, just like we all do every day in our beloved decimal-system. More formally we describe the factor for the position (1, 10, 100&#8230;) by</p>
<p>10^position, (position is zero-based, counting from right to left, of course)</p>
<p>Now, when we change the position of a single digit within a number we change its numeric value from</p>
<p>x*10^(old position) to x*10^(new position).</p>
<p>We can neglect x here, because it&#8217;s a factor that occurs in both values, so we can get rid of it by division.    <br />The remaining part for building the difference is</p>
<p>10^p1 - 10^p2, a formula that always produces multiples of 9: 10-1, 1000-100, 10-1000000.</p>
<h3>Conclusion</h3>
<p>Since the difference of a number and one of it&#8217;s permutations is a sum of (10^p1-10^p2)-parts, which are all multiples of 9, the total also can be divided by 9.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2009/02/27/permutations-and-the-number-9-proof/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Permutations and the number 9</title>
		<link>http://www.ticklishtechs.net/2009/02/17/permutations-and-the-number-9/</link>
		<comments>http://www.ticklishtechs.net/2009/02/17/permutations-and-the-number-9/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 16:43:14 +0000</pubDate>
		<dc:creator>Wolfram Bernhardt</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[algorithm]]></category>

		<category><![CDATA[maths]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2009/01/21/permutations-and-the-number-9/</guid>
		<description><![CDATA[Lately I stumbled over permutations and noticed a funny fact: When you take any integer, produce a permutation and subtract one form the other, you always get a multiple of 9. 
It works with a any length. Some examples: 
Length 2    23 - 32 = -9&#160; 84 - 48 = 36  [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I stumbled over permutations and noticed a funny fact: When you take any integer, produce a permutation and subtract one form the other, you always get a multiple of 9. </p>
<p>It works with a any length. Some examples: </p>
<p>Length 2    <br />23 - 32 = -9&#160; <br />84 - 48 = 36     <br />60 - 06 = 54 </p>
<p>Length 3    <br />123 - 132 = -9     <br />and so on&#8230; </p>
<p>It still works for changing the front position:    <br />123 - 213 = -90 </p>
<p>In fact it works for changing any position:    <br />123 - 321 = -198 (-22*9) </p>
<p>This leads to the conclusion I stated in the beginning. The difference of any permutation of the same number is a multiple of 9. Feel free to check it with you favorite numbers.</p>
<p>It&#8217;s not a great mathematical invention (if it is, please let me know), but I didn&#8217;t know it, didn&#8217;t expect it und find it kind of fascinating. I asked a couple of friends and no one was aware of this. </p>
<p>I still try to find a way to use these fact, maybe for spell-check-like for numbers or a fast calculation of permutations, but so far it seems just useless <img src='http://www.ticklishtechs.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Instead I can provide a proof for numbers of any length and I&#8217;ll post it here in ten days from today. Meanwhile I want you to try it yourself. The proof is really, really simple, almost trivial and it won&#8217;t cost you more than five minutes to understand it all. </p>
<p>Please email or comment your solution!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2009/02/17/permutations-and-the-number-9/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mind &#8216;win32manifest&#8217; when interop-ing</title>
		<link>http://www.ticklishtechs.net/2009/02/03/mind-win32manifest-when-interop-ing/</link>
		<comments>http://www.ticklishtechs.net/2009/02/03/mind-win32manifest-when-interop-ing/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 20:06:32 +0000</pubDate>
		<dc:creator>Wolfram Bernhardt</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[ARIS]]></category>

		<category><![CDATA[arisan]]></category>

		<category><![CDATA[dotnet]]></category>

		<category><![CDATA[dotnet2.0]]></category>

		<category><![CDATA[dotnet3.5]]></category>

		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2009/02/03/mind-win32manifest-when-interop-ing/</guid>
		<description><![CDATA[For those who look for a quick solution:
Try switching off the win32manifest-switch in Visual Studio.
Here is the long story.
Hi! As you may already know we are working on the best .NET - ARIS interface there is so far. It&#8217;s an interface that makes heavy use of an old C-Api, using interop and p/invoke.
In Mid-December Benjamin [...]]]></description>
			<content:encoded><![CDATA[<p>For those who look for a quick solution:</p>
<p><span style="color: #cc6600;"><strong><span style="font-size: small;">Try switching off the win32manifest-switch in Visual Studio.</span></strong></span></p>
<p>Here is the long story.</p>
<p>Hi! As you may already know we are working on the best .NET - <a href="http://www.ids-scheer.com/de/ARIS_Software_Software/7796.html">ARIS</a> interface there is so far. It&#8217;s an interface that makes heavy use of an old C-Api, using interop and p/invoke.</p>
<p>In Mid-December Benjamin found a very strange behavior that almost spoiled my Christmas. We had just release Version 1.1 when he called me: &#8220;<a href="http://www.arisan.de/">Arisan</a> crashes with Vista64.&#8221; I was shocked. &#8220;And with Vista32 as well&#8221;. I felt annihilated. We had done so much testing with various versions of XP, Vista and it worked fine with any of those OSes.</p>
<p>After some testing I saw that ARIS didn&#8217;t deliver any pointers at all. That&#8217;s rather bad for an interface to C that uses pointer in every call.  After one more day we had more evidence: We had switched to .NET3.5 and VS2008 some month ago and our old versions, that were compiled using the .NET2.0-compiler, still worked.</p>
<p>I was so terrified. The 3.5-framework should be similar to the 2.0-framework, just some (not so) little enhancements. A bug in the 3.5-compiler?</p>
<p>To provide a quick solution we re-wrote parts of the fancy 3.5-syntax, to make our newest enhancement compile with the 2.0-compiler again. That worked (at least we thought so) and we released version 1.1.1.</p>
<p>Then a very frustrating time began. We read articles over and over and quickly found <a href="http://blogs.msdn.com/ed_maurer/archive/2007/12/14/nxcompat-and-the-c-compiler.aspx">this very interesting post</a>. The problems described there where exactly what we saw.  So we followed the track of the <a href="http://msdn.microsoft.com/en-us/library/ms235442(VS.80).aspx">nxcompat-flag</a> and DEP, but it didn&#8217;t lead us anywhere.</p>
<p>The C-Api we interface is well documented, but it calls hundreds of other components and one of them crashed deep inside an <a href="http://www.imdb.com/title/tt0102975/">undiscovered country</a>.</p>
<p>We read pages of differences between 2.0- and 3.5-compiler, new compiler-flags (should have paid more attention here), any documentation we could find, but nothing seemed to help.</p>
<p>We had a feeling it could have something to do with Vista UAC, but we didn&#8217;t find any matching explanations to our problem. Being really desperate we started <a href="http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/1d995bb9-d42d-4b55-9012-c4fccf08c7f2">this thread at the MS forums</a>. As you can read there, no one could provide a solution that worked.</p>
<p>I was really sad, because the last thing I wanted to do was to switch the entire development of arisan back to VS2005. I got prepared for a very sad life from now on.</p>
<p>But five days ago my life turned to happiness again. One more time I started of by googling words like &#8220;.NET compiler 2.0 3.5 differences&#8221; and one more time I read the new features of the 3.5-compiler. This time I obviously paid more attention to the compiler-flags and read about the <a href="http://msdn.microsoft.com/en-us/library/bb545961.aspx?ppud=4">/win32manifest</a> and <a href="http://msdn.microsoft.com/en-us/library/bb513864.aspx">/nowin32manifest</a> - switches. I didn&#8217;t have much hope left, but tried to set the /nowin32manifest switch.</p>
<p>It worked! Everything worked! The C-Api delivered pointers again. I tried switching the win32manifest on and off and a day later Benjamin confirmed my results. We had found it. But after a long time of suffering (for me it felt like half a year) we still were skeptical and thought we needed a deeper understanding of the problem.</p>
<h3>The win32manifest and UAC</h3>
<p>Finally we had something to look for and quickly found valuable information on the great <a href="http://blogs.msdn.com/ed_maurer/archive/2008/01/19/the-win32manifest-switch.aspx">I&#8217;m just sayin&#8217; blog</a>. The documentation of the switches helped as well, so here is a summary:</p>
<p>The win32manifest is not the .NET-manifest.</p>
<p>The win32manifest is part of the UAC (user access control). UAC was introduced with Vista as an answer to more and more security threads. One of its ideas is to keep malicious software from secretly starting to work. If you work with Vista you may have noticed a lot of dialogs that ask you for permission to run certain programs. THAT is UAC.</p>
<p>Now the win32manifest inside an application tells the OS what level of permission it needs to run. There are levels like &#8220;asInvoker&#8221; (default), &#8220;highestAvailable&#8221; or &#8220;requireAdministrator&#8221;. In case the OS (and the current user) can provide the requested permission, the program runs as a trusted process (according to the granted access level). Of course, 90+% (just my estimation) of the programs on you Vista-machine don&#8217;t have a win32mianifest,  because it&#8217;s a new feature and older applications just don&#8217;t have it. (And I think a majority of newer applications won&#8217;t have it either). In order to be compatible with no-win32manifest applications on one hand and providing security on the other hand, Vista can do a miracle called &#8220;virtualization&#8221;. It&#8217;s a bit like running a process in a <a href="www.sandboxie.com">sandbox</a>: Vista provides anything the process may need to run: disk space, memory, a registry etc. So the process feels cosy.</p>
<p>But anything provided this way is separated from the main system. The process uses a copy of the registry, writes to a special parts of the HDD drives and accesses the memory in a controlled way (not sure about the memory thing&#8230;). For me this is a great achievement of Vista, almost magic. I can&#8217;t tell in detail how it works (mainly because I don&#8217;t have a clue), but it works good and doesn&#8217;t cost notable performance.</p>
<p>So on your Vista machine you have processes that run virtualized and others that run non-virtualized. &#8220;Non-virtualized&#8221; is also called &#8220;UCA-compatible&#8221; or just &#8220;compatible&#8221;, so I&#8217;ll adopt this wording here.</p>
<p>You could say that Vista trusts compatible processes a little bit more than virtualized processes. That doesn&#8217;t mean virtualized processes are evil, but.. well&#8230; maybe&#8230; under certain circumstances&#8230; not 100% trustworthy. (<a href="http://www.dcr.net/~w-clayton/Vista/UAC/UAC_app_compat_and_virtualization.htm">Here</a> is another nice article)</p>
<p>Note three facts here:</p>
<ol>
<li>The state (virtualized/compatible) always counts for a <strong>process</strong> and is set when the process starts. When you start an .exe-file, Vista decides how to run it.</li>
<li>Because of 1) there is no sense in attaching a win32manifest to components that do not start a process, like .dlls. Thus .dlls don&#8217;t have a win32manifest.</li>
<li>The state (virtualized/compatible) of a process doesn&#8217;t change during its lifetime.</li>
</ol>
<p>So if a .dll is used by a virtualized process, its code also runs virtualized. And if the same .dll is used by a compatible process, its code runs compatible.</p>
<h3>Interaction</h3>
<p>With some of that in my mind, I could explain the problems we had with our interface software arisan: arisan is a .dll you reference in your .NET-application and use it. As mentioned above arisan calls a native (so non-.NET) .dll using p/invoke-interop-techniques. Now this native .dll starts a bunch of new processes: a database-server, a database-driver, some middle-layers, etc. I am pretty sure non of this newly started processes is based on applications with a win32manifest - so they all run virtualized.</p>
<p>But the .NET-applications we use to test the arisan.dll started running compatible as we switched to VS2008 and the 3.5-compiler. So our test application (compatible) called arisan.dll (compatible), arisan.dll (compatible) called C-Api.dll (compatible). C-Api.dll started new processes (virtualized !!) and called functions there. And in the end a compatible (fully trusted) process asked a virtualized (less trusted) process to fill some pointers&#8230; and that&#8217;s the point where Vista interferes and says: &#8220;Dudes, are you drunk? No way!&#8221;</p>
<p>It was a bit of bad luck that the clash of a virtualized and a compatible process happened so deep inside a software we couldn&#8217;t debug and only threw some strange, meaningless error-messages, but on the other hand Vista could have told us more. Maybe there is some place in Vista where the clash is logged. If someone knows - please let me know, too. Let me get this straight: Vista is absolutely right here, but I&#8217;d wish more information when it happens. I don&#8217;t exactly know how, but you could do harmful things if you could easily exchange all sorts of pointers between virtualized and compatible processes&#8230;</p>
<h3>Solution</h3>
<p>So finally the solution was easy. Both processes have either to run virtualized or non-virtualized. Since we can&#8217;t make a third-party software run compatible, we have to make our .NET-application run virtualized: We just need to prevent .NET from inserting a win32manifest to <strong>executables</strong>.</p>
<p>Using the compiler from the command-line the compiler-flag /nowin32manifest does it.</p>
<p>In VS2008 same switch can be found on the &#8220;Application&#8221;-tab of the project properties.</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2009/02/image.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" src="http://www.ticklishtechs.net/wp-content/uploads/2009/02/image-thumb.png" border="0" alt="image" width="484" height="363" /></a></p>
<p>The manifest-area is enabled for &#8216;console applications&#8217; and &#8216;Windows applications&#8217;. It is disabled for class libraries.</p>
<p>Another way to handle this problem is to switch off UAC completely. But we strictly advice you against this solution. UAC is one of Vista&#8217;s main features and it is designed to provide shelter for your precious data in times of evil viruses and brutal intrusion attempts <img src='http://www.ticklishtechs.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h3>Epilog- bad fix</h3>
<p>After we understood the problem, we saw that the &#8216;fix&#8217; we provided as V1.1.1 couldn&#8217;t do much. Ok - it made the demos run, because the executable compiled with the 2.0- come without a win32manifest and thus run virtualized. But users trying it with VS2008 still had the same issues.</p>
<p>Actually we cannot provide a technical solution with the arisan.dll, because if the running mode depends on the executables that use arisan. So we&#8217;ll write detailed information and everyone lived happily ever after.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2009/02/03/mind-win32manifest-when-interop-ing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>x += x++;</title>
		<link>http://www.ticklishtechs.net/2009/01/21/x-x/</link>
		<comments>http://www.ticklishtechs.net/2009/01/21/x-x/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 06:50:00 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[dotnet]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2009/01/21/x-x/</guid>
		<description><![CDATA[Ok, what does this expression do or mean? First of all: never write something like this in your code. Nobody understands the meaning with a single look and that will lead to confusion and maybe to a bug in your software someday.
Now let’s take a deeper look. First you may think about the difference between [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, what does this expression do or mean? First of all: never write something like this in your code. Nobody understands the meaning with a single look and that will lead to confusion and maybe to a bug in your software someday.</p>
<p>Now let’s take a deeper look. First you may think about the difference between <code>x++</code> and <code>++x</code>. If you write it as a single statement both expressions are equal, but if you use it as a part of a complex expression the first will evaluated to the value of <code>x</code> before increasing it; the second one will evaluate to the new value of <code>x</code>. So <code>y = x++;</code> leads to a different result for <code>y</code> as <code>y = ++x;</code>.</p>
<p><code>x+=a</code> simply is a ‘shortcut’ for <code>x=x+a</code>.</p>
<p>Now let’s do it step by step. For example <code>x</code> is <code>5</code>. Then first <code>x</code> will be increased by one to <code>6</code> but the old value will go into the formula that remains as <code>x=x+5</code>. Since <code>x</code> was increased before the result will be <code>11</code>.</p>
<p>If you think that is all right, than please take a break and test it with your favorite compiler. If you are a C or C++ guy you will in fact receive 11 as an answer and everything is fine. But if you are a C# or java guy <code>x</code> will be <code>10</code>. Why?</p>
<p>.Net as well as the Java Runtime are stack machines. The expression will be put on the stack step by step before evaluating the whole thing. At that time <code>x</code> is 5. <code>x</code> will be changed to <code>6</code> by the <code>x++</code> part, but that only happens in the main memory. The old value (<code>5</code>) is still on the stack. After executing the whole expression the changed <code>x</code> will be overwritten by <code>10</code> (<code>5+5</code>).</p>
<p>And once again: NEVER write code like this!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2009/01/21/x-x/feed/</wfw:commentRss>
		</item>
		<item>
		<title>throw null;</title>
		<link>http://www.ticklishtechs.net/2009/01/13/throw-null/</link>
		<comments>http://www.ticklishtechs.net/2009/01/13/throw-null/#comments</comments>
		<pubDate>Tue, 13 Jan 2009 06:50:00 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[coding]]></category>

		<category><![CDATA[dotnet]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2009/01/13/throw-null/</guid>
		<description><![CDATA[I found this somewhere and I think it’s worth to write a short (only a very short) entry.
throw null;
If you use this expression in your C# code it will throw a NullReferenceException. That is because the throw-statement needs an object of type Exception as its single parameter. But this very object is null in my [...]]]></description>
			<content:encoded><![CDATA[<p>I found this somewhere and I think it’s worth to write a short (only a very short) entry.</p>
<p><code>throw null;</code></p>
<p>If you use this expression in your C# code it will throw a <code>NullReferenceException</code>. That is because the <code>throw</code>-statement needs an object of type <code>Exception</code> as its single parameter. But this very object is <code>null</code> in my example.</p>
<p>I like this way to produce some exception while testing code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2009/01/13/throw-null/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flow</title>
		<link>http://www.ticklishtechs.net/2009/01/05/flow/</link>
		<comments>http://www.ticklishtechs.net/2009/01/05/flow/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 06:49:00 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[flow]]></category>

		<category><![CDATA[JaDAL]]></category>

		<category><![CDATA[visual studio]]></category>

		<category><![CDATA[vsx]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2009/01/05/flow/</guid>
		<description><![CDATA[It was very silent here in the past month. That was mainly because I was working on my diploma thesis until the end of September. After that I did my final exam and started working in Bonn. Now it is December and almost 2009. I’m sitting in a plane to Australia for holiday and have [...]]]></description>
			<content:encoded><![CDATA[<p>It was very silent here in the past month. That was mainly because I was working on my diploma thesis until the end of September. After that I did my final exam and started working in Bonn. Now it is December and almost 2009. I’m sitting in a plane to Australia for holiday and have much time to write articles. I will try to keep this blog alive and will write articles more frequently.</p>
<p>Today I will introduce <em><strong>Flow</strong></em>. With <em>Flow</em> you can model the behavior of nodes in a wireless sensor network (WSN) in a data driven and event driven manor. I developed <em>Flow</em> as part of my diploma thesis.</p>
<p><em>Flow</em> is build as a Visual Studio Addon (a VS Package) on top of the DSL-Tools containing three different domain specific languages to describe different parts of the software running on a sensor node. These different DSLs are working together and using most of the techniques I described earlier in this blog. E.g. my library JaDAL was initially build to support this diploma thesis.</p>
<p>You will find screenshots, more explanations and <em>Flow</em> itself on <a href="http://flow.irgendwie.net">http://flow.irgendwie.net</a>. While the webpage and the software are available in English the thesis itself is a pdf-document and can only be downloaded in a German version.</p>
<p>The software is fully working and if no wireless sensor network is available you can use a node simulator to evaluate <em>Flow</em>. The code is released under the new BSD license and also available for download.</p>
<h3>Screenshots:</h3>
<p>Dataflows modeled with <em>Flow</em> looks like that:</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2009/01/dataflow.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="dataflow" src="http://www.ticklishtechs.net/wp-content/uploads/2009/01/dataflow-thumb.png" border="0" alt="dataflow" width="456" height="191" /></a></p>
<p>The simulated sensor nodes are represented as Windows forms programmed by such dataflows:</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2009/01/simulatednode.png"><img style="border-top-width: 0px; display: block; border-left-width: 0px; float: none; border-bottom-width: 0px; margin-left: auto; margin-right: auto; border-right-width: 0px" title="simulatednode" src="http://www.ticklishtechs.net/wp-content/uploads/2009/01/simulatednode-thumb.png" border="0" alt="simulatednode" width="182" height="244" /></a></p>
<p>For more information just visit <a href="http://flow.irgendwie.net">http://flow.irgendwie.net</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2009/01/05/flow/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Microsoft Technical Summit in Berlin</title>
		<link>http://www.ticklishtechs.net/2008/11/06/microsoft-technical-summit-in-berlin/</link>
		<comments>http://www.ticklishtechs.net/2008/11/06/microsoft-technical-summit-in-berlin/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 21:37:09 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[dates]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2008/11/06/microsoft-technical-summit-in-berlin/</guid>
		<description><![CDATA[From 11/19 to 11/21/2008 I will be at the Microsoft Technical Summit in Berlin. The Technical Summit itself starts on 20th; on the 19th I will attend the 4th Academic Day.
If anyone will be at these conferences and likes to meet please drop me a line.
See you in Berlin.  
]]></description>
			<content:encoded><![CDATA[<p>From 11/19 to 11/21/2008 I will be at the <a href="http://www.technical-summit.de">Microsoft Technical Summit</a> in Berlin. The Technical Summit itself starts on 20th; on the 19th I will attend the <a href="http://www.technical-summit.de/4thMicrosoftAcademicDays_ts08.mspx?ActiveID=1343">4th Academic Day</a>.</p>
<p>If anyone will be at these conferences and likes to meet please drop me a line.</p>
<p>See you in Berlin. <img src='http://www.ticklishtechs.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2008/11/06/microsoft-technical-summit-in-berlin/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using Geonames.org webservice from .Net</title>
		<link>http://www.ticklishtechs.net/2008/11/02/using-geonamesorg-webservice-from-net/</link>
		<comments>http://www.ticklishtechs.net/2008/11/02/using-geonamesorg-webservice-from-net/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 14:33:14 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[dotnet]]></category>

		<category><![CDATA[geonames]]></category>

		<category><![CDATA[GPS]]></category>

		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2008/11/02/using-geonamesorg-webservice-from-net/</guid>
		<description><![CDATA[Lately I was looking for a way to translate geo coordinates (latitude and longitude form my gps device) to some sort of text or names. As you know I’m trying to geotag my photos using a gps logger and PhotoTagStudio. This data can be used to visualize the place a photo was taken on a [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I was looking for a way to translate geo coordinates (latitude and longitude form my gps device) to some sort of text or names. As you know I’m trying to geotag my photos using a gps logger and <a href="http://phototagstudio.irgendwie.net/">PhotoTagStudio</a>. This data can be used to visualize the place a photo was taken on a map (e.g. Google Maps or flickr!). The next step can be to use this data to describe the photo as well.</p>
<p>I think one should be able to translate a geo coordinate into at least the name of the county, the state and the city; maybe to the district or a street name, too. To achieve this I found the <a href="http://www.geonames.org/">geonames.org webpage</a>. This page collects exactly the data I need and allows searching via the website and a <a href="http://www.geonames.org/export/">webservice</a>.</p>
<p>The webservice itself consists of approximate <a href="http://www.geonames.org/export/ws-overview.html">30 REST methods</a> one can call by querying an URL. Most of these calls return a XML document (or optional a JSON document). Unfortunately  there is no SOAP / WSDL version of this webservice. For a .net and C# developer a SOAP webservice is very easy to consume but for such a REST / XML webservice you have to create the URLs yourself and parse the resulting XML document.</p>
<p>I started to create a library to query the webservice. This library provides a few static methods mapped to the most useable webservice-methods and returns good shaped .Net objects. These objects carry all the data coming from the webservice. At the moment this library is in an early beta status but you can use it in your own projects. It can be found on Codeplex: <a href="http://www.codeplex.com/GeonamesDotOrgDotNet">GeonamesDotOrgDotNet</a>, there you will find a small example and a demo application. When using this library you should take a look at the documentation of the geonames.org webservices since the interfaces are nearly the same.</p>
<p>I hope this is useful for someone. I will extend the library in the next weeks. Feature requests are welcome, so is help on the coding side.</p>
<p>Currently the following webservice calls are supported:</p>
<ul>
<li>findNearby</li>
<li>findNearbyPlaceName</li>
<li>findNearByWeather</li>
<li>findNearbyWikipedia</li>
<li>get</li>
<li>hierarchy</li>
<li>children</li>
<li>gtopo30</li>
<li>srtm3</li>
</ul>
<p>At the end a few random screenshots and a code snippet. For more information please take a look at the <a href="http://www.codeplex.com/GeonamesDotOrgDotNet">Codeplex project page</a>.</p>
<p><code>// finding some place in Berlin, Germany<br />
</code><code>// (using prefix m for decimal literals)<br />
Geoname Place =<br />
GeoNamesOrgWebservice.FindNearbyPlaceName(52.51m, 13.4m); </code></p>
<p>// getting all parents<br />
IEnumerable ParentPlaces = Place.Hierarchy();</p>
<p>// display the partents<br />
// (will print out something like:<br />
//  &#8220;Globe &gt; Europe &gt; Germany &gt; Land Berlin &gt; Berlin &gt;&#8221;)<br />
foreach (Geoname x in ParentPlaces)<br />
Console.Write(x.Name + &#8221; &gt; &#8220;);</p>
<p>The Classes of the Library:</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2008/11/classes.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="classes" src="http://www.ticklishtechs.net/wp-content/uploads/2008/11/classes-thumb.png" border="0" alt="classes" width="334" height="484" /></a></p>
<p>A screenshot of the demo application to test the library:</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2008/11/testapp.png"><img style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" title="testapp" src="http://www.ticklishtechs.net/wp-content/uploads/2008/11/testapp-thumb.png" border="0" alt="testapp" width="244" height="221" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2008/11/02/using-geonamesorg-webservice-from-net/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
