Marc LaFleur

Thoughts on finding a better way
Mono 2.0

The Mono Project has hit 2.0. They seem to have done a lot of work around ASP.NET, Windows Forms, and ADO support.

It has been a while since I've poked around with Mono. Maybe it is time for me to take another look. Time to steal my children's Mac for a few days I think. :)

I Snapped My Chrome!

One of the more interesting features in Google’s new Chrome browser is “Application Shortcuts”. These are web site links that Chrome places on your Start menu, Desktop and/or Quick Launch bar. When launched they open with a trimmed down UI, giving the web application a decidedly “desktop” feel. I’ve created shortcuts for a number of applications, including my GMail account.

Today, while responding to an email, I got what is best described as a “black screen of death”. Chrome informed me that “Ah, Snap! Something went wrong while displaying this webpage. To continue, press Reload or go to another page”.

Aside from being a rather silly error message, it tells me nothing of value. I don’t know what went wrong. It doesn’t help me diagnose if it was Chrome that failed or the site it was viewing. And the methods suggested for resolving this error are not valid in “shortcut mode” as there are no toolbar items to press or URL boxes to navigate with.

One aspect of this message that I like is that it assumes the user isn’t an expert. It doesn’t shove a bunch of technical information at the poor user who cannot do anything with it anyway. Why needlessly make things confusing?

The problem is that they didn’t give any obvious way to get at the technical information for those who can make use of it. And if you’re going to go with the simplicity route then you need to make sure your error message gives a working resolution to the user. That novice user isn’t going to make the same assumption that I did and press F5 to reload the page.

My First Chrome Experience

My inbox has been flooded with emails asking me to blog about my opinion of Chrome. That is if you consider "flooded" to be one more than zero. And you include the email I sent to myself from work as a reminder to give it a shot...

Ok fine. No one asked. And even less likely care. But guess what, you're getting it anyway.

What I liked...

The download is a wonderfully small 475 KB. The same cannot be said for either IE or Firefox.

I was impressed with how quickly Chrome opened for me. Both IE and Firefox take between 3 and 5 seconds to load on my Vista machine. Chrome however opens instantly.

One feature that sticks out is the default home page. Rather than a search page like Firefox or that bloated MSN page from IE, you get a slick UI with personalized content on it. The "Most visited" site section is reminiscent of the XP and Vista start menu's listing of most commonly used applications. And having bookmarks displayed is also a nice touch.

Overall I'd have to say that Chrome is very quick and responsive. Pages render quickly and (from my limited testing) without any major issues.

What I didn't...

One major flaw in my view is that the default home page, while innovative, lacks any control over what gets displayed. If you search Monster regularly for example then it is going to show up on your home page. While convenient in some circumstances, imagine your manager walking past your desk and seeing a screen shot of Monster at the top of your list. And I've been told that some people have been known to use the net for more "adult" activities. Wouldn't that go over well when you open your browser during your quarterly sales presentation.... 

As a research project Chrome has some real value. If the benchmarks they present are accurate they have made some major improvements to JavaScript processing. But they are talking about it in much grander terms than just a research project. They seem to be positioning it as a first-class browser to replace IE, Firefox and the rest.

I'm still not sure why I should care. I've never felt an overwhelming desire to get a new browser. I use Firefox and IE and find very little difference between the two. I don't really see what market need Google is trying to fill here.

But I'm Not Dead Yet!

Ever have one of those "bad days"? Someone at Bloomberg had one yesterday. Looks like someone mistakenly published an obituary for Steve Jobs.

Posted: Aug 29 2008, 01:59 PM by MarcLaFleur | with no comments
Filed under:
Another Scott Hanselman Fan

My youngest (Michael, 5 months) has discovered BabySmash! It looks like Scott Hanselman has yet another life-ling fan.

Posted: Aug 29 2008, 01:15 PM by MarcLaFleur | with no comments
Filed under:
Silverlight Slideshow

I spent a few minutes last night looking for a simple Silverlight based slideshow control. I found a really nice one on CodePlex called "Silverlight Slideshow". It took only about 5 minutes to get a small show put together.

It was originally developed by First Floor Software. They've also got a preview of a Silverlight 2.0 version of the control that looks cool.

New Blog: Speaking From the Edge

I've started a new blog over on GotSpeech.net called Speaking From the Edge. It covers topics related to voice-enabled application development including Microsoft Speech Server. 

I'm not abandoning this site however. I will continue to post here as well. I'm also putting some thought to re-launching this blog to focus on other topics I'm interested in.

Executing a Speech Server Workflow via the API

In my previous post I outlined a basic framework for using the Core API for Speech Server 2007. Today I'll outline how to mix both the API and Workflow models by calling out to a workflow using the API and returning control back when it is complete.

If you are interested in the complete project code you may download it here.

I'm starting with the same basic framework from my last post. To this I'm adding a simple Voice Response Workflow with a single Statement activity. Rather than calling the synthesizer from the API, I'm going to use the Statement activity inside the workflow.  We're going to pass in the text we want it to play at runtime.

1) The first thing we need to do is add a new Voice Response Workflow to the project. Too this we'll add a single Statement activity. Because we've established the call using the API there is no AnswerCall, MakeCall, or DisconnectCall activities in this workflow.

image

 

2) Now that we have our really-big-and-complex workflow ready, we can start adding some code to set the prompt. The first thing we need to do is add a handler for the TurnStarting event. This is where we will assign the Main Prompt property for the activity.

3) Next we need to add a property to pass in our input parameters too. We'll call this MyPrompt. The resulting code behind should look like the following:

using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Diagnostics;
using System.Drawing;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.SpeechServer.Dialog;

namespace VoiceResponseWorkflowApplication2
{
    public sealed partial class Workflow1: SpeechSequentialWorkflowActivity
    {
        public Workflow1()
        {
            InitializeComponent();           
        }

        private string _myPrompt;
        public string MyPrompt
        {
            get { return _myPrompt; }
            set { _myPrompt = value; }
        }

        private void statementActivity1_TurnStarting(object sender, TurnStartingEventArgs e)
        {
            statementActivity1.MainPrompt.SetText(MyPrompt);
        }
    }
}

4) Now we need to add some code to kick off the workflow. We'll do this from within the OpenCompleted event handler in Class1.cs. This code establishes an input parameter Dictionary<>, instantiates the workflow object, and starts the workflow. We'll add a handler for the WorkflowCompleted event so that we can cleanup the call once the workflow is done. 

Dictionary<string, object> inputParam = new Dictionary<string, object>();
inputParam.Add("MyPrompt", "HelloWorld");
myWorkflow = SpeechSequentialWorkflowActivity.CreateWorkflow(_host, typeof(Workflow1), inputParam);
myWorkflow.WorkflowRuntime.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(WorkflowRuntime_WorkflowCompleted);
SpeechSequentialWorkflowActivity.Start(myWorkflow);

One interesting item here is the inputParam object. The way this works is that you pass in parameters to the workflow and it assigns the values to the corresponding public properties of the workflow. If you pass an input parameter for which there is no property you will get an exception.

The complete Class1.cs:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SpeechServer ;
using Microsoft.SpeechServer.Dialog;
using System.Workflow.Runtime;

namespace VoiceResponseWorkflowApplication2
{
    public class Class1 : IHostedSpeechApplication
    {
        private IApplicationHost _host;
        private WorkflowInstance myWorkflow;

        public void Start(IApplicationHost host)
        {
            if (host != null)
            {
                _host = host;
                _host.TelephonySession.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");

                // Dial and outbound call (make sure you change these numbers :-)
                _host.TelephonySession.OpenCompleted += new EventHandler<AsyncCompletedEventArgs>(TelephonySession_OpenCompleted);
                _host.TelephonySession.OpenAsync("7813062200", "8887006263");
            }
            else
            {
                throw new ArgumentNullException("host");
            }
        }

        void TelephonySession_OpenCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                _host.TelephonySession.Close();
            }
            else
            {
                Dictionary<string, object> inputParam = new Dictionary<string, object>();
                inputParam.Add("MyPrompt", "HelloWorld");
                myWorkflow = SpeechSequentialWorkflowActivity.CreateWorkflow(_host, typeof(Workflow1), inputParam);
                myWorkflow.WorkflowRuntime.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(WorkflowRuntime_WorkflowCompleted);
                SpeechSequentialWorkflowActivity.Start(myWorkflow);
            }
        }

        void WorkflowRuntime_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
        {
            _host.TelephonySession.Close();
        }

        public void Stop(bool immediate)
        {

        }

        public void OnUnhandledException(Exception exception)
        {
            if (exception != null)
            {
                _host.TelephonySession.LoggingManager.LogApplicationError(100, "An unexpected exception occurred: {0}", exception.Message);
            }
            else
            {
                _host.TelephonySession.LoggingManager.LogApplicationError(100, "An unknown exception occurred: {0}", System.Environment.StackTrace);
            }

            _host.OnCompleted();
        }
    }
}

(download the zipped project here)

Getting Started with the Speech Server 2007 API

Speech Server 2007 has a really cool Windows Workflow based programming model that lets you quickly build interactive voice response applications. For many applications it is all you will ever need.

Sometimes however you find the workflow model just isn't the right fit. If you're looking for really fine-grained control over the application, or you simply prefer to work in code, then the Core API is what you need.

Unfortunately figuring out you want to use the API is a lot easier than figuring out how to start using it. There is very little documentation and no Visual Studio project templates or samples included with Speech Server.

I'll do my best to give a brick-simple explanation of how to get your first core API project started. You can also download the zipped project files.

1) First you'll need to create a new Voice Response Workflow Application. We'll use the project that gets generated as our foundation.

image

2) When asked for the application resources you'll want to uncheck everything.

image

3) Open up the Class1.cs file and remove all of the references to the VoiceResponseWorkflow1 class. The resulting class should look like the following (I removed the comments in the code for brevity):

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SpeechServer ;
using Microsoft.SpeechServer.Dialog;

namespace VoiceResponseWorkflowApplication1
{
    public class Class1 : IHostedSpeechApplication
    {     
        private IApplicationHost _host;

        public void Start(IApplicationHost host)
        {
            if (host != null)
            {
                _host = host;
                _host.TelephonySession.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");
            }
            else
            {
                throw new ArgumentNullException("host");
            }
        }
        public void Stop(bool immediate)
        {
        }

        public void OnUnhandledException(Exception exception)
        {
            if (exception != null)
            {
                _host.TelephonySession.LoggingManager.LogApplicationError(100, "An unexpected exception occurred: {0}", exception.Message);
            }
            else
            {
                _host.TelephonySession.LoggingManager.LogApplicationError(100, "An unknown exception occurred: {0}", System.Environment.StackTrace);
            }

            _host.OnCompleted();
        }
    }
}

That's all folks. Class1.cs is now the starting point of your Core API application. As a further example, lets take the project and add some code to turn it into an outbound dialing "Hello World" application.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SpeechServer ;
using Microsoft.SpeechServer.Dialog;

namespace VoiceResponseWorkflowApplication1
{
    public class Class1 : IHostedSpeechApplication
    {     
        private IApplicationHost _host;

        public void Start(IApplicationHost host)
        {
            if (host != null)
            {
                _host = host;
                _host.TelephonySession.CurrentUICulture = System.Globalization.CultureInfo.GetCultureInfo("en-US");
                // Dial and outbound call (make sure you change these numbers :-)
                _host.TelephonySession.OpenCompleted += new EventHandler<AsyncCompletedEventArgs>(TelephonySession_OpenCompleted);
                _host.TelephonySession.OpenAsync("7813062200", "8887006263");
            }
            else
            {
                throw new ArgumentNullException("host");
            }
        }

        void TelephonySession_OpenCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                _host.TelephonySession.Close();
            }
            else
            {
                _host.TelephonySession.Synthesizer.SpeakCompleted += new EventHandler<Microsoft.SpeechServer.Synthesis.SpeakCompletedEventArgs>(Synthesizer_SpeakCompleted);
                _host.TelephonySession.Synthesizer.SpeakAsync("Hello World", Microsoft.SpeechServer.Synthesis.SynthesisTextFormat.PlainText);
            }
        }

        void Synthesizer_SpeakCompleted(object sender, Microsoft.SpeechServer.Synthesis.SpeakCompletedEventArgs e)
        {
            _host.TelephonySession.Close();
        }
        public void Stop(bool immediate)
        {
        }

        public void OnUnhandledException(Exception exception)
        {
            if (exception != null)
            {
                _host.TelephonySession.LoggingManager.LogApplicationError(100, "An unexpected exception occurred: {0}", exception.Message);
            }
            else
            {
                _host.TelephonySession.LoggingManager.LogApplicationError(100, "An unknown exception occurred: {0}", System.Environment.StackTrace);
            }

            _host.OnCompleted();
        }
    }
}

(download the zipped project)

Scoble Scale?

Robert Scoble has an interesting post in response to Om Malik's suggestion that Twitter start charging "Super Users". Scoble would qualify as an edge-case when comes to social network . He has a history of hitting the limits like these on MSN Messenger and Facebook.

Charging seems like an acceptable action to take for users like Robert who use these services at such a level. Robert is obviously getting business value out of these services and it is perfectly reasonable to get revenue from that. But I agree with Robert when he says that this won't completely solve their scalability problems. The amount they would have to charge would likely exceed the value of the service.

I also hope that Robert is correct in his assertion that Twitter's problem isn't caused by how it manages the data. If Assetbar is correct in his description then Twitter has a problem. I have no knowledge as to how Twitter works under the covers but I sure hope Assetbar's description isn't accurate.

I think we need to add another level to our description of scale: Small, Large , Enterprise and now Scoble Scale. Maybe he should rent himself out as a testing framework for social networks...

More Posts Next page »