A Lap Around of Cloud Design Patterns – Microsoft Patterns & Practices


Patterns & Practices are key indicators of any application development life-cycle whether it’s Windows Store / Desktop app, Web , Cloud , mobility or LOB app. Microsoft P & P leverages few new patterns as well for Cloud based apps. Lets have a summation as followed:

1. Cache-aside Pattern.

2. Circuit Breaker Pattern.

3. Compensating Transaction Pattern.

4. Compensating Consumers Pattern.

5. Compute Resource Consolidation Pattern.

6. Command and Query Responsibility Segregation(CQRS) Pattern.

7. Event Sourcing Pattern.

8. External Configuration Pattern.

9. Federated Identity Pattern.

10. Gatekeeper Pattern.

11. Health Endpoint Monitoring Pattern.

12. Index Table Pattern.

13. Leader Election Pattern.

14. Materialized View Pattern.

15. Pipes and Filters Pattern.

16. Priority Queue Pattern.

17. Queue based Load leveling Pattern.

18. Retry Pattern.

19. Run time Reconfiguration Pattern.

20. Scheduler Agent Supervisor Pattern.

21. Sharding Pattern.

22. Static Content Hosting Pattern.

23. Throttling Pattern.

24. Valet Key Pattern.

25. Asynchronous messaging Pattern.

26. Autoscaling Guidance.

27. Caching Guidance

28.Compute Partitioning Guidance.

29. Data Consistency Primer.

30. Data Partitioning Guidance.

31. Data Replication & Synchronization Guidance.

32. Instrumentation & Telemetry Guidance.

33. Multiple Data Center Deployment Guidance.

34. Service Metering Guidance.

 

Take a look of this link to deep dive into each of pattern’s architecture , key scenario considerations.

To have a complete overview on the projects executed by P&P team, have a look at this site.

 

 

Building Cross-Platform Mobile apps with Icenium for iOS,Android on Visual Studio 2012


Recently announced, the visual studio ultimate 2012 extension of Icenium (Kendo UI for Mobile) by telerik , a cross- platform mobile app framework based on PhoneGap, jQuery Mobile for iOS & Android. The Visual Studio 2012 ultimate extension can be downloaded from here.

Lets start , what’s new in this version of Icenium template. So, open Visual Studio 2012 ultimate & select Icenium template from Project templates.

Kendo

The latest release contains the following updates :

  • Icenium extension for Visual Studio (Beta): .NET developers can fully leverage Icenium mobile development platform directly from Visual Studio! This allows for quick development of cross-platform apps for both iOS and Android. In addition Team Foundation Server (TFS) and Subversion (SVN), for example, can now be used in addition to Icenium’s default support for GitHub, making it even easier to integrate Icenium into existing development workflows.
  • Apache Cordova 3.0 update: In Apache Cordova 3.0, every core API is taken apart into a plugin on its own-and Icenium can now take advantage of this new architecture. Users will be able to selectively turn on or off any core plugin. The same option will be available for all out-of-the-box advanced custom plugins such as the Barcode Scanner, PushPlugin, and SQLite.
  • Icenium Mist enhancements: Icenium Mist continues to mature with the inclusion of code analysis, code completion, and its new integrated version control plugin, CodeMirror.

 

  • Run the project by selecting the tab ‘ICENIUM‘ from Visual Studio 2012 & select the option ‘Run Project(Specified in Project Name) in simulator‘.

Run

 

  • The device simulator launches with iPhone,iPhone 5S, iPad, Android Phone & Android Tablet simulators.

PieChart

  • The simulator even specifies the geolocation & network connection feasibility options(viz. wifi, cell2G, cell3G,cell4G, limited) connectivity options.

geolocation

  • The Icenium DataViz project template contains default JSON data for populating charts, gauges along with ‘Cordova‘ framework support for iOS & Android.
  • The source code for these controls looks fairly simple by using jQuery Mobile & Cordova scripts using native html5 & minimized css3

<!DOCTYPE html>
<html>
<head>
<title>Kendo UI DataViz</title>
<meta charset=”UTF-8″ />

<link href=”kendo/styles/kendo.dataviz.mobile.min.css” rel=”stylesheet” />

<!–Once the final theme is chosen the redundant css reference should removed–>
<link href=”kendo/styles/kendo.dataviz.flat.min.css” rel=”stylesheet” />
<link href=”kendo/styles/kendo.dataviz.silver.min.css” rel=”stylesheet” />

<link href=”styles/main.css” rel=”stylesheet” />

<script src=”cordova.js”></script>
<script src=”kendo/js/jquery.min.js”></script>
<script src=”kendo/js/kendo.dataviz.mobile.min.js”></script>

<script src=”scripts/app.js”></script>
<script src=”scripts/pie-chart.js”></script>
<script src=”scripts/gauge.js”></script>
<script src=”scripts/qr-code.js”></script>
<script src=”scripts/stock-chart.js”></script>
</head>

<body>
<!–Pie chart–>
<div id=”tabstrip-pie-chart”
data-role=”view”
data-title=”Pie Chart”
data-show=”app.pieChart.createPieChart”
data-hide=”app.pieChart.unbindResizeEvent”
data-stretch=”true”>

<div data-role=”content” class=”view-content”>
<div id=”pie-chart”></div>
</div>

</div>

<!–Gauge–>
<div id=”tabstrip-gauge”
data-role=”view”
data-title=”Gauge”
data-show=”app.gauge.createGauge”
data-hide=”app.gauge.unbindResizeEvent”
data-stretch=”true”>

<div id=”gauge-wrap” data-role=”content” class=”view-content”>
<div id=”gauge”></div>
<div class=”input-content”>
<input id=”gauge-value” type=”range”>
</div>
</div>

</div>

<!–QR code–>
<div id=”tabstrip-qrcode”
data-role=”view”
data-title=”QR Code”
data-show=”app.qrcode.createQRCode”>

<div data-role=”content” class=”view-content”>
<div id=”qrcode”></div>
<div class=”input-content”>
<input type=”text” id=”qrcode-value” value=”http://www.icenium.com/”&gt;
<a data-role=”button” id=”qrcode-generate”>Update QR</a>
</div>
</div>

</div>

<!–Stock chart–>
<div id=”tabstrip-stock-chart”
data-role=”view”
data-title=”Stock Chart”
data-show=”app.stockChart.createStockChart”
data-hide=”app.stockChart.unbindResizeEvent”
data-stretch=”true”>

<div data-role=”content” class=”view-content”>
<div id=”stock-chart”></div>
</div>

</div>

<!–Layout–>
<div data-role=”layout”
data-id=”mobile-tabstrip”>

<!–Header–>
<div data-role=”header”>
<div data-role=”navbar”>
<a data-align=”right” data-role=”button” data-click=”app.changeSkin”>Flat</a>
<span data-role=”view-title”></span>
</div>
</div>

<!–Footer–>
<div data-role=”footer”>
<div data-role=”tabstrip”>
<a href=”#tabstrip-pie-chart” data-icon=”globe”>Pie Chart</a>
<a href=”#tabstrip-gauge” data-icon=”recents”>Gauge</a>
<a href=”#tabstrip-qrcode” data-icon=”camera”>QR Code</a>
<a href=”#tabstrip-stock-chart” data-icon=”featured”>Stock Chart</a>
</div>
</div>

</div>
</body>
</html>

Android chart

In next article, we will cover the PhoneGap / Cordova  3.0 framework to built native apps on HTML5, CSS3 & jQuery for Windows Store & Windows Phone apps using Windows Azure Mobile Services(WAMS).

 

What’s new in Windows Azure SDK 2.1, Visual Studio 2013 Preview along with .NET framework 4.5.1


Recently announced the release of Windows Azure SDK 2.1 which can downloaded here comply with .NET framework 4.5.1 along with support of Visual Studio 2013 preview. 

Windows Azure for .NET SDK version number (2.1) is determined by the core Windows Azure service runtime assembly using semantic versioning. Other client libraries packaged inside the Windows Azure SDK for .NET, along with their respective NuGet packages, follow independent versioning based on the semantic versioning scheme.

The Windows Azure SDK for .NET 2.1 includes Windows Azure Storage 2.0.6, Windows Azure Service Bus 2.1, Windows Azure Caching 2.0, and Windows Azure Configuration Manager 2.0.1 libraries. You can also download these libraries from their respective NuGet packages.

  • you need to install separately windows azure SDK 2.1 for VS 2013 preview.

Azure

 

  • Install Windows Azure emulators, SDK as well as VS integrator components for 2.1 version. But this version would be final version to be supported on VS 2010 as per as Side by Side debugging policy.
  • Side-by-Side Cloud Service Debugging is only supported with Windows Azure SDK for .NET versions 1.7, 1.8, 2.0, and 2.1. For a full debugging experience, projects built using versions prior to version 1.7 must be upgraded. For more information, see Windows Azure Cloud Services Support Lifecycle Policy.

    For example, when running a project built on Windows Azure SDK for .NET version 1.6 on a machine with version 2.1 installed, you will see the following error message- “The system is missing a prerequisite to execute the service.”

    To work around this error, uninstall the compute emulator included in version 2.1 and install thecompute emulator for version 1.6. If you do this, however, you will not be able to run an application built on SDK version 2.1 on this machine.

SDK

 

 

SDKsetup

 

  • Lets start to work with Windows Azure SDK 2.1 & start a new cloud project  selecting .net framework 4.5.

AzureSDK

 

  • Select the suitable webrole/worker role needs to be added to the project to start execution.

Azureproject

 

  • One noticeable change is the deprecation of Silverlight Business app webrole, instead of a new worker role template of service bus queue has been added.
  • For my demo, lets select an ASP.NET 4.5 webrole.

asp.net4.5

 

  • In order to have custom settings , asp.net 4.5 settings , it offers different options for webrole selection from webforms , MVC, webAPI, Facebook & mobile apps. 
  • One latest addition is SPA app on asp.net 4.5 which is an interactive frontend based app using HTML5, CSS3, javascript , jquery.
  • This template has a built – in ‘todolist‘ app which I selected for my demo app preview. so , lets select the app.

SPa

 

  • After selecting the app, start the execution of the app. The app starts in built to-do list sign in page.

Todolist

 

  • After sign up , you would be prompted to the home page of the app, where you can add your latest schedule of todo programs.

list

 

 

The following are breaking changes in the Windows Azure SDK for .NET 2.1:

  • Creating an ASP.NET MVC 5 Web API project or SPA project in a new Cloud Service in Visual Studio 2013 Preview– When creating these project types through File->New->Windows Azure Cloud Service->ASP.NET Web Application, you must manually add an assembly redirect to ODataLib version 5.5 if you are using the Storage Client Library in your project.  This can be done in one of two ways:
    • Remove and re-add the Storage Client Library NuGet package by right-clicking your project References in Solution Explorer and selecting Manage NuGet Packages
    • Or, add the assembly redirect as called out in the build warning:
      C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1613,5): warning MSB3247: 
      Found conflicts between different versions of the same dependent assembly. 
      Please add the following binding redirects to the "runtime" node in your application configuration file: 
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.Data.Edm" culture="neutral" publicKeyToken="31bf3856ad364e35" />
          <bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
        </dependentAssembly>
      </assemblyBinding>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="System.Spatial" culture="neutral" publicKeyToken="31bf3856ad364e35" />
          <bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
        </dependentAssembly>
      </assemblyBinding>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <dependentAssembly>
          <assemblyIdentity name="Microsoft.Data.OData" culture="neutral" publicKeyToken="31bf3856ad364e35" />
          <bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
        </dependentAssembly>
      </assemblyBinding>
  • Running the Windows Azure compute emulator on the Windows 8.1 Preview– Internet Explorer in Windows 8.1 Preview has a new Enhanced Security mode which breaks the Start Without Debugging (CTRL+F5) functionality of the compute emulator. When the compute emulator starts, Internet Explorer launches and fails to load the web application hosted at the local host IP because http://127.0.0.x is not listed in Trusted sites. Start With Debugging (F5) functionality is not affected.
  • Loading the ServiceRuntime from SDK 2.0 or later in a startup task throws an exception– To resolve, add the useLegacyV2RuntimeActivationPolicy attribute with a value of true to the startup element of the App.config file for the executable, as in the following example:
    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
        <startup useLegacyV2RuntimeActivationPolicy="true">
             ...
             ...
             ...
        </startup>
    </configuration>
  • WebPI feed failure conditions
    • The WebPI feed will fail to install if the Microsoft Root Certificate Authority 2010 or 2011 is missing.  For more information seehttp://support.microsoft.com/kb/931125.
    • The WebPI feed will silently fail on computers that are pending a reboot after installing updates or new software. To resolve this issue, restart the computer and then restart the setup.

