Even a chimp can write code

Tuesday, June 05, 2007

Google Gears and Silverlight

Last week Google announced an early beta of Gears, a "browser extension that enables web applications to provide offline functionality using following JavaScript APIs:

  • Store and serve application resources locally
  • Store data locally in a fully-searchable relational database
  • Run asynchronous Javascript to improve application responsiveness"

I figured that meant it was an automatic fit within a Silverlight application. So, as a proof of concept I decided to tweak the Simple Database Demo and integrate Silverlight content into it. The results are here for you to see.

Thanks to how Google and Microsoft architected their respective products, that was 5 minutes of effort at most. You can choose your browsers View Source option on that example and see how script interacts with the Gears APIs and tweaks XAML in Silverlight.

If you play with Gears and Silverlight some more and create something cool, drop me a comment.



Update 1: Danny Thorpe talks about his founding work on Gears whilst at Google.

Update 2: Fixed broken link to SilverGears sample.

Update 3: Fixed links again. Due to some issues with the hosting service for the "SilverGears" sample, I've moved it to a new host. I really appreciate Mike and Chris for hosting it on simplegeek.com thus far.

Update 4 (May 02, 2009): Those of you searching for information on local persistence store in Silverlight may want to see this post which also looks at offline/out-of-browser support.

Labels: ,

Email this | Bookmark this

