<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Wishful Code</title>
	<atom:link href="http://wishfulcode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wishfulcode.com</link>
	<description></description>
	<lastBuildDate>Mon, 30 Jul 2012 11:16:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='wishfulcode.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Wishful Code</title>
		<link>http://wishfulcode.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://wishfulcode.com/osd.xml" title="Wishful Code" />
	<atom:link rel='hub' href='http://wishfulcode.com/?pushpress=hub'/>
		<item>
		<title>MonoTouch.Dialog.DialogViewController and UINavigationController: missing back button</title>
		<link>http://wishfulcode.com/2012/04/06/monotouch-dialog-dialogviewcontroller-and-uinavigationcontroller-missing-back-button/</link>
		<comments>http://wishfulcode.com/2012/04/06/monotouch-dialog-dialogviewcontroller-and-uinavigationcontroller-missing-back-button/#comments</comments>
		<pubDate>Fri, 06 Apr 2012 22:27:30 +0000</pubDate>
		<dc:creator>petemill</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[monotouch]]></category>

		<guid isPermaLink="false">http://wishfulcode.com/?p=149</guid>
		<description><![CDATA[Ran in to an issue where I was pushing several DialogViewControllers in to a NavigationController. The DialogViewcontroller instances would asynchronously fetch data, and add the dialog elements when the data was retreived. Whilst this was working quite well, at any given point in the navigation the back button would only appear on the topmost view [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=149&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Ran in to an issue where I was pushing several DialogViewControllers in to a NavigationController. The DialogViewcontroller instances would asynchronously fetch data, and add the dialog elements when the data was retreived. Whilst this was working quite well, at any given point in the navigation the back button would only appear on the topmost view (the current view). Navigate back to any previous view and the back button would not be on the NavigationController.</p>
<p>I knew that the NavigationController is reliant upon the title of each UIView, so I made sure I was setting that, but it didn&#8217;t help.</p>
<p>The solution was to make sure to not reinstantiate the Root element of the DialogViewController. Doing so must mess with the Title of the UIView, and even if ithe title content stays the same, it looks like it causes the NavigationController to forget what it&#8217;s called and prevent a back button from showing. Instead, instantiate the RootElement when the class is created, and add items to the that object when the data has been retreived.</p>
<p>Bad:</p>
<pre>//data has been retreived, replace dialog contents<br />this.Root = new RootElement(myTitle)<br />{<br />new Section("Folders"){<br />Elements = myData.Select(obj =&gt; (Element)new StringElement(obj.Name)).ToList()<br />}<br />};</pre>
<p>Good:</p>
<pre>//data has been retreived, replace dialog contents<br />this.Root.Clear();<br />this.Root.Add(new Section[]<br />{<br />new Section("Folders"){<br />Elements = myData.Select(obj =&gt; (Element)new StringElement(obj.Name)).ToList()<br />}<br />});</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wishfulcode.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wishfulcode.wordpress.com/149/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=149&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wishfulcode.com/2012/04/06/monotouch-dialog-dialogviewcontroller-and-uinavigationcontroller-missing-back-button/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8424f579fc2b19677712c0b76e7a477?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">wishfulcode</media:title>
		</media:content>
	</item>
		<item>
		<title>Measuring Viewport size with Google Analytics</title>
		<link>http://wishfulcode.com/2011/11/02/measuring-viewport-size-with-google-analytics/</link>
		<comments>http://wishfulcode.com/2011/11/02/measuring-viewport-size-with-google-analytics/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 23:02:54 +0000</pubDate>
		<dc:creator>petemill</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[design]]></category>

		<guid isPermaLink="false">http://wishfulcode.com/?p=134</guid>
		<description><![CDATA[Google Analytics recently updated their API so that it&#8217;s possible to track non-interaction events without reducing the bounce rate to 0% when automatically tracking events on many or every pageview. They did this by including a boolean parameter on the _trackEvent method call which, when set to True, indicates that the event was not based [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=134&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Google Analytics recently <a title="Google Analytics Blog" href="http://analytics.blogspot.com/2011/10/non-interaction-events-wait-what.html">updated their API so that it&#8217;s possible to track non-interaction events</a> without reducing the bounce rate to 0% when automatically tracking events on many or every pageview. They did this by including a boolean <a title="Google Analytics Event Tracking Guide" href="http://code.google.com/apis/analytics/docs/tracking/eventTrackerGuide.html#non-interaction">parameter on the _trackEvent method call</a> which, when set to True, indicates that the event was not based on user-interaction.</p>
<p>Now we can send extra information to google analytics and not have it interpret that information as user interaction &#8211; and one piece of information we&#8217;ve always wanted to track in Google Analytics is viewport size. It&#8217;s great that GA already tracks screen resolution, but that doesn&#8217;t help us know what size the viewable area within the browser windows actually is, so let&#8217;s track the initial size, and then anytime the user resizes the window:</p>
<p><pre class="brush: jscript;">
//send to GA window viewport size on inital load and when resized as non-interactive events
$(function() {

  //track viewport dimensions
  var viewportWidth=$(window).width();
  _gaq.push(['_trackEvent', 'Viewport Dimensions', 'Viewport Dimensions Initial', viewportWidth+'x'+$(window).height(), viewportWidth, true]);

 //track viewport dimensions being changed by resize (throttled)
  var gaResizeCompleteHl;
  $(window).resize(function(){
    clearTimeout(gaResizeCompleteHl);
    gaResizeCompleteHl = setTimeout(function(){
        var viewportWidth=$(window).width();
  _gaq.push(['_trackEvent', 'Viewport Dimensions', 'Viewport Dimensions Resized', viewportWidth+'x'+$(window).height(), viewportWidth, true]);
      }, 500);
    });
  });
</pre></p>
<p><em>(paste this after your google analytics code, and sorry for the laziness &#8211; my code requires jQuery) </em>Since events allow for a numeric value to go with the action, I choose to send the width which GA can use to do powerful filtering during segmentation.</p>
<p>One of the biggest but most exciting challenges at the moment for web development is producing sites which respond beautifully to different screens, different methods of interaction and different amounts and types of data. In order to build those sites to the users&#8217; needs, we need as much data as possible about how people are using our products. Using Google Analytics and the above, we can segment the existing GA data and run queries using the new viewport information to answer questions such as:</p>
<ul>
<li>What percentage of people run their browsers at full screen width?</li>
<li>How many tablet (or phone) users are browsing in portrait versus landscape?</li>
<li>When or why do people resize their browsers?</li>
</ul>
<div>On a similar note, when thinking about designing for larger screens whilst I&#8217;m completely driven that we create experiences which make use of the whole screen, I have mixed feelings towards Mac OS. First, I panic because of the pre-Lion versions&#8217; tendencies to run browsers at very reduced widths compared to screen-widths. Then I feel excited about Lion&#8217;s full-screen mode, and how much users embrace and love it. Seeing that and the browsing experience on Windows 8 makes it clear the direction of travel and our task is to make those full-screen experiences as usable and beautiful as possible.</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wishfulcode.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wishfulcode.wordpress.com/134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=134&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wishfulcode.com/2011/11/02/measuring-viewport-size-with-google-analytics/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8424f579fc2b19677712c0b76e7a477?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">wishfulcode</media:title>
		</media:content>
	</item>
		<item>
		<title>You can&#8217;t put your privacy concerns on Facebook anymore</title>
		<link>http://wishfulcode.com/2011/09/25/facebook-privacy-concern-myths/</link>
		<comments>http://wishfulcode.com/2011/09/25/facebook-privacy-concern-myths/#comments</comments>
		<pubDate>Sun, 25 Sep 2011 21:07:18 +0000</pubDate>
		<dc:creator>petemill</dc:creator>
				<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://wishfulcode.com/?p=115</guid>
		<description><![CDATA[After facebook&#8217;s announcements last week around the new version of OpenGraph (version 3), many have been scared of an increased invasion of privacy about facebook recording and displaying, for the world to see, your activity as you browse around the web. Sparked by the release by certain media outlets of features where as you browse [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=115&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p style="text-align:left;">After facebook&#8217;s announcements last week around the new version of OpenGraph (version 3), many have been <a title="Dave Winer: Facebook is scaring me" href="http://scripting.com/stories/2011/09/24/facebookIsScaringMe.html" target="_blank">scared of an increased invasion of privacy</a> about facebook recording and displaying, for the world to see, your activity as you browse around the web. Sparked by the release by certain media outlets of features where as you browse their websites each action is relayed to your facebook timeline.<br />
<img class="size-medium wp-image-117" title="Facebook OpenGraph Timeline Music Items" src="http://wishfulcode.files.wordpress.com/2011/09/facebook-opengraph3-timeline-items.png?w=300&#038;h=107" alt="Facebook OpenGraph Timeline Music Items" width="300" height="107" /><img class="size-medium wp-image-119" style="border-color:initial;border-style:initial;" title="Facebook OpenGraph News items" src="http://wishfulcode.files.wordpress.com/2011/09/facebook-opengraph3-timeline-news.png?w=300&#038;h=121" alt="Facebook OpenGraph News items" width="300" height="121" /></p>
<div style="text-align:left;">There are two myths which seem to be perpetuating this hysteria:</div>
<h2>Myth #1: Facebook is implementing this functionality</h2>
<p>Actually, Facebook have only created an API for apps and sites to post actions to your history, and have done so in a very controlled way. The actions must contain an approved verb (eg: read/listened-to/played), an approved type (article/tv show/song) and cannot be anything outside of those bounds. The new actions API contains a sufficiently descriptive permission model for users of each app in front of that. It is the apps/sites you should direct your frustration at if you don&#8217;t want them to send every interaction you do to facebook. Indeed, I think these sites should offer more control &#8211; a compromise between fully automatic sending of actions, and a button similar to the like button.</p>
<p style="text-align:center;"><img class="aligncenter size-medium wp-image-121" title="Facebook OpenGraph action creation" src="http://wishfulcode.files.wordpress.com/2011/09/facebook-opengraph3-action-create.png?w=400" alt="Facebook OpenGraph action creation" width="400" /></p>
<p>In fact, facebook could have done so much worse. Due to the success of the facebook like button, facebook could have had the ability to record literally every article you visit on every site which implements the like button (lots) without asking for any persmission at all, or changing any code on your site. They had the power to know, without permission, everywhere a logged-in facebook user visits, but they chose to make this a push mechanism for content publishers. If you don&#8217;t like the fact that once you connect with Yahoo News or Spotify, every article you read or every song you listen to will be recorded forever on your Timeline, then you have to blame Yahoo or Spotify. Genius.</p>
<h2>Myth #2: Anything I do on the web now will be recorded on my Timeline</h2>
<p>Again, this depends on how media publishers intend to use facebook&#8217;s new API. Sometimes it will make sense to post actions without user interaction each time (listening to a song for example), and sometimes it won&#8217;t (imdb doesn&#8217;t know if you actually watched a movie, until you press their new watch button [this doesn't exist, I made it up]), but it&#8217;s all in the control of the publisher.</p>
<h2>This is the evolution of the like button, the old profile Apps, and the facebook beacon combined</h2>
<p>Facebook apps &#8211; the ones which created the mess of boxes and videos on people&#8217;s profiles, which quickly got removed a year or two ago allowed more identity to creep through, but in an extremely uncontrolled manner (developers could post pretty much any html in any layout they wanted). Now, developers don&#8217;t write <em>any</em> html on your profile &#8211; the actions your app sends to facebook are sent as data in a very specific manner, and how that is displayed and used on people&#8217;s Timelines is presented to you as 4 facebook-controlled options.</p>
<p><img class="aligncenter size-full wp-image-122" title="Facebook OpenGraph timeline display configuration" src="http://wishfulcode.files.wordpress.com/2011/09/facebook-opengraph3-timeline-configure.png?w=640" alt="Facebook OpenGraph timeline display configuration"   /></p>
<p>Like Button &#8211; as I mentioned already, the like button was a precursor to all this &#8211; 1 simple button which automatically likes a Url on the web. The like button could be reimplemented within the new OpenGraph API, but likely won&#8217;t be yet because of the fact you don&#8217;t need to give a website permission to have a like button which knows about you on it.</p>
<p>Facebook beacon &#8211; actually, facebook have been trying to achieve what they&#8217;ve done this week  for a while, starting with<a href="http://en.wikipedia.org/wiki/Facebook_Beacon"> facebook beacon</a>. Through that experience, it&#8217;s obvious Facebook learnt a lot about the direction they would need to take in order to get to their destination of becoming the central point for digital identity, sharing and discovery &#8211; and that direction is one where they share the resposibility with content providers.</p>
<h2>Like it or not, this is the direction the web is going if you want to take part in its social features and, personally, I love it.</h2>
<p>It&#8217;s definitely going to be an interesting time as we see how different content publishers embrace the new OpenGraph features &#8211; will wordpress.com implement an integration for their x hosted blogs? What about content publishers who have tried to do similar social/content mixing before &#8211; will iTunes give up on Ping and embrace facebook, or Microsoft connect Zune to facebook (their music and movie streaming is good but their social never took off)?</p>
<p>If Timeline is something to embrace as a cloud storage of my life events, and it&#8217;s to be a complete picture &#8211; then I&#8217;d like to see all the above, plus some interesting ways to push content to timeline from other mediums &#8211; TV shows and cinema, sports events (RunKeeper/MapMyRun), and trips for example, but I&#8217;d also like to see great tools for me to curate that information and powerful ways for facebook to amalgamate all my data, analyse it, and show interesting angles on my Timeline.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wishfulcode.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wishfulcode.wordpress.com/115/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=115&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wishfulcode.com/2011/09/25/facebook-privacy-concern-myths/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8424f579fc2b19677712c0b76e7a477?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">wishfulcode</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/09/facebook-opengraph3-timeline-items.png?w=300" medium="image">
			<media:title type="html">Facebook OpenGraph Timeline Music Items</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/09/facebook-opengraph3-timeline-news.png?w=300" medium="image">
			<media:title type="html">Facebook OpenGraph News items</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/09/facebook-opengraph3-action-create.png?w=400" medium="image">
			<media:title type="html">Facebook OpenGraph action creation</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/09/facebook-opengraph3-timeline-configure.png" medium="image">
			<media:title type="html">Facebook OpenGraph timeline display configuration</media:title>
		</media:content>
	</item>
		<item>
		<title>Cloud Terminal: Remote Desktop to EC2 instances</title>
		<link>http://wishfulcode.com/2011/05/19/cloud-terminal-remote-desktop-rdp-ec2-instances/</link>
		<comments>http://wishfulcode.com/2011/05/19/cloud-terminal-remote-desktop-rdp-ec2-instances/#comments</comments>
		<pubDate>Thu, 19 May 2011 20:24:57 +0000</pubDate>
		<dc:creator>petemill</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[amazon web services]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[code]]></category>

		<guid isPermaLink="false">http://wishfulcode.com/?p=104</guid>
		<description><![CDATA[By nature, when working with connectable resources in the cloud, the number and IP location of those resources can change at any point. A pain point is often managing the addresses with which to connect to these instances, so I spent a short amount of time doing something about it by creating a program in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=104&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>By nature, when working with connectable resources in the cloud, the number and IP location of those resources can change at any point. A pain point is often managing the addresses with which to connect to these instances, so I spent a short amount of time doing something about it by creating a program in WPF which automatically retreives a list of instances for an Amazon EC2 account and allows connections over Remote Desktop Protocol (RDP).</p>
<p><a href="http://cloudterminal.codeplex.com"><img class="aligncenter size-full wp-image-106" title="CloudConnect" src="http://wishfulcode.files.wordpress.com/2011/05/cloudconnect.png?w=640&#038;h=643" alt="CloudTerminal v0.2" width="640" height="643" /></a></p>
<p>After quickly realising then that there are many additional features which would also be useful in this area, I open sourced the project at <a title="EC2 RDP - CloudTerminal" href="http://cloudterminal.codeplex.com/">http://cloudterminal.codeplex.com</a> Special thanks for already contributing a beautiful logo to <a title="Tenniswood Blog" href="http://www.tenniswood.co.uk/">James Tenniswood</a>.</p>
<p>To prevent over-engineering the tool and never coming up with a version I can use myself, let alone releasing, I decided to put some old skool agile methodology on the project and prioritise the features by how essential they are for each release. This roadmap is then published on CodePlex. Development of features in 0.2 is complete and <a title="EC2 RDP - Cloud Terminal - Install" href="http://cloudterminal.codeplex.com/releases/clickonce">a working copy can be installed via click-once</a>.</p>
<pre>0.1
- Retreive and display list of connections from EC2
- Connect and disconnect via RDP to any instance in list

0.2
- Show instance CPU history
- Store account keys in local configuration
- Optimise UX

0.3
- Allow multiple AWS accounts
- SSH connectivity, including private key storage
- Overlay instance details / commands on list select
- Add grid of instances, shown when no connections are active

0.4
- Allow Azure accounts with more appropriate list view of instances/services

0.5
- Test TCP connectivity before connecting. Offer option to open relevant remote cloud firewall port to client IP address.
- Allow instance / image / service specific credential saving for connections.</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wishfulcode.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wishfulcode.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=104&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wishfulcode.com/2011/05/19/cloud-terminal-remote-desktop-rdp-ec2-instances/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8424f579fc2b19677712c0b76e7a477?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">wishfulcode</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/05/cloudconnect.png" medium="image">
			<media:title type="html">CloudConnect</media:title>
		</media:content>
	</item>
		<item>
		<title>EC2: Using BGINFO to display Instance Details (Instance-Id, AMI Id, Availability Zone)</title>
		<link>http://wishfulcode.com/2011/05/01/ec2-using-bginfo-to-display-instance-details-instance-id-ami-id-availability-zone/</link>
		<comments>http://wishfulcode.com/2011/05/01/ec2-using-bginfo-to-display-instance-details-instance-id-ami-id-availability-zone/#comments</comments>
		<pubDate>Sun, 01 May 2011 20:08:00 +0000</pubDate>
		<dc:creator>petemill</dc:creator>
				<category><![CDATA[amazon web services]]></category>
		<category><![CDATA[powershell]]></category>

		<guid isPermaLink="false">http://wishfulcode.com/?p=91</guid>
		<description><![CDATA[Yes, the BgInfo tool is a little dated, but it can be useful in situations where multiple servers are being used all with very similar configurations (as should be the case for servers running from an Amazon EC2 image). Any AWS EC2 instance is available to query information about itself using simple GET requests to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=91&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Yes, <a title="BGINFO from SysInternals at Microsoft" href="http://technet.microsoft.com/en-gb/sysinternals/bb897557">the BgInfo tool</a> is a little dated, but it can be useful in situations where multiple servers are being used all with very similar configurations (as should be the case for servers running from an Amazon EC2 image).</p>
<p>Any AWS EC2 instance is available to query information about itself using simple GET requests to the <a href="http://docs.amazonwebservices.com/AWSEC2/2008-08-08/DeveloperGuide/index.html?AESDG-chapter-instancedata.html">REST metadata service</a> at <a href="http://169.254.169.254/" rel="nofollow">http://169.254.169.254/</a></p>
<h2>Add Instance Metadata to Environment Variables with Powershell</h2>
<p><img class="size-medium wp-image-93 alignright" title="Add a task in Task Scheduler to run the powershell script" src="http://wishfulcode.files.wordpress.com/2011/05/setup-task-ec2-env-vars.png?w=300&#038;h=104" alt="" width="300" height="104" /></p>
<p>We can write a simple powershell script which fetches various pieces of this metadata and writes it to the Windows Environment Variables (at the machine level). We can then have Task Scheduler run this script at Machine Startup so that each new instance of our image will write its unique data.</p>
<p><pre class="brush: powershell; auto-links: false;">
$wc = new-object System.Net.WebClient;
$instanceIdResult = $wc.DownloadString(&quot;http://169.254.169.254/latest/meta-data/instance-id&quot;)
$instanceAZResult = $wc.DownloadString(&quot;http://169.254.169.254/latest/meta-data/placement/availability-zone&quot;)
$instanceAMIResult = $wc.DownloadString(&quot;http://169.254.169.254/latest/meta-data/ami-id&quot;)

[Environment]::SetEnvironmentVariable(&quot;EC2-InstanceId&quot;, &quot;$instanceIdResult&quot;, &quot;Machine&quot;)
[Environment]::SetEnvironmentVariable(&quot;EC2-InstanceAZ&quot;, &quot;$instanceAZResult&quot;, &quot;Machine&quot;)
[Environment]::SetEnvironmentVariable(&quot;EC2-InstanceAMI&quot;, &quot;$instanceAMIResult&quot;, &quot;Machine&quot;)
</pre></p>
<p>Now that we have our data, we can configure BgInfo to use it, adding a few custom fields.</p>
<p><a href="http://wishfulcode.files.wordpress.com/2011/05/bginfo-user-defined-fields.png"><img class="size-full wp-image-94 aligncenter" title="BGINFO user defined fields" src="http://wishfulcode.files.wordpress.com/2011/05/bginfo-user-defined-fields.png?w=640" alt=""   /></a></p>
<h2>Configuring a Machine Image to use BgInfo</h2>
<p>In order to successfully configure BgInfo for an Amazon Windows AMI so that each RDP user receives the custom background image, I performed the following steps:</p>
<ol>
<li>Save BgInfo.exe to a permanent folder accessible to all users on C</li>
<li>Run BgInfo.exe and configure data layout as desired</li>
<li>Under Bitmap &gt; Location&#8230; select &#8220;User&#8217;s temporary files directory&#8221;</li>
<li>Apply</li>
<li>File &gt; Save As&#8230; and save the configuration to a file in the same location as bginfo.exe (eg: bginfo.bgi)</li>
<li>Add the following Registry value:<br />
<pre class="brush: plain;">reg add HKU\.DEFAULT\Software\Sysinternals\BGInfo /v EulaAccepted /t REG_DWORD /d 1 /f</pre></li>
<li>Create a batch file in the same location with runs bginfo.exe against the saved configuration, with no GUI:<pre class="brush: plain;">
bginfo.exe bginfo.bgi /timer:0 /NOLICPROMPT
</pre></li>
<li>Create a task in Task Scheduler with the following properties:</li>
<ul>
<li>Run only when user is logged on</li>
<li>Trigger: At log on (and repeat as desired)</li>
<li>Action: Execute the batch file, starting in the relevant directory</li>
</ul>
</ol>
<div>And that&#8217;s it &#8211; every time you log-in, under any account, you should see the BgInfo background with the custom EC2 variables.</div>
<div><img class="size-full wp-image-98 aligncenter" title="BGINFO EC2 Instance Data" src="http://wishfulcode.files.wordpress.com/2011/05/bginfo-ec2-instance-info.png?w=640&#038;h=433" alt="" width="640" height="433" /></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wishfulcode.wordpress.com/91/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wishfulcode.wordpress.com/91/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=91&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wishfulcode.com/2011/05/01/ec2-using-bginfo-to-display-instance-details-instance-id-ami-id-availability-zone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8424f579fc2b19677712c0b76e7a477?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">wishfulcode</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/05/setup-task-ec2-env-vars.png?w=300" medium="image">
			<media:title type="html">Add a task in Task Scheduler to run the powershell script</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/05/bginfo-user-defined-fields.png" medium="image">
			<media:title type="html">BGINFO user defined fields</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/05/bginfo-ec2-instance-info.png" medium="image">
			<media:title type="html">BGINFO EC2 Instance Data</media:title>
		</media:content>
	</item>
		<item>
		<title>Facebook Page Custom Tabs</title>
		<link>http://wishfulcode.com/2011/03/02/facebook-page-custom-tabs/</link>
		<comments>http://wishfulcode.com/2011/03/02/facebook-page-custom-tabs/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 01:12:09 +0000</pubDate>
		<dc:creator>petemill</dc:creator>
				<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://wishfulcode.com/?p=82</guid>
		<description><![CDATA[There are a lot of Facebook apps around, most of them existing either as a Facebook Application in order to use the Facebook API from outside Facebook or as an application housed within Facebook itself. The framework Facebook have set up is focused very much on these scenarios, and it provides for them well with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=82&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>There are a lot of Facebook apps around, most of them existing either as a Facebook Application in order to use the Facebook API from outside Facebook or as an application housed within Facebook itself. The framework Facebook have set up is focused very much on these scenarios, and it provides for them well with its canvas. If you&#8217;re a heavy user of a particular app, you can even have an App expose a custom tab on your profile (or your page&#8217;s profile) to provide some data about you in the context of the app.</p>
<p>However, a lot of page owners want to have custom tabs for the sake of custom content, not to be integrated within an app. Facebook recently announced <a title="Introducing iframe Tabs for Pages" href="http://developers.facebook.com/blog/post/462" target="_blank">iframe tabs for Pages</a> and with it, the deprecation of previous alternatives such as using static FBML for custom tabs on a Page.</p>
<p>Using iFrames has several advantages over having to use FBML since the tab is now capable of any front-end code, like being able to include any javascript effects (eg: jquery animations), embedded content or integration with other front-end services (eg: google maps or google analytics).</p>
<p>However, there are some limitations at the moment that make the whole process, or the possibilities around it rather limited. The main limitation is that a tab must be added through an app, and each app can only expose one possible tab at one Url.</p>
<p>In other words, for each custom tab, you must create and maintain a new application. Again, I can see the logic to this when thinking in an app world, but when thinking from a content context it becomes frustrating. For example, if I want to expose a CMS with a customisable amount of templates for custom facebook tabs, the best I can hope for, if templates which detect the Facebook Page ID are built and change the content accordingly configured, is to create an App per template.</p>
<p>In figuring out a development and deployment process for custom tabs on Facebook Pages, I developed a tab for Glamour.com&#8217;s 10th Anniversary which displays the first issue in it&#8217;s entirety, and only for users who participate within the <a title="Glamour.com UK Facebook Page" href="http://www.facebook.com/glamourmaguk?sk=app_175437545836001" target="_blank">Glamour.com UK facebook page</a>. The page layout was designed by <a href="http://tenniswood.co.uk" target="_blank">James Tenniswood</a> who also put the entire magazine together inside the magazine viewer, powered by Issuu.</p>
<p><a href="http://www.facebook.com/glamourmaguk?sk=app_175437545836001"><img class="aligncenter size-full wp-image-85" title="facebook-custom-tab-glamour" src="http://wishfulcode.files.wordpress.com/2011/03/facebook-custom-tab-glamour.jpg?w=640&#038;h=373" alt="Facebook page custom tab for Glamour's 10th Anniversary" width="640" height="373" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wishfulcode.wordpress.com/82/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wishfulcode.wordpress.com/82/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=82&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wishfulcode.com/2011/03/02/facebook-page-custom-tabs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8424f579fc2b19677712c0b76e7a477?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">wishfulcode</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/03/facebook-custom-tab-glamour.jpg" medium="image">
			<media:title type="html">facebook-custom-tab-glamour</media:title>
		</media:content>
	</item>
		<item>
		<title>AWSMonitor &#8211; explore CloudWatch analytics from Amazon Web Services (open source)</title>
		<link>http://wishfulcode.com/2011/02/23/awsmonitor-explore-cloudwatch-analytics-from-amazon-web-services-open-source/</link>
		<comments>http://wishfulcode.com/2011/02/23/awsmonitor-explore-cloudwatch-analytics-from-amazon-web-services-open-source/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 19:33:52 +0000</pubDate>
		<dc:creator>petemill</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[amazon web services]]></category>
		<category><![CDATA[cloud]]></category>

		<guid isPermaLink="false">http://wishfulcode.com/?p=72</guid>
		<description><![CDATA[Awhile ago I wrote about developing a page to bring in some rudiementary cloud-watch data to measure and compare realtime trafffic of an ELB (Elastic Load Balancer) enabled website and the performance of the providing servers. Part of my role at Condé Nast Digital is to become fixated on be aware of the performance of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=72&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Awhile ago I wrote about <a title="Realtime website traffic and application server monitoring with Amazon EC2 and Google Charts (via ASP.net)" href="http://wishfulcode.com/2010/03/04/realtime-website-traffic-and-application-server-monitoring-with-amazon-ec2-and-google-charts-via-asp-net/">developing a page to bring in some rudiementary cloud-watch data</a> to measure and compare realtime trafffic of an ELB (Elastic Load Balancer) enabled website and the performance of the providing servers.</p>
<p>Part of my role at<a title="Condé Nast Digital" href="http://www.condenast.co.uk"> Condé Nast Digital</a> is to <del>become fixated on</del> be aware of the performance of our public-facing web sites, and be able to pre-empt or respond quickly to any traffic spikes or performance issues. To that end, I spend some time thinking of new ways to visualize and explore this data for both myself and my team.</p>
<p>In wishful style, I&#8217;ve open-sourced a web app containing these visualizations, in the hope that others contribute in the form of ideas or code, or at least get some use out of it so I can more easily justify the late nights.</p>
<p>The <a title="AWSMonitor - A web app utilizing the Amazon Web Services API with a focus on browsing through and analyzing data graphically" href="http://awsmonitor.codeplex.com">AWSMonitor project on CodePlex explains each visualization</a> and offers a roadmap, a forum to discuss new visualizations, and the code to download and run. The app is written in ASP.Net MVC3 and uses Razor views. The views use the javascript Google Visualization API to render graphs and gauges (favouring svg versions).</p>
<p>There are two main ways I use the visualizations in this app daily:</p>
<p><strong>Infoporn &#8211; office displays<br />
</strong>In true <a title="Wired UK" href="http://www.wired.co.uk">wired.co.uk</a> style, I love to have screens of realtime data on show so that everyone can easily see what&#8217;s going on, both in terms of editorial content, new features, traffic and server performance.</p>
<p style="text-align:left;">The /elb/random view really shines here as it displays a new site from our list of load-balancers on AWS after each interval.<br />
<img class="size-full wp-image-76 aligncenter" title="ELB Monitor" src="http://wishfulcode.files.wordpress.com/2011/02/elb-random.png?w=640" alt=""   /></p>
<p>In this visualization we can see:</p>
<ul>
<li>A graph comparing the traffic today (blue), yesterday (red), today -7 days (yellow) and today &#8211; 14 days (green)</li>
<li>A gauge showing the average CPU utilization for each server</li>
<li> A frame containing the site&#8217;s output</li>
</ul>
<p><strong>Problem Investigation<br />
</strong>AWS ELB manages server health and will take servers out if the health check target responds with an error. When this happens, I like to see exactly what&#8217;s happening on each server. The /elb/{load-balancer-name}/preview shows what the site looks like for each server</p>
<p style="text-align:left;"><img class="size-full wp-image-77 aligncenter" title="ELB Preview" src="http://wishfulcode.files.wordpress.com/2011/02/elb-preview-glamour.png?w=640" alt=""   />This visualization also accepts a parameter that allows us to see a specific Url for each server.</p>
<p style="text-align:left;"><a title="AWS Monitor - A web app utilizing the Amazon Web Services API with a focus on browsing through and analyzing data graphically" href="http://awsmonitor.codeplex.com">View more information and download the app at CodePlex</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wishfulcode.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wishfulcode.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=72&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wishfulcode.com/2011/02/23/awsmonitor-explore-cloudwatch-analytics-from-amazon-web-services-open-source/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8424f579fc2b19677712c0b76e7a477?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">wishfulcode</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/02/elb-random.png" medium="image">
			<media:title type="html">ELB Monitor</media:title>
		</media:content>

		<media:content url="http://wishfulcode.files.wordpress.com/2011/02/elb-preview-glamour.png" medium="image">
			<media:title type="html">ELB Preview</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.Net Routing and virtual article-based extensionless website Urls</title>
		<link>http://wishfulcode.com/2010/09/19/asp-net-routing-and-virtual-article-based-extensionless-website-urls/</link>
		<comments>http://wishfulcode.com/2010/09/19/asp-net-routing-and-virtual-article-based-extensionless-website-urls/#comments</comments>
		<pubDate>Sun, 19 Sep 2010 21:42:00 +0000</pubDate>
		<dc:creator>petemill</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wishfulcode.wordpress.com/2010/09/19/asp-net-routing-and-virtual-article-based-extensionless-website-urls</guid>
		<description><![CDATA[There is an architectural difficulty in relating the new ASP.Net penchant for functionaly semantic Url patterns using ASP.Net Routing with sites whose Url patterns are editorially semantic. That is, the patterns match various sections of a site, which may all be functionally very similar and so should be routed to the same handling code for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=24&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>There is an architectural difficulty in relating the new ASP.Net penchant for <em>functionaly</em> semantic Url patterns using <a href="http://msdn.microsoft.com/en-us/library/cc668201.aspx">ASP.Net Routing</a> with sites whose Url patterns are <em>editorially</em> semantic. That is, the patterns match various sections of a site, which may all be functionally very similar and so should be routed to the same handling code for an appropriate view to be returned.</p>
<p>My team were faced with this dilemna earlier this year whilst developing the <a href="http://www.glamourmagazine.co.uk">http://www.glamourmagazine.co.uk</a> site. This is a site whose content is stored in <a href="http://umbraco.org/">Umbraco</a>, so has an editorial tree of &gt;50,000 articles, each with a differing template choice. For this site, we wrote our own data reading and rendering API on top of ASP.Net, bypassing the Umbraco API.</p>
<p>The difficulty with using older methods to route extensionless requests to ASP.Net (and then to custom IHttpHandlers) is that once the pipeline has handed off to an ASP.Net handler, it’s difficult to get back to another IIS handler. An example of this is requests which should result in IIS finding the default document for a directory. Once we are directing all extensionless requests to ASP.Net, if our ASP.Net handler can’t continue (because maybe an article or aspx page at the virtual path does not exist), then ASP.Net will simply throw an error and display the error page configured in the Custom Errors section in the web.config. This is why still today there are two places to configure error pages, one for the ASP.Net handler, and one for IIS.</p>
<h2>UrlRoutingModule,Catch-All Parameters, IRouteHandler and IRouteConstraint</h2>
<p>If we lean on ASP.Net Routing, in the same way ASP.Net MVC does for its (often extensionless) virtual controller Urls, we can get a non-invasive solution to this problem with minimal hassle.</p>
<p>Traditionally, under ASP.Net routing if you want to set up a route, you need to know roughly how many Url segments to expect, and what the pattern should be. The problem on a site like Glamour is that there will be a varying level of Url segments, as defined by a team of editors at runtime to match the editorial layout of the site. Furthermore, the url pattern of articles is mostly irrelevant to the code.</p>
<p>ASP.Net Routing comes configured when you start an MVC site in Visual Studio, but if you already have an ASP.Net site you can start using ASP.Net routing without affecting anything else by including the following module in the web.config:</p>
<p><pre class="brush: xml;">&lt;add name=&quot;UrlRoutingModule&quot; type=&quot;System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a&quot; /&gt;</pre></p>
<p>and adding the normal route registration in the global.asax (or your site’s application class):</p>
<p><pre class="brush: csharp;">protected override void Application_OnStart(object sender, EventArgs e)
    {
        base.Application_OnStart(sender, e);
         // Set up custom routing (e.g. MVC Controllers)
        RegisterRoutes(RouteTable.Routes);
    }
    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute(&quot;{resource}.axd/{*pathInfo}&quot;);
        routes.IgnoreRoute(&quot;{resource}.aspx/{*pathInfo}&quot;);
    }</pre></p>
<p>Adding a new route, with a <strong>catch-all parameter </strong>in its Url pattern (ie: all Urls will route to the rule), in conjunction with a RouteConstraint and placing this rule <strong>after</strong> all other rules (in case we actually want to use MVC or other routes) will accomplish routing all urls to our handler for articles. This class (<em>EditorialRouteHandler</em> below) inherits from <em>IRouteHandler</em>, and should implement the <em>GetHttpHandler</em> which must return an <em>IHttpHandler</em>. In our case we are simply returning a <em>System.Web.UI.Page</em>, setting its master page file to be that set in the Umbraco data-store, and it’s data to be the <em>Node</em> retreived from the CMS:<br />
<pre class="brush: csharp;">//create a route for pages in editorial tree 
    var editorialPageRouter = new Route(&quot;{*page}&quot;, //catch-all page parameter 
				new EditorialRouteHandler() //handler                                                            ); 

    //add it to RouteCollection 
    routes.Add(&quot;EditorialPageRouter&quot;, editorialPageRouter);</pre><br />
The final step is to add a Route Constraint to the rule. This allows the handler to tell the system that it has not found a match for the Url, and that processing can continue to another rule, or back to IIS. This is accomplished by implementing the interface <em>IRouteConstraint</em> and implementing the <em>Match</em> method which only needs to return a <em>boolean</em> specifying whether the specied url matches the purpose of the rule.<br />
<pre class="brush: csharp;">//add a constraint that the page must exist in the cms, or we don't route 
    editorialPageRouter.Constraints = new RouteValueDictionary(); 
    editorialPageRouter.Constraints.Add(&quot;EditorialPageFoundConstraint&quot;, new EditorialRouteHandler());</pre><br />
The following is a sample class which implements IRouteHandler and IRouteConstraint and returns a System.Web.UI.Page if a match is found. If you want to follow this pattern, you’ll need to implement the mechanism for retreiving the data and the master-page appropriate for the Url specified:<br />
<pre class="brush: csharp;">public class EditorialRouteHandler : IRouteHandler, IRouteConstraint 
    { 

        public System.Web.IHttpHandler GetHttpHandler(RequestContext requestContext) 
        { 

            //we should not be here if we have not found a result, and set it 
            if (EditorialPageContext.Current.CurrentNode == null) 
                throw new Exception(&quot;Editorial Node Not Set. Ensure the correct EditorialRouteHandler Route Constraint has been set.&quot;);                    
            //create a new page object, and change the masterpage 
            Page pageResult = new Page 
            { 
                AppRelativeVirtualPath = &quot;~/fake.ashx&quot;, //this must be set to something irrelevant to fix a bug in ASP.Net 
                MasterPageFile = &quot;my-master-page.master&quot; //set this to a value retreived from your CMS 
            };        
            //return page with new masterpage 
            return pageResult; 
        }

        protected virtual string GetTemplatePath(INode node) 
        { 
            //todo: search data-store for master page path for current data 
        }

        protected virtual string GetNodeByUrl(string virtualPath) 
        { 
            //todo: search data-store for data with given url 
        }

        public bool Match(System.Web.HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) 
        { 
            if (!values.ContainsKey(&quot;page&quot;)) 
                return false;

            // get virtual path (null means there was no value for page, meaning it is the domain without a path) 
            string virtualPath = (values[&quot;page&quot;] ?? &quot;/&quot;).ToString();

            // case insensitive 
            virtualPath = virtualPath.ToLowerInvariant();
    
            var currentNode = GetNodeByUrl(virtualPath);

            //if we get a result, build a page up and set the current node 
            if (currentNode != null) 
            { 
                //set current node on the context, could be HttpContext 
                EditorialPageContext.Current.CurrentNode = currentNode; 

                //inform routing that we have found a result 
                return true; 
            }

            //inform routing we have not found a result 
            return false; 
        }

   }</pre></p>
<h2>Final Tip</h2>
<p>If you turn off <em>RunAllManagedModulesForAllRequests</em> in IIS’ web.config, you will make sure that the route only gets called for extensionless urls, and not Urls which should be handled by something else in IIS (even if the file does not exist). <strong>However, in most cases, you must <a href="http://support.microsoft.com/kb/980368">install hotfix 980368 from Microsoft to allow handlers to be called for Urls without extensions</a>.</strong></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wishfulcode.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wishfulcode.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=24&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wishfulcode.com/2010/09/19/asp-net-routing-and-virtual-article-based-extensionless-website-urls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8424f579fc2b19677712c0b76e7a477?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">wishfulcode</media:title>
		</media:content>
	</item>
		<item>
		<title>Managing code and configuration synchronisation in an IIS web farm</title>
		<link>http://wishfulcode.com/2010/06/22/managing-code-and-configuration-synchronisation-in-an-iis-web-farm/</link>
		<comments>http://wishfulcode.com/2010/06/22/managing-code-and-configuration-synchronisation-in-an-iis-web-farm/#comments</comments>
		<pubDate>Tue, 22 Jun 2010 21:34:00 +0000</pubDate>
		<dc:creator>petemill</dc:creator>
				<category><![CDATA[amazon web services]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[iis]]></category>

		<guid isPermaLink="false">http://wishfulcode.wordpress.com/2010/06/22/managing-code-and-configuration-synchronisation-in-an-iis-web-farm</guid>
		<description><![CDATA[When we think about version control, the most common purpose we associate with it is source code. When we think about maintaining a farm of web servers, the initial problems to focus on solving are: Synchronisation – different nodes in the farm should not (unless explicitly told to) have different configuration or serve different content. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=22&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><span>
<p>When we think about version control, the most common purpose we associate with it is source code.</p>
<p>When we think about maintaining a farm of web servers, the initial problems to focus on solving are:</p>
<ol>
<li>Synchronisation – different nodes in the farm should not (unless explicitly told to) have different configuration or serve different content.</li>
<li>Horizontal Scalability – I want to be able to add as many servers as required, without needing to spend time setting them up or without new builds taking more time to deploy.</li>
<li>Reliability – no single point of failure (although this has varying levels – inability to run a new deployment is less severe than inability to serve content to users). </li>
</ol>
<p>The scenario begs for a solution involving some kind of repository both of content (ie: runtime code) and configuration (ie: IIS setup), and most sensibly one that asks the member servers in the farm to pull content and configuration from an authoritative source, rather than having to maintain a list of servers to sequentially push to.</p>
<h2>Synchronising Content<br /></h2>
<p>This sounds very similar to the feature set of many Distributed Version Control Systems. Thanks to <a href='http://thecodedecanter.wordpress.com/'>James Freiwirth</a>&#8216;s investigation and code (and persistence!), <a href='http://thecodedecanter.wordpress.com/2010/03/25/one-click-website-deployment-using-teamcity-nant-git-and-powershell/'>we started with a set of commands in a script that would instruct a folder to fetch the latest revision of a set of files under Git version control and update to that revision</a>. So now we could have multiple servers pulling from a central Git repository on another server and maintaining the same version between themselves. What&#8217;s more, by using Git the following features are gained:</p>
<ul>
<li>It&#8217;s index-based – Git will fetch a revision and store it in its index <strong>before applying </strong>that revision to the working dir. That means, even on a slow connection, applying changes is very quick – no more half-changed working directory whilst waiting for large files to transfer. FTP, I&#8217;m talking to you!</li>
<li>It&#8217;s optimised – Git will only fetch change deltas, and it&#8217;s also very good at detecting repeated content in multiple files.</li>
<li>It&#8217;s distributed – All the history of your runtime code folder will be maintained on each server. If you lose the remote source of the repositories, not only will you not lose the data because the entire history is maintained on each node, you will still be able to push, pull, commit and roll-back between the remaining repositories.</li>
</ul>
<p>So you could commit from anywhere to your deployment Git repository, and have all servers in your web farm pick up these changes. And then you instantly gain revision control for all deployments. If you are manually copying files to your deployment environment and, now, to the origin of your repository (some environments can&#8217;t help this &#8211; shock!) you never have to worry about overwriting files you&#8217;ll later regret, and you&#8217;re able to see exactly what&#8217;s changed and when in your server environment. Or, if you have a build server producing your website&#8217;s runtime code like us, then you can script the build output to be committed to your git (using NANT for example). James is a member of my development team, and he really changed the way we think about DVCS by introducing us to Git quite early on.</p>
<p style='text-align:center;'><img alt='' src='http://4.bp.blogspot.com/_gYxqdqw9RN8/TCEgmoRKdMI/AAAAAAAAByA/-wsQrkcMKtg/s320/gitdeploy-buildoutput.JPG' />			</p>
<h2>Synchronising IIS<br /></h2>
<p>Maintaining web server configuration across all servers is just as important as being able to synchronise content. In the past, options were limited. With IIS7 we gain the ability to store a very semantic and realtime representation of IIS configuration on any file path with the Shared Configuration feature. If we can somehow still store this information locally, but have it synchronised across all the servers then we are satisfying all 3 requirements for synchronisation, scalability and reliability.</p>
<p>To accomplish this, we can use the exact same method for synchronising IIS configuration that we use for content. We can set up a git repository, put in the IIS configuration, pull this down to each server and instruct each server&#8217;s IIS to point to the working copy of the revision control repository. Then, we now have history, comments and rollback ability for IIS configuration. Being able to see each IIS configuration change difference is alone an incredibly invaluable feature for our multi-site environment.</p>
<p style='text-align:center;'><img alt='' src='http://wishfulcode.files.wordpress.com/2010/06/gitdeploy-iis.jpg?w=300' /> </p>
<h2>Practical setup (on Amazon EC2)<br /></h2>
<p>The final task to accomplish is to identify what process runs on all the servers to keep them always pulling the latest version of both the content and the configuration. The best we&#8217;ve used so far is simple Windows 2008 Task Scheduler powershell scripts, which James gives examples of. <strong>However, these scripts themselves </strong>can change over time since they need to know which repositories to synchronise. This calls for yet another revision controlled repository. The scheduled tasks on the servers themselves are only running stub files which define a key, to identify which farm, and therefore which sites a server needs, and then runs another powershell script retrieved from a central git repository which ensures the correct content repositories for that farm are created and up to date.</p>
<p>The end result is a completely autonomous (for their runtime) set of web servers, which call to central repositories in order to seek updated content and configuration. </p>
<p>If we then create a virtualised image with a Scheduled Task running the stub powershell script, we have the ability at any time to increase the capacity of a server farm simply by starting new servers and pointing the traffic at them. These new servers will each pull in the latest configuration and content.</p>
<h2>Why not use the MS Web Deploy Tool?<br /></h2>
<p>Microsoft&#8217;s Road Map for IIS and ASP.Net <a href='http://blogs.iis.net/msdeploy/archive/2008/01/22/welcome-to-the-web-deployment-team-blog.aspx'>includes interesting projects concerning deployment and server farm management</a>. The Web Deploy tools is impressive in that in can synchronise IIS configuration and content (and some other server setup) even between IIS versions. However, it is very <em>package</em> based. We&#8217;d still need a system to either pull the latest version package down to each local server and perform a deployment of the package, or remotely push to every server we know about. This essentially starts us back at the same step I defined at the beginning of this post – needing a way to maintain a farm of servers and building something to manage the execution of those packages. There are scenarios where I do use this tool, and I&#8217;m sure that this and other tools will evolve to the point where we can get as much control and flexibility as we can achieve with &#8216;git-deploy&#8217; quite soon.</p>
<p></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wishfulcode.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wishfulcode.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=22&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wishfulcode.com/2010/06/22/managing-code-and-configuration-synchronisation-in-an-iis-web-farm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8424f579fc2b19677712c0b76e7a477?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">wishfulcode</media:title>
		</media:content>

		<media:content url="http://4.bp.blogspot.com/_gYxqdqw9RN8/TCEgmoRKdMI/AAAAAAAAByA/-wsQrkcMKtg/s320/gitdeploy-buildoutput.JPG" medium="image" />

		<media:content url="http://wishfulcode.files.wordpress.com/2010/06/gitdeploy-iis.jpg?w=300" medium="image" />
	</item>
		<item>
		<title>Project SUMO / Silverlight for Umbraco Media Objects</title>
		<link>http://wishfulcode.com/2010/04/30/project-sumo-silverlight-for-umbraco-media-objects/</link>
		<comments>http://wishfulcode.com/2010/04/30/project-sumo-silverlight-for-umbraco-media-objects/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 06:30:00 +0000</pubDate>
		<dc:creator>petemill</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wishfulcode.wordpress.com/2010/04/30/project-sumo-silverlight-for-umbraco-media-objects</guid>
		<description><![CDATA[Not long ago, I was invited to join a small group tasked, with Microsoft&#8217;s help, at creating an open source project to provide some tools for the Umbraco community to use which would enhance both users&#8217; and developers&#8217; experiences with Umbraco. It was decided that a tool would be built which offers features not implemented [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=18&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Not long ago, I was invited to join a small group tasked, with Microsoft&#8217;s help, at creating an open source project to provide some tools for the Umbraco community to use which would enhance both users&#8217; and developers&#8217; experiences with Umbraco.</p>
<p>It was decided that a tool would be built which offers features not implemented in the default asp.net umbraco implementation of its Media section. The idea to enhance the tool with features such as media object editing, bulk saving and uploading, and cross-platform (including mobile) support led us to choosing Silverlight as the application platform to develop with.</p>
<p>Collaboratively, it was an interesting exercise in the use of tools, role-assumption, personal initiative&#8230; and maybe some all-nighters.</p>
<p>The project ended up taking on a good project-architecture:<br />1. Proof of concept. This took the form of an initial Silverlight application with a tree and a list of media items. We wanted to see if what we wanted to achieve on the client-side was quick to develop using Silverlight.<br />2. SketchFlow. Warren Buckley rapidly prototyped the different controls that would be available in the client app, which allowed the team to discuss issues before they became a reality.<br />3. Main Architecture &amp; Development.&nbsp; This is the side I enjoyed the most. We can up with a client-server architecture which exposed media objects as their byte[] data through a WCF service, and an MVVM pattern for interacting with this data inside the silverlight client and binding it to a UI.<br />4. Advanced Functionality and Skinning. With a solid foundation we are now in a great position to extend the project in order to rapidly gain new features, to build very similar clients for different silverlight platforms (like Windows Phone), and to keep improving the user experience.</p>
<p>The WCF side of things are architected in a way that the client is aware of the data-contract (<a href="http://ustf.codeplex.com/sourcecontrol/network/Show?projectName=ustf&amp;changeSetId=47575#963793">IUSTFMediaService</a>), and the project contains a default implementation which looks at Umbraco&#8217;s default media objects (<a href="http://ustf.codeplex.com/sourcecontrol/network/Show?projectName=ustf&amp;changeSetId=47575#963769">UmbracoDefaultImageMediaService</a>). Therefore, more advanced Umbraco developers can freely make their own implementation of IUSTFMediaService to deal with any custom media document types or architectures <b>without changing anything in the Silverlight application</b>.</p>
<p>&nbsp;The project will be available as an easy-to-install package for Umbraco, with <a href="http://ustf.codeplex.com/">releases and source code available at the SUMO codeplex site</a>.</p>
<p>I&#8217;ve had the pleasure of working with some great people from the community since the beginning of this project including <a href="http://www.darren-ferguson.com/">Darren Ferguson</a>, <a href="http://www.creativewebspecialist.co.uk/">Warren Buckley</a>, <a href="http://www.boxbinary.com/">Alex Norcliffe</a>, <a href="http://twitter.com/ashallcross01">Adam Shallcross</a> and <a href="http://twitter.com/will_coleman">Will Coleman from Microsoft</a>.</p>
<p>More to come on the user scenarios the app will enable, and some great code practices we found along the way.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wishfulcode.wordpress.com/18/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wishfulcode.wordpress.com/18/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wishfulcode.com&#038;blog=16093792&#038;post=18&#038;subd=wishfulcode&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wishfulcode.com/2010/04/30/project-sumo-silverlight-for-umbraco-media-objects/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d8424f579fc2b19677712c0b76e7a477?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">wishfulcode</media:title>
		</media:content>
	</item>
	</channel>
</rss>
