Blog Home  Home Feed your aggregator (RSS 2.0)  
.Net Jonesie - November, 2009
A simple programmers blog
 
# Friday, November 20, 2009

Day 2 began with more sizzle – lots of announcements and goodies.

SilverLight 4

Scott Guthrie - as always – gets to make the best announcements.  SilverLight 4 is out in Beta now and release will be 1st half of next year (probably around MIX time I’d guess).  Here’s the highlights:

  • Support for external devices including cameras and microphones.  Scott did a fun little demo using a web cam and some special effects. You can also interact with the stream – in another demo that took a snapshot of a barcode and did a lookup for the book.
  • Printing.  Let me say that again PRINTING!!! Awesome!!  Custom print preview also.
  • Multicasting support.  Don’t know what this is but it got a couple of ooo’s and ahhhh’s.
  • RichText, Clipboard (system or app), MouseWheel, Right Click and Drag and Drop. They demoed some of these using an awesome (so I say awesome too much?) Facebook client (the code for which is available).
  • Command Manager and MVVM framework.  Our SL gurus spend a lot of time getting this basic code working on every significant SL project.  This will save many hours!
  • HTML Control. Totally awesome!  You can use this to display any old HTML including plugins such as Flash. In this demo they played a Rick roll video off YouTube in a HTML control that was embedded in a SL app.  Then they chopped up the ‘page’ into a jigsaw and shsuffled the pieces.  All this while the video was still playing!  Incredible stuff!
  • Shared Assemblies.  No more sharing of code and recompiling.  Assemblies compiled in .Net 4 will be able to be used from SilverLight and non SilverLight apps. Another big timesaver there.
  • WCF & REST enhancements including support for TCP Channels!! OMG!
  • Intellisence for data binding.
  • COM automation via the DLR.  They demoed this by creating items in Outlook. Very easy and natural.
  • Implicit Styles. 
  • Keyboard in fullscreen mode.
  • Profiling support.
  • CHROME support.  Ha!  Take that Google.
  • And best of all – fully trusted applications outside the browser!!  WICKEDLY AWESOME!
  • Oh and it’s still only ~5MB and it’s twice as fast.

The relevance of WPF is in question now I think.  SilverLight 3 now has a 45% install base (that’s 45% of all PC’s on the planet I think). 

SharePoint and Office 2010

Apart from watching an awesome SharePoint and SilverLight demo involving a racing car that looked strangely familiar there wasn’t a lot of stuff shown.  Highlights were using the new tools in Visual Studio 2010 to create SharePoint Solutions.  This has improved the experience by several orders of magnitude. Main features I caught:

  • Sandbox deployments
  • F5 compile and debug – no more compile, deploy, activate, run, attach blah blah.
  • Can develop without SharePoint installed locally.

Beta is out now.

Goodies

They demoed a bunch of the latest hardware and some of the cool new things you can do with this gear.  Stuff like HD, MultiTouch and many cores.  Then they announced that every attendee at PDC would get a free notebook!  AWESOME!!  I didn’t think this would include me – given the nature of my attendence – but I asked and I recevied!  Woo hoo.  I love Microsoft.

Friday, November 20, 2009 4:37:40 AM (New Zealand Daylight Time, UTC+13:00)  #    Comments [1]   General | PDC09  | 
# Thursday, November 19, 2009

The worlds most expensive hair dryer!

http://jonesie.net.nz/video/M2U00303.MPG

Thursday, November 19, 2009 4:58:41 AM (New Zealand Daylight Time, UTC+13:00)  #    Comments [0]   Azure | General | PDC09  | 
# Wednesday, November 18, 2009

I’m sitting in a session at PDC 09 on SQL Azure futures.  Here’s some notes for me and anyone else who cares.

Backups and Clones

  • Backups are coming.  Can now(?) create a clone of a database.  Something like CREATE DATABASE fred AS CLONE OF bob.

Operations

  • API for provisioning – useful for SaaS providers.  Great for Multi-tenant too.
  • Better deployment and upgrades.
  • Data Sync.
  • Upgrade and downgrade options between db sizes  (1 & 10 GB).

Scale-Out

  • Woa!  TicketDirect mentioned again!
  • Dynamic database splits.  And merge back of course.
  • Additional db size options. Maybe up to 50 GB.
  • Multiple db connections.
  • Fan out query for multiple db’s.

Other

  • Support for profiler
  • Full Text Search
  • CLR
  • BI

Sensitive Data - Codename Vidalia – woosh – this went over my head.

Wednesday, November 18, 2009 12:50:52 PM (New Zealand Daylight Time, UTC+13:00)  #    Comments [0]   Azure | General | PDC09  | 

We are already into the 2nd day of Microsoft’s Professional Developers Conference (PDC 09).  This year the theme is very clearly Cloud Computing and Azure but there are a sprinkling of sessions on Visual Studio 2010, Team System, Languages and even a little SharePoint and CRM/XRM.

Day 0 was workshop day and I attended and slightly assisted ‘The Yellow Croc Man’ (aka Chris Auld) with his sessions on developing for the Azure Platform.  Chris did a fantastic job – pointing out a lot of things that us developers don't normally care/think about as much as we should – i.e., pricing and data sovereignty.  These are very important issues with Azure and cloud computing in general.  Bad programming can cost a lot of dosh.  Our TicketDirect project was used extensively during Chris’ preso and at the end of the day, Mat Davey (TicketDirect CEO), Chris and I took the stage to answer questions (which was slightly scary).

Today was Key Note day with Ray Ozzie (Microsoft Chief Architect) and a host of walk-on ‘softies and 3rd parties.  Key points here were the announcement of :

PinPoint – a market place for all things Microsoft.  It’s up now - http://pinpoint.microsoft.com

Project Dallas – data as a service.  In CTP now - http://www.theregister.co.uk/2009/11/17/microsoft_dallas_data_service/ 

SQL Data Sync – Synchronise data from SQL Local to/from SQL Azure.  I think this is part of SQL 08 R2 – CTP available now.

Project Sydney – this allows you to connect direct to on-premise SQL Server from cloud roles. 

AppFabric – Will include caching (velocity), workflow, monitoring, service bus, service hosting and access control.  Most usefully this will enable multi-tenant apps. CTP will be out early next year.  This is a host for applications and replaces the .Net Services SDK.  More on this after later sessions.

Visual Studio 2010 will also include a bunch of new stuff to make deployment much much simpler for cloud and non-cloud applications. 

System Centre and IIS – admin tools to support AppFabric.

BizTalk 2009 R2 – updates for new SQL and Windows server R2 releases. PowerShell access. Mapping enhancements and updated B2B accelerators.

Interestingly, WordPress is now hostable on Azure – this is still a PHP Apache app – no .Net there.   Microsoft are providing a production ready service for this ahead of the office switch-flick on January 1.

Following the keynote we attended the Lap Around Azure session by the Direct of the Platform, Manuvir Das.  Once again, TicketDirect  was shown and received a very favourable response.

 

Day 1 is only half over! I’ll update with more news later.

Wednesday, November 18, 2009 11:20:21 AM (New Zealand Daylight Time, UTC+13:00)  #    Comments [0]    | 

SQL Azure will throttle your connections to protect resources in the data centre.  When SQL Azure does this is non-deterministic – or at least, Microsoft cannot specifically tell you when it will do this because there are many complicated factors. It could be the number of concurrent requests, the CPU or IO usages, the weather – who knows!  In the end it doesn’t really matter – you, THE DEVELOPER, must but be aware of this and deal with it.

SQL Throttling is manifested by a dropped connection.  This may appear as a Native Error 10054 when you try to open a connection or some other error if the connection is dropped after being opened.

To cope with this throttle a retry will normally be all that is required.  At the connection and command level this is easy but it can be complicated by unstructured code.  So, having a nice clean data layer will make the solution much easier to implement, but this applies equally to ‘messy’ code :)

We reused the Retry Policy mechanism that is provided with the Storage Client.  In the old sample storage client the syntax was a lot simpler but in the interest of less confusion I wont talk about that.  The new November SDK works just as well, but you need to do a tad more work.  The following sample is a connection manager that is used by the data layer.

using System;

using System.Data;

using System.Data.SqlClient;

using Microsoft.WindowsAzure.StorageClient;

 

namespace MyApp.DataLayer

{

  public class ConnectionManager

  {

 

    /// <summary>

    /// Maximum number of retries

    /// </summary>

    private const int MAX_RETRIES = 3;

    /// <summary>

    /// The retry policy for operations that can be retried (sql etc)

    /// </summary>

 

    private RetryPolicy RetryPolicy { get; set; }

 

    /// <summary>

    /// Wait 5 seconds between retries

    /// </summary>

    private const int WAIT_BETWEEN_RETRIES = 5000;

 

 

    public ConnectionManager()

    {

      this.RetryPolicy = RetryPolicies.Retry(MAX_RETRIES, TimeSpan.FromSeconds(5));

    }

 

 

    private SqlConnection OpenConnection(string connectionString)

    {

      SqlConnection con = null;

      try

      {

        DieHard.RequestWithRetry(RetryPolicy, () =>

            {

 

              SqlConnection connection = new SqlConnection(connectionString);

              connection.Open();

              con = connection;

            });

        return con;

      }

      catch (Exception ex)

      {

        throw new Exception("Error connecting to " + connectionString, ex);

      }

    }

  }

}

The interesting part is the DieHard helper class.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using Microsoft.WindowsAzure.StorageClient;

using System.Threading;

 

namespace MyApp.DataLayer

{

  public static class DieHard

  {

    public static T RequestWithRetry<T>(RetryPolicy retryPolicy, Func<T> action)

    {

      ShouldRetry shouldRetry = retryPolicy();

 

      int retryCount = 0;

      while (true)

      {

        TimeSpan delay = TimeSpan.FromSeconds(0);

 

        try

        {

          return action();

        }

        catch (Exception ex)

        {

          if (!shouldRetry(retryCount, ex, out delay))

            throw;

        }

        retryCount++;

        Thread.Sleep(delay);

      }

    }

 

    public static void RequestWithRetry(RetryPolicy retryPolicy, Action action)

    {

      ShouldRetry shouldRetry = retryPolicy();

 

      int retryCount = 0;

      while (true)

      {

        TimeSpan delay = TimeSpan.FromSeconds(0);

 

        try

        {

          action();

          return;

        }

        catch (Exception ex)

        {

          if (!shouldRetry(retryCount, ex, out delay))

            throw;

        }

 

        retryCount++;

        Thread.Sleep(delay);

      }

    }

  }

}

 

DieHard has 2 variants of the same Retry invoker – 1 for void actions and the other for a generic return value.

There is a couple of points to mention.  The timeout and the number of retries to attempt may vary depending on your situation and other factors – don’t use my 5 second 5 retries settings as the best possible option for you.  You need to be aware of transactions.  Retries should encapsulate the transaction as dropping a connection will rollback the transaction.  So, except for this example of retrying the open connection you should use the retry mechanism at the higher domain level.

Enjoy!

Wednesday, November 18, 2009 10:20:39 AM (New Zealand Daylight Time, UTC+13:00)  #    Comments [0]   Azure | General | SQL  | 
Copyright © 2012 Peter G Jones. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: