<?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>Damian&#039;s Blog &#187; Uncategorized</title>
	<atom:link href="http://damianblog.com/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://damianblog.com</link>
	<description>.NET from Geneva, Switzerland</description>
	<lastBuildDate>Mon, 09 Apr 2012 23:45:42 +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>HTC Gingerbread&#8211;automatically switching from Wifi  to costly data connection</title>
		<link>http://damianblog.com/2011/05/30/htc-gingerbreadautomatically-switching-from-wifi-to-costly-data-connection/</link>
		<comments>http://damianblog.com/2011/05/30/htc-gingerbreadautomatically-switching-from-wifi-to-costly-data-connection/#comments</comments>
		<pubDate>Mon, 30 May 2011 14:17:23 +0000</pubDate>
		<dc:creator>damian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://damianblog.com/2011/05/30/htc-gingerbreadautomatically-switching-from-wifi-to-costly-data-connection/</guid>
		<description><![CDATA[I have an HTC Incredible S, and it’s a very nice phone indeed. I recently upgraded Android 2.3.3 (Gingerbread), and discovered that the Wifi connection was dropping in places at home where it had a perfectly usable (albeit weak) Wifi signal.&#160; Places where previously it had worked. I fiddled with my Wifi base station, repositioning [...]]]></description>
			<content:encoded><![CDATA[<p>I have an <a href="http://www.htc.com/www/product/incredibles/overview.html">HTC Incredible S</a>, and it’s a very nice phone indeed.</p>
<p>I recently upgraded <a href="http://developer.android.com/sdk/android-2.3-highlights.html">Android 2.3.3</a> (Gingerbread), and discovered that the Wifi connection was dropping in places at home where it had a perfectly usable (albeit weak) Wifi signal.&#160; Places where previously it had worked.</p>
<p>I fiddled with my Wifi base station, repositioning it, to no avail.</p>
<p>Finally I googled and found that <a href="http://forum.xda-developers.com/archive/index.php/t-1058450.html">HTC had decided to switch from Wifi to data if the Wifi signal dropped below a certain strength (88dbm)</a>.&#160; How nice of them to decide on my behalf that I wanted to switch from my (free) Wifi to my (expensive) data plan, even though I still had a perfectly usable (and free) Wifi connection – one that worked perfectly well in the previous OS version.</p>
<p>This is annoying for a couple of reasons.&#160; Firstly I can now run up horrendous data plan charges even though I’m within range of my Wifi.&#160; Secondly, I have services I run on my local Wifi (IP Cams, remote control software) that can no longer connect when I’m off my Wifi.</p>
<p>I’ve been a big HTC fan for a long time, and have gone through many of their ‘phones.&#160; This is a big disappointment for me – it stinks of paternalism/arrogance – deciding what is best for me without giving me a chance to override it.&#160; I am sure that it isn’t arrogance/paternalism – I am sure it made perfectly good engineering sense, perhaps because less battery will be consumed on data than on Wifi when on a weak link, but <strong>give me a choice</strong>.</p>
<p>I contacted HTC support and was told that yes, this behavior is new and that no, there was no way to downgrade – the suggestion was to switch off the Data connection when I was at home. Right, as if I will remember to do that.</p>
<p>I’ve ended up installing <a href="http://tasker.dinglisch.net/">Tasker</a>, and setting up a rule to switch off my Data connection when within range of my home Wifi.&#160; Not ideal, but it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://damianblog.com/2011/05/30/htc-gingerbreadautomatically-switching-from-wifi-to-costly-data-connection/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Generating Silverlight / Windows Phone compatible Thrift proxies</title>
		<link>http://damianblog.com/2011/01/11/generating-silverlight-windows-phone-compatible-thrift-proxies/</link>
		<comments>http://damianblog.com/2011/01/11/generating-silverlight-windows-phone-compatible-thrift-proxies/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 08:05:13 +0000</pubDate>
		<dc:creator>damian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://damianblog.com/?p=311</guid>
		<description><![CDATA[Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk, and OCaml. http://thrift.apache.org/ There are two reasons for this post: to float some ideas for [...]]]></description>
			<content:encoded><![CDATA[<p><em>Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, Smalltalk, and OCaml. <a href="http://thrift.apache.org/">http://thrift.apache.org/</a></em></p>
<p>There are two reasons for this post:</p>
<ul>
<li>to float some ideas for C#changes to the <a href="http://mail-archives.apache.org/mod_mbox/thrift-dev/">Thrift development community</a>.</li>
<li>to remind myself in the future what I need to do to download, modify and build the Windows Thrift compiler, and </li>
</ul>
<p>The idea is to maintain backwards compatibility, whilst at the same time generating Silverlight (and consequently Windows Phone 7) compatible proxies.</p>
<p>There are two sets of changes.&#160; One to the C# code generator (<a href="http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/src/generate/t_csharp_generator.cc?view=markup">t_cpp_generator.cpp</a>), and the other to the runtime files (mainly <a href="http://svn.apache.org/viewvc/thrift/trunk/lib/csharp/src/Transport/THttpClient.cs?view=markup">THttpClient.cs</a>).</p>
<h3></h3>
<h2>Downloading and building the thrift compiler</h2>
<p>To try out these changes on Windows, first install the latest version of Cygwin from <a href="http://cygwin.com/">http://cygwin.com/</a>, then install the various packages as described here: <a href="http://wiki.apache.org/thrift/ThriftInstallationWin32">http://wiki.apache.org/thrift/ThriftInstallationWin32</a></p>
<p>You’ll also need to install Subversion.</p>
<p>Next pop open the Cygwin shell, and fetch the latest source, as described here: <a href="http://thrift.apache.org/download/">http://thrift.apache.org/download/</a></p>
<p>Finally, build the source you downloaded, again as described here:</p>
<p><a href="http://wiki.apache.org/thrift/ThriftInstallationWin32">http://wiki.apache.org/thrift/ThriftInstallationWin32</a></p>
<p>In my environment I build using:</p>
<p><a href="http://damianblog.com/wp-content/uploads/2011/01/image3.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://damianblog.com/wp-content/uploads/2011/01/image_thumb3.png" width="374" height="69" /></a></p>
<p>And then I run the new thrift compiler:</p>
<p><a href="http://damianblog.com/wp-content/uploads/2011/01/image4.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://damianblog.com/wp-content/uploads/2011/01/image_thumb4.png" width="535" height="95" /></a></p>
<h3></h3>
<h2>Code Generator changes</h2>
<p>The code generator (<a href="http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/src/generate/t_csharp_generator.cc?view=markup">t_cpp_generator.cpp</a>) changes involve generating two additional methods for each “standard” method: a Begin_… method and an End_… method.</p>
<p>Whereas previously there might just have been a method such as this: </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> SyncState getSyncState(<span style="color: #0000ff">string</span> authenticationToken);</pre>
<p><!--CRLF--></div>
</div>
<p>Now, two additional methods get generated:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #cc6633">#if</span> SILVERLIGHT</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> IAsyncResult Begin_getSyncState(AsyncCallback callback, <span style="color: #0000ff">object</span> state, <span style="color: #0000ff">string</span> authenticationToken);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> SyncState End_getSyncState(IAsyncResult asyncResult);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #cc6633">#endif</span></pre>
<p><!--CRLF--></div>
</div>
<p>The two methods allow for the asynchronous invocation of methods, using the standard .NET asynchronous invocation pattern.</p>
<p>In addition, the generated standard method (“getSyncState”) method is modified when building for Silverlight, to make use of the Begin… and End… methods:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> SyncState getSyncState(<span style="color: #0000ff">string</span> authenticationToken)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #cc6633">#if</span> !SILVERLIGHT</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span>     send_getSyncState(authenticationToken);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>     <span style="color: #0000ff">return</span> recv_getSyncState();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> <span style="color: #cc6633">#else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     var asyncResult = Begin_getSyncState(<span style="color: #0000ff">null</span>, <span style="color: #0000ff">null</span>, authenticationToken);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     <span style="color: #0000ff">return</span> End_getSyncState(asyncResult);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span> <span style="color: #cc6633">#endif</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>As you can see, when not running Silverlight the standard code path is invoked, but when running Silverlight the asynchronous methods are invoked (the End… method blocks the current thread until the Begin… method completes).&#160; This is not something you should be doing on the UI thread.</p>
<p>The generated Begin… and End… methods are pretty thin:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #0000ff">public</span> IAsyncResult Begin_getSyncState(AsyncCallback callback, <span style="color: #0000ff">object</span> state, <span style="color: #0000ff">string</span> authenticationToken)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span>     <span style="color: #0000ff">return</span> send_getSyncState(callback, state, authenticationToken);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> <span style="color: #0000ff">public</span> SyncState End_getSyncState(IAsyncResult asyncResult)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     oprot_.Transport.EndFlush(asyncResult);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     <span style="color: #0000ff">return</span> recv_getSyncState();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Note the call to EndFlush above – this is one of the changes made to the runtime.&#160; The other is invoked by the generated send_getSyncState method:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.03%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; height: 232px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum1">   1:</span> <span style="color: #cc6633">#if</span> SILVERLIGHT</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum2">   2:</span> <span style="color: #0000ff">public</span> IAsyncResult send_getSyncState(AsyncCallback callback, <span style="color: #0000ff">object</span> state, <span style="color: #0000ff">string</span> authenticationToken)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum3">   3:</span> <span style="color: #cc6633">#else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum4">   4:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">void</span> send_getSyncState(<span style="color: #0000ff">string</span> authenticationToken)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum5">   5:</span> <span style="color: #cc6633">#endif</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum6">   6:</span> {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum7">   7:</span>     oprot_.WriteMessageBegin(<span style="color: #0000ff">new</span> TMessage(<span style="color: #006080">&quot;getSyncState&quot;</span>, TMessageType.Call, seqid_));</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum8">   8:</span>     getSyncState_args args = <span style="color: #0000ff">new</span> getSyncState_args();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum9">   9:</span>     args.AuthenticationToken = authenticationToken;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum10">  10:</span>     args.Write(oprot_);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum11">  11:</span>     oprot_.WriteMessageEnd();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum12">  12:</span> <span style="color: #cc6633">#if</span> SILVERLIGHT</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum13">  13:</span>     <span style="color: #0000ff">return</span> oprot_.Transport.BeginFlush(callback, state);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum14">  14:</span> <span style="color: #cc6633">#else</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum15">  15:</span>     oprot_.Transport.Flush();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum16">  16:</span> <span style="color: #cc6633">#endif</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060" id="lnum17">  17:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>The generated recv_getSyncState() has not changed.</p>
<p>The changes in the generated code boil down to asynchronous invocations at the transport layer (BeginFlush and EndFlush).</p>
<p>There are also changes to #ifdef out the Serializable attribute for generated structs, since this is not supported by Silverlight.</p>
<h2>Runtime changes</h2>
<p>There are minor tweaks required to THashSet, TProtocol and TBinaryProtocol because Silverlight does not support the full .NET framework API.</p>
<p>The main change is to TTransport.cs to introduce the BeginFlush and EndFlush methods shown above, and then to THttpClient.cs to actually implement these methods.</p>
<p>The existing Flush method is #ifdefed out when building using Silverlight, because it makes synchronous calls which are not supported by Silverlight.</p>
<p>Instead, the BeginFlush builds a request and then invokes the <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetrequeststream.aspx">HttpWebRequest.BeginGetRequestStream</a> method, passing a local GetRequestStreamCallback method as the callback.</p>
<p>The GetRequestStreamCallback method is invoked once the runtime has the request stream.&#160; It then writes out the data and invokes the <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.begingetresponse.aspx">HttpWebRequest.BeginGetResponse</a> method, passing a local GetResponseCallback method as callback.</p>
<p>The GetResponseCallback notifies the original caller (in the generated code) that the request has now completed.</p>
<p>The EndFlush method waits for the corresponding BeginFlush method to complete, and if there was an exception thrown at any point, it raises the corresponding exception.</p>
<h3></h3>
<h3>The changes</h3>
<p>The changes files are <a href="http://damianblog.com/SilverlightThriftChanges.zip">here</a>.&#160; If there is interest and these changes make sense, I’ll <a href="http://wiki.apache.org/thrift/HowToContribute">submit a patch</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://damianblog.com/2011/01/11/generating-silverlight-windows-phone-compatible-thrift-proxies/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>To right click running Vista on new (late 2008) MacBook Pros</title>
		<link>http://damianblog.com/2008/10/26/to-right-click-running-vista-on-new-late-2008-macbook-pros/</link>
		<comments>http://damianblog.com/2008/10/26/to-right-click-running-vista-on-new-late-2008-macbook-pros/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 11:17:58 +0000</pubDate>
		<dc:creator>dmehers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://damianblog.com/2008/10/26/to-right-click-running-vista-on-new-late-2008-macbook-pros/</guid>
		<description><![CDATA[All the documentation says to press two-fingers and click, but actually you must press down three fingers and then click to right-click when running Vista, Boot Camped on the new MacBook Pros (late 2008).]]></description>
			<content:encoded><![CDATA[<p>All the documentation says to press two-fingers and click, but actually you must press down <strong>three</strong> fingers and then click to right-click when running Vista, Boot Camped on the new MacBook Pros (late 2008).</p>
]]></content:encoded>
			<wfw:commentRss>http://damianblog.com/2008/10/26/to-right-click-running-vista-on-new-late-2008-macbook-pros/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving a blog hosted at WordPress.com to Webhost4life</title>
		<link>http://damianblog.com/2008/08/30/moving-a-blog-hosted-at-wordpresscom-to-webhost4life/</link>
		<comments>http://damianblog.com/2008/08/30/moving-a-blog-hosted-at-wordpresscom-to-webhost4life/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 15:01:32 +0000</pubDate>
		<dc:creator>dmehers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://damianblog.com/2008/08/30/moving-a-blog-hosted-at-wordpresscom-to-webhost4life/</guid>
		<description><![CDATA[A couple of days ago I decided to move this blog from being hosted at WordPress,com, to an account I have at Webhost4life.&#160; You can add new domains to your account for only US$15 a year. When I set the blog up at WordPress.com, I ordered my custom domain (damianblog.com) and that is what I [...]]]></description>
			<content:encoded><![CDATA[<p>A couple of days ago I decided to move this blog from being hosted at WordPress,com, to an account I have at Webhost4life.&#160; You can add new domains to your account for only US$15 a year.</p>
<p>When I set the blog up at WordPress.com, I ordered my custom domain (damianblog.com) and that is what I have been using.</p>
<h3>Export your WordPress.com hosted blog</h3>
<p>The first thing I did was to export my blog from my WordPress.com account, by logging in to WordPress.com administration page for Damianblog, clicking on Manage, and then clicking on Export:</p>
<p><a href="http://www.atadore.com/images/MovingabloghostedatWordpresstoWebhost4li_DF84/image.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="344" alt="image" src="http://www.atadore.com/images/MovingabloghostedatWordpresstoWebhost4li_DF84/image_thumb.png" width="410" border="0" /></a> </p>
<p>This generated an XML file which I saved on my local hard disk.</p>
<h3>Installing WordPress on webhost4life</h3>
<p>Webhost4life offer a an automated installation of WordPress using the &quot;Php Free Plug-ins&quot; item on the &quot;Site Admin&quot; tab of their control panel.&#160; I first tried using this, however it currently installs version 2.0.3, which will not import the file I'd just exported from WordPress.com. </p>
<p>After a little searching I came across <a href="http://forum.webhost4life.com/1775/ShowPost.aspx">this excellent page</a>, which explains in detail what you need to do to set up the latest version of WordPress. </p>
<p>It worked well for me, except for step 18 (giving NETWORK access) - I found I had to give access to IUSER_DEDI... and also IUSER_&lt;webhost4life account name&gt;. </p>
<p>I also created the zip at step 14 as 'damianblog.zip' and copied that to my root directory and then unzipped it, so that WordPress was now installed under a 'damianblog' directory under my account root directory.</p>
<h3>Setting up the damianblog DNS so that it points to Webhost4life</h3>
<p>In the webhost4life control panel I went to the &quot;Domain Name&quot; item on the &quot;Domains&quot; tab in the control panel and added damianblog.com to map to the damianblog directory to which I'd installed WordPress. </p>
<p>I paid my US$15, and I was given the name of two domain servers that I could now use to resolve damianblog.com.</p>
<h3>Configuring your domain's DNS servers to point to the webhost4life servers</h3>
<p>In the WordPress.com admin site I clicked on Upgrades and then on Domains (to the right of &quot;Upgrades&quot; and &quot;Gifts&quot;) and saved the Customer Number shown at the bottom of the page, and then clicked on &quot;Manage Your Domains&quot; at the very bottom of the page.</p>
<p>This took me to a new page on securepaynet.net on which I entered my Customer Number that I just saved, and my password.&#160; I clicked on damianblog.com and then clicked on &quot;Nameservers&quot; (the fourth tab), selected &quot;Custom nameservers&quot;, and entered the name of the two name servers I'd been given when I set up the damianblog domain name in the Webhost4life control panel.</p>
<p>An hour or so later, when I pinged damianblog.com it returned my webhost4life IP address.</p>
<h3>Panic</h3>
<p>I went into my new WordPress admin page on webhost4life, and clicked on Settings (on the right-hand part of the page), and made sure the WordPress address (URL) was <a href="http://damianblog.com">http://damianblog.com</a></p>
<p>I clicked on the Import link in the admin page, and imported the XML file I'd exported from the old blog hosted at WordPress.com</p>
<p>I checked, and sure enough when I went to <a href="http://damianblog.com">http://damianblog.com</a> all was well.&#160; I could relax.</p>
<p>As an afterthought I tried clicking on <a href="http://weblogs.asp.net/scottgu/archive/2007/03/05/video-of-scott-guthrie-shooting-private-donut-and-some-good-asp-net-ajax-links.aspx">one of the links</a> on the web that pointed to my blog.&#160; It didn't work.&#160; Aggh.</p>
<p>It turns out that the default Permalink URL in my new blog was of the form <code><a href="http://damianblog.com/?p=123">http://damianblog.com/?p=123</a></code>, whereas all my old postings hosted on WordPress.com were of the form <a title="http://damianblog.com/2007/02/25/ajax-screencast/" href="http://damianblog.com/2007/02/25/ajax-screencast/">http://damianblog.com/2007/02/25/ajax-screencast/</a></p>
<p>I went to the Permalink section but none of the common settings were in the form I wanted (they all wanted to add 'index.php' to the URL).&#160; I could configure a custom structure to be the way I wanted, but when you clicked on URLs the page was not found:</p>
<p><a href="http://www.atadore.com/images/MovingabloghostedatWordpresstoWebhost4li_DF84/image_3.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="318" alt="image" src="http://www.atadore.com/images/MovingabloghostedatWordpresstoWebhost4li_DF84/image_thumb_3.png" width="444" border="0" /></a> </p>
<p>The solution was to create a small PHP file which handled the &quot;URL Not Found&quot; error and remapped the page as described <a href="http://www.keyboardface.com/archives/2007/09/07/update-for-wordpress-permalinks-on-iis/">here</a>.&#160; Just be careful when copying the PHP code from the web page because some of the single quotes are not the standard quotes that they should be.</p>
<h3>Finally: the Simpla Theme</h3>
<p>The new WordPress installation did not come with the theme I've chosen: <a href="http://ifelse.co.uk/simpla">Simpla</a>.&#160; Installing it was pretty easy, I just unzipped the theme from <a title="http://ifelse.co.uk/simpla" href="http://ifelse.co.uk/simpla">http://ifelse.co.uk/simpla</a> into the /wp-content/themes/ directory.&#160; </p>
<p>Unfortunately none of my widgets showed on the right hand side.&#160; I had to make a couple of <a href="http://stuart.amanzi.co.nz/2006/05/30/new-simpla-theme-with-widgets/">small modifications</a> to get that resolved.</p>
<h3>Done</h3>
<p>Now it all seems to be working properly and I can customize my installation as I wish.</p>
]]></content:encoded>
			<wfw:commentRss>http://damianblog.com/2008/08/30/moving-a-blog-hosted-at-wordpresscom-to-webhost4life/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A new Z-Wave blog (home automation)</title>
		<link>http://damianblog.com/2008/08/30/a-new-z-wave-blog-home-automation/</link>
		<comments>http://damianblog.com/2008/08/30/a-new-z-wave-blog-home-automation/#comments</comments>
		<pubDate>Sat, 30 Aug 2008 09:09:05 +0000</pubDate>
		<dc:creator>dmehers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://damianblog.com/2008/08/30/a-new-z-wave-blog-home-automation/</guid>
		<description><![CDATA[Z-Wave is a home automation technology which uses a mesh network to allow devices to talk to each other.&#160; Some devices, such as infrared motion sensors can run for years off of batteries, since their power requirements are so low.&#160; Other devices that are wired-in (such as light switches) act as relays between devices, thus [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Z-Wave">Z-Wave</a> is a home automation technology which uses a mesh network to allow devices to talk to each other.&#160; </p>
<p>Some devices, such as infrared motion sensors can run for years off of batteries, since their power requirements are so low.&#160; </p>
<p>Other devices that are wired-in (such as light switches) act as relays between devices, thus forming the mesh.</p>
<p>I've got a few of these devices set up now, and have ordered a load more to fully automate my home.&#160; I'm going to be talking about the purchase experience, installation, configuration, and controlling them from software.</p>
<p>I didn't want to &quot;pollute&quot; this blog with a bunch of Z-Wave information, so I've just started a new blog at <a href="http://www.thezwave.com/"><strong><font size="4">http://www.thezwave.com/</font></strong></a>&#160; </p>
<p>I'll be posting there as my Z-Wave experience evolves.</p>
]]></content:encoded>
			<wfw:commentRss>http://damianblog.com/2008/08/30/a-new-z-wave-blog-home-automation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Attending PDC 2008</title>
		<link>http://damianblog.com/2008/06/07/attending-pdc-2008/</link>
		<comments>http://damianblog.com/2008/06/07/attending-pdc-2008/#comments</comments>
		<pubDate>Sat, 07 Jun 2008 15:20:34 +0000</pubDate>
		<dc:creator>dmehers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://damianblog.wordpress.com/2008/06/07/attending-pdc-2008/</guid>
		<description><![CDATA[Last year Microsoft announced the 2007 Professional Developers Conference (PDC) and I immediately booked the flights and hotel.&#160; They then canceled the PDC.&#160; Nevertheless I flew out to LA and had a great time spending a week immersed in technology, doing my very own "Personal" PDC, with no interruptions, spending all the hours I wanted.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Last year Microsoft announced the <a href="http://blogs.msdn.com/pdc/archive/2006/12/23/developers-start-your-engines-the-next-pdc-is-on-the-books.aspx" target="_blank">2007 Professional Developers Conference</a> (PDC) and I immediately booked the flights and hotel.&nbsp; They then <a href="http://blogs.msdn.com/pdc/archive/2007/05/24/pdc-update.aspx" target="_blank">canceled the PDC</a>.&nbsp; Nevertheless I flew out to LA and had a great time spending a week immersed in technology, doing my very own "Personal" PDC, with no interruptions, spending all the hours I wanted.&nbsp; It took me right back to the days before I was married, before I had kids, and I guess before I had a life.</p>
<p>Microsoft have just <a href="http://microsoftpdc.com/" target="_blank">announced the 2008 PDC in LA</a>, and I've signed up for it.&nbsp; I'm pretty sure this one won't get canceled.</p>
<p>If you are attending and feel like a chat about anything, including any of the products I've created such as <a href="http://www.mcefm.com/" target="_blank">MceFM</a>, the <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ListSearch/ListSearch.aspx" target="_blank">ListSearch Extender</a>, <a href="http://www.red-gate.com/about/news/sql_prompt.htm" target="_blank">PromptSQL</a> or <a href="http://j-integra.intrinsyc.com/support/com/doc/" target="_blank">J-Integra</a> or anything else please email me at damian at atadore.com.</p>
]]></content:encoded>
			<wfw:commentRss>http://damianblog.com/2008/06/07/attending-pdc-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MceFM released: Last.fm addin for Windows Media Center</title>
		<link>http://damianblog.com/2008/03/17/mcefm-released-lastfm-addin-for-windows-media-center/</link>
		<comments>http://damianblog.com/2008/03/17/mcefm-released-lastfm-addin-for-windows-media-center/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 09:38:11 +0000</pubDate>
		<dc:creator>dmehers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://damianblog.wordpress.com/2008/03/17/mcefm-released-lastfm-addin-for-windows-media-center/</guid>
		<description><![CDATA[Over the last few months I've been working on an addin to Windows Media Center which lets you listen to Last.fm based off of the artists in your music collection (you can also enter arbitrary artists names etc.). I wanted it to work when the user wasn't running the MceFM application within Media Center, which [...]]]></description>
			<content:encoded><![CDATA[<p>Over the last few months I've been working on an addin to <a href="http://www.microsoft.com/windows/products/windowsvista/features/details/mediacenter.mspx">Windows Media Center</a> which lets you listen to <a href="http://www.last.fm/">Last.fm</a> based off of the artists in your music collection (you can also enter arbitrary artists names etc.).</p>
<p>I wanted it to work when the user wasn't running the MceFM application within Media Center, which meant creating a background application and a normal application.&nbsp; That way you can listen to songs and watch your photo collection (for example).</p>
<p>Also, the Last.fm music streams don't include the tags normally included in mp3 files, which let you see the track name, artist, album name, etc.&nbsp; So what I did was to dynamically add these tags to the stream, which means that Media Center will shown all that information correctly.</p>
<p>All in all, a lot of fun to develop.&nbsp; Now I just need to see if anyone cares <img src='http://damianblog.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>More at <a href="http://www.mcefm.com/">http://www.mcefm.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://damianblog.com/2008/03/17/mcefm-released-lastfm-addin-for-windows-media-center/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Configuring HTTP Namespace reservations on Vista using WIX</title>
		<link>http://damianblog.com/2008/02/21/configuring-http-namespace-reservations-on-vista-using-wix/</link>
		<comments>http://damianblog.com/2008/02/21/configuring-http-namespace-reservations-on-vista-using-wix/#comments</comments>
		<pubDate>Thu, 21 Feb 2008 16:29:36 +0000</pubDate>
		<dc:creator>dmehers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://damianblog.wordpress.com/?p=49</guid>
		<description><![CDATA[WIX is an XML based installer generator, from Microsoft, now hosted in Sourceforge. As part of an installation for a Vista based product I am creating, I needed to register an http namespace.&#160; This is required in order to listen for incoming connections.&#160; You can do this from the command line as described here: http://msdn2.microsoft.com/en-us/library/ms733768.aspx [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wix.sourceforge.net/" target="_blank">WIX </a>is an XML based installer generator, from Microsoft, now hosted in Sourceforge.</p>
<p>As part of an installation for a Vista based product I am creating, I needed to register an http namespace.&nbsp; This is required in order to listen for incoming connections.&nbsp; You can do this from the command line as described here: <a href="http://msdn2.microsoft.com/en-us/library/ms733768.aspx">http://msdn2.microsoft.com/en-us/library/ms733768.aspx</a></p>
<p>I spent a day or so researching, and coding a <a href="http://msdn2.microsoft.com/en-us/library/aa368066(VS.85).aspx">Custom Action</a>, which worked.&nbsp; As I was in the final stages of integrating it into my WIX wxs file, I discovered a much simpler way of doing it, based on the way Microsoft Media Center applications are registered in the template code created in Visual Studio 2008 by the Windows Media Center SDK.</p>
<p>The first thing I did was to define a property which points to the fully qualified Netsh.exe tool:</p>
<pre><span style="color:blue;">&lt;!-- </span><span style="color:green;">This property uses an AppSearch to attempt to  </span><span style="color:blue;">--&gt;
&lt;!-- </span><span style="color:green;">locate the file %windir\Netsh.exe              </span><span style="color:blue;">--&gt;
&lt;</span><span style="color:#a31515;">Property </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">NETSH</span>" <span style="color:red;">Secure</span><span style="color:blue;">=</span>"<span style="color:blue;">yes</span>"<span style="color:blue;">&gt;
  &lt;</span><span style="color:#a31515;">DirectorySearch </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">Netshdir</span>" <span style="color:red;">Path</span><span style="color:blue;">=</span>"<span style="color:blue;">[SystemFolder]</span>"<span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">FileSearch </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">Netshexe</span>" <span style="color:red;">Name</span><span style="color:blue;">=</span>"<span style="color:blue;">Netsh.exe</span>" <span style="color:blue;">/&gt;
  &lt;/</span><span style="color:#a31515;">DirectorySearch</span><span style="color:blue;">&gt;
&lt;/</span><span style="color:#a31515;">Property</span><span style="color:blue;">&gt;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a><font face="Courier New"></font></p>
<p>Then I defined a couple of properties that describe the Netsh commands to register and unregister the HTTP namespace.&nbsp; You'd need to replace the port, 'Test' and possibly specify something else instead of 'Users':</p>
<pre><span style="color:blue;">&lt;</span><span style="color:#a31515;">Property </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">NamespaceAddCmd</span>"
          <span style="color:red;">Value</span><span style="color:blue;">=</span>"<span style="color:blue;">http add urlacl url=http://+:123/Test/ user=Users</span>"<span style="color:blue;">/&gt;
&lt;</span><span style="color:#a31515;">Property </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">NamespaceDelCmd</span>"
          <span style="color:red;">Value</span><span style="color:blue;">=</span>"<span style="color:blue;">http del urlacl url=http://+:123/Test/</span>"<span style="color:blue;">/&gt;
</span></pre>
<p>Next I define the custom actions used when installing and uninstalling. These are based on those used for registering MCE apps. The '..._Cmd' actions set properties which are then used by the actions they target. This is because deferred actions can not access normal properties, only the CustomActionData property.&nbsp; This is set by the '..._Cmd' actions when they have a Property which names the custom action whose CustomActionData they target:</p>
<pre><span style="color:blue;">&lt;</span><span style="color:#a31515;">CustomAction </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Install_Cmd</span>"
              <span style="color:red;">Property</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Install</span>"
              <span style="color:red;">Value</span><span style="color:blue;">=</span>"<span style="color:red;">&amp;quot;</span><span style="color:blue;">[NETSH]</span><span style="color:red;">&amp;quot; </span><span style="color:blue;">[NamespaceDelCmd]</span>"<span style="color:blue;">/&gt;
&lt;</span><span style="color:#a31515;">CustomAction </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Uninstall_Cmd</span>"
              <span style="color:red;">Property</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Uninstall</span>"
              <span style="color:red;">Value</span><span style="color:blue;">=</span>"<span style="color:red;">&amp;quot;</span><span style="color:blue;">[NETSH]</span><span style="color:red;">&amp;quot; </span><span style="color:blue;">[NamespaceDelCmd]</span>"<span style="color:blue;">/&gt;
&lt;</span><span style="color:#a31515;">CustomAction </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Register_Cmd</span>"
              <span style="color:red;">Property</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Register</span>"
              <span style="color:red;">Value</span><span style="color:blue;">=</span>"<span style="color:red;">&amp;quot;</span><span style="color:blue;">[NETSH]</span><span style="color:red;">&amp;quot; </span><span style="color:blue;">[NamespaceAddCmd]</span>"<span style="color:blue;">/&gt;
&lt;</span><span style="color:#a31515;">CustomAction </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Rollback_Cmd</span>"
              <span style="color:red;">Property</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Rollback</span>"
              <span style="color:red;">Value</span><span style="color:blue;">=</span>"<span style="color:red;">&amp;quot;</span><span style="color:blue;">[NETSH]</span><span style="color:red;">&amp;quot; </span><span style="color:blue;">[NamespaceDelCmd]</span>"<span style="color:blue;">/&gt;

&lt;</span><span style="color:#a31515;">CustomAction </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Install</span>"
              <span style="color:red;">BinaryKey</span><span style="color:blue;">=</span>"<span style="color:blue;">WixCA</span>" <span style="color:red;">DllEntry</span><span style="color:blue;">=</span>"<span style="color:blue;">CAQuietExec</span>"
              <span style="color:red;">Execute</span><span style="color:blue;">=</span>"<span style="color:blue;">deferred</span>" <span style="color:red;">Return</span><span style="color:blue;">=</span>"<span style="color:blue;">ignore</span>" <span style="color:red;">Impersonate</span><span style="color:blue;">=</span>"<span style="color:blue;">no</span>"<span style="color:blue;">/&gt;
&lt;</span><span style="color:#a31515;">CustomAction </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Uninstall</span>"
              <span style="color:red;">BinaryKey</span><span style="color:blue;">=</span>"<span style="color:blue;">WixCA</span>" <span style="color:red;">DllEntry</span><span style="color:blue;">=</span>"<span style="color:blue;">CAQuietExec</span>"
              <span style="color:red;">Execute</span><span style="color:blue;">=</span>"<span style="color:blue;">deferred</span>" <span style="color:red;">Return</span><span style="color:blue;">=</span>"<span style="color:blue;">ignore</span>" <span style="color:red;">Impersonate</span><span style="color:blue;">=</span>"<span style="color:blue;">no</span>"<span style="color:blue;">/&gt;
&lt;</span><span style="color:#a31515;">CustomAction </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Register</span>"
              <span style="color:red;">BinaryKey</span><span style="color:blue;">=</span>"<span style="color:blue;">WixCA</span>" <span style="color:red;">DllEntry</span><span style="color:blue;">=</span>"<span style="color:blue;">CAQuietExec</span>"
              <span style="color:red;">Execute</span><span style="color:blue;">=</span>"<span style="color:blue;">deferred</span>" <span style="color:red;">Return</span><span style="color:blue;">=</span>"<span style="color:blue;">check</span>" <span style="color:red;">Impersonate</span><span style="color:blue;">=</span>"<span style="color:blue;">no</span>"<span style="color:blue;">/&gt;
&lt;</span><span style="color:#a31515;">CustomAction </span><span style="color:red;">Id</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Rollback</span>"
              <span style="color:red;">BinaryKey</span><span style="color:blue;">=</span>"<span style="color:blue;">WixCA</span>" <span style="color:red;">DllEntry</span><span style="color:blue;">=</span>"<span style="color:blue;">CAQuietExec</span>"
              <span style="color:red;">Execute</span><span style="color:blue;">=</span>"<span style="color:blue;">rollback</span>" <span style="color:red;">Return</span><span style="color:blue;">=</span>"<span style="color:blue;">ignore</span>" <span style="color:red;">Impersonate</span><span style="color:blue;">=</span>"<span style="color:blue;">no</span>"<span style="color:blue;">/&gt;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Finally, these are the custom actions used in the InstallExecuteSequence:</p>
<p><span style="color:blue;">&lt;</span><span style="color:#a31515;">Custom </span><span style="color:red;">Action</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Install_Cmd</span>" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:red;">After</span><span style="color:blue;">=</span>"<span style="color:blue;">CostFinalize</span>"<span style="color:blue;">&gt;<br />&nbsp; &lt;![CDATA[</span><span style="color:gray;">NOT REMOVE</span><span style="color:blue;">]]&gt;<br />&lt;/</span><span style="color:#a31515;">Custom</span><span style="color:blue;">&gt;<br />&lt;</span><span style="color:#a31515;">Custom </span><span style="color:red;">Action</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Uninstall_Cmd</span>" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:red;">After</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Install_Cmd</span>"<span style="color:blue;">&gt;<br />&nbsp; &lt;![CDATA[</span><span style="color:gray;">REMOVE AND ($Registration.xml = 2)</span><span style="color:blue;">]]&gt;<br />&lt;/</span><span style="color:#a31515;">Custom</span><span style="color:blue;">&gt;<br />&lt;</span><span style="color:#a31515;">Custom </span><span style="color:red;">Action</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Register_Cmd</span>" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:red;">After</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Uninstall_Cmd</span>"<span style="color:blue;">&gt;<br />&nbsp; &lt;![CDATA[</span><span style="color:gray;">NOT REMOVE</span><span style="color:blue;">]]&gt;<br />&lt;/</span><span style="color:#a31515;">Custom</span><span style="color:blue;">&gt;<br />&lt;</span><span style="color:#a31515;">Custom </span><span style="color:red;">Action</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Rollback_Cmd</span>" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:red;">After</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Register_Cmd</span>"<span style="color:blue;">&gt;<br />&nbsp; &lt;![CDATA[</span><span style="color:gray;">NOT REMOVE</span><span style="color:blue;">]]&gt;<br />&lt;/</span><span style="color:#a31515;">Custom</span><span style="color:blue;">&gt;</p>
<p>&lt;</span><span style="color:#a31515;">Custom </span><span style="color:red;">Action</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Uninstall</span>" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:red;">Before</span><span style="color:blue;">=</span>"<span style="color:blue;">RemoveFiles</span>"<span style="color:blue;">&gt;<br />&nbsp; &lt;![CDATA[</span><span style="color:gray;">REMOVE AND ($Registration.xml = 2)</span><span style="color:blue;">]]&gt;<br />&lt;/</span><span style="color:#a31515;">Custom</span><span style="color:blue;">&gt;</p>
<p>&lt;</span><span style="color:#a31515;">Custom </span><span style="color:red;">Action</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Rollback</span>" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:red;">After</span><span style="color:blue;">=</span>"<span style="color:blue;">InstallFiles</span>"<span style="color:blue;">&gt;<br />&nbsp; &lt;![CDATA[</span><span style="color:gray;">NOT REMOVE</span><span style="color:blue;">]]&gt;<br />&lt;/</span><span style="color:#a31515;">Custom</span><span style="color:blue;">&gt;<br />&lt;</span><span style="color:#a31515;">Custom </span><span style="color:red;">Action</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Install</span>" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:red;">After</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Rollback</span>"<span style="color:blue;">&gt;<br />&nbsp; &lt;![CDATA[</span><span style="color:gray;">NOT REMOVE</span><span style="color:blue;">]]&gt;<br />&lt;/</span><span style="color:#a31515;">Custom</span><span style="color:blue;">&gt;<br />&lt;</span><span style="color:#a31515;">Custom </span><span style="color:red;">Action</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Register</span>" <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:red;">After</span><span style="color:blue;">=</span>"<span style="color:blue;">CA_RegisterNamespace_Unregister_Install</span>"<span style="color:blue;">&gt;<br />&nbsp; &lt;![CDATA[</span><span style="color:gray;">NOT REMOVE</span><span style="color:blue;">]]&gt;<br />&lt;/</span><span style="color:#a31515;">Custom</span><span style="color:blue;">&gt;<br /></span></p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Just in case it is of use to anyone, here is the custom action I coded up, although it is not needed with the above code:</p>
<pre><span style="color:blue;">#include </span><span style="color:#a31515;">&lt;windows.h&gt;
</span><span style="color:blue;">#include </span><span style="color:#a31515;">&lt;msi.h&gt;
</span><span style="color:blue;">#include </span><span style="color:#a31515;">&lt;msiquery.h&gt;
</span><span style="color:blue;">#include </span><span style="color:#a31515;">&lt;Http.h&gt;
</span><span style="color:blue;">#include </span><span style="color:#a31515;">&lt;Sddl.h&gt;

</span><span style="color:blue;">#pragma comment</span>(linker, <span style="color:#a31515;">"/EXPORT:ReserveNamespace=_ReserveNamespace@4"</span>)
<span style="color:blue;">#pragma comment</span>(linker, <span style="color:#a31515;">"/EXPORT:ReleaseNamespace=_ReleaseNamespace@4"</span>)

<span style="color:blue;">#define </span>BUF_LEN 256

<span style="color:blue;">#define </span>LOG <span style="color:blue;">true

</span>UINT ReserveOrReleaseNamespace (MSIHANDLE hInstall, <span style="color:blue;">bool </span>reserve) {
    HWND parentWindow = GetForegroundWindow();

    <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, L<span style="color:#a31515;">"Called"</span>, L<span style="color:#a31515;">"ReserveOrReleaseNamespace"</span>, MB_OK);

    <span style="color:blue;">bool </span>scheduled = MsiGetMode(hInstall, MSIRUNMODE_SCHEDULED);
    <span style="color:blue;">bool </span>rollback = MsiGetMode(hInstall, MSIRUNMODE_ROLLBACK);
    <span style="color:blue;">bool </span>commit = MsiGetMode(hInstall, MSIRUNMODE_COMMIT);

    <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, scheduled ? L<span style="color:#a31515;">"True" </span>: L<span style="color:#a31515;">"False"</span>,
        L<span style="color:#a31515;">"ReserveOrReleaseNamespace is MSIRUNMODE_SCHEDULED"</span>, MB_OK);
    <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, rollback ? L<span style="color:#a31515;">"True" </span>: L<span style="color:#a31515;">"False"</span>,
        L<span style="color:#a31515;">"ReserveOrReleaseNamespace is MSIRUNMODE_ROLLBACK"</span>, MB_OK);
    <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, commit ? L<span style="color:#a31515;">"True" </span>: L<span style="color:#a31515;">"False"</span>,
        L<span style="color:#a31515;">"ReserveOrReleaseNamespace is MSIRUNMODE_COMMIT"</span>, MB_OK);

    <span style="color:green;">// Initialize HTTP
    </span>HTTPAPI_VERSION httpApiVersion = HTTPAPI_VERSION_1;
    HRESULT error = HttpInitialize(httpApiVersion, HTTP_INITIALIZE_CONFIG, 0);
    <span style="color:blue;">if</span>(error != S_OK) <span style="color:blue;">return </span>error;

    <span style="color:green;">// Get the custom action data
    // (only thing we can pass to deferred custom actions)
    </span><span style="color:blue;">wchar_t </span>customActionData[BUF_LEN] = L<span style="color:#a31515;">""</span>;
    DWORD customActionDataLen = BUF_LEN;

    MsiGetProperty (hInstall, L<span style="color:#a31515;">"CustomActionData"</span>, customActionData,
        &amp;customActionDataLen);
    <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, customActionData,
        L<span style="color:#a31515;">"ReserveOrReleaseNamespace CustomActionData is"</span>, MB_OK);

    <span style="color:blue;">wchar_t</span>* semicolon = wcschr(customActionData, <span style="color:#a31515;">';'</span>);
    <span style="color:blue;">if</span>(!semicolon) {
        MessageBox(parentWindow,
            L<span style="color:#a31515;">"MceFM Namespace Reservation failed because the CustomActionData was incorrect"</span>,
            L<span style="color:#a31515;">"MceFM Namespace Reservation"</span>, MB_OK);
        <span style="color:blue;">return </span>E_FAIL;
    }

    <span style="color:green;">// Extract the user and URL
    </span><span style="color:blue;">wchar_t</span>* user = customActionData;
    <span style="color:blue;">wchar_t</span>* url = semicolon + 1;

    *semicolon = <span style="color:#a31515;">''</span>;

    <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, url, L<span style="color:#a31515;">"ReserveOrReleaseNamespace NR_URL is"</span>, MB_OK);
    <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, user, L<span style="color:#a31515;">"ReserveOrReleaseNamespace NR_USER is"</span>, MB_OK);

    <span style="color:green;">// Convert the user to a SID
    </span>PSID pSID;
    DWORD sidSize = SECURITY_MAX_SID_SIZE;
    pSID = LocalAlloc(LMEM_FIXED, sidSize);
    WCHAR domainName[BUF_LEN];
    DWORD domainNameLen = BUF_LEN;
    SID_NAME_USE sidNameUse;
    BOOL worked = LookupAccountName(NULL, user, pSID, &amp;sidSize, domainName,
        &amp;domainNameLen, &amp;sidNameUse);
    <span style="color:blue;">if</span>(!worked) {
        error = GetLastError();
        <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, L<span style="color:#a31515;">"LookupAccountName failed"</span>,
            L<span style="color:#a31515;">"ReserveOrReleaseNamespace"</span>, MB_OK);
        <span style="color:blue;">return </span>error;
    }

    <span style="color:green;">// Convert the SID to a string
    </span>LPTSTR stringSid;
    worked = ConvertSidToStringSid(pSID, &amp;stringSid);
    <span style="color:blue;">if</span>(!worked) {
        error = GetLastError();
        <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, L<span style="color:#a31515;">"ConvertSidToStringSid failed"</span>,
            L<span style="color:#a31515;">"ReserveOrReleaseNamespace"</span>, MB_OK);
        LocalFree(pSID);
        <span style="color:blue;">return </span>error;
    }

    <span style="color:green;">// Build a security descriptor in the required format
    </span>WCHAR securityDescriptor[BUF_LEN];
    wsprintf(securityDescriptor, L<span style="color:#a31515;">"D:(A;;GX;;;%s)"</span>, stringSid);

    <span style="color:green;">// Set up the config info (url and security descriptor)
    </span>HTTP_SERVICE_CONFIG_URLACL_SET configInfo;
    configInfo.KeyDesc.pUrlPrefix = url;
    configInfo.ParamDesc.pStringSecurityDescriptor =  securityDescriptor;

    <span style="color:blue;">if</span>(reserve) {
        <span style="color:green;">// Add the namespace reservation
        </span>error = HttpSetServiceConfiguration(0, HttpServiceConfigUrlAclInfo,
            &amp;configInfo, <span style="color:blue;">sizeof</span>(HTTP_SERVICE_CONFIG_URLACL_SET), NULL);
        <span style="color:blue;">if</span>(error != S_OK) {
            <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, L<span style="color:#a31515;">"HttpSetServiceConfiguration failed"</span>,
                L<span style="color:#a31515;">"ReserveOrReleaseNamespace"</span>, MB_OK);
        }
    } <span style="color:blue;">else </span>{
        <span style="color:green;">// Remove the namespace reservation
        </span>error = HttpDeleteServiceConfiguration(0,  HttpServiceConfigUrlAclInfo,
            &amp;configInfo, <span style="color:blue;">sizeof</span>(HTTP_SERVICE_CONFIG_URLACL_SET), NULL);
        <span style="color:blue;">if</span>(error != S_OK) {
            <span style="color:blue;">if</span>(LOG) MessageBox(parentWindow, L<span style="color:#a31515;">"HttpDeleteServiceConfiguration failed"</span>,
                L<span style="color:#a31515;">"ReserveOrReleaseNamespace"</span>, MB_OK);
        }
    }
    LocalFree(pSID);
    LocalFree(stringSid);

    <span style="color:blue;">return </span>error;
}

<span style="color:blue;">extern </span><span style="color:#a31515;">"C" </span>UINT <span style="color:blue;">__stdcall </span>ReserveNamespace (MSIHANDLE hInstall) {
    <span style="color:blue;">return </span>ReserveOrReleaseNamespace(hInstall, <span style="color:blue;">true</span>);
}

<span style="color:blue;">extern </span><span style="color:#a31515;">"C" </span>UINT <span style="color:blue;">__stdcall </span>ReleaseNamespace (MSIHANDLE hInstall) {
    <span style="color:blue;">return </span>ReserveOrReleaseNamespace(hInstall, <span style="color:blue;">false</span>);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://damianblog.com/2008/02/21/configuring-http-namespace-reservations-on-vista-using-wix/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Doug Reilly</title>
		<link>http://damianblog.com/2006/12/25/doug-reilly/</link>
		<comments>http://damianblog.com/2006/12/25/doug-reilly/#comments</comments>
		<pubDate>Sun, 24 Dec 2006 23:36:57 +0000</pubDate>
		<dc:creator>dmehers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://damianblog.com/2006/12/25/doug-reilly/</guid>
		<description><![CDATA[When I created this blog I decided to make it entirely technical.  No personal comments about what I was doing, etc. I've decided to make an exception. Last year I created a small software product, and as a result I was briefly in contact with Doug.  He asked me a series of questions and the [...]]]></description>
			<content:encoded><![CDATA[<p>When I created this blog I decided to make it entirely technical.  No personal comments about what I was doing, etc.</p>
<p>I've decided to make an exception.</p>
<p>Last year I created a small software product, and as a result I was briefly in contact with Doug.  He asked me a series of questions and the resulting interview was published on-line.  He seemed like a nice chap, but I thought no more of it.</p>
<p>Next time I heard of him was in an <a href="http://www.simple-talk.com/opinion/opinion-pieces/coming-out-as-a-cancer-survivor---a-guide-for-software-developers/">excellent piece </a>he wrote about how to deal with customers/clients/employers when you have cancer.  Solid, sound, practical advice.</p>
<p>He <a href="http://blog.programmingasp.net/">died yesterday</a>.  I for one want to mark his passing.  The world is poorer for his absence.</p>
]]></content:encoded>
			<wfw:commentRss>http://damianblog.com/2006/12/25/doug-reilly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

