<?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>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>
	<lastBuildDate>Fri, 23 Jul 2010 06:07:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Be careful with certain ctors of XmlSerializer</title>
		<link>http://www.ticklishtechs.net/2010/07/23/be-careful-with-certain-ctors-of-xmlserializer/</link>
		<comments>http://www.ticklishtechs.net/2010/07/23/be-careful-with-certain-ctors-of-xmlserializer/#comments</comments>
		<pubDate>Fri, 23 Jul 2010 06:07:49 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2010/07/23/be-careful-with-certain-ctors-of-xmlserializer/</guid>
		<description><![CDATA[In my current project we’re using XmlSerializer a lot. At some point I need to write about 400 files with the XmlSerializer. For some reason I created a new XmlSerializer for each of these files.
I discovered during debugging a lot of debug messages in Visual Studio output window like:




'Application.vshost.exe' (Managed (v4.0.30319)): Loaded 'm0dayvr5'
'Application.vshost.exe' (Managed (v4.0.30319)): [...]]]></description>
			<content:encoded><![CDATA[<p>In my current project we’re using <a href="http://msdn.microsoft.com/en-us/library/swxzdhc0.aspx">XmlSerializer</a> a lot. At some point I need to write about 400 files with the XmlSerializer. For some reason I created a new XmlSerializer for each of these files.</p>
<p>I discovered during debugging a lot of debug messages in Visual Studio output window like:</p>
<table border="1">
<tbody>
<tr>
<td>
<pre>'Application.vshost.exe' (Managed (v4.0.30319)): Loaded 'm0dayvr5'
'Application.vshost.exe' (Managed (v4.0.30319)): Loaded 'oxxqw1rq'
'Application.vshost.exe' (Managed (v4.0.30319)): Loaded 'dgh3mgtl'
'Application.vshost.exe' (Managed (v4.0.30319)): Loaded '00sdpqlv'
'Application.vshost.exe' (Managed (v4.0.30319)): Loaded 'yokpozj4'</pre>
</td>
</tr>
</tbody>
</table>
<p>&#160;</p>
<p>Then I remembered that the XmlSerializer creates dynamic assemblies during runtime and loaded them into the AppDomain (and never unloads these assemblies since you cannot unload from an AppDoamin). In the <a href="http://msdn.microsoft.com/en-us/library/swxzdhc0.aspx">MSDN article</a> I found a solution that explains this behavior:</p>
<blockquote>
<h5>Dynamically Generated Assemblies</h5>
<p>To increase performance, the XML serialization infrastructure dynamically generates assemblies to serialize and deserialize specified types. The infrastructure finds and reuses those assemblies. This behavior occurs only when using the following constructors:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/71s92ee1.aspx">XmlSerializer.XmlSerializer(Type)</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/kw0f5wee.aspx">XmlSerializer.XmlSerializer(Type, String)</a></p>
<p><strong><em>If you use any of the other constructors, multiple versions of the same assembly are generated and never unloaded, which results in a memory leak and poor performance.</em></strong> The easiest solution is to use one of the previously mentioned two constructors. Otherwise, you must cache the assemblies in a Hashtable, as shown in the following example.</p>
</blockquote>
<p>Of course you can use any other data structure to do the caching. But you have to do it on your own if you do not use the two mentioned constructors. I’ve got no idea why Microsoft builds caching into the code for some constructors and not for others, but that’s the way it is.</p>
<h3>Some performance measurements</h3>
<p>I didn’t build a great benchmark, but at least I got a few numbers. Serializing multiple files without caching takes on my machine about 140ms in debug mode and 130ms in release mode. Each time. With caching only the first file takes this 140 / 130ms and every additional file took about 8ms (debug) or 6ms (release).</p>
<p>That’s a speedup of about 17x to 20x!</p>
<p>And you do not produce memory leaks!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2010/07/23/be-careful-with-certain-ctors-of-xmlserializer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PhotoTagStudio 0.7.1 released</title>
		<link>http://www.ticklishtechs.net/2010/07/16/phototagstudio-0-7-1-released/</link>
		<comments>http://www.ticklishtechs.net/2010/07/16/phototagstudio-0-7-1-released/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 08:13:05 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[PhotoTagStudio]]></category>
		<category><![CDATA[release]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2010/07/16/phototagstudio-0-7-1-released/</guid>
		<description><![CDATA[Today I released the new version of PhotoTagStudio with a very small improvement.
A new option was added to expand the tree of tags at startup.
See http://phototagstudio.irgendwie.net/
]]></description>
			<content:encoded><![CDATA[<p>Today I released the new version of PhotoTagStudio with a very small improvement.</p>
<p>A new option was added to expand the tree of tags at startup.</p>
<p>See <a href="http://phototagstudio.irgendwie.net/">http://phototagstudio.irgendwie.net/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2010/07/16/phototagstudio-0-7-1-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Include in VSIX property is missing</title>
		<link>http://www.ticklishtechs.net/2010/06/23/include-in-vsix-property-is-missing/</link>
		<comments>http://www.ticklishtechs.net/2010/06/23/include-in-vsix-property-is-missing/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 18:33:59 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dsl]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[visual studio 2010]]></category>
		<category><![CDATA[vsx]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2010/06/23/include-in-vsix-property-is-missing/</guid>
		<description><![CDATA[When using the Visual Studio 2010 SDK and creating VSIX packages, you will set for some files the Include in VSIX property within your DslPackage.

I’m not sure what append, maybe it happed on a project I imported from an older Visual Studio version. But for this project the property I needed so much was just [...]]]></description>
			<content:encoded><![CDATA[<p>When using the Visual Studio 2010 SDK and creating VSIX packages, you will set for some files the <em>Include in VSIX</em> property within your <em>DslPackage</em>.</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2010/06/1.png"><img style="display: inline; border: 0px;" src="http://www.ticklishtechs.net/wp-content/uploads/2010/06/1_thumb.png" border="0" alt="" width="369" height="221" /></a></p>
<p>I’m not sure what append, maybe it happed on a project I imported from an older Visual Studio version. But for this project the property I needed so much was just missing.</p>
<p>If the same happens to you, you can edit the DslPackage.csproj and add the following line:</p>
<pre class="code"><span style="color: blue;">&lt;</span><span style="color: #a31515;">ProjectTypeGuids</span><span style="color: blue;">&gt;</span>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};     {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}<span style="color: blue;">&lt;/</span><span style="color: #a31515;">ProjectTypeGuids</span><span style="color: blue;">&gt;
</span></pre>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2010/06/2.png"><img style="display: inline; border: 0px;" src="http://www.ticklishtechs.net/wp-content/uploads/2010/06/2_thumb.png" border="0" alt="" width="480" height="234" /></a> <a href="http://11011.net/software/vspaste"></a></p>
<p>It worked on my machine and I got this property back.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2010/06/23/include-in-vsix-property-is-missing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Setup with Visual Studio 2010 for an application that needs the full .net 4.0 framework</title>
		<link>http://www.ticklishtechs.net/2010/06/09/creating-a-setup-with-visual-studio-2010-for-an-application-that-needs-the-full-net-4-0-framework/</link>
		<comments>http://www.ticklishtechs.net/2010/06/09/creating-a-setup-with-visual-studio-2010-for-an-application-that-needs-the-full-net-4-0-framework/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 12:50:48 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[dotnet3.5]]></category>
		<category><![CDATA[dotnet4.0]]></category>
		<category><![CDATA[msi]]></category>
		<category><![CDATA[setup]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2010/06/09/creating-a-setup-with-visual-studio-2010-for-an-application-that-needs-the-full-net-4-0-framework/</guid>
		<description><![CDATA[When using Visual Studio 2010 or any other version to create msi setups you can define prerequisites that need to be installed before the application will install. For most .NET applications this will be at least the .NET Framework itself. But from version 3.5 on there are two editions of this framework: the Client Profile [...]]]></description>
			<content:encoded><![CDATA[<p>When using Visual Studio 2010 or any other version to create msi setups you can define prerequisites that need to be installed before the application will install. For most .NET applications this will be at least the .NET Framework itself. But from version 3.5 on there are two editions of this framework: the Client Profile and the Full Framework.</p>
<p>I created a setup and changed the prerequisites from Client Profile to the Full Framework. When testing this on a virgin machine the setup told me that I need to install the .NET 4.0 framework (that’s right) but then it directs me to the download of the Client Profile only.</p>
<p>To fix this, you have to change the InstallUrl of the .NET Framework Launch Condition:</p>
<ul>
<li>right-click on the setup project in solution explorer and choose View –&gt; Launch Conditions</li>
<li>here you will find a Launch Condition for the .NET Framework</li>
<li>select this Launch Condition and open the Properties Window</li>
<li>there you will find the InstallUrl property</li>
</ul>
<p>For the full .net 4.0 Framework change this URL to <a title="http://go.microsoft.com/fwlink/?LinkId=186913" href="http://go.microsoft.com/fwlink/?LinkId=186913">http://go.microsoft.com/fwlink/?LinkId=186913</a></p>
<p>For the Client Profile of the .net 4.0 Framework the URL can stay as it is: <a title="http://go.microsoft.com/fwlink/?LinkId=131000" href="http://go.microsoft.com/fwlink/?LinkId=131000">http://go.microsoft.com/fwlink/?LinkId=131000</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2010/06/09/creating-a-setup-with-visual-studio-2010-for-an-application-that-needs-the-full-net-4-0-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Deploy TT include files with a VSIX in Visual Studio 2010</title>
		<link>http://www.ticklishtechs.net/2010/05/01/deploy-tt-include-files-with-a-vsix-in-visual-studio-2010/</link>
		<comments>http://www.ticklishtechs.net/2010/05/01/deploy-tt-include-files-with-a-vsix-in-visual-studio-2010/#comments</comments>
		<pubDate>Sat, 01 May 2010 11:34:11 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dsl]]></category>
		<category><![CDATA[t4]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[visual studio 2010]]></category>
		<category><![CDATA[vsx]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2010/05/01/deploy-tt-include-files-with-a-vsix-in-visual-studio-2010/</guid>
		<description><![CDATA[What’s the problem?
First of all I have to explain to everybody what I’m talking about:
With Visual Studio 2010 Microsoft introduced a new way to deploy extensions to Visual Studio. Instead of creating a setup.exe that copies files, writes to the registry and calls devenv.exe with the /setup option one only needs such a VSIX file [...]]]></description>
			<content:encoded><![CDATA[<h3>What’s the problem?</h3>
<p>First of all I have to explain to everybody what I’m talking about:</p>
<p>With Visual Studio 2010 Microsoft introduced a new way to deploy extensions to Visual Studio. Instead of creating a setup.exe that copies files, writes to the registry and calls <code>devenv.exe</code> with the <code>/setup</code> option one only needs such a VSIX file that does all that is necessary to install an extension.</p>
<p>When working with the T4 (Template Transformation Toolkit) system one creates tt files with some kind of script that is used to generate source code within a user’s Visual Studio project. The Microsoft DSL Tools do the same: every DSL project contains a number of tt files that will generate all the code. If you take a look at such a file, you will only see two lines:</p>
<pre class="code"><span style="color: black">&lt;#@ Dsl </span><span style="color: red">processor</span><span style="color: black">=&quot;</span><span style="color: blue">DslDirectiveProcessor</span><span style="color: black">&quot; </span><span style="color: red">requires</span><span style="color: black">=&quot;</span><span style="color: blue">fileName='..\DslDefinition.dsl'</span><span style="color: black">&quot; #&gt;
&lt;#@ </span><span style="color: brown">include </span><span style="color: red">file</span><span style="color: black">=&quot;</span><span style="color: blue">Dsl\Diagram.tt</span><span style="color: black">&quot; #&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The magic happens with the include command. The real template code sits in the included file and not within every single project. When installing the DSL Tools extension to Visual Studio all these include files get installed somewhere where they can be found by the tt engine. </p>
<p>For my own DSL Languages I would like do the same: the user projects should only contain such two line tt files and include the rest of the template from other files. </p>
<h3>How to deploy tt template files?</h3>
<p>The following steps will show you how to deploy additional files with you DSL extension. </p>
<p>I will start from a newly created Domain-Specific Language Designer project. Such a project contains a <code>Dsl</code> and a <code>DslPackage</code> project where the <code>DslPackage</code> project creates besides of the <code>DslPackage.dll</code> a vsix file to install the designer onto another machine.</p>
<p>Our goal will be to add some tt files to the vsix and make them includable on the installed machine.</p>
<ol>
<li>Add a folder to the <code>DslPackage</code> project and name it <code>TextTemplates</code> (or any other name) </li>
<li>Add the tt files to this folder.
<ul>
<li>In the properties windows clear the “Custom Tool” property; otherwise Visual Studio will try to execute these templates within the <code>DslPackage</code> project. </li>
<li>set “Build Action” to “Content” </li>
<li>set “Include in VSIX” to “True” </li>
</ul>
</li>
<li>Add a file called <code>Additional.pkgdef</code> to the <code>DslPackage</code> project with the following content and
<ul>
<li>set “Build Action” to “Content” </li>
<li>set “Include in VSIX” to “True”<br />
<table border="1">
<tbody>
<tr>
<td>
<pre>[$RootKey$\TextTemplating\IncludeFolders]
[$RootKey$\TextTemplating\IncludeFolders\.tt]
&quot;IncludeMyDsl&quot;=&quot;$PackageFolder$\TextTemplates&quot;</pre>
</td>
</tr>
</tbody>
</table>
<p>Replace “IncludeMyDsl” by a unique name for your DSL but make sure it starts with the word “Include”. </li>
</ul>
</li>
<li>Edit the <code>source.extension.tt</code> in the <code>DslPackage</code> project and add the following line within the <code>Content</code> tag:
<p></p>
<table border="1">
<tbody>
<tr>
<td>
<pre>&lt;VsPackage&gt;Additional.pkgdef&lt;/VsPackage&gt;</pre>
</td>
</tr>
</tbody>
</table>
</li>
</ol>
<p>With these changes the tt files from the <code>TextTemplates</code> folder get packaged into the <code>vsix</code> file and will be accessible using the <code>&lt;include&gt;</code> tag on the machine where this extension is installed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2010/05/01/deploy-tt-include-files-with-a-vsix-in-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Be careful when using GetCallingAssembly() and always use the release build for testing</title>
		<link>http://www.ticklishtechs.net/2010/03/04/be-careful-when-using-getcallingassembly-and-always-use-the-release-build-for-testing/</link>
		<comments>http://www.ticklishtechs.net/2010/03/04/be-careful-when-using-getcallingassembly-and-always-use-the-release-build-for-testing/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 17:46:24 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[dotnet3.5]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2010/03/04/be-careful-when-using-getcallingassembly-and-always-use-the-release-build-for-testing/</guid>
		<description><![CDATA[This looks like such a innocent method but it lead to big trouble in one of my projects. But lets start with when someone would use this method that is declared as a static method in the Assembly class. In the MSDN you can read:
Returns the Assembly of the method that invoked the currently executing [...]]]></description>
			<content:encoded><![CDATA[<p>This looks like such a innocent method but it lead to big trouble in one of my projects. But lets start with when someone would use this method that is declared as a static method in the <code>Assembly</code> class. In the MSDN you can <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getcallingassembly.aspx">read</a>:</p>
<blockquote><p>Returns the Assembly of the method that invoked the currently executing method.</p></blockquote>
<p>In our project we had an assembly with a lot of helper methods. On of these gets resources from the calling assembly. In various places of our code we called this method to get icons or other resources. This method used exactly this <code>GetCallingAssembly()</code> method to figure out what assembly to look for resources.</p>
<p>That worked pretty good in debug mode but exceptions were thrown in release mode. We could not understand what is going on. It became even worse: when we build a release version and tried to debug that version (using Visual Studio Debugger) in worked again. It looked like a <a href="http://en.wikipedia.org/wiki/Heisenbug#Heisenbug">heisenbug</a>.</p>
<p>It took us some time to figure out what is also written in <a href="http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getcallingassembly%28VS.85%29.aspx">MSDN</a>:</p>
<blockquote><p>If the method that calls the <code>GetCallingAssembly</code> method is expanded inline by the compiler (that is, if the compiler inserts the function body into the emitted Microsoft intermediate language (MSIL), rather than emitting a function call), then the assembly returned by the <code>GetCallingAssembly</code> method is the assembly containing the inline code. This might be different from the assembly that contains the original method. To ensure that a method that calls the <code>GetCallingAssembly</code> method is not inlined by the compiler, you can apply the <code>MethodImplAttribute</code> attribute with <code>MethodImplOptions.NoInlining</code>.</p></blockquote>
<p>The JIT compiler moves code around to optimize for performance. Small methods (up to about 56 Byte IL-Code if I remember it right) can be inlined where the method call was before. But the compiler does this only in release, not in debug mode. Also when attaching the debugger to our release build the JIT compiler stopped inlining to enable debugging and our bug was gone.</p>
<p>After understanding this, the fix is easy. Just don’t allow the compiler to inline that particular method that calls <code>Assembly.GetCallingAssembly()</code>. Then the method stays in the assembly where the source code is written and everything will be fine.</p>
<pre class="code">[<span style="color: #2b91af;">MethodImplAttribute</span>(<span style="color: #2b91af;">MethodImplOptions</span>.NoInlining)]
<span style="color: blue;">public void </span>SomeFunction(<span style="color: blue;">int </span>i)
{
    <span style="color: green;">// ...
    </span><span style="color: blue;">var </span>a = <span style="color: #2b91af;">Assembly</span>.GetCallingAssembly();
    <span style="color: green;">// ...
</span>}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>This attribute does the trick and I recommend to use it on all methods that call <code>GetCallingAssembly()</code> and can be called form another assembly and need the <em>real </em>calling assembly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2010/03/04/be-careful-when-using-getcallingassembly-and-always-use-the-release-build-for-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Change event for Dependency Properties</title>
		<link>http://www.ticklishtechs.net/2010/02/15/a-change-event-for-dependency-properties/</link>
		<comments>http://www.ticklishtechs.net/2010/02/15/a-change-event-for-dependency-properties/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 11:38:16 +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>
		<category><![CDATA[wpf]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2010/02/15/a-change-event-for-dependency-properties/</guid>
		<description><![CDATA[WPF comes with Dependency Properties and everybody using WPF will know about these new kind of properties. When you define your own Dependency Properties in your own class you can pretty easy add a property change event handler:
public int MyProperty
{
    get { return (int)GetValue(MyPropertyProperty); }
    set { SetValue(MyPropertyProperty, value); [...]]]></description>
			<content:encoded><![CDATA[<p>WPF comes with Dependency Properties and everybody using WPF will know about these new kind of properties. When you define your own Dependency Properties in your own class you can pretty easy add a property change event handler:</p>
<pre class="code"><span style="color: blue;">public int </span>MyProperty
{
    <span style="color: blue;">get </span>{ <span style="color: blue;">return </span>(<span style="color: blue;">int</span>)GetValue(MyPropertyProperty); }
    <span style="color: blue;">set </span>{ SetValue(MyPropertyProperty, <span style="color: blue;">value</span>); }
}
<span style="color: blue;">public static readonly </span><span style="color: #2b91af;">DependencyProperty </span>MyPropertyProperty =
    <span style="color: #2b91af;">DependencyProperty</span>.Register(<span style="color: #a31515;">"MyProperty"</span>,
                        <span style="color: blue;">typeof</span>(<span style="color: blue;">int</span>),
                        <span style="color: blue;">typeof</span>(<span style="color: #2b91af;">MainWindow</span>),
                        <span style="color: blue;">new </span><span style="color: #2b91af;">UIPropertyMetadata</span>(0,
                            <strong>MyPropertyvalueChangeCallback</strong>));

<span style="color: blue;">private static void </span><strong>MyPropertyvalueChangeCallback</strong>
                        (<span style="color: #2b91af;">DependencyObject </span>d,
                         <span style="color: #2b91af;">DependencyPropertyChangedEventArgs </span>e)
{
}</pre>
<p>But how to add such a event handler to an already existing Dependency Property or somewhere else then in the defining class? E.g. to an property of a WPF-Control that was not build by you. Take a standard WPF-TextBox; both the <code>Text</code> and the <code>FontSize</code> properties are Dependency Properties but the <code>TextBox</code>-class only provides a change event for the <code>Text</code>-property. Nevertheless you can get a change event for any Dependency Property:</p>
<pre class="code"><span style="color: #2b91af;">DependencyPropertyDescriptor </span>dpd =
    <span style="color: #2b91af;">DependencyPropertyDescriptor</span>.FromProperty
        (<span style="color: #2b91af;">Control</span>.FontSizeProperty, <span style="color: blue;">typeof </span>(<span style="color: #2b91af;">TextBox</span>));
dpd.AddValueChanged(someTextBox, SomeTextBoxFontSizeChanged);</pre>
<p>Every time the FontSizeProperty on the instance <code>someTextBox</code> changes the given method is called. It’s that easy and you can implement this code everywhere not only within the class that defines the property.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2010/02/15/a-change-event-for-dependency-properties/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Foxit Reader vs. Acrobat Reader: the default program problem</title>
		<link>http://www.ticklishtechs.net/2010/02/07/foxit-reader-vs-acrobat-reader-the-default-program-problem/</link>
		<comments>http://www.ticklishtechs.net/2010/02/07/foxit-reader-vs-acrobat-reader-the-default-program-problem/#comments</comments>
		<pubDate>Sun, 07 Feb 2010 11:52:12 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[foxit]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[windows7]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2010/02/07/foxit-reader-vs-acrobat-reader-the-default-program-problem/</guid>
		<description><![CDATA[I’m a big fan of the Foxit pdf Reader. It is just so damn fast in comparison to Acrobat Reader when opening pdf documents. Yesterday I had to go through a bunch of pdfs each containing only one or two pages to find a specific one. While waiting for Acrobat Reader to open a file [...]]]></description>
			<content:encoded><![CDATA[<p>I’m a big fan of the <a href="http://www.foxitsoftware.com/pdf/reader/">Foxit pdf Reader</a>. It is just so damn fast in comparison to Acrobat Reader when opening pdf documents. Yesterday I had to go through a bunch of pdfs each containing only one or two pages to find a specific one. While waiting for Acrobat Reader to open a file I could open, check an close a few files with Foxit. If you are not using Foxit Reader give it a try&#8230;</p>
<p>But for some pdf features you will need the original Adobe Reader. E.g. some documents with fields to enter data, with scripts or DRM secured files won’t open in Foxit.</p>
<p>I always have both installed on my machine and Foxit is the default application for opening pdf documents. But this setting changed some time ago on my Windows 7 64 bit machine.</p>
<p>I reset the default program for pdf in windows control panel to Foxit and all icons of pdf documents changed to the Foxit one. I can double click a file and Foxit opens&#160; &#8211; great. But in the very moment Foxit comes up the default program is set to Acrobat Reader again. This happens all the time.</p>
<p>I’m not sure what’s going on here and what is involved. I was blaming Acrobat and searched for a solution on the Acrobat side of the problem. Nothing.</p>
<p>In the end an update of Foxit to the current version fixes my problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2010/02/07/foxit-reader-vs-acrobat-reader-the-default-program-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t respect .inf-files too much</title>
		<link>http://www.ticklishtechs.net/2010/01/19/dont-respect-inf-files-too-much/</link>
		<comments>http://www.ticklishtechs.net/2010/01/19/dont-respect-inf-files-too-much/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 23:50:55 +0000</pubDate>
		<dc:creator>Wolfram Bernhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[driver]]></category>
		<category><![CDATA[windows7]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2010/01/19/dont-respect-inf-files-too-much/</guid>
		<description><![CDATA[When I get a new laptop that always triggers a little cascade in my home network. I have three machines: An older laptop serves as a server, a quadcore desktop pc provides gaming power and the a newer laptop accompanies me wherever I go.
Some day ago I replaced the old server laptop (with WinXP) by [...]]]></description>
			<content:encoded><![CDATA[<p>When I get a new laptop that always triggers a little cascade in my home network. I have three machines: An older laptop serves as a server, a quadcore desktop pc provides gaming power and the a newer laptop accompanies me wherever I go.</p>
<p>Some day ago I replaced the old server laptop (with WinXP) by a newer one, now running Win7.&#160; My printer (<a href="http://www.brother.de/g3.cfm/s_page/65190/s_level/24390/s_product/DCP120CG1">Brother DCP-120C</a>) is a little aged now and it’s not a network printer. So I attached it to the server (via USB) and thus it’s accessible in the entire network.</p>
<p>Attaching the printer to Win7 worked flawlessly. Importing the printer (which involves copying the drivers) to another Win7-machine was not a problem either.</p>
<p>But my quadcore still runs WinXP and wouldn’t accept the drivers from the Win7-server. Instead a dialog asks me to provide the appropriate driver manually.</p>
<p>Okay, so I downloaded the latest DCP-120C-drivers for WinXP, unzipped them and guided XP to the .inf-files. XP said: “No, I can’t see the right drivers.”</p>
<p>Unfortunately there is no way to force WinXP to use certain printer-drivers. So I spend ten minutes playing the old yes-no-game before I took a look at the .inf-file. I have never dealt with .inf-files a lot but I noticed this line:</p>
<p><font face="Courier New">     <br /></font><font face="Courier New"><strong>&quot;Brother DCP-120C Printer&quot;&#160;&#160; = BRDP120C.PPD, BrotherDCP-120C65FA</strong>       <br /></font></p>
<p>Hmm… okay… it is there. My Brother DCP-120C Printer. Fine. Why doesn’t WinXP recognize it? I found another .inf-file in the driver-package with these line:</p>
<p><font face="Courier New">     <br /></font><font face="Courier New"><strong>&quot;Brother DCP-120C USB Printer&quot;&#160;&#160; = BRDP120C.PPD…        <br /></strong></font></p>
<p>Hmm… now the name is DCP-120C <strong>USB</strong> Printer. Do the funny name string make any dfference? I took a closer look at the printer device that was recognized by my server:</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2010/01/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.ticklishtechs.net/wp-content/uploads/2010/01/image_thumb1.png" width="121" height="129" /></a> </p>
<p>Okay, nice, there is no “Printer” in the name… can it be… well… I copied the line in the .inf-file and replaced “Printer” by “USB”:</p>
<p><font face="Courier New"><strong>&quot;Brother DCP-120C Printer&quot;&#160;&#160; = BRDP120C.PPD, BrotherDCP-120C65FA</strong>       <br /></font><font face="Courier New"><strong>&quot;Brother DCP-120C USB&quot;&#160;&#160; = BRDP120C.PPD, BrotherDCP-120C65FA</strong> </font></p>
<p><font face="Courier New"></font></p>
<p>Bingo! That did the trick. </p>
<p>When accessing printers installed on other network computers, the printer drivers really seem to be recognized by their name. That hurts a bit, but knowing it may help solving driver problem from time to time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2010/01/19/dont-respect-inf-files-too-much/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VMWare Workstation demands Administrator rights &#8211; even if you have those</title>
		<link>http://www.ticklishtechs.net/2010/01/19/vmware-workstation-demands-administrator-rights-even-if-you-have-those/</link>
		<comments>http://www.ticklishtechs.net/2010/01/19/vmware-workstation-demands-administrator-rights-even-if-you-have-those/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 22:53:09 +0000</pubDate>
		<dc:creator>Wolfram Bernhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[administration]]></category>
		<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2010/01/19/vmware-workstation-demands-administrator-rights-even-if-you-have-those/</guid>
		<description><![CDATA[Whenever I move my system to a new laptop I create a virtual machine from my old system. Sometimes it is easier to access stuff I forget to copy from a running system than from mounted backup devices.
To create virtual machines from a running system I use VMWare Workstation, which outperforms VirtualPC by far (imho).
Some [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever I move my system to a new laptop I create a virtual machine from my old system. Sometimes it is easier to access stuff I forget to copy from a running system than from mounted backup devices.</p>
<p>To create virtual machines from a running system I use <a href="http://www.vmware.com/products/workstation/">VMWare Workstation</a>, which outperforms VirtualPC by far (imho).</p>
<p>Some days ago I tried to create a VM from a Win7/64 system. I was quiet surprised when VMWare Workstation told me, I needed Administrator rights:</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2010/01/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.ticklishtechs.net/wp-content/uploads/2010/01/image_thumb.png" width="474" height="405" /></a> </p>
<p>&#160;</p>
<p>So what – I have administrative rights. But the Workstation didn’t believe me. Since that held me from moving to my new laptop I was really p*ssed.</p>
<p><a href="http://communities.vmware.com/thread/232530;jsessionid=AA54EA753EB5F4F329275A1F7112657F">Luckily some smart guy found this solution.</a></p>
<p>I think this is clearly a bug, but so far VmWare Workstation demand Administrator-rights in the literal sense: It only accepts, when you are logged in as THE Administrator:</p>
<ul>
<li>start <font face="Courier New">c:\Windows\system32\cmd.exe</font> from explorer using &quot;execute as administrator&quot;. </li>
<li>type <font face="Courier New">net user Administrator /active:yes</font></li>
<li>logoff &amp; reboot </li>
<li>login as Administrator </li>
<li>create your image </li>
<li>Complain at <a href="http://www.vmware.com/support/contacts/file-sr.html">VMWare</a>. </li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2010/01/19/vmware-workstation-demands-administrator-rights-even-if-you-have-those/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
