Wednesday, 27 May 2009

Twitter spam=FAIL (UPDATE Customer Service=WIN)

Update Nov-09: It's been a few months since I 'let off steam' with the post below. It sounds a bit over-the-top reading it now. Anyway, as you can see in the comments I was recently contact by the company directly and I couldn't be more impressed with how they handled my 'complaint'. That sort of honesty in customer service deserves another look. The remainder of the post reads 'as it was'.

In the normal course of tweeting today, I happened to post
Argh - moving an ASP.NET app that requires Crystal Reports for VS 2003... oh the humanity
Nothing special about that - I often complain about stuff on Twitter... but mostly programming and stuff, not specific products or companies (see When Word of Mouth Got a Permalink) so I was unprepared for what happened next...

W.T.F.!? Okay so Twitter is totally open and there are all sorts of search-bots BUT give-me-a-break with the crappy marketing line and unattended twitter account.

Phew now I feel better :-)

Thursday, 14 May 2009

Microsoft Translator Widget

The Microsoft Translator Widget has been popping up on various sites recently - and now some of mine... in Spanish in Japanese

It's difficult to tell how useful this will be - unless Google can 'discover' this content is available in other languages it will be difficult to attract foreign-language traffic to Translator-enabled sites. It's all client-side/script-driven, so Google isn't going to get any translated content under normal spidering conditions. Those who land on the content organically may find it helpful I suppose...
I wonder if Live Search does anything special for Translator sites?

Tuesday, 12 May 2009

Draw on Silverlight Virtual Earth Map Control

There are a couple of different projects where I'd like to enable 'drawing' on a map (including - this is a basic first-cut of drawing within the Microsoft VE Map Control.

Each click on the map will start/continue a line. The MouseLeave event is wired to start a 'new' line. Navigating the map (dragging/double-click zoom) also causes points to be drawn - obviously this needs some work...

The two files required to build it are Page.xaml and Page.xaml.cs, the key pieces of code being
private void VEMap_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
Map m = (Map)sender;
Location l = m.ViewportPointToLocation(e.GetPosition(m));
if (polyline == null)
private void CreateNewPolyline(Location startPoint)
polyline = new MapPolyline();
polyline.Stroke = new SolidColorBrush(Colors.Red);
polyline.StrokeThickness = 2;
var lc = new LocationCollection();
polyline.Locations = lc;
Simple, eh?

p.s. these are plain old straight lines - at the 'continent' level you might expect them to curve as though on a great-circle; I'm not too worried about implementing that right now since the target usage of my drawing is at a much "smaller scale"... however Geoquery2008 does draw great circle lines correctly...

Saturday, 9 May 2009

Silverlight DataContractJsonSerializer Error

Admittedly there is very little excuse for hand-crafting Json output these days, with libraries like Json.NET available, and WCF supporting Json natively. However, I was tweaking an existing ASPX page (that was actually rendering Xaml for a Silverlight 1.0 application) to turn it into a 'service' for Silverlight 2.0... and it seemed like the fastest way to do that was simply replace a whole pile of <s and >s with {}

I got some hints/reminders on how to Consume a JSON object in Silverlight, and found Jsonlint really helpful in tuning the output until it was valid Json.

Then I created a 'matching' object model in Silverlight C#

and wired up the OpenReadCompleted event using DataContractJsonSerializer

Everything LOOKED like it should work, so at first I was confused by this error message:
Unable to cast object of type 'System.Collections.Generic.List`1[System.Object]' to type 'System.Collections.Generic.Dictionary`2[System.String,System.Object]'

After staring blankly at the code for a while, I finally realised where my Json had gone wrong -- at the very root of my Json response (see Jsonlint image above) I was "accidentally" wrapping the entire Json output with an unnecessary [] pair. I guess this meant the Deserializer was expecting to cast into a collection (albeit with a single element), but I was intending the root Json element to be a single object (to match my C# JsonCourse).

The simple fix was removing the enclosing [] so that my Json started off like this instead:
"width": 800 ,
"height": 600 ,
"runners": [
"name": "mapcanberramarathon",
"points": [
Lesson for tonight is to better understand the underlying Json representation before consuming it (or else use a library rather than hand-craft the output). Anyway now it is fixed 2.0 is that much closer to fruition...

Saturday, 2 May 2009

Silverlight "Maps That Bend Upwards"

I was inspired today by HERE & THERE's horizonless projection of Manhattan (via The Map Room: Maps that Bend Upwards).

Using Silverlight 3.0 beta and it's new PlaneProjection feature, I have hooked up three Silverlight Map Controls with different values for RotationX, GlobalOffsetY (vertical displacement) and GlobalOffsetZ (in/out of the page) to create a very crude 'interactive' version of their horizonless-map.

If you have Silverlight 3.0 beta installed, you can try out the Silverlight Virtual Earth Maps That Bend Upwards OR if you don't have the beta installed, you can watch a screencast.

[try it] [watch it]

I've noticed a little bit of weird behaviour on loading (sometimes the 'initial' map of New York doesn't load completely sync'd in all three panels), but after that it seems to work OK - it's just for fun after all.