All posts in Microsoft Azure

This session is so awesome, I just had to post it here so that I can play it over and over again…
What great times are we living…


Two days left for AzureConf 2014, if you haven’t registered for it yet now is the time to do it.

On October 21st, 2014, Microsoft will be hosting AzureConf, another free event for the Azure community. This event will feature a keynote presentation by Scott Guthrie, along with numerous sessions executed by Azure community members. Streamed live for an online audience on Channel 9, the event will allow you to see how developers just like you are using Azure to develop robust, scalable applications on Azure.

Community members from all over the world will join known speakers such as Michael Collier, Mike Martin, Rick Garibay, and Chris Auld in the Channel 9 studios to present their own inventions and experiences. Whether you’re just learning Microsoft Azure or you’ve already achieved success on the platform, you won’t want to miss this special event.

 


The Microsoft Azure Storage Team released their latest Azure Storage Client Libraries and Tools which now supports accessing the Azure Storage from Portable libraries which in turn means that you are now able to access Azure store from Window 8 phone and Metro style applications directly.

Following are some of the new features and highlights:

Azure Storage SDK for .NET v4.3.0
Added support for building Universal and Windows Runtime based Windows Phone applications.
Updated OData dependencies to v5.6.2 and Newtonsoft.Json dependency to v5.0.8
Readme | changelog

Azure Storage SDK for Python v0.8.4
Fixed the issue of incorrect content type on blob
Readme | changelog | [supports REST API protocol version: 2012-02-12]

Azure XPlat CLI v0.8.1
Readme | changelog
Added additional commands for working with File/Table/Queue and Blob Service (visit the changelog for a full list).
Added SAS support for storage container/blob/table and queue
Switched storage library to Azure storage module

Documentation
Monitoring, Diagnosing and Troubleshooting Guide | Link
PowerShell Storage cmdlets Documentation | Link


Today the Azure Media Services team announced a new tool, namely the Azure Media Services Explorer Tool.

The Azure Media Services Explorer Tool is a Windows Forms tool based on the Azure Media SDKs that can be used by non-developers to test media workflows, monitor activities on their Azure Media Services accounts, or do just about anything that the full API allows you to do today without writing a line of code.

capt1

You can find the installation package on http://aka.ms/amse.

What’s even better is that the full source code for this tool is published to GitHub which can really help you better learn the APIs and integrate features into your own applications.

Summary of features

Asset upload/download/management

  • Asset upload from files, folder, in batch mode, with a watch folder
  • Asset import from Azure Storage or from any http source
  • Asset download to local, and export to Azure Storage
  • Asset files management (upload or delete) within an existing asset
  • Duplicate/merge assets

Process assets

  • Encode with Azure Media Encoder (standard and custom presets, video stitching, audio or video overlay, etc)
  • Extract keywords and TTML caption files with Media Indexer
  • Generate thumbnails for your existing assets
  • Call any Media Processor generically
  • Manage jobs (progress, priority…)
  • List all available processors in your account

Live streaming

  • Enable live channels and programs (creation, start, stop, delete, reset)
  • Live preview playback, program playback

Publish assets

  • Dynamic encryption setup (AES, Common Encryption) and key/license delivery service
  • SAS and streaming locators creation/deletion
  • Playback assets with web based players (Silverlight, Flash, HTML5/Dash)
  • Manage streaming endpoints management (creation, deletion, settings)

Display and reporting

  • Display detailed information on assets (locators, protection), jobs (tasks), live channels, programs, streaming endpoints
  • Send email report for jobs and assets
  • Links to players and online documentation, and offline help file for Media Services

Note: you can select multiple assets, jobs, channels or programs for some features.

Read more about the new tool from here


image_thumb33Last month I had the opportunity to speak at a Microsoft event about best patterns and practices of Microsoft Azure development.

Today I noticed that most of the things we talked about at the event is included in a very nice book available for free from Microsoft Press:  “Patterns & Practices: Cloud Design Patterns”. So if you’re interested on how to build your software for Microsoft Azure this is a very nice starting point.

Containing twenty-four design patterns and ten related guidance topics, this guide articulates the benefit of applying patterns by showing how each piece can fit into the big picture of cloud application architectures. It also discusses the benefits and considerations for each pattern. Most of the patterns have code samples or snippets that show how to implement the patterns using the features of Windows Azure. However the majority of topics described in this guide are equally relevant to all kinds of distributed systems, whether hosted on Windows Azure or on other cloud platforms.

Additionally, there is sample code:

The example applications for use in conjunction with Cloud Design Pattern guide. It consists of 10 samples to show how to implement design patterns using the features of Windows Azure.
See the Readme for information about the sample code. Each sample has a corresponding readme for information about how to run the sample.
Note: The samples are simplified to focus on and demonstrate the essential features of each pattern. They are not designed to be used in production scenarios.

 


With Global Windows Azure Bootcamp only a few days away I just received confirmation of all the things we’re going to be giving away this Saturday and I must say that the list is long and contains a lot of interesting oferings from our sponsors.

MyGet http://www.myget.org/ Every attendee gets 2 free months1 winner at each location win a 1 year subscription
JetBrains http://www.jetbrains.com/ 1 winner at each location win a free personal license to one of JetBrain’s .NET Products or IDEs (their choice) See www.jetbrains.com for a list, or it is included in the giveaway slides.
Blue Syntax http://www.bluesyntax.net 3 winners at each location win an Enterprise license to Enzo Cloud Backup
Infragistics http://www.infragistics.com/ 1 winner at each location win a Infragistics Ultimate License
Opsgility http://www.opsgility.com/ 1 winner at each location wins a voucher (up to $200) for an online course.
Cerebrata http://www.cerebrata.com/ 5 winners at each location win a license to Azure Management Studio
CloudBerry http://www.cloudberrylab.com/ 5 winners at each location win a license of their choice to CloudBerry Drive, Explorer Pro or Backup
Paraleap https://www.paraleap.com/ Every attendees gets 1 free month of Azure Watch
CODE Magazine http://www.codemag.com/magazine/ Every attendee gets a digital copy of the March/April issue of CODE MagazineEvery attendee gets 1 year free digital subscription to CODE Magazine
Zudio https://zud.io/ Every Attendee gets 6 months free
Stackify http://www.stackify.com/ Every attendee gets 1 free license. Install it and get a TShirt sent to you.
Wintellect Now! http://www.wintellectnow.com/ Every attendee gets a 2 week subscription. If they register before April 25th they can get a 50% discount.
FacetFlow https://facetflow.com/ Every attendee gets 2 free months when they sign up past the trial.
Appveyor http://www.appveyor.com/ Every attendee gets 2 free months with the purchase of any plan.

And that’s not all… register and find out what the big prize of GWAB Greece is…


It was only last week, when I talked about Windows Azure mobile services in a www.dotnetzone.gr event at Microsoft, that I argued about the need business logic – data store separation and it seems that ScottGu might have been listening Smile

Today ScottGu announced a bunch of major ultra cool new features for Windows Azure Mobile Services which are:

  • Custom API support
  • Git Source Control support
  • Node.js NPM Module support
  • A .NET API via NuGet
  • Free 20MB SQL Database Option for Mobile Services and Web Sites
  • Android Broadcast Push Notification Support

If you want to find more about how these new features work visit ScottGu’s blog post or drop by next week at the TechEd Europe expo to show you Winking smile

I’ve got only one more thing to say, if you’re a mobile app /windows 8 developer you should definitely have a look …


As you may have already read, a couple of months back I migrated my blog to Windows Azure WebSites and changed my blog engine to WordPress. The WordPress gallery template comes with a MySQL database 20MB free offer from ClearDB which was more than I needed (or so I thought) so I went alone and used it.