Implement Windows Azure Websites from Web matrix 3 installed from Windows Azure Management Portal


Recently it has been announced the availability of Web matrix 3 as mentioned  here. You can now install Web matrix in order to work on Windows Azure Websites from Windows Azure Management Portal itself as shown.

azurewebmatrix

  • If  click on Webmatrix icon , you would be forwarded to following dialog.

installingterms

  • Lets install the Web matrix tool in order to start coding on Azure websites.

AppRun

  • After installing , lets start coding with latest interface & run directly the app with Azure website URL(*.azurewebsites.net).
  • You can sign in directly using your Microsoft Account or Org id in order to run your app on Windows Azure from Web matrix 3.

Signin

  • Once you sign in , you are good to go to work on code on Windows Azure websites as followed.

webmatrix_az

  • Even you can run the application from Remote server as configured from Web matrix 3 settings.

How to add Glossy App Icon for Mobile Web App on iOS platform?


Here is a short note on how to add glossy app icon for mobile web apps built in HTML5, ASP.NET MVC, jQuery Mobile/Sencha on iPad, iPhone platform. You need to select a standard .PNG file with proper icon formats (aka 114 x 114) for iPad , (54 X 54) for iPhone & add the .icon file in your mobile web app project root directory.

Simply add it in your HTML5 code after meta name viewport tag as:

<meta name=”apple-mobile-web-app-capable”content=”yes”/>

<meta name=”viewport”content=”width=device-width, initial-scale=1, maximum-scale=1″/>

<link rel=”apple-touch-icon”href=”icon.png”/>

Now, on iOS device, add the mobile web app on homescreen, then you can find your app icon along with the caption options.

AppIcon

What’s New in Windows Phone 7.8


Windows Phone SDK 7.8 as released on January 22nd, 2013 has embedded a couple exciting features on Windows Phone platform 7.1.1 with enhanced Live Tiles support as similar like Windows Phone 8.

Download Windows Phone SDK 7.8 from here

•Windows Phone 8 has support for Flip, Cyclic & Iconic Tiles. Windows Phone SDK 7.8 has the support also while upgraded applications built  for Windows Phone Platform 7.1.1.
Primary Tile has customizable Small tile, wide tiles .
Secondary tiles can take the support of Flip, Iconic & Cyclic Tiles.
It has enhanced support for Windows Phone Emulator 7.8 (512 MB RAM ) & Windows Phone Emulator 7.8(256 MB RAM) on both of Visual Studio 2012 & Visual Studio 2010 editions.

SDK

    • Lets check the utility of Mangopollo SDK for Windows Phone SDK 7.8 & Windows Phone 8 which is available at Codeplex.

Tiles

  • In order to Check the code to create Flip, Cyclic & Iconic Tiles for Windows Phone SDK 7.8 updated from Windows Phone 7.1.1 Platform.
  • To Create a Cyclic Tile:

private  void  CreateCycleTile_Click(object sender,  RoutedEventArgs e)
{
if (!Utils.CanUseLiveTiles)
{
MessageBox.Show(“This feature needs Windows Phone 8”);
return;
}
try
{
var  mytile = new  CycleTileData
{
Title = “cyclic tile”,
Count = 42,
SmallBackgroundImage =  new Uri(“/Assets/photosynth.png”, UriKind.Relative),
CycleImages =  new List<Uri> { new Uri(“/Assets/photosynth.png”, UriKind.Relative), new Uri(“/Assets/lumia820.jpg”,  UriKind.Relative),  new Uri(“/Assets/skype.jpg”, UriKind.Relative) }
};

#if ALTERNATIVE_SOLUTION
var myfile = Mangopollo.Tiles.TilesCreator.CreateCyclicTile(“cyclic tile”, 40, new Uri(“/Assets/Screen.png”,  Urikind.Relative), new List<Uri>() { new Uri(“/Assets/skype.jpg”, Urikind.Relative), new Uri(“/Assets/imagesCATP50SM.jpg”, Urikind.Relative), new Uri(“/Assets/htc.jpg”, Urikind.Relative)});

#endif
ShellTileExt.Create(new Uri(“/MainPage.xaml?msg=from%20cycle%20tile”, UriKind.Relative), mytile, false);
}

catch
{
MessageBox.Show(“remove tile before create it again”);
}
}

  • Lets take up code to implement the Iconic Tile which creates iconic style tile default for Windows Phone :

 private void CreateIconicTile_Click(object sender, RoutedEventArgs e)
{
if (!Utils.CanUseLiveTiles)
{
MessageBox.Show(“This feature needs Windows Phone 8”);
return;
}

try
{
var mytile = new IconicTileData
{
Title = “iconic tile”,
Count = 10,
BackgroundColor = Colors.Green,
IconImage = new Uri(“/Assets/nokia-lumia-620.jpg”, UriKind.Relative),
SmallIconImage = new Uri(“/Assets/Windows-Phone-mango.jpg”, UriKind.Relative),
WideContent1 = “Windows Phone Live Tiles”

};

#if ALTERNATIVE_SOLUTION
var mytile = Mangopollo.Tiles.TilesCreator.CreateIconicTile(“iconic tile”, 9, Colors.Green, new Uri(“/Assets/nokia-lumia-620.jpg”, UriKind.Relative), new Uri(“/Assets/Windows-Phone-mango.jpg”, UriKind.Relative));
#endif

ShellTileExt.Create(new Uri(“/MainPage.xaml?msg=from%20iconic%20tile”, UriKind.Relative), mytile, false);

}

catch
{
MessageBox.Show(“remove tile before create it again”);
}
}

  • Check for Flip Tile in order to flip back from front to back in Windows Phone app:

    private void CreateFlipTile_Click(object sender, RoutedEventArgs e)
    {
    if (!Utils.CanUseLiveTiles)
    {
    MessageBox.Show(“This feature needs Windows Phone 8”);
    return;
    }

    try
    {
    var mytile = new FlipTileData
    {
    Title = “Wide Flip Tile”,
    BackTitle = “Created by”,
    BackContent = “Windows Store”,
    Count = 10,
    SmallBackgroundImage = new Uri(“Assets/photosynth.png”, UriKind.Relative),
    BackBackgroundImage = new Uri(“Assets/lumia820.jpg”, UriKind.Relative),
    BackgroundImage = new Uri(“Assets/nokia-lumia-620.jpg”, UriKind.Relative),
    WideBackgroundImage = new Uri(“Assets/skype.jpg”, UriKind.Relative),
    WideBackBackgroundImage = new Uri(“Assets/Windows-Phone-mango.jpg”, UriKind.Relative),
    WideBackContent = “Windows Phone 7.8”
    };

    #if ALTERNATIVE_SOLUTION
    var mytile = Mangopollo.Tiles.TilesCreator.CreateFlipTile(“Wide Flip Tile”, “Created As”, “Windows Store Apps”, 10, new Uri(“Assets/photosynth.jpg”, UriKind.Relative), new Uri(“Assets/lumia820.jpg”, UriKind.Relative),new Uri(“Assets/nokia-lumia-620.jpg”, UriKind.Relative));

    #endif
    ShellTileExt.Create(new Uri(“/MainPage.xaml?msg=from%20flip%20tile”, UriKind.Relative), mytile, false);
    }
    catch
    {
    MessageBox.Show(“remove tile before create it again”);
    }
    }

SDK

Resources of Best Troubleshooting Tools for IIS 8, ASP.NET 4.5 & Windows Server 2012


