Microsoft BUILD Conference June 2013 in San Francisco


Here we go again. Microsoft is announcing officially the next developer conference BUILD in San Francisco, CA (I’m glad to live in San Francisco :)). This event seems to be the place were Microsoft is going to talk for the first time about the next version (or update) of Windows 8 and Windows Phone, codename “blue”. Regarding the logos on the main page of the event, the themes will be Windows, Windows Phone, Windows Azure, Internet Explorer, Office 365, Xbox and Visual Studio. I’m sure we will get some exciting news!


As a reminder, the Microsoft PDC is an exceptional event that happen only for very important and major announcements, like Windows Azure a few years ago. The last one was in 2010. Whereas the Microsoft TechEd is the annual technical event for the IT Pros (and a little bit for developers) and the Microsoft BUILD is the annual conference for developers mainly.


The event will happen at the Moscone Center, from June 26th to June 28th and the registrations open on Tuesday April 2nd at 9am PDT. Register here: As usual, the 500 first to register will receive $500 off the registration fees.

Get up to $2,000 with your Windows 8 and Windows Phone apps

Keep The Cash

Once again, Microsoft is helping developers to create new application for Windows 8 and Windows Phone. Today, it’s all about ca$h. From March 8th to June 30th 2013, you can get $100 for each new application you publish on the Windows Store or Windows Phone Store, up to 10 per store. Yes, it means you can get up to $2,000 just for building applications, then you’ll make money selling those apps and maybe monetize them using ads. Read this interesting article about how to choose your business model.
Link to the Keep The Cash contest.

Have a look again at the 50 free templates for Windows 8 applications and start building new apps today!

Windows Azure – How to delete a Virtual Machine properly

Azure Virtual Machines
If like me you’re playing more and more with Windows Azure, you’ve probably faced some issues with the Windows Azure Manager. Sometimes the problem is that you can’t find easily how to do a task. The last one I’ve been exposed is that I couldn’t delete the hard drive (vhd) use by an old virtual machine. Because when you create a new Virtual Machine, you’re prompted for a storage, I was guessing that I will just have to go to the storage I’ve created to store my machine, then open the container vhds and simply delete the blob. Unfortunately, there is a lock on the file, even if there is no VM using it:

VHD Metadata

So when you try to delete this blob, you’ll get this error message in the portal:

VHD Delete Error

The reason is simple, the lock comes from the management portal. Here is the “good way” to delete a Virtual Machine and the associated resources.

  • First, delete the Virtual Machine by going to the list of Virtual Machines, select the one you want to delete, then click Delete.
  • Once the VM is deleted, go to Virtual Machines | DISKS you will notice that the vhd is still here but not attached to anything. That’s good because you can still create a new VM with the same hard drive later on. Vhd Disks
  • From this screen, and this one only, you can delete the disk. Select the disk and click DELETE in the list of actions at the bottom of the page. In the new menu, click Delete the associated VHD. Vhd Delete Disk
  • A Cloud Service has also been created with your Virtual Machine. It can be used when you have multiple machines for a single service. If you don’t use it, you can delete it.
  • If you don’t need the storage created for this Virtual Machine, you can also delete it.
  • You’re done, you have cleaned your Windows Azure from the Virtual Machine.

Azure Mobile Services – Paging with REST APIs

Mobile Services
I would like to complete the code I’ve provided to call the REST APIs for Windows Azure Mobile Services in my two previous posts, Introduction to Windows Azure Mobile Services and Windows Azure Mobile Services – Update with REST APIs. Today, I’ve been facing a basic mistake I made for my application Earthquakes. You are more and more everyday to use this application, and I thank you for that :). Each time a new user start the application, the app will register on Azure Mobile Services in order to update the Live Tile on the Phone (see the picture below). It means I store a list of URLs on Mobile Services, and I’ll contact these URLs to update the Live Tile on your phone.

Earthquakes Live Tiles
If you’ve read and use the source code I’ve provided you’ve probably noticed an issue. How do you retrieve a list of more than 50 entries in Mobile Services? You have two possibilities:

  • The first idea would be to increase the number of items you want to retrieve when you call the REST API. In order to do that you have to specify the parameter $top of the REST API. You can ask up to 1000 items in one call. But what’s going on if you have more than a thousand items in your base? You’ll simply never get them and it’s what happened to me. I was stuck with the 50 firsts items…
    URL format: https://<ServiceName><TableName>?$top=<Limit>
  • The other idea and probably the better in most of the cases, is to use paging. The paging capability allows you to retrieve your elements by lot, 50 at a time for example, until you have all of them. To do so, we will combine the attributes $top and $skip. Also, by using the attribute $inlinecount with the value allpages we will get the number of elements in the table at each call. It will help us to track if we need to perform more call to get more elements.
    URL format: https://<ServiceName><TableName>?$top=<Limit>&$skip<Skip>&$inlinecount=allpages

Let’s start coding with a class named RestResult that we will use to deserialize the elements including the number of elements in the table.

public sealed class RestResult<T>
    where T : class
    [DataMember(Name = "results")]
    public T[] Results { get; set; }

    [DataMember(Name = "count")]
    public int Count { get; set; }

Now, we can update the function Get to retrieve an object RestResult<T> that will contain the list of elements we asked and the number of elements in the table.

public RestResult<T> Get<T>(string tableName, string filter = "", int skip = 0, int top = 50)
    where T : class
    if (!string.IsNullOrWhiteSpace(filter))
        filter = string.Concat("&$filter=", filter);

    Uri address = new Uri(string.Format("https://{0}{1}?$inlinecount=allpages&$skip={2}&$top={3}{4}",
                                        ServiceName, tableName, skip, top, filter));

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(address);

    request.Method = "GET";
    request.Headers = new WebHeaderCollection
                                {"X-ZUMO-APPLICATION", ApplicationId},
                                {"X-ZUMO-MASTER", MasterKey},

    RestResult<T> result;

    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
        Stream stream = response.GetResponseStream();

        result = stream.Deserialize<RestResult<T>>();

    return result;

And to finish, here is the code that will retrieve all the elements of a table.

public IEnumerable<T> GetAll<T>(string tableName, string filter = "")
    where T : class
    List<T> result = new List<T>();
    bool needMore;

        var get = Get<T>(tableName, filter, result.Count);

        needMore = get.Count > result.Count;
    } while (needMore);

    return result;

Monitoring the Cloud Services, Websites, Mobile Services and Virtual Machines


Windows Azure is evolving very fast. I don’t remember seen a Microsoft moving that fast. Scott Guthrie introduced a bunch of new features on his blog yesterday. Today, I’m going to focus only on the new capability to monitor an endpoint. Available for your Cloud Services, Websites, Mobile Services and Virtual Machines, you’ll able to understand how fast (or slow) are your services for your customers around the world.

Beware that the feature works only in Reserved Mode. So if you want to track your Websites or Mobile Services do not forget to switch them to Reserved Mode in the SCALE panel.


You can add up to two endpoints to monitor for each service and each endpoint can be monitored from 3 different locations from the following list.

  • Chicago, IL, USA
  • San Antonio, TX, USA
  • San Jose, CA, USA
  • Ashburn, VA, USA
  • Dublin, Ireland
  • Amsterdam, Netherland
  • Hong Kong
  • Singapore

Each location for each endpoint will bring you two more metrics to monitor in the MONITOR panel:
Select Metrics
I don’t have enough information on my own Virtual Machines so I’m using the picture posted by Scott Guthrie on his blog:
Result Monitoring

Windows Phone Map control and ZoomLevel limits

The Oscars are over, I was playing with my application Earthquakes for Windows Phone and I noticed a bug in the map control. The problem is very simple, but I’d like to share it here with you Windows Phone developers so you don’t make the same mistake.
Like a lot of application that use the Map control, I have two buttons in the ApplicationBar that allow me to zoom in and zoom out.


So, when you use the Map control for Windows Phone 7 or Windows Phone 8, you can use the property ZoomLevel to zoom in or zoom out. On the click of the button I was simply increasing or decreasing the value without doing any control. I know that’s bad… Apparently, there is a limit for the zoom level that can be apply to the Map. Which is 1 to 19 for Windows Phone 7 and 1 to 20 for Windows Phone 8.

For Windows Phone 7 you can use the following code to change the ZoomLevel property:

private void BtZoomMore(object sender, EventArgs e)
   map.ZoomLevel = Math.Min(map.ZoomLevel + 1, 19);

private void BtZoomLess(object sender, EventArgs e)
   map.ZoomLevel = Math.Max(map.ZoomLevel - 1, 1);

And for Windows Phone 8:

private void BtZoomMore(object sender, EventArgs e)
   Map.ZoomLevel = Math.Min(Map.ZoomLevel + 1, 20);

private void BtZoomLess(object sender, EventArgs e)
   Map.ZoomLevel = Math.Max(Map.ZoomLevel - 1, 1);

Windows Azure outage on February 22, 2013

Azure SSL Outage

What a nice day in San Francisco after a week in Redmond, WA at the Microsoft headquarter for the Microsoft MVP Summit 2013.
On Friday, February 22, 2013 at 12:44 PM PST, the datacenters of the giant cloud service experienced a worldwide outage impacting the HTTPS traffic of the Storage service.

Azure Outage

1:30 PM PST, Microsoft identifies the issues. It comes from an expired SSL certificate. It seems Microsoft did not learn enough about the outage that happened during the leap day in 2012. Learn more about the service disruption of February 29th 2012.

Azure Outage

1:45 PM PST, Access Control, Service Bus, and the WebSites services are also impacted by the SSL certificate expiration.

Azure Outage

2:15 PM PST, Microsoft start patching their testing environment.


3:45 PM PST, Microsoft start patching their production environment. It will take few more hours before a full recovery. The storage I use for my application Earthquakes was back online at around 9 PM PST. No one is 100% safe from this kind of problem, but this is the second outage due to a certificate. Let see if Microsoft will publish something to explain the details of the problem like they do every time something goes wrong.


Windows Azure Service Dashboard.

I updated my application Earthquakes for Windows Phone 8 with a back-end using Windows Azure and Mobiles Services. I hope I did not make this outage happened 😉
I’ll publish soon an update for both Windows Phone and Windows 8 to support the new features provided by the Azure back-end.

Using the AlternationIndex with a HeaderedItemsControl in XAML


Today, I want to show you a very easy thing that you can use in your WPF applications. It’s so easy that I always forgot the syntax to do it… How to alternate the background color in a HeaderedItemsControl using only XAML code.

Let’s start to create the HeaderedItemsControl that will host a basic list of strings.

<HeaderedItemsControl ItemsSource="{Binding Items, ElementName=Window}">

        <TextBlock Text="MESSAGE"
                   Margin="5,0" />

            <Grid x:Name="Grid">
                <TextBlock Text="{Binding}"
                           Margin="10" />

        <ControlTemplate TargetType="{x:Type HeaderedItemsControl}">
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="*" />

                <Border Grid.Row="0"
                        BorderBrush="#FF535353" />

                <ContentPresenter Grid.Row="0"
                                  HorizontalAlignment="Stretch" />

                <ItemsPresenter Grid.Row="1"
                                HorizontalAlignment="Stretch" />


This is the result of this very basic window:


Now, in order to add the alternate background, we need to add the attribute AlternationCount to the HeaderedItemsControl. The value has to be the number of different index you need, in our example I’ll simply use two different backgrounds.

<HeaderedItemsControl AlternationCount="2"
                      ItemsSource="{Binding Items, ElementName=Window}">

Then, in order to change the background color of each row, I’ll use the triggers of the ItemTemplate to apply the new color to the Grid.


        <Grid x:Name="Grid">
            <TextBlock Text="{Binding}"
                       Margin="10" />

            <Trigger Property="ItemsControl.AlternationIndex"
                <Setter Property="Background"
                        TargetName="Grid" />
            <Trigger Property="ItemsControl.AlternationIndex"
                <Setter Property="Background"
                        TargetName="Grid" />


And the result is:


Continue reading

Free Windows 8 Design Templates are coming back soon

Windows 8
Two weeks ago, Microsoft Malaysia published a list of 50 templates to help developers creating applications for Windows 8. The links to the SkyDrive account that was hosting the 500 MB file is down and even all the MSDN blog posts that were talking about it have been deleted by Microsoft or their respective authors. I think the reason of this “black out” is the success of the operation, imagine a lot of people downloading the 500 MB file on only one SkyDrive account.

But as you can see on the web site of Microsoft Malaysia, the templates should come back soon. Microsoft will probably host the file on another platform.

Microsoft Malaysia