<?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.southworks.net/~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>Southworks Blogs</title>
	
	<link>http://blogs.southworks.net</link>
	<description>Powered by Southworks</description>
	<lastBuildDate>Tue, 15 May 2012 20:38:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.southworks.net/master-feed" /><feedburner:info uri="master-feed" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><image><link>http://blogs.southworks.net</link><url>http://static.southworksinc.com/images-v1/sw_logo.png</url><title>Southworks</title></image><item>
		<title>Hadoop on Azure and importing data from the Windows Azure Marketplace</title>
		<link>http://feeds.southworks.net/~r/master-feed/~3/WvWyabzG244/</link>
		<comments>http://blogs.southworks.net/ajezierski/2012/05/10/hadoop-on-azure-and-importing-data-from-the-windows-azure-marketplace/#comments</comments>
		<pubDate>Fri, 11 May 2012 01:08:33 +0000</pubDate>
		<dc:creator>ajezierski</dc:creator>
				<category><![CDATA[Big Data]]></category>
		<category><![CDATA[Hadoop on Azure]]></category>
		<category><![CDATA[big data]]></category>
		<category><![CDATA[hadoop on azure]]></category>
		<category><![CDATA[HiveQL]]></category>
		<category><![CDATA[Windows Azure]]></category>

		<guid isPermaLink="false">http://139.113</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/ajezierski/2012/05/10/hadoop-on-azure-and-importing-data-from-the-windows-azure-marketplace/" class="more-link">read more<img src="http://blogs.southworks.net/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>In a previous <a href="http://blogs.southworks.net/ajezierski/2012/05/08/big-data-hadoop-on-azure-and-the-elephant-in-the-room/" target="_blank">post </a>I briefly introduced Hadoop and described a brief overview of its components.  In this post I&#8217;ll put my money where my mouth is and actually do stuff with Hadoop on Azure.  Again, one step at a time.</p>
<p>So I went to the <a href="https://datamarket.azure.com/browse/Data?Price=Free" target="_blank">market</a> and found some free demographics data available from the UN to mess around with and imported it to my Hadoop on Azure cluster via the portal.   Before you blindly go about importing data, you can first sample the goods.  In the Windows Azure Marketplace you can subscribe to published data, and build a query of your interest.  The most important thing here is that you need to take note of your primary account key and the query url.</p>
<p><a href="http://blogs.southworks.net/ajezierski/files/2012/05/DM1.png"><img class="alignnone size-large wp-image-121" src="http://blogs.southworks.net/ajezierski/files/2012/05/DM1-690x118.png" alt="" width="690" height="118" /></a></p>
<p><em>Take note of the query and passkey.  Click on Show.<br />
</em></p>
<p><a href="http://blogs.southworks.net/ajezierski/files/2012/05/testquery.png"><img class="alignnone size-large wp-image-122" src="http://blogs.southworks.net/ajezierski/files/2012/05/testquery-690x197.png" alt="" width="690" height="197" /></a></p>
<p><em>Sample the goods</em>, <em> build your query.</em></p>
<p>Once we have the query we want, we need to go to our Hadoop on Azure portal, select <strong>Manage Cluster</strong> and then select <strong>DataMarket</strong>.  Here we will have to input our user name (from your email), the passkey obtained earlier, the query url you obtained as well and the name of the Hive table so we can access the data after the import is done.  <strong>Note: </strong>I&#8217;ve replaced the encoded space and quotation marks to avoid <strong>Bad Request</strong> errors.  This happened to me because I copied and pasted the query right out from the marketplace.  It took a couple of tries until I figured it out, oh well.  Run the query by selecting Import Data.</p>
<p><a href="http://blogs.southworks.net/ajezierski/files/2012/05/ImportData.png"><img class="alignnone size-large wp-image-123" src="http://blogs.southworks.net/ajezierski/files/2012/05/ImportData-690x346.png" alt="" width="690" height="346" /></a></p>
<p>Now we can go to the Hive interactive console and take a look at the results.  We can type the <strong>show tables </strong>command for a list of the tables, and make sure ours is there.</p>
<p><a href="http://blogs.southworks.net/ajezierski/files/2012/05/ShowTables.png"><img class="alignnone size-large wp-image-124" src="http://blogs.southworks.net/ajezierski/files/2012/05/ShowTables-690x154.png" alt="" width="690" height="154" /></a></p>
<p>Take into consideration that, although this looks like a table, it has columns like a table, and we can query the data as if it were stored in the table, it&#8217;s not.  When we create tables in HiveQL, partition them and load data, HDFS files are actually created and stored (and replicated and distributed through the nodes).</p>
<p>Now we can go on and type our HiveQL query.  Remember what&#8217;s happening under the hood.  This query is creating and executing a MapReduce job.  I&#8217;m also a newbie in the MapReduce world, so I trust <a href="http://channel9.msdn.com/Events/TechDays/Techdays-2012-the-Netherlands/2266" target="_blank">Gert Drapers</a> when he says a simple join in HiveQL is equivalent to writing a much more complex bunch of code, and that Facebook&#8217;s jobs are mostly written in HiveQL.  That means something, doesn&#8217;t it?</p>
<p><a href="http://blogs.southworks.net/ajezierski/files/2012/05/HiveQL.png"><img class="alignnone size-large wp-image-126" src="http://blogs.southworks.net/ajezierski/files/2012/05/HiveQL-690x449.png" alt="" width="690" height="449" /></a></p>
<p>So we&#8217;ve executed our simple HiveQL query and seen the results.  We can always go back to the job history for that query, too (you can&#8217;t miss that big orange button in the main page).</p>
<p><a href="http://blogs.southworks.net/ajezierski/files/2012/05/job-history.png"><img class="alignnone size-large wp-image-127" src="http://blogs.southworks.net/ajezierski/files/2012/05/job-history-690x408.png" alt="" width="690" height="408" /></a></p>
<p><em>Job History.</em></p>
<p>So, we&#8217;ve imported data from the marketplace and ran a simple HiveQL query.  In a future post we can go through the samples that are included when you setup your cluster and mess around with the Javascript console.  Refer to the previous <a href="http://blogs.southworks.net/ajezierski/2012/05/08/big-data-hadoop-on-azure-and-the-elephant-in-the-room/" target="_blank">post</a> for additional links and resources.</p>
<p>Happy Learning.</p>
<div class="feedflare">
<a href="http://feeds.southworks.net/~ff/master-feed?a=WvWyabzG244:ygWWcWC2oBQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=WvWyabzG244:ygWWcWC2oBQ:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/master-feed?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=WvWyabzG244:ygWWcWC2oBQ:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/master-feed?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=WvWyabzG244:ygWWcWC2oBQ:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=WvWyabzG244:ygWWcWC2oBQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/master-feed?i=WvWyabzG244:ygWWcWC2oBQ:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=WvWyabzG244:ygWWcWC2oBQ:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/master-feed?i=WvWyabzG244:ygWWcWC2oBQ:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=WvWyabzG244:ygWWcWC2oBQ:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/master-feed?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/master-feed/~4/WvWyabzG244" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/ajezierski/2012/05/10/hadoop-on-azure-and-importing-data-from-the-windows-azure-marketplace/</feedburner:origLink></item>
		<item>
		<title>Prism: InteractionRequest and PopupModalWindowAction for WPF applications</title>
		<link>http://feeds.southworks.net/~r/master-feed/~3/uMUNSYbPxds/</link>
		<comments>http://blogs.southworks.net/aadami/2012/05/09/prism-interactionrequest-and-popupmodalwindowaction-for-wpf-applications/#comments</comments>
		<pubDate>Wed, 09 May 2012 14:46:41 +0000</pubDate>
		<dc:creator>aadami</dc:creator>
				<category><![CDATA[Prism]]></category>

		<guid isPermaLink="false">http://133.165</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/aadami/2012/05/09/prism-interactionrequest-and-popupmodalwindowaction-for-wpf-applications/" class="more-link">read more<img src="http://blogs.southworks.net/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>Hi everybody,</p>
