<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DUAGQn48cSp7ImA9WhRbF0o.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312</id><updated>2012-02-09T08:55:23.079Z</updated><category term="Personal" /><category term="&quot;M&quot;" /><category term="Windows 8" /><category term=".Net" /><category term="Math" /><category term="Windows" /><category term="PDC 2009" /><category term="XNA" /><category term="HymnSheet" /><category term="VSTO" /><category term="Book Reviews" /><category term="OData" /><category term="Fiddler" /><category term="Links" /><category term="Software" /><category term="Project Euler" /><category term="Windows Azure" /><category term="WP7Comp" /><category term="LINQ" /><category term="PDC 2008" /><category term="Build Windows" /><category term="UIAutomation" /><category term="REST" /><category term="How to" /><category term="Jobs" /><category term="PDC 2010" /><category term="WP7" /><category term="COM" /><category term="Humour" /><category term="Algorithms" /><category term="C# 5" /><category term="Freelancing" /><category term="Blogging" /><category term="C#" /><category term="WinRT" /><category term="Competition" /><category term="Seaturtle Software" /><category term="WCF" /><category term="Functional Programming" /><category term="Agile" /><category term="Bugs" /><category term="SQL Server Modelling" /><category term="NHibernate" /><category term="Protocol Buffers" /><category term="VB.Net" /><category term="Recipes" /><category term="ASP.Net" /><category term="Training" /><category term="WPF" /><category term="Silverlight" /><category term="Direct UI" /><category term="Excel" /><category term="C# 4.0" /><title>Functional Fun</title><subtitle type="html">Samuel Jack's light-hearted take on software development</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.functionalfun.net/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>197</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/FunctionalFun" /><feedburner:info uri="functionalfun" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by-sa/2.0/" /><feedburner:emailServiceId>FunctionalFun</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;DEUAQH8zeCp7ImA9WhRUGUw.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-3438982090865532958</id><published>2012-01-28T16:25:00.001Z</published><updated>2012-01-30T09:37:21.180Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-01-30T09:37:21.180Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Seaturtle Software" /><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term="REST" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Freelancing" /><title>Crunch, the RESTful Accountants (And Introducing the Crunch API Explorer)</title><content type="html">&lt;p&gt;One of the things that scared me a little when I thought about starting my own business was the thought of the bookkeeping. I know, I know – I have a Maths degree, so I ought to be able to cope with adding up a few numbers then working out the 20% I owe to the tax man. And the 20% I owe to the VAT lady. And how to take just the right amount of salary to avoid giving anything to the PAYE person. But my arithmetic has always been terrible, and the mathematicians who lectured me, strange to say, rarely used actual numbers. It was all &lt;em&gt;x&lt;/em&gt;s and &lt;em&gt;y&lt;/em&gt;s and &lt;em&gt;β&lt;/em&gt;s and &lt;em&gt;π&lt;/em&gt;s. So that didn’t help.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://crunch.co.uk"&gt;&lt;img style="margin: 0px 7px 0px 0px; display: inline; float: left" title="Crunch" alt="Crunch" align="left" src="http://lh3.ggpht.com/-zCRvvaO-Y6s/TyQhWshMZEI/AAAAAAAAA8Y/afFHtGlrFNM/crunch-logo%25255B3%25255D.png?imgmax=800" width="199" height="39" /&gt;&lt;/a&gt;A big factor in persuading me to make the leap into running a company was finding an excellent online accounting service to handle all those troublesome numbers for me. &lt;a href="https://www.crunch.co.uk/"&gt;Crunch&lt;/a&gt; are a smart bunch of accountants based down in Brighton who have teamed up with an equally smart bunch of developers to create bookkeeping software that is actually quite fun to use (I know – I couldn’t quite believe that when I read it on another freelancer’s blog, but it’s true!). You &lt;a href="https://www.youtube.com/watch?v=II4hdMmXhrc&amp;amp;feature=player_embedded"&gt;enter all the numbers&lt;/a&gt; in the website as you rake in the profits, or fork out to your suppliers, and at the end of the year, Crunch will put together your accounts and send them off to H.M.R.C. They’ll even submit your VAT returns for you. And handle your payroll, if you should happen to have any &lt;strike&gt;minions&lt;/strike&gt; employees. All for £59.50 a month. It’s great. &lt;a href="http://getcrun.ch/seatusj2qy"&gt;Sign up here&lt;/a&gt; and we’ll both get a £25 Amazon voucher!&lt;/p&gt;  &lt;p&gt;And as if all that wasn’t awesome enough, earlier this month they &lt;a href="https://www.crunch.co.uk/crunch-api-now-live/"&gt;launched an API&lt;/a&gt;. It its RESTful, speaking XML, with OAuth authentication. That’s right – a REST API from an accountancy company! I should caution that the first release is limited to dealing with expenses and suppliers, but the dev team plan to add areas according to the priorities indicated by us users.&lt;/p&gt;  &lt;h4&gt;The Crunch API Explorer&lt;/h4&gt;  &lt;p&gt;Well, you know me. I couldn’t leave a shiny new toy like that lying on the shelf. So I had a play, and knocked together something that I think you’ll like.&lt;/p&gt;  &lt;p&gt;Allow me to introduce the Crunch API Explorer:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-lEJWnPQsk2E/TyQhXIkzDtI/AAAAAAAAA8c/n6ycv8Sk3J0/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://lh6.ggpht.com/-EK32wXy0eX4/TyQhXo5vxgI/AAAAAAAAA8o/rneAa84vSdE/image_thumb%25255B2%25255D.png?imgmax=800" width="754" height="575" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It’s a little tool to help you poke and prod the Crunch API. You enter a URL, set the appropriate Http Method, hit Go!, and it will show you the XML that Crunch returns.&lt;/p&gt;  &lt;p&gt;You can download it &lt;a href="http://clickonce.seaturtlesoftware.s3-website-eu-west-1.amazonaws.com/CrunchApiExplorer/CrunchApiExplorer.application"&gt;here&lt;/a&gt; (it installs using ClickOnce, so it will auto-update when I add new features. If you don’t already have .Net 4.0 on your machine, you should be prompted to install it). To connect to Crunch using the Crunch API Explorer, you’ll need your own API key which you can get by contacting the nice folks at &lt;a href="mailto:api-dev@crunch.co.uk"&gt;api-dev@crunch.co.uk&lt;/a&gt;. Then you can make REST calls to your hearts delight. All the documentation you need about the resource URLs and the structure of the XML for submitting updates can be found &lt;a href="http://support.crunch.co.uk/entries/20718898-introduction-to-the-api"&gt;here on the Crunch website&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Here are a few of my favourite features:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;XML Syntax colouring when you’re editing requests (this courtesy of &lt;a href="http://avalonedit.net"&gt;AvalonEdit&lt;/a&gt;, the open source WPF text editor component that is part of SharpDevelop) &lt;/li&gt;    &lt;li&gt;Makes you confirm any update/delete requests made to the live server (but not to the test server) &lt;/li&gt;    &lt;li&gt;All the source is available on &lt;a href="https://github.com/samueldjack/CrunchAPIExplorer"&gt;GitHub&lt;/a&gt;, so if ever you wanted an example of how to connect to an OAuth API with &lt;a href="http://www.dotnetopenauth.net/"&gt;DotNetOAuth&lt;/a&gt;, well – now you have one (see &lt;a href="https://github.com/samueldjack/CrunchAPIExplorer/blob/master/CrunchApiExplorer/Crunch/CrunchFacade.cs"&gt;CrunchFacade.cs&lt;/a&gt;). It’s all in C#, with some WPF, and of course a topping of MVVM. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;There are a couple of things I wanted to add, but didn’t get time for – maybe next week:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Remembering frequently used resource URIs, and maybe saving template Xml request documents &lt;/li&gt;    &lt;li&gt;Ability to choose a file and insert it into the XML request documents in Base64 format for the APIs that support file upload &lt;/li&gt;    &lt;li&gt;Saving Base64 encoded data in the responses to files &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Anything else? &lt;/p&gt;  &lt;p&gt;I’d love to hear from anyone who finds this useful. Feature requests are welcome (&lt;a href="http://help.github.com/send-pull-requests/"&gt;pull requests&lt;/a&gt; even more so). And if you fancy forking this and adapting it to explore other APIs, be my guest.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-3438982090865532958?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=dBnpqkjdpKg:LnrDMsFvPqk:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=dBnpqkjdpKg:LnrDMsFvPqk:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=dBnpqkjdpKg:LnrDMsFvPqk:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=dBnpqkjdpKg:LnrDMsFvPqk:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=dBnpqkjdpKg:LnrDMsFvPqk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=dBnpqkjdpKg:LnrDMsFvPqk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=dBnpqkjdpKg:LnrDMsFvPqk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=dBnpqkjdpKg:LnrDMsFvPqk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=dBnpqkjdpKg:LnrDMsFvPqk:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=dBnpqkjdpKg:LnrDMsFvPqk:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=dBnpqkjdpKg:LnrDMsFvPqk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=dBnpqkjdpKg:LnrDMsFvPqk:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=dBnpqkjdpKg:LnrDMsFvPqk:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/dBnpqkjdpKg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/3438982090865532958/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2012/01/crunch-restful-accountants-and.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/3438982090865532958?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/3438982090865532958?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/dBnpqkjdpKg/crunch-restful-accountants-and.html" title="Crunch, the RESTful Accountants (And Introducing the Crunch API Explorer)" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-zCRvvaO-Y6s/TyQhWshMZEI/AAAAAAAAA8Y/afFHtGlrFNM/s72-c/crunch-logo%25255B3%25255D.png?imgmax=800" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://blog.functionalfun.net/2012/01/crunch-restful-accountants-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUMR3oyeip7ImA9WhRXGU4.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-7209856718188153282</id><published>2011-12-26T21:18:00.001Z</published><updated>2011-12-26T21:18:06.492Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-26T21:18:06.492Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Seaturtle Software" /><category scheme="http://www.blogger.com/atom/ns#" term="Personal" /><title>Happy Christmas to all</title><content type="html">&lt;p&gt;I hope you have all enjoyed a Happy Christmas. Nothing technical today. I just wanted to share with you something my six-year old daughter made for me:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-ZJPocVrNJPA/TvjkiFXn7jI/AAAAAAAAA8E/nv5f0AX90bE/s1600-h/EPSON007%25255B5%25255D.jpg"&gt;&lt;img style="display: block; float: none; margin-left: auto; margin-right: auto" title="EPSON007" alt="EPSON007" src="http://lh6.ggpht.com/-2TQb_iD9ZOY/TvjkjMlBpKI/AAAAAAAAA8M/XOExMcWH_fM/EPSON007_thumb%25255B3%25255D.jpg?imgmax=800" width="394" height="566" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-7209856718188153282?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=oQKymSK4HW4:23U3FX5aoSU:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=oQKymSK4HW4:23U3FX5aoSU:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=oQKymSK4HW4:23U3FX5aoSU:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=oQKymSK4HW4:23U3FX5aoSU:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=oQKymSK4HW4:23U3FX5aoSU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=oQKymSK4HW4:23U3FX5aoSU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=oQKymSK4HW4:23U3FX5aoSU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=oQKymSK4HW4:23U3FX5aoSU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=oQKymSK4HW4:23U3FX5aoSU:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=oQKymSK4HW4:23U3FX5aoSU:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=oQKymSK4HW4:23U3FX5aoSU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=oQKymSK4HW4:23U3FX5aoSU:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=oQKymSK4HW4:23U3FX5aoSU:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/oQKymSK4HW4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/7209856718188153282/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/12/happy-christmas-to-all.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/7209856718188153282?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/7209856718188153282?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/oQKymSK4HW4/happy-christmas-to-all.html" title="Happy Christmas to all" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-2TQb_iD9ZOY/TvjkjMlBpKI/AAAAAAAAA8M/XOExMcWH_fM/s72-c/EPSON007_thumb%25255B3%25255D.jpg?imgmax=800" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/12/happy-christmas-to-all.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0ANRX4_cSp7ImA9WhRRFk0.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-4545773380988423125</id><published>2011-11-29T22:29:00.001Z</published><updated>2011-11-29T22:29:54.049Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-29T22:29:54.049Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="NHibernate" /><category scheme="http://www.blogger.com/atom/ns#" term="Book Reviews" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><title>Mini Review: NHibernate 3 Beginner’s Guide</title><content type="html">&lt;p&gt;I’ve recently re-discovered the pleasure of reading in bed, thanks to my new iPad, which, with its backlit screen, allows me to snuggle under the covers with a good book without disturbing my wife. &lt;a href="http://www.packtpub.com/"&gt;Packt Publishing&lt;/a&gt; kindly provided my bedtime reading for the last few nights - &lt;strong&gt;&lt;a href="http://www.amazon.co.uk/gp/product/1849516022/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=funcfun-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=1849516022"&gt;NHibernate 3 Beginner's Guide&lt;/a&gt;&lt;/strong&gt; by Dr. Gabriel Nicolas Schenker and Aaron Cure.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/-vISB27QLq5U/TtVc0WXUzzI/AAAAAAAAA7w/7COaP-wGOag/s1600-h/nhibernate%25255B1%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px 15px 0px 0px; padding-left: 0px; padding-right: 0px; display: inline; float: left; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="nhibernate" border="0" alt="nhibernate" align="left" src="http://lh5.ggpht.com/-YLnS3SibYic/TtVc32g843I/AAAAAAAAA74/DaS5fB87Qy4/nhibernate_thumb%25255B1%25255D.png?imgmax=800" width="252" height="316" /&gt;&lt;/a&gt;This is a book I wish I’d had three years ago. Back then I was sketching designs for a database-heavy application, and I evaluated Nhibernate, but was put off by its steep learning curve, and skimpy documentation. The documentation has improved immensely in the years since, and NHibernate itself has got easier to use, but it can still appear daunting for someone just getting started. &lt;/p&gt;  &lt;p&gt;This book makes Nhibernate approachable for the absolute beginner, even one who is relatively new to database technologies. The author explains key concepts carefully, and drives lessons home with plenty of comprehensive step-by-step tutorials.&lt;/p&gt;  &lt;p&gt;What I particularly liked was the inclusion of the Nhibernate ecosystem: &lt;a href="http://fluentnhibernate.org/"&gt;FluentNhibernate&lt;/a&gt; (in my opinion the best mechanism for configuring NHibernate) is given good treatment, as is &lt;a href="http://nhprof.com/"&gt;NHProf&lt;/a&gt;, a commercial Nhibernate profiling tool. It was also nice to see an introduction to unit testing NHibernate data access layers.&lt;/p&gt;  &lt;p&gt;One area that I did feel was a little weak was the section on setting up mappings. The author gives examples of three different ways in which mappings can be configured, but doesn't cover important aspects like cascading updates in much detail at all – something I’ve been caught out by several times, and an area on which I would have appreciated some friendly guidance when I was starting out. Have a look at &lt;a href="http://www.amazon.co.uk/gp/product/1932394923/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=funcfun-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=1932394923"&gt;NHibernate in Action&lt;/a&gt; if you want to dig in more deeply here.&lt;/p&gt;  &lt;p&gt;This book definitely goes on my list to recommend to anybody starting out with NHibernate development. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-4545773380988423125?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Q46vtUJGfXQ:aJKLIXXglw4:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Q46vtUJGfXQ:aJKLIXXglw4:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Q46vtUJGfXQ:aJKLIXXglw4:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Q46vtUJGfXQ:aJKLIXXglw4:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Q46vtUJGfXQ:aJKLIXXglw4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Q46vtUJGfXQ:aJKLIXXglw4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Q46vtUJGfXQ:aJKLIXXglw4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Q46vtUJGfXQ:aJKLIXXglw4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Q46vtUJGfXQ:aJKLIXXglw4:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Q46vtUJGfXQ:aJKLIXXglw4:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Q46vtUJGfXQ:aJKLIXXglw4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Q46vtUJGfXQ:aJKLIXXglw4:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Q46vtUJGfXQ:aJKLIXXglw4:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/Q46vtUJGfXQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/4545773380988423125/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/11/mini-review-nhibernate-3-beginners.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/4545773380988423125?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/4545773380988423125?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/Q46vtUJGfXQ/mini-review-nhibernate-3-beginners.html" title="Mini Review: NHibernate 3 Beginner’s Guide" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-YLnS3SibYic/TtVc32g843I/AAAAAAAAA74/DaS5fB87Qy4/s72-c/nhibernate_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/11/mini-review-nhibernate-3-beginners.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkAGRX4_cCp7ImA9WhdaFEg.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-8777028568831165995</id><published>2011-10-24T11:00:00.000+01:00</published><updated>2011-10-24T11:05:24.048+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-24T11:05:24.048+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Freelancing" /><title>XAML Magic: Turning an Ugly Silverlight Duckling into a Beautiful Photoshopped Swan</title><content type="html">&lt;p&gt;Over the last few weeks I’ve had the privilege of working with &lt;a href="http://ayende.com/blog/"&gt;Ayende&lt;/a&gt; and the &lt;a href="http://hibernatingrhinos.com"&gt;Hibernating Rhinos&lt;/a&gt; team on the new management UI for &lt;a href="http://ravendb.net/"&gt;RavenDB&lt;/a&gt;. Never one to follow the herd (unless perhaps it &lt;a href="http://ayende.com/blog/58369/all-the-rhinos-in-the-world-unite"&gt;consisted of Rhinos&lt;/a&gt;), Ayende’s bucking the trend and building it in Silverlight.&lt;/p&gt;  &lt;p&gt;My part was to beautify the application by mimicking Photoshop designs that a designer had created for a new version of the RavenDB website. I was quite pleased with the way it turned out, and the &lt;a href="http://ayende.com/blog/125953/peeking-behind-the-curtains-the-new-ravendb-management-studio"&gt;screenshots Ayende posted on his blog&lt;/a&gt; got some favourable feedback.&lt;/p&gt;  &lt;p&gt;Ayende asked me to write a blog post on the transmogrification process, and he has just published it on &lt;a href="http://blog.hibernatingrhinos.com/10241/xaml-magic-turning-an-ugly-silverlight-duckling-into-a-beautiful-photoshopped-swan"&gt;the company blog&lt;/a&gt;. Go read it, to find out how I turned this &lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-oFNySPeXo1g/TqG7embgNUI/AAAAAAAAA6k/5rI-LEN5o18/s1600-h/image_thumb30%25255B3%25255D.png"&gt;&lt;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_thumb30" border="0" alt="image_thumb30" src="http://lh3.ggpht.com/-kXeCt9z52-4/TqG7hgMnrCI/AAAAAAAAA6s/-G3r9cMckbA/image_thumb30_thumb.png?imgmax=800" width="600" height="440" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;into this&lt;/p&gt;  &lt;p&gt;&lt;img alt="image" src="http://ayende.com/blog/Images/Windows-Live-Writer/Peeking-behind-the-curtains-The-new-Rave_404C/image_thumb.png" width="600" height="332" /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-8777028568831165995?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=6WPCpk-flZI:IJYzo2qxBGA:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=6WPCpk-flZI:IJYzo2qxBGA:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=6WPCpk-flZI:IJYzo2qxBGA:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=6WPCpk-flZI:IJYzo2qxBGA:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=6WPCpk-flZI:IJYzo2qxBGA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=6WPCpk-flZI:IJYzo2qxBGA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=6WPCpk-flZI:IJYzo2qxBGA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=6WPCpk-flZI:IJYzo2qxBGA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=6WPCpk-flZI:IJYzo2qxBGA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=6WPCpk-flZI:IJYzo2qxBGA:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=6WPCpk-flZI:IJYzo2qxBGA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=6WPCpk-flZI:IJYzo2qxBGA:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=6WPCpk-flZI:IJYzo2qxBGA:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/6WPCpk-flZI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/8777028568831165995/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/10/xaml-magic-turning-ugly-silverlight.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/8777028568831165995?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/8777028568831165995?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/6WPCpk-flZI/xaml-magic-turning-ugly-silverlight.html" title="XAML Magic: Turning an Ugly Silverlight Duckling into a Beautiful Photoshopped Swan" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-kXeCt9z52-4/TqG7hgMnrCI/AAAAAAAAA6s/-G3r9cMckbA/s72-c/image_thumb30_thumb.png?imgmax=800" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/10/xaml-magic-turning-ugly-silverlight.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEEERX8zeSp7ImA9WhdUFkk.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-1127344178535318308</id><published>2011-10-03T12:17:00.001+01:00</published><updated>2011-10-03T12:50:04.181+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-03T12:50:04.181+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Seaturtle Software" /><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term="Software" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Freelancing" /><category scheme="http://www.blogger.com/atom/ns#" term="C# 5" /><title>Announcing the launch of Mixed In Key 5</title><content type="html">&lt;p&gt;I’m very pleased to announce that &lt;a href="http://www.mixedinkey.com/"&gt;Mixed In Key LLC&lt;/a&gt;, one of my clients, have just launched the product I’ve been working on for the last eight months. &lt;a href="http://www.mixedinkey.com/Screenshots.aspx"&gt;Mixed In Key 5.0&lt;/a&gt; is for DJs who put together their DJ sets using &lt;a href="http://www.harmonic-mixing.com/"&gt;harmonic mixing&lt;/a&gt;, a technique for ensuring a musically pleasing transition from one track to the next by eliminating key clashes. &lt;a href="http://lh4.ggpht.com/-QfefFpyVDUg/TomZwIXSFjI/AAAAAAAAA6U/whFUMFCjkXU/s1600-h/image%25255B7%25255D.png"&gt;&lt;img style="margin: 10px auto; display: block; float: none" title="Mixed In Key 5.0" alt="Mixed In Key 5.0" src="http://lh3.ggpht.com/-SbHdpQWsDOo/TomZw4B6v5I/AAAAAAAAA6Y/PJSC0AU_pFc/image_thumb%25255B5%25255D.png?imgmax=800" width="682" height="480" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;How it works&lt;/h4&gt;  &lt;p&gt;&lt;a href="http://lh4.ggpht.com/-aQdfaIgXYa0/TomZxbEp3rI/AAAAAAAAA6c/A48mLH9fTJ8/s1600-h/camelotSmall%25255B5%25255D.jpg"&gt;&lt;img style="margin: 0px 0px 0px 10px; display: inline; float: right" title="The Camelot Wheel" alt="The Camelot Wheel" align="right" src="http://lh5.ggpht.com/-8H7jtxkW3e0/TomZx0-0XmI/AAAAAAAAA6g/exHCDa0MxMw/camelotSmall_thumb%25255B3%25255D.jpg?imgmax=800" width="231" height="231" /&gt;&lt;/a&gt;Mixed In Key supplies the key ingredient to successful harmonic mixing. It analyses every song in a DJ’s collection and determines which key it is written in (by key, I mean &lt;a href="http://en.wikipedia.org/wiki/Key_(music)"&gt;musical key&lt;/a&gt;, like C#, F#, A Minor, etc.). Every song is then added to a searchable database. &lt;/p&gt;  &lt;p&gt;The other ingredient comes from music theory, and has been cleverly codified by Mark Davis into the &lt;a href="http://www.mixedinkey.com/HowTo.aspx"&gt;Camelot Wheel&lt;/a&gt;. This shows the relationship between each key in a diagram arranged like a clock. To build a harmonic mix, a DJ finds the key of his first song on the wheel (so E Major is at the twelve o’clock position). For his next song he should pick one in a key which is an “hour” to the left or right, or stay at the same hour but switch between major or minor keys. Mixed In Key 5.0 includes a clickable Camelot Wheel to instantly search the database for songs in a particular key.&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;Under the bonnet&lt;/h4&gt;  &lt;p&gt;The User Interface is all built in WPF. As I hinted in an &lt;a href="http://blog.functionalfun.net/2011/07/how-to-create-inner-shadow-effects-in.html"&gt;earlier blog post&lt;/a&gt;, I had a great time taking the designs beautifully drawn up for us in Photoshop by our designers and mapping them into XAML. Though I have to say, it is a painstaking process, poking all those pixels into precisely the prescribed positions – I guess it took something like 5 or 6 days to polish the 4 screens in the applications.&lt;/p&gt;  &lt;p&gt;But more important than looking gorgeous, Mixed In Key 5.0 had to be fast and responsive (we started the project many months before Windows 8 was announced, otherwise that would have been “fast and fluid”). I have to thank the &lt;a href="http://msdn.microsoft.com/en-us/library/dd460717.aspx"&gt;Task Parallel Library&lt;/a&gt; in .Net 4.0 for making this really easy to achieve (though not as easy as it will be in &lt;a href="http://blog.functionalfun.net/2011/09/whats-new-in-c-50-and-vbnet.html"&gt;C# 5.0&lt;/a&gt;, when we get our hands on the &lt;a href="http://blog.functionalfun.net/2010/10/c-50-asynchronous-revolution.html"&gt;await keyword&lt;/a&gt;). &lt;/p&gt;  &lt;p&gt;At the heart of the application is song analysis, which is a process with several steps. First, we read the song data using some custom DirectShow filters (DirectShow is actually rather fun to use once you’ve got the hang of it). Then we send extracts of the data off to our analysis server in the cloud for processing. Finally we have to add it to the database. Each of the steps takes a while to complete, so are ideal candidates for Tasks.&lt;/p&gt;  &lt;p&gt;.Net 4.5 has a rather nice &lt;a href="http://blogs.msdn.com/b/pfxteam/archive/2011/09/27/10217461.aspx"&gt;Dataflow library&lt;/a&gt; that is ideal for setting up a pipeline of tasks that need to be processed asynchronously. But that’s not out yet, so I used some &lt;a href="http://blogs.msdn.com/b/pfxteam/archive/2010/11/21/10094564.aspx"&gt;extensions that Stephen Toub wrote&lt;/a&gt; to the current TPL library for chaining Tasks together. Here’s what our analysis pipeline looks like:&lt;/p&gt;  &lt;pre class="brush: csharp; toolbar: false;"&gt;AnalyzeSongAudio(progressReporter, file)
   .Then(audioAnalysis =&amp;gt; file.AudioAnalysis = audioAnalysis)
   .Then(_ =&amp;gt; ReadFileTags(file))
   .Then(tags =&amp;gt; file.Tags = tags)
   .Then(() =&amp;gt; SetItemStatus(file, QueuedFileStatus.DetectingKey))
   .Then(_ =&amp;gt; DetectKey(file))
   .Then(result =&amp;gt; file.SongAnalysisResult = result)
   .Then(_ =&amp;gt; RewriteTags(file))
   .Then(result =&amp;gt; AddSongToCollection(file))
   .Then(song =&amp;gt; UpdateQueuedFileWithSong(file, song))
   .Then(() =&amp;gt; SetItemStatus(file, QueuedFileStatus.UpdatingFile))
   .Then(() =&amp;gt; UpdateFile(file))
   .Then(() =&amp;gt; SetItemStatus(file, QueuedFileStatus.Completed))
