<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Udooz!</title>
	<atom:link href="http://udooz.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://udooz.net/blog</link>
	<description>technologies.each { &#124;tech&#124; write_post(tech.facets) if tech.facets }</description>
	<lastBuildDate>Tue, 10 Jan 2012 19:28: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>
	<div style=" text-align: center;  margin: 8px; ">
				<script type="text/javascript">
				google_ad_client = "pub-1206499418090878";
				google_ad_width = 468;
				google_ad_height = 60;
				google_ad_format = "468x60_as";
				google_ad_type = "text_image";
				google_ad_channel = "9891546574";
				google_color_border = "#6699CC";
				google_color_bg = "#003366";
				google_color_link = "#FFFFFF";
				google_color_text = "#AECCEB";
				google_color_url = "#AECCEB";
				google_ui_features = "rc:10";
				</script>
				<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
			</div>	<item>
		<title>Partial View Auto Refresh in ASP.NET MVC3</title>
		<link>http://udooz.net/blog/2012/01/partial-view-auto-refresh-in-asp-net-mvc3/</link>
		<comments>http://udooz.net/blog/2012/01/partial-view-auto-refresh-in-asp-net-mvc3/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 19:23:08 +0000</pubDate>
		<dc:creator>udooz</dc:creator>
				<category><![CDATA[MVC 3]]></category>
		<category><![CDATA[ASP.NET MVC3]]></category>
		<category><![CDATA[auto refresh]]></category>
		<category><![CDATA[output cache]]></category>
		<category><![CDATA[partial view]]></category>
<category>ajax</category><category>ajax auto refresh</category><category>asp.net mvc3</category><category>auto refresh</category><category>auto refresh page</category><category>auto refresh web page</category><category>html auto refresh</category><category>jquery</category><category>jquery ajax post</category><category>output cache</category><category>partial view</category>
		<guid isPermaLink="false">http://udooz.net/blog/?p=351</guid>
		<description><![CDATA[Problem A partial view in ASP.NET MVC3 needs to be refreshed on every particular interval. Let us take a typical ASP.NET MVC3 application. In the HomeController, there is a action called &#8220;Quote&#8221; which displays funny software quote for every new request like below: The partial view &#8220;_Quote.cshtml&#8221; has nothing other than the code below This [...]]]></description>
			<content:encoded><![CDATA[<h2>Problem</h2>
<p>A partial view in ASP.NET MVC3 needs to be refreshed on every particular interval.</p>
<p>Let us take a typical ASP.NET MVC3 application. In the HomeController, there is a action called &#8220;Quote&#8221; which displays funny software quote for every new request like below:</p>
<pre class="brush: csharp; title: ; notranslate">
public class HomeController : Controller
{
	public static string[] quotes = {
		&quot;The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time&quot;,
		&quot;In order to understand recursion, one must first understand recursion&quot;,
		&quot;I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone.&quot;,
		&quot;The gap between theory and practice is not as wide in theory as it is in practice.&quot;,
		&quot;Nine people can’t make a baby in a month&quot;
	};

	// other actions

	public ActionResult Quote()
	{
		var r = new Random();
		var rv = r.Next(0, 4);
		ViewBag.Quote = quotes[rv];
		return PartialView(&quot;_Quote&quot;);
	}
}
</pre>
<p>The partial view &#8220;_Quote.cshtml&#8221; has nothing other than the code below</p>
<pre class="brush: xml; title: ; notranslate">

&lt;h3&gt;@ViewBag.Quote&lt;/h3&gt;
</pre>
<p>This whole thing needs to be refreshed without any user interaction on every 10 seconds</p>
<h2>Solution</h2>
<p>Use setInterval() at client side and set up OutputCacheAttribute on the respective action. The duration should be same on both side.</p>
<p>In the corresponding script of this view, place the below JavaScript:</p>
<pre class="brush: jscript; title: ; notranslate">

// jQuery used

setInterval(&quot;$('#quote').load('/home/quote')&quot;, 10000); // every 10 sec
</pre>
<p>In the main view, create a div with id &#8220;quote&#8221; like:</p>
<p>In the action method set the OutputCacheAttribute like:</p>
<pre class="brush: csharp; title: ; notranslate">
[OutputCache(NoStore=true, Location = OutputCacheLocation.Client, Duration = 10)] // every 10 sec
public ActionResult Quote()
{
...
}
</pre>
<p><a style="display: none;" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=3057856" rel="tag">CodeProject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://udooz.net/blog/2012/01/partial-view-auto-refresh-in-asp-net-mvc3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unobtrusive JavaScript &#8211; Video Tutorial</title>
		<link>http://udooz.net/blog/2011/11/unobtrusive-javascript-video-tutorial/</link>
		<comments>http://udooz.net/blog/2011/11/unobtrusive-javascript-video-tutorial/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 20:19:27 +0000</pubDate>
		<dc:creator>udooz</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MVC 3]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://udooz.net/blog/?p=345</guid>
		<description><![CDATA[UdoozTube :: Hasha Tech Tutorial]]></description>
			<content:encoded><![CDATA[<div class="widgetwrap">
<div id="youtube_embed_widget-3" class="widget widget_youtube_embed_widget">
<h4 class="widgettitle">UdoozTube :: Hasha Tech Tutorial</h4>
<p><!-- YouTube Embed v2.1 | http://www.artiss.co.uk/artiss-youtube-embed --><br />
		<iframe style="border: 0;" class="youtube-player" width="560" height="315" src="http://www.youtube.com/embed/6flZUv7CXZQ?version=3&amp;modestbranding=1&amp;fs=0&amp;rel=0&amp;showinfo=1&amp;wmode=opaque"></iframe><br />
<!-- End of YouTube Embed code -->
	</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://udooz.net/blog/2011/11/unobtrusive-javascript-video-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Collection Binding in ASP.NET MVC3 with AJAX</title>
		<link>http://udooz.net/blog/2011/10/collection-binding-in-asp-net-mvc3-with-ajax/</link>
		<comments>http://udooz.net/blog/2011/10/collection-binding-in-asp-net-mvc3-with-ajax/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 12:06:24 +0000</pubDate>
		<dc:creator>udooz</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[MVC 3]]></category>
		<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Ajax.BeginForm]]></category>
		<category><![CDATA[ASP.NET MVC3]]></category>
		<category><![CDATA[Collection binding]]></category>
		<category><![CDATA[HiddenFor]]></category>
		<category><![CDATA[Model binding]]></category>
		<category><![CDATA[unobtrusive ajax]]></category>
		<category><![CDATA[UnobtrusiveJavaScriptEnabled]]></category>
<category>AJAX</category><category>Ajax.BeginForm</category><category>ASP.NET MVC3</category><category>Collection binding</category><category>HiddenFor</category><category>Model binding</category><category>unobtrusive ajax</category><category>UnobtrusiveJavaScriptEnabled</category>
		<guid isPermaLink="false">http://udooz.net/blog/?p=336</guid>
		<description><![CDATA[There is a less-common scenario in web applications where we need to edit collection of objects and submit the whole back to the system. For example, let us take the below view model: The UI for this scenario is shown below: Leave the top and bottom &#8220;Lorem ipsum&#8221; text, these are just gap fillers.  The [...]]]></description>
			<content:encoded><![CDATA[<p>There is a less-common scenario in web applications where we need to edit collection of objects and submit the whole back to the system. For example, let us take the below view model:</p>
<pre class="brush: csharp; title: ; notranslate">
public class FruitModel...
        public string Name { get; set; }
        public bool IsFresh { get; set; }
        public bool IsPacked { get; set; }
		public decimal UnitPrice { get; set; }
</pre>
<p>The UI for this scenario is shown below:</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/10/figure_1.png" rel="prettyPhoto[336]"><img class="alignnone size-full wp-image-338" style="border-width: 1px; border-color: black; border-style: solid;" title="figure_1" src="http://udooz.net/blog/wp-content/uploads/2011/10/figure_1.png" alt="" width="547" height="426" /></a></p>
<p>Leave the top and bottom &#8220;Lorem ipsum&#8221; text, these are just gap fillers.  The user can change the &#8220;IsFresh&#8221; and &#8220;IsPacked&#8221; settings of the fruits and the unit prices.</p>
<h2>Challenge</h2>
<p>This post addresses the following simple problems when using ASP.NET MVC3:</p>
<ul>
<li>Sending back collection of data to a MVC action</li>
<li>Also send back additional parameter(s) to the same MVC action</li>
<li>Sending back read-only data</li>
<li>By Ajax</li>
</ul>
<h2>Solution</h2>
<div>When the user hitting this site, the HomeController&#8217;s Index will be called:</div>
<div>
<pre class="brush: csharp; title: ; notranslate">
public ActionResult Index()...
	List&lt;FruitModel&gt; collection = new List&lt;FruitModel&gt;()
	{
		new FruitModel {Name = &quot;Apple&quot;, IsFresh=true, IsPacked=false, UnitPrice = 10M},
		new FruitModel {Name = &quot;Orange&quot;, IsFresh=false, IsPacked=false, UnitPrice = 5M},
		new FruitModel {Name = &quot;Strawberry&quot;, IsFresh=true, IsPacked=true, UnitPrice = 15M}
	};
	ViewBag.NetAmount = IncludeTax(collection.Sum(fm =&gt; fm.UnitPrice));
	ViewBag.ShopId = Guid.NewGuid();
	return View(collection);
</pre>
</div>
<div>In the Index view, I&#8217;ve used NetAmount value of ViewBag as shown below:</div>
<div>
<pre class="brush: xml; title: ; notranslate">&lt;/div&gt;
&lt;div&gt;
&lt;pre&gt;&lt;h2&gt;Welcome to Fruit Shop&lt;/h2&gt;
&lt;div&gt;Lorem ipsum... &lt;/div&gt;
&lt;div&gt;
	@Html.Partial(&quot;_Fruit&quot;, (List&lt;MvcApplication1.Models.FruitModel&gt;)Model)
&lt;/div&gt;
&lt;div id=&quot;netAmountDiv&quot; name=&quot;netAmountDiv&quot; style=&quot;color:Blue&quot;&gt;
	Net Amount: @ViewBag.NetAmount
&lt;/div&gt;
&lt;div&gt;Lorem ipsum...&lt;/div&gt;
</pre>
</div>
<div>The main part of the Fruit Shop is defined in _Fruit partial view.  It requires the FruitModel collection and shop ID (in ViewBag).</div>
<blockquote>
<div>Simply passing the Model in @Html.Partial(&#8230;) will throw the error &#8220;&#8216;System.Web.Mvc.HtmlHelper&lt;dynamic&gt;&#8217; has no applicable method named &#8216;Partial&#8217; but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.&#8221;.  So, cast it to appropriate type, here List&lt;MvcApplication1.Models.FruitModel&gt;.</div>
</blockquote>
<div>The partial view _Fruit is</div>
<div>
<pre class="brush: xml; title: ; notranslate">&lt;/div&gt;
&lt;div&gt;
&lt;pre&gt;@model List&lt;MvcApplication1.Models.FruitModel&gt;

@using (Ajax.BeginForm(new AjaxOptions
        {
            HttpMethod = &quot;Post&quot;,
            UpdateTargetId = &quot;netAmountDiv&quot;
        }
))
{

&lt;table&gt;
    &lt;tr&gt;
        &lt;th&gt;
            Name
        &lt;/th&gt;
        &lt;th&gt;
            IsFresh
        &lt;/th&gt;
        &lt;th&gt;
            IsPacked
        &lt;/th&gt;
        &lt;th&gt;Unit Price&lt;/th&gt;
    &lt;/tr&gt;

@for (int i = 0; i &lt; Model.Count; i++)
{
    &lt;tr&gt;
        &lt;td&gt;
            @Html.DisplayFor(modelItem =&gt; Model[i].Name)
            @Html.HiddenFor(modelItem =&gt; Model[i].Name)
        &lt;/td&gt;
        &lt;td&gt;
            @Html.EditorFor(modelItem =&gt; Model[i].IsFresh)
        &lt;/td&gt;
        &lt;td&gt;
            @Html.EditorFor(modelItem =&gt; Model[i].IsPacked)
        &lt;/td&gt;
        &lt;td&gt;
            @Html.EditorFor(modelItem =&gt; Model[i].UnitPrice)
        &lt;/td&gt;
    &lt;/tr&gt;
}

&lt;/table&gt;
        &lt;input type=&quot;hidden&quot; id=&quot;shopId&quot; name=&quot;shopId&quot; value=&quot;@ViewBag.ShopId&quot; /&gt;
        &lt;div&gt;
		    &lt;input name=&quot;submitFruit&quot; type=&quot;submit&quot; value=&quot;Change&quot; /&gt;
	    &lt;/div&gt;
}
</pre>
</div>
<div>Now the important point here is, when you want to post back collection of FruitModel, the naming pattern of every HTML item in the collection should be &#8220;obj-name[index].property-name&#8221;.  For example, for the above code, ASP.NET generates HTML for an item like below:</div>
<div>
<pre class="brush: xml; title: ; notranslate">&lt;/div&gt;
&lt;div&gt;
&lt;pre&gt;&lt;td&gt;
	Apple
	&lt;input name=&quot;[0].Name&quot; type=&quot;hidden&quot; value=&quot;Apple&quot; /&gt;
&lt;/td&gt;
&lt;td&gt;
	&lt;input checked=&quot;checked&quot; class=&quot;check-box&quot; data-val=&quot;true&quot; data-val-required=&quot;The IsFresh field is required.&quot; name=&quot;[0].IsFresh&quot; type=&quot;checkbox&quot; value=&quot;true&quot; /&gt;&lt;input name=&quot;[0].IsFresh&quot; type=&quot;hidden&quot; value=&quot;false&quot; /&gt;
&lt;/td&gt;
&lt;td&gt;
	&lt;input class=&quot;check-box&quot; data-val=&quot;true&quot; data-val-required=&quot;The IsPacked field is required.&quot; name=&quot;[0].IsPacked&quot; type=&quot;checkbox&quot; value=&quot;true&quot; /&gt;&lt;input name=&quot;[0].IsPacked&quot; type=&quot;hidden&quot; value=&quot;false&quot; /&gt;
&lt;/td&gt;
&lt;td&gt;
	&lt;input class=&quot;text-box single-line&quot; data-val=&quot;true&quot; data-val-number=&quot;The field UnitPrice must be a number.&quot; data-val-required=&quot;The UnitPrice field is required.&quot; name=&quot;[0].UnitPrice&quot; type=&quot;text&quot; value=&quot;10.00&quot; /&gt;
&lt;/td&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;</pre>
</div>
<div>This HTML code actually generate a post back collection as shown below when submitting the form.</div>
<pre>submitFruit=Change&amp;[0].Name=Apple&amp;[0].IsFresh=true&amp;[0].IsFresh=false&amp;[0].IsPacked=false&amp;
[0].UnitPrice=10.00&amp;[1].Name=Orange&amp;[1].IsFresh=false&amp;[1].IsPacked=true&amp;[1].IsPacked=false&amp;
[1].UnitPrice=5.00&amp;[2].Name=Strawberry&amp;[2].IsFresh=true&amp;[2].IsFresh=false&amp;[2].IsPacked=true&amp;
[2].IsPacked=false&amp;[2].UnitPrice=25&amp;shopId=c9517c6b-c911-4a28-9a0a-3e47ccb60bd8&amp;X-Requested-With=XMLHttpRequest</pre>
<div>The above data matched with List&lt;FruitModel&gt; model and with the other parameter name too.  The additional parameter I&#8217;m passing is &#8220;shopId&#8221; hidden value which is received from ViewBag.ShopId.  The main changes I did in the above code are:</div>
<ul>
<li><span class="Apple-style-span" style="font-family: Consolas, Monaco, monospace; font-size: 12px; line-height: 18px; white-space: pre;">Used List&lt;T&gt; for @model instead of IEnumerable&lt;T&gt;, hence I can use Count property.</span></li>
<li>Used for i = 0&#8230;List&lt;T&gt;.Count instead of foreach.</li>
</ul>
<div>ASP.NET MVC3 uses &#8220;name.propertyname&#8221; pattern, if you use &#8220;foreach&#8221;.  This wouldn&#8217;t send back the collection to the server.  Now, let us see the Index action for POST:</div>
<div>
<pre class="brush: csharp; title: ; notranslate">&lt;/div&gt;
&lt;div&gt;
&lt;pre&gt;[HttpPost]
public ActionResult Index(Guid shopId, List&lt;FruitModel&gt; collection)...
	decimal addlTax = 0M;
	if (collection.Any(fm =&gt; fm.UnitPrice &gt; 200)) addlTax += 2M;
	return Content(&quot;Net Amount: &quot; + IncludeTax(collection.Sum(fm =&gt; fm.UnitPrice) + addlTax).ToString());&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;</pre>
</div>
<div>Leave the tax calculation stuff, it is just for making some difference from GET Index().  The above method send back the tax calculation as plain text to the client.  This is the place for AJAX.  This can be achieved by Ajax.BeginForm() in the above code, where I&#8217;ve mentioned that the result should be placed on an element with id &#8220;netAmountDiv&#8221;.  So, we can get the result asynchronously.  To make this AJAX.BeginForm() to work, you have to:</div>
<div>
<ul>
<li>include jQuery&#8217;s unobtrusive AJAX script (jquery.unobtrusive-AJAX.min.js)</li>
<li>add &#8220;&lt;add key=&#8221;UnobtrusiveJavaScriptEnabled&#8221; value=&#8221;true&#8221; /&gt;&#8221; option in appsetting section of web.config</li>
</ul>
<p>Also, note that to send read-only item as part of the collection, in the above example FruitModel.Name, use hidden input control also.</p>
</div>
<p><a style="display: none;" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=3057856" rel="tag">CodeProject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://udooz.net/blog/2011/10/collection-binding-in-asp-net-mvc3-with-ajax/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Azure Table Storage, Domain Persistence and Concerns</title>
		<link>http://udooz.net/blog/2011/09/azure-table-storage-domain-persistence-and-concerns/</link>
		<comments>http://udooz.net/blog/2011/09/azure-table-storage-domain-persistence-and-concerns/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 03:26:33 +0000</pubDate>
		<dc:creator>udooz</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Azure]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[no sql]]></category>
		<category><![CDATA[table storage]]></category>
<category>ado.net data service serializer</category><category>alter table add partition</category><category>azure</category><category>azure cloud</category><category>azure microsoft</category><category>azure sdk</category><category>azure sql</category><category>azure storage</category><category>cloud computing azure</category><category>concerns</category><category>database sharding</category><category>ddd</category><category>document data store</category><category>domain</category><category>domain driven design</category><category>domain driven design quickly</category><category>domain model</category><category>domain object</category><category>domain object model</category><category>domain objects</category><category>domain services</category><category>fix partition table</category><category>key-value data store</category><category>microsoft sql azure</category><category>mongo</category><category>mongodb sharding</category><category>ms azure</category><category>nosql</category><category>nosql comparison</category><category>nosql db</category><category>nosql vs sql</category><category>rebuild partition table</category><category>scaled out</category><category>separation of concerns</category><category>sharding</category><category>sql azure</category><category>table partition</category><category>table storage</category><category>what is azure</category><category>window azure</category><category>windows azure</category><category>windows azure download</category><category>windows azure platform</category><category>windows azure sdk</category><category>windows azure tutorial</category>
		<guid isPermaLink="false">http://udooz.net/blog/?p=317</guid>
		<description><![CDATA[Always domain modeling is the vital part and nobody has second opinion about the importance of Domain-driven design.  This post is about anti-corruption layer between domain objects and data persistence in the Azure world. Whenever, I am started working on object-repository framework, this famous Einstein&#8217;s quote echoed in my mind In theory, theory and practical [...]]]></description>
			<content:encoded><![CDATA[<p>Always domain modeling is the vital part and nobody has second opinion about the importance of Domain-driven design.  This post is about anti-corruption layer between domain objects and data persistence in the Azure world. Whenever, I am started working on object-repository framework, this famous Einstein&#8217;s quote echoed in my mind</p>
<blockquote><p>In theory, theory and practical are the same.  In practice, they are not</p></blockquote>
<p>We have to compromise &#8220;persistence agnostic domain model&#8221; principle.  This is happened even with popular frameworks ActiveRecord (Rails) and Entity Framework (.NET) too.  I skip the compromise part as of now.</p>
<p>In Azure, you have two choices to persist objects.  One is table storage and another one is SQL Azure.  Typically, Web 2.0 applications use mixed approach like frequently used read-only data on NOSQL and source of truth is on relational data stores (CQRS).  This would be recommended when your application is running on Cloud, because every byte is billable and metered.  In this article, I brief the concerns when you are choosing Table Storage as source of truth.   Would Azure Table Storage be a good choice for domain object repository?  Though this is not the time to say &#8220;Azure Table Storage for domain object-repository should be highly recommended, partially or completely avoided&#8221; kind of opinions, but I can share some of the experiences with Azure Table Storage.</p>
<p>Due to high performance, Azure axes some NOSQL features those are typically available in other NOSQL products.  This seems like to get the ambitious mileage advertised for a bike, bike companies said you should drive on such a road, wheather and load conditions.</p>
<p>I have used the famous Customer-Order domain model in this post as shown in below figure.</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/09/CustomerOrder.jpg" rel="prettyPhoto[317]"><img class="alignnone size-full wp-image-318" title="CustomerOrder" src="http://udooz.net/blog/wp-content/uploads/2011/09/CustomerOrder.jpg" alt="" width="285" height="186" /></a></p>
<p>The actual classes are:</p>
<pre class="brush: csharp; title: ; notranslate">
public class Customer
{
public int Id { get; set; }
public string Name { get; set; }
public string City { get; set; }

List&lt;Order&gt; GetOrders(criteria)...
}

public class Product
{
public int Id { get; set; }
public string Name { get; set; }
public double UnitPrice { get; set; }
}

public class Order
{
public int Id { get; set; }
public DateTime QuotedAt { get; set; }
public int Status { get; set; }
public int CustomerId { get; set; }
public List&lt;OrderLine&gt; OrderLines;

public double CalculatePrice()...
}

public class OrderLine
{
public int Id { get; set; }
public Product ProductId { get; set; }
public double Quantity { get; set; }
public int OrderId { get; set; }

public double CalculatePrice()...
}
</pre>
<h2>Is Key-Value Data Store Enough?</h2>
<p>Key-Value based data stores are the actual starting point of NOSQL revolution, later Document based data store has been widely adopted for object persistence.  Document data store has the capability to persist an object (complex data type) against a key, however Key-Value data store can persist only scalar values.  This means that the Key-Value&#8217;s entity model is very much like relational representation (primary key &#8211; foreign key and link table), instead in Document data store, we have the choice to embed object into another object.  In the above example, Customer&#8217;s Order object can be embedded within Customer, and OrderLine and Product would be by reference. However, Azure Table Storage is just Key-Value data store.  You still have to provide meta-data for referential integrity.</p>
<h2>Am I smart enough on &#8220;Partition Key&#8221; decision?</h2>
<p>Physical location of a table in Azure (and all other NOSQL data stores too) is based on Partition Key (In Mongo DB, Sharding Key) selection.  You can get the &#8220;indexing&#8221; like faster query result only when you give partition key and row key.  Hence, the partition key selection is one of the architectural decision for a cloud application.  How smart you are to choose the right partition key is matter here!  In the Customer-Order, we can simply choose the following as partition key for the respective tables:</p>
<ul>
<li>Customer &#8211; first letter of Name in upper case</li>
<li>Product &#8211; first letter of Name in upper case</li>
<li>Order &#8211; again use the partition key of the customer, since Order is always made by a customer.</li>
<li>OrderLine &#8211; either use Order table partition key or Product table partition key.  If we choose Order table, the OrderLine table partition will use Customer table partition key.</li>
</ul>
<p>The below figure depicts how these tables would be distributed in a data center with four nodes.</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/09/nodes_tables_partition.png" rel="prettyPhoto[317]"><img class="alignnone size-full wp-image-320" title="nodes_tables_partition" src="http://udooz.net/blog/wp-content/uploads/2011/09/nodes_tables_partition.png" alt="" width="348" height="584" /></a></p>
<p>Now the concerns are:</p>
<p><strong>Is table partitioning happening always or based on capacity?</strong> Typically, NOSQL data stores (like Mongo) starts &#8220;sharding&#8221; when running out of drive capacity in the current machine. It seems very optimal way.  However, there is no clear picture on Azure table storage&#8217;s sharding.</p>
<p><strong>Data store is even smarter than me</strong> <strong>when sharding</strong>.  In Mongo DB, it only asks table object property or properties as as &#8220;Sharding&#8221; key.  Based on the load, these data stores scales out data across servers.  The sharding algorithm intelligently split the entities between the available servers based on the values in the provided &#8220;Sharding&#8221; key.  However, Azure asks the exacts value in the partition key and it groups entities those have same value.  Azure does not give the internals of how does partitioning happens.  Will it scale-out on all the nodes in the data center? or limit to some numbers?  No clear pictures though.</p>
<p><strong>What will happen if entities with same partition key on the single table server run out storage capacity?</strong> Do not have a clear picutre.  Some papers mentioned that table server is the abstraction and called as &#8220;access layer&#8221;, which in turns has &#8220;persistent storage layer&#8221; which contain scalable storage drives. The capacity of the drives will be increased based on the current capacity of the storage for a table server.</p>
<p>Interestingly, I found a reply in one of the Azure forum for a similar question (but quoted couple of years before):</p>
<address>&#8230;our access layer to the partitions is separated from our persistent storage layer.  Even though we serve up accesses to a single partition from a single partition server, the data being stored for the partition is not constrained to just the disk space on that server.   Instead, the data being stored for that partition is done through a level of indirection that allows it to span multiple drives and multiple storage nodes.</address>
<p>Since, based on the size of data we don&#8217;t know how many actuals table servers will be created for a table.  Assume, a business which needs more Orders for a limited Products and small Customers should have largely scaled out Order and OrderLine table.  But, here these two tables are restricted by small Customer table.  A web 2.0 company may need more products and customers which linearly have very large Order and OrderLines.  If this scaled out on large number of table servers, co-location between OrderLine and Product should be important as well for Customer-Order association.  If  Azure table storage scale-out algorithm does the partitioning based on the knowledge of that table only, then unnecessary network latency will be introduced.</p>
<h2>Is ADO.NET Data Service Serializer enough for the business?</h2>
<p>Enumeration are very common in domain models.  However, ADO.NET data service serializer does not serialize it.  Either we need to remove enumerated properties or to write custom serializer.</p>
<h2>Final Words</h2>
<p>So, you can either teach me your knowings of the abvoe concerns or stack your concerns up in this post.<br />
<a style="display: none;" rel="tag" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=3057856">CodeProject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://udooz.net/blog/2011/09/azure-table-storage-domain-persistence-and-concerns/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Windows 8 Developer Preview &#8211; A Quick View</title>
		<link>http://udooz.net/blog/2011/09/windows-8-developer-preview-a-quick-view/</link>
		<comments>http://udooz.net/blog/2011/09/windows-8-developer-preview-a-quick-view/#comments</comments>
		<pubDate>Thu, 15 Sep 2011 15:28:50 +0000</pubDate>
		<dc:creator>udooz</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Metro UI]]></category>
		<category><![CDATA[Windows 8]]></category>
<category>64-bit</category><category>arm</category><category>metro ui</category><category>microsoft</category><category>microsoft 7 upgrade</category><category>microsoft operating systems</category><category>microsoft virtual pc</category><category>virtual box</category><category>virtual pc</category><category>windows 8</category>
		<guid isPermaLink="false">http://udooz.net/blog/?p=299</guid>
		<description><![CDATA[Lured with &#8220;MetroUI&#8221; and &#8220;ARM processor support&#8221;, I dont want to wait until next year for RTM release.  Downloaded 64-bit Developer Preview with Development Tools from http://snip.udooz.net/qNCs4G. Environment I believed that Windows Virtual PC could be the only choice to install Win8DevPrew.  However, it throws &#8220;This 64-bit application couldn&#8217;t load because your PC doesn&#8217;t have [...]]]></description>
			<content:encoded><![CDATA[<p>Lured with &#8220;MetroUI&#8221; and &#8220;ARM processor support&#8221;, I dont want to wait until next year for RTM release.  Downloaded 64-bit Developer Preview with Development Tools from <a href="http://snip.udooz.net/qNCs4G">http://snip.udooz.net/qNCs4G</a>.</p>
<h2>Environment</h2>
<p>I believed that Windows Virtual PC could be the only choice to install Win8DevPrew.  However, it throws &#8220;This 64-bit application couldn&#8217;t load because your PC doesn&#8217;t have a 64-bit processor&#8221; error message during the setup.  Later, I came to know from Adrian&#8217;s ZDNet blog post (<a href="http://snip.udooz.net/p8pUX1">http://snip.udooz.net/p8pUX1</a>) that Virtual Box is the only and best choice.  He explained the various settings you should do before installing Windows 8 on Virtual Box.</p>
<blockquote><p>Note that allocate at least 25 GB for VDI, 2 GB RAM and 30 MB for Video RAM in the Virtual Box settings.</p></blockquote>
<h2>Installing</h2>
<p>The installation overall took 30 minutes, here some screen shots:</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/09/win8_1.png" rel="prettyPhoto[299]"><img class="alignnone size-full wp-image-300" title="Win8 Initial Setup" src="http://udooz.net/blog/wp-content/uploads/2011/09/win8_1.png" alt="Win8 Initial Setup" width="593" height="459" /></a></p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/09/win8_2.png" rel="prettyPhoto[299]"><img class="alignnone size-full wp-image-302" title="win8_2" src="http://udooz.net/blog/wp-content/uploads/2011/09/win8_2.png" alt="" width="597" height="499" /></a></p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/09/win8_3.png" rel="prettyPhoto[299]"><img class="alignnone size-full wp-image-303" title="win8_3" src="http://udooz.net/blog/wp-content/uploads/2011/09/win8_3.png" alt="" width="609" height="506" /></a></p>
<p>Post to the installation, you have to create an user account as shown in the below figure.</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/09/win8_4.png" rel="prettyPhoto[299]"><img class="alignnone size-full wp-image-304" title="win8_4" src="http://udooz.net/blog/wp-content/uploads/2011/09/win8_4.png" alt="" width="617" height="515" /></a></p>
<h2>Starting Windows</h2>
<p>After completing the installation, Windows 8 takes 19 seconds to load. You will see a full-screen wallpaper as shown below.</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/09/win8_5.png" rel="prettyPhoto[299]"><img class="alignnone size-full wp-image-306" title="win8_5" src="http://udooz.net/blog/wp-content/uploads/2011/09/win8_5.png" alt="" width="635" height="475" /></a></p>
<p>You get a feel of using Mobile operating system.  You have to drag this screen to see the login screen as like below.</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/09/win8_6.png" rel="prettyPhoto[299]"><img class="alignnone size-full wp-image-307" title="win8_6" src="http://udooz.net/blog/wp-content/uploads/2011/09/win8_6.png" alt="" width="645" height="486" /></a></p>
<p>So, &#8220;touch&#8221; is the main user input medium for Windows 8, though mouse and keyboard are available.  After the successful login, you will see the &#8220;Metro&#8221; styled start screen.</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/09/win8_7.png" rel="prettyPhoto[299]"><img class="alignnone size-full wp-image-308" title="win8_7" src="http://udooz.net/blog/wp-content/uploads/2011/09/win8_7.png" alt="" width="641" height="483" /></a></p>
<p>By tapping the &#8220;Computer&#8221; tile (in the above figure &#8211; not shown), you can see the classic explorer window and start menu as well, but again, tiles are the main interface to access all the features in Metro style.</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/09/win8_8.png" rel="prettyPhoto[299]"><img class="alignnone size-full wp-image-309" title="win8_8" src="http://udooz.net/blog/wp-content/uploads/2011/09/win8_8.png" alt="" width="651" height="490" /></a></p>
<p>Ok&#8230;.Let me explore more before writing more about Windows 8.<br />
<a style="display: none;" rel="tag" href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=3057856">CodeProject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://udooz.net/blog/2011/09/windows-8-developer-preview-a-quick-view/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Your Azure Web Role and Full IIS &#8211; Culture Changes</title>
		<link>http://udooz.net/blog/2011/08/azure-full-iis/</link>
		<comments>http://udooz.net/blog/2011/08/azure-full-iis/#comments</comments>
		<pubDate>Sun, 21 Aug 2011 19:15:28 +0000</pubDate>
		<dc:creator>udooz</dc:creator>
				<category><![CDATA[Azure]]></category>
		<category><![CDATA[Application_End]]></category>
		<category><![CDATA[Full IIS]]></category>
		<category><![CDATA[Global.asax]]></category>
		<category><![CDATA[RoleEntryPoint]]></category>
		<category><![CDATA[WaIISHost]]></category>
		<category><![CDATA[WaWebHost]]></category>
		<category><![CDATA[web role]]></category>

		<guid isPermaLink="false">http://udooz.net/blog/?p=290</guid>
		<description><![CDATA[On Azure SDK v1.3 onwards, your web role can enjoy the benefits full IIS capabilities.  It means that your application has now fully controlled by IIS 7.x.  Prior to v1.3, your web role was hosted on &#8220;Hosted Web Core&#8221; (HWC &#8211; hmmm, another acronym), a feature introduced in IIS 7.0.  HWC can be seen as [...]]]></description>
			<content:encoded><![CDATA[<p>On Azure SDK v1.3 onwards, your web role can enjoy the benefits full IIS capabilities.  It means that your application has now fully controlled by IIS 7.x.  Prior to v1.3, your web role was hosted on &#8220;Hosted Web Core&#8221; (HWC &#8211; hmmm, another acronym), a feature introduced in IIS 7.0.  HWC can be seen as a raw IIS without having IIS monitoring and administrative features.  Hence, you can have your own IIS for a specific web application.  It runs in a different process (WaWebHost.exe) and has a dedicated single application pool.  So, the mental model of your web role application would be:</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/08/full_iis_1.png" rel="prettyPhoto[290]"><img class="alignnone size-full wp-image-291" title="Figure 1" src="http://udooz.net/blog/wp-content/uploads/2011/08/full_iis_1.png" alt="WaWebHost" width="298" height="217" /></a></p>
<p>An Azure web role consists of two logical parts in the assembly, one is RoleEntryPoint implementation and another one is your actual web application.  Your typical Azure web role has:</p>
<ul>
<li> Web role lifecycle code (RoleEntry &#8211; OnStart, OnRun and OnStop) and Service model (csdef and cscfg)</li>
<li>Web application code and web configuration (web.config)</li>
</ul>
<p>In HWC, both Web role and web application logical artifacts are resided in a single process (WaWebHost.exe) as shown in figure 1. In the new full IIS capability feature, web role artifacts are loaded into a process called WaIISHost.exe.  The web application code as usual in w3wp.exe.  This is shown in figure 2.</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/08/full_iis_21.png" rel="prettyPhoto[290]"><img class="alignnone size-full wp-image-293" title="Figure 2" src="http://udooz.net/blog/wp-content/uploads/2011/08/full_iis_21.png" alt="WaIISHost" width="547" height="214" /></a></p>
<p>This creates some culture changes in the approach previously we did.  I have experimented only on DevFabric and yet to test on Azure.  Probably, I&#8217;ll update later.  The changes are:</p>
<ul>
<li> <strong>Process with different accounts</strong>.  WaIISHost and w3wp are now running in two different account privileges.  Generally, WaIISHost runs in higher privilege and this would cause some code in your web application which was previously enjoyed this high privilege benefit.  For example, you can create or access an machine level environment variable from your web application in HWC mode.  In Full IIS, this makes exception.</li>
<li> <strong>Global Configuration Setting Publisher</strong>.  In HWC, it is enough to initialize global configuration setting publisher once in RoleEntryPoint.OnStart().  However, now in two different process, you have to again set the publisher either in your framework start up or Application_Start(), otherwise it throws an exception with message &#8220;SetConfigurationSettingPublisher needs to be called before FromConfigurationSetting can be used&#8221;.  Instead of held up with two different initialization, CloudStorageAccount.Parse() is quite simple and elegant.  It just want the connection string detail as a string which can be provided by RoleEnvironment.GetConfigurationSettingValue(&#8230;).  This is safer too.</li>
<li> <strong>Application_End will not be encountered</strong>.  In Full IIS, Application_End() will never be called when you stop the debugging as like you normally did in HWC.</li>
<li> <strong>Static variables in RoleEntryPoint is not accessible from your web application</strong>.  Since, these two applications are running in two different process, sharing objects through static variable is not possible in Full IIS.  Instead, try to use machine level environment variable or local resource.</li>
</ul>
<p><a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=3057856" style="display:none" rel="tag">CodeProject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://udooz.net/blog/2011/08/azure-full-iis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WCAT &#8211; Simple Performance Test Tool for your .NET web app</title>
		<link>http://udooz.net/blog/2011/08/wcat-performance-test-iis/</link>
		<comments>http://udooz.net/blog/2011/08/wcat-performance-test-iis/#comments</comments>
		<pubDate>Sat, 06 Aug 2011 10:06:59 +0000</pubDate>
		<dc:creator>udooz</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[IIS 7.0]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[tool]]></category>
		<category><![CDATA[wcat]]></category>
<category>performance</category><category>WCAT</category>
		<guid isPermaLink="false">http://udooz.net/blog/?p=284</guid>
		<description><![CDATA[WCAT (Web Capacity Analysis Tool) is a tiny but excellent tool from Microsoft to perform load test your web application on IIS.  This tool enables you to do performance analysis on various scenarios of your web application.  All &#8220;perfmon&#8221; performance counters (like processor time, private bytes usage,  disk queue length,  total bytes sent or received [...]]]></description>
			<content:encoded><![CDATA[<p>WCAT (Web Capacity Analysis Tool) is a tiny but excellent tool from Microsoft to perform load test your web application on IIS.  This tool enables you to do performance analysis on various scenarios of your web application.  All &#8220;perfmon&#8221; performance counters (like processor time, private bytes usage,  disk queue length,  total bytes sent or received in network) can be specified for the performance testing.  A performance test is for a business scenario, hence a test needs to include all servers (application server, database server) involved in the business scenario.  This is tool is as handy as possible to perform a load test even on single machine.</p>
<p>Once you specify the scenario in your application (i.e. appropriate URLs), a number of virtual clients from various client machines  will visit the URL with appropriate request data.  Like other performance tools, the following players are involved in a performance testing:</p>
<ul>
<li>Server &#8211; machines on which your web application components are running</li>
<li>Client &#8211; A virtual client on a machine which acts as end-user to visit the URL</li>
<li>Controller &#8211; This coordinates a test among the virtual clients on  various machines.  It also capture and collate the performance counters  from appropriate servers.</li>
</ul>
<p>I&#8217;ve created a small ASP.NET MVC3 application with following actions:<br />
* http://localhost/myapp/load/create &#8211; to insert a simple &#8220;comment&#8221; field  value into the database (using POST data COMMENT =  &#8220;&lt;value&gt;&#8221;)<br />
* http://localhost/myapp/load &#8211; to lists all comments</p>
<p>WCAT uses Windows Scripting and you can use JavaScript syntax to define the scenario for your test.  Below is a sample scenario in a file scenario.ubr:</p>
<pre class="brush: jscript; title: ; notranslate">

scenario
 {
 name    = &quot;IIS Home Page&quot;;

warmup      = 30;
 duration    = 50;

default
 {
 // send keep-alive header
 setheader
 {
 name    = &quot;Connection&quot;;
 value   = &quot;keep-alive&quot;;
 }

// set the host header
 setheader
 {
 name    = &quot;Host&quot;;
 value   = server();
 }

// HTTP1.1 request
 version     = HTTP11;

// keep the connection alive after the request
 close       = ka;
 }

//
 // This script is made for IIS7
 //
 transaction
 {
 id = &quot;My App Load Test&quot;;
 weight = 1;

request
 {
 url = &quot;/myapp/load/create&quot;;
 verb = POST;
 postdata = &quot;Comment=Tested&quot;;
 statuscode= 200;
 }

request
 {
 url         = &quot;/MyBooks/load&quot;;
 statuscode  = 200;
 }

close
 {
 method      = reset;
 }
 }
 }
</pre>
<p>A scenario file normally contains warmup time (ramp up), test duration, cooldown time (ramp down).  The default section enables you to specify default HTTP headers for the test.  The transaction section is used to specify the actual business scenarios.  The weight property is used to set the priority of this transaction.  The request section is used to specify individual page request in the transaction.  A &#8220;request&#8221; contains</p>
<ul>
<li>URL of the page</li>
<li>Optionally the HTTP verb (default GET).  In case of posting data, you have to specify the POST as verb.</li>
<li>POSTDATA for POST</li>
<li> Status code which is normally 200, but for some cases you may need to specify 300 or 302 for moving request</li>
</ul>
<p>The other test details like servers and client machine names,  number of virtual clients, performance counters can be specified to WCAT through another script file called &#8220;setting file&#8221;.  Below is a sample setting file named &#8220;setting.ubr&#8221;:</p>
<pre class="brush: jscript; title: ; notranslate">

settings
 {
 clientfile     = &quot;scenario.ubr&quot;;
 server         = &quot;localhost&quot;;
 clients        = 2;
 virtualclients = 10;

counters
 {
 interval = 10;

counter = &quot;Processor(_Total)\\% Processor Time&quot;;
 counter = &quot;Processor(_Total)\\% Privileged Time&quot;;
 counter = &quot;Processor(_Total)\\% User Time&quot;;
 counter = &quot;Processor(_Total)\\Interrupts/sec&quot;;

counter = &quot;Memory\\Available KBytes&quot;;

counter = &quot;Process(w3wp)\\Working Set&quot;;

counter = &quot;System\\Context Switches/sec&quot;;
 counter = &quot;System\\System Calls/sec&quot;;

counter = &quot;Web Service(_Total)\\Bytes Received/sec&quot; ;
 counter = &quot;Web Service(_Total)\\Bytes Sent/sec&quot; ;
 counter = &quot;Web Service(_Total)\\Connection Attempts/sec&quot; ;
 counter = &quot;Web Service(_Total)\\Get Requests/sec&quot; ;
 }

// other settings
 }
</pre>
<p>A setting file usually contains the following:</p>
<ul>
<li> The scenario file the clients need to execute</li>
<li> Server machines</li>
<li> Number of physical client machines for this test</li>
<li> Number of virtual clients for this test</li>
<li> Performance counters</li>
<li> Registry settings</li>
</ul>
<p>Note that you can use any file extension for scenario and setting files.  I have followed the convention&#8221;ubr&#8221; is used in WCAT sample.</p>
<h2>Initial Setup</h2>
<ol>
<li>Download the tool from <a href="http://snip.udooz.net/wcat63" target="_blank">http://snip.udooz.net/wcat63</a>.   It has x64 version also.</li>
<li>Add the installed folder path into system PATH.</li>
</ol>
<p>This setup has following three exeutables and one Windows script file along with documentation and samples folders:</p>
<ul>
<li> wcctl.exe &#8211; controller</li>
<li> wcclient.exe &#8211; client</li>
<li> wcutil.exe &#8211; small utility to view a brief report of a test</li>
<li> wcat.wsf &#8211; used to update, terminate and run wcclient on various client machines.</li>
</ul>
<p>Initially, you need to update WCAT setup on all client machines by</p>
<pre class="brush: bash; title: ; notranslate">
 wcat.wsf –terminate –update –clients {comma separated list of WCAT client machines}
</pre>
<h2>Steps for the Testing</h2>
<p>To perform a test, you need a machine for &#8220;controller&#8221;, one or more machines for &#8220;clients&#8221; and the server machines.  You can do the testing even within a single machine by specifying &#8220;localhost&#8221;.</p>
<ol>
<li> Once you prepare the scenario and setting files, create a folder  in the controller machine for your test and copy these files on to it.</li>
<li> Open the command prompt as Administrator.</li>
<li> Run wcctl -t scenario.ubr -f settings.ubr -x on the controller machine.  The output will be like</li>
</ol>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/08/WCAT2.png" rel="prettyPhoto[284]"><img class="alignnone size-full wp-image-286" style="border: 1px solid black;" title="wcctl" src="http://udooz.net/blog/wp-content/uploads/2011/08/WCAT2.png" alt="" width="588" height="466" /></a></p>
<p>4. Run wcclient.exe on all client machines.</p>
<p>After the test run, the output in the controller command prompt would be like</p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2011/08/WCAT.png" rel="prettyPhoto[284]"><img class="alignnone size-full wp-image-287" title="WCAT - Output" src="http://udooz.net/blog/wp-content/uploads/2011/08/WCAT.png" alt="" width="586" height="635" /></a></p>
<p>After all the test run completed, result will be stored in log.xml file in the controller&#8217;s  machine current directory.  WCAT has a XSLT &#8220;report.xsl&#8221; to transform this XML into readable in its installed folder.  Copy the file into log.xml.  Open the log.xml in the browser to see the output.  A part of log.xml file is</p>
<pre class="brush: xml; title: ; notranslate">

&lt;?xml version='1.0'?&gt;
 &lt;?xml-stylesheet type='text/xsl' href='report.xsl'?&gt;
 &lt;report name=&quot;wcat&quot; version=&quot;6.4.0&quot; level=&quot;1&quot; top=&quot;100&quot;&gt;
 &lt;section name=&quot;header&quot; key=&quot;90000&quot;&gt;
 ...

&lt;item&gt;
 &lt;data name=&quot;counter&quot; &gt;\Processor(_Total)\% Processor Time&lt;/data&gt;
 &lt;data name=&quot;avg&quot; &gt;1.82&lt;/data&gt;
 &lt;data name=&quot;min&quot; &gt;1.82&lt;/data&gt;
 &lt;data name=&quot;max&quot; &gt;1.82&lt;/data&gt;
 &lt;data name=&quot;delta&quot; &gt;0.00&lt;/data&gt;
 &lt;item&gt;
 &lt;data name=&quot;time&quot; &gt;0.00&lt;/data&gt;
 &lt;data name=&quot;current&quot; &gt;1.82&lt;/data&gt;
 &lt;/item&gt;
 &lt;/item&gt;
 &lt;item&gt;
 &lt;data name=&quot;counter&quot; &gt;\Process(w3wp)\Private Bytes&lt;/data&gt;
 &lt;data name=&quot;avg&quot; &gt;98455552.00&lt;/data&gt;
 &lt;data name=&quot;min&quot; &gt;98455552.00&lt;/data&gt;
 &lt;data name=&quot;max&quot; &gt;98455552.00&lt;/data&gt;
 &lt;data name=&quot;delta&quot; &gt;0.00&lt;/data&gt;
 &lt;item&gt;
 &lt;data name=&quot;time&quot; &gt;0.00&lt;/data&gt;
 &lt;data name=&quot;current&quot; &gt;98455552.00&lt;/data&gt;
 &lt;/item&gt;
 &lt;/item&gt;
 &lt;/table&gt;

...
 &lt;/report&gt;
</pre>
<h2>Final Words</h2>
<p>WCAT might not help to test an entire application which normally has so many user interaction which are not simply captured by single POST request.  However, it would help to perform load testing on every atomic part of your application or to perform technology evaluation as part of prototype engineering.<br />
<a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=3057856" style="display:none" rel="tag">CodeProject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://udooz.net/blog/2011/08/wcat-performance-test-iis/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ILSpy: alternate to Reflector</title>
		<link>http://udooz.net/blog/2011/02/ilspy-alternate-to-reflector/</link>
		<comments>http://udooz.net/blog/2011/02/ilspy-alternate-to-reflector/#comments</comments>
		<pubDate>Sat, 19 Feb 2011 05:50:04 +0000</pubDate>
		<dc:creator>udooz</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[decompiler]]></category>
		<category><![CDATA[ILSpy]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[reflector]]></category>

		<guid isPermaLink="false">http://udooz.net/blog/2011/02/ilspy-alternate-to-reflector/</guid>
		<description><![CDATA[RedGate recently announced that sooner it will make some money from Reflector. Developers from Mono space invented ILSpy alternate to this. Though it is early stage, will be a better alternate. URL: http://wiki.sharpdevelop.net/ilspy.ashx]]></description>
			<content:encoded><![CDATA[<p>RedGate recently announced that sooner it will make some money from Reflector.  Developers from Mono space invented ILSpy alternate to this.  Though it is early stage, will be a better alternate.</p>
<p>URL: http://wiki.sharpdevelop.net/ilspy.ashx</p>
]]></content:encoded>
			<wfw:commentRss>http://udooz.net/blog/2011/02/ilspy-alternate-to-reflector/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook App by Rails using Koala</title>
		<link>http://udooz.net/blog/2011/02/facebook-app-using-rails-koala/</link>
		<comments>http://udooz.net/blog/2011/02/facebook-app-using-rails-koala/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 01:31:11 +0000</pubDate>
		<dc:creator>udooz</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[facebook App]]></category>
		<category><![CDATA[facebook SDK]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[koala]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[SDK]]></category>
<category>facebook</category><category>facebook App</category><category>facebook SDK</category><category>framework</category><category>koala</category><category>rails</category><category>SDK</category>
		<guid isPermaLink="false">http://udooz.net/blog/?p=277</guid>
		<description><![CDATA[To get to know much about developing Facebook applications using a server side, I have chosen with Koala for Rails.  For .NET, Facebook C# SDK is being well supported by Microsoft also (http://facebooksdk.codeplex.com/).  In this post, I explain how to use Koala in your Rails applications.  As any Facebook app, the prerequisite  are: Facebook account [...]]]></description>
			<content:encoded><![CDATA[<p>To get to know much about developing Facebook applications using a server side, I have chosen with Koala for Rails.  For .NET, Facebook C# SDK is being well supported by Microsoft also (<a href="http://facebooksdk.codeplex.com/" target="_blank">http://facebooksdk.codeplex.com/</a>).  In this post, I explain how to use Koala in your Rails applications.  As any Facebook app, the prerequisite  are:</p>
<ul>
<li>Facebook account (of course you should be the one in the 10% of world population <img src='http://udooz.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  )</li>
<li>A Facebook application (which could be in sandbox mode), so you should have App ID, App Secret and Callback URL</li>
<li>A Rails application in your local machine and the Facebook app pointed to this as http://localhost:3000 (default port for Mongrel or WEBrick)</li>
</ul>
<h2>Installing Koala</h2>
<p>Install Koala gem from <a href="https://github.com/arsduo/koala" target="_blank">https://github.com/arsduo/koala</a> by using <strong>sudo gem install koala &#8211;pre</strong></p>
<h2>Configuring Koala</h2>
<p>Create facebook.yml in /config with the following content</p>
<pre class="brush: jscript; title: ; notranslate">

# config/facebook.yml
development:
 app_id: 184xxxxxxxxxxxx
 secret_key: 80xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 callback_url: http://localhost:3000/
test:
 ...
production:
 ...
</pre>
<p>Add the following in config/environment.rb</p>
<pre class="brush: ruby; title: ; notranslate">

# config/environment.rb
# in Rails::Initializer.run do |config|
config.action_controller.allow_forgery_protection = false
config.gem &quot;koala&quot;
</pre>
<p>The first line enables Facebook callback to your server.  The following line adds koala gem into this application.</p>
<p>Create koala.rb in /config/initializers with the following content</p>
<pre class="brush: ruby; title: ; notranslate">

# config/initializers/koala.rb

module Facebook
 CONFIG = YAML.load_file(Rails.root + &quot;/config/facebook.yml&quot;)[Rails.env]
 APP_ID = CONFIG['app_id']
 SECRET = CONFIG['secret_key']
 CALLBACK_URL = CONFIG['callback_url']
end

Koala::Facebook::OAuth.class_eval do
 def initialize_with_default_settings(*args)
 case args.size
 when 0, 1
 raise &quot;application id and/or secret are not specified in the config&quot; unless Facebook::APP_ID &amp;&amp; Facebook::SECRET
 initialize_without_default_settings(Facebook::APP_ID.to_s, Facebook::SECRET.to_s, Facebook::CALLBACK_URL.to_s)
 when 2, 3
 initialize_without_default_settings(*args)
 end
 end

 alias_method_chain :initialize, :default_settings
end
</pre>
<p>The above code loads the Facebook.yml settings into Facebook, so you can access AppID, AppSecret and CallbackURL anywhere in your application in an unified way.  The following OAuth extension method is taken from Koala guidance to simplify the instantiation of OAuth.new.</p>
<h2>Controller Part</h2>
<p>In ApplicationController, add the following</p>
<pre class="brush: ruby; title: ; notranslate">

#app/controller/application.rb

# protect_from_forgery

before_filter :parse_facebook_cookies
def parse_facebook_cookies
 @facebook_cookies = Koala::Facebook::OAuth.new.get_user_info_from_cookie(cookies)
end
</pre>
<p>Note that protect_from_forgery has been commented.  The following instructions, let this application load OAuth details from cookies for getting Facebook access token.</p>
<h2>Your Login Page</h2>
<p>Add the following on your login page layout, in this case /app/views/layout/login.html.erb</p>
<pre class="brush: xml; title: ; notranslate">

&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; xml:lang=&quot;en&quot; lang=&quot;en&quot;
 xml:fb=&quot;http://www.facebook.com/2008/fbml&quot;&gt;
&lt;head&gt;
 &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=UTF-8&quot; /&gt;
 &lt;title&gt;Udooz Sample&lt;/title&gt;
 &lt;script type=&quot;text/javascript&quot; src=&quot;http://connect.facebook.net/en_US/all.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;p style=&quot;color: green&quot;&gt;&lt;%= flash[:notice] %&gt;&lt;/p&gt;
&lt;div id=&quot;fb-root&quot;&gt;&lt;/div&gt;

&lt;script type=&quot;text/javascript&quot;&gt;
 FB.init({
 appId  : '&lt;%= Facebook::APP_ID %&gt;',
 status : true, // check login status
 cookie : true, // enable cookies to allow the server to access the session
 xfbml  : true  // parse XFBML
 });

 FB.login(function(response) {
 if (response.session) {
 location.href = '/home'
 } else {
 // user cancelled login
 }
});
&lt;/script&gt;
&lt;h1&gt;udooz&lt;/h1&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>In this example, I&#8217;ve used Facebook JavaScript SDK for login screen.  To use this, I&#8217;ve include FBML scheme in &lt;html&gt; as xml:fb=&#8221;http://www.facebook.com/2008/fbml&#8221; followed by referring Facebook SDK script file.</p>
<h2>You Home Page</h2>
<p>In your home page, add the following things.</p>
<p>In app/controllers/HomeController.rb</p>
<pre class="brush: ruby; title: ; notranslate">

class HomeController &lt; ApplicationController
  def index
    graph = Koala::Facebook::GraphAPI.new(@facebook_cookies[&quot;access_token&quot;])
    @likes = graph.get_connections(&quot;me&quot;, &quot;likes&quot;)
  end
end
</pre>
<p>In the above code, new Graph instance has been created.  By using this, I&#8217;ve invoked the currently logged in user&#8217;s likes.</p>
<p>In app/views/home.html.erb</p>
<pre class="brush: xml; title: ; notranslate">

&lt;table border=&quot;0&quot;&gt;
 &lt;% if @likes %&gt;
 &lt;% for like in @likes %&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;b&gt;&lt;%=h like[&quot;name&quot;]%&gt; &lt;/b&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&lt;%=h like[&quot;category&quot;] %&gt;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;tr&gt;
 &lt;td&gt;&amp;ndash;&lt;/td&gt;
 &lt;/tr&gt;
 &lt;% end %&gt;
 &lt;% end %&gt;
&lt;/table&gt;
</pre>
<p>Now, run your application.  Hope it would be easy.<br />
<a href="http://www.codeproject.com/script/Articles/BlogFeedList.aspx?amid=3057856" style="display:none" rel="tag">CodeProject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://udooz.net/blog/2011/02/facebook-app-using-rails-koala/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>WCF Claims, STS and Federation – Layman’s View &#8211; 2</title>
		<link>http://udooz.net/blog/2010/12/wcf-sts-federation-claims-2/</link>
		<comments>http://udooz.net/blog/2010/12/wcf-sts-federation-claims-2/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 17:28:56 +0000</pubDate>
		<dc:creator>udooz</dc:creator>
				<category><![CDATA[WCF]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[Claims]]></category>
		<category><![CDATA[Federation]]></category>
		<category><![CDATA[Identity]]></category>
		<category><![CDATA[STS]]></category>

		<guid isPermaLink="false">http://udooz.net/blog/?p=268</guid>
		<description><![CDATA[In the previous post, we have seen the service configuration of WCF federation.  In this post, let us see the STS configuration.  In the STS&#8217;s configuration file, it is mentioned in &#60;message&#62; element.  The STS service contract is declared in Udooz.ISecurityTokenService and implementation is resided in Udooz.SecurityTokenService.      The message security mode is specified [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://udooz.net/blog/2010/12/wcf-sts-federation-claims/" target="_blank">previous post</a>, we have seen the service configuration of WCF federation.  In this post, let us see the STS configuration.<a href="http://udooz.net/blog/wp-content/uploads/2010/12/STS_4_1.png" rel="prettyPhoto[268]"><img class="alignnone size-full wp-image-270" title="STS_4_1" src="http://udooz.net/blog/wp-content/uploads/2010/12/STS_4_1.png" alt="" width="601" height="305" /></a> </p>
<p>In the STS&#8217;s configuration file, it is mentioned in &lt;message&gt; element. </p>
<pre class="brush: xml; title: ; notranslate"> 

&lt;system.serviceModel&gt;
  &lt;services&gt;
   &lt;service name=&quot;Udooz.SecurityTokenService&quot; behaviorConfiguration=&quot;stsBehavior&quot;&gt;
    &lt;endpoint contract=&quot;Udooz.ISecurityTokenService&quot; binding=&quot;wsHttpBinding&quot; bindingConfiguration=&quot;stsBinding&quot;/&gt;
   &lt;/service&gt;
  &lt;/services&gt; 

&lt;bindings&gt;
   &lt;wsHttpBinding&gt;
    &lt;binding name=&quot;stsBinding&quot;&gt;
     &lt;security mode=&quot;Message&quot;&gt;
      &lt;message clientCredentialType=&quot;UserName&quot; /&gt;
     &lt;/security&gt;
    &lt;/binding&gt;
   &lt;/wsHttpBinding&gt;
  &lt;/bindings&gt; 
</pre>
<p>The STS service contract is declared in Udooz.ISecurityTokenService and implementation is resided in Udooz.SecurityTokenService. </p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2010/12/STS_4_2.png" rel="prettyPhoto[268]"><img class="alignnone size-full wp-image-271" title="STS_4_2" src="http://udooz.net/blog/wp-content/uploads/2010/12/STS_4_2.png" alt="" width="601" height="305" /></a> </p>
<p><a href="http://udooz.net/blog/wp-content/uploads/2010/12/STS_4_3.png" rel="prettyPhoto[268]"><img class="alignnone size-full wp-image-272" title="STS_4_3" src="http://udooz.net/blog/wp-content/uploads/2010/12/STS_4_3.png" alt="" width="600" height="316" /></a> </p>
<p>The message security mode is specified in &lt;binding&gt;..&lt;wsHttpBinding&gt;..&lt;binding name=&#8221;stsBinding&#8221;&gt;&#8230;&lt;security&gt;.  </p>
<p>This is specified in the &lt;serviceBehaviors&gt; section named &#8220;stsBehavior&#8221;. </p>
<pre class="brush: xml; title: ; notranslate"> 

&lt;behaviors&gt;
   &lt;serviceBehaviors&gt;
    &lt;behavior name=&quot;stsBehavior&quot;&gt;           
     &lt;serviceCredentials&gt;
                 &lt;userNameAuthentication
              userNamePasswordValidationMode=&quot;Custom&quot;
              customUserNamePasswordValidatorType=&quot;UdoozCommonLib.STSUsernamePasswordValidator, UdoozCommonLib&quot;/&gt;
            &lt;serviceCertificate findValue=&quot;WCFServerKey&quot; x509FindType=&quot;FindBySubjectName&quot; storeLocation=&quot;LocalMachine&quot; storeName=&quot;My&quot; /&gt;           
     &lt;/serviceCredentials&gt;
    &lt;/behavior&gt;
   &lt;/serviceBehaviors&gt;
  &lt;/behaviors 
</pre>
<p>The username-password authentication is done by UdoozCommonLib.STSUsernamePasswordValidator class in UdoozCommonLib assembly. </p>
<p><em>To be continued&#8230;</em><br />
<a style="display: none;" rel="tag" href="http://udooz.net/blog/2010/12/wcf-sts-federation-claims-2">CodeProject</a></p>
]]></content:encoded>
			<wfw:commentRss>http://udooz.net/blog/2010/12/wcf-sts-federation-claims-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