<p>As you might already know the Prism Library does not provide UI implementations for <strong>WPF</strong> interaction requests as out of the box, it only provides examples of these implementations for <strong>Silverlight, </strong>which<strong> </strong>can be used as a basis for the development of your own triggers and actions.</p>
<p>Hence, I created this blog with the purpose of demonstrating a possible approach to achieve this and to show how creating similar implementations in <strong>WPF</strong> should be quite straightforward.</p>
<p>Therefore, I created a sample which benefits from <strong>InteractionRequestTriggers</strong> and a custom <strong>TriggerAction</strong>&lt;<strong>FrameworkElement</strong>&gt; similar to the default <strong><a href="http://msdn.microsoft.com/en-us/library/microsoft.practices.prism.interactivity.interactionrequest.popupchildwindowaction%28v=pandp.38%29.aspx">PopupChildWindowAction</a></strong> class, which can be used to display a pop-up modal windows in <strong>Silverlight</strong>.</p>
<h2>Introduction</h2>
<p>The Prism documentation provides useful information on how a view model can make interaction requests directly to the view itself via an <strong>InteractionRequest</strong> object coupled with a behavior in the view. I recommend reading the following section of the <strong>Prism</strong> documentation to have a better understanding on how this works:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/gg405494(v=pandp.40).aspx#sec12">Chapter 6: Advanced MVVM Scenarios, Using Interaction Request Objects</a></li>
</ul>
<p>As mentioned in the Prism documentation:  the standard <strong>EventTrigger</strong> provided by <strong>Expression Blend</strong> can be used to monitor an interaction request event by binding to the interaction request objects exposed by the view model. However, the Prism Library defines a custom <strong>EventTrigger</strong>, named <strong>InteractionRequestTrigger</strong>, which automatically connects to the appropriate <strong>Raised</strong> event of the <strong>IInteractionRequest</strong> interface. Once the event is raised, the <strong>InteractionRequestTrigger</strong> will invoke the specified action. As mentioned before, the library only provides the <strong>PopupChildWindowAction</strong> class for <strong>Silverlight</strong>, which displays a pop-up window to the user. By default, the specific type of pop-up window displayed by the <strong>PopupChildWindowAction</strong> class depends on the type of the context object (e.g for a <strong>Notification</strong> context object, a <strong>NotificationChildWindow</strong> is displayed, while for a <strong>Confirmation</strong> context object, a <strong>ConfirmationChildWindow</strong> is displayed). Unfortunately the <strong><a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.childwindow%28v=vs.95%29.aspx">ChildWindow</a></strong> class used by these objects returned to display as part of the trigger action is only available for <strong>Silverlight</strong>.</p>
<p>Hence, when I created a custom <strong>TriggerAction</strong> similar to the <strong>PopupChildWindowAction </strong><strong>provided with </strong><strong>Prism</strong><strong>, I had to change the returned type of the object to be displayed. In mi case I defined it as </strong><strong><a href="http://msdn.microsoft.com/en-us/library/system.windows.window.aspx">Window</a></strong><strong>.</strong><strong> </strong><strong>The problem was that as a result of this change, the displayed popups would not be modals like with the </strong><strong>ChildWindows</strong><strong> implementations. Therefore, I also changed the way the action invokes its child window, and instead of calling the </strong><strong>Window.Show()</strong><strong> method in my </strong><strong>PopupModalWindowActionBase’s Invoke </strong><strong>method I used the <a href="http://msdn.microsoft.com/en-us/library/system.windows.window.showdialog.aspx">Window.ShowDialog()</a> method, which allows showing a modal window instead.</strong></p>
<p>Basically these were all the changes I needed to obtain a similar implementation to the <strong>PopupChildWindowAction.</strong><strong> Take into account that this implementation may change depending on your personal preferences and the requirements of your scenario. Although I believe it could be considered as a starting point.</strong></p>
<h2>Sample Application</h2>
<p><a href="http://blogs.southworks.net/aadami/files/2012/05/sample.jpg"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/aadami/files/2012/05/sample_thumb.jpg" border="0" alt="sample" width="477" height="341" /></a></p>
<p>You can download the sample in my <a href="https://skydrive.live.com/#cid=7890102B5B8BC928&amp;id=7890102B5B8BC928!103" target="_blank">SkyDrive account</a>, under the name &#8220;<strong> PopupModalWindowActionSample</strong>&#8220;.</p>
<p>Note that this code is provided “AS IS” with no warranties and confers no rights.</p>
<p>I hope you find it useful!</p>
<h3><span style="color: #0000ff">Updated 2012/05/15</span></h3>
<h2><span style="color: #000080">Additional Considerations</span></h2>
<p>After reviewing this approach we realize that some considerations should be taken for some scenarios. Particularly if passing a custom view using the <strong>PopupModalWindowAction</strong>&#8216;s <strong>ChildWindow </strong>property. When doing so, you will find that you can&#8217;t show the dialog window more than once. This occurs as the view is of type window which won&#8217;t allow showing a windows once this is closed. Currently this could be achieved by creating a new custom window in the <strong>PopupModalWindowAction </strong>each time the <strong>InteractionRequest </strong>is raised, this is why the default windows implementation can be re open without problems.</p>
<p>Also if you want to keep the state of the view, this can be achieved without problems by passing the same instance of the <strong>Context object </strong>when raising the <strong>InteractionRequest</strong>.</p>
<p>Additionally, we have been thinking that a possible approach to reopen a custom window using the <strong>ChildWindow </strong>property may be possible passing a custom view to the <strong>ChildWindow </strong>property, and creating a new window each time the interaction is raised and use it to wrap the custom view as the content of this new window.</p>
<div class="feedflare">
<a href="http://feeds.southworks.net/~ff/master-feed?a=uMUNSYbPxds:TwScoajLP9A:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=uMUNSYbPxds:TwScoajLP9A:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/master-feed?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=uMUNSYbPxds:TwScoajLP9A:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/master-feed?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=uMUNSYbPxds:TwScoajLP9A:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=uMUNSYbPxds:TwScoajLP9A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/master-feed?i=uMUNSYbPxds:TwScoajLP9A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=uMUNSYbPxds:TwScoajLP9A:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/master-feed?i=uMUNSYbPxds:TwScoajLP9A:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=uMUNSYbPxds:TwScoajLP9A:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/master-feed?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/master-feed/~4/uMUNSYbPxds" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/aadami/2012/05/09/prism-interactionrequest-and-popupmodalwindowaction-for-wpf-applications/</feedburner:origLink></item>
		<item>
		<title>Big Data, Hadoop on Azure and the elephant in the room</title>
		<link>http://feeds.southworks.net/~r/master-feed/~3/pYKBHSXYkWI/</link>
		<comments>http://blogs.southworks.net/ajezierski/2012/05/08/big-data-hadoop-on-azure-and-the-elephant-in-the-room/#comments</comments>
		<pubDate>Tue, 08 May 2012 21:17:07 +0000</pubDate>
		<dc:creator>ajezierski</dc:creator>
				<category><![CDATA[Big Data]]></category>
		<category><![CDATA[Hadoop on Azure]]></category>

		<guid isPermaLink="false">http://139.91</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/ajezierski/2012/05/08/big-data-hadoop-on-azure-and-the-elephant-in-the-room/" class="more-link">read more<img src="http://blogs.southworks.net/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>Seriously.  There&#8217;s an elephant in the room, so I&#8217;ve no choice but to talk about it.  I&#8217;m new to Big Data and newer to Hadoop on Azure, so this post (and future ones as well) will serve as an introduction to the underlying concepts of big data and my experience on using Hadoop on Azure, one step at a time.</p>