For diagnosing troubleshooting cases for IIS 8 , there are specifically built in support for following three types of issues:

1. IIS Specific error (viz: HTTP Error 500.19)

2. Hang/time-out issues.

3. Resource – intensive issues.

1. Specific Errors: These are the errors that usually fail quickly & will show an HTTP error page corresponding to the error. Specific errors are easier for troubleshooting as the error message will immediately narrow down the issue details & can be easily reproduced over the time.

2. Hang/Time-out Issues:  The error would often simply say that there was a time-out, without giving any clues as to the cause. With IIS 8.0, troubleshooting hang & time out issues can be solved out by Failed Request Tracing and Runtime Status & Control (RSCA)

3. Resource-Intensive & Slowness Issues:  This can cause server’s CPU to spike, excessive disk usage, high memory pressure, utilizing almost any resources. Windows Task Manager, Process Explorer , Process Monitor are the excellent tools in order to solve this type of issues.

  • Failed Request Tracing:

Failed Request Tracing is the most useful feature in IIS 8.0 which enables to get the gain the details of information about any page request and to be able to capture data data based on the criteria that you define. With Failed Request Tracing, troubleshooting can be done at any time without downtime, with intangible performance overhead on the server . FREB logs on enabling trace rules are stored on disk in as easy to read XML format.

Tracing

TraceRules

  • Specify the Trace Providers.

Verbosity

WWWServer

  • The best way to  view the FREB logs is to open the logs in IE to get the log details in XML format.
  • ASP.NET Tracing :  ASP.NET Tracing can be enabled in several ways, the most straight forward way is to do this as <%@ Page Trace=”true” %>
  • This will enable it at page level & will  append the trace input to the bottom of the page. Alternatively you can set it through in web.config as <trace /> attribute.

    <system.web>

<trace enabled =”true” pageOutput = “true” localOnly = “true” />

</system.web>

LogParser.exe “SELECT * FROM SYSTEM WHERE EVENTTYPE = 1 ORDER BY TIMEWRITTEN DESC”

  • DelegConfig: DelegConfig helps to troubleshoot the authentication issues on production servers specially where Kerberos, delegating credentials are main concerns.

you can download the extension from here

  •    Process Explorer : Process Explorer is a tool which helps to dig into the issue based on process IDs, thread based way. Where Task Manager stops , Process Explorer starts to find the internal views of the concerned process regarding the CPU affinity, Performance Graphs, GPU Graphs etc.

Process

  • Process Monitor: One of the best troubleshooting tool from Sysinternals, which helps to dig into the issues like Access Denied errors in IIS, adding filters , process highlights, Thread affinity graphs.

Procmon

  • Debug Diagnostic Tool : The debug Diagnostic Tools is still supported in troubleshooting cases of IIS 8 & Windows Server 2012. The tool is used to for troubleshooting hangs, slow performance of production ASP.NET websites, w3wp.exe worker process crashes & COM+ debugging.
  • Creating Memory Dump :  For creating Memory Leak issues of Windows Desktop / Windows Store applications , debugdiag is an ideal tool which injects the Leak Track DLL (LeakTrack.dll) into the process. Attaching the .dll & leave it for several hours helps to find the memory leakage issues by taking proper memory dump. It also helps to create Full Userdump, Mini UserDump, Create UserDump Series, dubugging Crash & slow performance issues.

you can download DebugDiag tool from here

DebugDiag

IISDump

  • Specify the Dump type as Full User Dump or Mini Dump.

Dump

  • Select location of the Dump file

dumps

Debugdiagdump

 

  • ProcDump : ProcDump is a Command Line tool used to capture memory dumps that can be analysed using WinDbg or DebugDiag. ProcDump is specially useful in case of capturing memory dump of w3wp.exe worker process  for slow unresponsive production website or hanging issue. you can download ProcDump from here
  • WinDbg: WinDbg is a tool used to analyse memory dumps. WinDbg provides commands & GUI interface to examine memory dumps of processes running in Kernel, user mode, System Registry, managed code hangings of w3wp worker processes. you can download the tool from here .

 

%d bloggers like this: