Client-side database with Silverlight?

I’ve seen some discussion threads about doing things like putting VistaDb (a 100% managed code database) into a Silverlight app. Most of this was wishful thinking, IMHO. If you are going to put a database into a Silverlight app, obviously the data file(s) need to go in IsolatedStorage. So that’s one hurdle – handling file access. And VistaDb is kind of on the large side for inclusion in a Silverlight app that’s designed to download into the browser.

I took a look at SharpHsql, which a much simpler managed – code database effort that has had its ups and downs since being ported from the JAVA implementation.  I tried ripping out the Provider (which depends on System.Data – not present in Silverlight Framework) and thought I was making progress, but then I saw that there were still too many other dependencies on stuff from the full Framework that just isn’t there in Silverlight, so I gave up for now.

However, I still think this is an idea that has merit. Think of a notetaking app that you could run locally off Cassini or IIS, that used a database to store your stuff on the client. You could even LINQ-ify it. Then, you could sync your stuff through a WCF service to a central SQL Server database running on a website somewhere.

One thing SharpHSQL has in it is some very good routines for parsing textual SQL – that could be used to save a lot of time on writing a new one that’s more Silverlight – friendly.

I think it’s got some real potential – after all, you have up to 1MB of IsolatedStorage to work with. Just thought I’d throw it out as an idea.  Ah, well – maybe my Tweeter is just over capacity with too many Twits. Who knows? We could always go back to these:



Tips for Silverlight Developers / Tutorials

Friends may come and go, but enemies accumulate. – Thomas Jones

I’ve downloaded some very simple “one page” zipped or rar-ed Silverlight demos that were 1MB and larger. If you remove all the .dll and .pdb files from such a solution, you save about 2.5 MB before you compress it. If you use tools like Resharper, and you remove all the Resharper – related files, you’ll save even more.  Remember, not everybody uses Resharper!

The last one I downloaded was a one -pager Silverlight .rar that weighed in at nearly 1 MB. It also had the Resharper files in it. After I did the above cleanups and re-rared it, it was only 43Kb! D00ds! Almost 1 MB vs only 43K after cleanup!

When you load and build one of these  “cleaned up” demo or tutorial solutions like this, all of the assemblies and pdb files will be regenerated perfectly. You do not need to distribute all this baggage with your demo!

Computers run on electricity. And electricity comes from coal, oil, or gas (and sometimes the hot air from Congress).  Save the bandwidth and the planet!  You may not believe in global warming, but you know what? They say you become a conservative once you have something to conserve.

On a related note, lots of cool people have been "ittifying" their url links to Silverlight Resources at my "playground" site, IttyUrl.net. This is a "Social Short Urls" kind of hybrid site that I originally developed for my own use and then realized it would be better to make it public. There are some new features I've added:

1) All new "Ittified" urls are also posted to the Twitter account here.

2) On the right pane, there are two new links, "Silverlight Latest Posts" and "Silverlight Forum Posts" which bring up popup JQuery-powered scrolling windows featuring last 12 hours blog post search on "Silverlight" and the Active Forum posts from the Silverlight.net forum respectively.


Silverlight 2 Beta 2 Installation Issues

The "bottom line" (you can read all the gory details after this):

1) I DO NOT recommend installing Visual Studio 2008 SP1 Beta and / or .NET Framework 3.5 SP1. There are simply too many issues and fragile fixes. Just wait until all this stuff gets fixed and save yourself a lot of headaches and lost time.

2) I DO recommend installing Silverlight 2 Beta 2, the Tools, the documentation, and Blend June 2008 Preview. Just be very careful about the ServiceProxy assembly issue mentioned at the end of this post, as it seems to be able to occur whether or not you choose to try the Service Pack route.

Well, 2 out of 3 ain’t so bad! I got SL2B2, the Visual Studio Tools and Blend June Preview on 2 out of 3 PCs and everything is working beautifully. On the third PC (the one at the office, which of course had to wait until Monday June 9, unless you stayed very late Friday night) however, I ran into the below issue:

Method 'SelectSilverlightProject' in type 'Microsoft.VisuaStudio.Silverlight.SLPackage' from assembly 'Microsoft.VisualStudio.Silverlight, Version=, Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a' does not have an implementation.




Brad B of MS has a very detailed post on his Blog on this issue and how to fix it here. Basically, it revolves around needing to UNINSTALL KB949325 before installing VS SP1, or if it exists without the SP1 install. Yes, apparently the newest Silverlight bits DO WORK with Visual Studio 2008 SP1 Beta installed. But what if you cannot find KB949325 in the “View Installed Updates”?  You can search the Registry first for “KB949325” to confirm that it is indeed not “removed” even though you do not see it in the Programs and Features Control Panel “View Installed Updates” under your version of Visual Studio 2008.

The fix for this is simple and logical: Download a copy of Silverlight_Chainer.EXE for BETA 1. Using either 7Zip or WinRar, open the archive and extract the .msp installer, “VS90-KB949325.msp”, and double-click to install it. This “repair job” will give you back your missing entry in “View Installed Updates” and you can immediately proceed to uninstall it (Don’t you just love those “4 seconds remaining” messages that hang around for 30 minutes?)

At this point you can follow Bradleys detailed instructions on the above link and all will be well! (That is, if you’re lucky; I wasn’t.)

NOTE: If you are going to install Visual Studio 2008 SP1 Beta, make sure you UNINSTALL Hotfix KB944899 first. Otherwise, you are going to spend a lot of time waiting only to see a failure message at the very, VERY end!

Incidentally, Heath Stewart, who specializes in this kind of stuff, has an excellent post on how to download all of VS2008 SP1 Beta and have it on your hard drive. If you are going to use Heath's method, you need to download and rename the .NET 3.5 SP installer executable and store it where the original was as he describes.

And for those who are more ambitious, Aaron Stebner has his Cleanup Tool and lots of instructions on "fixes".

All in all, I still had issues after all these fixes, and removed Service Pack 1 Beta and the NET. Framework 3.5 Service Pack. I need mostly to work with Silverlight 2 Beta 2, and so all this other great “stuff” will just have to wait.

The final issue I found was the “object reference not set to an instance” issue when attempting to add a WCF Service Reference. Tim Anderson covers this very nicely, if you experience it. Basically, if you’ve got the previous version of the ServiceProxy assembly, the installer doesn’t replace it. If your installation size of the Tools is 1.14 MB instead of 1.17 or more, then you probably got this glitch; I certainly did.

So at the end of the day (or week, or however long it takes to check out and fix any or all of these little glitches) is Silverlight 2 Beta 2 worth the trouble?  I think so. You can build real business applications with this, and you can put them on your commercial web site. It' seems to be remarkably stable. That’s cool.

As far as the VS2008 Service Pack and the .NET Framework 3.5 Service Pack betas, unfortunately I have to recommend you keep your powder dry until you see the final releases of these. As a general rule, I don't have a problem installing and experimenting with BETAs, but if I have to jump through hoops just to get one installed and working, then I do have a problem.


Silverlight 2 Beta 2 Downloads

NOTE: Since this post has been a "work in progress", updated links are found starting at the nota bene number 2. You want "Silverlight_Chainer.exe".

Jeesh! I don’t know why they seem to make this stuff so hard to find. Here they are, more later ( go to the bottom for more recent links, including the "chainer")

 Silverlight 2 Beta 2 Download (4.66 MB)

Silverlight 2 Beta 2 Documentation (50.3 MB)

Have fun!


At this point I haven’t been able to locate links for the Silverlight 2 Beta 2 Visual Studio Tools, or the June Preview of Expression Blend.  You would think what with Tech Ed and all that Microsoft would be scrambling to get these links up on the Silverlight.net site, but – hey, that’s progress, huh?

if you happen to be reading this and you find the Tools or other links before I do and update this post, leave a comment with the hyperlink  so we can do a service to the .NET Developer community.

N.B. – The latest from MS at the Silverlight.net forums is that they are still testing and having some issues to solve with client deployment, and so they’re recommending to wait until everything is ready. If you install Beta 2 alone, it’s just going to break your Beta 1 apps and you will be spending a day or two accomplishing nothing, so…  Personally, I think this is really crappy timing. You guys knew there would be these big announcements about this stuff at Tech-Ed, and you really should have started your client deployment testing and fixed any glitches well before that. Either that, or just don’t make the announcments and  avoid getting people all hopped up over nothing. Just my 2 cents…

N.B. The SDK is now live as of 9:15 PM Friday June 6. (Link was intermittent at the time).

The Blend June Preview link also is working (for me).

And the Tools Link just worked for me (keep refreshing the page!) That's Silverlight_chainer, which has everything combined.

Yah, I'm complete. Had to wait till 9:30 PM EDT.


In case you are interested, here's what's inside Silverlight_Chainer.EXE:



Silverlight_Chainer.exe installs everything you need except the CHM documentation and the Expression Blend June preview.

Issues:  You may find an issue that SL 2 BETA 1 apps will not build or load. and  for New Apps:

"Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)"

This is how I fixed the above issue, in case it happens to you:  It appears that there were a bunch of orphaned Registry entries left from previous installations. So I uninstalled Silverlight, the Tools, and the SDK (everything installed by Silverlight_Chainer.exe). Then, I removed all Registry entries with the word "Silverlight" in them, rebooted, and reinstalled Silverlight_Chainer. Now everything is fine. I use a proggie called Registry Crawler that lets you search the Registry, brings up all the matches, and all you need to do is CTRL-A to select them all and hit the DEL key.

You will find that most applications built with BETA 1 will fail, usually because of minor changes in control property names and so on. If you have an HTML "Launch" page that uses javascript, you'll need to change the "-b1" to "-b2" in the "type" attribute in order for it to work, otherwise all you'll get is an "Install Silverlight" image:

var objscript = '<object id="silverlight">data="data:application/x-silverlight," type="application/x-silverlight-2-b2" <-- this needs to be "b2"

Breaking Changes List

The list of breaking changes from B1 to B2 can be found in the Documentation CHM. Any updates to the list can be found at this link.


The Cow Problem … is Us

Yesterday, the Senate began what is expected to be a week-long, contentious debate over legislation to combat global warming by mandatory reductions in carbon dioxide and other greenhouse gases. You can read up on my post re the World Bank’s experiments with carbon credit trading to see how this is likely to pan out.

President Bush said that the measure amounted to "a huge spending bill fueled by tax increases" and that it "would impose roughly $6 trillion in new costs on the American economy."

It isn’t just that the alarmists are trumpeting climate model results that we know must be wrong. It is that they are predicting catastrophes that couldn’t happen even if the models were right, in order to justify costly policies to try to prevent global warming. The average person conflates alarmism with science – the Senate and House of Representatives being no exception. The results can be tremendously misguided and dangerous legislation.

Meanwhile, a U.N. FAO report states that cows (livestock) produce 18 percent of total greenhouse gas emissions – more than every car, truck and bus on earth! Yikes, we don’t need Cap and Trade / Carbon Credit legislation! We just need to quit drinking MILK!

I have an idea. How about if we start by installing special filters over the House and Senate to suck up and dispose of  all the noxious hot air and other damaging gases emitted by our elected representatives? That would at least be a start.

The bottom line is that our elected representatives and the Presidential candidates – all of them  -- haven’t got a clue as to how to effectively solve our energy and pollution problems. They are not showing true leadership, not a single one of them.

What we really need to do:

1) Get off our addiction to foreign oil by producing ethanol efficiently – from either switchgrass or sugar cane (as Brazil does).

2) End the costly corn subsidies to companies like Archer Daniels Midland. According to the Cato Institute, a libertarian think tank, "ADM has cost the American economy billions of dollars since 1980 and has indirectly cost Americans tens of billions of dollars in higher prices and higher taxes over that same period. At least 43 percent of ADM's annual profits are from products heavily subsidized or protected by the American government. Moreover, every $1 of profits earned by ADM's corn sweetener operation costs consumers $10, and every $1 of profits earned by its ethanol operation costs taxpayers $30."

3) Drill for oil wherever we can find it, now. Even though we are already on the downside of “peak oil” – which experts say was around 1985, we can still help the problem by exploring for and finding our own oil.

4) Ramp up alternative energy production  -- That means solar, wind energy, hydrogen, nuclear and other technological advances. The same morons who are screaming about how we are polluting ourselves into the next Jurassic Age are the ones who are saying we can’t drill for oil or bring on any new nuclear power plants. What a bunch of fyookin’ hypocrites! This is just one of those problems where you cannot have your cake and eat it too.


Where is Silverlight going? (or-- Why Silverlight will succeed)

Cows (livestock) produce 18 percent of total greenhouse gas emissions, more than all the cars and trucks on earth. -- U.N. report

I've been watching the buzz around Silverlight 2 Beta 1 since it came out, and there's a new beta that will be out this week (yes, I was the guy that asked Scott Guthrie when it would be released at the MVP Summit conference).  If you look at my "Playground" short url site with a Silverlight tag query, IttyUrl.net, you'll see hundreds of new Silverlight - related links, as developers and pundits post their creations, articles, and streaming videos to show what they've learned and to share their techniques.

The underlying Silverlight technologies (XAML/WPF/WCF and .NET) are encouraging client-side Windows developers to think beyond boring forms apps and get into the promising world of vector graphics with 3D, streaming HD media and "animated everything". Microsoft is simply extending existing proven technology to  encourage developers to use the power of the client-side to ensure that "Windows" apps continue to make web-apps look boring.  There's even a Maya plugin to export a Maya rendering as XAML -- which you can use in Silverlight!

The Silverlight .NET runtime enables developers to provide cutting edge multimedia user experience in the browser. I am seeing that a  lot of Air, Flex and Flash pundits don't fully understand that Silverlight is not a Flash substitute. .NET developers can use the exact same development assets, paradigms and tools they know and love -- .NET objects, Controls, Visual Studio, WCF, WebServices and more.

If you stop to think about it, Silverlight and its OOP .NET foundation are the perfect platform to web-enable Microsoft Office and similar apps - you have IsolatedStorage for client -side  OOP persistence, and all is built - in to a security - protected execution sandbox.

Silverlight is now getting positioned as the new web-based .NET application platform. It will soon be on Nokia phones, Linux workstations and OSX. The MONO people are putting it on Linux ("Moonlight"), with Microsoft's blessing.  Even the iPhone could run Silverlight, since it runs the full Safari browser. And now, I've just read that Silverlight will be shipped with millions of HP computers. But -- that's just the beginning;  it is clear to me that Microsoft has determined  Silverlight is the new direction, and they will not stop.

With Silverlight now coming out on Nokia phones, delivered as part of the Olympics coverage, and embedded throughout MS properties and content,  with new deals materializing everywhere, Microsoft is starting to gain enormous distribution potential.  Of course, Microsoft would love to package Silverlight with the Internet Explorer 8.0 install experience - if they can get past the legal hurdles. And that would be, well -- huge.

I believe that Silverlight is a critical and consummate technological strategy from the Redmond Mother-Ship. It allows them to leverage proven tools and technologies from the client, set the accepted minimum standards higher on web-based experiences, deploy client-side apps through the browser, and broaden the MS platform reach into every device and screen comprising a user’s experience on the web.

You can read a lot of pundits claiming "Why Silverlight will fail", etc. Typically they will say that you don’t really understand the rival technology but have already decided that you'll be using Silverlight because it’s from Microsoft. They will extoll all the server-side technologies you can do with Flex, Adobe LiveCycle, J2EE, etc. But they forget that Silverlight runs a subset of the .NET Framework ON THE CLIENT - in the browser, and that it supports dynamic languages. They will say things like, "Open your eyes, MS fanboys".

The anti-Microsoft "Why SIlverlight will fail" fanboys are just that - their better judgement has been completely obfuscated by their fanatic, fallacious belief that if something comes from Microsoft, it has to be "bad". Boy, are they going to be proven wrong. And - it won't take very long, either.


My 2 cents.