All posts by joshholmes

Playing with JSON

Silverlight Plasma ReactorI was asked on Friday by a friend how one can consume JSON in Silverlight. At the time, I just said start with the System.Json namespace and I’ll get you a sample later. Well, here’s a sample and a peek into my head because I couldn’t just stop with creating the sample that he needed.

Download Solution – PlayingWithJSON.zip

*Update – gotta do a quick shoutout to Leon Gersing for his passionate defense of JavaScript and JSON. It’s part of what inspired me to spend as much time on this as I did.

Really short JSON overview

JSON, for those of you who don’t know, is a really simple data format heavily used with JavaScript. It’s a lot smaller and lighter than XML.

This is the JSON that I’m using in this example. As you can see, it’s just name/value pairs with a little bit of extra formatting. Curly Braces separate objects in a list. Commas separate values. Colons separate the names from the values. 

[
{“FirstName”:”Etta”,”LastName”:”James”,”Url”:”http:\/\/www.etta-james.com\/”},{“FirstName”:”Billie”,”LastName”:”Holiday”,”Url”:”http:\/\/www.billie-holiday.net\/”},{“FirstName”:”Ella”,”LastName”:”Fitzgerald”,”Url”:”http:\/\/en.wikipedia.org\/wiki\/Ella_Fitzgerald”}]
}

Creating the JSON service with ASP.NET MVC Framework

The first thing that I did was slap together an ASP.NET MVC Framework application to produce the JSON and host the Silverlight application. This was remarkably easy. I decided against going through the effort of creating a database because that’s not really the point of the exercise.

I created a simple class that to fill out and serialize and then returned it from a controller.

public class Artist
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Url { get; set; }
}

The next step was to create a simple controller that would return my list as JSON. As you can see, there’s a JsonResult that you can return right from a controller method.

public class ArtistsController : Controller
{
    public JsonResult GetAll()
    {
        List<Artist> artists = new List<Artist>();

        artists.Add(new Artist("Etta", "James", "http://www.etta-james.com/"));
        artists.Add(new Artist("Billie", "Holiday", "http://www.billie-holiday.net/"));
        artists.Add(new Artist("Ella", "Fitzgerald", "http://en.wikipedia.org/wiki/Ella_Fitzgerald"));

        return Json(artists);
    }
}

To test it, I just browsed to http://localhost:mylocalport/artists/getall. That returned the JSON file. As the browser doesn’t display JSON auto-magically, it prompted me to download a file and save it off.

Now, take notice of the URL. The ASP.NET MVC Framework is producing what’s called a RESTful Service. The parameters and all are simply in the URL. In the URL, “artists” takes us to a particular Controller called the ArtistsController and the “getall” calls the “GetAll()” method on that controller. We can further specify parameters and the like in the URL. Scott Guthrie has a great article that explains the URL routing and all at http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx.

Now that we are producing JSON from a services, we are ready to create a client.

Getting the JSON from the RESTful service.

The first client that I tried was the straight up System.Json namespace client. Since we are using a RESTful service, we can’t generate the proxy object in the same way that we’re used to with SOAP. Instead, we need to leverage the WebClient object.  This is done as follows:

void mainButton_Click(object sender, RoutedEventArgs e)
{
    Uri serviceUri = new Uri("/Artists/GetAll", UriKind.Relative);
    WebClient downloader = new WebClient();
    downloader.OpenReadCompleted += new OpenReadCompletedEventHandler(downloader_OpenReadCompleted);
    downloader.OpenReadAsync(serviceUri);
}

Notice that the URL that I’m using is relative. You can specify the full URL if the service is not on your own server. These calls, as all calls in Silverlight, are async. Therefore I wire up the downloader_OpenReadCompleted event and call OpenReadAsync. Simple enough?

Leveraging System.Json

Once the downloader returns, I can get the result off of the event arguments. Load is a static method on the JsonArray that will automatically parse out the results from the stream object. Then, I can just loop over the objects in the array and use them to fill out my own type that I’m ready to databind to.

void downloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
    JsonArray jsonArray = (JsonArray)JsonArray.Load(e.Result);

    List<Artist> artists = new List<Artist>();

    foreach (JsonObject jsonArtist in jsonArray)
    {
        Artist artist = new Artist();
        artist.FirstName = jsonArtist["FirstName"];
        artist.LastName = jsonArtist["LastName"];
        artist.Url = jsonArtist["Url"];

        artists.Add(artist);
    }

    dataGrid1.ItemsSource = artists;
}

This was fairly straight forward and simple, but I wasn’t ready to be done yet.

Leveraging LINQ

The next thing is to try LINQ against this JsonArray and see what happens.

void downloader_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
    JsonArray jsonArray = (JsonArray)JsonArray.Load(e.Result);

    var query = from artist in jsonArray
                select new Artist
                {
                    FirstName = (string)artist["FirstName"],
                    LastName = (string)artist["LastName"],
                    Url = (string)artist["Url"],
                };

    List<Artist> artists = query.ToList() as List<Artist>;
    dataGrid1.ItemsSource = artists;
}

