Tim Murphy's .NET Software Architecture Blog

December 2011 Entries

New WP7 App: Little League Coach

My first Windows Phone app, Little League Coach, has just been released into the marketplace.  If you have ever helped coach a team where every player bats every inning this app should help keep your sanity.  It is a simple application to allow little league coaches to manage the lineup for a game as well as keep track of batter rotation.  As a bonus it tracks pitches and outs during an inning.  Here are a few screen shots from the application.


Ways To Pass Time On Window Phone – TouchDevelop

A co-worker was showing me an in phone scripting environment on the iPhone and I knew I had seen one mentioned for the Windows Phone before.  TouchDevelop is an app from Microsoft Research that allows you to create small applications that do a wide variety of operations including using most of the capabilities of the device.  So could this be a fun way for us geeks to waste some time while waiting for our oil to be change or a table to open up at your favorite restaurant?

So what does this language look like?  The structure for TouchDevelop applications is broken into three sections: actions, data and events. 

Actions are essentially procedures and can be run independently from the user interface as long as they are not marked private.  One action can also execute another action using the “code” section of “expressions” UI.

Variables that are defined in the Data section.  They are global to the application and are persistent by default.  The variable types include not only basic structures like strings, but also more complex system constructs like JSON, playlist and camera objects.  This isn’t where all of your variables reside as many variables are automatically generated when you create assignment expressions.

The events that can be handled are somewhat limited but are appropriate for the phone.  As with some of the specialized data types the events are based around the different sensors and services of the phone.

Now the syntax is a little strange compared to most of the languages that I have used in the past.  It is very plain English which can throw you when you are used to more terse programming languages.  You have to get used to the concept of a “wall” instead of console which uses syntax like the example below.

var1->post to wall

You also aren’t going to get a WYSIWYG experience with the TouchDevelop environment.  You will have to create your own visual controls through code.  It reminds me of righting for the Win16 API in C++, only with less built in UI abilities.  If you get to this point then you probably want to start by copying an application that already has methods to generate buttons, text boxes and other controls.

Just to give you a flavor of the environment there are a number of screenshots below.

Screen Capture-1Screen Capture-2Screen Capture-3Screen Capture-4Screen Capture-5

In the end it is a bit of a mind bending challenge to learn to develop with TouchDevelop, but getting out of your comfort zone is always a good thing.  Enjoy.

Using JSON.NET To Load Twitter Search Results In WP7

The main way that Twitter provides feeds is through JSON.  Unfortunately the version of the .NET Framework that is on the phone does not include the System.Runtime.Serialization.Json namespace.  Rather than trying to brute force the JSON feed I have been looking into using the Newtonsoft JSON.NET library.

The first thing that I ran into with JSON.NET is that the documentation is severely tilted to the serialization side with almost no mention of deserialization.  This would have been my preferred approach considering work I have done with WCF.  In a future posts I intend to explore deserialization in JSON.NET.  Given my time constraints though I ended up using the JSON to LINQ feature of JSON.NET.

Once I headed down this new road I found that even the LINQ features did not work the way I would have expected them to.  I would have thought that when the library parsed the JSON feed it would be able to drill down like a normal object graph.  In the end I used the base JSON to LINQ ability to get a named set and then loop through it using the SelectToken method to pull individual values.

Let’s take a look at an example.  The first thing you need to do is open a WebClient object and assign a method to handle the DownloadStringAsync event and call the DownloadStringAsync method.

WebClient client = new WebClient();

client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);

client.DownloadStringAsync(new Uri("http://search.twitter.com/search.json?q=" + searchString));

Now comes the real work.  You will see that a JObject is used to parse the feed returned from Twitter.  After that you are able to get the “results” array by name.  I was concerned with getting the text and user image so while looping through the results I access the profile_image_url and text fields of each and record the values.

JObject searchResult = JObject.Parse(e.Result);
var results = searchResult["results"];


foreach (var tweet in results)
this.Items.Add(new TweetViewModel(tweet.SelectToken("profile_image_url").Value<string>(),tweet.SelectToken("text").Value<string>()));

Once I have this List of TweetViewModel items I can bind it to a templated ListBox to render it to the user.  In all this was a very simple piece of code that took a lot of trail and error because of poor documentation.  As I dig deeper into this library I will do my best to augment the official documentation.

Chicago Windows Phone Accelerator Lab Recap

This week I spent three day with close to 30 of my new best friends doing lots of Windows Phone coding and helping each other with our application.  The sessions were lead by Jeff Blankenburg and Dave Bost who and kept the atmosphere light.  This included us finding out a lot about Dave’s tastes in music.

While most of the time was spent working on our individual apps we saw how an app is submitted to the market place and what you can prep your app for the market place using the Marketplace Test Kit.  It was surprising how much of the process of is represented by this tool either in automated form or as scripts you can follow.

Another thing that we came out of the sessions with was a number of links to resources that are gems for both developers new to the platform or those wanting to branch out into new features.  Below are links to a couple of these resources.

We finished up the labs by going around the room and discussing what we had been working on and revelations from our work.  We also got to see a trio of interesting demos from our classmates.  In all it was a rejuvenating as well as an enlightening experience.  If one of these sessions comes to your area be sure to sign up.

2011 Year In Review

2011 has been an amazing year in which I ended up working on an exciting number of projects.  SharePoint has continued to be the hottest requested technology that I deal with.  At the same time Windows Phone 7 has put Microsoft back in the mobile market and I will be finishing off the year additionally writing for this platform.  At the same time the old standards of WinForms and ASP.NET have not left our market space.  Ultimately, the IT market is still on fire and I am looking forward to great things next year.

On another front, it was a great year for the Chicago Information Technology Architects Group that saw presentations on Functional Programming, Onion Architecture, SOLID, Scalable Internet Solutions, ORM Frameworks, Mobile Architecture, and Enterprise Architecture.  Our numbers have grown which has made the discussions in our meetings much more interesting.  I am looking forward to even more growth and more exciting topics in our third year.

PSC Group also continues to grow as I have now passed two years with this terrific group of IT Professionals.  I have been spending a fair amount of time interviewing perspective employees and helping to get new business opportunities started.  It really makes me glad to be part of this organization with amazing projects filled with top notch people.

In all, 2012 is looking like it is going to be very exciting.  The biggest challenge, as with all previous years, will be keeping up.  Here is hoping all of you have a great new year.

2012 Chicago IT Architects Group Call For Speakers

We are almost at the start of the new year.  The group is currently on our December break from presentations but we are looking to return full steam in January. The Chicago Information Technology Architects Group is community driven and as such we are looking for speakers and topics to keep our community thriving.  If you have a topic that you would like to present or know someone who has a topic that they love to talk about in the IT Architecture space please contact me through this blog.