.OnError(task =&amp;gt; UpdateItemWithError(file, task.Exception.InnerException), Schedulers.UIThread)
.ContinueWith(t =&amp;gt; DecrementQueuedFileCount(), TaskContinuationOptions.ExecuteSynchronously);&lt;/pre&gt;

&lt;p&gt;As an aside, do you know the best thing about using Tasks in your application? You get your &lt;a href="http://www.gotw.ca/publications/concurrency-ddj.htm"&gt;free lunches&lt;/a&gt; back again! As PCs get more and more cores, your application will automatically scale to take advantage of them.&lt;/p&gt;

&lt;h4&gt;&lt;/h4&gt;

&lt;h4&gt;What a launch!&lt;/h4&gt;

&lt;p&gt;Yakov, the founder of Mixed In Key LLC, tells me that the launch has been very successful already.The &lt;a href="http://twitter.com/mixedinkey"&gt;Mixed In Key Twitter stream&lt;/a&gt; has been flooded with happy comments. Here are a few of my favourites:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Woke up without a hangover, got called off jury duty &amp;amp; &lt;a href="https://twitter.com/#!/MixedInKey"&gt;&lt;s&gt;&lt;strong&gt;@&lt;/strong&gt;&lt;/s&gt;&lt;strong&gt;&lt;b&gt;MixedInKey&lt;/b&gt;&lt;/strong&gt;&lt;/a&gt;just came out with version 5.0 that analyzes video!!! Start of a good day&lt;/p&gt;
&lt;/blockquote&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="https://twitter.com/#!/MixedInKey"&gt;&lt;s&gt;&lt;strong&gt;@&lt;/strong&gt;&lt;/s&gt;&lt;strong&gt;&lt;b&gt;MixedInKey&lt;/b&gt;&lt;/strong&gt;&lt;/a&gt; You guys did it! &lt;a href="https://twitter.com/#!/search?q=%23MIK5"&gt;&lt;s&gt;#&lt;/s&gt;&lt;b&gt;MIK5&lt;/b&gt;&lt;/a&gt; is working like a charm. Gorgeous interface, unrivaled speed, heaps new features and still easy to use!!&lt;/p&gt;

  &lt;p&gt;My new &lt;a href="https://twitter.com/#!/MixedInKey"&gt;&lt;s&gt;&lt;strong&gt;@&lt;/strong&gt;&lt;/s&gt;&lt;strong&gt;&lt;b&gt;MixedInKey&lt;/b&gt;&lt;/strong&gt;&lt;/a&gt; purchase rocks! Firing on all 4 cores at the moment at 100% CPU, this thing is &lt;a href="https://twitter.com/#!/search?q=%23fast"&gt;&lt;s&gt;#&lt;/s&gt;&lt;b&gt;fast&lt;/b&gt;&lt;/a&gt;! Currently scanning 3000 songs :)&lt;/p&gt;

  &lt;p&gt;&lt;a href="https://twitter.com/#!/MixedInKey"&gt;&lt;s&gt;@&lt;/s&gt;&lt;b&gt;MixedInKey&lt;/b&gt;&lt;/a&gt; is very very fast! Like a thunder! The multicore processing is the best feature&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So Congratulations to Yakov and the rest of &lt;a href="http://www.mixedinkey.com/Credits.aspx"&gt;the Mixed In Key team&lt;/a&gt;, and thanks for letting me help out on such an exciting project.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-1127344178535318308?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=izld-5yoM-4:OzlP76z6Ogg:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=izld-5yoM-4:OzlP76z6Ogg:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=izld-5yoM-4:OzlP76z6Ogg:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=izld-5yoM-4:OzlP76z6Ogg:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=izld-5yoM-4:OzlP76z6Ogg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=izld-5yoM-4:OzlP76z6Ogg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=izld-5yoM-4:OzlP76z6Ogg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=izld-5yoM-4:OzlP76z6Ogg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=izld-5yoM-4:OzlP76z6Ogg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=izld-5yoM-4:OzlP76z6Ogg:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=izld-5yoM-4:OzlP76z6Ogg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=izld-5yoM-4:OzlP76z6Ogg:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=izld-5yoM-4:OzlP76z6Ogg:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/izld-5yoM-4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/1127344178535318308/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/10/announcing-launch-of-mixed-in-key-5.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/1127344178535318308?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/1127344178535318308?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/izld-5yoM-4/announcing-launch-of-mixed-in-key-5.html" title="Announcing the launch of Mixed In Key 5" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-SbHdpQWsDOo/TomZw4B6v5I/AAAAAAAAA6Y/PJSC0AU_pFc/s72-c/image_thumb%25255B5%25255D.png?imgmax=800" height="72" width="72" /><thr:total>6</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/10/announcing-launch-of-mixed-in-key-5.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0QFRHc9eyp7ImA9WhdUEEk.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-6378894587396844623</id><published>2011-09-16T19:12:00.001+01:00</published><updated>2011-09-26T13:48:35.963+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-26T13:48:35.963+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WinRT" /><category scheme="http://www.blogger.com/atom/ns#" term="VB.Net" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="C# 5" /><title>What’s new in C# 5.0 and VB.Net?</title><content type="html">&lt;p&gt;As always, &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-816T"&gt;Anders Hejlberg’s session&lt;/a&gt; at &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011"&gt;Microsoft’s Build conference&lt;/a&gt; was a must-see. He’s a great presenter, and he had some great things to show off.&lt;/p&gt;  &lt;p&gt;Anders started off by laying out what’s new in C# 5.0 and VB.Net. Bear in mind that Microsoft now have a &lt;a href="http://blog.functionalfun.net/2009/11/future-directions-for-c-and-visual.html"&gt;policy of language parity for C# and VB.Net&lt;/a&gt;. So both languages get Windows Runtime support, Asynchronous programming and a brand new feature, Caller info attributes. VB.Net plays catch-up, and finally gets support for Iterators.&lt;/p&gt;  &lt;h4&gt;Asynchronous Methods&lt;/h4&gt;  &lt;p&gt;The first demo in Anders talk was about asynchronous programming. He introduced it by reminding us how vital responsiveness is in touch applications. This was something Jensen Harris mentioned &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/BPS-1004"&gt;in his talk&lt;/a&gt;. Touch User Interfaces are visceral. If an application doesn’t respond immediately when you touch it, it feels dead, whereas using a mouse or keyboard introduces a kind of disconnect between you and the computer which makes delays feel more acceptable.&lt;/p&gt;  &lt;p&gt;In the Windows Runtime, the designers took the decision that if an operation was going to take more than 50 milliseconds to complete, it must be implemented asynchronously. There will be no synchronous equivalent – it would make it too easy for developers to do the lazy thing. So, all of a sudden it becomes really important to be able to do asynchronous programming easily.&lt;/p&gt;  &lt;p&gt;This is where C# shines in comparison to C++ or Javascript for writing Metro style apps. In those languages, doing asynchronous programming means callbacks, and that means turning your programming inside out. The Asynchronous Methods feature in C# allows you to do async programming in the usual, straightforward, do-this-then-that fashion. &lt;/p&gt;  &lt;p&gt;I won’t say any more on that here. Go watch &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-816T"&gt;Anders demo&lt;/a&gt; if you haven’t groked async yet. Your future as a Windows developer depends on it!&lt;/p&gt;  &lt;h4&gt;Windows Runtime integration&lt;/h4&gt;  &lt;p&gt;In the next section of his talk (starting at 26:00), Anders demonstrated more of the deep integration that C# and .Net now has with the Windows Runtime. He showed how it is possible to take a C# “compute engine” and expose it to a HTML/Javascript meto-style app (it works just as well with C++). You can take a C# project, compile to a WinMD file, then reference it from your HTML/Javascript project. This gives you intellisense for your C# objects when you access them from your Javascript code. As Anders said, “In Javascript, you sometimes get lucky. [Beat]. Of course, in C# you get lucky always! … I’m Just saying!”&lt;/p&gt;  &lt;h4&gt;Caller Info Attributes&lt;/h4&gt;  &lt;p&gt;The aforementioned Caller info attributes came up next (see video at 32:00). Not a big feature, just a palate cleanser between demos, according to Anders.&lt;/p&gt;  &lt;p&gt;Apparently the C# team often get asked when they’re going to introduce support for &lt;a href="http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.71).aspx"&gt;__FILE__ and __LINE__ macros&lt;/a&gt;, which, C++ developers will know, expand when compiled to produce a string containing the name of the current source file, and the current line, respectively. Of course, C# will only introduce support for macros over Ander’s dead body, so the team had to find another way.&lt;/p&gt;  &lt;p&gt;Anders related that back in the days of C# 1.0 they had a design that implemented this feature using attributes, but it involved optional parameters on methods which weren’t supported at the time. Well, now C# 4.0 supports optional parameters on methods, so the team revisited the design, and, lo and behold, C# 5.0 now has the CallerFilePath, CallerLineNumber and CallerMemberName attributes.&lt;/p&gt;  &lt;p&gt;You can write a Trace.WriteLine method like this:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;public static class Trace
{
    public static void WriteLine(string message,
        [CallerFilePath] string file = &amp;quot;&amp;quot;,
        [CallerLineNumber] in line = 0,
        [CallerMemberName] string member = &amp;quot;&amp;quot;)
    {
        var s = string.Format(&amp;quot;{0}:{1} - {2}: {3}&amp;quot;, file, line, member, message);
        Console.WriteLine(s);
    }
}&lt;/pre&gt;

&lt;p&gt;Then, if you were to call Trace.WriteLine(“Something just happened”) the compiler would automatically fill out the optional parameters in the WriteLine method with details of where you made the call from.&lt;/p&gt;

&lt;p&gt;This isn’t in the current developer preview, but will be in the final release. As Anders said, not a big feature, but no doubt somebody will put it to good use.&lt;/p&gt;

&lt;h4&gt;&lt;/h4&gt;

&lt;h4&gt;The Roslyn (Compiler APIs) Project&lt;/h4&gt;

&lt;p&gt;The last half of the talk (starting at 35:26) dealt with what comes after C# 5.0, which is what project “Roslyn” in all about (named apparently after a cute little mining town, an hours drive from Seattle). Roslyn is “the compiler re-imagined”. Anders introduced Roslyn by noting that we are increasingly addicted to IDE productivity tools which provide features like “Find Reference”, “Go to Symbol”, “Rename”,&amp;#160; and “Extract Method”. All these need knowledge about code that is traditionally locked inside the compiler. &lt;/p&gt;

&lt;p&gt;Roslyn is all about building compiler APIs that expose what the compiler knows about code to the IDE and to developers. It will include Syntax Tree APIs, Symbol APIs, Binding and Flow Analysis APIs and Emit APIs. The APIs are designed using modern principles. So, for example, the SyntaxTree objects are completely immutable (though you can create new ones by combing bits from old ones) and this means that they are concurrency safe. All the language services in the IDE (syntax colouring, intellisense, etc.) are going to be using Roslyn.&lt;/p&gt;

&lt;p&gt;All this is going to be available to us starting mid October, when a CTP of Visual Studio Roslyn will be released. APIs will be available for both C# and VB.&lt;/p&gt;

&lt;p&gt;The demos Anders gave of Roslyn are pretty impressive (starting 43:00). First up was the ScriptEngine API that allows you to parse and execute code from a string, or even get a delegate back for executing it at some later point. This led in to the demo of the C# interactive window, which will be part of Visual Studio in the future. You can select code in the editor, press Alt-Enter and have it immediately executed in the interactive window. If you then go and edit it there, you get intellisense, even for methods that you have just interactively defined.&lt;/p&gt;

&lt;p&gt;Another demo,roundly applauded, was “Paste as VB” and “Paste as C#” which uses the Roslyn APIs to parse and translate code from the Clipboard buffer. The source code for this will be made available in the CTP.&lt;/p&gt;

&lt;p&gt;None of this was big news, of course, because Anders first started talking about it when &lt;a href="http://blog.functionalfun.net/2008/10/dynamic-future-of-c-40.html"&gt;I was at PDC in 2008&lt;/a&gt;. But it’s nice to know that it’s moving on steadily, and that we’ll soon be able to have a play with it.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-6378894587396844623?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=MvDr1Q3mzNE:j07nEQLC5Dk:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=MvDr1Q3mzNE:j07nEQLC5Dk:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=MvDr1Q3mzNE:j07nEQLC5Dk:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=MvDr1Q3mzNE:j07nEQLC5Dk:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=MvDr1Q3mzNE:j07nEQLC5Dk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=MvDr1Q3mzNE:j07nEQLC5Dk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=MvDr1Q3mzNE:j07nEQLC5Dk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=MvDr1Q3mzNE:j07nEQLC5Dk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=MvDr1Q3mzNE:j07nEQLC5Dk:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=MvDr1Q3mzNE:j07nEQLC5Dk:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=MvDr1Q3mzNE:j07nEQLC5Dk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=MvDr1Q3mzNE:j07nEQLC5Dk:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=MvDr1Q3mzNE:j07nEQLC5Dk:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/MvDr1Q3mzNE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/6378894587396844623/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/09/whats-new-in-c-50-and-vbnet.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/6378894587396844623?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/6378894587396844623?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/MvDr1Q3mzNE/whats-new-in-c-50-and-vbnet.html" title="What’s new in C# 5.0 and VB.Net?" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/09/whats-new-in-c-50-and-vbnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEAHQ34-eCp7ImA9WhdVEUU.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-4673610358072177593</id><published>2011-09-16T10:53:00.001+01:00</published><updated>2011-09-16T15:18:52.050+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-16T15:18:52.050+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term="WinRT" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows 8" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Build Windows" /><title>Windows Runtime – Dial in the right expectations before reading up</title><content type="html">&lt;p&gt;Three days on from &lt;a href="http://channel9.msdn.com/events/BUILD/BUILD2011/KEY-0001"&gt;the announcement&lt;/a&gt; of the Windows Runtime at Microsoft’s &lt;a href="http://www.buildwindows.com/"&gt;Build conference&lt;/a&gt; the marketing dust is settling and the full picture emerging. As you begin to read up what the Windows Runtime actually is you’ll need to set your expectations to the right level or you run the risk of being disappointed. But set them appropriately and I think you’ll see that an exciting developer journey lies ahead.&lt;/p&gt;  &lt;p&gt;Leading up to the conference &lt;a href="http://blog.functionalfun.net/2011/09/microsofts-build-windows-conference-is.html"&gt;I was hoping&lt;/a&gt; for a new lean-and-mean User Interface platform for writing any kind of Windows application. But that isn’t what Windows Runtime is about. As things stand this week, Windows Runtime is about producing Metro-style applications (think Windows Phone 7) optimised for running on Tablet devices. Windows Runtime is aimed squarely at the solar plexus of iOS and Android 3.0. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://tirania.org/blog/archive/2011/Sep-15.html"&gt;Miguel de Icaza&lt;/a&gt; and &lt;a href="http://www.itwriting.com/blog/4866-a-few-facts-about-microsofts-new-windows-runtime.html"&gt;Tim Anderson&lt;/a&gt; have already done a good job of writing up what has been announced so far about Windows Runtime (or WinRT). But here are the two key points to notice:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;Metro-style apps run in a sandboxed environment&lt;/strong&gt;. As with Windows Phone 7, apps have to declare upfront, &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/hh464929(v=VS.85).aspx#capabilities"&gt;through a manifest built in at compilation time&lt;/a&gt;, which capabilities of your PC they intend to use. Access to APIs is monitored at runtime by the Runtime Broker, which prevents your app from doing anything naughty. Only certain parts of the &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/br230302(v=VS.85).aspx"&gt;.Net Base Class Libraries can be used&lt;/a&gt;, and even native developers are limited as to &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/br205757(v=VS.85).aspx"&gt;which Win32 or COM objects&lt;/a&gt; they call. Apps can only talk to each other through the WinRT-endorsed Contracts, which allow for Sharing, File-picking etc.       &lt;p&gt;To a developer all this sounds like a horrible restriction. But it is wonderful for users, who can have much more confidence that applications they install from the new App Store will not get up to mischief.&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;&lt;strong&gt;Metro-style apps are always full screen and immersive&lt;/strong&gt;. Windows Runtime does not provide a general-purpose windowing system. Several presenters at the conference mentioned that support for overlapping windows have been intentionally left out. And for one simple reason: they don’t work well in a touch-centric environment. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Windows Runtime is not (at the moment) a general purpose runtime. It may get there eventually, but for the time being it is focused on building the kinds of apps and games that today you might run on the iPad, the Xoom, or (once the lawyers have finished their fisticuffs) the Galaxy Tab. Think of it as Silverlight-on-Steroids-With-Native-Extensions for Tablets and you won’t go far wrong.&lt;/p&gt;  &lt;p&gt;As speakers at Build conceded, there are many kinds of application that would not fit the Metro-style. Visual Studio is one. Photoshop is another. Microsoft Office is (possibly) a third. For these kinds of apps, keyboard, mouse, menus, toolbars, ribbons and dialog boxes still works best. &lt;/p&gt;  &lt;p&gt;This means Win32 and WPF are still very much alive. Though there are no sessions about it at the conference, &lt;a href="http://msdn.microsoft.com/en-us/library/bb613588(v=VS.110).aspx"&gt;WPF 4.5 has been announced&lt;/a&gt; with a number of not-insignificant new features, including the &lt;a href="http://blog.functionalfun.net/2010/11/wpf-to-support-hosting-of-silverlight.html"&gt;promised fix&lt;/a&gt; for the Win32 airspace restrictions (though nothing has been said about hosting Silverlight controls in WPF apps).&lt;/p&gt;  &lt;p&gt;I’m no prophet, but I don’t believe this is the last we’ll hear about WPF.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-4673610358072177593?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2WP82opNOz4:SQY6d-Pmde0:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=2WP82opNOz4:SQY6d-Pmde0:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2WP82opNOz4:SQY6d-Pmde0:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2WP82opNOz4:SQY6d-Pmde0:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2WP82opNOz4:SQY6d-Pmde0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=2WP82opNOz4:SQY6d-Pmde0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2WP82opNOz4:SQY6d-Pmde0:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=2WP82opNOz4:SQY6d-Pmde0:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2WP82opNOz4:SQY6d-Pmde0:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2WP82opNOz4:SQY6d-Pmde0:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2WP82opNOz4:SQY6d-Pmde0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2WP82opNOz4:SQY6d-Pmde0:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=2WP82opNOz4:SQY6d-Pmde0:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/2WP82opNOz4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/4673610358072177593/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/09/windows-runtime-dial-in-right.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/4673610358072177593?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/4673610358072177593?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/2WP82opNOz4/windows-runtime-dial-in-right.html" title="Windows Runtime – Dial in the right expectations before reading up" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/09/windows-runtime-dial-in-right.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkYDSX08cSp7ImA9WhdVEEo.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-7198022905255190119</id><published>2011-09-14T10:18:00.001+01:00</published><updated>2011-09-15T09:09:38.379+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-15T09:09:38.379+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Windows" /><category scheme="http://www.blogger.com/atom/ns#" term="Direct UI" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows 8" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Build Windows" /><title>Build Windows Day 1–and a peek a what’s to come</title><content type="html">&lt;p&gt;If you haven’t caught the news already, yesterday at Microsoft’s &lt;a href="http://www.buildwindows.com/"&gt;Build Windows&lt;/a&gt; conference Steven Sinofsky announced a preview of Windows 8 and a bunch of developer tools, including Visual Studio 11. You can download it &lt;a href="http://msdn.microsoft.com/en-us/windows/apps/br229516"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.functionalfun.net/2011/09/microsofts-build-windows-conference-is.html"&gt;As predicted&lt;/a&gt;, Windows 8 comes with an all new development framework, the Windows Runtime (WinRT). I’ve not read enough myself to begin explaining. But here’s a picture, snapped during Steven Sinofsky’s keynote:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/-vbcHI2hLwEA/TnBxafQgygI/AAAAAAAAA6M/ZJ4IFDuQVps/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto; padding-top: 0px" title="Windows 8 Platform and Tools - How WinRT relates to Win32 and .Net" border="0" alt="Windows 8 Platform and Tools - How WinRT relates to Win32 and .Net" src="http://lh5.ggpht.com/-rya8adHhQ14/TnBxc9_hXaI/AAAAAAAAA6Q/ZQFXffaPsTc/image_thumb%25255B2%25255D.png?imgmax=800" width="736" height="426" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;WinRT is an object-oriented API, consisting of 1800 objects, accessible to managed, unmanaged and JavaScript code alike. Sinofsky emphasised that this WinRT is a peer to Win32, not another abstraction layer built on top of it. As this diagram clearly shows, and Sinofsky stressed in his talk, Win32, .Net and Silverlight developers have nothing to fear, all current frameworks continue to work in Windows 8.&lt;/p&gt;  &lt;p&gt;I’m sure to have more to say about WinRT in the coming days. In the meantime, InfoQ has a couple of articles &lt;a href="http://www.infoq.com/news/2011/09/WinRT-API"&gt;summarising&lt;/a&gt; &lt;a href="http://www.infoq.com/news/2011/09/WinRT"&gt;what we learned&lt;/a&gt; in the keynote. If you’re wanting a sneak peak at the API’s themselves, check out the &lt;a href="http://msdn.microsoft.com/en-us/library/windows/apps/br211377"&gt;preview documentation&lt;/a&gt; on MSDN.&lt;/p&gt;  &lt;p&gt;The videos are the first few sessions of the conference are already up on the web:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;The &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/KEY-0001"&gt;Day 1 Keynote&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Jensen Harris: &lt;a href="http://channel9.msdn.com/events/BUILD/BUILD2011/BPS-1004"&gt;8 traits of great Metro style apps&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Aleš Holeček and John Sheehan: &lt;a href="http://channel9.msdn.com/events/BUILD/BUILD2011/BPS-1005"&gt;Platform for Metro style apps&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h4&gt;What’s next?&lt;/h4&gt;  &lt;p&gt;In other news, the &lt;a href="http://channel9.msdn.com/events/BUILD/BUILD2011"&gt;session list&lt;/a&gt; is now up for the rest of the week. Here are a few that grab my attention.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Anders Hejlsberg on &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-816T"&gt;Future directions for C# and Visual Basic&lt;/a&gt;. Doesn’t look like “Roslyn” (compiler-as-a-service) will make it into Visual Studio 11. But he might announce some new language features for C# 5.0. &lt;/li&gt;    &lt;li&gt;Mark Miller and Pracheeti Nagarkar give a &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-813T"&gt;Deep dive into the kernel of the .Net Framework&lt;/a&gt;. Sounds like they’ve done yet more work to improve code-generation and garbage collection. &lt;/li&gt;    &lt;li&gt;Stephen Toub, one of my favourite speakers from previous years, is doing two sessions: &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-829T"&gt;The zen of async: Best practices for performance&lt;/a&gt; (vital know-how, given that many of the new WinRT API’s will be asynchronous) and &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/SAC-808T"&gt;Building parallelized apps with .Net and Visual Studio&lt;/a&gt; (look for some announcements about new parallelization libraries). &lt;/li&gt;    &lt;li&gt;Harry Pierson and Jesse Kaplan are doing a talk on &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-531T"&gt;Using the Windows Runtime from C# and Visual Basic&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Out of curiosity, I make take a look at Daniel Moth’s &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-802T"&gt;Taming GPU compute with C++ AMP&lt;/a&gt; where he’s going to introduce new tools and language features for using the GPU within C++ solutions. &lt;/li&gt;    &lt;li&gt;Boris Jabes talk &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/TOOL-761T"&gt;A lap around DirectX game development tools&lt;/a&gt; also piques my interest, as it promises the “most significant set of improvements for developing graphics-intensive apps in over a decade”. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;And now, on with the show!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-7198022905255190119?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=eHNcOONE_pU:yB0EnEGEZuc:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=eHNcOONE_pU:yB0EnEGEZuc:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=eHNcOONE_pU:yB0EnEGEZuc:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=eHNcOONE_pU:yB0EnEGEZuc:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=eHNcOONE_pU:yB0EnEGEZuc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=eHNcOONE_pU:yB0EnEGEZuc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=eHNcOONE_pU:yB0EnEGEZuc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=eHNcOONE_pU:yB0EnEGEZuc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=eHNcOONE_pU:yB0EnEGEZuc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=eHNcOONE_pU:yB0EnEGEZuc:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=eHNcOONE_pU:yB0EnEGEZuc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=eHNcOONE_pU:yB0EnEGEZuc:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=eHNcOONE_pU:yB0EnEGEZuc:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/eHNcOONE_pU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/7198022905255190119/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/09/build-windows-day-1and-peek-whats-to.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/7198022905255190119?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/7198022905255190119?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/eHNcOONE_pU/build-windows-day-1and-peek-whats-to.html" title="Build Windows Day 1–and a peek a what’s to come" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-rya8adHhQ14/TnBxc9_hXaI/AAAAAAAAA6Q/ZQFXffaPsTc/s72-c/image_thumb%25255B2%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/09/build-windows-day-1and-peek-whats-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQHSHo7fCp7ImA9WhdWFE0.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-5263926391712062342</id><published>2011-09-07T15:55:00.001+01:00</published><updated>2011-09-07T15:55:39.404+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-07T15:55:39.404+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term="COM" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows" /><category scheme="http://www.blogger.com/atom/ns#" term="Direct UI" /><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Build Windows" /><category scheme="http://www.blogger.com/atom/ns#" term="C# 5" /><title>Microsoft’s Build Windows Conference is Next Week – What’s in Store?</title><content type="html">&lt;p&gt;It’s less than a week to go until Microsoft’s &lt;a href="http://www.buildwindows.com/"&gt;Build&lt;/a&gt; conference. According to tradition, about now I should be speculating on what the future holds for us faithful Microsoft developers. But there’s still no official session list. Fortunately, we do have a few official hints, and a couple of very unofficial leaks to whet our appetites for what’s in store.&lt;/p&gt;  &lt;h4&gt;Windows 8&lt;/h4&gt;  &lt;p&gt;Read the &lt;a href="http://www.buildwindows.com/"&gt;Build homepage&lt;/a&gt;, and you’ll see that the conference is focused very clearly on Windows 8. We’ve already had a &lt;a href="http://www.microsoft.com/presspass/features/2011/jun11/06-01corporatenews.aspx"&gt;preview&lt;/a&gt; of the new touch-centric, Windows Phone 7-like UI. And over on the &lt;a href="http://blogs.msdn.com/b/b8/"&gt;Building 8 blog&lt;/a&gt;, Steven Sinofsky and others on the Windows team have started announcing some of the to-be-expected features like &lt;a href="http://blogs.msdn.com/b/b8/archive/2011/08/22/building-robust-usb-3-0-support.aspx"&gt;USB 3.0 support&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Here are some of the other things that we know already:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Windows 8 will &lt;a href="http://www.microsoft.com/presspass/press/2011/jan11/01-05socsupport.mspx"&gt;support ARM processors&lt;/a&gt;, and System on a Chip architectures. Look out for a slew of Windows 8 based tablets to compete with the iPad and Galaxy Tab. Indeed, there is a &lt;a href="http://www.winsupersite.com/blog/supersite-blog-39/windows8/quad-core-tablets-windows-8-140371"&gt;rumour doing the rounds&lt;/a&gt; that Microsoft will be giving away a Windows 8 tablet to all Build attendees.&lt;/li&gt;    &lt;li&gt;The &lt;a href="http://blogs.msdn.com/b/b8/archive/2011/08/31/designing-for-metro-style-and-the-desktop.aspx"&gt;Windows Desktop is being demoted&lt;/a&gt; to just another application, that some users (think Tablet users) may never see. Instead they’ll live in the new immersive Metro environment.&lt;/li&gt;    &lt;li&gt;&lt;a href="http://blogs.msdn.com/b/b8/archive/2011/08/29/improvements-in-windows-explorer.aspx"&gt;Windows Explorer is being Ribbonified&lt;/a&gt;, and the &lt;a href="http://blogs.msdn.com/b/b8/archive/2011/08/23/improving-our-file-management-basics-copy-move-rename-and-delete.aspx"&gt;File Copy/Move experience given an overhaul&lt;/a&gt;.&lt;/li&gt;    &lt;li&gt;It’s goodbye to &lt;a href="http://www.slysoft.com/en/virtual-clonedrive.html"&gt;Virtual CloneDrive&lt;/a&gt; and friends, as &lt;a href="http://blogs.msdn.com/b/b8/archive/2011/08/30/accessing-data-in-iso-and-vhd-files.aspx"&gt;Windows 8 gains the ability to mount ISO files&lt;/a&gt;, and also simplifies mounting of VHD files.&lt;/li&gt;    &lt;li&gt;Windows 8 will be getting its own &lt;a href="http://techcrunch.com/2011/08/18/microsoft-confirms-windows-8-app-store/"&gt;App Store&lt;/a&gt;.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;And now comes the controversial part. Those of you who have not entirely &lt;a href="http://news.cnet.com/8301-27083_3-20079643-247/google-rewiring-the-way-we-remember-study-says/"&gt;delegated their memories to Google&lt;/a&gt; will recall that when Microsoft first showed the new Metro desktop for Windows 8, they announced that &lt;a href="http://arstechnica.com/microsoft/news/2011/06/html5-centric-windows-8-leaves-microsoft-developers-horrified.ars"&gt;developers would be able to use HTML5 and JavaScript&lt;/a&gt; for building these new-fangled immersive apps. But they said nothing about the presence of .Net, WPF or Silverlight in this brave new world, stirring up an instant furore in the blogosphere.&lt;/p&gt;  &lt;p&gt;But there’s no need to panic. It’s all under control. I think.&lt;/p&gt;  &lt;h4&gt;Direct UI&lt;/h4&gt;  &lt;p&gt;This is where we turn to the leaks. Leaked Windows 8 builds, that is.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://arstechnica.com/microsoft/news/2011/06/windows-8-for-software-developers-the-longhorn-dream-reborn.ars"&gt;According to Peter Bright over on Ars Technica&lt;/a&gt;, Microsoft are creating a new Windows Runtime (or WinRT), which is intended to be the successor to the Win32 API. It will be a native-code API, but shaped in a way that is pleasing to the eye of a managed-code developer, and what is more, said .Net developers will be able to access WinRT through a new (hopefully painless) version of COM for which support is being built into .Net 4.5.&lt;/p&gt;  &lt;p&gt;Included in WinRT is a new UI framework called Direct UI which appears to be a lean-and-mean version of WPF/Silverlight (and also uses XAML – remember how &lt;a href="http://www.zdnet.com/blog/microsoft/microsoft-splits-up-its-xaml-team-whats-the-fallout/9807"&gt;part of the XAML team got moved to the Windows division&lt;/a&gt;!). With the official details coming out in less than a week, there’s little point on me elaborating further here, but you can get a taster of the new APIs by reading &lt;a href="http://forums.mydigitallife.info/threads/27437-Win8-M3-(7955)-findings-relevant-to-Managed-.net-amp-WPF-SL-developers"&gt;these&lt;/a&gt; &lt;a href="http://forums.mydigitallife.info/threads/27533-Win8-M3-(7989)-findings-relevant-to-Managed-.net-amp-WPF-SL-developers"&gt;two&lt;/a&gt; forum threads which dissect some of the leaked Windows 8 builds.&lt;/p&gt;  &lt;p&gt;What I look forward to hearing is where WPF fits into the picture. One thing we know with a high degree of confidence, given Microsoft’s backwards-compatibility track record: current WPF applications will continue to work. The question is: will there be further development to WPF? As I &lt;a href="http://blog.functionalfun.net/2010/11/wpf-to-support-hosting-of-silverlight.html"&gt;reported last year&lt;/a&gt;, we know there are some new features coming, including fixing the airspace issues when hosting Hwnds inside WPF controls, and enabling hosting of Silverlight controls. But will there be anything beyond that? And will there be interop between WPF and Direct UI? Watch this space.&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;Silverlight&lt;/h4&gt;  &lt;p&gt;Remember that Microsoft stirred up another firestorm at PDC 2010 by &lt;a href="http://www.zdnet.com/blog/microsoft/microsoft-our-strategy-with-silverlight-has-shifted/7834"&gt;staying mum about Silverlight&lt;/a&gt;? They put that right a few weeks later by announcing &lt;a href="http://10rem.net/blog/2011/09/04/the-big-list-of-whats-new-or-improved-in-silverlight-5"&gt;Silverlight 5&lt;/a&gt;, which was quite distinctly not a maintenance release, since it included a whole raft of new features like a 3d API, vector printing support, and P/Invoke for Trusted Applications. They’ve now made good on that, with the &lt;a href="http://www.silverlight.net/downloads"&gt;Silverlight 5 Release Candidate&lt;/a&gt; coming out just last week. It will be interesting to learn Microsoft’s vision for how Silverlight, WPF and Direct UI align.&lt;/p&gt;  &lt;h4&gt;C# 5.0&lt;/h4&gt;  &lt;p&gt;We already know the headline feature for C# 5: &lt;a href="http://blog.functionalfun.net/2010/10/c-50-asynchronous-revolution.html"&gt;asynchronous methods&lt;/a&gt;. We’ve had a CTP. Here’s hoping for a beta release during the conference. One thing Anders did say at his talk last year is that &lt;a href="http://blog.functionalfun.net/2010/11/c-50-other-news.html"&gt;async won’t be the only new feature in C# 5.0&lt;/a&gt;. So I wonder what else he has up his sleeves? It would be nice if it was the &lt;a href="http://blog.functionalfun.net/2010/11/c-50-other-news.html"&gt;Roslyn project&lt;/a&gt; (Compiler as a Service).&lt;/p&gt;  &lt;h4&gt;Visual Studio&lt;/h4&gt;  &lt;p&gt;It sounds like Microsoft are &lt;a href="http://news.softpedia.com/news/Pre-Release-Visual-Studio-vNext-Build-Already-Compiled-220437.shtml"&gt;preparing to release a new preview build of Visual Studio at Build&lt;/a&gt;. Many of the features that were previously released as PowerToys for VS 2010 are &lt;a href="http://blogs.msdn.com/b/zainnab/archive/2011/09/01/visual-studio-vnext-ide-enhancements.aspx"&gt;going to part of vNext&lt;/a&gt;. But the more interesting news to me is that Microsoft have been taking note of data coming back from &lt;a href="http://visualstudiogallery.msdn.microsoft.com/fa85b17d-3df2-49b1-bee6-71527ffef441"&gt;PerfWatson&lt;/a&gt; to make some &lt;a href="http://blogs.msdn.com/b/zainnab/archive/2011/09/06/preparing-for-vnext-performance-enhancements.aspx"&gt;big performance improvements&lt;/a&gt;. Visual Studio vNext is going to make more use of multi-core machines, and will reduce memory usage in some cases by doing builds out-of-process for C# projects.&lt;/p&gt;  &lt;h4&gt;Stay Tuned&lt;/h4&gt;  &lt;p&gt;&lt;a href="http://blog.functionalfun.net/2011/05/say-hello-to-hatchling-seaturtle.html"&gt;My new boss&lt;/a&gt; has kindly given me some time next week to follow the Build conference from the comfort of my office. And as &lt;a href="http://blog.functionalfun.net/search/label/PDC%202008"&gt;in&lt;/a&gt; &lt;a href="http://blog.functionalfun.net/search/label/PDC%202009"&gt;previous&lt;/a&gt; &lt;a href="http://blog.functionalfun.net/search/label/PDC%202010"&gt;years&lt;/a&gt;, I’ll be reporting back the choicest titbits as I find them. Follow me &lt;a href="http://twitter.com/#!/samuel_d_jack"&gt;on twitter&lt;/a&gt; to hear it as it happens.&lt;/p&gt;  &lt;p&gt;Now, over to you. What are you looking forward to? Have you heard any rumours that I’ve not picked up on?&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-5263926391712062342?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=EQeKb0e5xwQ:Rw43vrhkq1E:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=EQeKb0e5xwQ:Rw43vrhkq1E:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=EQeKb0e5xwQ:Rw43vrhkq1E:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=EQeKb0e5xwQ:Rw43vrhkq1E:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=EQeKb0e5xwQ:Rw43vrhkq1E:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=EQeKb0e5xwQ:Rw43vrhkq1E:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=EQeKb0e5xwQ:Rw43vrhkq1E:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=EQeKb0e5xwQ:Rw43vrhkq1E:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=EQeKb0e5xwQ:Rw43vrhkq1E:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=EQeKb0e5xwQ:Rw43vrhkq1E:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=EQeKb0e5xwQ:Rw43vrhkq1E:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=EQeKb0e5xwQ:Rw43vrhkq1E:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=EQeKb0e5xwQ:Rw43vrhkq1E:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/EQeKb0e5xwQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/5263926391712062342/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/09/microsofts-build-windows-conference-is.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/5263926391712062342?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/5263926391712062342?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/EQeKb0e5xwQ/microsofts-build-windows-conference-is.html" title="Microsoft’s Build Windows Conference is Next Week – What’s in Store?" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/09/microsofts-build-windows-conference-is.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcNQnY9eip7ImA9WhdRGUo.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-3786860215840795419</id><published>2011-08-10T11:28:00.001+01:00</published><updated>2011-08-10T11:28:13.862+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-08-10T11:28:13.862+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Humour" /><category scheme="http://www.blogger.com/atom/ns#" term="Software" /><title>Nice touch of humour in VirtualBox’s Clone Dialog</title><content type="html">&lt;p&gt;Oracle may have taken over Sun, and with it, the excellent &lt;a href="http://www.virtualbox.org/" target="_blank"&gt;VirtualBox&lt;/a&gt;. But it looks like the VirtualBox team, at least, have managed to retain their sense of humour.&lt;/p&gt;    &lt;p&gt;&lt;a href="http://lh4.ggpht.com/--Vr__RVHXPc/TkJdOYKE-pI/AAAAAAAAA5o/O3kg55DrgGE/s1600-h/image%25255B7%25255D.png"&gt;&lt;img style="margin: 0px auto; display: block; float: none" title="image" alt="image" src="http://lh4.ggpht.com/-G4k5bJU724M/TkJdPIxZRRI/AAAAAAAAA5s/hALMX9wsNZc/image_thumb%25255B3%25255D.png?imgmax=800" width="520" height="172" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-3786860215840795419?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Sqrnig91KAc:ICu2IHwQ3Yg:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Sqrnig91KAc:ICu2IHwQ3Yg:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Sqrnig91KAc:ICu2IHwQ3Yg:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Sqrnig91KAc:ICu2IHwQ3Yg:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Sqrnig91KAc:ICu2IHwQ3Yg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Sqrnig91KAc:ICu2IHwQ3Yg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Sqrnig91KAc:ICu2IHwQ3Yg:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Sqrnig91KAc:ICu2IHwQ3Yg:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Sqrnig91KAc:ICu2IHwQ3Yg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Sqrnig91KAc:ICu2IHwQ3Yg:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Sqrnig91KAc:ICu2IHwQ3Yg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Sqrnig91KAc:ICu2IHwQ3Yg:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Sqrnig91KAc:ICu2IHwQ3Yg:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/Sqrnig91KAc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/3786860215840795419/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/08/nice-touch-of-humour-in-virtualboxs.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/3786860215840795419?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/3786860215840795419?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/Sqrnig91KAc/nice-touch-of-humour-in-virtualboxs.html" title="Nice touch of humour in VirtualBox’s Clone Dialog" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-G4k5bJU724M/TkJdPIxZRRI/AAAAAAAAA5s/hALMX9wsNZc/s72-c/image_thumb%25255B3%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/08/nice-touch-of-humour-in-virtualboxs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0IAR307eip7ImA9WhdTFUs.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-152648120437102189</id><published>2011-07-12T19:59:00.001+01:00</published><updated>2011-07-13T14:59:06.302+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-13T14:59:06.302+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><title>How to create Inner Shadow Effects in WPF and Silverlight</title><content type="html">&lt;p&gt;A new experience for me this week: I was handed a &lt;a href="http://www.adobe.com/products/photoshop.html" target="_blank"&gt;Photoshop&lt;/a&gt; file containing the new UI design for the app I’m currently working on, and asked to implement it in WPF. Easy, I thought: Expression Blend has a &lt;a href="http://expressioniq.com/?p=965" target="_blank"&gt;Photoshop Import&lt;/a&gt; feature. &lt;/p&gt;  &lt;p&gt;Not so fast! &lt;/p&gt;  &lt;p&gt;Whilst Blend does a pretty good job of importing simple Photoshop files, it struggles when asked to convert the little flourishes with which designers like to top off their masterpieces. Like inner shadows.&lt;/p&gt;  &lt;p&gt;Thus the inspiration for another first: my first ever &lt;a href="http://www.codeproject.com" target="_blank"&gt;Code Project&lt;/a&gt; article, &lt;a href="http://www.codeproject.com/KB/WPF/innershadows.aspx" target="_blank"&gt;Creating Inner Shadow Effects for WPF and Silverlight&lt;/a&gt;, which went live this afternoon.&lt;/p&gt;  &lt;p&gt;&lt;img alt="image" src="http://lh6.ggpht.com/-d18uKQRid9o/Th10fxOp-tI/AAAAAAAAA4k/vIElS9w37TQ/image_thumb%25255B15%25255D.png?imgmax=800" /&gt;&lt;/p&gt;  &lt;p&gt;If you’ve ever wanted to render something like this in WPF, &lt;a href="http://www.codeproject.com/KB/WPF/innershadows.aspx" target="_blank"&gt;go read the article.&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-152648120437102189?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=LbZc1hsQhjI:V4cmLIICoVo:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=LbZc1hsQhjI:V4cmLIICoVo:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=LbZc1hsQhjI:V4cmLIICoVo:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=LbZc1hsQhjI:V4cmLIICoVo:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=LbZc1hsQhjI:V4cmLIICoVo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=LbZc1hsQhjI:V4cmLIICoVo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=LbZc1hsQhjI:V4cmLIICoVo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=LbZc1hsQhjI:V4cmLIICoVo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=LbZc1hsQhjI:V4cmLIICoVo:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=LbZc1hsQhjI:V4cmLIICoVo:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=LbZc1hsQhjI:V4cmLIICoVo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=LbZc1hsQhjI:V4cmLIICoVo:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=LbZc1hsQhjI:V4cmLIICoVo:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/LbZc1hsQhjI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/152648120437102189/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/07/how-to-create-inner-shadow-effects-in.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/152648120437102189?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/152648120437102189?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/LbZc1hsQhjI/how-to-create-inner-shadow-effects-in.html" title="How to create Inner Shadow Effects in WPF and Silverlight" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-d18uKQRid9o/Th10fxOp-tI/AAAAAAAAA4k/vIElS9w37TQ/s72-c/image_thumb%25255B15%25255D.png?imgmax=800" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/07/how-to-create-inner-shadow-effects-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UCRXsyeSp7ImA9WhZaGUg.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-8538562881854008690</id><published>2011-06-21T19:51:00.001+01:00</published><updated>2011-07-06T13:27:44.591+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-07-06T13:27:44.591+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term="Training" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><title>WPF Training, anyone?</title><content type="html">&lt;p&gt;The team over at &lt;a href="http://www.frameworktraining.co.uk/" target="_blank"&gt;Framework Training&lt;/a&gt; approached me recently about putting together a training course for WPF and possibly UI Automation. I’ve been giving it some thought, but I need your help.&lt;/p&gt;  &lt;p&gt;What would you like to see in a WPF course? Or perhaps, more to the point, what do you think your non-blog-reading colleagues would benefit from hearing about? Are there any areas you can think of that are not covered by existing courses?&lt;/p&gt;  &lt;p&gt;I’m guessing that the world doesn’t need another WPF 101. But people might like some help on more advanced topics, such as using the MVVM pattern, extending the declarative powers of WPF with &lt;a href="http://www.amazedsaint.com/2010/01/behaviors-triggers-and-actions-in.html" target="_blank"&gt;Triggers and Behaviors&lt;/a&gt;, or even learning how to write robust tests against their UI using the &lt;a href="http://blog.functionalfun.net/2009/06/introduction-to-ui-automation-with.html" target="_blank"&gt;UIAutomation API.&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;So, over to you. The comment box is open … now!&lt;/p&gt;  &lt;p&gt;And if you think the world doesn’t need another WPF training course, tell me what you would like to see. And feel free to give me the benefit of your wisdom on how training course in general should or should not be run.&lt;/p&gt;  &lt;p&gt;Perhaps an incentive would help you put fingers to keyboard? I’ll give a £25 Amazon voucher to the person who (in my judgement) leaves the most helpful suggestions.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Update: &lt;/strong&gt;My thanks (and, more concretely, a £25 gift voucher!) go to Jedrzej Sztompka who emailed in a copious list of suggestions. But don’t let that put you off: I’ll keep the offer open for anybody else who gets in touch with significant useful ideas.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-8538562881854008690?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Ca08rl_ROx0:IkSvL6xbHm8:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Ca08rl_ROx0:IkSvL6xbHm8:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Ca08rl_ROx0:IkSvL6xbHm8:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Ca08rl_ROx0:IkSvL6xbHm8:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Ca08rl_ROx0:IkSvL6xbHm8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Ca08rl_ROx0:IkSvL6xbHm8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Ca08rl_ROx0:IkSvL6xbHm8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Ca08rl_ROx0:IkSvL6xbHm8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Ca08rl_ROx0:IkSvL6xbHm8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Ca08rl_ROx0:IkSvL6xbHm8:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Ca08rl_ROx0:IkSvL6xbHm8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=Ca08rl_ROx0:IkSvL6xbHm8:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=Ca08rl_ROx0:IkSvL6xbHm8:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/Ca08rl_ROx0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/8538562881854008690/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/06/wpf-training-anyone.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/8538562881854008690?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/8538562881854008690?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/Ca08rl_ROx0/wpf-training-anyone.html" title="WPF Training, anyone?" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><thr:total>5</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/06/wpf-training-anyone.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0EGSXs5eyp7ImA9WhZbEk4.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-8241768301036491824</id><published>2011-06-16T14:50:00.001+01:00</published><updated>2011-06-16T15:47:08.523+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-16T15:47:08.523+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term="Software" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><title>Resharper 6 XAML Tip: Intellisense for your Databindings</title><content type="html">&lt;p&gt;Anybody who has installed the &lt;a href="http://www.jetbrains.com/resharper/download/" target="_blank"&gt;Resharper 6 Beta&lt;/a&gt; (and that should be all of you – it’s awesome, and no major problems that I can see) will find in it a feature I’ve been wanting ever since WPF was first released: intellisense for databindings.&lt;/p&gt;  &lt;p&gt;Mark up your Xaml so that Resharper knows the type of your DataContext and it will tell you what properties you can bind to, and warn you if it doesn’t recognize what you’ve typed. I’m always switching back and forth between my Views and ViewModels to make sure I get my property names right, so this will be a real time-saver.&lt;/p&gt;  &lt;p&gt;There are lots of places where Resharper can already deduce the type of the DataContext – within DataTemplates where you’ve specified a DataType, for example. In other cases, there's just one thing you have to do to enable this awesome feature.&lt;/p&gt;  &lt;p&gt;At the root of your file, you need to add the &lt;a href="http://karlshifflett.wordpress.com/2009/10/28/ddesigninstance-ddesigndata-in-visual-studio-2010-beta2/" target="_blank"&gt;d:DataContext&lt;/a&gt; attribute and set it to the type of you Datacontext. Here’s an example:&lt;/p&gt;  &lt;pre class="brush: xml; gutter: false; toolbar: false; highlight: [8];"&gt;&amp;lt;UserControl x:Class=&amp;quot;MyApp.Views.MyView&amp;quot;
             xmlns=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&amp;quot;
             xmlns:x=&amp;quot;http://schemas.microsoft.com/winfx/2006/xaml&amp;quot;
             xmlns:mc=&amp;quot;http://schemas.openxmlformats.org/markup-compatibility/2006&amp;quot; 
             xmlns:d=&amp;quot;http://schemas.microsoft.com/expression/blend/2008&amp;quot;
             xmlns:ViewModels=&amp;quot;clr-namespace:MyApp.ViewModels&amp;quot;
             mc:Ignorable=&amp;quot;d&amp;quot;
             d:DataContext=&amp;quot;{d:DesignInstance ViewModels:MyViewModel, IsDesignTimeCreatable=False}&amp;quot;&amp;gt;&lt;/pre&gt;

&lt;p&gt;Now if you press Ctrl-Space within a binding element, you’ll get lovely intellisense:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-PNQ7Tb7J1Zc/TfoKCW76-yI/AAAAAAAAA3M/wMbHMokQDoU/s1600-h/image%25255B4%25255D.png"&gt;&lt;img style="margin: 0px auto; display: block; float: none" title="image" alt="image" src="http://lh6.ggpht.com/-Lc6MmN4yL9k/TfoKDVCiPxI/AAAAAAAAA3Q/WVs7TGvhPh0/image_thumb%25255B2%25255D.png?imgmax=800" width="447" height="214" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-8241768301036491824?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=5x6QxfvMxAA:aRERgSYnigE:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=5x6QxfvMxAA:aRERgSYnigE:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=5x6QxfvMxAA:aRERgSYnigE:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=5x6QxfvMxAA:aRERgSYnigE:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=5x6QxfvMxAA:aRERgSYnigE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=5x6QxfvMxAA:aRERgSYnigE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=5x6QxfvMxAA:aRERgSYnigE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=5x6QxfvMxAA:aRERgSYnigE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=5x6QxfvMxAA:aRERgSYnigE:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=5x6QxfvMxAA:aRERgSYnigE:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=5x6QxfvMxAA:aRERgSYnigE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=5x6QxfvMxAA:aRERgSYnigE:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=5x6QxfvMxAA:aRERgSYnigE:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/5x6QxfvMxAA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/8241768301036491824/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/06/resharper-6-xaml-tip-intellisense-for.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/8241768301036491824?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/8241768301036491824?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/5x6QxfvMxAA/resharper-6-xaml-tip-intellisense-for.html" title="Resharper 6 XAML Tip: Intellisense for your Databindings" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-Lc6MmN4yL9k/TfoKDVCiPxI/AAAAAAAAA3Q/WVs7TGvhPh0/s72-c/image_thumb%25255B2%25255D.png?imgmax=800" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/06/resharper-6-xaml-tip-intellisense-for.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcCSXY4cCp7ImA9WhZUFkQ.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-7946223812251467991</id><published>2011-06-10T09:48:00.001+01:00</published><updated>2011-06-10T10:11:08.838+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-10T10:11:08.838+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="REST" /><category scheme="http://www.blogger.com/atom/ns#" term="Software" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="ASP.Net" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Bugs" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title>XmlSerializerFormat is NOT supported by WCF Rest 4.0 in Medium Trust</title><content type="html">&lt;p&gt;Here’s one for you googlers (or bingites): Using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.xmlserializerformatattribute.aspx" target="_blank"&gt;XmlSerializerFormat&lt;/a&gt; attribute on methods that you expose over WCF Rest (i.e. services using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.webhttpbinding.aspx" target="_blank"&gt;webHttpBinding&lt;/a&gt;) is not supported if your service is running in Medium Trust (as it most likely is if you’re using Shared Hosting, like &lt;a href="http://www.rackspace.com/cloud/cloud_hosting_products/sites/" target="_blank"&gt;Rackspace Cloud Sites&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;This is contrary to what you might expect from reading documents like &lt;a href="http://msdn.microsoft.com/en-us/library/bb412186.aspx" target="_blank"&gt;this&lt;/a&gt;, which say that XmlSerializer &lt;em&gt;is&lt;/em&gt; supported in partial trust. I guess they forgot to test the webHttpBinding scenario. I should be clear: webHttpBinding itself works fine in Medium Trust: it’s using XmlSerializerFormat with webHttpBinding that will give you problems.&lt;/p&gt;  &lt;p&gt;That’s the short story.&lt;/p&gt;  &lt;p&gt;Here’s the amplified version.&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;How I learned: the hard way&lt;/h4&gt;  &lt;p&gt;I’m building a web service that my friends running MacOSX want to be able to use. Out in the Apple orchards they’re not so keen on SOAP as we are who sit behind Windows. So I turned to &lt;a href="http://msdn.microsoft.com/en-us/library/bb412172.aspx" target="_blank"&gt;WCF Web Http&lt;/a&gt;, now part of .Net 4.0, which lets you take control of your urls and keep your messages to the bare necessities.&lt;/p&gt;  &lt;p&gt;With WCF REST you have the choice of XML or JSON. I chose XML, and by default WCF will use the &lt;a href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer.aspx" target="_blank"&gt;DataContractSerializer&lt;/a&gt;. That produces reasonably clean XML, but it is picky about ordering of elements within messages, it annotates elements with type attributes that are often unnecessary, and it has a rather clunky syntax for serializing arrays. &lt;/p&gt;  &lt;p&gt;Then I read about the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.xmlserializerformatattribute.aspx" target="_blank"&gt;XmlSerializerFormat&lt;/a&gt; attribute. If you apply that to your Operation Contracts, it switches to using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx" target="_blank"&gt;XmlSerializer&lt;/a&gt;, and then, by decorating your data contracts with the &lt;a href="http://msdn.microsoft.com/en-us/library/2baksw0z.aspx" target="_blank"&gt;appropriate attributes&lt;/a&gt;, you can take complete control of the xml which gets written to the wire.&lt;/p&gt;  &lt;p&gt;All well and good – while the service was running on my machine. But when I pushed the bits to our web host, who run all websites under &lt;a href="http://msdn.microsoft.com/en-us/library/ms998341" target="_blank"&gt;Medium Trust&lt;/a&gt;, it was a different story. All the calls to the service threw a ProtocolException with the helpful message: “(400) Bad Request”.&lt;/p&gt;  &lt;p&gt;Turning on &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.description.servicedebugbehavior.includeexceptiondetailinfaults.aspx" target="_blank"&gt;includeExceptionDetailInFaults&lt;/a&gt;, then spying on the interaction using &lt;a href="http://www.fiddler2.com/fiddler2/" target="_blank"&gt;Fiddler&lt;/a&gt; shed more light on the situation. I was getting back a stack trace with this at the top:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;at System.ServiceModel.Dispatcher.UnwrappedTypesXmlSerializerManager.BuildSerializers()      &lt;br /&gt;&amp;#160;&amp;#160; at System.ServiceModel.Dispatcher.UnwrappedTypesXmlSerializerManager.GetOperationSerializers(Object key)       &lt;br /&gt;&amp;#160;&amp;#160; at System.ServiceModel.Dispatcher.SingleBodyParameterXmlSerializerMessageFormatter.EnsureSerializers()       &lt;br /&gt;&amp;#160;&amp;#160; at System.ServiceModel.Dispatcher.SingleBodyParameterXmlSerializerMessageFormatter.GetInputSerializers()       &lt;br /&gt;&amp;#160;&amp;#160; at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.ReadObject(Message message)       &lt;br /&gt;&amp;#160;&amp;#160; at System.ServiceModel.Dispatcher.SingleBodyParameterMessageFormatter.DeserializeRequest(Message message, Object[] parameters)&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;A bit of hunting around using Reflector revealed that the BuildSerializers method always calls &lt;a href="http://msdn.microsoft.com/en-us/library/96hz5363.aspx" target="_blank"&gt;XmlSerializer.FromMappings&lt;/a&gt;, and if you check that out on MSDN, you’ll see that it requires Full Trust.&lt;/p&gt;  &lt;p&gt;So there’s no getting away from it. You can’t use XmlSerializer together with WebHttpBinding under Medium Trust. I did try the usual work-around for getting &lt;a href="http://stackoverflow.com/questions/1510557/xmlserializer-under-medium-trust-bombs" target="_blank"&gt;XmlSerializer to work in Medium Trust&lt;/a&gt; – &lt;a href="http://msdn.microsoft.com/en-us/library/aa751883.aspx" target="_blank"&gt;pre-generating the serialization assemblies at build time&lt;/a&gt;: but that was before Reflector showed me the clinching evidence that my efforts were futile.&lt;/p&gt;  &lt;p&gt;So what are your options? Either stick with DataContractSerializer, or switch to JSON&lt;sup&gt;1&lt;/sup&gt;. Or, if time is on your side, wait for the next version of WCF which has a new extensible &lt;a href="http://wcf.codeplex.com/" target="_blank"&gt;Web API&lt;/a&gt; specially designed to let you take complete control of your message formats and such like.&lt;/p&gt;  &lt;hr /&gt;  &lt;ol&gt;   &lt;li&gt;Decorate your methods like this to switch to JSON format: &lt;/li&gt; &lt;/ol&gt;  &lt;pre class="brush: csharp;"&gt;[ServiceContract()]
public interface IService
{
    [OperationContract]
    [WebInvoke(UriTemplate = &amp;quot;/MyOperation&amp;quot;, 
               Method = &amp;quot;POST&amp;quot;,
               RequestFormat = WebMessageFormat.Json,
               ResponseFormat = WebMessageFormat.Json)]
    Response MyOperation(Dto dto);
}&lt;/pre&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-7946223812251467991?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ql5Ci2Dl3dY:kX_A2pptsbo:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=ql5Ci2Dl3dY:kX_A2pptsbo:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ql5Ci2Dl3dY:kX_A2pptsbo:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ql5Ci2Dl3dY:kX_A2pptsbo:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ql5Ci2Dl3dY:kX_A2pptsbo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=ql5Ci2Dl3dY:kX_A2pptsbo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ql5Ci2Dl3dY:kX_A2pptsbo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=ql5Ci2Dl3dY:kX_A2pptsbo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ql5Ci2Dl3dY:kX_A2pptsbo:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ql5Ci2Dl3dY:kX_A2pptsbo:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ql5Ci2Dl3dY:kX_A2pptsbo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ql5Ci2Dl3dY:kX_A2pptsbo:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=ql5Ci2Dl3dY:kX_A2pptsbo:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/ql5Ci2Dl3dY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/7946223812251467991/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/06/xmlserializerformat-is-not-supported-by.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/7946223812251467991?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/7946223812251467991?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/ql5Ci2Dl3dY/xmlserializerformat-is-not-supported-by.html" title="XmlSerializerFormat is NOT supported by WCF Rest 4.0 in Medium Trust" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/06/xmlserializerformat-is-not-supported-by.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4FRHw7eip7ImA9WhZUFU8.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-2224616153579114180</id><published>2011-06-08T09:58:00.001+01:00</published><updated>2011-06-08T10:05:15.202+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-08T10:05:15.202+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Book Reviews" /><category scheme="http://www.blogger.com/atom/ns#" term="Freelancing" /><title>Book Review: Brilliant Freelancer</title><content type="html">&lt;p&gt;&lt;a href="http://lh6.ggpht.com/-7BQMLm7cNRQ/Te850N92n9I/AAAAAAAAA3E/SgX_AuPIYAc/s1600-h/book-brilliant-freelancer%25255B3%25255D.png"&gt;&lt;img style="margin: 0px 10px 0px 0px; display: inline; float: left" title="book-brilliant-freelancer" alt="book-brilliant-freelancer" align="left" src="http://lh6.ggpht.com/-yy28QdEXdGo/Te85063P30I/AAAAAAAAA3I/DmSlmpZ8AIk/book-brilliant-freelancer_thumb%25255B1%25255D.png?imgmax=800" width="217" height="308" /&gt;&lt;/a&gt;I had a pleasant surprise last Tuesday: an email from &lt;a href="http://kendallcopywriting.co.uk/" target="_blank"&gt;Leif Kendall&lt;/a&gt; congratulating me on winning a copy of his book, &lt;a href="http://brilliantfreelancer.com/" target="_blank"&gt;Brilliant Freelancer&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;The vividly coloured volume duly arrived on Saturday, and on Monday kept me pleasantly occupied on a journey from Birmingham up to London, and part of the way home again, leaving me with enough time to jot down my impressions before getting off the train.&lt;/p&gt;  &lt;p&gt;I’d recommend this book to anyone hesitating on the brink of a freelance career, or those who have just taken the plunge. If, like me, you’ve hitherto been consumed by coding, or whatever it is that specialists in your field do, Brilliant Freelancer will open your eyes to everything else that is involved in running a micro-business. But it will turn up the lights gently so you don’t get scared off the prospect for good.&lt;/p&gt;  &lt;p&gt;The books starts by helping you think through your suitability to be a freelancer, then talks you through making the transition from employment to being your own boss. It gives advice on how to find work through sales and marketing (including chapters on blogging and networking), how to price your work, and how to manage clients when you’ve got them. &lt;/p&gt;  &lt;p&gt;You may be be asking yourself how you’ll get anything done without a boss to crack the whip – and Leif has thoughtfully included a chapter on Motivation. If you have the opposite problem, and can’t get enough of the drug called work, Dr Kendall is there to remind you (in a chapter entitled Healthy Body, Healthy mind) that “You’re selling &lt;em&gt;you&lt;/em&gt;, so look after your product”.&lt;/p&gt;  &lt;div style="width: 398px; display: block; float: right;"&gt;   &lt;div style="background-color: #f2f2f2; padding-left: 5px; padding-right: 5px; padding-top: 5px"&gt;     &lt;blockquote&gt;Don't think of 'marketing' as a nefarious activity conducted by spivs and double-glazing companies. Marketing means to take your goods to market. You would not consider farmers evil for taking their wares to the market, so don't consider yourself evil for doing the same.&lt;/blockquote&gt;      &lt;p align="right"&gt;&lt;strong&gt;Leif Kendall, Brilliant Freelancer&lt;/strong&gt;&lt;/p&gt;   &lt;/div&gt; &lt;/div&gt;  &lt;p&gt;There’s one part of the book that I feel could be expanded, and that is in the financial department. Book-keeping, after all, is the one part of every business that’s mandated by law. Brilliant Freelancer does little more than skim the surface here, and at the very least could do with some recommendations for further reading.&lt;/p&gt;  &lt;p&gt;With his easy-going style, no-nonsense advice, and flashes of humour, Leif presents himself as the wise friend who has seen it all before. He’s not afraid to point out where you’ll find the going tough, but he’s equally quick to highlight the potential rewards.&lt;/p&gt;  &lt;p&gt;Perhaps you’ve been thinking about setting up on your own? If so, this book is for you. Check out the &lt;a href="http://brilliantfreelancer.com/" target="_blank"&gt;website&lt;/a&gt; (you can read a chapter for free), or &lt;a href="http://www.amazon.co.uk/gp/product/0273744631/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=funcfun-21&amp;amp;linkCode=as2&amp;amp;camp=1634&amp;amp;creative=19450&amp;amp;creativeASIN=0273744631" target="_blank"&gt;buy the book&lt;/a&gt; on Amazon.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-2224616153579114180?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2AgLhVoW_fo:WhXDc-bTvqI:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=2AgLhVoW_fo:WhXDc-bTvqI:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2AgLhVoW_fo:WhXDc-bTvqI:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2AgLhVoW_fo:WhXDc-bTvqI:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2AgLhVoW_fo:WhXDc-bTvqI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=2AgLhVoW_fo:WhXDc-bTvqI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2AgLhVoW_fo:WhXDc-bTvqI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=2AgLhVoW_fo:WhXDc-bTvqI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2AgLhVoW_fo:WhXDc-bTvqI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2AgLhVoW_fo:WhXDc-bTvqI:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2AgLhVoW_fo:WhXDc-bTvqI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=2AgLhVoW_fo:WhXDc-bTvqI:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=2AgLhVoW_fo:WhXDc-bTvqI:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/2AgLhVoW_fo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/2224616153579114180/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/06/book-review-brilliant-freelancer.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/2224616153579114180?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/2224616153579114180?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/2AgLhVoW_fo/book-review-brilliant-freelancer.html" title="Book Review: Brilliant Freelancer" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-yy28QdEXdGo/Te85063P30I/AAAAAAAAA3I/DmSlmpZ8AIk/s72-c/book-brilliant-freelancer_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/06/book-review-brilliant-freelancer.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0AEQHg6fSp7ImA9WhZWFUo.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-3309816974333098252</id><published>2011-05-16T17:39:00.001+01:00</published><updated>2011-05-16T20:55:01.615+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-16T20:55:01.615+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Seaturtle Software" /><category scheme="http://www.blogger.com/atom/ns#" term="Software" /><category scheme="http://www.blogger.com/atom/ns#" term="Personal" /><title>Say hello to a hatchling: Seaturtle Software Ltd is born</title><content type="html">&lt;p&gt;&lt;a href="http://http://www.flickr.com/photos/jb-london/4440519473/in/photostream/"&gt;&lt;img style="margin: 0px 0px 5px 5px; display: inline; float: right" title="Baby Sea Turtle. Photo Credit: JB London" alt="Baby Sea Turtle" align="right" src="http://lh4.ggpht.com/_Blokl_3SWiA/TdF-ZH1y29I/AAAAAAAAA2w/MRRFh1SO7fw/4440519473_d80c3eab0c_b%5B15%5D.jpg?imgmax=800" width="305" height="365" /&gt;&lt;/a&gt;Two months ago I handed in my notice. One month later, Seaturtle Software Ltd was hatched. I shepherded its dash to the ocean. And now I hold the reigns as it begins a journey in the vast ocean that is the international software industry.&lt;/p&gt;  &lt;p&gt;To put it another way, I now own a software start-up. &lt;/p&gt;  &lt;p&gt;And what a surprise that is. Three years ago I was in negotiations with my boss looking for a way to escape the slippery slide into management. Today I’m a business owner.&lt;/p&gt;  &lt;p&gt;What changed? &lt;/p&gt;  &lt;p&gt;Recession, and a radical restructuring changed the landscape at the company where I worked. Of all the former employees, I was the only one remaining. I stayed to make a last-ditch attempt to launch the product we’d been working on for two years. But it was not to be.&lt;/p&gt;  &lt;p&gt;The directors and I explored several avenues for re-building the business. Eight happy and fulfilling years I’d worked for them, starting two weeks after I completed my Degree (my honeymoon occupied the interval). In that time they’ve given me fantastic opportunities to grow as a person and a software developer. I was hesitant to move on from a relationship that has blessed me so well for so long. But in the last couple of months I’ve come to realise that I have the skills to go it alone. And I’ve discovered that my taste in challenges has diversified beyond the merely technical.&lt;/p&gt;  &lt;p&gt;Most importantly, I learned that starting and running a business is not as scary as you might think. Creating a company is just a legal formality (you can do it online for much less than £100). There are &lt;a href="http://www.crunch.co.uk?a_aid=seaturtlesoftware" target="_blank"&gt;clever websites backed by smart accountants&lt;/a&gt; who will handle your book-keeping and tax returns for a very reasonable fee. The wonders of cloud computing provide infrastructure on demand.&lt;/p&gt;  &lt;p&gt;All I need is a quiet room, a desk, a PC – and some bright ideas.&lt;/p&gt;  &lt;p&gt;So Seaturtle Software is open for business. &lt;/p&gt;  &lt;p&gt;Consulting will be my initial line of work, specialising in the things you know me for here on &lt;a href="http://blog.functionalfun.net/" target="_blank"&gt;Functional Fun&lt;/a&gt;. So if you have a &lt;a href="http://blog.functionalfun.net/search/label/WPF" target="_blank"&gt;knotty WPF problem to solve&lt;/a&gt;, a tricky &lt;a href="http://blog.functionalfun.net/search/label/Project%20Euler" target="_blank"&gt;algorithm to implement,&lt;/a&gt; or simply want a leg-up with your &lt;a href="http://blog.functionalfun.net/search/label/UIAutomation" target="_blank"&gt;UI Automation testing strategy&lt;/a&gt;, get in touch.&lt;/p&gt;  &lt;p align="center"&gt;&lt;a href="mailto:sam@seaturtlesoftware.com"&gt;&lt;font color="#147044" size="5"&gt;sam@seaturtlesoftware.com&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-3309816974333098252?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3qgNqX3g9Kw:XZxYmh8Wlxw:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=3qgNqX3g9Kw:XZxYmh8Wlxw:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3qgNqX3g9Kw:XZxYmh8Wlxw:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3qgNqX3g9Kw:XZxYmh8Wlxw:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3qgNqX3g9Kw:XZxYmh8Wlxw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=3qgNqX3g9Kw:XZxYmh8Wlxw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3qgNqX3g9Kw:XZxYmh8Wlxw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=3qgNqX3g9Kw:XZxYmh8Wlxw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3qgNqX3g9Kw:XZxYmh8Wlxw:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3qgNqX3g9Kw:XZxYmh8Wlxw:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3qgNqX3g9Kw:XZxYmh8Wlxw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3qgNqX3g9Kw:XZxYmh8Wlxw:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=3qgNqX3g9Kw:XZxYmh8Wlxw:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/3qgNqX3g9Kw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/3309816974333098252/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/05/say-hello-to-hatchling-seaturtle.html#comment-form" title="5 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/3309816974333098252?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/3309816974333098252?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/3qgNqX3g9Kw/say-hello-to-hatchling-seaturtle.html" title="Say hello to a hatchling: Seaturtle Software Ltd is born" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_Blokl_3SWiA/TdF-ZH1y29I/AAAAAAAAA2w/MRRFh1SO7fw/s72-c/4440519473_d80c3eab0c_b%5B15%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>5</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/05/say-hello-to-hatchling-seaturtle.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0QGRHs7eCp7ImA9WhZWE0w.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-3659888835261499752</id><published>2011-05-12T20:20:00.000+01:00</published><updated>2011-05-13T21:42:05.500+01:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-05-13T21:42:05.500+01:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WP7Comp" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><title>Congratulations to the Winners of the WP7 Competition</title><content type="html">&lt;p&gt;So after a delay of more than a month, and some speculation that the judges might have taken the 3 x $10,000 kitty and done a runner, Red Gate have finally &lt;a href="http://wp7comp.posterous.com/red-gate-softwares-windows-phone-7-competitio"&gt;announced the winners&lt;/a&gt; of the Windows Phone 7 App Competition.&lt;/p&gt;  &lt;p&gt;Sadly, &lt;a href="http://blog.functionalfun.net/p/simon-squared.html"&gt;Simon Squared&lt;/a&gt;, my little puzzle game wasn’t amongst the finalists.&lt;/p&gt;  &lt;p&gt;But congratulations to &lt;a href="http://blogs.blackmarble.co.uk/blogs/rfennell/"&gt;Richard Fennell&lt;/a&gt;, Simon McKenzie, and &lt;a href="http://blog.markrendle.net/"&gt;Mark Rendle&lt;/a&gt; who scooped a prize each.&lt;/p&gt;  &lt;p&gt;I was particular impressed with Mark Rendle’s app, &lt;a href="http://www.wp7comp.com/pocket-c/"&gt;Pocket C#&lt;/a&gt; which lets you write code on your phone (syntax highlighting and all), then uses a Windows Azure back-end to compile and run it. Perfect for racking up your &lt;a href="http://stackoverflow.com/"&gt;StackOverflow&lt;/a&gt; rep on the move.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-3659888835261499752?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=G9zKJtAUrX4:zJ1GCeU9ZF8:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=G9zKJtAUrX4:zJ1GCeU9ZF8:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=G9zKJtAUrX4:zJ1GCeU9ZF8:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=G9zKJtAUrX4:zJ1GCeU9ZF8:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=G9zKJtAUrX4:zJ1GCeU9ZF8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=G9zKJtAUrX4:zJ1GCeU9ZF8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=G9zKJtAUrX4:zJ1GCeU9ZF8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=G9zKJtAUrX4:zJ1GCeU9ZF8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=G9zKJtAUrX4:zJ1GCeU9ZF8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=G9zKJtAUrX4:zJ1GCeU9ZF8:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=G9zKJtAUrX4:zJ1GCeU9ZF8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=G9zKJtAUrX4:zJ1GCeU9ZF8:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=G9zKJtAUrX4:zJ1GCeU9ZF8:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/G9zKJtAUrX4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/3659888835261499752/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/05/congratulations-to-winners-of-wp7.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/3659888835261499752?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/3659888835261499752?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/G9zKJtAUrX4/congratulations-to-winners-of-wp7.html" title="Congratulations to the Winners of the WP7 Competition" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/05/congratulations-to-winners-of-wp7.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IEQ38-fyp7ImA9WhZSEEg.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-2941694644968448714</id><published>2011-03-15T19:58:00.001Z</published><updated>2011-03-25T13:25:02.157Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-25T13:25:02.157Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WP7Comp" /><category scheme="http://www.blogger.com/atom/ns#" term="REST" /><category scheme="http://www.blogger.com/atom/ns#" term="Software" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><category scheme="http://www.blogger.com/atom/ns#" term="Algorithms" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title>Let’s synchronize our watches: Determining Clock Skew with Christian’s Algorithm and the Reactive Framework</title><content type="html">&lt;p&gt;In every playground race, there’s always one child who sets off somewhere between “On your marks” and “Get set”, gaining an unfair advantage over the honest ones who wait for “Go!”. I faced a similar problem in the design of my Windows Phone 7 multi-player game, &lt;a href="http://blog.functionalfun.net/p/simon-squared.html" target="_blank"&gt;Simon Squared&lt;/a&gt;, though it was unsynchronized clocks and network latency that were to blame rather than cheats.&lt;/p&gt;  &lt;p&gt;The multi-player mode in the game relies on puzzles being &lt;a href="http://blog.functionalfun.net/2011/02/simon-squared-making-it-multi-player.html" target="_blank"&gt;shown to all players at the same time&lt;/a&gt;, and players race to complete them. Since some puzzles can be solved in a matter of seconds, players who get to see them even slightly sooner than their competitors stand a good chance of getting to the solution first. So I needed a plan for avoiding the digital equivalent of playground squabbles.&lt;/p&gt;  &lt;p&gt;Any such plan has to take into account network latency: an unpredictable amount of time can elapse between the server shouting “Go!”, and the phones hearing the message. So I got my server to send out a message announcing that it would shout “Go!” at time T, where T is 4 seconds on from the time on the server’s clock (and broadcast in &lt;a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time" target="_blank"&gt;UTC&lt;/a&gt; obviously). This gives even the most far-flung phone plenty of time to receive the message, check its own clock, and then start a count-down.&lt;/p&gt;  &lt;p&gt;Bet you’ve spotted the flaw in that straight-away! What if the server’s clock and the phones’ clocks are out of sync? &lt;/p&gt;  &lt;h4&gt;An Overview of Christian’s Algorithm&lt;/h4&gt;  &lt;p&gt;That’s where &lt;a href="http://en.wikipedia.org/wiki/Cristian's_algorithm" target="_blank"&gt;Christian’s algorithm&lt;/a&gt; comes in. It gives us a simple method of broadcasting the time at the server to a client whilst allowing for network latency. It works like this:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Client sends a message to the server: “What’s the time?” [adding ‘Mr. Wolf’ is optional]. Crucially, it notes the time that it sent the message (call it T&lt;sub&gt;sent&lt;/sub&gt;) &lt;/li&gt;    &lt;li&gt;Server responds as quick as it can, giving the time according to its own clock, T&lt;sub&gt;server&lt;/sub&gt;. &lt;/li&gt;    &lt;li&gt;When Client gets the message, it notes the time of receipt (call it T&lt;sub&gt;received&lt;/sub&gt;). Then it does some maths: the round-trip time, RTT, is T&lt;sub&gt;received&lt;/sub&gt; – T&lt;sub&gt;sent&lt;/sub&gt; . So assuming that the server responded instantly, and that the network latency was the same in both directions, that means that the server actually sent the message RTT/2 seconds ago. Thus, at the instant Client receives the message, the time at the server is T&lt;sub&gt;server&lt;/sub&gt; + RTT/2. Then the Client can compare with its own clock and determine the difference – the clock skew. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Since network latency can vary with each request we can get an improved result by trying the whole exercise several times then cherry picking the result which had the shortest round trip time, since that minimises the error in our estimate of the network latency.&lt;/p&gt;  &lt;p&gt;So what does that look like in code?&lt;/p&gt;  &lt;h4&gt;The Server Side – with WCF REST&lt;/h4&gt;  &lt;p&gt;Well first we need the server to be able to serve up the time:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceContract]
public class TimeService
{
    [WebGet(UriTemplate = &amp;quot;/?timeAtClient={clientReportedTime}&amp;quot;)]
    public TimeCheck GetTime(string clientReportedTime)
    {
        return new TimeCheck()
                   {
                       ClientReportedTime = DateTimeOffset.Parse(clientReportedTime, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal),
                       TimeAtServer = DateTimeOffset.UtcNow,
                   };
    }
}&lt;/pre&gt;

&lt;p&gt;This is making use of WCF 4’s REST capabilities. Notice the WebGet attribute on the method, with it’s UriTemplate. If I add the appropriate route&amp;#160; to my Global.ascx file, &lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;routes.Add(new ServiceRoute(&amp;quot;Time&amp;quot;, new WebServiceHostFactory(), typeof(FeedbackService)));&lt;/pre&gt;

&lt;p&gt;that will ensure that HTTP GET requests like http://localhost/MyApp/Time/?timeAtClient=2011-03-17T20:19:30.2196972Z get routed to the CheckTime method with the appropriate part of the query string passed into the &lt;em&gt;clientReportedTime&lt;/em&gt; parameter.&lt;/p&gt;

&lt;p&gt;So that's the server side done.&lt;/p&gt;

&lt;h4&gt;RestSharp and Rx for Asynchronous Web Requests&lt;/h4&gt;

&lt;p&gt;Then the client needs to be able to call the server. I’ve been making use of the excellent &lt;a href="http://www.google.co.uk/url?sa=t&amp;amp;source=web&amp;amp;cd=1&amp;amp;sqi=2&amp;amp;ved=0CBYQFjAA&amp;amp;url=http%3A%2F%2Frestsharp.org%2F&amp;amp;ei=vEyKTe3YG9SbhQe4nJi8Dg&amp;amp;usg=AFQjCNHKPRBizbYGaZLdyV3iX3iq7HEKEQ&amp;amp;sig2=34aopkCLBqAB_4n-Fl5EKQ" target="_blank"&gt;RestSharp&lt;/a&gt; library here:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;_restClient = new RestClient(ServerUrl);

...

private IObservable&amp;lt;TimeCheck&amp;gt; GetServerTime()
{
    var request = new RestRequest(&amp;quot;Time?timeAtClient={timeNow}&amp;quot;);
    request.AddUrlSegment(&amp;quot;timeNow&amp;quot;, DateTime.UtcNow.ToString(&amp;quot;O&amp;quot;));

    return ExecuteRequest&amp;lt;TimeCheck&amp;gt;(request);
}

private IObservable&amp;lt;TResult&amp;gt; ExecuteRequest&amp;lt;TResult&amp;gt;(RestRequest restRequest) where TResult : new()
{
    var subject = new AsyncSubject&amp;lt;TResult&amp;gt;();

    _restClient.ExecuteAsync&amp;lt;TResult&amp;gt;(restRequest, response =&amp;gt; HandleResponse(response, subject));

    return subject;
}

private void HandleResponse&amp;lt;T&amp;gt;(RestResponse&amp;lt;T&amp;gt; response, AsyncSubject&amp;lt;T&amp;gt; subject)
{
    subject.OnNext(response.Data);
    subject.OnCompleted();
}&lt;/pre&gt;

&lt;p&gt;This is where things start hotting up. The first part of GetServerTime is obvious enough: in lines 7-8 I’m constructing a RestRequest consisting of a url and the appropriate query string parameter. Then I Execute it. Now since we’re talking Windows Phone here, I can’t make synchronous web requests – the phone UI has to remain responsive. So I can’t wait and then return the response from the method. &lt;/p&gt;

&lt;p&gt;Instead I return an &lt;a href="http://msdn.microsoft.com/en-us/library/dd990377.aspx" target="_blank"&gt;IObservable&lt;/a&gt;, an interface you might not be familiar with. This creature is the brain-child of the clever folks on the &lt;a href="http://msdn.microsoft.com/en-us/devlabs/ee794896.aspx" target="_blank"&gt;Reactive Framework&lt;/a&gt; team. They like to call IObservable the mathematical dual of IEnumerable. And what they mean is this: IEnumerable is used when you want to &lt;strong&gt;pull&lt;/strong&gt; elements one by one out of a collection. IObservable is used when you want elements to be &lt;strong&gt;pushed&lt;/strong&gt; one by one to you. You can think of an IObservable as being a stream of events. And just like you can build queries on top of IEnumerable, using Where and Select, so you can build queries on top of IObservable.&lt;/p&gt;

&lt;p&gt;Here I’m using an IObservable as the channel to push back the result of the Web request when it becomes available – you can see that happening in the HandleResponse method, which is the callback that RestRequest calls when it gets a response back from the web server.&lt;/p&gt;

&lt;h4&gt;Finally – the Algorithm&lt;/h4&gt;

&lt;p&gt;Finally we get to the implementation of the algorithm itself: and with the underpinnings in place, it turns out to be one big LINQ query:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public IObservable&amp;lt;TimeSpan&amp;gt; DetermineClockSkew()
{
    var timeOffset = (from tick in Observable.Interval(TimeSpan.FromMilliseconds(100)).Take(5)
                      from timeCheck in GetServerTime().Timestamp()
                      let estimatedOneWayLatency =
                          (timeCheck.Timestamp.UtcDateTime - timeCheck.Value.ClientReportedTime).
                              TotalMilliseconds/2
                      let estimatedTimeAtServer =
                          timeCheck.Value.TimeAtServer + TimeSpan.FromMilliseconds(estimatedOneWayLatency)
                      let predictedClockSkew = estimatedTimeAtServer - timeCheck.Timestamp
                      select new {predictedClockSkew, estimatedOneWayLatency})
        .MinBy(p =&amp;gt; p.estimatedOneWayLatency)
        .Select(p =&amp;gt; p.predictedClockSkew);

    return timeOffset;
}&lt;/pre&gt;

&lt;p&gt;Let's step through this line by line: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Line 1: We start things off by generating a stream of 5 tick events, at 100 millisecond intervals – we’re going to ping the server 5 times, and use the result with the shortest round trip time &lt;/li&gt;

  &lt;li&gt;Line 2: Each time we hear a tick we fire off a what’s-the-time request to the server using &lt;em&gt;GetServerTime&lt;/em&gt; which we discussed above. The &lt;em&gt;Timestamp()&lt;/em&gt; method will stamp each response that we get back from the server with the time at which we received it. &lt;/li&gt;

  &lt;li&gt;Line 3: For each response we get back from the server we estimate the one-way latency from server to client by taking half of the round-trip time (when we send a request to the server we send our own time, and the server echoes this back in the &lt;em&gt;ClientReportedTime&lt;/em&gt; property of the message) &lt;/li&gt;

  &lt;li&gt;Line 4: Now that we have an estimate of how long the message took to get from the server, we can estimate the time at the server at this precise moment. &lt;/li&gt;

  &lt;li&gt;Line 5: We can now figure out the difference between the clock on the phone and the server’s clock by comparing the time at which we received the server’s response with our estimate of the server’s time at that moment. &lt;/li&gt;

  &lt;li&gt;Line 6: We stash our estimate of the latency, and the estimate of the clock skew into an anonymous type &lt;/li&gt;

  &lt;li&gt;Line 7 - 8: We look over all 5 attempts at estimating the clock skew, and we take the one which had the smallest latency. Notice how &lt;em&gt;MinBy&lt;/em&gt; returns an IObservable rather than an actual value as it might in good old Linq-to-Objects: it has to be this way, otherwise the whole method would block waiting for all the web requests to complete, rather defeating the our use of asynchronous calls elsewher. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So there you have it: thanks to Christian, the WCF REST framework and the Rx team, a neat and elegant way of determining clock skew between server and phone. &lt;/p&gt;

&lt;h4&gt;See it in Action&lt;/h4&gt;

&lt;p&gt;Remember, for a limited time only you can see this in action by &lt;a href="http://blog.functionalfun.net/2011/03/developers-try-out-simon-squared-my.html" target="_blank"&gt;downloading my game to your phone&lt;/a&gt; or Emulator (for free!) and playing with your friends. Full &lt;a href="http://simonsquared.codeplex.com" target="_blank"&gt;source code&lt;/a&gt; to the whole game is also available. &lt;/p&gt;

&lt;p&gt;Finally, judging for the Windows Phone 7 app contest finishes on March 31st, so make sure you &lt;a href="http://wp7comp.wpengine.com/category/wp7-applications/" target="_blank"&gt;check out the entries&lt;/a&gt;, and be sure to tell Red Gate what &lt;a href="http://wp7comp.wpengine.com/simon-squared/" target="_blank"&gt;you think of mine&lt;/a&gt;!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-2941694644968448714?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=o7Lg51NUpJM:_XvE0muxlS4:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=o7Lg51NUpJM:_XvE0muxlS4:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=o7Lg51NUpJM:_XvE0muxlS4:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=o7Lg51NUpJM:_XvE0muxlS4:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=o7Lg51NUpJM:_XvE0muxlS4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=o7Lg51NUpJM:_XvE0muxlS4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=o7Lg51NUpJM:_XvE0muxlS4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=o7Lg51NUpJM:_XvE0muxlS4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=o7Lg51NUpJM:_XvE0muxlS4:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=o7Lg51NUpJM:_XvE0muxlS4:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=o7Lg51NUpJM:_XvE0muxlS4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=o7Lg51NUpJM:_XvE0muxlS4:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=o7Lg51NUpJM:_XvE0muxlS4:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/o7Lg51NUpJM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/2941694644968448714/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/03/lets-synchronize-our-watches.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/2941694644968448714?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/2941694644968448714?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/o7Lg51NUpJM/lets-synchronize-our-watches.html" title="Let’s synchronize our watches: Determining Clock Skew with Christian’s Algorithm and the Reactive Framework" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/03/lets-synchronize-our-watches.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQASXYyeip7ImA9WhZTEU8.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-8890800052698985974</id><published>2011-03-14T17:22:00.001Z</published><updated>2011-03-14T17:22:28.892Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-14T17:22:28.892Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WP7Comp" /><category scheme="http://www.blogger.com/atom/ns#" term="XNA" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><title>Developers: try out Simon Squared, my multi-player Windows Phone 7 game, for free</title><content type="html">&lt;p&gt;If &lt;a href="http://ma.tt/2010/11/one-point-oh/" target="_blank"&gt;usage is like oxygen for ideas&lt;/a&gt;, then my Windows Phone 7 game, &lt;a href="http://blog.functionalfun.net/p/simon-squared.html" target="_blank"&gt;Simon Squared&lt;/a&gt;, must be pretty blue in the face right now. It’s not on the Marketplace yet, you see. Sure, nearly 25 people have download the &lt;a href="http://simonsquared.codeplex.com" target="_blank"&gt;source code&lt;/a&gt;. But how many of them will have bothered to compile it? Well, as of now, I’m demolishing your excuses: &lt;a href="http://simonsquared.codeplex.com/releases/view/62561" target="_blank"&gt;here is the Xap file&lt;/a&gt; - so you developers out there with unlocked phones can deploy the game and try it out. &lt;/p&gt;  &lt;p&gt;Remember, the game has a multi-phone multi-player mode: and I’ve pre-configured the Xap file to run against our Windows Azure hosted server. So challenge your office mates! It doesn’t matter where in the world they are.&lt;/p&gt;  &lt;p&gt;Let me know what you think – but don’t do it here: write your comments on the &lt;a href="http://wp7comp.wpengine.com/simon-squared/" target="_blank"&gt;Simon Squared competition entry page&lt;/a&gt; so Red Gate can see what you think.&lt;/p&gt;  &lt;h4&gt;A reminder: Deploying Xap files to your phone&lt;/h4&gt;  &lt;p&gt;Building a project in Visual Studio and having it deployed to your phone is straightforward enough. Deploying a Xap file by itself is not quite so obvious, so here’s a reminder of how it’s done:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Remember to fire up the Zune software&lt;/li&gt;    &lt;li&gt;Browse to &lt;em&gt;C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Tools\XAP Deployment&lt;/em&gt; – drop the &lt;em&gt;(x86)&lt;/em&gt; if you’re not on Windows 64-bit&lt;/li&gt;    &lt;li&gt;Load the XapDeploy tool, select Windows Phone 7 Device as the target, browse for the Xap file, then hit deploy.&lt;/li&gt; &lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-8890800052698985974?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ngxQDWKLx6o:UFAKiOiB5ZU:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=ngxQDWKLx6o:UFAKiOiB5ZU:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ngxQDWKLx6o:UFAKiOiB5ZU:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ngxQDWKLx6o:UFAKiOiB5ZU:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ngxQDWKLx6o:UFAKiOiB5ZU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=ngxQDWKLx6o:UFAKiOiB5ZU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ngxQDWKLx6o:UFAKiOiB5ZU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=ngxQDWKLx6o:UFAKiOiB5ZU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ngxQDWKLx6o:UFAKiOiB5ZU:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ngxQDWKLx6o:UFAKiOiB5ZU:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ngxQDWKLx6o:UFAKiOiB5ZU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=ngxQDWKLx6o:UFAKiOiB5ZU:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=ngxQDWKLx6o:UFAKiOiB5ZU:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/ngxQDWKLx6o" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/8890800052698985974/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/03/developers-try-out-simon-squared-my.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/8890800052698985974?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/8890800052698985974?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/ngxQDWKLx6o/developers-try-out-simon-squared-my.html" title="Developers: try out Simon Squared, my multi-player Windows Phone 7 game, for free" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/03/developers-try-out-simon-squared-my.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4CQ34yfyp7ImA9Wx9aFEU.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-5679849833955930656</id><published>2011-03-03T19:58:00.001Z</published><updated>2011-03-07T08:52:42.097Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-07T08:52:42.097Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WP7Comp" /><category scheme="http://www.blogger.com/atom/ns#" term="XNA" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><title>Unpacking Simon Squared: My mini framework-independent animation library</title><content type="html">&lt;p&gt;Animation is the trick a computer uses to make math come alive. Our minds are wired to see movement. A video game where the characters and props jumped instantly between the positions where the math says they ought to be would be incomprehensible and unplayable. Which explains why I spent a good part of the few precious days I had building &lt;a href="http://blog.functionalfun.net/p/simon-squared.html" target="_blank"&gt;Simon Squared&lt;/a&gt; on developing a little animation framework.&lt;/p&gt;  &lt;p&gt;I’m pretty pleased with the result. It’s by no means polished or complete, but it makes it very easy to implement one-off animations, and to schedule groups of animations together. Best of all, it’s not tied to the XNA framework – you could use it to implement animation in Windows Forms if you so desired!&lt;/p&gt;  &lt;h4&gt;Fluent Animations&lt;/h4&gt;  &lt;p&gt;Here’s one example:&lt;/p&gt;  &lt;pre class="brush: csharp;"&gt;_storyboard.Plan()
    .AfterDelay(TimeSpan.FromSeconds(0.5))
    .Begin(b =&amp;gt; b.Animate(this, (Shape target, float value) =&amp;gt; target.RotationY = value)
                 .From(RotationY)
                 .To(RotationY + MathHelper.Pi)
                 .In(TimeSpan.FromSeconds(MovementAnimationTime)));&lt;/pre&gt;

&lt;p&gt;This shows off several aspects of the framework. &lt;/p&gt;

&lt;p&gt;First, the &lt;em&gt;Storyboard&lt;/em&gt; class. This is responsible for keeping track of all the animations that are currently in flight, or scheduled for later on. In my Game’s Update method I call &lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;_storyboard.AdvanceTimeTo(gameTime.TotalGameTime);&lt;/pre&gt;
and that takes care of updating all the animations that are in progress.&amp;#160; &lt;p&gt;The Plan() method returns a &lt;em&gt;StoryboardPlanner&lt;/em&gt; which is used to schedule animations using a fluent interface. No prizes for guessing what &lt;em&gt;AfterDelay &lt;/em&gt;does: it leaves a gap of what ever duration you specify before starting subsequent animations. These animations are scheduled using the &lt;em&gt;Begin&lt;/em&gt; method: you pass it a function which uses the &lt;em&gt;AnimationFactory&lt;/em&gt; it supplies to fabricate animations to your exact specifications. &lt;/p&gt;

&lt;p&gt;Most important of all is the &lt;em&gt;Animate&lt;/em&gt; method. In the definition of the &lt;em&gt;Animate&lt;/em&gt; is the secret sauce that makes this animation framework independent of whatever framework it is you’re trying to animate. It works like this: &lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;you set up an animation, &lt;em&gt;RotationY&lt;/em&gt; goes from &lt;em&gt;Pi&lt;/em&gt; to &lt;em&gt;Pi/2 in 2 seconds, &lt;/em&gt;for example; &lt;/li&gt;

  &lt;li&gt;the animation framework calculates values as the animation progresses; &lt;/li&gt;

  &lt;li&gt;every time it calculates a new value, it calls the lambda function that you’ve provided, so that you can update the appropriate object with the new value. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The first parameter I’m passing to &lt;em&gt;Animate&lt;/em&gt; is the object that has the property I want to animation, RotationY. Then I pass in a lambda function that receives both the target object, and the value that should be assigned to the target property or field&lt;sup&gt;1&lt;/sup&gt;.&lt;/p&gt;

&lt;h4&gt;How the animations work&lt;/h4&gt;

&lt;p&gt;When it comes to the actual animations, I’ve abstracted the majority of the animation logic into a couple of base classes, which makes it very easy to add animations for different types. &lt;/p&gt;

&lt;p&gt;Here are the critical parts of the &lt;em&gt;Animation&lt;/em&gt; base class:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public abstract class Animation
{
    // snip

    public void UpdateForTime(TimeSpan currentElapsedTime)
    {
        var normalisedTime = GetNormalisedTimeInAnimation(currentElapsedTime);
        if (normalisedTime.HasValue)
        {
            SetValueForTime(normalisedTime.Value);
        }
    }

    protected abstract void SetValueForTime(double normalisedTime);

    protected double? GetNormalisedTimeInAnimation(TimeSpan currentElapsedTime)
    {
        var normalisedPosition = 0.0;

        var millisecondsAfterStart = currentElapsedTime.TotalMilliseconds - StartTime.TotalMilliseconds;
        if (millisecondsAfterStart &amp;lt; 0)
        {
            return null;
        } 
        else if (millisecondsAfterStart &amp;gt; Duration.TotalMilliseconds &amp;amp;&amp;amp; RepeatMode == RepeatMode.None)
        {
            return 1;
        }
        else
        {
            var quotient = millisecondsAfterStart / Duration.TotalMilliseconds;
            var integerPart = Math.Floor(quotient);

            normalisedPosition = quotient - integerPart;

            if (AutoReverse &amp;amp;&amp;amp; (integerPart % 2) == 1)
            {
                normalisedPosition = 1 - normalisedPosition;
            }
        }

        return normalisedPosition;
    }
}&lt;/pre&gt;

&lt;p&gt;Start at the top: &lt;em&gt;UpdateForTime&lt;/em&gt; is called by the &lt;em&gt;Storyboard&lt;/em&gt; on every frame, to inform the animation of the time, and to give it an opportunity to update its target.&lt;/p&gt;

&lt;p&gt;The first thing &lt;em&gt;Animation&lt;/em&gt; does then is to work out the normalised time – that is a value between 0 and 1 indicating the progress through the animation. If the clock says that we’re bang on the animation’s start time then we return 0; halfway through (however long the animation lasts), and the normalised time is 0.5; and a clock time of StartTime + Duration gets a normalised time of 1. All this is calculated by &lt;em&gt;GetNormalisedTimeInAnimation. &lt;/em&gt;Notice from the code how it is also smart enough to handle animations that repeat over and over, and animations that cycle -&amp;#160; repeating, but reversing when they get to the end value.&lt;/p&gt;

&lt;p&gt;Once the normalised value has been calculated it is passed to &lt;em&gt;SetValueForTime&lt;/em&gt; which is an abstract method on the &lt;em&gt;Animation&lt;/em&gt; base class.&lt;/p&gt;

&lt;p&gt;Next level down in the hierarchy we have &lt;em&gt;SetterInvokingAnimation:&lt;/em&gt;&amp;#160; &lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public abstract class SetterInvokingAnimation&amp;lt;TValue, TTarget&amp;gt; : Animation where TTarget : class 
{
    public TValue StartValue { get; set; }

    public TValue EndValue { get; set; }

    private WeakReference _target;
    private readonly Action&amp;lt;TTarget, TValue&amp;gt; _setter;

    public SetterInvokingAnimation(TTarget target, Action&amp;lt;TTarget, TValue&amp;gt; setter)
    {
        _setter = setter;
        _target = new WeakReference(target);
    }

    protected override void SetValueForTime(double normalisedTime)
    {
        var value = GetValueForNormalisedTime(normalisedTime);
        var target = _target.Target as TTarget;
        if (target != null)
        {
            _setter(target, value);
        }
    }

    protected abstract TValue GetValueForNormalisedTime(double normalisedTime);
}&lt;/pre&gt;

&lt;p&gt;This is the class that takes care of pushing calculated values to the target - though it doesn't actually calculate any values itself – it leaves that to derived classes, by way of the &lt;em&gt;GetValueForNormalisedTime &lt;/em&gt;abstract method. &lt;/p&gt;

&lt;p&gt;And here is one of those derived class, &lt;em&gt;FloatAnimation. &lt;/em&gt;Since it is descended from some hard-working ancestors, there’s little it has to do – just a simple mathematical interpolation between the StartValue and EndValue of the animation:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;public class FloatAnimation&amp;lt;TTarget&amp;gt; : SetterInvokingAnimation&amp;lt;float,TTarget&amp;gt; where TTarget : class 
{
    public FloatAnimation(TTarget target, Action&amp;lt;TTarget, float&amp;gt; propertySetter) : base(target, propertySetter)
    {
    }

    protected override float GetValueForNormalisedTime(double normalisedTime)
    {
        var delta = EndValue - StartValue;
        var value = StartValue + delta * normalisedTime;

        return (float)value;
    }
}&lt;/pre&gt;

&lt;p&gt;So there you have it: a whistle-stop tour of my mini-animation framework.&lt;/p&gt;

&lt;h4&gt;See it for yourself&lt;/h4&gt;

&lt;p&gt;You can see the full source code - in use - in my Simon Squared game up on &lt;a href="http://simonsquared.codeplex.com" target="_blank"&gt;Codeplex&lt;/a&gt;. And if you shout loud enough, I might pull it out of there and stick it in a &lt;a href="http://nuget.codeplex.com/" target="_blank"&gt;NuGet&lt;/a&gt; for easy consumption in your own games.&lt;/p&gt;

&lt;p&gt;Go &lt;a href="http://simonsquared.codeplex.com" target="_blank"&gt;check it out&lt;/a&gt; – and then make sure you tell Red Gate how much you love it, over on my &lt;a href="http://wp7comp.wpengine.com/simon-squared/" target="_blank"&gt;Simon Squared competition entry&lt;/a&gt; page!&lt;/p&gt;

&lt;hr /&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;I could have defined &lt;em&gt;Animate&lt;/em&gt; like this: &lt;/p&gt;

    &lt;pre class="brush: csharp;"&gt;Animate(value =&amp;gt; this.RotationY = value);&lt;/pre&gt;
which would have looked a lot neater. But that has the downside of capturing a reference to my target object in a closure and smuggling it down into the animations which are held by the &lt;em&gt;Storyboard&lt;/em&gt;; and since my &lt;em&gt;Storyboard&lt;/em&gt; is longer-lived than many of the objects that I’m animating, this would have had the effect of keeping my target objects alive when they would otherwise have been Garbage Collection. So I pass in the target object separately so that I can hold it using a WeakReference, and then I use a lambda function that is, in effect, a static method. 

    &lt;p&gt;Another way, of course, would be to remove animations from the Storyboard explicitly (and it does support that). But I'm lazy, and it's much easier to use this fire-and-forget approach!&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-5679849833955930656?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=aJ1n6LnhTVI:wHXoQ2N1iak:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=aJ1n6LnhTVI:wHXoQ2N1iak:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=aJ1n6LnhTVI:wHXoQ2N1iak:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=aJ1n6LnhTVI:wHXoQ2N1iak:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=aJ1n6LnhTVI:wHXoQ2N1iak:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=aJ1n6LnhTVI:wHXoQ2N1iak:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=aJ1n6LnhTVI:wHXoQ2N1iak:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=aJ1n6LnhTVI:wHXoQ2N1iak:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=aJ1n6LnhTVI:wHXoQ2N1iak:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=aJ1n6LnhTVI:wHXoQ2N1iak:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=aJ1n6LnhTVI:wHXoQ2N1iak:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=aJ1n6LnhTVI:wHXoQ2N1iak:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=aJ1n6LnhTVI:wHXoQ2N1iak:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/aJ1n6LnhTVI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/5679849833955930656/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/03/unpacking-simon-squared-my-mini.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/5679849833955930656?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/5679849833955930656?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/aJ1n6LnhTVI/unpacking-simon-squared-my-mini.html" title="Unpacking Simon Squared: My mini framework-independent animation library" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/03/unpacking-simon-squared-my-mini.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUNRHg5cSp7ImA9Wx9aEEo.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-2186401705918905426</id><published>2011-03-01T19:58:00.001Z</published><updated>2011-03-02T12:51:35.629Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-02T12:51:35.629Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WP7Comp" /><category scheme="http://www.blogger.com/atom/ns#" term="XNA" /><category scheme="http://www.blogger.com/atom/ns#" term="Software" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><title>Want to see inside a Windows Phone 7 game? I’ve opened-sourced Simon Squared</title><content type="html">&lt;p&gt;&lt;a title="Simon Squared Competition Entry" href="http://www.wp7comp.com/simon-squared/"&gt;&lt;img style="margin: 0px 0px 0px 10px; display: inline; float: right" title="SSquaredEntryShot" alt="SSquaredEntryShot" align="right" src="http://lh5.ggpht.com/_Blokl_3SWiA/TW1P5dKKIGI/AAAAAAAAA2M/rKDf860l4sU/SSquaredEntryShot%5B16%5D.png?imgmax=800" width="300" /&gt;&lt;/a&gt;The deed is done: I’ve thrown my hat into the ring. &lt;a href="http://blog.functionalfun.net/p/simon-squared.html"&gt;Simon Squared&lt;/a&gt; is now officially standing for election as the &lt;a href="http://www.wp7comp.com/"&gt;App developers will love most&lt;/a&gt;. Go and &lt;a href="http://wp7comp.wpengine.com/simon-squared/"&gt;vote for it here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Why does it deserve your vote? Because, not only is it a thoroughly addictive little puzzle game, with a multi-phone-multi-player mode that will have you coming back for more, but I’ve just released the source code! It’s all there &lt;a href="http://simonsquared.codeplex.com/"&gt;on CodePlex&lt;/a&gt;, released under the GPL v2 license. Build it, try it out, and let me know what you think.&lt;/p&gt;  &lt;p&gt;Over the next little while I’m intending to publish some posts highlighting the points of interest in the source code. In the meantime:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Take a look at my mini animation framework, under &lt;a href="http://simonsquared.codeplex.com/SourceControl/changeset/view/599a57fb8b91#Flatlings%2fFlatlings%2fAnimations"&gt;&lt;em&gt;Flatlings/Flatlings/Animation&lt;/em&gt;&lt;/a&gt;&lt;em&gt; – &lt;/em&gt;I’m quite fond of that fluent interface &lt;/li&gt;    &lt;li&gt;See how I implemented &lt;a href="http://en.wikipedia.org/wiki/Cristian's_algorithm"&gt;Christian’s algorithm&lt;/a&gt; using the Reactive Framework: &lt;em&gt;&lt;a href="http://simonsquared.codeplex.com/SourceControl/changeset/view/599a57fb8b91#Flatlings%2fFlatlings%2fGameServerClient.cs"&gt;Flatlings/Flatlings/GameServerClient.cs&lt;/a&gt; – DetermineClockSkew()&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Discover how easy it is to fix the &lt;a href="http://wcf.codeplex.com"&gt;WCF HTTP CTP&lt;/a&gt; so that it uses the DataContractSerializer: &lt;em&gt;&lt;a href="http://simonsquared.codeplex.com/SourceControl/changeset/view/599a57fb8b91#FlatlingsServer%2fInfrastructure%2fDataContractXmlProcessor.cs"&gt;FlatlingsServer/Infrastructure/ DataContractXmlProcessor.cs&lt;/a&gt;&lt;/em&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you visit my blog, you’ll find a new page dedicated to &lt;a href="http://blog.functionalfun.net/p/simon-squared.html"&gt;Simon Squared&lt;/a&gt;. I’ll be updating that as I blog about the source code; and I’ve also indexed all the posts I made during development – bookmark it, because I’m sure you’ll want to go back and re-live those hectic days!&lt;/p&gt;  &lt;p&gt;It only remains for me to thank everyone who has spurred me on over the last few months with comments, tweets and links, and to remind you all to go and &lt;a href="http://www.wp7comp.com/simon-squared/"&gt;exercise your democratic right&lt;/a&gt;.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-2186401705918905426?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3nAjlN1XOVk:pKpcAGWAUq8:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=3nAjlN1XOVk:pKpcAGWAUq8:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3nAjlN1XOVk:pKpcAGWAUq8:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3nAjlN1XOVk:pKpcAGWAUq8:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3nAjlN1XOVk:pKpcAGWAUq8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=3nAjlN1XOVk:pKpcAGWAUq8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3nAjlN1XOVk:pKpcAGWAUq8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=3nAjlN1XOVk:pKpcAGWAUq8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3nAjlN1XOVk:pKpcAGWAUq8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3nAjlN1XOVk:pKpcAGWAUq8:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3nAjlN1XOVk:pKpcAGWAUq8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=3nAjlN1XOVk:pKpcAGWAUq8:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=3nAjlN1XOVk:pKpcAGWAUq8:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/3nAjlN1XOVk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/2186401705918905426/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/03/want-to-see-inside-windows-phone-7-game.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/2186401705918905426?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/2186401705918905426?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/3nAjlN1XOVk/want-to-see-inside-windows-phone-7-game.html" title="Want to see inside a Windows Phone 7 game? I’ve opened-sourced Simon Squared" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_Blokl_3SWiA/TW1P5dKKIGI/AAAAAAAAA2M/rKDf860l4sU/s72-c/SSquaredEntryShot%5B16%5D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/03/want-to-see-inside-windows-phone-7-game.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUANSX8-cSp7ImA9Wx9bFk4.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-4450242650813023421</id><published>2011-02-25T11:33:00.001Z</published><updated>2011-02-25T11:36:38.159Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-25T11:36:38.159Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WP7Comp" /><category scheme="http://www.blogger.com/atom/ns#" term="REST" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><category scheme="http://www.blogger.com/atom/ns#" term="Windows Azure" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title>Simon Squared – We have Multi-player: Days 4, 5 and (ahem!) 6</title><content type="html">&lt;p&gt;OK. So you let me have &lt;a href="http://blog.functionalfun.net/2011/02/multi-player-enabling-my-windows-phone.html" target="_blank"&gt;one more day&lt;/a&gt;, and I took 3. But I got it working. After 6 days of work, I can show you Simon Squared in all its Windows Azure powered multi-player glory:&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px auto; padding-left: 0px; width: 600px; padding-right: 0px; display: block; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:2e443b21-8fff-4b4f-a656-fd20b85e88bf" class="wlWriterEditableSmartContent"&gt;&lt;div id="573ed9f8-da40-404b-9bb8-edfef5d194c8" style="margin: 0px; padding: 0px; display: inline;"&gt;&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=xhyeb94DrQU" target="_new"&gt;&lt;img src="http://lh3.ggpht.com/_Blokl_3SWiA/TWeTlezq1AI/AAAAAAAAA14/pAJnKCNoslc/video709ec68055c9%5B182%5D.jpg?imgmax=800" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('573ed9f8-da40-404b-9bb8-edfef5d194c8'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;425\&amp;quot; height=\&amp;quot;319\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/xhyeb94DrQU?hl=en&amp;amp;hd=1\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/xhyeb94DrQU?hl=en&amp;amp;hd=1\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;425\&amp;quot; height=\&amp;quot;319\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="width:425px;clear:both;font-size:.8em"&gt;Simon Squared Multi-player, nicely showcasing my Multiple-instances-of-the-WP7-emulator hack&lt;/div&gt;&lt;/div&gt;  &lt;p&gt;So what took me so long? Surely after &lt;a href="http://blog.functionalfun.net/2011/02/multiplayer-enabling-my-windows-phone-7.html" target="_blank"&gt;getting the Windows Phone 7 emulator to talk to the Windows Azure emulator&lt;/a&gt;, finding &lt;a href="http://blog.functionalfun.net/2011/02/multiplayer-enabling-my-windows-phone-7_04.html" target="_blank"&gt;a UI library for XNA&lt;/a&gt; and enabling &lt;a href="http://blog.functionalfun.net/2011/02/multi-player-enabling-my-windows-phone.html" target="_blank"&gt;multiple instances of the WP7 emulator to run at once&lt;/a&gt;, everything else should have been easy? If only! &lt;/p&gt;  &lt;p&gt;Here’s what happened.&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;Day 4&lt;/h4&gt;  &lt;p&gt;&lt;strong&gt;9:00&lt;/strong&gt; Start by setting up a &lt;a href="http://www.microsoft.com/windowsazure/" target="_blank"&gt;Windows Azure&lt;/a&gt; subscription, making use of my &lt;a href="http://msdn.microsoft.com/en-us/subscriptions/ee461076.aspx"&gt;MSDN subscription benefits&lt;/a&gt;: it's pretty generous: 750 hours/month of Compute Time, 10 GB storage, 7/14 GB traffic in/out.&lt;/p&gt;  &lt;p&gt;I get a little worried when the sign up screen tells me that I'll receive an activation email &amp;quot;within 24 hours&amp;quot; - but I'm relieved to see that within a couple of minutes of being redirected to the Azure management console (very swish Silverlight app) my subscription appears, and I can start creating deployments.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;10:11&lt;/strong&gt; Got side-tracked into a discussion with my boss about possibilities for future products and offerings based on the work we've been doing here&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;12:45&lt;/strong&gt; Implemented the phone side behaviour for running the count down to the games beginning. Making heavy use of the &lt;a href="http://msdn.microsoft.com/en-us/devlabs/ee794896" target="_blank"&gt;Reactive Framework&lt;/a&gt; (which comes built into WP7) for hiding away the messiness of asynchronous calls.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;13:45&lt;/strong&gt; Problem with &lt;a href="http://wcf.codeplex.com/" target="_blank"&gt;WCF REST&lt;/a&gt;: if I return a derived type of message from my operation, the client only receives the properties defined on the base type. This is the problem that the &lt;a href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.knowntypeattribute.aspx" target="_blank"&gt;KnownType attribute&lt;/a&gt; solves elsewhere in WCF, but it doesn’t seem to be working for WCF REST.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;15:22&lt;/strong&gt; Discovered that WCF REST uses &lt;a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlserializer.aspx" target="_blank"&gt;XmlSerializer&lt;/a&gt; by default rather than DataContractSerializer - so KnownTypes woudn't work. Also discovered that &lt;a href="http://restsharp.org/" target="_blank"&gt;RestSharp&lt;/a&gt; is using XmlSerializer when sending data to the server, so not serializing inherited types in the way that DCS is expecting. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;15:39&lt;/strong&gt; Now got inherited message types passing correctly: WCF Rest and RestSharp are both pretty pluggable, so I was able to implement a custom ISerializer in RestSharp, and a custom &lt;a href="http://weblogs.asp.net/cibrax/archive/2010/11/15/http-processors-in-the-wcf-web-programming-model.aspx" target="_blank"&gt;MediaTypeProcessor&lt;/a&gt; in WCF Rest, both using DataContractSerializer instead of XmlSerializer&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;17:30&lt;/strong&gt; Caught out by Http response caching. The symptom was that I’d launch a fresh &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx" target="_blank"&gt;HttpWebRequest&lt;/a&gt;,&amp;#160; but get back stale data. Investigation showed that the requests weren’t ever leaving the phone – it never showed up in &lt;a href="http://www.fiddlertool.com/" target="_blank"&gt;Fiddler&lt;/a&gt;. I spent ages prodding my Reactive Framework query, convinced that it wasn’t issuing the requests properly. Then I remembered Http Caching. In my haste, and newbie-ness, I solved the problem by putting a NoCache on all the responses on the server side. A better way would probably have been to set the &lt;a href="http://msdn.microsoft.com/en-us/library/system.net.webrequest.cachepolicy.aspx" target="_blank"&gt;WebRequest.CachePolicy&lt;/a&gt;.&lt;/p&gt;  &lt;h4&gt;Day 5&lt;/h4&gt;  &lt;p&gt;&lt;strong&gt;09:00&lt;/strong&gt; Thought occurs to me that I might get on faster if I don't have to keep waiting for the Azure Emulator to start up and shut down every time I build my server. Why not just run my server project directly in IIS? I try it – and WCF Http stops working. I eventually discover that the CTP bits I’m using &lt;a href="http://wcf.codeplex.com/discussions/246604" target="_blank"&gt;don’t yet support HTTPS&lt;/a&gt;, and I had a HTTPs binding configured on my default Website in IIS.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;10:30&lt;/strong&gt; Fortunately Cassini works - why did it take me an hour and half to discover that!&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;10:43&lt;/strong&gt; Start work on refactoring puzzle generation, so I can do it on the server side. The goal is that the server will generate rounds of 5 puzzles, and send them out to all the players in advance. Within a round, the server will send out a message saying “start puzzle X at Time T” – and thus synchronize the experience of each of the players&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;12:00&lt;/strong&gt; Working on updating the Phone side to play the puzzles that server sends out.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;13:16&lt;/strong&gt; Finished refactoring the Game screen so that it is backed by a GameController - allowing me to implement a SinglePlayerGameController and MultiPlayerGameController.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;17:20 &lt;/strong&gt;Got some simple state machines working on the client and server. It looks something like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_Blokl_3SWiA/TWeTll27BtI/AAAAAAAAA1k/O3KGY9yL_r8/s1600-h/image%5B7%5D.png"&gt;&lt;img style="margin: 0px auto; display: block; float: none" title="image" alt="image" src="http://lh5.ggpht.com/_Blokl_3SWiA/TWeTmeHEmCI/AAAAAAAAA1o/3cUVpH3v5y8/image_thumb%5B3%5D.png?imgmax=800" width="263" height="295" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;17:40&lt;/strong&gt; With two instances of the emulator running, I can now see the same puzzles displayed on each. The problem is, they’re horribly out of sync – player 1 might get the puzzle two seconds ahead of player 2, which for small puzzles means he’s certain to win!&lt;/p&gt;  &lt;h4&gt;&lt;/h4&gt;  &lt;h4&gt;Day 6&lt;/h4&gt;  &lt;p&gt;&lt;strong&gt;09:21 &lt;/strong&gt;Implemented &lt;a href="http://en.wikipedia.org/wiki/Cristian's_algorithm" target="_blank"&gt;Christian’s algorithm&lt;/a&gt; to estimate the clock skew between server and phone. The implementation is pretty straight-forward using the Reactive Framework, and quite elegant, if I do say so myself. Remind me to show you, sometime.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;10:33&lt;/strong&gt; Couldn’t figure out why changes I was making in the code weren’t having any effect when I ran the game. Then discovered that Visual Studio had some how set itself to “Never Build on Run”.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;12:00 &lt;/strong&gt;It’s working! Multiple players now receive the puzzles beautifully in sync, one after another. As soon as one player completes a puzzle, it vanishes from all the other players screens, and the count-down to the next puzzle begins&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;13:20 &lt;/strong&gt;Implemented a scoreboard to show the position at the end of each round&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;14:30&lt;/strong&gt; Having deployed the game to my phone, I challenge Vinod to a dual – me on the emulator, him on the phone. I now discover a serious downside to being a games developer: once a game reaches playability, you inevitably get sucked into playing when you should just be testing.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;15:35 &lt;/strong&gt;Use Expression Design 4 to recreate a game logo that Neil designed using Word. What do you think?&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_Blokl_3SWiA/TWeTmtADXRI/AAAAAAAAA1s/rAz_LeJg_Ck/s1600-h/SimonSquaredLogo200x200%5B3%5D.png"&gt;&lt;img style="margin: 0px auto; display: block; float: none" title="SimonSquaredLogo200x200" alt="SimonSquaredLogo200x200" src="http://lh3.ggpht.com/_Blokl_3SWiA/TWeTm7e4SyI/AAAAAAAAA1w/NGfu2mZ2JwM/SimonSquaredLogo200x200_thumb%5B1%5D.png?imgmax=800" width="176" height="176" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;17:05 &lt;/strong&gt;Spitting and polishing. Tidying up the various screens. I might not have time to make them pretty, but at least I can make the buttons big enough to touch. That’s the downside of testing with an emulator using a mouse – it doesn’t alert you to the imprecision of fat fingers!&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;17:30&lt;/strong&gt; Waiting for Windows Azure to deploy the server. Visual Studio 2010 is supposed to be able to package and deploy your project straight into the cloud, but I couldn’t get that to work (something about it not being able to resolve the URL of my storage account). Instead, I uploaded the package manually. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;17:45 &lt;/strong&gt;Still waiting for Windows Azure to start up my role instance. Give up and go home.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;21:00 &lt;/strong&gt;Wife gives me permission to interrupt our traditional Thursday evening film (&lt;a href="http://www.imdb.com/title/tt0482571/" target="_blank"&gt;The Prestige&lt;/a&gt; last night, – recommended) to see whether the Azure role has started up yet. It hasn’t, so in the time-honoured way I tell it to reboot – and that fixes it. A few minutes later, she’s thrashing me – mainly because she’s using the phone, and I’m using the emulator over Remote Desktop (my laptop is old, and doesn’t support XNA games in the emulator) – in that setup the emulator doesn’t respond to my mouse moves! &lt;/p&gt;  &lt;p&gt;What I need is another phone. &lt;/p&gt;  &lt;p&gt;Ah, what’s this I see – the Windows Phone Marketplace Developer Newsletter, announcing &lt;a href="http://www.zones.com/site/standard_page/index.html" target="_blank"&gt;Windows Phone 7 Handsets for Developers&lt;/a&gt;. The Newsletter says that local evangelists have codes for free phones to give away. I think &lt;a href="http://blogs.msdn.com/b/mikeormond/" target="_blank"&gt;Mike Ormond&lt;/a&gt; is the WP7 evangelist for the UK … &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-4450242650813023421?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sG2sf91UZJE:urPlAZ5Ch0A:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=sG2sf91UZJE:urPlAZ5Ch0A:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sG2sf91UZJE:urPlAZ5Ch0A:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sG2sf91UZJE:urPlAZ5Ch0A:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sG2sf91UZJE:urPlAZ5Ch0A:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=sG2sf91UZJE:urPlAZ5Ch0A:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sG2sf91UZJE:urPlAZ5Ch0A:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=sG2sf91UZJE:urPlAZ5Ch0A:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sG2sf91UZJE:urPlAZ5Ch0A:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sG2sf91UZJE:urPlAZ5Ch0A:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sG2sf91UZJE:urPlAZ5Ch0A:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sG2sf91UZJE:urPlAZ5Ch0A:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=sG2sf91UZJE:urPlAZ5Ch0A:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/sG2sf91UZJE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/4450242650813023421/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/02/simon-squared-making-it-multi-player.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/4450242650813023421?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/4450242650813023421?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/sG2sf91UZJE/simon-squared-making-it-multi-player.html" title="Simon Squared – We have Multi-player: Days 4, 5 and (ahem!) 6" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_Blokl_3SWiA/TWeTlezq1AI/AAAAAAAAA14/pAJnKCNoslc/s72-c/video709ec68055c9%5B182%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>4</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/02/simon-squared-making-it-multi-player.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IARHwyfip7ImA9Wx9UFEw.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-2984109716106789678</id><published>2011-02-11T10:19:00.001Z</published><updated>2011-02-11T10:19:05.296Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-11T10:19:05.296Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WP7Comp" /><category scheme="http://www.blogger.com/atom/ns#" term="REST" /><category scheme="http://www.blogger.com/atom/ns#" term="Software" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><category scheme="http://www.blogger.com/atom/ns#" term="WCF" /><title>Multi-player enabling my Windows Phone 7 game: Day 3 – The Server Side</title><content type="html">&lt;p&gt;&lt;em&gt;I’m building a game to enter in Red Gate’s &lt;a href="http://wp7comp.wpengine.com/"&gt;Windows Phone 7 App competition&lt;/a&gt;. I built the core of the game &lt;a href="http://blog.functionalfun.net/2010/12/can-i-build-windows-phone-7-game-in-3.html"&gt;in 3 days&lt;/a&gt; from a standing start. Now I’ve challenged myself to &lt;a href="http://blog.functionalfun.net/2011/01/simon-squared-x-n-multi-player.html"&gt;make the game multi-player in 3 days&lt;/a&gt;, using Windows Azure for the server side.&amp;#160; &lt;a href="http://blog.functionalfun.net/2011/02/multiplayer-enabling-my-windows-phone-7.html"&gt;Day 1&lt;/a&gt; was spent getting up to speed with Windows Azure and networking on WP7. On &lt;a href="http://blog.functionalfun.net/2011/02/multiplayer-enabling-my-windows-phone-7_04.html"&gt;Day 2&lt;/a&gt; I got the UI sketched out. Here’s Day 3:&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;8:30 Begin the day with excellent news. With barely any badgering at all &lt;a href="http://red-badger.com/"&gt;Red Badger&lt;/a&gt; have kindly offered me an non-expiring build of their &lt;a href="http://red-badger.com/Blog/post/XPF-Getting-Started.aspx"&gt;XPF UI library for XNA&lt;/a&gt;. Thanks chaps!&lt;/p&gt;  &lt;p&gt;And thanks to everyone who's shown support by tweeting the last couple of blog posts. I can't tell you how motivating it is as I set to work again this morning.&lt;/p&gt;  &lt;p&gt;8:45 Microsoft have released the &lt;a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=49B9D0C5-6597-4313-912A-F0CCA9C7D277"&gt;January 2011 Update to the Windows Phone Developer Tools&lt;/a&gt; (on the 4th of February mind, but I'll let that pass). This is the one that brings the promised Copy-Paste support and some performance updates. Being the good boy I am, I install it before beginning anything else.&lt;/p&gt;  &lt;p&gt;9:32 Staring work on the server. I've never designed anything RESTful before, so I've taken a quick look at a couple of articles: one at quite &lt;a href="http://www.xfront.com/REST-Web-Services.html"&gt;a high level&lt;/a&gt;, and one in a little &lt;a href="http://www.infoq.com/articles/designing-restful-http-apps-roth"&gt;more detail&lt;/a&gt;.&amp;#160; A logical place to begin is starting a game. So what I think I need to do is define a /Game resource on my server, and make it respond to POST requests.&lt;/p&gt;  &lt;p&gt;11:45 Hooked up &lt;a href="http://code.google.com/p/autofac/"&gt;AutoFac&lt;/a&gt; on the server so that I can inject dependencies into my REST services. &lt;/p&gt;  &lt;p&gt;12:00 A good chunk of the day gone, and I still haven't implemented starting a game. WCF isn't playing nice at the moment: I can't get it to respond to the POST request I'm making to my Service.&lt;/p&gt;  &lt;p&gt;12:01 Writing the above fixed the problem! Well, not quite. As soon as I had written that, I thought of fiddling with the UriTemplate on the &lt;a href="http://www.google.co.uk/url?sa=t&amp;amp;source=web&amp;amp;cd=1&amp;amp;ved=0CBYQFjAA&amp;amp;url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fsystem.servicemodel.web.webinvokeattribute.aspx&amp;amp;ei=jQJVTajCIYXKhAf4kbDZDA&amp;amp;usg=AFQjCNFjDD8IVv45dtxec2yVENKvN9IwjA&amp;amp;sig2=sx1jll0Emcy3_YYT84OJTA"&gt;WebInvoke&lt;/a&gt; attribute. Since I was posting a request to the /Games resource, and I had registered my Games service using &lt;font face="Consolas"&gt;routes.AddServiceRoute&amp;lt;GamesService&amp;gt;(&amp;quot;Games&amp;quot;, serviceConfiguration)&lt;/font&gt; I thought I could get away without specifying a value for UriTemplate on WebInvoke. Turned out I needed to specify &amp;quot;/&amp;quot;!&lt;/p&gt;  &lt;p&gt;12:05 Next: list all available games, so that a player can choose one to join.&lt;/p&gt;  &lt;p&gt;12:45 Done! I can now create several games through the Start a Game screen, and see them all listed on the Join a Game screen.&lt;/p&gt;  &lt;p&gt;16:15 The afternoon passes in a blur. I’ve added several operations to my service, so that the basic game setup screens are working. This is what I’ve got on the server side:    &lt;table border="1" cellspacing="0" cellpadding="2" width="401"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="142"&gt;&lt;strong&gt;Resource&lt;/strong&gt;&lt;/td&gt;          &lt;td valign="top" width="135"&gt;&lt;strong&gt;Http Method&lt;/strong&gt;&lt;/td&gt;          &lt;td valign="top" width="122"&gt;&lt;strong&gt;Meaning&lt;/strong&gt;&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="142"&gt;/Games&lt;/td&gt;          &lt;td valign="top" width="135"&gt;POST&lt;/td&gt;          &lt;td valign="top" width="122"&gt;Start a Game&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="142"&gt;/Games&lt;/td&gt;          &lt;td valign="top" width="147"&gt;GET&lt;/td&gt;          &lt;td valign="top" width="153"&gt;List existing games&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="142"&gt;/Games/{id}/Players&lt;/td&gt;          &lt;td valign="top" width="147"&gt;POST&lt;/td&gt;          &lt;td valign="top" width="153"&gt;Join a game&lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="142"&gt;/Games/{id}/Players&lt;/td&gt;          &lt;td valign="top" width="147"&gt;GET&lt;/td&gt;          &lt;td valign="top" width="153"&gt;List players belonging to a game&lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p&gt;Notice any conspicuous absences? That’s right: there are no operations to support actually playing a game. Where has the time gone? But before I can move on, I should at least check that this service works if multiple devices connect to it.&lt;/p&gt;  &lt;p&gt;16:25 Fustrated: the Microsoft Windows Phone 7 emulator is single-instance. How can I test a multi-player game if I can only run one copy of it?! I’ve got to find a way round this.&lt;/p&gt;  &lt;p&gt;17:30 Eureka! After a journey deep into the bowels of the &lt;a href="http://msdn.microsoft.com/en-us/library/bb384093(v=vs.90).aspx"&gt;Microsoft.SmartDevice.Connectivity API&lt;/a&gt; and its associated XML datastore I’ve found a way to have multiple instances of the emulator running at once, and even debug them simultaneously.&lt;/p&gt;  &lt;p&gt;Hey! Hang on just a minute: there’s already a &lt;a href="http://blog.functionalfun.net/2011/02/how-to-deploy-to-and-debug-multiple.html"&gt;post on my blog about that&lt;/a&gt; – is someone with a time machine playing around with me here? &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://lh3.ggpht.com/_Blokl_3SWiA/TVUNGLmJAbI/AAAAAAAAA1Y/7x84xHQNsnQ/wlEmoticon-smile%5B2%5D.png?imgmax=800" /&gt;&lt;/p&gt;  &lt;p&gt;But never mind that. My 3 days are up, and all I’ve got to show for it are the game sign-up screens. So where do we go from here? Well, I’m going to make my excuses and plead for an extra day – just one more day, and I’m sure I can get it working!&lt;/p&gt;  &lt;p&gt;My excuses:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;It took me ages to get the &lt;a href="http://blog.functionalfun.net/2011/02/multiplayer-enabling-my-windows-phone-7.html"&gt;Windows Phone 7 emulator talking to the Windows Azure emulator&lt;/a&gt;: the good folks at Microsoft haven’t connected the dots here.&lt;/li&gt;    &lt;li&gt;A good two hours or more of my first day was taken up with the hunt for a working UI library for XNA. Thanks to Red Badger for saving me further frustrating hours.&lt;/li&gt;    &lt;li&gt;Running multiple instances of the emulator really shouldn’t be that hard. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So what do you think? Can I have another day?&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-2984109716106789678?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sacJpqFM0v0:GGTcNKYFfE4:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=sacJpqFM0v0:GGTcNKYFfE4:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sacJpqFM0v0:GGTcNKYFfE4:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sacJpqFM0v0:GGTcNKYFfE4:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sacJpqFM0v0:GGTcNKYFfE4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=sacJpqFM0v0:GGTcNKYFfE4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sacJpqFM0v0:GGTcNKYFfE4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=sacJpqFM0v0:GGTcNKYFfE4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sacJpqFM0v0:GGTcNKYFfE4:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sacJpqFM0v0:GGTcNKYFfE4:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sacJpqFM0v0:GGTcNKYFfE4:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=sacJpqFM0v0:GGTcNKYFfE4:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=sacJpqFM0v0:GGTcNKYFfE4:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/sacJpqFM0v0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/2984109716106789678/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/02/multi-player-enabling-my-windows-phone.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/2984109716106789678?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/2984109716106789678?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/sacJpqFM0v0/multi-player-enabling-my-windows-phone.html" title="Multi-player enabling my Windows Phone 7 game: Day 3 – The Server Side" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_Blokl_3SWiA/TVUNGLmJAbI/AAAAAAAAA1Y/7x84xHQNsnQ/s72-c/wlEmoticon-smile%5B2%5D.png?imgmax=800" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/02/multi-player-enabling-my-windows-phone.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8EQnsyfyp7ImA9Wx9UEUw.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-4198907775131385519</id><published>2011-02-07T20:33:00.001Z</published><updated>2011-02-07T20:33:23.597Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-07T20:33:23.597Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="XNA" /><category scheme="http://www.blogger.com/atom/ns#" term="Software" /><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><category scheme="http://www.blogger.com/atom/ns#" term="How to" /><title>How to deploy to, and debug, multiple instances of the Windows Phone 7 emulator</title><content type="html">&lt;p&gt;I’m developing &lt;a href="http://blog.functionalfun.net/2011/01/simon-squared-x-n-multi-player.html"&gt;a multi-player Windows Phone 7 game&lt;/a&gt;. Now I don’t know about you, but I find it hard to test a multi-player application when I’m only allowed to run one instance of it. And that seemed to be the case with Windows Phone 7 applications. Microsoft provide an Emulator, but it’s a single-instance application: however many times you click its icon, you only get the one window.&lt;/p&gt;  &lt;p&gt;Googling found me &lt;a href="http://dotnet.dzone.com/articles/how-run-multiple-instances"&gt;a useful article&lt;/a&gt; on how to run multiple instances of the emulator. But it didn’t tell me how to deploy applications to them, or how to debug those applications. There was however, a &lt;a href="http://forums.create.msdn.com/forums/p/72474/442219.aspx"&gt;post in the forums&lt;/a&gt;, somewhat reminiscent of &lt;a href="http://en.wikipedia.org/wiki/Fermat's_Last_Theorem#Fermat.27s_conjecture"&gt;Monsieur de Fermat&lt;/a&gt; scribbling's, that gave me hope that what I wanted to do was indeed possible.&lt;/p&gt;  &lt;p&gt;So I set out on a journey of discovery.&lt;/p&gt;  &lt;p&gt;About an hour later, I had this,&lt;a href="http://lh4.ggpht.com/_Blokl_3SWiA/TVBW1Ji7ybI/AAAAAAAAA0g/MZY1hXew5Mc/s1600-h/image%5B15%5D.png"&gt;&lt;img style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://lh3.ggpht.com/_Blokl_3SWiA/TVBW2CBSx7I/AAAAAAAAA0k/EmTgwCmQz_g/image_thumb%5B17%5D.png?imgmax=800" width="257" height="100" /&gt;&lt;/a&gt;this, &lt;a href="http://lh4.ggpht.com/_Blokl_3SWiA/TVBW3FSbOAI/AAAAAAAAA0o/af3QERMnmnM/s1600-h/image%5B16%5D.png"&gt;&lt;img style="display: block; float: none; margin-left: auto; margin-right: auto" title="image" alt="image" src="http://lh5.ggpht.com/_Blokl_3SWiA/TVBW4bajPaI/AAAAAAAAA0s/XIb25Ij-xp4/image_thumb%5B18%5D.png?imgmax=800" width="290" height="271" /&gt;&lt;/a&gt;and this&lt;a href="http://lh3.ggpht.com/_Blokl_3SWiA/TVBW6CzauEI/AAAAAAAAA0w/hanCjMKjynM/s1600-h/Multiple%20Instances%5B5%5D.png"&gt;&lt;img style="display: block; float: none; margin-left: auto; margin-right: auto" title="Multiple Instances" alt="Multiple Instances" src="http://lh5.ggpht.com/_Blokl_3SWiA/TVBW7kO2SjI/AAAAAAAAA00/QvGKg-lf5qA/Multiple%20Instances_thumb%5B3%5D.png?imgmax=800" width="489" height="317" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h4&gt;Step by Step instructions&lt;/h4&gt;  &lt;p&gt;&lt;em&gt;Disclaimer: what I am about to show is completely unsupported by Microsoft or me. Continue at your own risk. Here be dragons.&lt;/em&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Open the folder &lt;em&gt;[Your Drive Letter]:\ProgramData\Microsoft\Phone Tools\CoreCon\10.0\addons&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Locate the file &lt;em&gt;ImageConfig.en-US.xsl&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Take a copy of it, leaving it in the same directory, and name it something like &lt;em&gt;ImageConfig.en-US 2nd Instance.xsl&lt;/em&gt; &lt;/li&gt;    &lt;li&gt;Open the copy in your text editor of choice. &lt;/li&gt;    &lt;li&gt;Locate the element DEVICE&lt;a href="http://lh6.ggpht.com/_Blokl_3SWiA/TVBW8_QGuII/AAAAAAAAA04/tI_S4mASg-o/s1600-h/DEVICEElement%5B4%5D.png"&gt;&lt;img style="display: block; float: none; margin-left: auto; margin-right: auto" title="DEVICEElement" alt="DEVICEElement" src="http://lh4.ggpht.com/_Blokl_3SWiA/TVBW-JrHPmI/AAAAAAAAA08/1lixPliPCW4/DEVICEElement_thumb%5B2%5D.png?imgmax=800" width="712" height="221" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Change the Name attribute, and assign a new value to ID – you can use the &lt;a href="http://www.guidgenerator.com/"&gt;Online Guid Generator&lt;/a&gt; if you can’t think of one off the top of your head. &lt;/li&gt;    &lt;li&gt;Scroll down the file to locate the part that says PROPERTY ID=”VMID”:&lt;a href="http://lh6.ggpht.com/_Blokl_3SWiA/TVBW-8BuT6I/AAAAAAAAA1A/ur4Kx9QzQYI/s1600-h/VIMD%5B4%5D.png"&gt;&lt;img style="display: block; float: none; margin-left: auto; margin-right: auto" title="VIMD" alt="VIMD" src="http://lh3.ggpht.com/_Blokl_3SWiA/TVBW_lUw7KI/AAAAAAAAA1E/RpX5jkaHHtU/VIMD_thumb%5B2%5D.png?imgmax=800" width="705" height="183" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Put a new Guid inside that element – make sure though that you use capital letters rather than lower case. &lt;/li&gt;    &lt;li&gt;Save the file &lt;/li&gt;    &lt;li&gt;That’s it. Re open the XAP deployment tool, or Visual Studio, if you already have them open, and you’ll see your new Emulator instances. &lt;/li&gt; &lt;/ol&gt;  &lt;h4&gt;A Bonus Visual Studio tip&lt;/h4&gt;  &lt;p&gt;To debug multiple instances of your Windows Phone 7 application you can do the following:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Start the first instance as usual.&lt;/li&gt;    &lt;li&gt;Change the Deployment Device to your newly-minted 2nd Emulator: &lt;a href="http://lh6.ggpht.com/_Blokl_3SWiA/TVBXA3JqHOI/AAAAAAAAA1I/JUfhoVLrz50/s1600-h/image%5B34%5D.png"&gt;&lt;img style="margin: 5px auto 0px; display: block; float: none" title="image" alt="image" src="http://lh6.ggpht.com/_Blokl_3SWiA/TVBXB5WSmfI/AAAAAAAAA1M/vOWYRo5Zur0/image_thumb%5B39%5D.png?imgmax=800" width="423" height="150" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt; To start the 2nd instance, right-click on your project, go to the Debug menu item, then select Start new instance:&lt;a href="http://lh4.ggpht.com/_Blokl_3SWiA/TVBXDOtDa_I/AAAAAAAAA1Q/mFbYge-ikl4/s1600-h/image%5B29%5D.png"&gt;&lt;img style="margin: 5px auto 0px; display: block; float: none" title="image" alt="image" src="http://lh3.ggpht.com/_Blokl_3SWiA/TVBXElWou2I/AAAAAAAAA1U/E99RrxdrU5U/image_thumb%5B32%5D.png?imgmax=800" width="446" height="365" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ol&gt;    &lt;p&gt;4. Prepare a wet towel and a darkened room in preparation for the multi-player debugging experience.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-4198907775131385519?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=_VNaGmqNEMg:cTvdZ3c0Cs8:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=_VNaGmqNEMg:cTvdZ3c0Cs8:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=_VNaGmqNEMg:cTvdZ3c0Cs8:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=_VNaGmqNEMg:cTvdZ3c0Cs8:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=_VNaGmqNEMg:cTvdZ3c0Cs8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=_VNaGmqNEMg:cTvdZ3c0Cs8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=_VNaGmqNEMg:cTvdZ3c0Cs8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=_VNaGmqNEMg:cTvdZ3c0Cs8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=_VNaGmqNEMg:cTvdZ3c0Cs8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=_VNaGmqNEMg:cTvdZ3c0Cs8:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=_VNaGmqNEMg:cTvdZ3c0Cs8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=_VNaGmqNEMg:cTvdZ3c0Cs8:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=_VNaGmqNEMg:cTvdZ3c0Cs8:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/_VNaGmqNEMg" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/4198907775131385519/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/02/how-to-deploy-to-and-debug-multiple.html#comment-form" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/4198907775131385519?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/4198907775131385519?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/_VNaGmqNEMg/how-to-deploy-to-and-debug-multiple.html" title="How to deploy to, and debug, multiple instances of the Windows Phone 7 emulator" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_Blokl_3SWiA/TVBW2CBSx7I/AAAAAAAAA0k/EmTgwCmQz_g/s72-c/image_thumb%5B17%5D.png?imgmax=800" height="72" width="72" /><thr:total>10</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/02/how-to-deploy-to-and-debug-multiple.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak8CRH47eSp7ImA9Wx9VGEk.&quot;"><id>tag:blogger.com,1999:blog-7577421612120825312.post-3744429485111775116</id><published>2011-02-04T17:34:00.001Z</published><updated>2011-02-04T19:47:45.001Z</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-02-04T19:47:45.001Z</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="WPF" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7Comp" /><category scheme="http://www.blogger.com/atom/ns#" term="XNA" /><category scheme="http://www.blogger.com/atom/ns#" term="Software" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Silverlight" /><category scheme="http://www.blogger.com/atom/ns#" term=".Net" /><category scheme="http://www.blogger.com/atom/ns#" term="WP7" /><title>Multiplayer-enabling my Windows Phone 7 game: Day 2–Building a UI with XPF</title><content type="html">&lt;p&gt;&lt;em&gt;I’m building a game to enter in Red Gate’s &lt;a href="http://wp7comp.wpengine.com/"&gt;Windows Phone 7 App competition&lt;/a&gt;. The first challenge I set myself was to &lt;a href="http://blog.functionalfun.net/2010/12/can-i-build-windows-phone-7-game-in-3.html"&gt;build the core of the game in 3 days&lt;/a&gt; from a standing start. Then Red Gate &lt;a href="http://blog.functionalfun.net/2010/12/say-hello-to-simon-squared-my-35-day.html"&gt;moved the goal posts&lt;/a&gt;. So I’ve set myself a new challenge: &lt;a href="http://blog.functionalfun.net/2011/01/simon-squared-x-n-multi-player.html"&gt;make the game multi-player in 3 days&lt;/a&gt;, using Windows Azure for the server side.&amp;#160; &lt;a href="http://blog.functionalfun.net/2011/02/multiplayer-enabling-my-windows-phone-7.html"&gt;Day 1&lt;/a&gt;, was spent getting up to speed with Windows Azure and networking on WP7. Here’s Day 2:&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;9:00 Decided to take the plunge and go with &lt;a href="http://red-badger.com/Blog/post/XPF-Getting-Started.aspx"&gt;Red Badger's XPF framework&lt;/a&gt; for the UI - what else can I do, if I want to get this thing done in three days? I’m going to need TextBoxes, ListBoxes and the like, and I certainly wouldn’t be able to write them from scratch in the time I have. On Red Badger’s &lt;a href="http://red-badger.com/Blog/post/XPF-Roadmap-and-Licensing.aspx"&gt;roadmap&lt;/a&gt;, there’s no word on a likely release date. I wonder if I can badger them into at least giving me a build that won’t expire before the competition gets judged?&lt;/p&gt;  &lt;p&gt;9:43 Got my first &amp;quot;Hello World&amp;quot; screen working using XPF. For ages I couldn't get buttons to respond to clicks, until I noticed from a sample that I needed to supply an InputManager instance to the RootElement.&lt;/p&gt;  &lt;p&gt;10:47 Created a TextBox control using XPF. They've done a good job of mimicking the Silverlight API. And in some ways, their DependencyProperty implementation is even better! It uses generics for a start. And the key classes are actually called ReactiveProperty and ReactiveObject because their change notification is based on IObservable from the &lt;a href="http://msdn.microsoft.com/en-us/devlabs/ee794896"&gt;Rx Framework&lt;/a&gt; (which, by the way, comes in the box on WP7). Text input on XNA is pretty limited. Your only option is to call &lt;a href="http://msdn.microsoft.com/en-us/library/microsoft.xna.framework.gamerservices.guide.beginshowkeyboardinput.aspx" target="_blank"&gt;Guide.BeginShowKeyboardInput&lt;/a&gt;, which is an async method that takes care of showing the soft keyboard as well as the editor, and then returns to you the text that was entered.&lt;/p&gt;  &lt;p&gt;11:40 Refactored my game so it now has Screen classes to represent the states that it can be in - Showing the Game, Showing the Welcome Screen, Showing Help, etc. It’s nice that XNA has the concept of Components and Services built in.&lt;/p&gt;  &lt;p&gt;14:21Got a simple dialog working:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_Blokl_3SWiA/TUw4iSMhyXI/AAAAAAAAA0Q/1UduuV7uyaM/s1600-h/clip_image001%5B4%5D.png"&gt;&lt;img style="margin: 0px auto; display: block; float: none" title="clip_image001" alt="clip_image001" src="http://lh5.ggpht.com/_Blokl_3SWiA/TUw4izn5QoI/AAAAAAAAA0U/jhVR5I9ChFA/clip_image001_thumb%5B1%5D.png?imgmax=800" width="238" height="434" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;14:36 Borrowed the Messenger code from &lt;a href="http://www.galasoft.ch"&gt;Laurent Bugnion&lt;/a&gt;'s &lt;a href="http://www.galasoft.ch/mvvm/getstarted/"&gt;MVVM Light Toolkit&lt;/a&gt; to enable me to pass messages in a loosely coupled way between my screens.&lt;/p&gt;  &lt;p&gt;15:06 Seeing strange behaviour in XPF where clicks on a button seem to be handled twice: once by the button, and then by widgets on the following screen (which is made visible by the button click). Realise that this is what comes of changing one screen for another in the middle of handling events. I'm going to have to implement a mini message queue so I can queue the change of screen after the button event has been handled.&lt;/p&gt;  &lt;p&gt;15:15 Implemented the message queue, and magically another bug goes away too! That bug was most odd – after I clicked one button, moved to a different screen, then moved back again, all the other buttons would stop working. It turned out that the first button was capturing the mouse events, so the other buttons didn’t get a look in. Making sure that events completed before changing screens obviously fixed the mouse capture problem too.&lt;/p&gt;  &lt;p&gt;16:05 Dialogs are coming on nicely now, but it sure is tedious building up a control hierarchy in C#. Oh XAML, how I miss you!&lt;/p&gt;  &lt;p&gt;17:21 Got a very basic ListBox working on top of XPF. The time I’ve spent delving around in WPF and Silverlight certainly helps out here!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_Blokl_3SWiA/TUw4jUEz4YI/AAAAAAAAA0Y/hR9Cqs8mp0U/s1600-h/image%5B4%5D.png"&gt;&lt;img style="margin: 0px auto; display: block; float: none" title="image" alt="image" src="http://lh6.ggpht.com/_Blokl_3SWiA/TUw4joofrTI/AAAAAAAAA0c/ZM2ZE52WXdo/image_thumb%5B2%5D.png?imgmax=800" width="255" height="467" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;17:30 I think that’s enough of the multi-player UI done for now. That leaves me with one day to implement the multi-player logic, and the server. &lt;/p&gt;  &lt;p&gt;Do you think I can do it?&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7577421612120825312-3744429485111775116?l=blog.functionalfun.net' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=4FNWI2Sw0AA:ZFwHPEhZqyc:VYtfdMxc7SE"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=4FNWI2Sw0AA:ZFwHPEhZqyc:VYtfdMxc7SE" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=4FNWI2Sw0AA:ZFwHPEhZqyc:8U7eRf_NmwQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=8U7eRf_NmwQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=4FNWI2Sw0AA:ZFwHPEhZqyc:G79ilh31hkQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=G79ilh31hkQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=4FNWI2Sw0AA:ZFwHPEhZqyc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=4FNWI2Sw0AA:ZFwHPEhZqyc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=4FNWI2Sw0AA:ZFwHPEhZqyc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=4FNWI2Sw0AA:ZFwHPEhZqyc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=4FNWI2Sw0AA:ZFwHPEhZqyc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=4FNWI2Sw0AA:ZFwHPEhZqyc:l6gmwiTKsz0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=l6gmwiTKsz0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=4FNWI2Sw0AA:ZFwHPEhZqyc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/FunctionalFun?a=4FNWI2Sw0AA:ZFwHPEhZqyc:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/FunctionalFun?i=4FNWI2Sw0AA:ZFwHPEhZqyc:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/FunctionalFun/~4/4FNWI2Sw0AA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.functionalfun.net/feeds/3744429485111775116/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.functionalfun.net/2011/02/multiplayer-enabling-my-windows-phone-7_04.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/3744429485111775116?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7577421612120825312/posts/default/3744429485111775116?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/FunctionalFun/~3/4FNWI2Sw0AA/multiplayer-enabling-my-windows-phone-7_04.html" title="Multiplayer-enabling my Windows Phone 7 game: Day 2–Building a UI with XPF" /><author><name>Sam</name><uri>http://www.blogger.com/profile/01345100698738870730</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="24" height="32" src="http://1.bp.blogspot.com/_Blokl_3SWiA/TLnxX6u-kVI/AAAAAAAAAxM/4G8IFTrvgGc/S220/Portrait+Cropped.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_Blokl_3SWiA/TUw4izn5QoI/AAAAAAAAA0U/jhVR5I9ChFA/s72-c/clip_image001_thumb%5B1%5D.png?imgmax=800" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://blog.functionalfun.net/2011/02/multiplayer-enabling-my-windows-phone-7_04.html</feedburner:origLink></entry></feed>

