Localhost development with Live Services

Localhost development with Live Services

If you are planning to do development using the Live Services you will probably want to register a Live Services Project where the Return URL is an address on you local machine.  Unfortunately the UI on the Azure Services Developer Portal isn’t that informative which can lead to a bit of confusion.  In the following image I’ve attempted to register a new project where the Return URL is a local address on my machine.  Since the Domain is the top level domain that is in the Return URL I figured that I needed to put localhost in the Domain field.

image

As you can see this generated the error “Invalid application domain name.”  Whilst this error message is technically correct it would be better if it said “you don’t need to specify a domain if your return url is on your local machine”.  The upshot is that if you want to use a local address you can simply omit this field.

Windows 7 (again) and Hosted Exchange

Windows 7 (again) and Hosted Exchange

I decided that I would once again brave running the PDC Windows 7 build on my Toshiba M700.  Unlike last time where I installed the 64bit version I went with the x86 version.  Last time there were all sorts of issues such as IE8 crashing, drivers not installing and worst of all I couldn’t get Outlook to sync with our hosted exchange server.

After installing Windows 7, Office etc everything seemed to be going well.  IE8 was working, most hardware seems to be working but I was still not able to get Outlook to play ball with our hosted exchange.  nsquared uses myhostedsolution for our hosted exchange solution.  I still think they’re the best hosting provider out there with unlimited mailbox size for only $10US a month.  That said, I doubted that they would offer me support, knowing I’m running Windows 7.

I remembered that Craig Pringle, one of the regulars at (and founder of) Sydney Geek Coffee, also uses myhostedsolution.  Craig has also been doing a number of posts around the new features of Windows 7 so I figured he’d probably know the work around to get Outlook to work. One quick phone call later and sure enough I’m up and running.  We’re not sure whether this is a problem specific to Windows 7 as Craig has seen the issue under Vista but we do know that the work around seems to work:

Issue:

When setting up a connection to myhostedsolution you normally just enter your email address and password and hit Next.  Outlook goes off and autodiscovers all the settings it needs to connect.  I seem to recall it prompts you for your username and password once under normal circumstances where you again just enter your email address as you username. The issue I was seeing is that it repeatedly prompts for a username and password – as if the credentials are wrong.

Resolution

myhostedsolution normally allows you to authenticate using either your email address or your actual domain username eg netplexityuser_name.  If you use myhostedsolution you can find out your domain username by logging into their management console, going to the relevant User properties and looking at the bottom of the main page.  Using the domain username while configuring Outlook works a treat and I’m once again connected to our hosted exchange (syncing still in progress).

[Thanks Craig!!!]

HTC Touch Pro – Breaking the iPhone trend

HTC Touch Pro – Breaking the iPhone trend

One of the trends that I’ve seen over the last week or two is the growing number of previously loyal Windows Mobile users who have drunk the apple juice and are now wielding an iPhone. Whilst I have nothing against the iPhone I can’t see myself using a device that doesn’t support primitive operations such as copy-n-paste or that assumes that we wouldn’t want to schedule a meeting with more than one attendee….(list goes on).

With this in mind, when the screen on my HTC Touch Dual stopped working a couple of weeks ago I made the decision to go with the HTC Touch Pro.  Eventually it arrived yesterday and I must admit HTC do a great job of packaging:

IMAG0002

IMAG0003IMAG0005  

As I was unboxing and setting up the device I went through a bit of a mental checklist:

  • Minimal yet funky packaging
  • Easy to put together including battery, Sim card and microSD card
  • Autoconfigured for my carrier (3G support out of the box!)
  • Easy to connect through to Exchange (enter email and password and it’s done)
  • Nice user interface (much better than raw Windows Mobile but still a bit laggy in areas)
  • Device.exe crashes frequently
  • Screen is slow to respond

Honestly, why have I got yet another Microsoft based device that crashes (oh wait, it’s Windows, I should be used to this….).  Where is the quality in what’s being shipped. I don’t think that Microsoft or HTC get what really drives the consumer market but surely they must understand that consumers just want stuff that works.

Functional Programming and Linq

Functional Programming and Linq

