ButtercupReader – A Silverlight Digital Talking Book Reader

Marge: "You know, I've never met your wife." Fat Tony: "Sadly, my Anna-Maria was whacked by natural causes." Marge: "Oohh, you're a widower." Fat Tony: "I bring flowers to her grave every Sunday" Marge: "Ooooh, flowers every week! I wish I was dead."For the second Mix in a row Intergen is launching a cool new Silverlight application: ButtercupReader!

ButtercupReader is a free Silverlight 2.0 application for viewing and playing digital talking books (DAISY) on the web by blind and partially sighted users.

As well as using Silverlight to render text and play DAISY document audio, ButtercupReader also showcases many of Silverlight’s accessibility features including screen reader support, shortcut keys, different contrast settings and zoomability. Andrew Tokeley, a member of the ButtercupReader team, has a great blog post on those features here.

I only worked briefly on this project, spiking out functionality at the beginning. It is great to see how it has all come together.

The legendary esquilax, a horse with the head of a rabbit and the body of a rabbit!

kick it on DotNetKicks.com

Sunday Podcasts

Ahoy hoy? Hanselminutes - Mo Interviews Scott Hanselman

One of my highlights of TechEd NZ 2008 was meeting Scott Hanselman. Chatting about random techie things in the speakers room and working side by side to prepare our presentations was a lot of fun. Here Mo, Scott’s wife, interviews him about what it is like being The HanselMan.

Econtalk - Wales on Wikipedia

Wikipedia is a fantastic example of harnessing the cloud to collaboratively create something amazing. Jimmy Wales talks about what has made Wikipedia successful, dealing with conflict and how Wikipedia is a self managing entity.

Dungeons & Dragons PodcastPenny Arcade Episode 1

The Penny Arcade guys are always funny and listening to them play D&D is hilarious. The first of episode of many.

Thoughts on improving JsonSerializer. IMappingResolver?

Carl: "According to the map, the cabin should be right here." Lenny: "Hey, maybe there is no cabin. Maybe it's one of them metaphorical things." Carl: "Oh yeah, yeah... Like maybe the cabin is the place inside each of us, created by our goodwill and teamwork." Lenny: "Oh! ... Nah, they said there would be sandwiches." JsonSerializer is pretty darn flexible. It has a half dozen options on the class to customize how an object is serialized, attributes for more fine grained control and finally JsonConverters if you need to do something completely different.

The most popular request I get these days is control over how JsonSerializer determines what members on a type to serialize (e.g. serialize private as well as public properties) and control over the name of the written property (e.g. instead of “FirstName” write the property camelcase style: “firstName”).

Controlling this behaviour is actually already possible by inheriting from JsonSerializer and overriding GetMemberMappings. The MemberMapping class contains all the information about how a .NET member gets mapped to a JSON property (name, readable, writable, converter, etc) and is used internally by JsonSerializer. The problem is it isn’t terribly discoverable to the average user.

IMappingResolver

What I am thinking of doing is adding is an IMappingResolver interface.

public interface IMappingResolver
{
  JsonMemberMappingCollection ResolveMappings(Type type);
}

JsonSerializer would have a MappingResolver property and the instance of the object assigned to it would determine how the members on a .NET class get mapped to a JSON object (if you’re hip with the GOF urban street lingo this is an example of the strategy pattern).

Examples of resolvers that could come with Json.NET or you could create yourself: CamelCaseMappingResolver, TypeDescriptorMappingResolver, PrivateMembersMappingResolver and so on.

I like this over inheritance because it is obvious and in a user’s face. MappingResolver could also be added to the JsonSerializerSettings class and used from the serialization helper methods on JsonConvert.

Yay or nay? Suggestions welcome [:)]