<?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>Wed, 05 Jan 2011 21:44:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Do it yourself: home automation</title>
		<link>http://www.ticklishtechs.net/2011/01/05/do-it-yourself-home-automation/</link>
		<comments>http://www.ticklishtechs.net/2011/01/05/do-it-yourself-home-automation/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 21:28:54 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[electronics]]></category>
		<category><![CDATA[hardware]]></category>
		<category><![CDATA[homeautomation]]></category>
		<category><![CDATA[microframework]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2011/01/05/do-it-yourself-home-automation/</guid>
		<description><![CDATA[For my new apartment I imagine some nice (or nerdy) infrastructure things. Since the apartment is currently building and I can decide how to do the wiring: we will get CAT7 Ethernet nearly everywhere for gigabit Ethernet. We will get a lot of power outlets, HDMI cables from the stereo to the TV and to [...]]]></description>
			<content:encoded><![CDATA[<p>For my new apartment I imagine some nice (or nerdy) infrastructure things. Since the apartment is currently building and I can decide how to do the wiring: we will get CAT7 Ethernet nearly everywhere for gigabit Ethernet. We will get a lot of power outlets, HDMI cables from the stereo to the TV and to a potential place for a projector and so on.</p>
<p>I was also looking into systems for home automation to control lights etc. using some commercial bus system like <a href="https://secure.wikimedia.org/wikipedia/en/wiki/KNX_%28standard%29">KNX</a>. But all these systems are boring, expensive, inflexible and absolutely not the kind of system I was willing to invest a few thousand euros in. They advertise all that stuff as programmable and ultra flexible. But you need some expensive software and special adapters to reprogram your house. To save light configuration and recall them by a button you need some light-configuration-controller-hardware (at about 200 Euro) and a guy to program it. Non of the classical home automation systems can be controlled with an iPad.</p>
<p>So I decided to build something for my apartment by myself. In this first post of many I will show you my basic ideas and later I’m planning to publish hardware schematic and software source code for single modules and maybe for the whole thing.</p>
<h3>The goal</h3>
<ul>
<li>Control every light in every room of my apartment
<ul>
<li>some will just turn on / off </li>
<li>some are dimmable </li>
</ul>
</li>
<li>Controlled by the regular light switches </li>
<li>A “Turn everything off” switch at the main door </li>
<li>Connected to my local network (e.g. webservice) </li>
<li>My personal application on an iPad </li>
</ul>
<p>optional (or later on):</p>
<ul>
<li>Control the motor for the projection screen </li>
<li>Control light by timers </li>
<li>Send infrared signals to the stereo and the tv set </li>
<li>Connected to the phone line (e.g. turn off the music when the phone rings) </li>
<li>Receive data from wireless sensors </li>
<li>Add a sensor to the washing machine and remind me when it’s finished </li>
<li>much more </li>
</ul>
<h3>The basic concept</h3>
<p>To control all this I will use some central microcontroller in my apartment. I decided to give the Microsoft Micro Framework a try. Since I’m already a .Net guy it should be pretty easy (and cool) to program my home in C#. I will use the <a href="http://www.tinyclr.com/hardware/12/fez-cobra/">FEZ Cobra</a> board. A 72 MHz ARM device with 12 MB RAM. It is probably already too powerful for my usage but who cares. It comes with USB-Ports where you can connect keyboards, joysticks or cameras. It has a build in Ethernet port, a SD-Card slot a lot of I/O Ports and everything else you need. One could also connect a TFT touch screen. With this guy I have all the connectability I need and enough power to implement all crazy ideas in software.</p>
<p>In the walls I will get push buttons instead of regular on/off switches and a single cable will be used for each of this button to a central place where my project resists. This way the Cobra board can receive signals from all buttons.</p>
<p>To control the lights the cables will be put to these place too. Here I will use relais or dimmers controlled by the Cobra board. For some lights I will try RGB LEDs with DMX controllers (I will later explain what that exactly is).</p>
<h3>A little bit more in detail</h3>
<p>The key to all this is my custom wiring with a lot of more cables in the walls then usually. Since the apartment will be newly build I can get this wiring without big problems.</p>
<p>My push buttons will be powered only by 12V or 24V DC not 240V AC (the normal power in Europe). This way it is much easier to connect it to the Cobra board. </p>
<p>For controlling dimmers I will use dimmers with a control input of 0 to 10V. Again: it’s much easier to buy some working and proofed dimmers for the 240V high voltage and my DIY projects only controls it by a 10V signal. The same for switches: the Cobra board will drive some relais with 12V DC and the relais will switch the 240V AC line.</p>
<p>Maybe I will use for dimmers and other light controlling stuff the digital <a href="https://secure.wikimedia.org/wikipedia/en/wiki/DMX512">DMX512</a> protocol. This is used on stages to control all the light effects and seems pretty simple to implement on the hardware and software side.</p>
<p>For most of these functions I will create small hardware modules and connect them to the Cobra board. This way the completion of the whole project is much easier. Some of these modules will be connected to the I/O ports of the Cobra directly and some will use a <a href="https://secure.wikimedia.org/wikipedia/en/wiki/I2c">I2C-Bus</a>.</p>
<h3>Some modules first</h3>
<p>To get stared I created hardware prototypes for the first modules of the system. These modules can be used for the purpose I’m planning or for something totally different (at the end these are only input and output port controlled by a microcontroller). I will show you the different modules in upcoming posts. Once finished the major parts I believe I will extend the whole system step by step. But let’s start with:</p>
<ul>
<li>I2C voltage converter
<ul>
<li>since the Cobra board uses 3,3V but all other modules will use 5V I need a simple voltage converter </li>
</ul>
</li>
<li>I2C input module for push buttons
<ul>
<li>using optocouplers and an I2C-I/O-chip </li>
</ul>
</li>
<li>I2C digital output modules
<ul>
<li>with an I2C-I/O-chip again and some drivers to power relais </li>
</ul>
</li>
<li>I2C analog outputs
<ul>
<li>to create the control voltage for 0-10V dimmers. </li>
</ul>
</li>
<li>DMX512 output </li>
</ul>
<p>&#160;</p>
<p>Within the next weeks I will start to write a post to each of these modules with detailed hardware and software explanations. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2011/01/05/do-it-yourself-home-automation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Developing R#-PlugIns with a little comfort?</title>
		<link>http://www.ticklishtechs.net/2011/01/03/developing-r-plugins-with-a-little-comfort/</link>
		<comments>http://www.ticklishtechs.net/2011/01/03/developing-r-plugins-with-a-little-comfort/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 12:44:16 +0000</pubDate>
		<dc:creator>Wolfram Bernhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[resharper]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[visual studio 2010]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/?p=342</guid>
		<description><![CDATA[I am playing around with R#-plugins these days. I have started off with this nice introduction. Unfortunately it silences about some problems that may occur to you in the beginning. 1) When trying to copy the given source code you&#8217;ll mention that all the classes are unknown to Visual Studio, because all a lot of [...]]]></description>
			<content:encoded><![CDATA[<p>I am playing around with R#-plugins these days. I have started off with <a href="http://devlicio.us/blogs/hadi_hariri/archive/2010/01/12/writing-plug-ins-for-resharper-part-1-of-undefined.aspx">this</a> nice introduction. Unfortunately it silences about some problems that may occur to you in the beginning.</p>
<p>1) When trying to copy the given source code you&#8217;ll mention that all the classes are unknown to Visual Studio, because all a lot of references are missing. So far I have no clue about the R#-class-architecture. So I started <a href="http://www.red-gate.com/products/dotnet-development/reflector/">.NET Reflector</a>, open ALL the .dlls in the R#/bin-folder into Reflector and use the search to find the .dlls to reference in my project.</p>
<p>2) When you have your first R#-plugin ready you want to test it. To do so you have to copy the dll containing your plugin in the R#-plugin folder. You may want to do this in a post-build event like this:</p>
<p><code><br />
copy $(TargetPath) "C:\Program Files (x86)\JetBrains\ReSharper\v5.1\Bin\PlugIns\WobTest"<br />
</code></p>
<p>When you build your project with this post-build event it fails. This doesn&#8217;t work for two reasons. First: Win 7 denies access to that folder. Second: after another start of Visual Studio R# has loaded the plugin so you can&#8217;t copy a newer version over it.</p>
<p>My solution to this is a .cmd that starts Visual Studio without R# (<code>devenv /safemode</code>). I run this .cmd as administrator. </p>
<p>Now at least I can debug my plugins by starting another instance of Visual Studio (not in safemode!)</p>
<p>This solution is not cool, because developing R#-plugin without using R# in the development-process sucks&#8230;. any ideas?</p>
<h3>a better solution&#8230;</h3>
<p>Some minutes after I published this post, Benjamin pointed me to <a href="http://www.codeproject.com/KB/cs/r_gettingStarted.aspx">this</a> page. Forget about my lines to 2). You don&#8217;t need a silly .cmd run as administrator not a post-build event. All you need to do is to start your debugging Visual Studio the the command line option /ReSharper.Plugin followed by the path to your plugin-dll.<br />
<code><br />
/ReSharper.Plugin "R:\sandbox\ReSharperPlugInTest\PublicGoesVirtual\PublicGoesVirtual\bin\Debug\PublicGoesVirtual.dll"</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2011/01/03/developing-r-plugins-with-a-little-comfort/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cannot access VMware Server Web Access</title>
		<link>http://www.ticklishtechs.net/2011/01/02/cannot-access-vmware-server-web-access/</link>
		<comments>http://www.ticklishtechs.net/2011/01/02/cannot-access-vmware-server-web-access/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 12:51:00 +0000</pubDate>
		<dc:creator>Benjamin Schröter</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[VMWare]]></category>

		<guid isPermaLink="false">http://www.ticklishtechs.net/2011/01/02/cannot-access-vmware-server-web-access/</guid>
		<description><![CDATA[I’m running a VMware Server 2 on a Linux box and access this service via the VMware Server Web Interface at https://server-name:8333. This is a pretty usual way of interacting with VMware Server. But suddenly I cannot access the website any more. Internet Explorer just said “Loading…” forever but nothing happened. If the same happened [...]]]></description>
			<content:encoded><![CDATA[<p>I’m running a VMware Server 2 on a Linux box and access this service via the VMware Server Web Interface at <code>https://server-name:8333</code>. This is a pretty usual way of interacting with VMware Server.</p>
<p>But suddenly I cannot access the website any more. Internet Explorer just said “Loading…” forever but nothing happened.</p>
<p>If the same happened to you try to switch Internet Explorer into <em>Compatibility View </em>and it may work again (it did on my machine).</p>
<p><a href="http://www.ticklishtechs.net/wp-content/uploads/2011/01/a.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="a" border="0" alt="a" src="http://www.ticklishtechs.net/wp-content/uploads/2011/01/a_thumb.png" width="335" height="168" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ticklishtechs.net/2011/01/02/cannot-access-vmware-server-web-access/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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' [...]]]></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 [...]]]></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>2</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 [...]]]></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>1</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 [...]]]></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>1</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); } } public static [...]]]></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>
	</channel>
</rss>

