February 2010 - Posts

I've corrected only the Silverlight aspects, because that's what I know. People with significant knowledge of Flash are welcome to contribute corrections and updates.

Silverlight Flash My analysis
Silverlight is missing Linux support, so people using Linux machine cannot run it on their machines and will have to stick to Windows and MAC OS. This limitation doesn’t exist with Flash. Microsoft is deliberately ignoring all six Linux users.
Silverlight will (naturally) be using the WMV and Silverlight will add to the use of the WMV file format. Using the WMV video format essentially makes Silverlight useless for the vast majority of video websites such as YouTube. It cannot play .avi and .mov file.
Flash Video turned Flash into a mechanism for delivering media with far more potential than any other solution that is .flv, no doubt Flash has also limitation to play other video file. For that Flash required codex for that player installed on Client machine. Oh no, you can’t use it to clone YouTube. The world is ending.
Silverlight has no support for binding to models, binding to data, or even connecting to network resources to obtain data. Even flash is also lacking this area. Flash can read data source in terms of XML or text from some URL and can use it. Same thing silverlight also can read. My how things have changed, and how quickly. Silverlight has extensive and well thought out support for binding to data, using entity models and connecting to network resources.
Silverlight doesn't even have support for things that should be considered a stock part of any library such as buttons, checkboxes, list boxes, list views, grids, etc. Probably in future release may Microsoft support it. Flash has rich set of control library. Silverlight has out of the box support for all of the mentioned items, plus elaborate support for both stylesheet (cosmetic and behavioural) and template (structural) customisation as well as roll-your-own.
Once the accessibility features are provided with Silverlight versions, any existing test tools that support driving UI through Accessibility will be fully enabled to automate Silverlight applications
Flash test tools are already in place. While I am unsure what “accessibility” means, it is certain that Visual Studio provides extensive test automation for Silverlight.
Silverlight 1.0 does not support GIF-file format. Even it doesn’t support BMP and other file format. It supports only JPG and PNG file format. Flash support all image formats. Silverlight 4 supports more formats than you can poke a stick at.
Can’t do sound processing. With some media file sound processing can possible. Extensive support.
Socket programming is not possible. Flash allows creating XML Socket object. Socket programming directly out of the client is a security risk and shouldn’t be done. Use a web service to have the server do this sort of thing, incidentally also stepping around firewalls and other environmental hazards.
Per pixel bitmap editing, bitmap filters (convolution, color matrix, etc), bitmap effects (drop shadow, blur, glow) cannot be done. Can do that. Oh no, I won’t be able to write crappy games like the Flash boys. But wait - I can with SL3! But I won’t.
Webcam and Microphone support it not there. Flash supports it. SL4 has both.
Built in file upload/download support is not available. Inbuilt Upload/download support is there. Inbuilt Upload/download support is there.
The performance of Silverlight and Flash will be nearly the same. While Silverlight is using XAML as description language in a non-compressed format size of Silverlight component is large.In practical implementation of similar component in Flash and Silverlight it has found that size of Silverlight component is approximately 10-20 times larger than Flash component.
Size of flash component is smaller.
  Silverlight outruns Flash by a country mile because it uses jitted MSIL instead of script for behaviours and hardware acceleration when rendering. XAML lends itself extremely well to dictionary compression as provided by XAP files which are ZIP files renamed. Compressed like this Silverlight controls are consistently smaller in transit, and in memory they exist as a DOM not textual XAML.
To deploy Silverlight to client browser more than one components ship. (1) XAML files (2) .dll if using C# (3) Silverlight.js (4) Custom JavaScript file. Images/videos/sounds also required deploy separately.
Flash ships in single component that is .swf. Images/video/sounds also incorporated in single .swf package.
  XAP files. See above comment.
It has found in practical implementation of image animation, at some extent flickering occurs on image.
To avoid this type of flickering in flash, refresh layout or cache bitmap functionalities are available.
  XAML uses hardware acceleration unless the computer is prehistoric.
It has found in practical implementation of video play, audio may start playing before showing movie on screen. It has also found video can still continue to play after redirecting to other page. It may be it is bug of current beta release. Flash doesn’t face these types of issues. Was bug of ancient beta release.
Right now not any support to play Silverlight object as Windows application. Flash can be played as Windows application also by downloading player for it. Flash can be also packaged as .exe which can be deploying standalone. It’s called OOB or Out of Browser. Flash gets pretty lardy if you do this, but Silverlight doesn’t.
Silverlight is new in market and required time to get acceptance in market. Flash is exist from many years and have strong acceptance in market. Silverlight is being rolled out by an operating system vendor with 99% market share. Game over.
Silverlight supports the WPF animation model, which is not only time based instead of frame based, but lets you define the start and end conditions and it will figure out how to get there for you. No need to deal with matrixes like in flash. Also no need to calculate positions on various frames. It just works.
 
The animation model is frame based.

Silverlight uses XAML. XAML is text based and can be output using a simple XML object.
Flash stores its shapes using binary shape records. In order to write shape definitions, you will need to either license a 3rd party Flash file format SDK, or build your own. It isn’t too difficult, but it does require a bit of a learning curve. Yep.
Simple to debug. Difficult to debug. And the gap is widening.
Easy font handling. Complex difficult font handling.  
Use any .NET language including third party offerings. Use Actionscript whether you like it or not.  
High-res high bandwidth video streaming supported by colossal global infrastructure at no charge with opportunities to monetize via MSN video ads. Build it yourself, pay for it yourself. If you succeed, Flash boy, watch your one pitiful server get slashdotted and melt down.
Expanding support for mobile computing. Limited and stagnant support for mobile computing.  
Scalable video from HD to mobile. Fixed resolution video. I’m told later versions of Flash do support scalable video.
Major codecs built in. Codecs separately installed. Trojans, trojans, get ‘em while they’re hot!
Built-in presentation of SEO No SEO support.  
Declarative and imperative. Imperative only.  
Hardware-assisted editing and encoding solutions. No support.  
End-to-end server and application platform. Client only.  
Posted by peterw | 3 comment(s)

If you put a web service in the host web for your Silverlight application and discover it then when you create the reference the URI is obtained from the debug web server. You can configure this with the ServiceReferences.ClientConfig file but you have to do so prior to building the XAP file.

To change things after the fact, you can rename the XAP to ZIP, extract the ServiceReference.ClientConfig file, edit it, update the ZIP file and rename it back to XAP. Tedious but possible with tools intrinsic to Windows.

Another option is to rewrite the binding address after you instantiate the service client. Here’s a sample from one of my XAML code-behind files.

   17     SPClient _spClient = new SPClient();

   18 

   19     public Search()

   20     {

   21       InitializeComponent();

   22       this.Title = ApplicationStrings.HomePageTitle;

   23       string baseUri = HtmlPage.Document.DocumentUri.AbsoluteUri;

   24       string relativeUri = _spClient.Endpoint.Address.Uri.ToString();

   25       int i = relativeUri.IndexOf('/') + 2;

   26       i = relativeUri.IndexOf('/', i);

   27       relativeUri = relativeUri.Substring(i);

   28       i = baseUri.LastIndexOf("#");

   29       baseUri = baseUri.Substring(0, i);

   30       baseUri.Substring(0, baseUri.LastIndexOf("/"));

   31       _spClient.Endpoint.Address =

   32         new EndpointAddress(baseUri + relativeUri);

   33       _spClient.FindCompleted +=

   34         new EventHandler<FindCompletedEventArgs>(_spClient_FindCompleted);

   35     }

 

This code exploits the habit Silverlight applications have of putting a # between the end of the application base URI and the name of the XAML page; the last slash before the hash marks the end of the base URI.

None of this is remotely difficult. What I want to know is why the generated service client doesn’t detect service URIs that begin with “http://localhost:” and perform this simple fix-up automatically.

Posted by peterw | with no comments

The world is not waiting on EF directly handling spatial data types. You don’t need them.

Just use Lat and Lng columns typed as float, and set up a trigger so that whenever the Lat column is updated the trigger updates the Geography column.

Most data sinks use separate latitude and longitude values, so you have to handle them like this anyway. The trigger keeps the geography column in synch so stored procedures can use spatial indexes.

Sure you can’t use a spatial index directly in a Linq expression, but you couldn’t anyway because that would entail L2E carting all the rows to the client. To avoid this we always end up writing stored procedures and using a web service to call them, and this is where you munge coordinates into the right form for spatial indexing.

So, the absence of spatial types from EF is not now and never has been a problem.

If the EF team wants to do something useful they could figure out the Linq to Entities Guid join problem. For those fortunate enough not to have encountered this bug, L2E doesn’t like comparing Guids with parameters. It can’t figure out how to compare Guid with object, because object uses reference comparison but Guid uses value comparison.

The generated proxy in Silverlight works properly, probably because by the time the data reaches the Silverlight client you’re probably actually using Linq to Objects, which doesn’t manifest the problem.

In my opinion this is a much higher priority. Guids are very frequently used as primary keys, and therefore also as foreign keys. Guid comparison is extremely common, and L2E is completely broken in this very common scenario.

Posted by peterw | with no comments