<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="https://www.w3.org/2005/Atom" xmlns:sy="https://purl.org/rss/1.0/modules/syndication/" xmlns:dc="https://purl.org/dc/elements/1.1/" xmlns:content="https://purl.org/rss/1.0/modules/content/" xmlns:wfw="https://wellformedweb.org/CommentAPI/" xmlns:slash="https://purl.org/rss/1.0/modules/slash/"
  version="2.0">
  <channel>
    <title>Patterns for Great Architecture</title>
    <atom:link
      href="https://docs.microsoft.com/archive/blogs/rahul/feed.xml"
      rel="self"
      type="application/rss+xml" />
    <link>https://docs.microsoft.com/archive/blogs/rahul/feed.xml</link>
    <description>Hi!</description>
    <lastBuildDate>Wed, 17 Apr 2019 03:24:50 GMT</lastBuildDate>
    <language>en-US</language>
    <sy:updatePeriod>hourly</sy:updatePeriod>
    <sy:updateFrequency>1</sy:updateFrequency>
    <item>
      <title>Internet of Things (IoT) on Microsoft</title>
      <link>https://docs.microsoft.com/archive/blogs/rahul/internet-of-things-iot-on-microsoft</link>
      <pubDate>Sun, 25 May 2014 20:04:00 GMT</pubDate>
      <dc:creator><![CDATA[RahulGangwar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rahul/2014/05/25/internet-of-things-iot-on-microsoft/</guid>
      <description><![CDATA[What is IoT: Internet of Things (IoT) has become the buzzword today (even though it was coined long...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: tahoma,arial,helvetica,sans-serif;"><span style="text-decoration: underline;"><strong>What is IoT:</strong></span> <a href="https://www.microsoft.com/windowsembedded/en-us/internet-of-things.aspx">Internet of Things (IoT)</a> has become the buzzword today (even though it was coined long </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">time back&hellip; in 1990s by MIT professors). IoT simply means: &ldquo;all entities </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">connected&rdquo;. Everything connected ranging from your home appliances (like TV, refrigerator, </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">Microwave, Car etc.) to office appliances (tablets, laptops, phones etc.) to </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">industry specific devices (manufacturing units, sensors, CCTVs etc.).</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif;">When we go to buy grocery, the point of sales personnel </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">scans barcodes from each item. This updates backend inventory and all kinds of </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">reports are generated. This labelling of even technically incapable items like </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">fruits/soaps is nothing but a simple example of IoT in retail. Microsoft has worked with </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">London Underground transport system on this concept where not only rails but </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">also things like lifts, escalators, cctvs, temperature/humidity monitoring </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">units etc. are all connected and providing intelligence in real-time</span><span style="font-family: tahoma,arial,helvetica,sans-serif;">.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif;"><span style="text-decoration: underline;"><strong>IoT and StreamInsight:</strong></span> With large number of entities connected, there are IoT scenarios where we need to analyse data in near real-time. We cannot wait to store data coming from small devices to be first stored in database and then analysed later.&nbsp;Microsoft&rsquo;s <a href="https://blogs.msdn.com/b/streaminsight/">StreamInsight</a></span><span style="font-family: tahoma,arial,helvetica,sans-serif;">&nbsp;(that we released back in <a href="https://blogs.msdn.com/b/nickmac/archive/2010/10/18/sql-server-2008-r2-streaminsight.aspx">SQL 2008 R2</a>) which is also available as an <a href="https://www.simple-talk.com/cloud/platform-as-a-service/-streaminsight-service-for-windows-azure/">Azure Service</a> holds important place in such IoT scenarios. Using StreamInsight we can </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">perform BI on data on real-time <span style="text-decoration: underline;">before it even gets stored in database</span> which is </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">a must for many scenarios.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif;"><span style="text-decoration: underline;"><strong>IoT and BigData:</strong></span> With IoT, it is natural to have a very large data storage with wide data formats (not just relational)&nbsp;</span><span style="font-family: tahoma,arial,helvetica,sans-serif;">that traditional SQL Server were never designed for. With such large storage of data it </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">is also expected to analyse this data at a speed that SQL Server cannot </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">deliver (SQL Server is typically good for Terabytes only). Many organizations cannot </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">afford solutions like SQL Parallel Data warehouse (PDW). So, the only choice remaining with </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">large data associated with IoT is using Big Data techniques like Microsoft&rsquo;s <a href="https://blogs.msdn.com/b/bigdatasupport/archive/2014/05/22/some-frequently-added-questions-on-microsoft-azure-hdinsight.aspx">HDInsight</a></span><span style="font-family: tahoma,arial,helvetica,sans-serif;">&nbsp;(Hadoop implementation on Azure) or HDP for windows (Hadoop implementation on </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">premise).</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif;"><span style="text-decoration: underline;"><strong>IoT and Embedded Systems:</strong></span> With the need for every device to be connected (by IoT </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">philosophy), it is natural to build intelligent small devices. Technologies </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">like <a href="https://www.microsoft.com/net/multiple-platform-support">.NET Micro framework</a>/ .NET Compact frameworks or <a href="https://www.microsoft.com/windowsembedded/en-us/windows-embedded-8.aspx">Windows embedded 8.1</a>. </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">Microsoft&rsquo;s <a href="https://blogs.msdn.com/b/windows-embedded/archive/2014/04/16/making-the-internet-of-things-accessible-with-microsoft-azure-intelligent-systems-service.aspx">Intelligent Systems Service</a> is the central place to stop by for building such devices.</span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif;"><span style="font-family: tahoma,arial,helvetica,sans-serif;"><span style="font-family: tahoma,arial,helvetica,sans-serif;"><span style="text-decoration: underline;"><strong>IoT and Service Bus: </strong></span></span>Microsoft is also creating the base for developing </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">custom solutions that are very much relevant in IoT. Networking Technologies </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">(like VPN) may not be sufficient enough to realize IoT in scenarios where small devices </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">cannot be part of VPN (lets say) but with <a href="https://msdn.microsoft.com/en-us/magazine/dn605873.aspx">technologies</a></span><span style="font-family: tahoma,arial,helvetica,sans-serif;">&nbsp;like <a href="https://msdn.microsoft.com/en-in/magazine/dn574801(en-us).aspx">Service Bus</a>, we can expect connected device vision.</span></span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif;"><span style="text-decoration: underline;"><strong>IoT and Industry Verticals:</strong></span> Microsoft&rsquo;s point of view about IoT is not just connecting </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">everything (<a href="https://www.informationweek.com/strategic-cio/executive-insights-and-innovation/ces-2014-ciscos-internet-of-everything-vision/d/d-id/1113407">Internet of everything</a>), rather connecting all those things that matter to us most. </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">This creates many scenarios for IoT like <a href="https://www.microsoft.com/windowsembedded/en-us/internet-of-things-retail.aspx">IoT in retail</a>, <a href="https://www.microsoft.com/windowsembedded/en-us/internet-of-things-health.aspx">IoT in healthcare</a>, <a href="https://www.microsoft.com/windowsembedded/en-us/internet-of-things-manufacturing.aspx">IoT in manufacturing</a> etc. </span></p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif;"><span style="text-decoration: underline;"><strong>IoT and Microsoft:</strong></span> With Microsoft&rsquo;s April 2014 <a href="https://www.zdnet.com/microsoft-delivers-preview-of-new-azure-cloud-service-for-internet-of-things-7000028469/">announcement</a></span><span style="font-family: tahoma,arial,helvetica,sans-serif;">&nbsp;of <a href="https://www.microsoft.com/windowsembedded/en-us/intelligent-systems-service.aspx">Azure Intelligent Systems Service</a>, we&rsquo;ve provided a practical solution towards </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">IoT demonstrating how IoT solutions could be built using HDInsight, PowerBI, </span><span style="font-family: tahoma,arial,helvetica,sans-serif;">embedded devices, <a href="https://www.microsoft.com/en-in/server-cloud/products/analytics-platform-system/#fbid=K53HHmdr9Bq">Analytics Platform System</a> (combining SQL (PDW) and Big Data (HDInsight)).</span></p>
<p>&nbsp;</p>
<p><span style="font-family: tahoma,arial,helvetica,sans-serif;">-Rahul Gangwar</span></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>Live ID Authentication</title>
      <link>https://docs.microsoft.com/archive/blogs/rahul/live-id-authentication</link>
      <pubDate>Mon, 27 Jun 2011 12:45:59 GMT</pubDate>
      <dc:creator><![CDATA[RahulGangwar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rahul/2011/06/27/live-id-authentication/</guid>
      <description><![CDATA[June 27 – 2011  Pre-requisites:   I assume the reader understands the concept of Claims...]]></description>
      <content:encoded><![CDATA[<p style="line-height: 13.5pt; list-style-type: disc; background: white; margin-left: 0cm; margin-right: 0cm"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">June 27 – 2011</font></font></span></p>  <p style="line-height: 13.5pt; list-style-type: disc; background: white; margin-left: 0cm; margin-right: 0cm"><font face="Verdana"><b style="mso-bidi-font-weight: normal"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font style="font-size: 10pt">Pre-requisites:</font></span></b><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font style="font-size: 10pt"> </font></span></font></p>  <p style="line-height: 13.5pt; list-style-type: disc; background: white; margin-left: 0cm; margin-right: 0cm"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">I assume the reader understands the concept of Claims Authentication and related terms like STS, IP...</font></font></span></p>  <p style="line-height: 13.5pt; list-style-type: disc; background: white; margin-left: 0cm; margin-right: 0cm"><font face="Verdana"><b style="mso-bidi-font-weight: normal"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font style="font-size: 10pt">About:</font></span></b><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font style="font-size: 10pt"> </font></span></font></p>  <p style="line-height: 13.5pt; list-style-type: disc; background: white; margin-left: 0cm; margin-right: 0cm"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">This post explains my understanding about Live ID authentication that you might want to integrate in your applications like Win Forms, SharePoint, CRM or a custom ASP.NET application.</font></font></span><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">Live ID exposes different ways of authenticating against it. The primary ones being:</font></font></span></p>  <p style="line-height: 13.5pt; list-style-type: disc; text-indent: -18pt; background: white; margin-left: 36pt; margin-right: 0cm; mso-list: l1 level1 lfo1"><span style="font-family: ; color: ; mso-bidi-font-family: symbol; mso-ansi-language: en; mso-fareast-font-family: symbol" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 10pt">·</font></font><span style="line-height: normal; font-family: "><font face="Times New Roman"><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></font></span></span></span><font face="Verdana"><b style="mso-bidi-font-weight: normal"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font style="font-size: 10pt">Using WS-Federation:</font></span></b><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font style="font-size: 10pt"> </font></span></font></p>  <p style="line-height: 13.5pt; list-style-type: disc; background: white; margin-left: 72pt; margin-right: 0cm"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">If you want to use WS-Federation, then you need to (1) Register your application with Live ID STS as trusted RP (use MSM </font></font><font style="font-size: 10pt"><a title="https://msm.live.com/wizard/default.aspx" href="https://msm.live.com/wizard/default.aspx"><b><font face="Verdana">https://msm.live.com/wizard/default.aspx</font></b></a><font face="Verdana"> ). This mechanism is also known by name Relying Party Suite. (2) Configure your application to start using Live ID: Live ID STS exposes its Federation Metadata which makes it easy for you to use FedUtil.exe in your application to establish this trust from RP to Live ID STS. the Federation metadata is found here: </font><a title="Metadata XML URL" href="https://nexus.passport-int.com/federationmetadata2/2007-06/federationmetadata.xml"><b><font face="Verdana">Metadata XML URL</font></b></a><font face="Verdana"> Seems easy. BUT the very first step of configuring your application as RP using MSM is not exposed to external customers. It is available only for Microsoft Partners. So as per my conclusion, even though Live ID supports WS-Federation, you won’t be able to use it “directly”. I will explain in next option why I have used the term “directly”. I am not sure why do we have this article published when we cannot actually use it publicly: </font><a title="https://technet.microsoft.com/en-us/library/ff973117.aspx" href="https://technet.microsoft.com/en-us/library/ff973117.aspx"><b><font face="Verdana">https://technet.microsoft.com/en-us/library/ff973117.aspx</font></b></a></font><font face="Verdana"><font style="font-size: 10pt"> </font></font></span></p>  <p style="line-height: 13.5pt; list-style-type: disc; text-indent: -18pt; background: white; margin-left: 36pt; margin-right: 0cm; mso-list: l1 level1 lfo1"><span style="font-family: ; color: ; mso-bidi-font-family: symbol; mso-ansi-language: en; mso-fareast-font-family: symbol" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 10pt">·</font></font><span style="line-height: normal; font-family: "><font face="Times New Roman"><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></font></span></span></span><font face="Verdana"><b style="mso-bidi-font-weight: normal"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font style="font-size: 10pt">Using Azure ACS:</font></span></b><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font style="font-size: 10pt"> </font></span></font></p>  <p style="line-height: 13.5pt; list-style-type: disc; background: white; margin-left: 72pt; margin-right: 0cm"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">Microsoft Azure Access Control Service (ACS) is an cloud STS. It offers Live ID authentication as out of box identity provider. In order to use this path for Live ID authentication, you need to (1) Configure ACS to start trusting your application as trusted RP. (2) Add Live ID as Identity Provider in ACS (3) Configure your application to start trusting ACS as trusted STS. Both these steps are pretty easy to be followed with minimal coding. Here is one post that explains in step by step manner: </font></font><font style="font-size: 10pt"><a title="https://msdn.microsoft.com/en-us/wazplatformtrainingcourse_introtoacslabsv2_topic2.aspx" href="https://msdn.microsoft.com/en-us/wazplatformtrainingcourse_introtoacslabsv2_topic2.aspx"><b><font face="Verdana">https://msdn.microsoft.com/en-us/wazplatformtrainingcourse_introtoacslabsv2_topic2.aspx</font></b></a>        <br /></font><font face="Verdana"><font style="font-size: 10pt">If this is so easy, then why doesn’t one always use it? </font></font></span></p>  <p style="line-height: 13.5pt; list-style-type: disc; text-indent: -18pt; background: white; margin-left: 108pt; margin-right: 0cm; mso-list: l0 level3 lfo2"><span style="font-family: ; color: ; mso-bidi-font-family: wingdings; mso-ansi-language: en; mso-fareast-font-family: wingdings" lang="EN"><span style="mso-list: ignore"><font face="Wingdings"><font style="font-size: 10pt">§</font></font><span style="line-height: normal; font-family: "><font face="Times New Roman"><font style="font-size: 7pt">&#160; </font></font></span></span></span><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">Cost: Azure ACS doesn’t come for free. You need to pay for it. </font></font></span></p>  <p style="line-height: 13.5pt; list-style-type: disc; text-indent: -18pt; background: white; margin-left: 108pt; margin-right: 0cm; mso-list: l0 level3 lfo2"><span style="font-family: ; color: ; mso-bidi-font-family: wingdings; mso-ansi-language: en; mso-fareast-font-family: wingdings" lang="EN"><span style="mso-list: ignore"><font face="Wingdings"><font style="font-size: 10pt">§</font></font><span style="line-height: normal; font-family: "><font face="Times New Roman"><font style="font-size: 7pt">&#160; </font></font></span></span></span><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">It adds an extra layer between your application and Live ID (a less agreed reason).</font></font></span></p>  <p style="line-height: 13.5pt; list-style-type: disc; text-indent: -18pt; background: white; margin-left: 36pt; margin-right: 0cm; mso-list: l1 level1 lfo1"><span style="font-family: ; color: ; mso-bidi-font-family: symbol; mso-ansi-language: en; mso-fareast-font-family: symbol" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 10pt">·</font></font><span style="line-height: normal; font-family: "><font face="Times New Roman"><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></font></span></span></span><font face="Verdana"><b style="mso-bidi-font-weight: normal"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font style="font-size: 10pt">Using APIs offered by Microsoft:</font></span></b><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font style="font-size: 10pt"> </font></span></font></p>  <p style="line-height: 13.5pt; list-style-type: disc; background: white; margin-left: 72pt; margin-right: 0cm"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">So, isn’t there any free, publicly available way of directly working with Live ID authentication? Well, yes there is and you can do it via APIs that Microsoft offered. These set of APIs (previously known with different names) are clubbed under the common name called as “Messenger Connect”. Messenger connect can not only be used to authenticate users with Live ID but also access their information stored on Live ID Servers like pictures, contacts etc. Here are details on how to achieve it with an ASP.NET application: </font></font><font style="font-size: 10pt"><a title="https://msdn.microsoft.com/en-us/library/ff748287.aspx" href="https://msdn.microsoft.com/en-us/library/ff748287.aspx"><b><font face="Verdana">https://msdn.microsoft.com/en-us/library/ff748287.aspx</font></b></a></font><font face="Verdana"><font style="font-size: 10pt"> </font></font></span></p>  <p style="line-height: 13.5pt; list-style-type: disc; background: white; margin-left: 0cm; margin-right: 0cm"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">You can also develop a custom claims provider that uses Messenger Connect and configure it with AD FS 2.0 so that you don’t have to code it every time you plan to use Live ID authentication.</font></font></span></p>  <p style="line-height: 13.5pt; list-style-type: disc; background: white; margin-left: 0cm; margin-right: 0cm"><span style="font-family: ; color: ; mso-bidi-font-family: arial; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 10pt">Rahul Gangwar</font></font></span></p>  <p style="line-height: 13pt; list-style-type: disc; margin: 0cm 0cm 10pt" class="MsoNormal"><span style="line-height: 12pt; font-family: "><font face="Verdana"><font style="font-size: 10pt" color="#000000">&#160;</font></font></span></p>]]></content:encoded>
    </item>
    <item>
      <title>ApplicationPoolIdentity and IIS</title>
      <link>https://docs.microsoft.com/archive/blogs/rahul/applicationpoolidentity-and-iis</link>
      <pubDate>Tue, 17 May 2011 13:45:29 GMT</pubDate>
      <dc:creator><![CDATA[RahulGangwar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rahul/2011/05/17/applicationpoolidentity-and-iis/</guid>
      <description><![CDATA[Ever faced the requirement of giving permissions to any resource (like folder) while your ASP.NET...]]></description>
      <content:encoded><![CDATA[<p><font size="2" face="Verdana">Ever faced the requirement of giving permissions to any resource (like folder) while your ASP.NET application’s pool is running under ApplicationPoolIdentity? Few points to understand:</font></p>  <ul>   <li><font size="2" face="Verdana">There is no fixed account for this so you would not find any account under in built accounts while trying to set ACL permissions.</font> </li>    <li><font size="2" face="Verdana">Corresponding to each AppPool that you have a new account is created when the AppPool starts. The naming convention is: “IIS APPPOOL\your_app_pool_name”. So if you have an application is running under “Classic .NET AppPool” then the local user account created is IIS APPPOOL\Classic .NET AppPool.</font> </li>    <li><font size="2" face="Verdana">Just grant permissions to this account and you are set to go.</font> </li>    <li><font size="2" face="Verdana">The benefit of this approach is that without you taking the trouble of creating any local user account under a system, you can configure to have your application run under different identity. Different applications can run simultaneously without any possibility to access each other’s data. Automatic provisioning also becomes easy.</font> </li>    <li><font size="2" face="Verdana">Since this account actually doesn’t exist on the system there are less chances that you would have given any other rights to this account and as a result any hacking threat doesn’t compromises your system.</font></li>    <li><font size="2" face="Verdana">But in order to best use this feature you need to make sure that for such compartmented security requirement, you need to run your application under a dedicated custom Application Pool. </font></li> </ul>  <p><font size="2" face="Verdana"></font></p>  <p><font size="2" face="Verdana">Rahul Gangwar</font></p>]]></content:encoded>
    </item>
    <item>
      <title>ADFS 2.0; The Service is Unavailable Error</title>
      <link>https://docs.microsoft.com/archive/blogs/rahul/adfs-2-0-the-service-is-unavailable-error</link>
      <pubDate>Mon, 16 May 2011 16:23:16 GMT</pubDate>
      <dc:creator><![CDATA[RahulGangwar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rahul/2011/05/16/adfs-2-0-the-service-is-unavailable-error/</guid>
      <description><![CDATA[Hi,
I just came to understand that while using the Step by step guides for ADFS 2.0 alongwith...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: verdana,geneva; font-size: large;">Hi,</span></p>
<p><span style="font-family: verdana,geneva; font-size: large;">I just came to understand that while using the Step by step guides for ADFS 2.0 alongwith combination of the Virtual machines that are present at connect Microsoft website, you might receive "Service Unavailable" errors while trying to navigate to ADFS asmx services or FederationMetadata.xml file.</span></p>
<p><span style="font-family: verdana,geneva; font-size: large;">The virtual Machines present at Microsoft connect location (below) have the Token-signing certificate and token-decrypting certificates on ContosoDC server expired on April 22 2011. Because of this ADFS is not able to build the certificate chain for these operations and as a result metadata endpoints are not exposed. An end user trying to work with these labs simply doesn&rsquo;t see federationmetadata.xml file.</span></p>
<p><span style="font-family: verdana,geneva; font-size: large;">Temporary Resolution:</span></p>
<p style="padding-left: 30px;"><span style="font-family: verdana,geneva; font-size: large;">While it would take time to get the VMs updated, you can work ahead by renewing the certificates manually. In order to do so folow below steps:</span></p>
<p style="padding-left: 30px;"><span style="font-family: verdana,geneva; font-size: large;">1. Log in as Administrator on ContosoDC</span></p>
<p style="padding-left: 30px;"><span style="font-family: verdana,geneva; font-size: large;">2. Open Powershell in administrative mode and enter the command: "Add-PSSnapin Microsoft.Adfs.Powershell"</span></p>
<p style="padding-left: 30px;"><span style="font-family: verdana,geneva; font-size: large;">3. Enter following commands one by one. After hitting enter, you need to wait till the command prompt returns back.</span></p>
<p style="padding-left: 60px;"><br /><span style="font-family: verdana,geneva; font-size: large;">Update-ADFSCertificate -CertificateType: Token-Signing -Urgent:$true</span></p>
<p style="padding-left: 60px;"><span style="font-family: verdana,geneva; font-size: large;">Update-ADFSCertificate -CertificateType: Token-Decrypting-Urgent:$true</span></p>
<p><span style="font-family: verdana,geneva; font-size: large;">VM Location: </span><a href="https://connect.microsoft.com/site642/Downloads/DownloadDetails.aspx?DownloadID=29506">https://connect.microsoft.com/site642/Downloads/DownloadDetails.aspx?DownloadID=29506</a> </p>
<p><span style="font-family: verdana,geneva; font-size: large;">&nbsp;Rahul Gangwar</span></p>
<p style="padding-left: 60px;"><br /><br /></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>ADFS 2.0; The Service is Unavailable Error</title>
      <link>https://docs.microsoft.com/archive/blogs/rahul/adfs-2-0-the-service-is-unavailable-error-2</link>
      <pubDate>Mon, 16 May 2011 16:23:00 GMT</pubDate>
      <dc:creator><![CDATA[RahulGangwar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rahul/2011/05/16/adfs-2-0-the-service-is-unavailable-error-2/</guid>
      <description><![CDATA[Hi,
I just came to understand that while using the Step by step guides for ADFS 2.0 alongwith...]]></description>
      <content:encoded><![CDATA[<p><span style="font-family: verdana,geneva; font-size: large;">Hi,</span></p>
<p><span style="font-family: verdana,geneva; font-size: large;">I just came to understand that while using the Step by step guides for ADFS 2.0 alongwith combination of the Virtual machines that are present at connect Microsoft website, you might receive "Service Unavailable" errors while trying to navigate to ADFS asmx services or FederationMetadata.xml file.</span></p>
<p><span style="font-family: verdana,geneva; font-size: large;">The virtual Machines present at Microsoft connect location (below) have the Token-signing certificate and token-decrypting certificates on ContosoDC server expired on April 22 2011. Because of this ADFS is not able to build the certificate chain for these operations and as a result metadata endpoints are not exposed. An end user trying to work with these labs simply doesn&rsquo;t see federationmetadata.xml file.</span></p>
<p><span style="font-family: verdana,geneva; font-size: large;">Temporary Resolution:</span></p>
<p style="padding-left: 30px;"><span style="font-family: verdana,geneva; font-size: large;">While it would take time to get the VMs updated, you can work ahead by renewing the certificates manually. In order to do so folow below steps:</span></p>
<p style="padding-left: 30px;"><span style="font-family: verdana,geneva; font-size: large;">1. Log in as Administrator on ContosoDC</span></p>
<p style="padding-left: 30px;"><span style="font-family: verdana,geneva; font-size: large;">2. Open Powershell in administrative mode and enter the command: "Add-PSSnapin Microsoft.Adfs.Powershell"</span></p>
<p style="padding-left: 30px;"><span style="font-family: verdana,geneva; font-size: large;">3. Enter following commands one by one. After hitting enter, you need to wait till the command prompt returns back.</span></p>
<p style="padding-left: 60px;"><br /><span style="font-family: verdana,geneva; font-size: large;">Update-ADFSCertificate -CertificateType: Token-Signing -Urgent:$true</span></p>
<p style="padding-left: 60px;"><span style="font-family: verdana,geneva; font-size: large;">Update-ADFSCertificate -CertificateType: Token-Decrypting-Urgent:$true</span></p>
<p><span style="font-family: verdana,geneva; font-size: large;">VM Location: </span><a href="https://connect.microsoft.com/site642/Downloads/DownloadDetails.aspx?DownloadID=29506">https://connect.microsoft.com/site642/Downloads/DownloadDetails.aspx?DownloadID=29506</a> </p>
<p><span style="font-family: verdana,geneva; font-size: large;">&nbsp;Rahul Gangwar</span></p>
<p style="padding-left: 60px;"><br /><br /></p>
<p>&nbsp;</p>]]></content:encoded>
    </item>
    <item>
      <title>MVVM with RIA Services</title>
      <link>https://docs.microsoft.com/archive/blogs/rahul/mvvm-with-ria-services</link>
      <pubDate>Tue, 05 Oct 2010 13:41:44 GMT</pubDate>
      <dc:creator><![CDATA[RahulGangwar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rahul/2010/10/05/mvvm-with-ria-services/</guid>
      <description><![CDATA[MVVM without RIA:  ·&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; MVVM relies on the concept that...]]></description>
      <content:encoded><![CDATA[<p style="margin: 0in 0in 0pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">MVVM without RIA:</font></font></span></b></p>  <p style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo3" class="MsoListParagraph"><font color="#333333"><span style="font-family: ; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol; mso-ansi-language: en" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 11pt">·</font></font><span style="line-height: normal; font-family: "><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span></span><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt">MVVM relies on the concept that View (XAML) will not contact your Model directly. </font></font></span></font></p>  <p style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo3" class="MsoListParagraph"><font color="#333333"><span style="font-family: ; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol; mso-ansi-language: en" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 11pt">·</font></font><span style="line-height: normal; font-family: "><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span></span><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt">View will contact Model via ViewModel classes.</font></font></span></font></p>  <p style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo3" class="MsoListParagraph"><font color="#333333"><span style="font-family: ; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol; mso-ansi-language: en" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 11pt">·</font></font><span style="line-height: normal; font-family: "><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span></span><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt">ViewModel talks with View using Data Binding and Commanding in XAML based applications.</font></font></span></font></p>  <p style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l2 level1 lfo3" class="MsoListParagraph"><font color="#333333"><span style="font-family: ; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol; mso-ansi-language: en" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 11pt">·</font></font><span style="line-height: normal; font-family: "><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span></span><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt">ViewModel talks with Model via web service communication in case of Silverlight when we don’t use RIA Service.</font></font></span></font></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-no-proof: yes"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/82/12/metablogapi/2626.clip_image0016_76298C2C.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-82-12-metablogapi/2626.clip_5F00_image0016_5F00_76298C2C.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image001[6]" border="0" alt="clip_image001[6]" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/82/12/metablogapi/1464.clip_image0016_thumb_2D236A66.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-82-12-metablogapi/1464.clip_5F00_image0016_5F00_thumb_5F00_2D236A66.png" width="663" height="317" /></a></span><span style="font-family: ; mso-ansi-language: en" lang="EN"></span></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">MVVM with RIA:</font></font></span></b></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>  <p style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2" class="MsoListParagraph"><font color="#333333"><span style="font-family: ; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol; mso-ansi-language: en" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 11pt">·</font></font><span style="line-height: normal; font-family: "><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span></span><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt">RIA Service abstracts the web service layer from developer’s perspective and presents on client an identical set of classes that we have in model on server.</font></font></span></font></p>  <p style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2" class="MsoListParagraph"><font color="#333333"><span style="font-family: ; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol; mso-ansi-language: en" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 11pt">·</font></font><span style="line-height: normal; font-family: "><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span></span><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt">This simply means that under normal MVVM scenario we just change the communication between ViewModel and Model to go via the auto generated model classes on client side instead of explicitly calling web services (though internally it is still WCF communication).</font></font></span></font></p>  <p style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l1 level1 lfo2" class="MsoListParagraph"><font color="#333333"><span style="font-family: ; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol; mso-ansi-language: en" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 11pt">·</font></font><span style="line-height: normal; font-family: "><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span></span><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt">In my opinion, this should not pose any problems to the MVVM pattern given that we keep the communication link same as above.</font></font></span></font></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-no-proof: yes"><a href="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/82/12/metablogapi/2548.clip_image0026_1929D7D0.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-82-12-metablogapi/2548.clip_5F00_image0026_5F00_1929D7D0.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image002[6]" border="0" alt="clip_image002[6]" src="https://msdnshared.blob.core.windows.net/media/MSDNBlogsFS/prod.evol.blogs.msdn.com/CommunityServer.Blogs.Components.WeblogFiles/00/00/00/82/12/metablogapi/2541.clip_image0026_thumb_7AFC1A1B.png" original-url="https://blogs.msdn.com/cfs-file.ashx/__key/CommunityServer-Blogs-Components-WeblogFiles/00-00-00-82-12-metablogapi/2541.clip_5F00_image0026_5F00_thumb_5F00_7AFC1A1B.png" width="695" height="433" /></a></span><span style="font-family: ; mso-ansi-language: en" lang="EN"></span></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">Cautions/DON’Ts:</font></font></span></b></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>  <p style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class="MsoListParagraph"><font color="#333333"><span style="font-family: ; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol; mso-ansi-language: en" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 11pt">·</font></font><span style="line-height: normal; font-family: "><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span></span><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt">We should never attach the auto generated client model classes of RIA with View directly. This link of View to Model should happen via ViewModel only. In a nutshell, these auto-generated model classes should never be considered as ViewModel.</font></font></span></font></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>  <p style="text-indent: -0.25in; margin: 0in 0in 0pt 0.5in; mso-list: l0 level1 lfo1" class="MsoListParagraph"><font color="#333333"><span style="font-family: ; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol; mso-ansi-language: en" lang="EN"><span style="mso-list: ignore"><font face="Symbol"><font style="font-size: 11pt">·</font></font><span style="line-height: normal; font-family: "><font style="font-size: 7pt">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </font></span></span></span><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt">We also have the availability of some RIA controls like DomainDataSource (in XAML). In case of MVVM we should NEVER use any such RIA controls in XAML since they break the very pillar of MVVM by contacting auto generated client side model of RIA directly (which is same as above point).</font></font></span></font></p>  <p style="margin: 0in 0in 0pt 0.5in" class="MsoListParagraph"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">Rahul Gangwar</font></font></span></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>  <p style="margin: 0in 0in 0pt" class="MsoNormal"><span style="font-family: ; mso-ansi-language: en" lang="EN"><font face="Verdana"><font style="font-size: 11pt" color="#333333">&#160;</font></font></span></p>]]></content:encoded>
    </item>
    <item>
      <title>Silverlight Graphics and Hardware Acceleration</title>
      <link>https://docs.microsoft.com/archive/blogs/rahul/silverlight-graphics-and-hardware-acceleration</link>
      <pubDate>Wed, 09 Jun 2010 09:38:21 GMT</pubDate>
      <dc:creator><![CDATA[RahulGangwar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rahul/2010/06/09/silverlight-graphics-and-hardware-acceleration/</guid>
      <description><![CDATA[Hi,         Today is May 20th 2010 and I am writing this post to discuss the working mechanism of...]]></description>
      <content:encoded><![CDATA[<p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Hi, </span></p>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Today is May 20th 2010 and I am writing this post to discuss the working mechanism of Silverlight’s capability of utilizing GPU of your machine. </span></p>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">There are two kinds of graphics popular today:</span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160; </span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">1. Bitmap Graphics: </span></b>    <p></p> </p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt 0.5in" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Here the graphics is a file that stores the display information in the form of pixel information. Basically the term itself means map of bits. Each pixel stores information about how to light it up, in the data structure: Color Depth. This structure (color depth) can be of various size like 8bit, 16 bit, 32 bit etc. and larger the data structure the more information about the pixel can be stored. This determines the bit depth. So when you buy a scanner/camera kind of device you can relate what bit depth mean and what mega pixel means. Two devices having same megapixel but different bit depth will capture different quality of images. </span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt 0.5in" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Now larger the number of pixels per inch you have for your image, lesser would be distortion if you try expanding the image. But as we store larger number of pixels, the size of image also grows large. This means for all practical purpose there is a limit to which you can expand your image to a larger size. Theoretically no matter how many pixels an image contains, expanding to larger size will definitely distort its quality. It is just that it won’t be visible to human eye if the expansion and number of pixels are maintained to a balanced level. Not only that the image quality decreases even if you shrink it beyond the allowed limit. That is why we use less pixel images if the display required is small (not primarily because of size, but for quality). So a high resolution image/video will not look good on a small device. You need to re-encode it! </span></p>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"></span></p>  <p>&#160;</p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">2. Vector Graphics</span></b><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160; </span></p>  <p></p>  <p style="margin: 0in 0in 10pt 0.5in" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Here the graphics is store as mathematical formulas. Like lines, formulas for different shapes like curves or even custom algorithm is created to interpret the shape. This means that no matter how big/small display we need, the information will simply remain the same. Size of vector images will remain always same irrespective of how large/small it is displayed. The size changes with the complexity of information stored. If you want to display simple shapes like triangle, circle or even combination of such shapes, vector images are best. But if you ever try to convert a photograph that you clicked on that famous hill station, your resulting vector image would be larger in size and also in worse condition because vector graphics techniques are not so sophisticated to convert the graphics created by God into man made. No lens in the world could be better than your eye and no speaker in the world could be better than your ear! You might call that as a limiting factor or something mysterious :). </span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Now coming back to Silverlight, the graphics that you display with Silverlight can be rendered using two ways:</span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160; </span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">1. Using Graphics Card (GPU) (primarily when the graphics is bitmap). </span></p>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">2. Using Software that is run by CPU (primarily when the graphics is vector based).</span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">The XAML that you write in your SL application are displayed using CPU. They are all formulas that are calculated and rendered by CPU. When you instruct SL to use GPU we call that as GPU acceleration. Why “acceleration”, I don’t know. Probably “assisted” would have been better term.</span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Mechanism: </span></b><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">It is simple. You specify the UI elements that you want to display using GPU by adding the attribute CacheMode=”Bitmap”. Now all the UI elements are represented in form of object tree in Silverlight. Silverlight does the calculation to create the object tree and forms a bitmap for that object tree. Then, Silverlight gives this bitmap to GPU to display it and keeps it cached. Now, when the application screen refreshes, that part of the screen that you specified to be displayed by GPU is simply rendered by GPU and the rest part of the UI is rendered by SL using CPU. As a result, we are using less CPU and improving performance. Even if you are performing some animations like scaling, changing opacity etc. these are done by GPU and not by CPU. </span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Why not Always?      <br />This seems interesting so why not do it always using GPU? Few reasons (not in order of any priority): </span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="text-indent: -0.25in; margin: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class="MsoListParagraph"><span style="line-height: 115%; font-family: symbol; font-size: 12pt; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"><span style="mso-list: ignore">·<span style="font: 7pt &#39;Times New Roman&#39;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">There are some animations that GPU cannot assist (like changing perspective (3D), animating on each pixel such as pixel shader effects). There is no point in using GPU acceleration in such scenarios. </span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="text-indent: -0.25in; margin: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class="MsoListParagraph"><span style="line-height: 115%; font-family: symbol; font-size: 12pt; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"><span style="mso-list: ignore">·<span style="font: 7pt &#39;Times New Roman&#39;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">If the GPU has less memory and if the memory required by Silverlight is large, Silverlight falls back to CPU mode and you will hit performance. Also there is no way to query memory available in GPU from Silverlight code. However you can query other details like GPU vendor, driver version etc. through Analytics.GpuCollection structure. </span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="text-indent: -0.25in; margin: 0in 0in 10pt 0.5in; mso-list: l0 level1 lfo1" class="MsoListParagraph"><span style="line-height: 115%; font-family: symbol; font-size: 12pt; mso-fareast-font-family: symbol; mso-bidi-font-family: symbol"><span style="mso-list: ignore">·<span style="font: 7pt &#39;Times New Roman&#39;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </span></span></span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Cache Invalidations: If your UI element is changing a lot and that change cannot be assisted by GPU (another example is changing text of a UI element lie textbox), then cache invalidation happens and we hit on performance.</span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Note: </span></b><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"></span></p>  <p>&#160;</p> <span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">You also need to enable the GPU acceleration at plug-in level by setting a parameter as shown below: </span>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><i style="mso-bidi-font-style: normal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; color: #006600; font-size: 10pt">&lt;param name=&quot;enableGPUAcceleration&quot; value=&quot;true&quot; /&gt;</span></i><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"> </span></p>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Also note that on Mac OSX GPU acceleration works only in full screen mode. Users need to have a DirectX9 (windows) or OpenGL2 (Mac) compatible video card.</span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Testing:</span></b><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"> </span></p>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">You can test the GPU acceleration by adding another parameter to the plug-in as shown below:      <br />      <br /></span><i style="mso-bidi-font-style: normal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; color: #006600; font-size: 10pt">&lt;param name=&quot;enableCacheVisualization&quot; value=&quot;true&quot; /&gt;</span></i><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"> </span></p>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">This parameter shows all GPU accelerated graphics in natural colors while all non GPU accelerated graphics in Red color for testing purpose. </span></p>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">When you test CPU percentage, make sure you use lesser number of cores and more complex graphics to actually see the difference in performance. </span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Beware Animation: </span></b><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Please make sure that the UI elements for which you have used GPU acceleration are using below animations only and not anything else:</span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160; </span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Scale, Rotate, Changing Opacity, Clipping (only if clip is rectangular). For all other types of animations like 3D, moving, pixel shaders, do not use GPU acceleration. </span><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">&#160;</span></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><b style="mso-bidi-font-weight: normal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">Poor Joke:        <br /></span></b><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt">If you like the post, you can pay pal me <a href="https://blogs.msdn.com/b/rahul/contact.aspx">here</a>.</span></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"><span style="mso-spacerun: yes">&#160;</span> </span></p>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"></span></p>  <p>&#160;</p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"><span style="mso-spacerun: yes">&#160;</span> </span></p>  <p></p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"></span></p>  <p>&#160;</p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"></span></p>  <p>&#160;</p>  <p></p>  <p></p>  <p style="margin: 0in 0in 10pt" class="MsoNormal"><span style="line-height: 115%; font-family: &#39;Verdana&#39;,&#39;sans-serif&#39;; font-size: 12pt"></span></p>]]></content:encoded>
    </item>
    <item>
      <title>WCF Data Service; Server Driven Paging (SDP); Silverlight</title>
      <link>https://docs.microsoft.com/archive/blogs/rahul/wcf-data-service-server-driven-paging-sdp-silverlight</link>
      <pubDate>Tue, 05 Jan 2010 05:16:19 GMT</pubDate>
      <dc:creator><![CDATA[RahulGangwar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rahul/2010/01/05/wcf-data-service-server-driven-paging-sdp-silverlight/</guid>
      <description><![CDATA[Hi,  Today is January 5th 2010 and I am writing this post to explain the mechanism of the Server...]]></description>
      <content:encoded><![CDATA[<p><font color="#000000">Hi,</font></p>  <p><font color="#000000">Today is January 5th 2010 and I am writing this post to explain the mechanism of the Server Driven Paging feature of WCF Data Service and also a code guide on how to use this from Silverlight 4.0. </font></p>  <p><strong><font color="#000000">The Pattern:</font></strong></p>  <p><font color="#000000">Server Driven paging is one of the </font><a href="https://blogs.msdn.com/astoriateam/archive/2009/08/31/ado-net-data-services-v1-5-ctp2-now-available-for-download.aspx" target="_blank"><u><font color="#000000">new features</font></u></a><font color="#000000"> that have been added in WCF Data Service Version 1.5 CTP2 (formerly called as ADO.NET Data Service). The feature in simple terms means transmitting data in pages. This feature is important from performance point of view and also an important pattern used in applications where UI layer and data access layer are separated by cloud. I view this as a pattern used many places; the most common of being “chunking” approach used in large data transfer. Take example for WCF data transfer of a large file. We typically implement and recommend to use “chunking” pattern to transmit large data from one place to another because of many reasons. One reason could be to support “resume” functionality. So if data transfer is interrupted at 50%, we don’t need to start all over again next time. We can resume from 50%. Another reason could be to allow large data transfers where network policies put an upper bound on data transfers. One more possibility I can think of is unreliable network (which internet is) where packet loss is very common and would otherwise lead to long time to get a perfect data flow in one go. Server driven paging is the same pattern/algorithm applied to transfer large set of records between WCF Data Service and client so that it doesn’t put pressure on client (e.g, to render millions of records with small scroller in a single data grid, or storing large records in client memory after he waited for good 10 minutes or so). In short, paging makes the overall process faster on average. Server driven paging gives more performance since we save time in transmitting very large number of records over the wire and improve the end user experience.</font></p>  <p><strong><font color="#000000">The Mechanism:</font></strong></p>  <p><font color="#000000">The mechanism is simple and worth understanding to make decision about whether to use this feature or not:</font></p>  <p><font color="#000000"><strong>Step 1:</strong> Client sends request to fetch data by firing query.</font></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_2.png" original-url="https://blogs.msdn.com/blogfiles/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_thumb.png" original-url="https://blogs.msdn.com/blogfiles/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_thumb.png" width="244" height="184" /></a></p>  <p><font color="#000000"><strong>Step 2:</strong> Server Fetches result from Data Base for a given page. This step needs a little elaboration since here comes the important factor that might decide how effective SDP of WCF Data service is for your scenario:</font></p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_4.png" original-url="https://blogs.msdn.com/blogfiles/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_thumb_1.png" original-url="https://blogs.msdn.com/blogfiles/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_thumb_1.png" width="244" height="184" /></a> </p>  <p></p>  <p><font color="#000000">When a user fires a query from client, the data service fetches the result based on page size and the page on which currently the user is. If we want to implement paging in our application from scratch, we usually follow one of the two approaches to achieve this:</font></p>  <ul>   <li><font color="#000000">&#160;<strong>Session based approach:</strong> We store the page on which a user currently is in the session. So we always know which page the user wants when he clicks next/previous. <strong>Pros:</strong> Sometimes in order to improve speed we also cache result set in session and simply return the required page and in fact for such cases, this is the only approach we use. We cannot afford to go to DB every time the request comes.        <br />Another benefit of this approach is that the client code is very simple, we simply have to tell whether we need next or previous page. On server side, we fetch records from DB that should be present on a particular page.         <br /><strong>Cons: </strong>Drawback is that the moment session expires, the page tracking is lost and it also requires us to scale server. Not a preferred approach for most of business scenarios that I have encountered.</font></li> </ul>  <p><font color="#000000"></font></p>  <ul>   <li><font color="#000000"><strong>No session approach:</strong> Here we establish some unique key that can be used to calculate which records should be present on a particular page. An example would be a combination of “page number” and “page size” would give the records that should be present on a given page. Every time a new page is requested, we go to database to fetch the records for that page and return them. This approach is used where scalability is more important than speed. We don’t put pressure of storing calculated results in memory at server.</font></li> </ul>  <p><font color="#000000">WCF Data Service uses “no session” approach and goes to DB every time a new page is fetched. It uses primary key as the counter to reach to a particular page. So when a next page request comes, it contains the primary key of the last record of the last page. WCF Data Service goes to Database, orders the query by primary key, fetches records of page size starting after the provided argument by client and returns result. The benefit of this approach is that you don’t depend on session for paging. This approach is also ideal for clients (especially thick clients like Silverlight) that might not talk to server for long time. Another benefit is that we don’t need to scale the server by not storing large set of data in session. The drawback of this approach is that it is not performance effective since it goes to DB for each request. Not only that, it uses orderby in query fired to DB which is even slower than an equivalent query not using “orderby”.</font></p>  <p><font color="#000000"><strong>Step 3:</strong> WCF Data Service returns the data for the requested page. Along with the Data it also returns a URL that contains the URL to fetch next page.</font> </p>  <p><a href="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_6.png" original-url="https://blogs.msdn.com/blogfiles/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_6.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="https://msdnshared.blob.core.windows.net/media/TNBlogsFS/BlogFileStorage/blogs_msdn/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_thumb_2.png" original-url="https://blogs.msdn.com/blogfiles/rahul/WindowsLiveWriter/WCFDataServiceServerDrivenPagingSDPSilve_107DE/image_thumb_2.png" width="244" height="184" /></a> </p>  <p><strong>Sample Code with Silverlight:</strong></p>  <p>The following Sample Code has been developed using Visual Studio 2010 and Silverlight 4, but it will work fine with SL 3.0 as well since Data Service is all based on REST. Just that right client APIs need to be used and correct version of Data Service is needed at server side to enable Server Driven Paging. <a href="https://blogs.msdn.com/rahul/contact.aspx"><u>Contact me</u></a> if you need a working sample code and if anything below did not worked.</p>  <ul>   <li><font color="#000000">Create a Silverlight 4.0 Application</font></li>    <li><font color="#000000">Add Database to Server. Add Employee Table with FirstName, LastName and eMail (Primary Key). This is the table that we are going to page via server upon client request. Fill it with some data… maybe 5 records.</font></li>    <li><font color="#000000">Add DataLayer at server side using Entity Framework.</font></li>    <li><font color="#000000">Add ADO.NET Data Service at server side. Attach it to DataLayer, set its Access Rule, turn on ServerDriven Paging with Page size and Protocol version to be used by adding following statements in InitializeService() method of ADO.NET Data Service:</font></li> </ul>  <p align="left"><i><font color="#800000" size="1">config.SetEntitySetAccessRule(&quot;*&quot;, EntitySetRights.All);       <br /></font></i></p>  <p align="left"><font size="1"><font color="#800000"><i>//enable server driven paging with PageSize </i><i></i></font></font></p>  <p align="left"><i><font color="#800000" size="1">config.SetEntitySetPageSize(&quot;Employees&quot;, 2);       <br /></font></i></p>  <p align="left"><i><font color="#800000" size="1">//This is required for server driven paging to work and maintain backword compatibility since SDP doesn't work with version 1 of data service       <br /></font></i></p> <i></i>  <p align="left"><i><font color="#800000" size="1">config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;</font></i></p>  <ul>   <li><font color="#000000">Add DataGrid and next button on Silverlight client. Remember to autogenerate columns to true for datagrid.</font></li>    <li><font color="#000000">Fix port address for website and add service reference to WCF data service in SL client.</font></li>    <li><font color="#000000">On Silverlight client code behind, add proxy to data service and client type that will hold link to next URI on every request fired to data service. The code is similar to below:</font></li> </ul>  <p><font size="1"><font color="#800000"><i>//add proxy to wcf data service where we can fire queries</i><i></i></font></font></p>  <p><i><font color="#800000" size="1">public DatabaseEntities myDB = new DatabaseEntities(new</font></i></p>  <p><font size="1"><font color="#800000"><i>Uri</i><i>(@&quot;https://localhost:53951/WebDataService1.svc/&quot;, UriKind.RelativeOrAbsolute));</i></font></font></p>  <p><font size="1"><font color="#800000"><i>//add the client type that will hold the link to next uri (next page of records) after every request</i><i></i></font></font></p>  <p><font color="#800000" size="1">public DataServiceQueryContinuation&lt;Employee&gt; token = null;</font></p>  <ul>   <li><font color="#000000">On PageLoad, execute query to get all records from server. Code is same as any WCF Data Service code and shown below:</font></li> </ul>  <p><font color="#800000"><i>public</i><i> MainPage()</i></font></p>  <p><i><font color="#800000">{</font></i></p>  <p><i><font color="#800000">InitializeComponent();</font></i></p>  <p><i><font color="#800000"></font></i></p>  <p><i><font color="#800000">//execute query to get all records from table</font></i></p>  <p><i><font color="#800000">var q = from e in myDB.Employees</font></i></p>  <p><i><font color="#800000">select e;</font></i></p>  <p><i><font color="#800000">var eq = q as DataServiceQuery&lt;Employee&gt;;</font></i></p>  <p><i><font color="#800000">eq.BeginExecute(new AsyncCallback(MyCallback), eq);</font></i></p>  <p><i><font color="#800000">}</font></i></p>  <p><i></i></p>  <ul>   <li><font color="#000000">On Callback, write code to collect response for two different conditions. The entire code behind is shown below. I have not included XAML since its trivial having a blank Datagrid with autogenerate columns to true and a button for next page:</font></li> </ul>  <p><font color="#800000"><b>public</b><b> partial class MainPage : UserControl</b></font></p>  <p><font color="#800000">{</font></p>  <p><font color="#800000">//add proxy to wcf data service where we can fire queries</font></p>  <p><font color="#800000">public DatabaseEntities myDB = new DatabaseEntities(new</font></p>  <p><font color="#800000">Uri(@&quot;https://localhost:53951/WebDataService1.svc/&quot;, UriKind.RelativeOrAbsolute));</font></p>  <p><font color="#800000">//add the client type that will hold the link to next uri (next page of records) after every request</font></p>  <p><font color="#800000">public DataServiceQueryContinuation&lt;Employee&gt; token = null;</font></p>  <p><b><font color="#800000">public MainPage()</font></b></p>  <p><font color="#800000">{</font></p>  <p><font color="#800000">InitializeComponent();</font></p>  <p><font color="#800000">//execute query to get all records from table</font></p>  <p><font color="#800000">var q = from e in myDB.Employees</font></p>  <p><font color="#800000">select e;</font></p>  <p><font color="#800000">var eq = q as DataServiceQuery&lt;Employee&gt;;</font></p>  <p><font color="#800000">//this is called once and the caller is DataServiceQuery&lt;Employee&gt;; </font></p>  <p><font color="#800000">//so in callback it has to be collected in the same datatype which is what is written</font></p>  <p><font color="#800000">//in when next querytoken is null (since we are still to collect it).</font></p>  <p><font color="#800000">eq.BeginExecute(new AsyncCallback(MyCallback), eq);</font></p>  <p><font color="#800000">}</font></p>  <p><b><font color="#800000">public void MyCallback(IAsyncResult result)</font></b></p>  <p><font color="#800000">{</font></p>  <p><font color="#800000">//slot to hold returned result</font></p>  <p><font color="#800000">IEnumerable&lt;Employee&gt; response = null;</font></p>  <p><font color="#800000">if (token != null) //this is executed everytime we have clicked on next button</font></p>  <p><font color="#800000">{</font></p>  <p><font color="#800000">//since in next button click we used DatabaseEntities to fire query , we need to typecast it to the same type</font></p>  <p><font color="#800000">var eq = result.AsyncState as DatabaseEntities;</font></p>  <p><font color="#800000">//collect the response</font></p>  <p><font color="#800000">response = eq.EndExecute&lt;Employee&gt;(result);</font></p>  <p><font color="#800000">}</font></p>  <p><font color="#800000">else//this &quot;else&quot; is executed only for the first call to WCF data service; we get token only after first call</font></p>  <p><font color="#800000">{</font></p>  <p><font color="#800000">//since the first call was made by DataServiceQuery&lt;Employee&gt;, we are typecasting it to the same type on first callback</font></p>  <p><font color="#800000">var eq = result.AsyncState as DataServiceQuery&lt;Employee&gt;;</font></p>  <p><font color="#800000">//collect the response</font></p>  <p><font color="#800000">response = eq.EndExecute(result);</font></p>  <p><font color="#800000">}</font></p>  <p><font color="#800000">//bind the data to datagrid (but do it before typecasting response to get token </font></p>  <p><font color="#800000">//or collect data first in separate instance and then typecast the returned result to get next token)</font></p>  <p><font color="#800000">dataGrid1.ItemsSource = response.ToList();</font></p>  <p><font color="#800000">//collect next page uri by typecasting the returned response</font></p>  <p><font color="#800000">var qor = response as QueryOperationResponse&lt;Employee&gt;;</font></p>  <p><font color="#800000">token = qor.GetContinuation();</font></p>  <p><font color="#800000">}</font></p>  <p><b><font color="#800000">private void button1_Click(object sender, RoutedEventArgs e)</font></b></p>  <p><font color="#800000">{</font></p>  <p><font color="#800000">//if there are more pages</font></p>  <p><font color="#800000">if (token != null)</font></p>  <p><font color="#800000">//fire the next page query to proxy of WCF Data Service</font></p>  <p><font color="#800000">myDB.BeginExecute(token, new AsyncCallback(MyCallback), myDB);</font></p>  <p><font color="#800000">}</font></p>  <p><font color="#800000">}</font></p>  <p><font color="#800000"></font></p>  <p><font color="#000000">Comments/error always welcome. <a href="https://blogs.msdn.com/rahul/contact.aspx"><u>Contact me</u></a> if you need a working sample code and if anything below did not worked.</font></p>]]></content:encoded>
    </item>
    <item>
      <title>Why Task Based Programming (Parallel Extensions)</title>
      <link>https://docs.microsoft.com/archive/blogs/rahul/why-task-based-programming-parallel-extensions</link>
      <pubDate>Wed, 14 Oct 2009 14:06:37 GMT</pubDate>
      <dc:creator><![CDATA[RahulGangwar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rahul/2009/10/14/why-task-based-programming-parallel-extensions/</guid>
      <description><![CDATA[Hi,  Today is October 15th 2009 and I am writing this post to express my understanding about...]]></description>
      <content:encoded><![CDATA[<p>Hi,</p>  <p>Today is October 15th 2009 and I am writing this post to express my understanding about parallel programming using Parallel Extensions (or Task based parallel programming); specifically to express why should we go for this approach.</p>  <p>Since the Parallel Extension announcement, I was excited to get my hands dirty with it but after working with Parallel Extensions, I had few initial questions that I thought everyone would have and there is less content available online that targets against benefits of Parallel extensions. Below are a couple of questions that I am targeting in this post.</p>  <ul>   <li>Is Threading going to die? Are Parallel Extensions replacements to Threading?</li>    <li>Sometimes Threading gives me better performance than Task based programming. Why?</li> </ul>  <p>Before we come to these questions, it would be worth understanding options other than parallel extensions that we used to follow for parallel programming. Before Parallel Extensions, we would use primarily any of the below two modes for parallel programming:</p>  <p><strong>Directly Creating Threads:</strong>    <br />Here we create Threads directly in our code something similar to the following code:</p>  <blockquote>   <p><em>Thread t = new Thread(DoSomeWorkMethod);       <br />t.Start(someInputValue);</em></p> </blockquote>  <p><strong>Benefits:     <br /></strong>The benefit of this approach is that each of the thread will run at all times. .NET Framework’s scheduling algorithm will make sure that all the threads that we created will execute in similar to RoundRobin algorithm (though actual algorithm is different). This approach is especially useful in cases where I want to provide justice to all threads.     <br />Another benefit associated with this approach is the fact that we have control over these created threads like aborting a thread in the middle.</p>  <p><strong>Drawbacks:     <br /></strong>The drawback of this approach comes into picture when we have more threads than the available CPUs (cores). As an example, if we have two cores and I am running 10 threads, context switching, invalidation of each thread’s cache etc. So we need to keep a balance between how many CPUs we have and how many Threads should we create for optimum performance.</p>  <p><strong>Using Thread Pool:     <br /></strong>.NET Framework has a thread pool (configurable) which limits the number of Threads that can be run at a time. Now when we want to execute something in a separate thread, we simply queue our work on a thread of thread pool instead of creating our own separate thread. Code looks something similar to below:</p>  <blockquote>   <p><em>ThreadPool.QueueUserWorkItem(       <br /> DoSomeWorkMethod, someInputValue);</em></p> </blockquote>  <p><strong>Benefits:     <br /></strong>Thread Pool size for .NET Framework can be set by doing a simple calculation using number of CPUs the machine has. After this, Thread Pool makes sure to run only those number of threads that are optimal for a particular machine. This prevents any context switching and other overheads. So we get best performance.</p>  <p><strong>Drawbacks:</strong>    <br />The drawback of this approach is that developer doesn’t have much control over the Queued tasks over Thread Pool. In other words, once we have queued a work item, we do not get a reference to it and there is no explicit support for knowing when it completed, or for blocking until it completes or for cancelling it, or for identifying it in the debugger via some sort of ID etc. Plus, you are not guaranteed when your Task will start to run, so progress is unknown.</p>  <p><strong>Using Parallel Extensions:</strong>    <br />This approach is the one that we are here to discuss. Task based programming combines the benefit of both the approaches with some new additions. Using task Based programming, you create Tasks instead of Threads and start executing them. Programmatically they are almost identical to Thread Based programming with additions features. Here is a code snippet that uses the new Task class: </p>  <blockquote>   <p><em>Task t = Task.Create(DoSomeWorkMethod,       <br /> someInputValue);</em></p> </blockquote>  <p><strong>Benefits:</strong></p>  <ul>   <li>With Task Based programming, by default, you can be sure that we are not actually decreasing the performance by doing excessive multitasking since Task Manager (central class in Parallel Extensions) takes care of this issue by queuing any additional tasks if all the existing CPUs are busy.</li>    <li>With Task based programming you have complete control over the Task. You can pause, abort, wait, join etc. </li>    <li>The scheduling algorithm is improved over Thread Pool approach with new features like “Task Stealing”.</li>    <li>You get additional constructs to easily work with, like Parallel LINQ, Parallel For Loop etc.</li> </ul>  <p><strong>Drawbacks:</strong></p>  <p>Personally I see the only drawback is that you are not guaranteed when the Task will execute. So if you want to guarantee of starting your Task execution as soon as it is created, use plain old Threading Way. UI multitasking as an example should be done with Threading and not Thread Pool or Task based programming.</p>  <p>I will also share one interesting incident that happened while I was developing a Proof Of Concept. I was running the samples on a 4 Core Machines and created 2 Threads to do a Task and then 2 Tasks to do the same task and I could not see any improvement. Then I realized that if I am creating Threads which are less in number than available free CPUs I might actually get some greater performance sometimes, but that is not a guarantee. With task based programming, I can guarantee that either all my Tasks are running in parallel or all CPUs are busy executing my tasks.</p>  <p>I will try to cover benefits approach in future posts but for now, it is done.</p>  <p>I hope this post was useful. If you are a Microsoft Partner, please feel free to involve our team for all your development consultation needs by contacting us <a href="https://blogs.msdn.com/rahul/contact.aspx">here.</a> Comments, corrections; I Love them.</p>  <p>Rahul Gangwar</p>]]></content:encoded>
    </item>
    <item>
      <title>Microsoft Codename "Gemini"</title>
      <link>https://docs.microsoft.com/archive/blogs/rahul/microsoft-codename-gemini</link>
      <pubDate>Tue, 28 Jul 2009 12:47:25 GMT</pubDate>
      <dc:creator><![CDATA[RahulGangwar]]></dc:creator>
      <guid
        isPermaLink="false">https://blogs.msdn.microsoft.com/rahul/2009/07/28/microsoft-codename-gemini/</guid>
      <description><![CDATA[&nbsp; Hi, Today is July 28th 2009 and I am writing this small post to share my understanding on...]]></description>
      <content:encoded><![CDATA[<p>&nbsp;</p> <p>Hi,</p> <p>Today is July 28th 2009 and I am writing this small post to share my understanding on Gemini and Business Intelligence arena and specifically around Analysis Service.</p> <p>Talk about data in Microsoft and the very first thing that comes in mind is SQL Server. Microsoft hardly released SQL 2008 and we are looking forward for next version of SQL Server. That is very ambitious.</p> <p>When it comes to Business Intelligence problem, things like Reporting, Analysis, data-mining come automatically forms part of the solution. But there are few patterns that should be considered for developing an efficient BI solution. Before talking about Analysis Service, let's understand how operations are different in OLTP vs OLAP databases. </p> <p>In OLTP databases, data is written in form of rows (relational databases). So for example, if I want to store two records of two column structure having (name and email as columns) the storage will go in a fashion:<br>"Rahul" "<a href="mailto:rahul@contoso.com">rahul@contoso.com</a>", "Sabiha" "<a href="mailto:sabiha@contoso.com">sabiha@contoso.com</a>".<br>Eeffectively, data is written over disk one row at a time. This makes typical OLTP transactions efficient&nbsp; since I can quickly read/write a all columns of ONE record somewhere in middle of 50 million rows. But when it comes to reading ALL records (let's say email of all 50 Million records), relational databases fail miserably in terms of performance.</p> <p>In OLAP databases, data is stored in a different fashion. It is stored in the form of columns rather that rows. So if I want to store the same set of records in columnar fashion, it would be stored this ways:<br>"Rahul" "Sabiha", "<a href="mailto:rahul@contoso.com">rahul@contoso.com</a>" "<a href="mailto:sabiha@contoso.com">sabiha@contoso.com</a>".<br>The benefit and drawbacks are here. <br>If I want to read columns of ONE record somewhere in middle of 50 million rows, it will fail miserably in comparison to relational databases. But when it comes to reading a column of ALL records, this will be surprisingly fast (and this requirement is very common in Analysis: to read large number of records rather than one record).<br><br>So one thing is clear that columnar databases are better than relational databases for data analysis.</p> <p>Another thing that need to be considered while designing analysis solution is the storage medium. Databases that use disk as the storage medium will perform very slow for performing analysis algorithms than the databases that use in memory medium as storage. Storing data in memory is fast because of the medium speed as well as saving CPU cycles. Although the durability property of ACID is lost in this process (since memory is volatile) but this still holds a good candidate for analysis solutions.&nbsp; Even hybrid storage mechanisms can be considered depending on the requirement scenario.<br><br>Now comes Microsoft's project codename "Gemini". Gemini is next version of Analysis Service based on the concepts of using columnar database and in memory storage, making analysis of data hell fast. Gemini will be shipped in the next version of SQL Server (2008 R2/Kilimanjaro).<br>The good thing is that Excel users can use its capability by installing a plug-in. Hence the term "self service analysis". Every user in an organization will be able to analyse data and take decisions using simple Excel. More here:<br><a title="https://www.microsoft.com/presspass/press/2008/oct08/10-06BI08PR.mspx" href="https://www.microsoft.com/presspass/press/2008/oct08/10-06BI08PR.mspx">https://www.microsoft.com/presspass/press/2008/oct08/10-06BI08PR.mspx</a>&nbsp;</p> <p>I hope this gives a peek about what Gemini is and how it will work.</p> <p><a href="https://blogs.msdn.com/rahul/contact.aspx">Comments/feedbacks</a> welcome.</p> <p><a href="https://blogs.msdn.com/rahul/contact.aspx">Rahul Gangwar</a></p>]]></content:encoded>
    </item>
  </channel>
</rss>