Personally, I think that the LINQ version is a lot more powerful. It’s not immediately obvious in this simple example but there’s a ton that I could do with the LINQ query from filling out sub-types to filtering and so on.

JSON in JavaScript

JavaScript ReferenceBut then I started thinking about all of the different ways that one can get and parse out JSON directly in JavaScript (I mean it does have JavaScript right in the name).

First, I did it the old school way that I used to do back when I was doing a ton of JavaScript development.

Quick note here – before you start copying this code – this is NOT the way to do this in the modern era. I did it to prove a point. You really need to be leveraging one of the many great JavaScript frameworks that are out there in order to accomplish your JavaScript today. I’ll get to those in a minute.

Short version, you’re going to be doing an XMLHttpRequest directly. When that returns you’ll get an “onreadystatechange” event which you can respond to. If it’s actually ready, then you can call a JavaScript function called eval that will return and array of objects parsed out from the string that you pass in.

<script language="javascript" type="text/javascript">
    function GetJson(url) {
        // Create xmlhttprequest object
        var xmlhttp = null;
        if (window.XMLHttpRequest) {
            xmlhttp = new XMLHttpRequest();
            //make sure that Browser supports overrideMimeType
            if (typeof xmlhttp.overrideMimeType != 'undefined') {
                xmlhttp.overrideMimeType('text/xml');
            }
        }
        else if (window.ActiveXObject) {
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        else {
            alert('Perhaps your browser does not support xmlhttprequests?');
        }

        // Create an HTTP GET request
        xmlhttp.open('GET', url, true);

        // Set the callback function
        xmlhttp.onreadystatechange = function() {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                var json = xmlhttp.responseText;

                var artists = eval(json);

                var newArtistList;
                newArtistList = "<ul>";

                for (var i in artists) {
                    var artist = artists[i];
                    newArtistList += "<li>"
                    + artist.FirstName + " "
                    + artist.LastName
                    + "</li>"
                }

                newArtistList += "<ul>";

                outputControl = document.getElementById("divOutput");
                outputControl.innerHTML = newArtistList;
            } else {
                // waiting for the call to complete
            }
        };

        // Make the actual request
        xmlhttp.send(null);
    }
</script>

Alright, that’s a lot of JavaScript to get through and understand. There are multiple possible problems here. First, that’s just a ton of code. Second, the same eval function that you are calling here is the same eval function used to dynamically execute a piece of JavaScript in a string. This means that you’re open to all kinds of possible attacks. Finally, there are a ton of frameworks that have come up in the past handful of years.

So, let’s go look at some of those frameworks.

Leveraging MS AJAX

The AJAX framework that I’ve been trying to learn lately is the MS AJAX one. It’s got a lot of power. First, notice that the WebRequest actually looks a lot like what I did in C#. Next, notice the JavaScriptSerializer object. This gives me some nice and easy serialization to and from JSON. The reason to use this is that it’s a much safer mechanism than eval. Lastly, notice the $get at the end. This is a nice and easy selector that does all of the heavy lifting of finding the object in the DOM and the like.

<script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
    function GetJson() {
        var request = new Sys.Net.WebRequest();
        request.get_headers()['Content-Type'] = 'application/json; charset=utf-8';
        request.set_url('/Artists/GetAll');

        request.add_completed(Function.createDelegate(null, DisplayArtists));
        request.invoke();
    }

    function DisplayArtists(executor) {
        if (executor.get_responseAvailable()) {
            var json = executor.get_responseData();
            var artists = Sys.Serialization.JavaScriptSerializer.deserialize(json);

            var newArtistList;
            newArtistList = "<ul>";

            for (var i in artists) {
                var artist = artists[i];
                newArtistList += "<li>"
                + artist.FirstName + " "
                + artist.LastName
                + "</li>"
            }

            newArtistList += "<ul>";

            $get("divOutput").innerHTML = newArtistList;
        }
    }
</script>

This is a lot less code and a lot safer than what I was doing in raw JavaScript. However, I thought I should try this with a few more frameworks.

Leveraging Prototype

image A framework that I’ve used for a while and really like is Prototype.

This is a whole lot less code. Notice the “Ajax.Request”. That packages up all of the work of doing the network call behind one simple to use function. And on the response is a nice and easy method called evalJSON that will parse out the JSON string to an array of objects that you can loop over. Finally, notice the $() selector.

<script src="../../Scripts/prototype-1.6.0.2.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
    function GetJson() {
        new Ajax.Request('/Artists/GetAll', {
            method: 'get',
            onSuccess: DisplayArtists
        })
      }

      function DisplayArtists(transport) {
        var json = transport.responseText.evalJSON();
        var newArtistList;
        newArtistList = "<ul>";

        json.each(function(artist) {
            newArtistList += "<li>"
                    + artist.FirstName + " "
                    + artist.LastName
                    + "</li>"
        });

        newArtistList += "<ul>";

        $("divOutput").insert(newArtistList);
    }
</script>

I liked this a lot. A feature that I didn’t take advantage of is that Scriptaculous, which is a fantastic set of JavaScript libraries for visualization, weaves in with Prototype really easily.

Leveraging jQuery

image The last JavaScript framework that I tried was jQuery. One extra cool part about this one for me is that I get intellisense right in Visual Studio. Check out Scott Guthrie’s post on jQuery Intellisense in VS2008 to see how to enable it.

Notice that it’s got the same type of easy to use function that packages up the call to get the JSON. Since it knows that it’s JSON, the variable returned to the callback is already parsed out into a usable object. And lastly, notice the $() selector again. There is a subtle difference between this one and the Prototype selector in that the jQuery one uses a # to signify that it’s looking for an ID, . to signify objects with a given class and so on.

<script language="javascript" type="text/javascript">
    function GetJson() {
        $.getJSON("/Artists/GetAll",
          {},
          DisplayArtists);
      }

      function DisplayArtists(data) {
          var newArtistList;
        newArtistList = "<ul>";

        for(var i = 0; i < data.length;i++)
        {
            var artist = data[i];
            newArtistList += "<li>"
                + artist.FirstName + " "
                + artist.LastName
                + "</li>"
        }

        newArtistList += "<ul>";

        $("#divOutput").html(newArtistList);
    }
</script>

Now that I was done playing with different JavaScript libraries, I thought I’d see if I could piece it all back together.

Leveraging jQuery and Silverlight

I decided to try jQuery and Silverlight together, leveraging jQuery to get and parse the JSON and Silverlight to do the display. This turned out to be remarkably simple.

First, in order for Silverlight to call into the JavaScript, you just have to call HtmlPage.Window.Invoke. That dynamically looks up and executes the method named in the first parameter.

void mainButton_Click(object sender, RoutedEventArgs e)
{
    HtmlPage.Window.Invoke("GetJson", "/Artists/GetAll");
}

Now, I could have wired up the JavaScript to listen for the button click event directly but that’s a lot more code than what I’ve got here.

Next I had to enable the Silverlight objects for callbacks. Step 1 is to Register the class with the browser’s scripting engine.

public LeveragingJQuery()
{
    InitializeComponent();
    HtmlPage.RegisterScriptableObject("LeveragingJQuery", this);
...
}

Step 2 is to declare one of the methods as a ScriptableMember. This gives the scripting engine access to the method in question. There’s also ScriptableType for creating serializable objects but that’s not what we need here. Notice, however, that the object type passed in is a ScriptObject. The slick part about this object is that it’s got a “ConvertTo” method that will take the weakly typed objects that it contains and serialize them to the type of object that you specify. This made the C# code here REALLY simple.

[ScriptableMember]
public void CallBackFromJavaScript(ScriptObject artists)
{
    List<Artist> listofartists = artists.ConvertTo<List<Artist>>();
    dataGrid1.ItemsSource = listofartists;
}

What’s left is the JQuery in the browser that we’re talking to. Notice that the first part is exactly the same. The second part, however, is a little different. First, we have to get a reference to the Silverlight plugin itself. Since I’m in a form object, ASP.NET mangles the name a little bit but it wasn’t too hard to figure out the new name. Next, I have to get the object that I had registered with the RegisterScriptableObject method. Then, all that’s left is calling the method to pass in my array of Artists.

<script src="/Scripts/jquery-1.2.6.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
    function GetJson(url) {
        $.getJSON(url,
          {},
          DisplayArtists);
    }

    function DisplayArtists(artists) {
        var control = document.getElementById("ctl00_MainContent_SilverlightPlugin");
        var leveragingJSPage = control.Content.LeveragingJQuery;
        leveragingJSPage.CallBackFromJavaScript(artists);
    }
</script>

Conclusion

This is how I learn about new things. I’m not satisfied with just getting the job done in one and only one way. I want to try out 3, 4, 5 different ways to accomplish a given task. That way I know what the right way to do something is in a given context. For example, I don’t know that I’ll ever need to mingle jQuery and Silverlight. But, I know how it’s done now and know that it’s a lot simpler than I originally thought it would be.

JSON is a simple but powerful format. There are a ton of simple services, from flickr to twitter to many of your production applications that could be producing JSON. It saves bandwidth compared to XML and is a just as simple to use.

Too much to see at the MDC Detroit

I’m not normally overly excited about the large Microsoft events, however, I’m really looking forward to the MDC Detroit next week.

The idea behind the show is that it’s taking the most critical sessions from PDC and repackaging them in a one day format.

I’ve had a chance to go through a lot of the content and see what all is going to be show. The cool part about it is that the vast majority of the talks are doing a demo. This is a big departure from a lot of the multi-city roadshows that Microsoft puts on and it’s a good thing. You’ll actually get to see code running. You’ll see applications being built. The other thing is that these demos are real world. It’s not hello world style demos. In my talk, I’m actually building a full line of business HR application that reads and writes from the database.

The talk that I’m doing is the Silverlight talk. Those of you who know me are not shocked by that. 🙂 The cool part is that there are two parts to the talk. First, I’m going to show what you can do with current and shipping technologies. Then I’m going to show you what’s coming next.

Web technologies not your bag, there’s still plenty to see. Specifically, there are three different tracks. I’m in the Client and Presentation track. I’m just happy that there’s a lunch between me and Billy Hollis. That’ll give the audience to forget how awesome he was before coming and hearing me.

AGENDA

Time Table Azure Services Platform for Cloud Computing Client and Presentation Tools, Languages and Framework
7:00-8:30 Registration and Breakfast
8:30-10:00 Ron JacobsThe day starts off with a keynote presented by Ron Jacobs. If you’ve not heard Ron speak before, you’re in for a treat. He’s a dynamic and engaging speaker on any topic.
10:00-10:15 Break
10:15-11:30 Brian PrinceA Lap Around Windows Azure and the Azure Services Platform
Brian Prince
Jeff Hunsaker
Jason Karns
ASP.NET and JQuery
Jeff Hunsaker
Jason Karns
Bill WagnerThe Future of Managed Languages: C# and Visual Basic
Bill Wagner
11:30-12:30 lunch
12:30-1:45 Jennifer MarsmanDeveloping and Deploying Your First Azure Service
Jennifer Marsman
Billy HollisDeveloping Data-Centric Applications Using the WPF DataGrid and Ribbon Controls
Billy Hollis
Delbert MurphyA Lap Around “Oslo”
Delbert Murphy
Darryl Hogan (note that Darryl didn’t send in a photo.)
1:45-2:00 Break
2:00-3:15 Jeff BlankenburgA Lap Around the Live Framework and Mesh Services
Jeff Blankenburg
Josh HolmesBuilding Business-Focused Applications Using Silverlight 2
Josh Holmes

Randy Pagels
Tony Jimenez
A Lap Around VSTS 2010
Randy Pagels
Tony Jimenez

3:15-3:30 Break
3:30-4:45 Chris WoodruffDeveloping Applications Using Microsoft SQL Data Services
Chris Woodruff

Carey Payette
Jeff McWherter
ASP.NET 4.0 Roadmap
Carey Payette / Jeff McWherter

Jay WrenAn Introduction to Microsoft F#
Jay Wren

Chuck Norris writes code under the name Josh Holmes

I love Chuck Norris jokes. One of my favorites is “Some people wear Superman pajamas. Superman wears Chuck Norris pajamas.” There are a ton of them out there. There are even entire web sites dedicated to Chuck Norris jokes such as http://www.thechucknorrisfacts.com/. Most of those jokes are hysterical though some are slightly less than politically correct.

So Bill Wagner accidentally started jokes about me. Bill was actually responding to me when I posted that it was -8 outside. The full context is that “-8 keeps out the riff raff” but as you can read below, it looks like he was saying that I’m the one that keeps out the riff raff.

Leon Gershing (aka fallenrogue) took that and ran with it ala Chuck Norris jokes. Since then a ton of people have started piling on. (btw – Leon actually named this post to)

Bill_color_small_normalbillwagner: @joshholmes Keeps out the riff raff.
1 day ago · Reply · View Tweet
Photo_22_normal fallenrogue: @billwagner I hear @joshholmes‘ tears cure cancer…. too bad he’s never cried.
1 day ago · Reply · View Tweet
Photo_22_normalfallenrogue: I also hear that @joshholmes has to register any code he writes as lethal weapons.
1 day ago · Reply · View Tweet
Picture_14_normalusher: Good laugh of the day – RT @fallenrogue: I also hear that @joshholmes has to register any code he writes as lethal weapons.
1 day ago · Reply · View Tweet

Photo_35_normaljoefiorini: @fallenrogue I’ve heard that @joshholmes‘ failing tests pass anyway because they are too scared to fail.
1 day ago · Reply · View Tweet
3187276048_580e77883b-1_normalcoreyhaines: @joefiorini I heard that @joshholmes‘ testing framework writes tests for @joshholmes
1 day ago · Reply · View Tweet
Photo_22_normalfallenrogue: @joefiorini @joshholmes can’t do TDD because it’s impossible to follow “Red > Green > Refactor” when his code only goes green.
1 day ago · Reply · View Tweet
Photo_35_normaljoefiorini: @fallenrogue exactly; @joshholmes doesn’t need TDD. His code works the first time.
1 day ago · Reply · View Tweet
3187276048_580e77883b-1_normalcoreyhaines: @joefiorini @fallenrogue @joshholmes code refactors itself
1 day ago · Reply · View Tweet
Mike1981_1__normalViNull: According to NSA regulations, only @joshholmes is allowed to carry @joshholmes code across state lines
1 day ago · Reply · View Tweet
Head_shot_v2_normal brianhprince: @ViNull and chuck norris of course
1 day ago · Reply · View Tweet
Mike1981_1__normal ViNull: @brianhprince I heard Chuck Norris tried to out code @joshholmes once and broke all his fingers
1 day ago · Reply · View Tweet
Photo_35_normaljoefiorini: Lesson learned: no amount of careful can replace testing.
about 13 hours ago · Reply · View Tweet
Photo_22_normalfallenrogue: @joefiorini except for @joshholmes who, btw, wrote a program that’s already counted to infinity… twice.
about 13 hours ago · Reply · View Tweet
Photo_35_normaljoefiorini: @fallenrogue of course that was after he wrote a program to find all possible Marseinne primes. @joshholmes
about 12 hours ago · Reply · View Tweet
Photo_22_normalfallenrogue: You know why you can’t mock HttpContext in .Net? because @joshholmes wrote it and @joshholmes WILL NOT BE MOCKED!!!!
about 12 hours ago · Reply · View Tweet
Chris_roland_normalChrisRoland: @joshholmes Snores in binary and that’s how the internet was born.
about 12 hours ago · Reply · View Tweet
Mike1981_1__normalViNull: I heard @joshholmes beard can optimize and compile 8088 assembly faster than Deep Thought
about 5 hours ago · Reply · View Tweet
 
And after Chris Woodruff got stuck in the median in a snow storm…
 
Head_shot_v2_normalbrianhprince: @cwoodruff being as tall as you are, I figured you just picked up your car ‘hulk style’ and put it back on the road
about 2 hours ago · Reply · View Tweet
Mikewood-headshot_normalmikewo: @brianhprince Come on now, it’s not like @cwoodruff is @joshholmes or Chuck Norris.
about 2 hours ago · Reply · View Tweet

 

Keep those jokes rolling… I might just print these off as my next resume. Or I might start handing out pajamas. 🙂

*Update – a lot more jokes added below – enjoy! *

Marty_normal MartyAdams: @joshholmes can squeeze orange juice from a banana
about 19 hours ago · Reply · View Tweet
Carey_normalcareypayette: A man once asked @joshholmes if his real name is “Jo”. @joshholmes did not respond, he simply stared at him until he exploded.
about 19 hours ago · Reply · View Tweet
Carey_normalcareypayette: @joshholmes threads don’t sleep … they wait!
about 19 hours ago · Reply< /a> · View Tweet
Marty_normalMartyAdams: @crazeegeekchick @careypayette go straight to the Mountain Dew. Enough caffeine to kill a horse! (but not @joshholmes)
about 19 hours ago · Reply · View Tweet
Pblogo_normalPainBank: ‘@joshholmes can code so well he can squeeze a Perl out a Python that looks like a Ruby, yet runs under .Net faster than C++’ C.Norris
about 19 hours ago · Reply · View Tweet
Marty_normalMartyAdams: thought of this this morning while driving in… @joshholmes doesn’t actually write code, he wills applications into existence.
about 4 hours ago · Reply · View Tweet
Mikewood-headshot_normalmikewo: @aaronlerch @joshholmes doesn’t write workarounds. Whatever he codes becomes the best practice.
about 3 hours ago · Reply · View Tweet

Jared Spool re-convinces me that UX Matters

Jared Spool

Jared Spool is one of my heroes. I go hear him speak every time that I get a chance to and have often retold a number of his stories with various clients. One of the first times that I heard him speak was at the Software Development Conference in 2000.

Jared is a usability expert. That does not mean graphic designer. That means that his expertise is understanding the user and building an experience that is relevant and meaningful in the user’s context.

So what is a “User’s Context”? It’s all of the things that make up your user and how they work. What’s their education level (high school, college, doctorate)? How loud is the work environment (are they on a call center floor? are they in an office by themselves?)? How many and how big are the individual tasks that the user has to perform (is it clicking one button or filling in a 1000 question survey)? Are they wearing gloves while working (such as a mechanic)? Are they familiar with the application (such as an internal application) or are they new to the application (such as a publicly facing web site)? What’s the average tenure of an employee? All of these things and more make up the context for the user and dramatically change the needs of the user for a given application.

He talks about the process that his firm goes through where they start with “Users in the Mist”, all props to Dian Fossey. This involves sometimes 2 or more weeks of just observing the users at work in their natural environment. This gives him a good understanding of the users and how they work so that the software that he’s helping create will slide right into the way that they need to work without them having to spend time fighting to the tools. Sometimes, the result is actually not more software. I know that’s shocking but it’s true. One of these stories ended up solving the worker’s issue with plywood and Christmas tree lights. That’s cool.

I have a tremendous amount of respect for those that have graphic artist abilities because I’ve got none. However, you should not confuse that with usability. This point is very clearly demonstrated in his latest article on his blog – UIEtips: The $300 Million Button » UIE Brain Sparks. In this article, he talks about a fairly straight forward ecommerce site that was loosing millions a year and they couldn’t figure out why. They brought in Jared’s team who after a few weeks of usability testing with real users changed the working on the button for a $300 million dollar jump in profits the following year. The button was pretty enough, functional enough and so on but the user’s didn’t understand the ramifications of clicking the button. That’s an issue that they found through extensive usability testing.

Before you spend a lot of time and money building a beautiful skin to your application, make sure that you understand your users and that you’ve built the application in such a way that it works for them rather than them working for the application.

Missed the PDC? Catch the content live at the MDC!

The Professional Developers Conference (PDC) is one of my favorite conferences.  But it is an investment, especially when you factor in the cost of airfare and a week in a downtown LA hotel, in addition to the cost of the conference.  In today’s unstable economy, some people missed out on a lot of cool technical content. 

clip_image00138

But, the MSDN Developer Conference (MDC) is bringing the PDC to you!  The MDC is a day-long conference with three parallel tracks, summarizing the essentials of the PDC, for only $99.  These events will be held in 11 major cities across the US.  Hear all of the exciting announcements around the Azure Services Platform, Windows 7, and Visual Studio 2010 – the session lineup is pretty compelling. 

Windows7_h_rgbAnd of course, there are great giveaways and swag!  The most exciting thing is that all attendees will receive a Windows 7 Beta DVD.  If the Windows 7 Beta is not available at the time of the event, the DVD will be shipped to you when it becomes available.

There are other worthwhile gatherings happening at the MDC:

Community Courtyard: Perhaps you’ve seen the PDC content already, but want a chance to discuss it?  Maybe you have questions or still just don’t get what the excitement around Azure is all about.  The Community Courtyard is an Open-Space-like environment, where attendees can propose topics to discuss and convene their own sessions!  Leaders in the development community as well as Microsoft employees will be hanging around to answer questions and participate in the conversations. 

WomenBuild: This interactive workshop is open to both men and women.  Participants utilize Lego bricks to explore different solutions to the same problem, and celebrate the true meaning of diversity. 

Register today

Date          City

1/13/2009 Chicago, IL

1/13/2009 Minneapolis, MN

1/16/2009 Washington, DC

1/20/2009 New York, NY

1/22/2009 Boston, MA

1/22/2009 Detroit, MI

1/26/2009 Dallas, TX

2/23/2009 San Francisco, CA

And We Might Even Improv…


Here’s the list of ten tools that I covered in my session:


 



  1. CodeRush/Refactor

    1. http://www.devexpress.com/
    2. Mark Miller (http://doitwith.net/)
    3. Dustin Campbell (http://diditwith.net/)

  2. GhostDoc

    1. http://www.roland-weigelt.de/ghostdoc/

  3. cr Documentor

    1. http://www.paraesthesia.com/blog/comments.php?id=701 0 1 0 C

  4. SandCastle

    1. http://www.codeplex.com/Wiki/View.aspx?ProjectName=SHFB
    2. GUI for SandCastle – http://www.codeproject.com/useritems/SandcastleBuilder.asp

  5. Reflector and Add-Ins

    1. http://www.aisto.com/roeder/dotnet/download.aspx?File=Reflectorctor

  6. CopySourceAsHTML

    1. http://www.jtleigh.com/people/colin/blog/archives/2004/10/visual studio a.html

  7. ZoomIt

    1. http://www.sysinternals.com/utilities/zoomit.html

  8. Camtasia/Snagit

    1. http://www.techsmith.com/

  9. Process Explorer

    1. http://www.sysinternals.com/

  10. Snippet Compiler

    1. http://www.sliver.com/dotnet/snippetcompiler/

 


There are a lot of tools that didn’t make the list that really easily could have.


 


 



  1. Tablet UML

    1. http://www.tabletuml.com/ – the UML tool that you don’t need to learn. It was created by Martin Shoemaker out of Hopkins Michigan.

  2. CodeKeep

    1. http://www.codekeep.com/ – online Snippet Library and collaboration. It’s was created by Dave Donaldson out of Columbus Ohio.

  3. CodeSmith

    1. http://www.codesmith.com/ – template based code generation. One of the great uses of this is to generate business objects based on database tables

  4. Too many others to name at the moment…

Download: GrokTalk-10DevToolsIn10Minutes.ppt

.NET Coffee Break Show on IronRuby and Silverlight

I was just on a cool webcast called the .NET Coffee Break Show. I did a short show on getting started with IronRuby and Silverlight.

Because the show is supposed to be just 30 minutes or so, I didn’t get into my usual preaching about the Ruby programming language or why people should use a dynamic language. Instead I just stated the fact that I really like Ruby and I really like Silverlight and I especially like the combination of the two.

To get started with IronRuby, check out the getting started guide with IronRuby by Justin Etheredge.

Now, it’s not absolutely necessary to go through all of those steps to get started with IronRuby in Silverlight. Instead, just download the Silverlight Dynamic Languages SDK. Under the Releases tab, there are a handful of downloads. The one that you want is the one that has “Everything”. This includes the languages, samples, quick start templates and more.

Steps to get started:

1. Unzip the SDLSDK into a directory. I put mine in my public downloads directory for ease of access.

2. Open a command prompt, cd to the sdlsdk directory and run the script:

script\sl ruby demo

This will run the template to generate a starter Silverlight application with IronRuby as it’s language. You could substitute in python or jscript as well.

3. cd to the directory demo and run the script

..\script\server /b

This will run Chiron and then launch a new browser window pointing to the directory. Chiron will first package up the dynamic language files into the XAP and then host a simple web server.

4. Browse to the index.html file. You should see a simple page with “Welcome to Ruby and Silverlight!” displayed in the Silverlight instance.

image

5. Under demo/ruby, open the file app.xaml. Alter it as follows:

<UserControl x:Class=”System.Windows.Controls.UserControl”
    xmlns=”http://schemas.microsoft.com/client/2007″
    xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”>

  <Grid x:Name=”layout_root” Background=”White”>
    <TextBlock x:Name=”message” FontSize=”30″ />
    <Button x:Name=”button_main”
        Height=”30″ Width=”100″
        HorizontalAlignment=”Right”
        VerticalAlignment=”Top”
        Margin=”0,10,10,0″
        Content=”Click”
        />
  </Grid>

</UserControl>

6. open the file app.rb. Alter it as follows:

require “silverlight”

class App < SilverlightApplication
  use_xaml

  def initialize
    message.text = “Welcome to Ruby and Silverlight!”
    button_main.click do |sender, args|
        button_main_click
    end
  end
  def button_main_click
      message.text = “Hello from the click handler”
  end
end

$app = App.new

The “do” in this case is wiring up a .NET delegate as the event handler for click event.

7. refresh the browser (or relaunch via Chiron per step 3 if you closed the browser).

image

There are a lot of other samples that are out there as well. Check out the ones under the sdlsdk/samples directory. Right now there’s a simple clock and a Flickr photoviewer that shows a lot of DOM and JavaScript integration.

You can also find samples at:

http://silverline.schementi.com/

If you want to play with IronRuby or IronPython you can get started playing in the DLRConsole found at http://silverlight.net/samples/sl2/dlrconsole/index.html. All the source for that is under the SDLSDK samples as well.

I’ll update the post once they put up the recording – .NET Coffee Break Show

Speaking at VSLive! Dallas 2008

One of the things that I’ve missed during my tenure here at Microsoft is speaking at some of the independent national conferences such as VSLive. But if you look through the speaker’s list at VSLive Dallas you’ll find a fellow named Josh Holmes… Woot!

I’ve actually got 4 talks and I’m sitting in on the ALT.NET panel on Tuesday night.

Definitely come out and see us – Register online or call 800-280-6218 using Priority Code SPHOL and receive $300 off the package of your choice.

DW10IronRuby and Silverlight, Like Peanut Butter and Chocolate
Josh Holmes
Wednesday, December 10 – 1:45 p.m.
As the DLR (Dynamic Language Runtime) and IronRuby become more polished, it’s time to start applying those technologies in new and interesting ways. One of my favorites is in a Rich Internet Application with a Silverlight front end. A perfect joining of two great technologies – IronRuby brings the dynamic abilities to your code that XAML gives your UI. From animations to logic to simple HTML DOM manipulation – it’s all possible and a lot of fun. In this session, we will cover the basics of the DLR, a touch of Ruby and play with it all in the context of Silverlight.

DW16User Experience for Architects: No Longer Optional
Josh Holmes
Wednesday, December 10 – 3:15 p.m.
The user experience is a core part of new applications and those with the best user experience will prevail. When I say user experience, most people think of the graphics and the front end. This, however, is just the lipstick on the application and considered “small d” design. The “big D” Design starts well before the UI layer and can have profound implications on your application architecture. Is it a SaaS application? Or is that one of many front ends? How does that impact your services strategy? How does the information flow impact your database structure? These and hundred more questions are all ways that the user experience decisions can affect the architecture.
In this session, we will cover a primer on user experience for the architect and discuss the various ways that it will affect your application architecture.

DTH6Mashups from the Ground Up
Josh Holmes
Thursday, December 11 – 9:45 a.m.
When building a Mashup, there are a lot of choices that come into play. Most people they with choosing the UI technologies that are going to be used, but they are wrong. They should be thinking about the information that is going to be used and how to get to that data. Mashups are about exposing new and interesting looks at data so the first thing that you have to do is figure out how to get to that data. Only after that do you start looking at the various front end technologies from AJAX to Silverlight to any number of other Rich Internet Platforms.
In this session, we will compare and contrast building out SOAP services verses REST services with ASMX, WCF and ADO.NET Data Services. We will demonstrate consuming those various services with AJAX, Live Maps, Silverlight and many more front end technologies.

DTH10Best and Worst Practices for Building Silverlight Applications
Josh Holmes
Thursday, December 11 – 1:45 p.m.
Silverlight, as it’s relatively new to much of the community, is putting people through some bumps and bruises as they create amazing experiences for their users. There are a lot of best and worst practices that are starting to emerge as the platform matures and more and more applications are being written. How and where to keep the state management? What networking stacks make the most sense? When does it make sense to use Silverlight or any Rich Internet Application (RIA) platform?
In this session, we will give a cursory overview of what it takes to build a RIA and dive deep into the best and worst practices with Silverlight.

VSLive! Dallas 2008

Microsoft BizSpark

It’s an exciting time here at Microsoft. Last week we announced Microsoft BizSpark!

Microsoft BizSpark is a global program designed to accelerate the success of early stage Startups. Microsoft has realized that most startups have more time than money. This means that in an attempt to save some cash up front, many will pursue free technology paths rather than spending the money on a more complete solution. The issue is that even though they have more money than time, if they don’t get to revenue quickly, they will fail. To help out here, Microsoft has taken cost off the table as an issue for the startups adopting any of the Microsoft technologies in their products and offerings.

I’ll get to the details of the software offering in a moment. But first I want to point out that this is not just cheap software. There are three key areas that Microsoft has identified where it can help startups. Startups need, in addition to the technology, support and marketing. This is accomplished in a couple of different ways. BizSpark Startups receive professional support from Microsoft as well as community-driven support from Network Partners, active organizations in the entrepreneurial space, who can provide guidance, mentorship and resources to Startups.

By virtue of their participation in BizSpark, Startups can also gain visibility with potential investors, partners and customers.

BizSpark provides software, support and visibility to high-potential Startups:

Software

  • All the software included in the Visual Studio Team System Team Suite (VSTS) with MSDN Premium subscription Expression Studio (Version 2), plus VSTS Team Foundation Server Standard Edition – for the entire development team
  • Production license use rights, to deploy, host and support Startup’s “software as a service” applications for delivery over the Internet, using the following products: Windows Server (all versions), SQL Server (all versions), BizTalk Server, and Office SharePoint Server for hosting; and Systems Center for managing hosting server operations.

Support

  • Guidance, resources and mentoring provided by Network Partners, active members of the global software ecosystem who are qualified to provide support and advice to Startups
  • Access to MSDN Premium: managed newsgroups, online library, online concierge, etc.
  • Two technical support Incidents per Startup

Visibility

  • Each BizSpark Startup will have the opportunity to profile their company in the BizSparkDB, an online Startup directory, hosted on the Microsoft Startup Zone web site. Startups will get exposure to potential investors, partners and customers around the world.
  • Opportunity to be highlighted on the BizSparkDB as a featured company and be promoted as BizSpark Company of the Week on the Microsoft Startup Zone website.

Costs – on exit of the program (read three years after you sign up), the participants will be invoiced a $100.00 fee. This means that there are no up front costs for the startups.

Who’s Eligible?

An eligible Startup must have the following characteristics at the time of joining:

  • Actively engaged in development of a software-based product or service that will form a core piece of its current or intended business. This means that the startup must be producing software or services as the means to them getting paid. Either selling or leasing the software and/or service.
  • Privately held.
  • In business for less than 3 years.
  • Less than US $1 million in annual revenue. This varies slightly by country but here in the US it’s $1 Million.

To be eligible for Production License rights, Startups must also be developing a “software as a service” solution (on any platform) to be delivered over the Internet.

Examples:

Does Quality:

  • An Independent Software Vendor (ISV) that is producing software for sale.
  • Producing a service such as a claims processing services that you lease to other companies so that they can outsources their claims management.
  • A combination application that sits on the clients machine and calls services that you have produced with any form of monitization be it leasing or for sale to third parties.

Does Not Qualify:

  • If you are developing an internal claims processing system solely for your own company.
  • Developing a web site for your company as your marketing presence.
  • Are a pure consulting agency with no products.

To break it down, if you are getting paid through the software and/or service that you are producing then you probably quality.

If you think you are qualified and are interested in signing up – Anand Iyer has a great walk-through that explains how to sign up at http://tr.im/joinbizspark

Network Partners

Our Network Partners consist of University Incubators, Government Agencies, Entrepreneur Organizations (incubators, business angels,…) and Investors themselves depending on the volume of startups that they deal with. These Network Partners are able to offer a lot of services to the startups than Microsoft ever could because they are in the trenches and offer a lot of different services.

Depending on the network partner, some of the services could include office space, access to funding sources, introductions to potential clients, legal advice, business plan mentoring and tons of other support.

If you are interested in joining BizSpark, you can do so easily by contacting one of our network partners. Or you can contact me and I’ll get you in touch with a local network partner that can help you out.

If you are interested in being a Network Partner, sign up online or reach out to me.

techtown-logo

One of my first Network Partners, who actually offers almost all of the services listed above, is TechTown. TechTown, Detroit’s research and technology park, was established in 2000 when Wayne State University, General Motors and the Henry Ford Health System convened to create an engine of economic growth with both local and statewide impact. TechTown stimulates job growth and small-business creation by developing companies in emerging high-technology industries including advanced engineering, life sciences and alternative energy.

TechTown is a 501(c)(3) non-profit organization and is the Woodward Technology Corridor SmartZone.

In the years since its inception, TechTown has developed into an epicenter of high-tech business creation by equipping new companies with the services, support and resources they need to grow and thrive. The 12-block park is poised to become a critical source of job growth in Michigan.

Highlights:

  • TechOne, the 100,000-square-foot business incubator facility, now hosts 40 growing companies.
  • More than 30 high-tech startups have enrolled in TechTown’s business accelerator programs.
  • NextEnergy, an alternative energy incubator founded to encourage the commercialization of emerging energy technologies, opened its $12 million research facility in TechTown.
  • Asterand, a biomaterials bank and TechTown’s first tenant, has become an international, publicly traded company on the London Stock Exchange.

TechTown Detroit

SRT Solutions 

Microsoft BizSpark