Still trying to get you head around Linq and wondering what all the interest in Functional Programming is about?  Well Eric White has released a tutorial on Functional Programming in both C# 3.0 and VB 9.0. 

Getting MultiPoint SDK Installed under Windows XP SP3

Getting MultiPoint SDK Installed under Windows XP SP3

[NB: Kudos for this post needs to go to Greg and Andrew who actually solved this issue]

The MultiPoint SDK that I referred to in my previous post was designed to be installed on XP SP2 and Vista.  Unfortunately the way the installer has been written prevents it from being installed on XP SP3.  Here’s a bit of a hack to get around this limitation

1. Download & Install Orca

Download Orca from the Windows Installer SDK: http://download.microsoft.com/download/platformsdk/sdk/update/win98mexp/en-us/3790.0/msisdk-common.3.0.cab (open the CAB and rename the Orca-file to Orca.MSI to install it)

2. Open the Installer file in Orca

3. Under “Tables” click “Launch Condition”, then change the first row’s conditions from “… ServicePackLevel = 2…” to “… ServicePackLevel >= 2…”  
clip_image002

4. Save and close Orca

5. Run the saved installer.

What is MultiPoint?

What is MultiPoint?

One of the most interesting points around the announcement of Windows 7 is the improved support for touch input.  Clearly an extension (which devices such as the iPhone already use) to this is multi-touch.  Traditionally Windows, and it’s associated metaphors, has been geared around single input devices.  Whether the device is a keyboard, mouse or touch, Windows typically only expects one of them. 

What happens if we could break this model and build applications that support multiple mice?  Enter…. the MultiPoint SDK.  This is an SDK from Microsoft Research that allows you to build a WPF application that supports multiple mice.  Here are a bunch of links that you can look at to get started with MultiPoint.

MultiPoint Site  – http://www.microsoft.com/multipoint

Multipoint Blog – http://blogs.msdn.com/multipoint/default.aspx

MultiPoint SDK Download – http://www.microsoft.com/downloads/details.aspx?FamilyID=a137998b-e8d6-4fff-b805-2798d2c6e41d&displaylang=en

MS Research blog (old) –http://community.research.microsoft.com/forums/43.aspx

Mouse Mischief – http://mousemischief.org

Offical MS Press Release – http://www.microsoft.com/presspass/features/2006/dec06/12-14MultiPoint.mspx

Multipoint for Education (Whitepaper) -http://research.microsoft.com/users/udaip/multipoint.htm

Multipoint: What. How. Why (Video) – http://channel9.msdn.com/posts/Charles/MultiPoint-What-How-Why/

Working Locally with Live Mesh

Working Locally with Live Mesh

Angus made an interesting post talking about the relative merits of connecting to the Live Operating Environment (LOE) locally, rather than to the cloud.  Anyone who has heard me present on SQL Compact, Sync Services or building Mobile Applications will know that “I hate the web”.  Actually this is a complete lie, what I hate is the obsessive nature with which developers choose to build web applications “because it’s easy” – easy to build, easy to deploy, easy to upgrade.  But what they forget is the user experience.  Let’s face it, despite numerous attempts to make the web usable, there are still a number of non-usable elements about it:

– Firstly, the request-response model for interacting with pages and data is fundamentally not a great way to build applications.  Whilst Ajax has gone a bit of the way to ease this problem, most developers don’t understand the concept of pre-loading data and trying to make the application more responsive by trying to predict what the user wants to do.  The net effect is that the user still has to wait when they click that button – sure, they don’t see a full page refresh but they still have to wait, and wait and wait again….

– There are a couple of technologies out there that could make a real difference to building web applications.  The leaders are definitely Silverlight and Flash – their ability to support rich graphics whilst supporting basic programming constructs such as threading mean that they can really be used for building applications.  Unfortunately as these technologies both require client side installs and are typically associated with a browser, there is still the underlying issues associated with browser differences.

This brings me back to the post Angus made.  He’s spot on with the list of things that the local LOE enables.  I can’t count the number of times that I’ve got up on stage and talked about the issues associated with sync’ing data, application settings and authentication.  But these are essentially all problems that need to be solved because you want the ability to keep working when there is no connection available.

IE Mobile 6 for Windows Mobile 6

IE Mobile 6 for Windows Mobile 6

Somehow I forgot to mention this last week but IE Mobile 6 for Windows Mobile 6 was released.  There are a series of emulators running Windows Mobile 6.1.4 which includes IE Mobile 6 available for download.  Unfortunately you will have to wait for your OEM of choice to upgrade their ROMs before you can make use of the new functionality…… Ho Hum, what’s wrong with building installers that will update applications on the device.

Extending Silverlight Mesh Enabled Application with the Live Framework

Extending Silverlight Mesh Enabled Application with the Live Framework

In a previous post across on the Professional Visual Studio blog I walked through getting your first Mesh-enabled Silverlight application up and running. Today I was putting together a bit more of a sample on working with Mesh and got thinking – wouldn’t it be cool if I could use Mesh to replicate out assemblies that could be used to extend an existing application.  The scenario would be that someone creates a mesh application with specific extension points.  Anyone who belongs to that mesh could then build extensions and make them available to other members on the mesh.

I’ll assume that you have read through my previous post, so I’m not going to cover off building your first Silverlight mesh-enabled application.

The next thing to do was to create a simple Silverlight control library and to use a traditional windows forms application to load this assembly into the mesh corresponding to the application I built.  Rather than build out any specific extension points I’m just going to use the Silverlight User Control as a pseudo-interface (clearly it’s not an interface but the fact that I know my type will be a User Control will mean that I can cast it and display it in my Silverlight app – poor man’s application extensibility). There is nothing special about the control library; just use the project template in the new project dialog, give it a name, create a new user control (eg MyUserControl) and build the control library.

The Windows Forms application is where it becomes a little more interesting.  In order to work with Mesh you need to start by connecting to the Live Operating Environment, LOE.

private static string meshCloudUrl = @"https://user-ctp.windows.net";
private
static void ConnectCloud(string Username, string Password)
{

    //Get the URI from the input
    Uri meshCloudUri = new Uri(meshCloudUrl );

    System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(Username, Password);

    // Use "LiveItemAccessOptions" to pre-fetch the resources
    Microsoft.LiveFX.Client.LiveItemAccessOptions accessOptions = new Microsoft.LiveFX.Client.LiveItemAccessOptions(true);

    ConnectedLiveOperatingEnvironment = new LiveOperatingEnvironment();
    ConnectedLiveOperatingEnvironment.Connect(credentials);
}

Once you have connected to LOE you can iterate through resource and make use of the Live Services api.  The assembly we created earlier needs to be added to a DataFeed.  In this case we will iterate through the existing feeds for the MeshObject corresponding to our Silverlight mesh-enabled application, called MyFirstSilverlightApp. The assembly will be added to a feed called BitsAndPieces.  If this DataFeed doesn’t exist, it will be created.

if (ConnectedLiveOperatingEnvironment.IsRunning())
{
    MeshObject status = null;
    foreach (MeshObject mo in ConnectedLiveOperatingEnvironment.Mesh.MeshObjects.Entries)
    {
        if (string.Equals(mo.Resource.Title, "MyFirstSilverlightApp"))
        {
            status = mo;
            break;
        }
    }

    if (status != null)
    {
        foreach (DataFeed df in status.DataFeeds.Entries)
        {
            if (df.Resource.Title == "BitsAndPieces")
            {
                objectFeed = df;
                break;
            }
        }

        if (objectFeed==null)
        {
            objectFeed = new DataFeed("BitsAndPieces");
            status.DataFeeds.Add(ref objectFeed);
        }
    }
}

Now that we have a reference to the DataFeed we just need to add the assembly as a stream.

OpenFileDialog dlg = new OpenFileDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
    FileStream fs = new FileStream(dlg.FileName,FileMode.Open);
    objectFeed.DataEntries.Add(fs, "Extension");
}

Running this will add the Silverlight control assembly to the Mesh, which will subsequently be synchronized to those devices on the mesh.  This will make it available whereever the MyFirstSilverlightApp is run.

Making use of this extension is essentially the same process but in reverse.  The Silverlight application needs to access the mesh environment, read the appropriate feed, load the assembly, create an instance of the type and then display it.  To begin with, when the application is loaded you need to get references to the Mesh Service.

private static MeshApplicationService MeshService;
private static LiveOperatingEnvironment MeshEnvironment;

public Page()
{
    InitializeComponent();

    MeshService = Application.Current.GetMeshApplicationService();
    // once mesh contents are loaded we get callback
    MeshService.LoadCompleted += new EventHandler(meshAppLoaded);
    MeshService.Load();

    MeshEnvironment = MeshService.LiveOperatingEnvironment;
}

void meshAppLoaded(object sender, EventArgs e)
{
    ….
}

When the mesh services has completed loading the LoadCompleted event will be raised.  In the event handler for this event is a good place for us to find our BitsAndPieces data feed so that we can access our assembly.

foreach (DataFeed df in MeshService.DataFeeds.Entries)
{
    if (df.Resource.Title == "BitsAndPieces")
    {
        foreach (DataEntry de in df.DataEntries.Entries)
        {
            if (de.Resource.Title == "Extension")
            {
                System.IO.MemoryStream mstream = new System.IO.MemoryStream();
                de.ReadMediaResource(mstream);
                AssemblyPart part = new AssemblyPart();
                System.Reflection.Assembly asmb  =part.Load(mstream);
                UserControl uc = Activator.CreateInstance(asmb.GetType("UserControlLibrary.MyUserControl")) as UserControl;
                if (uc != null)
                {
                    this.Content = uc;
                }
            }
        }
    }
}

In this example all the assembly names and class types are hardcoded.  This doesn’t need to be the case and you could iterate through classes in an assembly or use some interfaces or attributes to determine which types can be instantiated for use by the application.

iPhones are for Girls, Diamonds are for Men

iPhones are for Girls, Diamonds are for Men

This post started out as a bit of a grumble about the complete lack of support here in Australia for Windows Mobile devices.  I recall about a months or so ago being pleasantly surprised when I saw the HTC Touch Dual on that back of buses.  It got me thinking that Microsoft Australia actually cared what devices we bought and were trying to make a difference.

Unfortunately, last week my trusty device (the Touch Dual) packed it in.  For some reason the screen is completely dysfunctional – whilst you can still do quite a few things with the device with no touch screen, it’s almost impossible to dismiss alarms/reminders and send SMS messages.  This is because the hardware manufacturers have decided to move away from providing hardware alternatives to the on-screen soft-keys.

Over last weekend I went looking for a new Windows Mobile device.  Being familiar with the HTC Diamond I thought I’d at least start with that.  I know that the Touch Pro (essentially the Diamond with a keyboard) has been released but I doubted that anyone in Australia would stock it.  What I wasn’t prepared for was the complete lack of nearly any Windows Mobile based devices in any of the stores we went into.  I think we went into close to 10 shops covering 3, Telstra, Vodafone, Optus and a couple of other less carried dependent stores.  Of these stores perhaps 1 or 2 of them had the Touch II or the Touch Dual. Surprisingly the Telstra store had a Diamond on display but that was the only Windows Mobile device out of around 30 phones on display.  Nearly all the stores had the usual suspects of Blackberry, Nokia, Samsung etc on display. Oh, and yes, of course there was the mandatory iPhone propaganda.

In summary I don’t know what the Windows Mobile group is doing in Australia, but it’s definitely not working.  The message is not getting out, the devices are not a viable alternative as the plans are not competitive and they are not accessible!

Ok, so now for some good news.  I happen to be waiting to get my hair cut and was flicking through a copy of Men’s Style and came across a one page comparison between the iPhone and the HTC Diamond.  I immediately thought “here we go, more Go Buy an iPhone rubbish,” but no, this was actually a fair comparison of the good and bad points of the devices.  In fact, after reading it you’d want to go and buy the HTC Diamond.

IMAGE_496 IMAGE_497

To wrap this post up, I’m going to conclude that since this was in a Men’s article that (HTC) Diamonds are clearly designed for men, whilst iPhones are only suitable for girls.