Lately though I”ve been experiencing a strange behavior, at undeterminable intervals my changes stopped being persisted at the database. After getting in contact with the ClearDB guys, I learned that the problem was that the MySQL engine was generating temp tables in order to facilitate the queries being made to it and the size of the data in these tables was greater from my quota leading to a block. The conversation reached a point where the ClearDB guy said

…I”m sorry for the inconvenience. If you”re not able to optimize your queries, and I gather that you”re using a stock WordPress install, the solution is simply to upgrade to the next service tier… (You can read the full transcript here)

I got so frustrated by this that I decided to investigate if moving to SQL Azure was an option and guess what… you can easily use SQL Azure with your WordPress Azure WebSite here”s how.

webmatrix

Step 1

Create a new WordPress site using WebMatrix localy by clicking new and selecting App Gallery from the menu.

Step 2

Download WP Db Abstraction. This plugin provides db access abstraction and SQL dialect abstraction for SQL Server. It is an mu (Must-Use) plugin AND also a db.php drop-in.

Step 3

Put the wp-db-abstraction.php and the wp-db-abstraction directory to wp-content/mu-plugins.  This should be parallel to your regular plugins directory.  If the mu-plugins directory does not exist, you must create it. Put the db.php file from inside the wp-db-abstraction.php directory to wp-content/db.php. Rename the wp-config.php file in the root folder to wp-config_old.php since this is going to be written by the setup wizard at a later step.

Step 4

Publish your newly created WordPress site to an empty Azure WebSite slot.

Step 5

Create a new SQL Azure database

Step 6

Once the site is published visit http://your_wordpress_url/wp-content/mu-plugins/wp-db-abstraction/setup-config.php to generate your wp-config.php file and follow the instructions to connect WordPress with the database you created in the previous step. In the database type field you’ll have to select BDO_SQL as the type to connect to SQL Azure. Note that WordPress should be able to connect to the database otherwise you”ll get an error.

Step 7

Complete the normal WordPress installation

Step 8

There is a known bug in the  WP Db Abstraction that causes your posts and media files to not appear in their corresponding lists in the admin. You can read more about it here. So you’2015-04-28 07:02:14’ll have to edit the function is translate_limit in the wp-db-abstraction/translations/sqlsrv/translations.php file

// Check for true offset
if ( (count($limit_matches) == 5  )  && $limit_matches[1] != ''0'' ) {
    $true_offset = true;
} elseif ( (count($limit_matches) == 5 )  && $limit_matches[1] == ''0'' ) {
    $limit_matches[1] = $limit_matches[4];
}

The “$limit_matches” returns 6 items and in a validation is asking for 5 that”s all.

// Check for true offset
if ( (count($limit_matches) == 5  )  && $limit_matches[1] != ''0'' ) {
    $true_offset = true;
} elseif ( (count($limit_matches) >= 5 )  && $limit_matches[1] == ''0'' ) {
    $limit_matches[1] = $limit_matches[4];
}

just change the == for a >= and it works like a charm.

If you already had a WordPress installation like I did then you can easily migrate your data to your new SQL Azure backed installation. You just export all your data from you old site and import them to the new one.

Now, with half the price (4.99$ per month) of what I would have had to pay ClearDB to upgrade to the next service level I”ve got all the space I”ll ever going to need (up to 100MB) and all available for my data not temp.


In Part 1 of this series I’ve shown you how easy it was to build my Google Reader backing service using Windows Azure Mobile Services. In this part I’ll show you how I put that service to work using a Windows 8 client application and how I managed my data with it.

The client application I had been using with Google Reader so far was Modern Reader and I must admit that I got quite fond and used to it. So I’ve decided to build something similar, a Windows 8 application that would connect and sync with my newly created service. So I fired up Visual Studio and using the new Widows 8 application wizard I’ve created my client.

Now, from the Windows Azure Mobile Service tab you can get detailed instructions on how to connect your existing applications to the service or even download an already hooked to the service project for all the available platforms.

instructionsSo the first thing I did once my application had been created was to connect it with my mobile service. So I first imported the Windows Azure Mobile Services nuget package to get the necessary assemblies to my project (instead of installing the sdk) and then added a static member to my App class to allow easy access to my service as the guide suggests.

public static MobileServiceClient MobileService = new MobileServiceClient(
    "https://cloudreader.azure-mobile.net/", 
    "YOUR_MOBILE-SERVICE-KEY");

Having hooked my app with my CloudReader mobile service, I needed a way to manage (add/remove) and import my feeds. As mentioned earlier in my previous post I already had downloaded my data from Google Reader, so I had an OPML formatted xml file that contained all my subscriptions, so I needed some UI to help me pick that file, parse it and save my subscription data to my service. I thought that the best place for this UI was probably a custom fly out spawned by the settings charm bar like the Clasic RSS app does. So using the new Page wizard from visual studio I’ve created a Settings Flyout page and added a few controls to help my pick up the OPML file (DISCLAIMER I’m not a designer so the UI I’ve created is probably not the best you’ve seen but it gets the job done. We’ll talk about design more extensively in the last post of this series). The resulting UI looked something like that:

SettingsFlyout

In order to save some space in this post I will post the full xaml source code of this page as well as any other page of my solution at the end. To hook it up with the settings charm all I had to do was to handle the CommandsRequested event for the current view immediately after the window activation.

SettingsPane.GetForCurrentView().CommandsRequested += App_CommandsRequested;

Then on the event handler I instanciated a new UICommandInvokedHandler and provided a IUICommand to be called when this handler was selected.

void App_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
    UICommandInvokedHandler handler = new UICommandInvokedHandler(OnSettingsCommand);

    SettingsCommand generalCommand = new SettingsCommand("FeedsId", "Feeds", handler);
    args.Request.ApplicationCommands.Add(generalCommand); 
}

The OnSettingsCommand, in turn, created a new popup at runtime set its child control to be the settings flyout page I had already created and then opened it using some transitions.

void OnSettingsCommand(IUICommand command)
{
    // Create a Popup window which will contain our flyout. 
    settingsPopup = new Popup();
    settingsPopup.Closed += settingsPopup_Closed;
    Window.Current.Activated += Current_Activated;
    settingsPopup.Width = settingsWidth;
    settingsPopup.Height = Window.Current.Bounds.Height;

    // Add the proper animation for the panel. 
    settingsPopup.ChildTransitions = new TransitionCollection();
    settingsPopup.ChildTransitions.Add(new PaneThemeTransition()
    {
        Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ?
               EdgeTransitionLocation.Right :
               EdgeTransitionLocation.Left
    });

    // Create a SettingsFlyout the same dimenssions as the Popup. 
    SettingsFlyout mypane = new SettingsFlyout();
    mypane.Width = settingsWidth;
    mypane.Height = Window.Current.Bounds.Height;

    // Place the SettingsFlyout inside our Popup window. 
    settingsPopup.Child = mypane;

    // Let's define the location of our Popup. 
    settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? 
        (Window.Current.Bounds.Width - settingsWidth) : 0);
    settingsPopup.SetValue(Canvas.TopProperty, 0);
    settingsPopup.IsOpen = true; 
}
Now all I had to do to complete my feed management / importing was to actually write the code for it in my settings flyout page. Since I didn’t want my code to be coupled with the page though I’ve decided to use MVVM. So I used nuget again to import MVVM light and created a ViewModel for my settings flyout page.
The ViewModel code was pretty straight forward, I used 2 commands that were triggered by the buttons on my UI to call the ImportFeeds method which in turn handled all the business logic.
public class SettingsViewModel : NavigationViewModel
 {

     public SettingsViewModel()
     {
         ////if (IsInDesignMode)
         ////{
         ////    // Code runs in Blend --> create design time data.
         ////}
         ////else
         ////{
         ////    // Code runs "for real"
         ////}
     }

     private StorageFile _selectedFile;
     public StorageFile SelectedFile
     {
         get { return _selectedFile; }
         set
         {
             _selectedFile = value;
             RaisePropertyChanged("SelectedFile");
         }
     }

     private RelayCommand _OpmlSelectCommand;
     public RelayCommand OpmlSelectCommand
     {
         get
         {
             return _OpmlSelectCommand
                 ?? (_OpmlSelectCommand = new RelayCommand(async () =>
                     {
                         var filePicker = new FileOpenPicker();
                         filePicker.FileTypeFilter.Add(".xml");
                         filePicker.ViewMode = PickerViewMode.List;
                         filePicker.SuggestedStartLocation = PickerLocationId.Downloads;
                         filePicker.SettingsIdentifier = "OPML Picker";
                         filePicker.CommitButtonText = "Select File";

                         SelectedFile = await filePicker.PickSingleFileAsync();
                     }));
         }
     }

     private RelayCommand _ImportFeedsCommand;
     public RelayCommand ImportFeedsCommand
     {
         get
         {
             return _ImportFeedsCommand
                 ?? (_ImportFeedsCommand = new RelayCommand(async () =>
                     {
                         if (SelectedFile != null)
                         {
                             var stream = await FileIO.ReadTextAsync(SelectedFile);
                             var opml = XDocument.Parse(stream);
                             if (opml != null)
                             {
                                 ImportFeeds(opml);
                             }
                         }
                     }));
         }
     }

     private async void ImportFeeds(XDocument opml)
     {
         foreach (var item in opml.Descendants("outline").Where(el => el.Attribute("xmlUrl") == null))
         {
             var feedGroupTable = App.MobileService.GetTable<FeedGroup>();
             var feedFolder = new FeedGroup()
                 {
                     Text = item.Attribute("text").Value,
                     Title = item.Attribute("title").Value
                 };
             await feedGroupTable.InsertAsync(feedFolder);

             foreach (var fds in item.Descendants("outline").Where(el => el.Attribute("xmlUrl") != null))
             {
                 var feedTable = App.MobileService.GetTable<Feed>();
                 var newFeed = new Feed()
                 {
                     FeedGroupId = feedFolder.Id,
                     FeedType = 1,
                     HtmlUrl = fds.Attribute("htmlUrl").Value,
                     Text = fds.Attribute("text").Value,
                     Title = fds.Attribute("title").Value,
                     XmlUrl = fds.Attribute("xmlUrl").Value
                 };
                 await feedTable.InsertAsync(newFeed);
             }

         }
     }

 }
The only interesting part in this piece of code is how easy it was to actually save my subscriptions to my database through my Windows Azure Mobile Service. All it took was two lines of code first I had to get a reference to my table using the call
var feedGroupTable = App.MobileService.GetTable<FeedGroup>();
and then I called
await feedTable.InsertAsync(newFeed);
for every feed in my subscriptions OPML formatted xml file.Now that my feeds were safely stored in my database I had to find a way to download news for each feed.
Stay tuned to read, in part 3 of this series how I wrote my server side code to read news for my stored subscriptions.

I’ve been using RSS feed aggregators most of my life and have tried pretty much all available versions / flavors out there. I’ve started by using stand alone RSS aggregators with my favorite being feeddaemon but a couple of years back I decided to switch to Google Reader as I was tired of reading again and again the same stories every time I used a different device. Using Google Reader I was able to keep all my devices in sync and pick up where I left off whichever device I used. Plus there were a number of very cool and fast native windows 8/ windows mobile apps available for all my devices, that used Google Reader API. So I was able to store my feeds centrally but work with a native app locally on my laptop, desktop, tablet and phone. So you can understand my frustration when I learned that Google decided to retire the service.

Since then I’ve been trying to find an alternative, I visited most of the “The best Google reader alternatives” stories and tried most of the suggestions but I couldn’t really find what I was looking for. But most importantly, none of the alternatives could convince me that my data were safe and that what happened with Google wouldn’t happen with them as well. And then it struck me, why don’t I build something my self? and I did. Using Windows Azure Mobile Services I was able to build an RSS aggregation service in absolutely no time that I can literally use from any device out there. So in this series will show you how you can take advantage of most of the Windows Azure Mobile Services features to build your own Google Reader alternative.

Creating a Windows Azure Mobile Service

So first thing I did was to create a new WAMS called CloudReader. There are plenty of resources available on how to start your first Windows Azure account and create your first Windows Azure Mobile Service so I won’t go into much detail on that part and instead go ahead assuming that you’re pretty familiar on how to do that.

Data ModelGTakeout

Then I had to design my service data model. To do that I had to think about the kind of data I would store. In my case I wanted to implement the KISS principle so I’ve decided to only have 3 different data types

  • FeedGroup. Represents a folder/container of feeds that helps better organize my feeds
  • Feed. Represents the feed I’m following
  • Post. The posts I’ve downloaded and read.

Fortunately Google Reader allows you to export your data through the Google Takeout service, so I was able to see all the data Google is storing and have a better idea on what data I would use in my service.

Finally the model I came up with, looked something like this:

image

Now, building the data model any other way I would have had to use some db initialization SQL script or use SSMS (SQL Server Management Studio) to design my data model in the database and I would then have had to migrate the database to SQL Azure using some tool like for example SQL Azure Migration Wizard. Then I would have had to build some data access mechanism using Linq or Entity Framework, build repositories, implement IoC, dependency injection and write a bunch of server side code just to access the database let alone expose it as a service to my clients.

WAMS_DataUsing WAMS all I had to do was create three tables by going to the DATA tab and clicking the create table button at the bottom. Just by following the simple wizard not only I was able to create an initial database schema but also create the data access layer and expose everything through, an automatically generated by WAMS, rest service.

To Create the rest of the schema I had taken advantage of the dynamic schema feature WAMS offers. When dynamic schema is enabled on your mobile service, new columns are created automatically when JSON objects are sent to the mobile service by an insert or update operation. So all I had to do was to create a new CloudReader.Model portable class library (we’ll discuss the project type choice in a next part) where I introduced 3 POCO classes that corresponded to each of my table and when I my application was ready the insert operations on these objects would create the necessary db schema.

   1:  namespace CloudReader.Model
   2:  {
   3:      public class FeedGroup
   4:      {
   5:          public int Id { get; set; }
   6:          public string Text { get; set; }
   7:          public string Title { get; set; }
   8:      }
   9:  
  10:      public class Feed
  11:      {
  12:          public int Id { get; set; }
  13:          public int? FeedGroupId { get; set; }
  14:          public string Text { get; set; }
  15:          public string Title { get; set; }
  16:          public int FeedType { get; set; }
  17:          public string XmlUrl { get; set; }
  18:          public string HtmlUrl { get; set; }
  19:      }
  20:  
  21:      public class Post
  22:      {
  23:          public int Id { get; set; }
  24:          public int FeedId { get; set; }
  25:          public string Title { get; set; }
  26:          public string Link { get; set; }
  27:          public DateTime PubDate { get; set; }
  28:          public string Author { get; set; }
  29:          public string Description { get; set; }
  30:          public string Content { get; set; }
  31:          public int CommentsCount { get; set; }
  32:          public bool Stared { get; set; }
  33:          public bool IsRead { get; set; }
  34:      }
  35:  }

In the next part of this series I’m going to show you how to start your Google Reader client application that is going to consume your newly created service. For this post series I’m going to use a Windows 8 application as my client but building a windows mobile 8 client app is equally easy.