<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>These Days Labs</title>
	
	<link>http://labs.thesedays.com</link>
	<description>To infinity and beyond</description>
	<lastBuildDate>Mon, 12 Mar 2012 14:43:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TheseDaysLabs" /><feedburner:info uri="thesedayslabs" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>It’s agency life Jim, but not as you know it.</title>
		<link>http://feedproxy.google.com/~r/TheseDaysLabs/~3/J_PlheW_IkU/</link>
		<comments>http://labs.thesedays.com/blog/2012/03/12/its-agency-life-jim-but-not-as-you-know-it/#comments</comments>
		<pubDate>Mon, 12 Mar 2012 14:43:04 +0000</pubDate>
		<dc:creator>Sam Serrien</dc:creator>
				<category><![CDATA[Jobs]]></category>
		<category><![CDATA[These Days]]></category>
		<category><![CDATA[thesdays]]></category>

		<guid isPermaLink="false">http://labs.thesedays.com/?p=1816</guid>
		<description><![CDATA[Check our new microsite http://playground.thesedays.com to experience agency life at These Days. Of course we don&#8217;t do this without a reason &#8230; We need loads of new geeks so if you want to come work in this environment, check out the job pages! (You can find the jobs inbetween the life tiles on playground or [...]]]></description>
			<content:encoded><![CDATA[<p>Check our new microsite <a href="http://playground.thesedays.com">http://playground.thesedays.com</a> to experience agency life at These Days. Of course we don&#8217;t do this without a reason &#8230; We need loads of new geeks so if you want to come work in this environment, check out the <a href="http://labs.thesedays.com/jobs/">job</a> pages! (You can find the jobs inbetween the life tiles on <a href="http://playground.thesedays.com">playground</a> or directly via <a href="http://labs.thesedays.com/jobs/">http://labs.thesedays.com/jobs/</a>)</p>
<p><strong>The job descriptions are boring as hell though ;-)</strong></p>
<p><img src="http://labs.thesedays.com/wp-content/uploads/2012/03/pokerface1.png" alt="" width="300" height="266" class="alignnone size-full wp-image-1823" /></p>
<img src="http://feeds.feedburner.com/~r/TheseDaysLabs/~4/J_PlheW_IkU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://labs.thesedays.com/blog/2012/03/12/its-agency-life-jim-but-not-as-you-know-it/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://labs.thesedays.com/blog/2012/03/12/its-agency-life-jim-but-not-as-you-know-it/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=its-agency-life-jim-but-not-as-you-know-it</feedburner:origLink></item>
		<item>
		<title>SUD – A bookmark plugin for responsive sites</title>
		<link>http://feedproxy.google.com/~r/TheseDaysLabs/~3/yOPpH5UgYnw/</link>
		<comments>http://labs.thesedays.com/blog/2012/01/31/sud-a-bookmark-plugin-for-responsive-sites/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 13:36:55 +0000</pubDate>
		<dc:creator>Bram Verdyck</dc:creator>
				<category><![CDATA[Mobile development]]></category>
		<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://labs.thesedays.com/?p=1726</guid>
		<description><![CDATA[Responsive websites are getting more and more mainstream these days. They can be a pain in the ass for bugfixing, especially when clients are mailing bugs/changes without nothing more then a screenshot and some comments. It&#8217;s us, the developers, who have to figure out where and on which layout/browser/os these bugs manifest themselves. This can [...]]]></description>
			<content:encoded><![CDATA[<p>Responsive websites are getting more and more mainstream these days. They can be a pain in the ass for bugfixing, especially when clients are mailing bugs/changes without nothing more then a screenshot and some comments.</p>
<p>It&#8217;s us, the developers, who have to figure out where and on which layout/browser/os these bugs manifest themselves. This can be a very frustrating &amp; time-consuming task, so that&#8217;s why we made ourselves a little helper.</p>
<p>Meet: <strong>SUD</strong>. It&#8217;s a smart little bookmark widget. Some javascript code that creates a small overlayer head-up display (HUD) with a bunch of info.</p>
<p>It gives you:<br />
- A number representing the current &#8220;layout&#8221; in your responsive site (we like to number our different layouts)<br />
- The current active media query<br />
- All necessary browser info<br />
- All OS info needed</p>
<p>Here is a little screenshot:</p>
<p><a href="http://labs.thesedays.com/wp-content/uploads/2012/01/sud_boston_globe.png"><img class="alignnone size-medium wp-image-1751" src="http://labs.thesedays.com/wp-content/uploads/2012/01/sud_boston_globe-300x57.png" alt="" width="300" height="57" /></a></p>
<p>SUD is still in BETA, it&#8217;s a work in progress. You can find it on <a title="SUD on github" href="https://www.github.com/thesedays/sud/" target="_blank">github</a> if you want to see how it works.<br />
Or simply start using it now by dragging <a href="javascript:(function(){s=document.createElement('script');s.type='text/javascript';s.src='https://thesedays.blob.core.windows.net/labs-thesedays-com/sud/td.plugin.sud.min.js?v='+parseInt(Math.random()*99999999);document.body.appendChild(s);})();">this link</a> to your bookmarks bar or by creating a new bookmark with this in the link field:</p>
<pre class="brush: jscript; title: ; notranslate">javascript:(function(){s=document.createElement('script');s.type='text/javascript';s.src='https://thesedays.blob.core.windows.net/labs-thesedays-com/sud/td.plugin.sud.min.js?v='+parseInt(Math.random()*99999999);document.body.appendChild(s);})();</pre>
<p>If you want the widget to run at page load, just include this script tag:</p>
<pre class="brush: jscript; title: ; notranslate">&lt;script type=&quot;text/javascript&quot; src=&quot;https://thesedays.blob.core.windows.net/labs-thesedays-com/sud/td.plugin.sud.min.js&quot;&gt;&lt;/script&gt;</pre>
<p>Feel free to check it out and give it a go. And make sure to let us know what you think of it!</p>
<img src="http://feeds.feedburner.com/~r/TheseDaysLabs/~4/yOPpH5UgYnw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://labs.thesedays.com/blog/2012/01/31/sud-a-bookmark-plugin-for-responsive-sites/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://labs.thesedays.com/blog/2012/01/31/sud-a-bookmark-plugin-for-responsive-sites/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=sud-a-bookmark-plugin-for-responsive-sites</feedburner:origLink></item>
		<item>
		<title>Creating a progress bar in ASP.NET using SignalR</title>
		<link>http://feedproxy.google.com/~r/TheseDaysLabs/~3/2scs8DvtKFY/</link>
		<comments>http://labs.thesedays.com/blog/2011/12/05/creating-a-progress-bar-in-asp-net-using-signalr/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 13:26:37 +0000</pubDate>
		<dc:creator>Lennart Stoop</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[aspnet]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[longpolling]]></category>
		<category><![CDATA[progress bar]]></category>
		<category><![CDATA[signalr]]></category>
		<category><![CDATA[websockets]]></category>

		<guid isPermaLink="false">http://labs.thesedays.com/?p=1683</guid>
		<description><![CDATA[Introducing SignalR Whenever you need to create an interactive widget on a website you often end up writing a lot of code in having the widget updated through asynchronous calls between client and server. Moreover in most cases the widget will pull for updates while it would be much more efficient in having the server [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introducing SignalR</strong></p>
<p>Whenever you need to create an interactive widget on a website you often end up writing a lot of code in having the widget updated through asynchronous calls between client and server. Moreover in most cases the widget will pull for updates while it would be much more efficient in having the server push updates to its clients. This is where <a href="https://github.com/SignalR/SignalR" target="_blank">SignalR</a> comes in: a signaling library for ASP.NET which does all the heavy lifting for you, making it dead easy to push data from server to client(s).</p>
<p>The best way to <a href="https://github.com/SignalR/SignalR/wiki/Getting-Started" target="_blank">get started with SignalR</a> is by looking at Hubs which are a higher level implementation of a persisted connection. Check out the<a href="https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs" target="_blank"> quick start example</a> and see how easy it is. Note that in order to <a href="https://github.com/SignalR/SignalR/wiki/Faq" target="_blank">support certain browsers</a> you will need to include json2.js in your application.</p>
<p><strong>Why create a progress bar using SignalR?</strong></p>
<p>In our production department we have several (web based) collaboration tools amongst which a deployment tool for .NET based websites. The tool allows front-end developers to work against a shared development environment (not having to run websites on their local machines) and deploy websites to a staging environment which is accessible to our clients for previewing and acceptance testing.</p>
<p>Since deploying larger websites can take up to several minutes we needed to provide the user with feedback, preferably by means of a progress bar. We also needed to make sure that during website deployment the deployment could not be reinitiated and finally we thought it would be really cool if we could prompt the progress bar to other (concurrent) users as well.</p>
<p>And although this could also be accomplished with Ajax/JSON, it is just so much easier using SignalR!</p>
<p>Let’s see this in action: the screenshots below represent 3 different browser windows showing 2 simultaneous deployments. When a user visits the deployment page of a website a progress bar is prompted if the website is currently being deployed. The overview page which lists all the websites is updated as well (a rotating progress loader is shown instead of the deploy button)</p>
<div id="attachment_1686" class="wp-caption alignnone" style="width: 597px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/12/01-Progress-bar-with-SignalR-Deploy-app-1.png"><img class="size-full wp-image-1686  " src="http://labs.thesedays.com/wp-content/uploads/2011/12/01-Progress-bar-with-SignalR-Deploy-app-1.png" alt="Deploying a first website" width="587" height="190" /></a><p class="wp-caption-text">Deploying a first website</p></div>
<div id="attachment_1687" class="wp-caption alignnone" style="width: 596px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/12/02-Progress-bar-with-SignalR-Deploy-app-2.png"><img class="size-full wp-image-1687  " src="http://labs.thesedays.com/wp-content/uploads/2011/12/02-Progress-bar-with-SignalR-Deploy-app-2.png" alt="Deploying a second website" width="586" height="204" /></a><p class="wp-caption-text">Deploying a second website</p></div>
<div id="attachment_1688" class="wp-caption alignnone" style="width: 596px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/12/03-Progress-bar-with-SignalR-Manage-app-overview.png"><img class="size-full wp-image-1688    " src="http://labs.thesedays.com/wp-content/uploads/2011/12/03-Progress-bar-with-SignalR-Manage-app-overview.png" alt="Overview which lists all websites and their deployment status" width="586" height="204" /></a><p class="wp-caption-text">Overview which lists all websites and their deployment status</p></div>
<p><strong>A look at the source code</strong></p>
<p>The deployment tool is an ASP.NET MVC 3 web application so installing SignalR is a breeze with <a href="http://nuget.org/List/Packages/SignalR" target="_blank">NuGet</a> and the first thing I did after installing the package was adding the progress bar to the view which initiates the deployment.</p>
<div id="attachment_1689" class="wp-caption alignnone" style="width: 581px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/12/04-Progress-bar-with-SignalR-Deployment-View.png"><img class="size-full wp-image-1689    " src="http://labs.thesedays.com/wp-content/uploads/2011/12/04-Progress-bar-with-SignalR-Deployment-View.png" alt="Client-side code in the Deployment view" width="571" height="373" /></a><p class="wp-caption-text">Client-side code in the Deployment view</p></div>
<p>In the head section I added references to the scripts required for SignalR and the <a href="http://docs.jquery.com/UI/Progressbar" target="_blank">JQuery UI progress bar</a> as well as some JS code which initializes the <a href="https://github.com/SignalR/SignalR/blob/master/SignalR/Hubs/Hub.cs" target="_blank">Hub</a> and handles the progress updates. Instead of having the form post back to the server, the submit button triggers a client side click event which will call a method on the hub (in this case <em>run</em>). Note that Jquery itself also needs referenced (in a shared layout).</p>
<p>That’s pretty much it when it comes to client side code and as you can see below the actual implementation of the hub is written in plain old C#</p>
<div id="attachment_1690" class="wp-caption alignnone" style="width: 570px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/12/05-Progress-bar-with-SignalR-Deploy-Manager.png"><img class="size-full wp-image-1690" src="http://labs.thesedays.com/wp-content/uploads/2011/12/05-Progress-bar-with-SignalR-Deploy-Manager.png" alt="DeployManager: server-side implementation of the hub" width="560" height="628" /></a><p class="wp-caption-text">DeployManager: server-side implementation of the hub</p></div>
<p>All it takes is creating a class which derives from <em>SignalR.Hubs.Hub</em> and by doing so the <em>run</em> method that is executed in the client-side script will trigger the run method on this class, which is all handled by SignalR.</p>
<p>The actual deployment logic is implemented in the <em>WebAppManager </em>class, so the <em>run</em> method just creates a new worker thread and passes in the deployment info. The worker thread instantiates a <em>WebAppManager</em> and subscribes to the progress event which will bubble progress events back to the <em>DeployManager</em>. Finally, the <em>DeployManager</em> will update the progress to all its clients (also handled by SignalR) which causes the <em>updateProgress</em> method on all clients to fire. Isn’t that just <strong>awesome</strong>?</p>
<p>Finally, the view which lists all websites can be easily updated by adding some familiar client-side script.</p>
<div id="attachment_1691" class="wp-caption alignnone" style="width: 580px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/12/06-Progress-bar-with-SignalR-Management-View.png"><img class="size-full wp-image-1691 " src="http://labs.thesedays.com/wp-content/uploads/2011/12/06-Progress-bar-with-SignalR-Management-View.png" alt="Client-side code in the App Management view" width="570" height="419" /></a><p class="wp-caption-text">Client-side code in the App Management view</p></div>
<p>Whenever a progress update is received the script will check to see whether a website’s deploy icon (and alt/title text) needs to be switched back and forth.</p>
<p>And apart from the actual progress calculation, basically that is all there is to it!</p>
<img src="http://feeds.feedburner.com/~r/TheseDaysLabs/~4/2scs8DvtKFY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://labs.thesedays.com/blog/2011/12/05/creating-a-progress-bar-in-asp-net-using-signalr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://labs.thesedays.com/blog/2011/12/05/creating-a-progress-bar-in-asp-net-using-signalr/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=creating-a-progress-bar-in-asp-net-using-signalr</feedburner:origLink></item>
		<item>
		<title>A blob storage hive provider for Umbraco 5 (beta)</title>
		<link>http://feedproxy.google.com/~r/TheseDaysLabs/~3/VI6S7bnguCw/</link>
		<comments>http://labs.thesedays.com/blog/2011/11/25/a-blob-storage-hive-provider-for-umbraco-5-beta/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 15:05:05 +0000</pubDate>
		<dc:creator>Lennart Stoop</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Open source]]></category>
		<category><![CDATA[Umbraco]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[azure]]></category>
		<category><![CDATA[blob storage]]></category>
		<category><![CDATA[hive]]></category>
		<category><![CDATA[jupiter]]></category>
		<category><![CDATA[umbraco]]></category>

		<guid isPermaLink="false">http://labs.thesedays.com/?p=1642</guid>
		<description><![CDATA[An introduction into Umbraco Hive and creating a Hive provider which stores media on Azure blob storage. Related files: download the source code &#8211; download the web application Jupiter is just around the corner With its first beta release on November 11th the road to Umbraco 5 (aka Jupiter) has brought us very close to [...]]]></description>
			<content:encoded><![CDATA[<p><em>An introduction into Umbraco Hive and creating a Hive provider which stores media on Azure blob storage.</em></p>
<p>Related files: <a href="http://labs.thesedays.com/wp-content/uploads/2011/11/ProviderSourceCode.zip">download the source code</a> &#8211; <a href="http://labs.thesedays.com/wp-content/uploads/2011/11/UmbracoBetaWebApp.zip">download the web application</a></p>
<p><strong>Jupiter is just around the corner</strong></p>
<p>With its first <a href="http://umbraco.com/follow-us/blog-archive/2011/11/11/umbraco-5-beta-1-is-out-today.aspx" target="_blank">beta release</a> on November 11<sup>th </sup>the <a href="http://umbraco.com/umbraco-5-status.aspx" target="_blank">road to Umbraco 5</a> (aka Jupiter) has brought us very close to its destination. The members of the Umbraco core team have been working really hard on stabilizing the API and many of our beloved (and improved) CMS features are well taking shape.</p>
<p>As Umbraco 5 remains open source all current and future releases are made available through <a href="http://umbraco.codeplex.com/" target="_blank">Codeplex </a>which allows developers of the <a href="http://our.umbraco.org/" target="_blank">Umbraco community</a> to explore and work with the source code, to contribute and to provide the <a href="http://our.umbraco.org/wiki/about/core-team" target="_blank">core team</a> with valuable feedback.</p>
<p>After having attended the awesome <a href="http://umb5hackaton.buug.be/" target="_blank">Umbraco v5 hackathon</a> organized by <a href="http://www.buug.be" target="_blank">BUUG</a> and hosted at our offices in Amsterdam – and also very much inspired by <a href="http://boxbinary.com/" target="_blank">Alex Norcliffe</a>’s talk at the Microsoft offices in Brussels – we really wanted to get our hands dirty and – deep dive into hive!</p>
<p><strong>Umbraco Hive</strong></p>
<p>Many of the recent Umbraco 5 talks and presentations involve <a href="http://jupiter.umbraco.org/Data-Access-in-Umbraco-5.ashx" target="_blank">Hive</a>, a completely new and extremely powerful concept in the upcoming version. Much unlike a traditional data layer in most n-tier or n-layer (web) applications Hive represents an abstraction layer for developers to plug in multiple, stackable data providers. These Hive providers can pull data (read and/or write) from nearly any data source and allow for smooth integration within the Umbraco back office as well as a transparent way of querying the data in the front-end.</p>
<p>The <a href="http://umbraco.codeplex.com/releases/view/76238" target="_blank">first beta release</a> comes with three Hive providers, created by the core team:</p>
<ul>
<li>A persistence provider that already supports SQL server and SQL CE (which uses <a href="http://sourceforge.net/projects/nhibernate/files/NHibernate/" target="_blank">NHibernate</a> as ORM)</li>
<li>An Examine provider for data indexation (which uses the <a href="http://incubator.apache.org/lucene.net/" target="_blank">Lucene.NET</a> indexer)</li>
<li>An IO provider which stores data on the local file system</li>
</ul>
<p>Basically this means Hive already supports the vast majority of (.NET) based websites.</p>
<p>By the way, didn’t I mention these providers are stackable? In a recent <a href="http://www.buug.be/en/events/umbracov5" target="_blank">demo</a> (video currently not available yet) Alex quickly swapped the Examine provider with the persistence provider, having Umbraco run entirely on a file index without using a database at all. Although that’s a neat trick by itself, the true power of Hive is the ability to query multiple, stacked providers: imagine having data stored in both a database and a file index while data is always retrieved from the file index in order to gain a performance boost… Hive will make it work.</p>
<p><strong>Community hackathons</strong></p>
<p>In many countries the <a href="http://umbraco.com/follow-us/blog-archive/2011/10/27/duug-festival-2011-and-amsterdam-v5-hackathon-wrap-up.aspx" target="_blank">ongoing v5 hackathons</a> allow Umbraco developers to come together, share experiences, learn and contribute. These sessions are the perfect opportunity to experiment with the various new concepts in v5 such as hive, hive providers, property editors, surface controllers, tree controllers and much more.</p>
<p>During the BUUG hackathon we were able to play around with the WordPress Hive provider created by <a href="http://blog.mattbrailsford.com/" target="_blank">the Karminator</a>. Basically the provider connects to a <a href="http://wordpress.org/" target="_blank">WordPress blog</a> and fetches categories and posts which are then loaded into the Umbraco back office. And even though our efforts of making the provider writeable were somewhat fruitless (#h5is) it did allow us to get familiar with Hive and understand how to create and configure a custom Hive provider.</p>
<p>The source code of the WordPress hive provider can be found on <a href="https://bitbucket.org/boxbinary/hive-wordpress-provider" target="_blank">bitbucket </a>and has also been added to the <a href="http://umbraco5contrib.codeplex.com/" target="_blank">Umbraco 5 Contrib project</a> on Codeplex which was introduced during the recent UK hackathon.</p>
<p>Since we weren’t able to attend the <a href="http://umbracoukfestival.co.uk/" target="_blank">Umbraco UK festival</a> and we didn’t want to wait until the next hackathon to further explore v5, we started a somewhat experimental side project: whether or not the websites we create are hosted on Windows Azure we often want to store resources on <a href="http://www.microsoft.com/windowsazure/features/cdn/" target="_blank">Windows Azure CDN</a> or <a href="http://www.microsoft.com/windowsazure/features/storage/" target="_blank">blob storage</a>. In Umbraco v5 style sheets, scripts, templates and media uploads are stored on the local file system. All of this is handled by the IO Hive provider, so we decided to create a Hive provider which is to save these files on blob storage, and it works!</p>
<p>As for the more technical part of this post, let’s have a closer look at the setup.</p>
<p><strong>Configuring the Blob Storage Hive provider</strong></p>
<p>When you have a closer look at the Hive configuration file you will notice that a Hive provider can be configured separately for each of the storage types known by Umbraco.</p>
<div id="attachment_1645" class="wp-caption alignnone" style="width: 593px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/11/01-Blob-storage-hive-provider-Hive-config.png"><img class="size-full wp-image-1645 " src="http://labs.thesedays.com/wp-content/uploads/2011/11/01-Blob-storage-hive-provider-Hive-config.png" alt="The hive configuration file, located in App_Data\Umbraco\Config" width="583" height="103" /></a><p class="wp-caption-text">The hive configuration file, located in App_Data\Umbraco\Config</p></div>
<p>The configuration file allows you to configure the type of the Factory class that is used by Hive to instantiate the provider’s entity repository (more on this later) as well as a reference to the provider configuration section which is located in the web.config. As shown below this configuration section allows users to further configure the Hive provider.</p>
<div id="attachment_1646" class="wp-caption alignnone" style="width: 562px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/11/02-Blob-storage-hive-provider-Web-config.png"><img class="size-full wp-image-1646 " src="http://labs.thesedays.com/wp-content/uploads/2011/11/02-Blob-storage-hive-provider-Web-config.png" alt="The umbraco configuration section in web.config" width="552" height="128" /></a><p class="wp-caption-text">The umbraco configuration section in web.config</p></div>
<p>As for the blob storage provider we allow users to configure the name of the connection string of the blob storage account (which is to be added to the connection strings section) as well as the name of the blob container.</p>
<p>Creating a custom configuration section is fully supported by the <a href="http://umbraco.codeplex.com/SourceControl/changeset/view/bde2e6f42a6f#Source%2fLibraries%2fUmbraco.Hive%2fAbstractProviderDependencyBuilder.cs" target="_blank">Umbraco v5 Framework</a> and is just a matter of creating/inheriting some classes that will allow the settings to be injected into the Entity repository (handled by <a href="http://code.google.com/p/autofac/" target="_blank">IOC</a>, very sweet). Make sure to have a look at <a href="http://labs.thesedays.com/wp-content/uploads/2011/11/ProviderSourceCode.zip">the source code</a> to find out exactly how easy it is ;-)</p>
<div id="attachment_1647" class="wp-caption alignnone" style="width: 529px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/11/03-Blob-storage-hive-provider-Dependency-helper.png"><img class="size-full wp-image-1647  " src="http://labs.thesedays.com/wp-content/uploads/2011/11/03-Blob-storage-hive-provider-Dependency-helper.png" alt="The provider dependency helper is a property of the abstract entity repository" width="519" height="198" /></a><p class="wp-caption-text">The provider dependency helper is a property of the abstract entity repository</p></div>
<p><strong>Creating the Blob Storage Hive provider</strong></p>
<p>Although we haven’t gotten around testing the provider for all storage types just yet, obviously the first thing we had in mind was having the provider handle media file uploads. The one thing which distinguishes media from other storage types is is that it uses both a persistence provider and a storage provider. This approach provides a (much needed) separation of the concept of media on the one hand and the actual physical storage on the other hand (I will come back to this in a moment).</p>
<p>As we won’t be replacing the persistence provider we were able to reuse plenty of the code written for the IO provider. So instead of walking through all the code, let’s just have a look at the key differences (and imperfections).</p>
<p>When you create a custom Hive provider you start out with creating an Entity model and a schema, allowing you to convert an arbitrary data model into a model which can be interpreted by Hive. Hive provides base entity classes for both model and schema (currently <em>TypedEntity</em> and <em>EntitySchema</em>) and base repository classes (currently <em>AbstractEntityRepository</em> and <em>AbstractSchemaRepository</em>) which allow Hive to query against model, schema and relations.</p>
<p>The main problem we faced when creating a model and schema for blob storage is that we noticed the core property editor used for uploading files in the back office creates a File model (IO provider). Since we did not want to create a custom upload property editor just yet, we decided to have our Blob model derive from the File model instead.</p>
<div id="attachment_1648" class="wp-caption alignnone" style="width: 451px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/11/04-Blob-storage-hive-provider-Typed-Entity.png"><img class="size-full wp-image-1648" src="http://labs.thesedays.com/wp-content/uploads/2011/11/04-Blob-storage-hive-provider-Typed-Entity.png" alt="The Blob typed entity which derives from Umbraco.Persistence.Model.IO.File" width="441" height="228" /></a><p class="wp-caption-text">The Blob typed entity which derives from Umbraco.Persistence.Model.IO.File</p></div>
<p>Definitely something we will need to reconsider in the future, but for the sake of getting the project of the ground quickly it seems like a fair solution. This is also the reason why we didn’t put too much effort in tailoring the Blob schema just yet (a simple schema with a node name attribute seems to work just fine).</p>
<p>Next we copy/pasted the <a href="http://umbraco.codeplex.com/SourceControl/changeset/view/bde2e6f42a6f#Source%2fLibraries%2fUmbraco.Hive.Providers.IO%2fEntityRepository.cs" target="_blank">entity repository used by the IO provider</a> and implemented most of the key logic in having data stored on blob storage. This actually all went pretty smooth and the one thing worth mentioning here is probably the use of Hive ID’s. The IO provider assembles Hive ID’s by normalizing the file path and although I’m sure it makes perfect sense we didn’t get it straight away and decided to implement our own strategy which basically comes down to: blob – container – blob name (which includes the GUID of the persisted media).</p>
<p>Although we haven’t yet fully implemented all of the entity/relation operations (and revision support for that matter) we did implement some of the relation operations which basically allow for the creation of thumbnails (<em>AddRelation</em> and <em>PerformGetChildRelations</em>). Having these implemented was amazingly straightforward by the way, so a big thumbs up to the core team! And again, you should really check out <a href="http://labs.thesedays.com/wp-content/uploads/2011/11/ProviderSourceCode.zip">the source code</a> to find out just how easy it was ;-)</p>
<div id="attachment_1649" class="wp-caption alignnone" style="width: 583px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/11/05-Blob-storage-hive-provider-Entity-repository-add-relation.png"><img class="size-full wp-image-1649 " src="http://labs.thesedays.com/wp-content/uploads/2011/11/05-Blob-storage-hive-provider-Entity-repository-add-relation.png" alt="The AddRelation method of the Entity Repository" width="573" height="218" /></a><p class="wp-caption-text">The AddRelation method of the Entity Repository</p></div>
<p>That’s basically it, and now we seriously wanted to test-drive this baby! Unfortunately the upload property editor did require a small fix in order to make it work with our blob storage provider: the code used to create a thumbnail creates a bitmap by passing in a file path. To fix this we just had to replace 1 line of code (maybe 20 characters?) which I think still is impressive considering we are reusing the existing property editor ;-)</p>
<div id="attachment_1650" class="wp-caption alignnone" style="width: 477px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/11/06-Blob-storage-hive-provider-Upload-property-editor-fix.png"><img class="size-full wp-image-1650 " src="http://labs.thesedays.com/wp-content/uploads/2011/11/06-Blob-storage-hive-provider-Upload-property-editor-fix.png" alt="A small fix in the core Upload property editor" width="467" height="127" /></a><p class="wp-caption-text">A small fix in the core Upload property editor</p></div>
<p>And it just works!</p>
<div id="attachment_1651" class="wp-caption alignnone" style="width: 571px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/11/07-Blob-storage-hive-provider-Media-section-using-blob-storage.png"><img class="size-full wp-image-1651 " src="http://labs.thesedays.com/wp-content/uploads/2011/11/07-Blob-storage-hive-provider-Media-section-using-blob-storage.png" alt="Media section in a local Umbraco v5 beta installation" width="561" height="172" /></a><p class="wp-caption-text">Media section in a local Umbraco v5 beta installation</p></div>
<div id="attachment_1652" class="wp-caption alignnone" style="width: 574px"><a href="http://labs.thesedays.com/wp-content/uploads/2011/11/08-Blob-storage-hive-provider-Cloudberry-explorer.png"><img class="size-full wp-image-1652 " src="http://labs.thesedays.com/wp-content/uploads/2011/11/08-Blob-storage-hive-provider-Cloudberry-explorer.png" alt="Cloudberry explorer showing the media files on blob storage" width="564" height="156" /></a><p class="wp-caption-text">Cloudberry explorer showing the media files on blob storage</p></div>
<p>We were actually somewhat surprised to see it work immediately as we first figured we would still have to make some changes in having the editor display the thumbnails (they&#8217;re on blob storage, so what about the URL?) and this is when we found out Umbraco 5 uses a custom mechanism for rendering media, i.e. the following URL will display an image uploaded as media:</p>
<p><em>http://umb5beta.local/Umbraco/Media/Proxy/media%24empty_root%24%24_p__nhibernate%24_</em></p>
<p><em>v__guid%24_28a171dda97048f98e6b9fa501792a5b?propertyAlias=uploadedFile</em></p>
<p>Remember the separation of the concept of media and the actual physical storage I mentioned earlier? Right!</p>
<p><strong>What’s next?</strong></p>
<p>Although we realize this is just a very basic implementation we would certainly love to see it being further developed into a solid Jupiter hive provider, and of course we love to hear your feedback and suggestions.</p>
<p>The source code is available on the <a href="http://umbraco5contrib.codeplex.com/SourceControl/network/Forks/theamph/Blobstorage">Umbraco 5 contrib project</a> (forked) or  you can just <a href="http://labs.thesedays.com/wp-content/uploads/2011/11/ProviderSourceCode.zip">download it here</a> or <a href="http://labs.thesedays.com/wp-content/uploads/2011/11/UmbracoBetaWebApp.zip">download a full web application</a> which has the provider already configured (it uses SQL CE so no need to setup a database).</p>
<p>At <a href="http://www.thesedays.com" target="_blank">These Days</a> we are already looking forward to the next release of Jupiter!</p>
<img src="http://feeds.feedburner.com/~r/TheseDaysLabs/~4/VI6S7bnguCw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://labs.thesedays.com/blog/2011/11/25/a-blob-storage-hive-provider-for-umbraco-5-beta/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		<feedburner:origLink>http://labs.thesedays.com/blog/2011/11/25/a-blob-storage-hive-provider-for-umbraco-5-beta/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=a-blob-storage-hive-provider-for-umbraco-5-beta</feedburner:origLink></item>
		<item>
		<title>responsive awareness</title>
		<link>http://feedproxy.google.com/~r/TheseDaysLabs/~3/WK9xYU38Bb8/</link>
		<comments>http://labs.thesedays.com/blog/2011/10/11/responsive-awareness/#comments</comments>
		<pubDate>Tue, 11 Oct 2011 08:19:51 +0000</pubDate>
		<dc:creator>onehundred_be</dc:creator>
				<category><![CDATA[CSS3]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Innovation]]></category>

		<guid isPermaLink="false">http://labs.thesedays.com/?p=1588</guid>
		<description><![CDATA[It&#8217;s 2011, the way we consume the internet has changed quite a bit over the past few years. We&#8217;re now dealing with a whole new range of web capable devices: smartphones, tablets and TV&#8217;s, just to name a few. Yet for the last couple of years websites are designed and built for a 1024 px [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s 2011, the way we consume the internet has changed quite a bit over the past few years. We&#8217;re now dealing with a whole new range of web capable devices: smartphones, tablets and TV&#8217;s, just to name a few. Yet for the last couple of years websites are designed and built for a 1024 px screen resolution. This so called standard is no longer accurate and if we keep making products for this old screen resolution, a lot of people will feel discriminated. When someone gets their hands on a brand new device and they are still presented with an interface which is no longer relevant, chances are they won&#8217;t be very happy.</p>
<p>That&#8217;s why it&#8217;s time for responsive awareness. The presentation included in this blogpost exists out of three parts and is intended for everybody with an interest in responsive web design and development, designers and front-end developers. Are you ready to make the switch? Do you want to deliver optimal user experience at all times? Get responsive already.</p>
<h2>Demo</h2>
<p><a href="http://playground.thesedays.com/responsive" target="_blank">check it out</a></p>
<p>Look ma, <strong>no javascript</strong>. Without scripting however IE6, IE7 &amp; IE8 won&#8217;t display properly. If you would like to see this work in every browser known to mankind simply include <a href="https://github.com/scottjehl/Respond" target="_blank">respond.js</a>. While viewing the demo, screen resolutions are displayed in the upper left corner. Depending on your screen size you can see up to <strong>seven different layouts</strong>.  The css is dynamic thanks to less.</p>
<h2>Presentation</h2>
<p>This presentation aims to shed light on do&#8217;s and don&#8217;ts for both designers and front-end developers. You can expect some tips on how to approach a responsive project, how to optimize the website for speed and plenty more.</p>
<div style="width: 425px">
<iframe src="http://www.slideshare.net/slideshow/embed_code/9629824" width="590" height="481" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe><br/><br/>
</div>
<img src="http://feeds.feedburner.com/~r/TheseDaysLabs/~4/WK9xYU38Bb8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://labs.thesedays.com/blog/2011/10/11/responsive-awareness/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://labs.thesedays.com/blog/2011/10/11/responsive-awareness/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=responsive-awareness</feedburner:origLink></item>
		<item>
		<title>Introducing Dude Where’s My Velo</title>
		<link>http://feedproxy.google.com/~r/TheseDaysLabs/~3/jPv2epdzyyU/</link>
		<comments>http://labs.thesedays.com/blog/2011/07/26/introducing-dude-where%e2%80%99s-my-velo/#comments</comments>
		<pubDate>Tue, 26 Jul 2011 15:27:13 +0000</pubDate>
		<dc:creator>Keegan Street</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mobile development]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[sass]]></category>

		<guid isPermaLink="false">http://labs.thesedays.com/?p=1450</guid>
		<description><![CDATA[Dude Where’s My Velo is a new HTML5 web app you can open on your phone to find the nearest velo city-bike in Antwerp. The interface is a full window Google Map with colour-coded markers representing the location of bike stations and the availability of velos. Geolocation is used to center the map and show [...]]]></description>
			<content:encoded><![CDATA[<p><em><a href="http://www.dudewheresmyvelo.be" target="_blank">Dude Where’s My Velo</a></em> is a new HTML5 web app you can open on your phone to find the nearest velo city-bike in Antwerp. The interface is a full window Google Map with colour-coded markers representing the location of bike stations and the availability of velos.</p>
<p>Geolocation is used to center the map and show the user’s exact position in Antwerp. As you ride around the city your new location is automatically represented on the map.</p>
<p>The serverside part of the application is built with NodeJS to be blazing fast. It constantly scrapes data from the official velo-antwerpen.be website and stores it as a JSON file. NodeJS is fast because it is an event driven server. After the server sends out a scraping request it will rest, and CPU usage will go down to zero, until it receives a response. This allows it to manage many simultaneous tasks.</p>
<p>On the client side, scripts and stylesheets are included as inline code to reduce the number of HTTP requests made and improve the performance of the app.</p>
<p>All code for the project is <a href="https://github.com/keeganstreet/dudewheresmyvelo.be" target="_blank">open source and available on GitHub</a>, so if you’d like to improve something about the website, feel free to make your own changes and submit a pull request.</p>
<p>There are a number of reasons we built this as an HTML5 web app rather than a native app.</p>
<p>The most important reason is cross-device support. The Google Maps SDK we use already supports iPhone, Android, BlackBerry 6 and Dolfin 2 (Samsung Beda). As other manufacturers improve their mobile web browsers, <em>Dude Where’s My Velo</em> will automatically support those devices. We are expecting good support for Windows Mobile and Nokia devices later this year.</p>
<p>The second reason for web over native is bug fixes and feature updates. Web apps can be updated as quickly and easily as normal websites. Changes don’t have to be approved or reviewed by third parties.</p>
<p>So check it out now. Visit <a href="http://www.dudewheresmyvelo.be" target="_blank">dudewheresmyvelo.be</a> on your phone or computer. We would also like to give a shout out to <a href="https://www.dotcloud.com/" target="_blank">DotCloud</a> who are hosting the app for free. Happy cycling!</p>
<p><a href="http://labs.thesedays.com/wp-content/uploads/2011/07/DWMV-post.jpg"><img class="alignnone size-medium wp-image-1451" src="http://labs.thesedays.com/wp-content/uploads/2011/07/DWMV-post-159x300.jpg" alt="" width="159" height="300" /></a></p>
<img src="http://feeds.feedburner.com/~r/TheseDaysLabs/~4/jPv2epdzyyU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://labs.thesedays.com/blog/2011/07/26/introducing-dude-where%e2%80%99s-my-velo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://labs.thesedays.com/blog/2011/07/26/introducing-dude-where%e2%80%99s-my-velo/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=introducing-dude-where%25e2%2580%2599s-my-velo</feedburner:origLink></item>
		<item>
		<title>Using the server-side authentication flow for Facebook Page Tabs</title>
		<link>http://feedproxy.google.com/~r/TheseDaysLabs/~3/AEp-CrCDCHE/</link>
		<comments>http://labs.thesedays.com/blog/2011/06/24/using-the-server-side-authentication-flow-for-facebook-page-tabs/#comments</comments>
		<pubDate>Fri, 24 Jun 2011 07:38:06 +0000</pubDate>
		<dc:creator>Keegan Street</dc:creator>
				<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://labs.thesedays.com/?p=1435</guid>
		<description><![CDATA[When we need to authenticate a user in a Facebook Page Tab, it is tempting to use the FB.login() function of the JavaScript SDK. It requires less work on our end and the popup dialog is less intrusive than a full redirect. But if we need to access the Graph API or verify that a [...]]]></description>
			<content:encoded><![CDATA[<p>When we need to authenticate a user in a Facebook Page Tab, it is tempting to use the <code>FB.login()</code> function of the JavaScript SDK. It requires less work on our end and the popup dialog is less intrusive than a full redirect. But if we need to access the Graph API or verify that a user is logged in from our server-side code, we should opt for the server-side OAuth 2.0 flow. Facebook’s <a href="http://developers.facebook.com/docs/authentication/" target="_blank">docs</a> say to use the server-side flow “whenever you need to call the Graph API from your web server”.</p>
<p>The <code>FB.login()</code> method of the JavaScript SDK won’t help us because <a href="http://anantgarg.com/2010/02/18/cross-domain-cookies-in-safari/" target="_blank">Safari does not allow cookies to be set from iframes</a>, which Page Tabs are loaded in. There are some nasty hacks that claim to get around this but I wouldn’t go there. Anyway, its actually really easy to implement the server-side auth flow in a Page Tab.</p>
<p>Here’s the flow we’ll need to implement:</p>
<ol>
<li>Use the <code>getLoginUrl()</code> function of the PHP SDK to generate a login URL.</li>
<li>The <code>redirect_uri</code> parameter should point to a page on our server — let’s call it <code>facebook-callback.php</code> for the example.</li>
<li>After the user allows (or denies) our permission request, Facebook will forward them on to <code>facebook-callback.php</code>.</li>
<li>That page will initialise the Facebook SDK so that a cookie is set. If you’re asking for offline access, this is when you should save the access token.</li>
<li>That page will then redirect the user back to our Page Tab, and voila, they are logged in.</li>
</ol>
<p>If you implement this flow you will be able to reliably access the Graph API from your client-side and server-side code.</p>
<p>If you read my previous post, <a href="http://labs.thesedays.com/2011/06/23/query-strings-for-facebook-page-tabs/" target="_blank">Query Strings for Facebook Page Tabs</a>, you might be wondering how to use the server-side authentication flow in a multi-page, deep-linked Page Tab. Its actually really easy because you can add query string parameters to the <code>redirect_uri</code>. When you generate your login URL, you can append your <code>app_data</code> parameters like this:</p>
<pre class="brush: plain; title: ; notranslate">
$callbackUrl = 'https://playground.thesedays.com/facebook-serverside-login/facebook-callback.php';
$encodedParams = urlencode(json_encode($params));
$loginUrl = $facebook-&amp;gt;getLoginUrl(array(
	'redirect_uri' =&amp;gt; $callbackUrl . '?app_data=' . $encodedParams
));
</pre>
<p>Then in your <code>facebook-callback.php</code> page, you just need to forward those parameters on to the Page Tab:</p>
<pre class="brush: plain; title: ; notranslate">
$tabUrl = 'https://www.facebook.com/mypage?sk=app_128534967229326';
if (!empty($_GET['app_data'])) {
	$redirectUrl = $tabUrl . '&amp;amp;app_data='.urlencode(stripslashes($_GET['app_data']));
}
header('Location: '.$redirectUrl);
</pre>
<p>Now you can have login links which go to different states in the same Page Tab. I’ve put up an example of <a href="https://www.facebook.com/apps/application.php?id=128534967229326&amp;sk=app_128534967229326" target="_blank">using server-side authentication on Page Tabs</a>. <a href="https://github.com/thesedays/facebook-app-data/tree/serverside-login" target="_blank">The source is on GitHub</a>.</p>
<p>Note: Using the server-side auto flow with Page Tabs will result in 3 HTTP redirects — first to Facebook, then to <code>facebook-callback.php</code>, then to the Page Tab, which finally loads your content in an iframe. Therefore you should only use this flow when you need to authenticate a user. If a user is already logged in, you should load new pages directly. Ajax is your friend!</p>
<img src="http://feeds.feedburner.com/~r/TheseDaysLabs/~4/AEp-CrCDCHE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://labs.thesedays.com/blog/2011/06/24/using-the-server-side-authentication-flow-for-facebook-page-tabs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://labs.thesedays.com/blog/2011/06/24/using-the-server-side-authentication-flow-for-facebook-page-tabs/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=using-the-server-side-authentication-flow-for-facebook-page-tabs</feedburner:origLink></item>
		<item>
		<title>Query Strings for Facebook Page Tabs</title>
		<link>http://feedproxy.google.com/~r/TheseDaysLabs/~3/Uh9o_U6hkqk/</link>
		<comments>http://labs.thesedays.com/blog/2011/06/23/query-strings-for-facebook-page-tabs/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 07:29:29 +0000</pubDate>
		<dc:creator>Keegan Street</dc:creator>
				<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://labs.thesedays.com/?p=1406</guid>
		<description><![CDATA[There is a very useful but rarely used feature of the Facebook platform which allows you to pass query string parameters into Page Tabs. This is a powerful feature because you can use it to build full applications inside a Page Tab. No canvas app is required. For example, if you had a picture-drawing application, [...]]]></description>
			<content:encoded><![CDATA[<p>There is a very useful but rarely used feature of the Facebook platform which allows you to pass query string parameters into Page Tabs. This is a powerful feature because you can use it to build full applications inside a Page Tab. No canvas app is required. For example, if you had a picture-drawing application, you could let your users share a link to the Page Tab which opened their picture directly.</p>
<p>Facebook Page Tabs are loaded in an frame, which means they don’t have access to the query string. But Facebook have provided a way around this by passing on <a href="https://developers.facebook.com/blog/post/462" target="_blank">one particular parameter</a>. Any value in the <code>app_data</code> GET parameter is made available to your application as a string in the <code>signed_request</code> object. You can use JSON encoding to make that parameter store any number of objects.</p>
<p>Enough talk — time for some code. I’m going to walk through a really basic demo of how to make this work. First, let’s initialise the Facebook SDK.</p>
<pre class="brush: plain; title: ; notranslate">$facebook = new Facebook(array(
  'appId'  =&amp;gt; 'YOUR_APP_ID',
  'secret' =&amp;gt; 'YOUR_APP_SECRET',
));</pre>
<p>Now we’ll ask for the <code>signed_request</code> object.</p>
<pre class="brush: plain; title: ; notranslate">$signedRequest = $facebook-&amp;gt;getSignedRequest();</pre>
<p>Now let’s take the <code>app_data</code> string parameter and decode it into an array.</p>
<pre class="brush: plain; title: ; notranslate">$appData = array();
if (!empty($signedRequest) &amp;amp;&amp;amp; !empty($signedRequest['app_data'])) {
  $appData = json_decode($signedRequest['app_data'], true);
}</pre>
<p>For testing purposes, we’ll print out the results.</p>
<pre class="brush: plain; title: ; notranslate">echo 'appData contains: ' .
  '&lt;pre&gt;' . print_r($appData, 1) . '&lt;/pre&gt;';</pre>
<p>Now that we’ve set up a way to retrieve and display the <code>app_data</code> parameters, let’s create a link which actually passes some parameters in. The first step is to define our parameters in an array.</p>
<pre class="brush: plain; title: ; notranslate">$params = array(
  'page' =&amp;gt; 'home',
  'id'   =&amp;gt; '99'
);</pre>
<p>Next we’ll encode that array into a JSON string, and then URL encode it so it can be used in a query string.</p>
<pre class="brush: plain; title: ; notranslate">$encodedParams = urlencode(json_encode($params));</pre>
<p>Finally, we’ll concatenate the string onto our Page Tab’s base URL and print it as a link.</p>
<pre class="brush: plain; title: ; notranslate">$tabUrl = 'http://www.facebook.com/mypage?sk=app_142464959162218';
$linkUrl = $tabUrl . '&amp;amp;app_data=' . $encodedParams;
echo '&lt;a href=&quot;' . $linkUrl . '&quot;&gt;My link&lt;/a&gt;';</pre>
<p>The value of <code>$linkUrl</code> would be:</p>
<pre class="brush: plain; title: ; notranslate">http://www.facebook.com/mypage?sk=app_142464959162218&amp;amp;app_data={%22page%22%3A%22home%22%2C%22id%22%3A%2299%22}</pre>
<p>As you can see, having multiple query string parameters in a Page Tab is a really simple process. If you want to you can use this functionality to build multi-page Tabs with deep-linking. I have made a working example of a multi-page Tab for you to check out. You can follow the links below to see the demo, and the source code is up on GitHub of course.</p>
<p><a href="http://www.facebook.com/apps/application.php?id=142464959162218&amp;sk=app_142464959162218&amp;app_data={%22colour%22%3A%22red%22%2C%22another_param%22%3A%225000%22}" target="_blank">Deep link red</a><br />
<a href="http://www.facebook.com/apps/application.php?id=142464959162218&amp;sk=app_142464959162218&amp;app_data={%22colour%22%3A%22green%22%2C%22id%22%3A%2212%22%2C%22list%22%3A%5B%22kangaroos+%26+wallabies%22%2C%22koalas%22%2C%22wombats%22%2C%22emus%22%5D}" target="_blank">Deep link green</a><br />
<a href="http://www.facebook.com/apps/application.php?id=142464959162218&amp;sk=app_142464959162218&amp;app_data={%22colour%22%3A%22blue%22}" target="_blank">Deep link blue</a><br />
<a href="https://github.com/thesedays/facebook-app-data" target="_blank">Source on GitHub</a></p>
<img src="http://feeds.feedburner.com/~r/TheseDaysLabs/~4/Uh9o_U6hkqk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://labs.thesedays.com/blog/2011/06/23/query-strings-for-facebook-page-tabs/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://labs.thesedays.com/blog/2011/06/23/query-strings-for-facebook-page-tabs/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=query-strings-for-facebook-page-tabs</feedburner:origLink></item>
		<item>
		<title>The missing Facebook interface component for friend selection</title>
		<link>http://feedproxy.google.com/~r/TheseDaysLabs/~3/qsdqU48k_PI/</link>
		<comments>http://labs.thesedays.com/blog/2011/06/20/the-missing-facebook-interface-component-for-friend-selection/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 07:21:15 +0000</pubDate>
		<dc:creator>Keegan Street</dc:creator>
				<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[sass]]></category>

		<guid isPermaLink="false">http://labs.thesedays.com/?p=1389</guid>
		<description><![CDATA[Introducing the missing Facebook interface component — the These Days Facebook Friend Selector. A common problem we have as Facebook application developers is the need to provide users with a way to select one or more of their friends and then capture that selection. The Graph API can provide us with an array of the [...]]]></description>
			<content:encoded><![CDATA[<p><em>Introducing the missing Facebook interface component — the These Days Facebook Friend Selector.</em></p>
<p>A common problem we have as Facebook application developers is the need to provide users with a way to select one or more of their friends and then capture that selection. The <a href="http://developers.facebook.com/docs/reference/api/user/" target="_blank">Graph API</a> can provide us with an array of the user’s friends but there’s no official way to convert that array into an interactive interface component. The <a href="https://github.com/thesedays/Facebook-friend-selector" target="_blank">These Days Facebook Friend Selector</a> aims to fill that requirement.</p>
<p>Here’s what it looks like:<br />
<a href="http://labs.thesedays.com/wp-content/uploads/2011/06/687474703a2f2f706c617967726f756e642e7468657365646179732e636f6d2f7464667269656e6473656c6563746f722f73637265656e73686f742d32303131303630382e706e67.png"><img class="alignnone size-medium wp-image-1390" src="http://labs.thesedays.com/wp-content/uploads/2011/06/687474703a2f2f706c617967726f756e642e7468657365646179732e636f6d2f7464667269656e6473656c6563746f722f73637265656e73686f742d32303131303630382e706e67-246x300.png" alt="" width="246" height="300" /></a></p>
<p>You can view an example in the <a href="http://playground.thesedays.com/tdfriendselector/" target="_blank">These Days Playground</a> or check out the <a href="https://github.com/thesedays/Facebook-friend-selector" target="_blank">source code on GitHub</a>.</p>
<p>We had a number of priorities when designing this plugin:</p>
<ul>
<li><strong>User experience</strong> — The plugin should look and feel like an official interface component on facebook.com.</li>
<li><strong>Ease of implementation</strong> — You can get the example up and running on your own server simply by adding your application’s API key to example.js. The plugin loads the user’s friends automatically via the Facebook JavaScript SDK.</li>
<li><strong>Flexibility</strong> — You can customise the number of friends to select, the number of friends to display per page, toggle auto-deselection if the maximum number of friends is reached and have multiple instances of the plugin on the same page, each with separate settings. The CSS classnames are all editable, as is the CSS itself, which is provided in <a href="http://sass-lang.com/" target="_blank">SCSS</a> syntax for ease of authoring.</li>
</ul>
<p>The plugin is tested (IE7+) and production ready. We’re using it in a couple of upcoming projects to allow users to select friends who they would like to invite to play a game. But of course a plugin like this is never finished. We will continue to work on it, and you’re also welcome to fork it and submit pull requests on GitHub. Some of our ideas are:</p>
<ul>
<li>Adding unit tests — we know we can’t realistically expect the community to contribute patches if there are no tests.</li>
<li>Adding a button to toggle between ‘All Friends’ and ‘Selected Friends’.</li>
<li>Adding alternate UI modes — such as a tile view as well as the list view, and an embedded display mode as well as the popup/overlay display mode.</li>
<li>Adding support for other JavaScript libraries — currently we rely on jQuery for selectors, event binding and style changes. It might be nice if the core of the plugin was library independent and there were different adapters for jQuery, MooTools, YUI, etc.</li>
</ul>
<p>To get started with the These Days Facebook Friend Selector, <a href="https://github.com/thesedays/Facebook-friend-selector" target="_blank">check out the readme and download the source on GitHub</a>.</p>
<img src="http://feeds.feedburner.com/~r/TheseDaysLabs/~4/qsdqU48k_PI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://labs.thesedays.com/blog/2011/06/20/the-missing-facebook-interface-component-for-friend-selection/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<feedburner:origLink>http://labs.thesedays.com/blog/2011/06/20/the-missing-facebook-interface-component-for-friend-selection/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=the-missing-facebook-interface-component-for-friend-selection</feedburner:origLink></item>
		<item>
		<title>Migrating a web application to Azure</title>
		<link>http://feedproxy.google.com/~r/TheseDaysLabs/~3/9szeJLa1WJI/</link>
		<comments>http://labs.thesedays.com/blog/2011/06/06/migrating-a-web-application-to-azure/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 07:36:39 +0000</pubDate>
		<dc:creator>Lennart Stoop</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Cloud computing]]></category>
		<category><![CDATA[Web development]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">http://labs.thesedays.com/?p=1228</guid>
		<description><![CDATA[I was recently involved in moving a web campaign into the cloud. Development phase had nearly ended and we realized that having the application run on Windows Azure would involve redesigning several parts of the application. Questions that come up at this point are: Project manager: Why does it take an extra development effort? Developers: [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently involved in moving a <a title="Q8 Fuel campaign" href="http://www.q8fuel.be" target="_blank">web campaign</a> into the cloud. Development phase had nearly ended and we realized that having the application run on <a title="Windows Azure" href="http://www.microsoft.com/windowsazure/" target="_blank">Windows Azure</a> would involve redesigning several parts of the application. Questions that come up at this point are:</p>
<ul>
<li>Project manager:<em> Why does it take an extra development effort?</em></li>
<li>Developers:<em> Why should we write platform-specific code?</em></li>
</ul>
<p>In my opinion the cloud is about leveraging web applications and enhancing <strong>scalability &amp; content delivery</strong>. In order to fully take advantage of Windows Azure applications need to be scalable as well, and they should definitely use the features provided by the underlying platform.</p>
<p>A first step in the migration process had us identify the parts of the application that needed to be redesigned, either to support scalability, to apply best practices or simply to work around some of the platform’s limitations. At this stage we needed to be familiar with the <a title="Windows Azure features" href="http://www.microsoft.com/windowsazure/features/" target="_blank">concepts introduced by Windows Azure</a>, such as web &amp; worker roles, blob and table storage, queues and distributed cache.</p>
<p>By looking at these concepts we decided action was needed in handling:</p>
<ul>
<li>ASP.NET Session state</li>
<li>Static content</li>
<li>Event logging (log4net)</li>
<li>E-mail notification (SMTP)</li>
<li>Scheduled tasks</li>
<li>Data exchange (FTP)</li>
</ul>
<p><a href="http://labs.thesedays.com/wp-content/uploads/2011/06/Cloudapp.jpg"><img class="alignnone size-large wp-image-1278" src="http://labs.thesedays.com/wp-content/uploads/2011/06/Cloudapp-1024x742.jpg" alt="Windows Azure concepts applied" width="547" height="397" /></a></p>
<p><strong>Using distributed cache to store ASP.NET sessions</strong></p>
<p>The application had already implemented ASP.NET membership and it was also using in-process ASP.NET session state to maintain state between pages. As by default, session information is stored in-memory of the application, but since we wanted to run at least two instances to <a title="Windows Azure SLA" href="http://www.microsoft.com/windowsazure/sla/" target="_blank">ensure high availability</a>, we figured we needed a different session store.</p>
<p>In Windows Azure common alternatives are storing session information in a database or table storage. A new service however is the<em> </em><a title="AppFabric Caching" href="http://www.microsoft.com/windowsazure/appfabric/caching/" target="_blank">AppFabric Cache</a> which provides a global distributed caching mechanism that can also be used to store session information. For this type of storage a custom <a title="AppFabric Cache session state provider configuration" href="http://msdn.microsoft.com/en-us/library/ee790859.aspx" target="_blank">session state provider</a> exists out of the box so basically we just had to configure it.</p>
<p>Note that in order to use this service we also needed to install the <a title="Windows Azure AppFabric SDK" href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=39856a03-1490-4283-908f-c8bf0bfad8a5&amp;displaylang=en" target="_blank">AppFabric SDK</a> (currently v1.0, a newer version is already <a title="Windows Azure AppFabric SDK 2.0 CTP" href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=d89640fc-c552-446e-aead-b1e0d940f31b" target="_blank">available in CTP</a> and expected to be released soonish).</p>
<p><strong>Using blob storage for content delivery</strong></p>
<p>For smaller and local web applications we normally don’t consider a CDN and have the content stored directly within the web application itself. Having static content deployed to multiple web role instances however is not ideal, and it would also require us to redeploy the application even when minor changes occur, for example to images, style sheets or scripts.</p>
<p>A good practice therefore is to store this type of content outside of the application, and for this we decided to use <a title="Windows Azure storage" href="http://www.microsoft.com/windowsazure/storage/" target="_blank">blob storage</a>. Blob storage is easy to setup and there are several tools that allow you to upload files, configure cache control, manage header information, etc.</p>
<ul>
<li><a title="Cloudberry Explorer for Azure storage" href="http://cloudberrylab.com/?page=explorer-azure" target="_blank">Cloudberry Explorer</a></li>
<li><a title="Cloud Storage Studio" href="http://www.cerebrata.com/products/cloudstoragestudio/" target="_blank">Cloud Storage Studio (Cerebrata)</a></li>
</ul>
<p>I would like to add that blob storage is also a great solution for storing dynamic content such as file uploads and image galleries. Some working examples can be found in the <a title="Windows Azure training kit" href="http://msdn.microsoft.com/en-us/windowsazure/wazplatformtrainingcourse.aspx" target="_blank">Azure training kit</a>.</p>
<p><strong>Configuring log4net and transferring logs to table storage</strong></p>
<p>We often use <a title="Apache Log4net logging framework" href="http://logging.apache.org/log4net/" target="_blank">log4net</a> as our logging framework and this web application was no exception. The events we log are usually either informative (i.e. a worker process that started) or exceptional (both managed and unhandled exceptions). The application was already configured to write these log entries to a file using a <em>RollingFileAppender</em>, a setup we needed to reconsider because:</p>
<ul>
<li>A web role instance runs in a virtual machine with a (somewhat limited) IIS installation and local storage is to be considered temporary (if the VM dies or gets upgraded local storage is lost)</li>
<li>Log entries will be written by multiple web role instances so we needed to combine these events and also keep track of their source</li>
</ul>
<p>Fortunately the <a title="Windows Azure SDK" href="http://www.microsoft.com/windowsazure/sdk/" target="_blank">Windows Azure SDK</a> provides a diagnostics configuration and management API which allows you to collect diagnostics in different roles and transfer this information to <a title="Windows Azure table service concepts" href="http://msdn.microsoft.com/en-us/library/dd179463.aspx" target="_blank">table storage</a> at regular intervals.</p>
<p>We also found a helpful blog post describing <a title="Creating a log4net appender for Windows Azure" href="http://cloudshaper.wordpress.com/2010/10/30/logging-with-log4net-on-the-azure-platform/" target="_blank">how to create a custom log4net appender</a> that utilizes the diagnostics API and provides a means of configuration through the service configuration file allowing us to change the logging configuration without having to redeploy.</p>
<p><strong>Using queue storage in processing e-mail notification</strong></p>
<p>The web application needed to send e-mail notifications during user registration or whenever a contact form had been submitted. The original implementation relied on the existence of an SMTP e-mail service on the hosting environment and here’s the catch: Windows Azure does not provide an SMTP service. The <a title="Azure adoption: SMTP" href="http://blogs.msdn.com/b/windowsazure/archive/2010/10/08/adoption-program-insights-sending-emails-from-windows-azure-part-1-of-2.aspx?wa=wsignin1.0" target="_blank">Azure adoption team recommends</a> using either:</p>
<ul>
<li>A custom on-premise e-mail forwarder service</li>
<li>E-mail server’s web service API’s</li>
<li>A third party SMTP service</li>
</ul>
<p>We were actually pretty fortunate in having other e-mail notifications that would run within a scheduled task already configured to use an on-premise e-mail service using a web service API.</p>
<p>So we needed to make that work for all notifications and while at it, we also decided to completely move the notification process out of the web role and to take advantage of the <a title="Azure Queue Service" href="http://msdn.microsoft.com/en-us/library/dd179363.aspx" target="_blank">Azure Queue service</a> to forward messages to a worker role for background processing. Let’s look at the benefits:</p>
<ul>
<li>Notification logic is abstracted from the web role</li>
<li>The web role becomes more responsive</li>
<li>Messages are kept in store in case the e-mail service goes down</li>
<li>Monitoring the queue allows us to scale up or down by adding/removing worker roles as needed</li>
</ul>
<p><strong>Configuring jobs to run within a worker role</strong></p>
<p>For the application to synchronize its data with external systems at regular intervals the original idea was to configure scheduled tasks on the hosting platform. And although Windows Azure does provide a VM role that allows you to <a title="Windows Azure virtual machine" href="http://www.microsoft.com/windowsazure/virtualmachines/" target="_blank">create a virtual machine</a> and setup the scheduled tasks, we figured this approach to be rather inconvenient.</p>
<p>That is why we decided to use the <a title="Quartz.Net scheduling framework" href="http://quartznet.sourceforge.net/" target="_blank">Quartz.net scheduling framework</a> and had the tasks converted into jobs. We used <a title="Quartz.net cron expressions" href="http://quartznet.sourceforge.net/tutorial/lesson_6.html" target="_blank">cron expressions</a> to schedule the jobs in the worker role and configured these in the service configuration file. Of course we did need to consider the time zone the worker role would be running in.</p>
<p>Since we were using third party assemblies, we also needed to ensure that:</p>
<ul>
<li>The assemblies are included in the package (by setting the copy local property to true when referencing the assembly)</li>
<li>The assemblies are compiled to run on a 64-bit platform (in our case the Quartz.dll was compiled to run on any CPU, but we did have to recompile the Common.Logging.dll)</li>
</ul>
<p>Having your local development machine run on a 64-bit platform does make deployment easier.</p>
<p><strong>Setting up data exchange via FTP</strong></p>
<p>During a synchronization process the application needed to import files that were uploaded to a local FTP server by an external system and export files that were to be picked up by that system later. And although it’s not the most flexible way of exchanging data it’s still a common practice and nonetheless a requirement for our application.</p>
<p>The problem we faced here is that Windows Azure does not provide an FTP service so we had to come up with a work-around. The options we considered were to create:</p>
<ul>
<li>An <em>FTP client</em> in the worker role which connects to an on-premise FTP server</li>
<li>An <em>FTP server</em> in the worker role that accepts FTP connections and uses blob storage for storing files (for example by using <a title="FTP 2 Azure" href="http://ftp2azure.codeplex.com/" target="_blank">FTP2Azure</a>, a project on codeplex)</li>
<li>A small application that would run on the on-premise FTP server and synchronizes files with blob storage</li>
</ul>
<p>Considering time and resources we decided to go with the first option which did require us to set up an on-premise FTP server, although the development effort would somewhat be reduced. Eventually it turned out that implementing a simple FTP client is <a title="Creating a simple FTP client in .NET" href="http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx" target="_blank">well supported by the .NET framework</a>.</p>
<p><strong>Conclusion</strong></p>
<p>Much of the work involved in migrating the application to Windows Azure was due to fact that the application was not very scalable to begin with and it pretty much relied on the infrastructure of the hosting environment (local SMTP, FTP and file storage) although I must say that SMTP is a pretty common requirement for many applications and it surprises me it’s not provided out of the box.</p>
<p>Windows Azure offers plenty of new features that improve overall scalability and content delivery. Automated scaling, online storage, diagnostics and performance monitoring have been made easy and the Windows Azure SDK provides developers with the necessary tools and API’s to quickly start using these features.</p>
<p>Although we did have our fair share in refactoring our application, I am convinced that applications designed to run on the platform can also drastically improve by <em>sharing common services</em> including e-mail notification and data exchange and by fully taking advantage of the services already offered by Windows Azure.</p>
<img src="http://feeds.feedburner.com/~r/TheseDaysLabs/~4/9szeJLa1WJI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://labs.thesedays.com/blog/2011/06/06/migrating-a-web-application-to-azure/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://labs.thesedays.com/blog/2011/06/06/migrating-a-web-application-to-azure/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=migrating-a-web-application-to-azure</feedburner:origLink></item>
	</channel>
</rss>

