Friday 31 July 2009

Seadragon - Deep Zoom on Demand

Microsoft LiveLabs just announced the release of Seadragon.com, an Azure-based service that creates hosted DeepZoom images 'on demand', making it super-easy to share very-high-resolution images with a quick link.

I tried it out with a few images from my Flickr account (they only take a minute or two to 'process')... click the links to play with Seadragon, click the images just to see a larger copy

Sydney skyline 9774 x 2154 (21 megapixels)



Seattle suburbs from the Space Needle 11991 x 2186 (26 megapixels)



Here's a few more to try for yourself:

Sydney at night 2048 x 768 (1.6 megapixels)

Pike Place Farmers Market 5273 x 2309 (12 megapixels)

Space Needle and Mt Rainier 6388 x 2366 (15 megapixels)

Seattle waterfront from the Space Needle 8861 x 2062 (18 megapixels)

Pike Place close-up 11323 x 3026 (34 megapixels)

As LiveLabs mentions on their website - an easy way to add hi-res images to your eBay listing, real-estate website, ecommerce store, blog, etc...

Saturday 11 July 2009

SQL in Silverlight

It never ceases to amaze me how short my attention span has become...

what was I saying :) ?

Aaanyway, I sat down in front of my PC today planning to accomplish a few different things... but before that I had to catch up on blogs and twitter. A tweet caught my eye
migueldeicaza IDEA: SOmeone to do a line-by-line port of Sqlite to C# to run inside Silverlight

"Great idea" I thought... but seemed like quite a big job and certainly not something I have the time to tackle. Then I started to recall seeing a C# port of an SQL engine (ages ago) and thought it might be fun to have a poke around. At least it would be easier to port something already in .NET land.

A couple of Google results later, I came across Sharp HSql, a circa 2001 port of the Java-based hsqldb (licence). The code was subsequently added to Codeplex with the following warning: This version is not ready for production grade applications. More testing is needed and some important bugs has to be fixed before that. You are warned.
Long story short...
it's a couple of hours later and I've done nothing that I'd planned to, but here is an 'alpha' of SharpHSql for Silverlight (try it out) - there's some test SQL at the bottom of the post.


The "port" mainly consisted of:
  • 'implementing' ArrayList and Hashtable (umm, can you say List<object> and Dictionary<object, object>)
  • removing the 'Provider' and all the dependencies on System.Data that work fine in the full framework, but are missing from Silverlight (would be nice to add some sort of wrapper back in...)
  • converting FileInfo and related operations to IsolatedStorageFileStream (still some persistence testing to do...)
  • breaking DateTime handling (for now)
The REAL work was all done by Mark Tutt so don't get the idea that I'm taking any credit - all the goodness is his, any errors are mine.

The full source of the consuming Silverlight app is this Page.xaml and Page.xaml.cs; the full Visual Studio 2008 project ZIP (199Kb) is available to download. Anywhere I've touched the code you'll find a //HACK: tag!

Disclaimer: I've no idea if this is fit for any purpose at all... it seems to be able to DROP and CREATE tables, INSERT rows and SELECT/JOIN - but even that could be a fluke. Try it out at your own risk; leave a comment if you find something good or bad. Have fun!

UPDATE: the output is a lot prettier (try it) with the Silverlight DataGrid and Vladimir Bodurov's awesome dynamic datasource compiler - updated for generic types

(updated source (277Kb))

Test SQL

#1
DROP TABLE IF EXIST "books";CREATE TABLE "books" ("id" INT NOT NULL PRIMARY KEY, "name" char, "author" char, "qty" int, "value" numeric);

INSERT INTO "books" VALUES (1, 'Book000', 'Amy', 1, 23.5);
INSERT INTO "books" VALUES (2, 'Book001', 'Andy', 2, 43.9);
INSERT INTO "books" VALUES (3, 'Book002', 'Andy', 3, 37.25);
INSERT INTO "books" VALUES (4, 'Book 21', 'Amy', 99, 20.5);
INSERT INTO "books" VALUES (5, 'Book 22', 'Andy', 2, 903.9);
INSERT INTO "books" VALUES (6, 'Book 23', 'Andy', 5, 0.25);

SELECT * FROM "books" ORDER BY "value"

DROP TABLE IF EXIST "author";CREATE TABLE "author" ("name" char NOT NULL PRIMARY KEY, "country" char);

INSERT INTO "Author" VALUES ('Andy', 'UK');
INSERT INTO "Author" VALUES ('Amy', 'USA');

SELECT * FROM "author" ORDER BY "value"

SELECT * FROM "books" LEFT JOIN "author" ON "author"."name" = "books"."name"
#2
CREATE TABLE "clients" ("id" int NOT NULL IDENTITY PRIMARY KEY, "DoubleValue" double, "nombre" char, "photo" varbinary, "created" date );
INSERT INTO "clients" ("DoubleValue", "nombre", "photo", "created") VALUES (1.1, 'NOMBRE')
SELECT * FROM "clients"

Friday 10 July 2009

Silverlight 3.0 - can't upgrade Runtime without DevTools?

Silverlight 3.0 has been RTW (Released To Web), so I rushed straight to Silverlight.net to install it. Because I'm a Silverlight developer, I already have Silverlight 2.0 and the Silverlight 2.0 Tools for Visual Studio installed (of course).

Silverlight.net immediately notices I'm "out of date" and suggests I install the latest version.


After the quick 4Mb download, the installation seems to be going well...


...until... oops, I can't upgrade the Runtime in browser if the Visual Studio developer tools are out-of-date (ie. for 2.0)??


I'll just click 'more information' to read more - oh wait, 404


At the moment it seems like you'll have to install the full Silverlight 3.0 Developer Tools just to view Silverlight 3.0 content (if you were previously developing for Silverlight 2.0).

Only problem is, Silverlight 3 Release Notes says
Silverlight 2 projects cannot be created with the Silverlight 3 Tools for Visual Studio 2008. To create Silveright 2 projects, uninstall the Silverlight 3 runtime and the Silverlight 3 Tools from Add or Remove Programs and re-install the Silverlight 2 Tools for Visual Studio 2008.
I'm not sure I want to force all my users to upgrade to Silverlight 3.0 right now - I don't wany my website to be the one that forces a 4Mb download until I really need it (ie. I start using 3.0 features). So... to keep developing on 2.0 (for now), I can't even view Silverlight 3.0 content?

Please - tell me I'm wrong and that I've missed something?

UPDATE: Thankfully, in a VirtualPC set aside for SL3.0, the tools happily uninstalled previous versions and enabled me to open, recompile and deploy my 3.0 beta stuff...

Here are some beta samples updated for RTW