21 Comments:

  • Hi,

    Could you compare the use of Gears for storage with the exisiting Isolated Storage?

    Thanks,
    Martin

    By Anonymous Anonymous, at June 6, 2007 at 1:28 AM  

  • Martin, simply put, the Silverlight isolated storage provides the analogous of straight file I/O. You can squirrel away data and retrieve it later. Gears does the same thing conceptually but it provides a backing database (SQLLite) as persistence store and the benefits of a query language like SQL for data retrieval, filtering and transformation.

    When used for straight data persistence and retrieval in Silverlight, I doubt one is more beneficial or efficient than the other.

    By Blogger Ashish Shetty, at June 6, 2007 at 12:30 PM  

  • From your comment, it sounds like the 1-Up Gears has over SilverLight (for the above app) are the benefits of SQL-Lite. What about when LINQ is fully integrated into SilverLight's (or SL's) runtime? (not sure when that'll happen or if it's already there) Then wouldn't the playing field be leveled? If so, then I'd have to assume SilverLight may be better (after SL-1.1 and VS'07 are both out of Beta) because of the quoted 300 to 1,000 times faster speed SL has over JavaScript (i.e Google's JavaScripted Gears).

    One other question: I'll probably sound like such a nube asking this; do you see AJAX technology going to the wayside once SL is fully launched? I'd imagine for debugging/customization/CLR/optimization benefits that people would make similar AJAX controls in SilverLight for distribution? Am I the only one thinking this???

    By Blogger Miguel_TX, at June 16, 2007 at 12:51 AM  

  • @miguel_tx: Ajax is portable. Silverlight is not. Before SL can replace Ajax, it has to a) get stable (the API isn't frozen yet) b) work on Windows (it does), Macs (it does) and *nix (it does not).

    Mono (with http://www.mono-project.com/Moonlight ) is on it's way for porting SL API to *nixes, but they are in no way supported by MS - so they will lag each time the API changes.

    By Blogger skolima, at June 17, 2007 at 5:33 AM  

  • http://www.simplegeek.com/mharsh/SilverGears/default.html appears to be brokwn

    By Anonymous Anonymous, at June 22, 2007 at 3:43 AM  

  • Link... Broken...

    Need... Link...!

    By Anonymous Anonymous, at June 24, 2007 at 3:29 AM  

  • @skolima: Thank you for your well explained response to my AJAX question. I was hoping SL would be the silver bullet to pierce all platforms with the "write once, run everywhere" ability we all desire. Luckily for me *nix is not a requirement as my company writes apps for clients that all use Win or Mac. Still, I can imagine a future-client out there with *nix fanboys who have pushed *nix and OpenOffice to all their employees. It is, after all, the cheaper alternative (despite my personal belief that average non-tech users wouldn't be as productive as they are on Win/Mac machines).

    About my first Question: If (say a year from now after VS007 and SL 1.1 are released) I write a web app using ADO.NET datasets and LINQ to query them on the client using SL, would it then be an alternative (probably faster) to the Google Gears "simple database demo" mentioned in this article?

    By Blogger Miguel_TX, at June 24, 2007 at 12:43 PM  

  • I have seen two Macs during my whole IT education (5 university years). And about half of people I know runs Linux as their primary desktop, so I guess it all depends on where you live.

    As per SL portability, it seems that I have greatly underestimated the Mono team. A large part of SL API is now alive and kicking in the Moonlight project - status updates are posted by Miguel de Icaza on his blog (http://tirania.org/blog/). And all this progress was made in less than a month, I'm not sure whether I should awe the productivity or pity the workaholism ;-)

    By Blogger skolima, at June 25, 2007 at 1:39 PM  

  • The proof of concept:

    http://www.simplegeek.com/SilverGears/default.html

    ...will not load?

    Can you look into it?

    By Blogger Chuck Boyce, at August 15, 2007 at 7:10 AM  

  • google gears not even getting installed on my pc ...haha lovely !

    By Blogger Aditya Thatte, at August 17, 2007 at 3:30 PM  

  • The demo does not work on FireFox (although it works on IE6). It displays 1, 2, 3 on a blue background, but not the entered words.

    By Blogger Razvan Socol, at August 17, 2007 at 11:23 PM  

  • Is it possible for Google Gears to provide database access and offline execution to Silverlight apps written in languages other than JavaScript (e.g. C#, VB.Net)?

    By Anonymous Anonymous, at August 29, 2007 at 1:49 PM  

  • Ashish,

    Great blog, really. I just linked your SilverGears proof-of-concept from my recent post about data processing with Silverlight. You might be interested to check out the post. It would be very interesting if you considered updating your SilverGears sample to supplement Silverlight's missing SaveFileDialog. (You could simply let the user download their latest list.)

    Jeff Powers

    By Blogger jeff, at September 30, 2007 at 11:19 PM  

  • doesn't work on Firefox?

    By Blogger Joshua, at October 8, 2007 at 4:18 PM  

  • link not working. Tried in IE and FF.
    Thanks
    http://www.nerddawg.members.winisp.net/SilverGears/

    By Anonymous Anonymous, at May 8, 2008 at 3:01 PM  

  • Nice article. Check out my article below which outlines how we can use LINQ and Isolated storage to provide local database storage for Silverlight.

    Silverlight Local database

    By Anonymous Anonymous, at August 6, 2008 at 9:38 AM  

  • We have developed a tool named as Desklighter that can convert a Silverlight application into a standalone desktop application. See more details at http://blendables.com/labs/Desklighter/Default.aspx

    Download some samples from http://ctlabs.blogspot.com/2008/09/desklighter-carry-light-along.html

    By Blogger Sameer C. Thiruthikad, at September 1, 2008 at 6:01 AM  

  • Thanks for putting this together, I've been investigating Gears and Silverlight today and this exactly answered a question I had.

    But. Didn't work in Chrome (OK it's very new so I'll give you a pass there). Bombed in FF3 (killed the app). Worked in IE7.

    By Blogger Justin Collum, at September 2, 2008 at 4:13 PM  

  • Can somebody upload an example solution?

    By Blogger Unknown, at August 20, 2009 at 5:55 PM  

  • If you want to work with a native Silverlight database you can use siaqodb ( http://siaqodb.com ). It store objects directly on client machine; objects are retrieved back using LINQ in optimized way

    By Blogger Unknown, at February 10, 2010 at 3:04 PM  

  • I'm coming across your blog more and more as I do more work with silverlight and something that always strikes me is that even a chimp would realise that your top banner is using a ridiculous amount screen real estate

    By Anonymous Anonymous, at August 11, 2010 at 7:55 AM  

Post a Comment | Home | Inference: my personal blog