<p>Big Data</p>
<p>So we generate massive amounts of data.  Massive.  Structured, not structured, from devices, from sensors, feeds, tweets, blogs, everything we do in our daily lives generate data at some point.  What do we do with it besides store it?  Ignore it?  Throw it away?  We could. But data is there for a reason.  We can extract valuable information from it.  We can discover new business insights, interesting patterns emerge, and most important we could save lives&#8230; so yes, it&#8217;s a big deal.  Ok, so we&#8217;ll leave the processing to multi-million dollar companies, they can afford it, right?  One misconception is that we need all this massive state of the art infrastructure to be able to handle big data.  We can setup nodes on affordable, commodity hardware, and achieve the same results.  Nice.  But I still need to maintain all these boxes, and they WILL fail eventually&#8230;</p>
<p>Hadoop is a scalable, hi fault tolerant open source <a href="http://hadoop.apache.org/mapreduce/" target="_blank">MapReduce</a> solution.  It runs on commodity hardware, so there is an economic advantage to it.</p>
<p>The main components of Hadoop are illustrated in the following diagram.</p>
<p><a href="http://blogs.southworks.net/ajezierski/files/2012/05/HADOOP.png"><img class="alignnone size-full wp-image-95" src="http://blogs.southworks.net/ajezierski/files/2012/05/HADOOP.png" alt="" width="326" height="246" /></a></p>
<p>HDFS: Hadoop Distributed File System.  It&#8217;s the storage mechanism used by Hadoop applications.  Amongst other things, it stores replicas of data blocks on the nodes of your cluster, aid availability, reliability, performance, etc.</p>
<p>Map Reduce.  A programming framework that allows to create mappers and reducers.  The framework will construct a set of jobs, hand them over to the nodes for processing, and keep track of them.  The map operation let&#8217;s you take the processing to where the data is stored in the distributed file system.  The reduce operation summarizes the results from the mappers.</p>
<p>Hive: it provides a few things, such as the possibility to create a structure for data through the use of tables.  It also defines a SQL oriented language (QL, or Hive QL), in other words, MapReduce for mortals.  The magic behind this is that a Hive query can be translated to a MapReduce job, and present the results back to the user.  The need for Hive appeared because creating a relatively simple query in plain MapReduce jobs resulted in a cumbersome coding experience.</p>
<p>Sqoop: Bridge between the Hadoop and the relational world.  Because we also live in a relational world, right?  We can import data from SQL Server, let Sqoop store the data in HDFS, and make the data available for our MapReduce jobs as well.</p>
<p>Hadoop on Azure is Microsoft&#8217;s Hadoop distribution that runs on Windows, plus a hosting environment on Windows Azure.  I recently got invited to use the CTP version of Hadoop on Azure (I did ask for an <a href="http://www.hadooponazure.com" target="_blank">invitation</a> a few weeks ago) and started to get familiar with its features.  The huge benefit to this is that I don&#8217;t need to maintain all those nodes, I have my own cluster now, and I&#8217;m ready to handle massive amounts of data.  Tada!</p>
<p>In future posts I&#8217;ll be showing how to execute a simple MapReduce job, or how to get data from the Windows Azure Marketplace and query the data using Hive.  The following links lead you to useful resources if you are getting started with Hadoop on Azure.</p>
<p><a href="http://channel9.msdn.com/Events/TechDays/Techdays-2012-the-Netherlands/2266http://" target="_blank">Big Data, Big deal</a>, video by Gert Drapers</p>
<p><a href="http://channel9.msdn.com/Events/windowsazure/learn/Introduction-to-Hadoop-on-Windows-Azure" target="_blank">Introduction to Hadoop on Azure</a>, video by Wenming Ye</p>
<p><a href="https://www.hadooponazure.com/" target="_blank">Hadoop on Azure portal</a>, get invited!</p>
<p><a href="http://hadoop.apache.org/" target="_blank">Apache Hadoop</a></p>
<p>Happy learning</p>
<div class="feedflare">
<a href="http://feeds.southworks.net/~ff/master-feed?a=pYKBHSXYkWI:caQS46dyupI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=pYKBHSXYkWI:caQS46dyupI:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/master-feed?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=pYKBHSXYkWI:caQS46dyupI:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/master-feed?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=pYKBHSXYkWI:caQS46dyupI:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=pYKBHSXYkWI:caQS46dyupI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/master-feed?i=pYKBHSXYkWI:caQS46dyupI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=pYKBHSXYkWI:caQS46dyupI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/master-feed?i=pYKBHSXYkWI:caQS46dyupI:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=pYKBHSXYkWI:caQS46dyupI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/master-feed?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/master-feed/~4/pYKBHSXYkWI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/ajezierski/2012/05/08/big-data-hadoop-on-azure-and-the-elephant-in-the-room/</feedburner:origLink></item>
		<item>
		<title>Configuring TeamCity 7 to build your VS2010 .NET project using Git repository</title>
		<link>http://feeds.southworks.net/~r/master-feed/~3/ULmtXq5hbnM/</link>
		<comments>http://blogs.southworks.net/giglesias/2012/04/27/configuring-teamcity-7-to-build-your-vs2010-net-project-using-git-repository/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 19:18:19 +0000</pubDate>
		<dc:creator>giglesias</dc:creator>
				<category><![CDATA[Continuous Integration]]></category>
		<category><![CDATA[TeamCity7]]></category>

		<guid isPermaLink="false">http://95.38</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/giglesias/2012/04/27/configuring-teamcity-7-to-build-your-vs2010-net-project-using-git-repository/" class="more-link">read more<img src="http://blogs.southworks.net/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>Hi everyone,</p>
<p>Recently I’ve been working with <a href="http://www.jetbrains.com/teamcity/">TeamCity 7</a> and getting involved in the continuous integration practice, so I would like to show my experience in this post.</p>
<p>For my project, “build” means the following things: compiling, checking Source Analysis, checking Code Analysis, running Unit Tests and measuring <a href="http://en.wikipedia.org/wiki/Code_coverage">Code Coverage</a>. Taking this into account, I will show you how to configure TeamCity 7 to perform all these tasks automatically in a VS2010 .NET solution, with .NET Framework 4 and a <a href="http://en.wikipedia.org/wiki/Git_(software)">Git</a> repository.</p>
<p>First of all I had to create a new project. I did this in the Administration &gt; Projects section, clicking <strong>Create new project</strong> and providing a name for it. After that, I had to create a new configuration for my project. This configuration has various “steps” to configure.</p>
<h1>Configuring General Settings</h1>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb.png" border="0" alt="image" width="1020" height="541" /></a></p>
<p>In this section I only provided a name for the new configuration. I left all the other values by default.</p>
<h1>Configuring Version Control Settings</h1>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image1.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb1.png" border="0" alt="image" width="985" height="101" /></a></p>
<p>In this section I had to specify the URL of the Git repository that I’ve been using to commit the source files of my application. To do this, I clicked <strong>Create</strong> <strong>and attach new VCS root</strong> and then, when the <strong>New VCS Root</strong> windows is displayed, I specified the URL of my repository and set the authentication method to Private Key, indicating the Private Key Path too.</p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image2.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb2.png" border="0" alt="image" width="968" height="767" /></a></p>
<p>TeamCity will be monitoring my repository according to the triggers that I specify in the build execution. On each build, TeamCity will search for changes in my repository and will execute the defined Build Steps. I will show all of this configuration in in the next sections.</p>
<h1>Configuring Build Steps</h1>
<p>This is one of the most important parts of the configuration process, because Build Steps are the actions that will be executed when a new build runs. In my configuration, I had to create 3 Build Steps as shown in the following picture:</p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image3.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb3.png" border="0" alt="image" width="862" height="240" /></a></p>
<h2>Step 1 – Source Analysis, Compilation and Code Analysis</h2>
<p>This step will use a MSBuild runner with a ciserver.proj build file that resides inside the repository of the project. This build file has all the routines to check Source Analysis, Code Analysis and perform the compilation.</p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image4.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb4.png" border="0" alt="image" width="852" height="513" /></a></p>
<h4>Ciserver.proj file</h4>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image5.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb5.png" border="0" alt="image" width="926" height="788" /></a></p>
<p><strong>IMPORTANT:</strong> In order to successfully run this build file, you need to have <a href="http://stylecop.codeplex.com/releases/view/79972">Stylecop</a> and <a href="http://msbuildextensionpack.codeplex.com/">MSBuild Extension Pack</a> installed in the Server machine.</p>
<p>I defined all the paths to the working directory, FxCop and the Extension Pack at the beginning (they should be environment variables provided by TeamCity), so they can be passed to the tasks that are executed after that. In the ItemGroup tag I specified all the source code files in the repository, the assemblies to take into account, the rules to include, the soulution files and the ones that I want StyleCop to include in the checking.</p>
<ul>
<li><strong>RunSourceAnalysis task</strong>: It depends on the StyleCop.dll assembly of the MSBuild extension pack. This task will take the files defined in the ItemGroup section and the Settings.Stylecop specified and will perform the check generating a log file with all the information of the execution.</li>
<li><strong>Compile task</strong>: It will perform the compilation of the solution. Notice that it depends on the RunCodeAnalysis task.</li>
<li><strong>RunCodeAnalysis task</strong>: It will check Code Analysis in the assemblies defined in the ItemGroup section, and generate the results in a txt file. It also depends on the Compile task.</li>
</ul>
<p>All the result files generated by StyleCop and FxCop will then be used to show the Code Metrics reports in the TeamCity UI. I will show how to do this at the end of the post.</p>
<h2>Step 2 – Run tests</h2>
<p>This step will use MSTest runner with the Local.testsettings and test-metadata (.vsmdi) files generated by Visual Studio. In the test-metadata file I included the list of tests that I want the Build Process to execute.</p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image6.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb6.png" border="0" alt="image" width="795" height="660" /></a></p>
<p>All the other fields are left by default.</p>
<h2>Step 3 – Measure Code Coverage</h2>
<p>For this step, I decided to execute a Build file called teamCityCodeCoverage.proj with a MSBuild runner and measure the coverage manually instead of using one of the tools that TeamCity provides (NCover, PartCover, dotCover, etc).</p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image7.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb7.png" border="0" alt="image" width="792" height="474" /></a></p>
<p>The only things that I had to provide in TeamCity were the path to the Build file, the .NET Framework used and the platform (x86 in this case). I left all the other fields by default.</p>
<h3>teamCityCodeCoverage.proj</h3>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image8.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb8.png" border="0" alt="image" width="1089" height="700" /></a></p>
<p>When the Tests were run in the previous Build Step, a sort of TestResults folder is created in a temp folder inside TeamCity path. It is the ArtifactDirectory path that is displayed in the previous image. Inside of it we have 2 important assets: The <strong>Out</strong> folder with all the assemblies of the test results, and the <strong>data.coverage</strong> file with the coverage information inside a <strong>In</strong> folder. All these stuff will be passed to the CoverageConvert.exe tool (this is an internal tool developed by the engineering excellence team), which will process them and produce a CodeCoverage.xml file with all the results of the measurement. But this is a lot of information to show in a report, so I used some assemblies to transform this xml into a html file with the summary of the Coverage.</p>
<h4>Folder with build files and Coverage tools</h4>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image9.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb9.png" border="0" alt="image" width="244" height="189" /></a></p>
<p><strong>NOTE:</strong> The disadvantage of measuring Code Coverage like this is that these assemblies have no maintenance and are a blackbox, although they were developed here in Southworks.</p>
<h1>Configuring Build Failure Conditions</h1>
<p>In this section you can specify when the Build should fail. Notice that you can add custom Build Conditions apart from the ones provided by TeamCity. In my case, I added two build failure conditions when there are Source Analysis or Code Analysis violations. Basically in the ciserver.proj file I show a status message when the check of Code Analysis and Source Analysis finishes. This will be printed in the Build log of TeamCity, so I added my custom failure conditions to fail the build if the status messages of Source Analysis and Code Analysis in the Build log of TeamCity are failure.</p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image10.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb10.png" border="0" alt="image" width="943" height="372" /></a></p>
<h1>Configuring Build Triggers</h1>
<p>In this section you can specify the triggering of the Build Process. In this case, I decided that the build process should start after a new commit is detected in the Git repository, so I chose a VCS trigger.</p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image11.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb11.png" border="0" alt="image" width="1098" height="232" /></a></p>
<h1>How to Show the Code Metrics Reports in the TeamCity UI</h1>
<p>TeamCity 7 provides <a href="http://confluence.jetbrains.com/display/TCD7/Including+Third-Party+Reports+in+the+Build+Results?pageVersion=5">custom report tags</a>. These ones are useful to show reports generated by other tools, like in this case, Source Analysis, Code Analysis and Code Coverage. To make this happen, we have to store these 3 reports as <a href="http://confluence.jetbrains.net/display/TCD7/Build+Artifact">artifacts</a> from the build.</p>
<p>To do this, we specify the path to these files in the General Settings section of the Project Configuration Wizard.</p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image12.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb12.png" border="0" alt="image" width="984" height="465" /></a></p>
<p>After that, we will create a new report tag for each report, and retrieve the report from the artifacts generated by the last successful build. To do this, click <strong>Administration</strong> at the top right corner, click <strong>your project’s name</strong> and the click the <strong>Report tabs</strong> tab. There you can create all the tabs that you want, specifying the build which the artifacts will be taken from, and the file names. These artifacts will be taken from the data-directory path of TeamCity, in this case, under UsersUser.BuildServer7systemartifacts{projectname}….{file-name}.</p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image13.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb13.png" border="0" alt="image" width="1135" height="216" /></a></p>
<p>Then, you can see the new tabs in the Project’s Home page, displaying the required reports.</p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image14.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb14.png" border="0" alt="image" width="674" height="189" /></a><a href="http://blogs.southworks.net/giglesias/files/2012/04/image15.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb15.png" border="0" alt="image" width="834" height="194" /></a></p>
<p><a href="http://blogs.southworks.net/giglesias/files/2012/04/image16.png"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/giglesias/files/2012/04/image_thumb16.png" border="0" alt="image" width="1025" height="366" /></a></p>
<p>I know that the Code Analysis report is not very consumable, but I will show another alternatives for reporting it in another post.</p>
<p>I hope that you find all this information useful!</p>
<p>Thanks!</p>
<div class="feedflare">
<a href="http://feeds.southworks.net/~ff/master-feed?a=ULmtXq5hbnM:0D7XgNwQP8k:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=ULmtXq5hbnM:0D7XgNwQP8k:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/master-feed?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=ULmtXq5hbnM:0D7XgNwQP8k:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/master-feed?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=ULmtXq5hbnM:0D7XgNwQP8k:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=ULmtXq5hbnM:0D7XgNwQP8k:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/master-feed?i=ULmtXq5hbnM:0D7XgNwQP8k:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=ULmtXq5hbnM:0D7XgNwQP8k:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/master-feed?i=ULmtXq5hbnM:0D7XgNwQP8k:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=ULmtXq5hbnM:0D7XgNwQP8k:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/master-feed?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/master-feed/~4/ULmtXq5hbnM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/giglesias/2012/04/27/configuring-teamcity-7-to-build-your-vs2010-net-project-using-git-repository/</feedburner:origLink></item>
		<item>
		<title>Blog moved to woloski.com</title>
		<link>http://feeds.southworks.net/~r/master-feed/~3/xw0Tr1EISdA/</link>
		<comments>http://blogs.southworks.net/mwoloski/2012/04/26/blog-moved-to-woloski-com/#comments</comments>
		<pubDate>Fri, 27 Apr 2012 02:36:19 +0000</pubDate>
		<dc:creator>Matias Woloski</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://24.741</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/mwoloski/2012/04/26/blog-moved-to-woloski-com/" class="more-link">read more<img src="http://blogs.southworks.net/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<h2>NEW URL</h2>
<h2><a href="http://woloski.com">http://woloski.com</a></h2>
<h2>NEW RSS </h2>
<h2><a href="http://feeds.feedburner.com/woloski">http://feeds.feedburner.com/woloski</a></h2>
<div class="feedflare">
<a href="http://feeds.southworks.net/~ff/master-feed?a=xw0Tr1EISdA:eiNxv_3Fg9w:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=xw0Tr1EISdA:eiNxv_3Fg9w:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/master-feed?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=xw0Tr1EISdA:eiNxv_3Fg9w:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/master-feed?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=xw0Tr1EISdA:eiNxv_3Fg9w:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=xw0Tr1EISdA:eiNxv_3Fg9w:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/master-feed?i=xw0Tr1EISdA:eiNxv_3Fg9w:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=xw0Tr1EISdA:eiNxv_3Fg9w:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/master-feed?i=xw0Tr1EISdA:eiNxv_3Fg9w:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=xw0Tr1EISdA:eiNxv_3Fg9w:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/master-feed?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/master-feed/~4/xw0Tr1EISdA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/mwoloski/2012/04/26/blog-moved-to-woloski-com/</feedburner:origLink></item>
		<item>
		<title>Prism: Using CompositeCommands, DelegateCommands and IActiveAware</title>
		<link>http://feeds.southworks.net/~r/master-feed/~3/QEnWUK2nnho/</link>
		<comments>http://blogs.southworks.net/aadami/2012/04/24/prism-using-compositecommands-delegatecommands-and-iactiveaware/#comments</comments>
		<pubDate>Tue, 24 Apr 2012 20:57:54 +0000</pubDate>
		<dc:creator>aadami</dc:creator>
				<category><![CDATA[Prism]]></category>

		<guid isPermaLink="false">http://133.153</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/aadami/2012/04/24/prism-using-compositecommands-delegatecommands-and-iactiveaware/" class="more-link">read more<img src="http://blogs.southworks.net/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>Hi everybody,</p>
<p>Recently I found that these topics were often discussed in the Prism forum and, although there are samples already using these features provided by Prism as out of the box (e.g. <a href="http://msdn.microsoft.com/en-us/library/ff921082">Commanding Quickstart</a> and <a href="http://msdn.microsoft.com/en-us/library/ff921074%28v=pandp.40%29.aspx">Stock Trader Reference Implementation</a>.) I thought that a small sample portraying all these functionalities together could become handy, especially one that shows the different behaviors of <strong>CompositeCommands</strong> (e.g. with and without the <strong>monitorCommandActivity</strong> parameter).</p>
<h2>Introduction</h2>
<p>As many of you might have read from the <a href="http://msdn.microsoft.com/en-us/library/gg406140.aspx">Prism documentation</a>, <strong>CompositeCommands</strong> can be connected to several child commands so that when a <strong>CompositeCommand</strong> is invoked, its child commands are also invoked. Also, these commands support enablement, as they can listen to the <strong>CanExecuteChanged</strong> event of each one of its child commands. This way, when any call to the <strong>CanExecute</strong> method of the child commands returns false, the <strong>CompositeCommand’s CanExecute </strong>method will also return false and the corresponding invoker will be disabled.</p>
<p>Additionally, if its child commands implements the <strong>IActiveAware</strong> interface, the <strong>CompositeCommands</strong> provide the possibility to only execute and evaluate the corresponding <strong>Execute</strong> and <strong>CanExecute</strong> methods of the child commands that have its <strong>IsActive</strong> property set to true.</p>
<p><strong>CompositeCommands</strong> can be configured to evaluate the active status of child commands (in addition to the <strong>CanExecute</strong> status) by specifying true to the <strong>monitorCommandActivity</strong> parameter in the constructor. In those cases <strong>DelegateCommands</strong> will become handy as they already implement the <strong>IActiveAware</strong> interface.</p>
<p>Basically, I created this sample with the purpose to highlight  the different possibilities that could be achieved when benefiting from these available functionalities.</p>
<h2>Sample Application</h2>
<p><a href="http://blogs.southworks.net/aadami/files/2012/04/pic.jpg"><img style="padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/aadami/files/2012/04/pic_thumb.jpg" border="0" alt="pic" width="438" height="308" /></a></p>
<p>The Solution is a small application, that contains a shell project, one module and an infrastructure project.</p>
<p>There you can find that the module’s <strong>Initialize </strong>method registers two views in a region which is attached to a <strong>ListBox</strong> control in the shell. As their view model implements the <strong>IActiveAware</strong> interface, when one view is selected their active state is changed accordingly. Particularly, I decided to use a <strong>ListBox</strong> as the region placeholder, so it could be possible to appreciate the state of the different views displayed in the region simultaneously, although it could be easily replaced with any control that inherits from the <strong>Selector </strong>class.</p>
<p>Each of these views contain a pair of buttons which are bound to its corresponding <strong>DelegateCommand</strong> and they also contain a <strong>CheckBox</strong> which will allow to select the returned value of each <strong>CanExecute</strong> method in order to appreciate the different behaviors when those values are changed.</p>
<p>All these inner buttons&#8217; <strong>DelegateCommands</strong> will be registered as child commands of the two <strong>CompositeCommands</strong> that are defined as static classes in the <strong>Infrastructure</strong> project so they could become globally available. One of them (<strong>GlobalCommands.MyGlobalCommand</strong>) sets its <strong>monitorCommandActivity</strong> parameter value to <strong>true</strong> and the other one (<strong>GlobalCommands.MyResetCommand</strong>) sets it to <strong>false</strong>.</p>
<p>You can download the sample application from my <a href="https://skydrive.live.com/#cid=7890102B5B8BC928&amp;id=7890102B5B8BC928!103">SkyDrive account</a>, under the name &#8220;<strong>CompositeCommand&amp;IActiveAware</strong>&#8220;.</p>
<p>Note that this code is provided “AS IS” with no warranties and confers no rights.</p>
<p>I hope you find it useful!</p>
<div class="feedflare">
<a href="http://feeds.southworks.net/~ff/master-feed?a=QEnWUK2nnho:AAfvyoExFII:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=QEnWUK2nnho:AAfvyoExFII:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/master-feed?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=QEnWUK2nnho:AAfvyoExFII:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/master-feed?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=QEnWUK2nnho:AAfvyoExFII:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=QEnWUK2nnho:AAfvyoExFII:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/master-feed?i=QEnWUK2nnho:AAfvyoExFII:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=QEnWUK2nnho:AAfvyoExFII:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/master-feed?i=QEnWUK2nnho:AAfvyoExFII:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=QEnWUK2nnho:AAfvyoExFII:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/master-feed?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/master-feed/~4/QEnWUK2nnho" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/aadami/2012/04/24/prism-using-compositecommands-delegatecommands-and-iactiveaware/</feedburner:origLink></item>
		<item>
		<title>Sync active state when adding views</title>
		<link>http://feeds.southworks.net/~r/master-feed/~3/UpEEnxsKQt4/</link>
		<comments>http://blogs.southworks.net/dcherubini/2012/04/19/sync-active-state-when-adding-views/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 16:38:32 +0000</pubDate>
		<dc:creator>dcherubini</dc:creator>
				<category><![CDATA[Prism]]></category>
		<category><![CDATA[Prism 4.1]]></category>

		<guid isPermaLink="false">http://90.42</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/dcherubini/2012/04/19/sync-active-state-when-adding-views/" class="more-link">read more<img src="http://blogs.southworks.net/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>Hi everybody,</p>
<p>Since the version<strong> 4.1</strong> of <a href="http://compositewpf.codeplex.com/">Prism</a>, the <strong>RegionActiveAwareBehavior</strong> has been modified to be able to sync the state (that is, the <strong>IsActive </strong>property of the <strong>IActiveAware </strong>interface) of &#8220;child&#8221; <em><strong>views </strong></em>and <em><strong>view models</strong></em> with their parents through the inclusion of the <strong>SyncActiveState </strong>attribute. However, a user in the following <a href="http://compositewpf.codeplex.com/workitem/8061">work item</a> has posted that this behavior fails when adding views &#8220;at start-up&#8221; (for example, in the <strong>Initialize </strong>method of an <strong>IModule </strong>class.) We were able to reproduce the problem, find the cause behind it and implement a possible workaround for it:</p>
<h2 style="margin: 40px 0px 0px"><span style="color: #4488cc">How the RegionActiveAwareBehavior works</span></h2>
<p>Based on my understanding, the <strong>RegionActiveAwareBehavior </strong>subscribes to the <strong>CollectionChanged </strong>event of the <strong>ActiveViews</strong> collection of the corresponding <strong>Region</strong>. When the aforementioned collection is changed, the behavior changes the state of the views that are added or removed from the collection. This means that this behavior only executes its logic when a view is <strong>activated </strong>or <strong>deactivated</strong>.</p>
<p>Through the inclusion of the <strong>SyncActiveState </strong>attribute, during the state change, this behavior now also checks for any scoped views with the aforementioned attribute and set its state too.</p>
<h2 style="margin: 40px 0px 0px"><span style="color: #4488cc">The problem</span></h2>
<p>It seems that the aforementioned logic does not take into account one scenario: when a view is added to a region. For example, it is possible to add a &#8220;<em><strong>child view</strong></em>&#8221; into a &#8220;<em><strong>parent view</strong></em>&#8221; that is deactivated. In this case, as the <strong>ActiveViews </strong>collection would not be modified, the logic in the <strong>RegionActiveAwareBehavior </strong>will not execute. As a  result the value of the parent view&#8217;s <strong>IsActive</strong> property would be <strong>false </strong>while the value in the child view&#8217;s property could be <strong>true</strong>.</p>
<p>A quick work around for this could be to <strong>activate </strong>and <strong>deactivate </strong>all the views in the corresponding region in order to update the state of all the views. However, activating and deactivating all the views each time a view is added to a region might be bothersome, especially if any of those view or their corresponding view models perform some kind of logic when activated.</p>
<p>As another possible approach to solve this, I have created a behavior named <strong>RegionActiveAwareSyncOnAdditionBehavior </strong>that complements the existing <strong>RegionActiveAwareBehavior</strong>.</p>
<h2 style="margin: 40px 0px 0px"><span style="color: #4488cc">RegionActiveAwareSyncOnAdditionBehavior</span></h2>
<p>This behavior has a similar logic to the <strong>RegionActiveAwareBehavior </strong>but performs a different task. Instead of subscribing to the changes in the <strong>ActiveViews </strong>collection, this behavior subscribes to the <strong>Views </strong>collection of the region, meaning that it will be notified when any view is added to the region. When a view is added to the region, the behavior check if it&#8217;s decorated with the <strong>SyncActiveState </strong>attribute. If so, the behavior then searches for a parent view or view model that implements the <strong>IActiveAware</strong> interface. If a parent is found, the value of the <strong>IsActive </strong>property of the added view is changed to match the one of its parent.</p>
<div style="color: black;background-color: white">
<pre><span style="color: blue">private</span> <span style="color: blue">void</span> OnViewsCollectionChanged(<span style="color: blue">object</span> sender, NotifyCollectionChangedEventArgs e)
{
    <span style="color: blue">if</span> (e.Action == NotifyCollectionChangedAction.Add)
    {
        <span style="color: blue">foreach</span> (<span style="color: blue">var</span> view <span style="color: blue">in</span> e.NewItems)
        {
            <span style="color: green">// We only sync the state of the view if it's an active view in its corresponding region</span>
            <span style="color: blue">if</span> (<span style="color: blue">this</span>.Region.ActiveViews.Contains(view))
            {
                <span style="color: blue">if</span> (ShouldSyncActiveState(view))
                {
                    IActiveAware parent = FindIActiveAwareParent(view <span style="color: blue">as</span> DependencyObject);
                    <span style="color: blue">if</span> (parent != <span style="color: blue">null</span>)
                    {
                        InvokeOnActiveAwareElement(view, activeAware =&gt; activeAware.IsActive = parent.IsActive);
                    }
                }
            }
        }
    }
}</pre>
</div>
<p>The <strong>ShouldSyncActiveState </strong>and <strong>InvokeOnActiveAwareElement </strong>methods used in the aforementioned code snippet are the same that the ones used in the <strong>RegionActiveAwareBehavior</strong>.</p>
<p>The question now is how the <strong>FindIActiveAwareParent </strong>method find the corresponding parent. The answer is simple: this method uses a modified version of the same logic used by the <strong>RegionManagerRegistrationBehavior </strong>to find the corresponding <strong>RegionManager</strong>, only that this method searches for <strong>IActiveAware </strong>elements instead:</p>
<div>
<pre><span style="color: blue">protected</span> <span style="color: blue">static</span> IActiveAware FindIActiveAwareParent(DependencyObject element)
{
    <span style="color: blue">if</span> (element == <span style="color: blue">null</span>)
    {
        <span style="color: blue">return</span> <span style="color: blue">null</span>;
    }

    DependencyObject parent = <span style="color: blue">null</span>;

<span style="color: blue">#if</span> SILVERLIGHT
    FrameworkElement frameworkElement = element <span style="color: blue">as</span> FrameworkElement;
    <span style="color: blue">if</span> (frameworkElement != <span style="color: blue">null</span>)
    {
        parent = frameworkElement.Parent;
    }

<span style="color: blue">#else</span>
    parent = LogicalTreeHelper.GetParent(element);

<span style="color: blue">#endif</span>

    <span style="color: blue">if</span> (parent == <span style="color: blue">null</span>)
    {
        <span style="color: blue">return</span> <span style="color: blue">null</span>;
    }

    <span style="color: green">// We check if the parent control implements IActiveAware</span>
    IActiveAware activeAwareParent = parent <span style="color: blue">as</span> IActiveAware;
    <span style="color: blue">if</span> (activeAwareParent != <span style="color: blue">null</span>)
    {
        <span style="color: blue">return</span> activeAwareParent;
    }

    <span style="color: green">// If not, we check if the parent control's data context implements IActiveAware</span>
    FrameworkElement parentFrameworkElement = parent <span style="color: blue">as</span> FrameworkElement;
    <span style="color: blue">if</span> (parentFrameworkElement != <span style="color: blue">null</span>)
    {
        IActiveAware activeAwareParentDataContext = parentFrameworkElement.DataContext <span style="color: blue">as</span> IActiveAware;
        <span style="color: blue">if</span> (activeAwareParentDataContext != <span style="color: blue">null</span>)
        {
            <span style="color: blue">return</span> activeAwareParentDataContext;
        }
    }

    <span style="color: green">// If none of the two implements IActiveAware, we keep climbing the tree.</span>
    <span style="color: blue">return</span> FindIActiveAwareParent(parent);
}</pre>
</div>
<p>You can find the behavior inside a sample at the end of this post. As a side note, I believe that this behavior and the <strong>RegionActiveAwareBehavior </strong>could be merged into one without problems; however, as they have a different logic, I am posting it as a different behavior (which depends of the original one to work) in order to make its code more readable.</p>
<h2 style="margin: 40px 0px 0px"><span style="color: #4488cc">Sample</span></h2>
<p>The sample application is very simple. The behavior is registered in the <strong>Bootstrapper </strong>overriding the <strong>ConfigureDefaultRegionBehaviors </strong>method:</p>
<div>
<pre><span style="color: blue">protected</span> <span style="color: blue">override</span> IRegionBehaviorFactory ConfigureDefaultRegionBehaviors()
{
    IRegionBehaviorFactory factory = <span style="color: blue">base</span>.ConfigureDefaultRegionBehaviors();

    factory.AddIfMissing(RegionActiveAwareSyncOnAdditionBehavior.BehaviorKey, <span style="color: blue">typeof</span>(RegionActiveAwareSyncOnAdditionBehavior));

    <span style="color: blue">return</span> factory;
}</pre>
</div>
<p>The <strong>Shell </strong>contains a <em><strong>MainRegion </strong></em>which is a <strong>TabControl</strong>. During the initialization of the <strong>HelloWorlModule </strong>five instances of a view containing a scoped region (named &#8220;<em><strong>SubRegion</strong></em>&#8220;) that implement <strong>IActiveAware </strong>are injected in that region. Also, in each of those scoped regions, another view implementing <strong>IActiveAware </strong>and decorated with <strong>SyncActiveState </strong>attribute is injected.</p>
<div>
<pre><span style="color: blue">public</span> <span style="color: blue">void</span> Initialize()
{
    IRegion mainRegion = <span style="color: blue">this</span>.regionManager.Regions[<span style="color: #a31515">"MainRegion"</span>];

    <span style="color: blue">for</span> (<span style="color: blue">int</span> i = 0; i &lt; 5; i++)
    {
        FrameworkElement view = ServiceLocator.Current.GetInstance&lt;Views.ScopedRegionView&gt;();
        IRegionManager scopedManager = mainRegion.Add(view, <span style="color: blue">null</span>, <span style="color: blue">true</span>);

        FrameworkElement subView = ServiceLocator.Current.GetInstance&lt;Views.SubView&gt;();
        scopedManager.Regions[<span style="color: #a31515">"SubRegion"</span>].Add(subView);
    }
}</pre>
</div>
<p>The application&#8217;s <strong>Shell </strong>has a &#8220;<em><strong>Check Views&#8217; States</strong></em>&#8221; button that when clicked will write in the console the state of each view (you can find its output in the <strong>Output </strong>window of <strong>Visual Studio</strong>.) You will see that the state of each view is now synchronized.</p>
<p>You can find the sample in my <strong>SkyDrive </strong>account:</p>
<ul>
<li><a href="https://skydrive.live.com/?ppud=4#cid=99307B6105BC060D&amp;id=99307B6105BC060D!107">RegionActiveAwareSyncOnAdditionBehaviorSample.zip</a></li>
</ul>
<p>I hope that you find it useful!</p>
<div style="background-color: #aaaaaa"><em><strong><span style="color: #ff0000">Note</span>:</strong> This code is provided “AS IS” with no warranties and confers no rights. The behavior portraying in this blog post has not been tested in all scenarios and it&#8217;s unknown if it might cause an unexpected behavior in some applications. </em></div>
<div class="feedflare">
<a href="http://feeds.southworks.net/~ff/master-feed?a=UpEEnxsKQt4:jWXmVKc30a4:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UpEEnxsKQt4:jWXmVKc30a4:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/master-feed?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UpEEnxsKQt4:jWXmVKc30a4:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/master-feed?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UpEEnxsKQt4:jWXmVKc30a4:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UpEEnxsKQt4:jWXmVKc30a4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/master-feed?i=UpEEnxsKQt4:jWXmVKc30a4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UpEEnxsKQt4:jWXmVKc30a4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/master-feed?i=UpEEnxsKQt4:jWXmVKc30a4:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UpEEnxsKQt4:jWXmVKc30a4:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/master-feed?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/master-feed/~4/UpEEnxsKQt4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/dcherubini/2012/04/19/sync-active-state-when-adding-views/</feedburner:origLink></item>
		<item>
		<title>Microsoft Media Platform Video Editor (former RCE) 2.0 – Silverlight 5 Refresh released</title>
		<link>http://feeds.southworks.net/~r/master-feed/~3/9PNdmsgbOAA/</link>
		<comments>http://blogs.southworks.net/ejadib/2012/04/12/microsoft-media-platform-video-editor-former-rce-2-0-%e2%80%93-silverlight-5-refresh-released/#comments</comments>
		<pubDate>Thu, 12 Apr 2012 17:20:00 +0000</pubDate>
		<dc:creator>Ezequiel Jadib</dc:creator>
				<category><![CDATA[Adaptive Streaming]]></category>
		<category><![CDATA[CSM]]></category>
		<category><![CDATA[Composite Stream Manifest]]></category>
		<category><![CDATA[Live Smooth Streaming]]></category>
		<category><![CDATA[MMP Video Editor]]></category>
		<category><![CDATA[Media]]></category>
		<category><![CDATA[Microsoft Media Platform]]></category>
		<category><![CDATA[RCE]]></category>
		<category><![CDATA[Rough Cut Editing]]></category>
		<category><![CDATA[SSME]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Silverlight 5]]></category>
		<category><![CDATA[Smooth Streaming]]></category>
		<category><![CDATA[Smooth Streaming Media Element]]></category>
		<category><![CDATA[Prism]]></category>

		<guid isPermaLink="false">http://17.309</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/ejadib/2012/04/12/microsoft-media-platform-video-editor-former-rce-2-0-%e2%80%93-silverlight-5-refresh-released/" class="more-link">read more<img src="http://blogs.southworks.net/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p><img style="display: inline; float: right" align="right" src="http://blogs.southworks.net/dschenkelman/files/2011/10/image1.png" width="279" height="138">Heads up! A refresh of the MMP Video Editor 2.0 <a href="http://archive.msdn.microsoft.com/VideoEditor/Release/ProjectReleases.aspx?ReleaseId=5852">was released</a> today. This release doesn’t contain any new feature and is just a refresh to use the latest Silverlight 5.</p>
<p>The <a href="http://blogs.southworks.net/dschenkelman/2011/10/03/microsoft-media-platform-video-editor-former-rce-2-0-just-released/">2.0 release</a> was built using the Silverlight 5 Beta bits, which already expired so some users were getting the message <em>&#8220;This application was created for an expired beta release of Silverlight. Please contract the owner of this application and have them upgrade their application using an official release of Silverlight&#8221; </em>when trying to use the application.</p>
<p>Happy editing,</p>
<p>Ez.</p>
<div class="feedflare">
<a href="http://feeds.southworks.net/~ff/master-feed?a=9PNdmsgbOAA:AjA2IW1iEWE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=9PNdmsgbOAA:AjA2IW1iEWE:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/master-feed?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=9PNdmsgbOAA:AjA2IW1iEWE:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/master-feed?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=9PNdmsgbOAA:AjA2IW1iEWE:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=9PNdmsgbOAA:AjA2IW1iEWE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/master-feed?i=9PNdmsgbOAA:AjA2IW1iEWE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=9PNdmsgbOAA:AjA2IW1iEWE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/master-feed?i=9PNdmsgbOAA:AjA2IW1iEWE:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=9PNdmsgbOAA:AjA2IW1iEWE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/master-feed?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/master-feed/~4/9PNdmsgbOAA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/ejadib/2012/04/12/microsoft-media-platform-video-editor-former-rce-2-0-%e2%80%93-silverlight-5-refresh-released/</feedburner:origLink></item>
		<item>
		<title>Service Bus Topics and Synchronizing Data</title>
		<link>http://feeds.southworks.net/~r/master-feed/~3/UwbOxg_2aCc/</link>
		<comments>http://blogs.southworks.net/ajezierski/2012/04/11/service-bus-topics-and-syncrhonizing-data/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 21:29:34 +0000</pubDate>
		<dc:creator>ajezierski</dc:creator>
				<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Data Sync]]></category>
		<category><![CDATA[Service Bus]]></category>
		<category><![CDATA[Service Bus Topics]]></category>

		<guid isPermaLink="false">http://139.64</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/ajezierski/2012/04/11/service-bus-topics-and-syncrhonizing-data/" class="more-link">read more<img src="http://blogs.southworks.net/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>I am probably going to compare apples and oranges in this post, with a slight bias towards oranges.  Yes, I like fruit.  I also like <a href="http://msdn.microsoft.com/en-us/library/hh456371.aspx" target="_blank">SQL Azure Data Sync</a> and how it makes data synchronization tasks a breeze.  You  install your agent, register your database, go to the portal, setup your sync groups, conflict resolution and you are ready to go.  Eventually (if you set things up right) data you need will be synchronized from cloud to cloud, cloud to on premise&#8230;  Awesome.</p>
<p>As it turns out, I also like <a href="http://msdn.microsoft.com/en-us/library/windowsazure/ee732537.aspx" target="_blank">Service Bus</a>, and the powerful features it provides to build distributed applications, aid transactional behavior, etc.</p>
<p>In our scenario we have a company that runs an online store in all six Windows Azure data centers (how romantic), and, through Traffic Manager, the users can get routed anywhere.  How do we deal with the challenge of data consistency? Well, we can use Data Sync, for sure, but what if we are in a more restrictive scenario?  What if  we are not allowed to make changes to the database?  Well, the Data Sync option quickly fades away, doesn&#8217;t it?  Part of Data Sync&#8217;s magic consists of installing a Windows Service and a number of tables in your database to keep track of changes.  Busted.</p>
<p><a href="http://blogs.southworks.net/ajezierski/files/2012/04/datasync.png"><img class="alignnone size-full wp-image-69" src="http://blogs.southworks.net/ajezierski/files/2012/04/datasync.png" alt="" width="230" height="82" /></a></p>
<p>So, how do we go about solving this problem?  I will go down the path of  Service Bus topics and subscriptions to comply with our restriction.  I choose Service Bus because we are already working with Windows Azure,  I&#8217;ve seen it in action, been working with it for the last couple of months and know that I can find a relatively simple way to manage this.  It&#8217;ll be wholesome to discuss other options as well.</p>
<p>This is a high level diagram of the idea</p>
<p><a href="http://blogs.southworks.net/ajezierski/files/2012/04/sync.png"><img class="alignnone size-full wp-image-70" src="http://blogs.southworks.net/ajezierski/files/2012/04/sync.png" alt="" width="618" height="462" /></a></p>
<p>Our beloved customer places an order through any of the data centers.  Because the user can see his own orders, and because he might get routed by Traffic Manager to another data center, we need to have that information available everywhere, eventually.</p>
<p>We create a topic (let&#8217;s call it SyncTopic) in our favorite data center.  Just one (let&#8217;s add a budget restriction while we are at it, and a little bit of <a href="http://en.wikipedia.org/wiki/KISS_principle" target="_blank">KISS</a>). We create one subscription per data center, and we&#8217;ll have our SyncListener component running in each cloud subscribe to that topic.  The SyncListener will be responsible for writing the orders to the database.  Insert only, it makes the story easier  (that would depend on how we designed our data model, of course)</p>
<p>Every time a customer places an order, the SyncSender component (a separate worker role or a new task running in a worker role &#8211; you choose) posts a message to the topic, a copy of the order.  Each SyncListener will receive a copy of the message and perform the corresponding write operation to the db.  That is the big picture.</p>
<p><strong>Implementation considerations.</strong></p>
<p>This is all very nice if we draw it on paper, but we need to be sure that we are tackling other concerns, for example, and in no particular order of importance&#8230;</p>
<p><strong>Sync loops:</strong> because the data center where the order originated also contains a SyncListener, it could potentially receive a copy of the order it already has.  We can avoid this by implementing a filter on the subscription, and filling the corresponding property in the BrokeredMessage.  The filter (a SQLFilter why not) can be something like  SenderDataCenter != ListeningDataCenter.</p>
<p><strong>Conflict Resolution:</strong> we need to be covered here as well.  The path we choose will depend on our given context and might even take us back to square one.</p>
<p><strong>Transactional Behavior:</strong> We would have to use the PeekLock mode to receive messages for starters, and we would have to have a supervising mechanism to deal with transient failures, we can also use <a href="http://msdn.microsoft.com/en-us/library/hh680934%28v=pandp.50%29.aspx" target="_blank">Topaz</a>.  Consider using the dead letter queue as well if something goes wrong when receiving the message.</p>
<p><strong>Message size:</strong> What if our BrokeredMessage exceeds its size?  We need to consider another mechanism to get the required data through.  Maybe storing it in blob storage, and then passing a reference in the message for the listener to pick up.  The story gets complicated, but it could happen.</p>
<p><strong>Security:</strong> Although the topic and subscriptions are used internally, it is always a good idea to secure them.  With ACS we can easily secure the edges.</p>
<p><strong>Hybridness:</strong> now we need all the orders data on premise (wait, don&#8217;t we have that already? oops).  By setting up  a new subscription, and a SyncListener on premise we can now get a copy of the data.</p>
<p>and probably others&#8230;</p>
<p><strong>Conclusion</strong></p>
<p>We can go about it many ways.  Data Sync is simple and quick to setup.  We don&#8217;t have 100% control over it, but it gets the job done.   As our context changes, so does our need of considering other possibilities where we need greater control over things.  I am aware that this idea can trigger LOTS of other considerations I haven&#8217;t mentioned. Consider this post not as a definitive solution, but as a starting point to a fun discussion.</p>
<p>Happy Learning!</p>
<div class="feedflare">
<a href="http://feeds.southworks.net/~ff/master-feed?a=UwbOxg_2aCc:c1sj2HSxfnY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UwbOxg_2aCc:c1sj2HSxfnY:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/master-feed?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UwbOxg_2aCc:c1sj2HSxfnY:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/master-feed?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UwbOxg_2aCc:c1sj2HSxfnY:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UwbOxg_2aCc:c1sj2HSxfnY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/master-feed?i=UwbOxg_2aCc:c1sj2HSxfnY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UwbOxg_2aCc:c1sj2HSxfnY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/master-feed?i=UwbOxg_2aCc:c1sj2HSxfnY:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=UwbOxg_2aCc:c1sj2HSxfnY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/master-feed?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/master-feed/~4/UwbOxg_2aCc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/ajezierski/2012/04/11/service-bus-topics-and-syncrhonizing-data/</feedburner:origLink></item>
		<item>
		<title>Using the Windows Phone Storage NuGets for Windows Azure (Video)</title>
		<link>http://feeds.southworks.net/~r/master-feed/~3/mBbdvUz5Wto/</link>
		<comments>http://blogs.southworks.net/nbello/2012/03/28/using-the-windows-phone-storage-nugets-for-windows-azure-video/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 18:07:39 +0000</pubDate>
		<dc:creator>Nicolás Bello Camilletti</dc:creator>
				<category><![CDATA[NuGet]]></category>
		<category><![CDATA[Windows Azure]]></category>
		<category><![CDATA[Windows Phone]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://116.9</guid>
		<description><![CDATA[... <a href="http://blogs.southworks.net/nbello/2012/03/28/using-the-windows-phone-storage-nugets-for-windows-azure-video/" class="more-link">read more<img src="http://blogs.southworks.net/wp-content/themes/southworks/assets/img/arrow-blue.png" width="12" height="12" alt="" /></a>]]></description>
			<content:encoded><![CDATA[<p>While working with the Windows Phone Storage NuGet packages for Windows Azure with <a href="http://blogs.southworks.net/dmartinez/">Damián Martinez Gelabert</a> and <a href="http://blogs.southworks.net/mconverti/">Mariano Converti</a>, we created a video to showcase these NuGet packages which <a href="http://www.wadewegner.com">Wade Wegner</a> publishes to <a href="http://channel9.msdn.com/posts/Using-the-Windows-Phone-Storage-NuGets-for-Windows-Azure">Channel 9</a>.</p>
<p>Topics in the video:</p>
<ul>
<li>Creating a new project, adding, and configuring the Storage NuGet package.</li>
<li>Walkthrough the Storage Sample NuGet package (Blobs, Tables and Queues).</li>
<li>Why you should use the proxies&#8217; services?</li>
<li>Installing and configuring the proxies&#8217; services.</li>
<li>Configuring your Windows Phone application to work with the proxies.</li>
<li>Using ACS with the Windows Phone Storage NuGet Packages.</li>
<li>Configuring your proxies and your Windows Phone application to use ACS.</li>
</ul>
<p>If you haven&#8217;t seen it, <a href="http://channel9.msdn.com/posts/Using-the-Windows-Phone-Storage-NuGets-for-Windows-Azure">here is your chance</a>.</p>
<p><a href="http://channel9.msdn.com/posts/Using-the-Windows-Phone-Storage-NuGets-for-Windows-Azure"><img style="margin: 0px 0px 0px 40px;padding-left: 0px;padding-right: 0px;padding-top: 0px;border: 0px" src="http://blogs.southworks.net/nbello/files/2012/03/video.png" border="0" alt="video" width="515" height="291" /></a></p>
<div class="feedflare">
<a href="http://feeds.southworks.net/~ff/master-feed?a=mBbdvUz5Wto:jiN5Kjgi-Ts:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=mBbdvUz5Wto:jiN5Kjgi-Ts:I9og5sOYxJI"><img src="http://feeds.feedburner.com/~ff/master-feed?d=I9og5sOYxJI" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=mBbdvUz5Wto:jiN5Kjgi-Ts:G79ilh31hkQ"><img src="http://feeds.feedburner.com/~ff/master-feed?d=G79ilh31hkQ" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=mBbdvUz5Wto:jiN5Kjgi-Ts:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/master-feed?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=mBbdvUz5Wto:jiN5Kjgi-Ts:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/master-feed?i=mBbdvUz5Wto:jiN5Kjgi-Ts:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=mBbdvUz5Wto:jiN5Kjgi-Ts:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/master-feed?i=mBbdvUz5Wto:jiN5Kjgi-Ts:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.southworks.net/~ff/master-feed?a=mBbdvUz5Wto:jiN5Kjgi-Ts:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/master-feed?d=qj6IDK7rITs" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/master-feed/~4/mBbdvUz5Wto" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss />
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://blogs.southworks.net/nbello/2012/03/28/using-the-windows-phone-storage-nugets-for-windows-azure-video/</feedburner:origLink></item>
	</channel>
</rss>

