Category Archives: silverlight

BBC iPlayer supporting H.264 in Flash – what’s the point of downloading now?

The BBC’s streamed catch-up broadcasting, iPlayer, is about to be upgraded to the high-definition H.264 standard, according to this post, from the BBC’s Head of Digital Media Anthony Rose.

He says that the “Play high quality” option will be available “from this week”, though I couldn’t see any sign of it on a brief sampling of available content.

The question: where does this leave the download service, based on peer-to-peer file sharing? This is the thing that caused me considerable hassle this time last year, and which also drew criticism because it is Windows-only.

By contrast, the Flash-based embedded video seems to have performed as smoothly as Flash usually does.

When Flash streaming was introduced, the BBC said that the download option would remain for higher-quality viewing, but with H.264 Flash that argument has little force. It is still comforting to have a downloaded file, in case your Net connection fails or becomes congested, but other than that there is little advantage. My guess is that it will wither. Supporting both must be expensive.

It is unfortunate for Microsoft, whose technology is losing out to Adobe’s at the BBC, particularly since Silverlight would probably have worked nicely in this context. Unfortunately the old iPlayer is not Silverlight, but based on Windows Media Player, known to be hassle-prone as well as being single platform.

Technorati tags: , , , ,

Installing Visual Studio 2008 SP1

First, the patch removal tool, now officially called the “Visual Studio 2008 Service Pack Preparation Tool”.

Wait ages. Useless progress bar stuck at 50%. Wait some more.

Help – it’s asking for the Visual Studio DVD. Hey, at least it proves it is doing something. But where is it? Scrabble round office, eventually find .iso instead and mount it.

Wait ages. We are now over an hour into this install, and haven’t got past the preparation tool yet. Still useless progress bar stuck at 50%.

It’s done at last. Next, mount and run the SP1 iso:

http://www.microsoft.com/downloads/details.aspx?FamilyId=27673C47-B3B5-4C67-BD99-84E525B5CE61&displaylang=en

Wait again. This is when you need multiple computers in order to get on with your work.

Now Windows Update pops up to request a restart. I’m not sure if this is coincidence, or something triggered by the install. It doesn’t seem a good plan to restart when the SP1 installer is still chugging away, so I refuse.

Wait.

Done. Now the installer requests the inevitable Windows restart.

Still need to reinstall Silverlight beta 2:

http://www.microsoft.com/downloads/details.aspx?FamilyId=50A9EC01-267B-4521-B7D7-C0DBA8866434&displaylang=en

That one wasn’t too bad in comparison.

Overall: took longer than I’d like, but it worked.

Microsoft Silverlight: 10 reasons to love it, 10 reasons to hate it

A year or so a go I wrote a post called Adobe AIR: 10 reasons to love it, 10 reasons to hate it. Here’s the same kind of list for Microsoft’s Silverlight, based on the forthcoming Silverlight 2.0 rather than the current version. The items are not in any kind of order; they also reflect my interest in application development rather than design. It is not a definitive list, so there are many more points you could make – by all means comment – and it will be interesting to have another look a year from now when the real thing has been out for a while.

This Silverlight developer chart is available in full on Brad Abrams’ blog here, or in Joe Stegman’s Deep Zoom version here.

The pros…

1. The Silverlight plug-in means developers can target a single, consistent runtime for browser-based applications, rather than dealing with the complexity of multiple browsers in different versions. You also get video and multimedia effects that are hard or impossible with pure HTML and JavaScript; though Adobe’s Flash has the same advantages.

2. Execute .NET code without deploying the .NET runtime. Of course, the Silverlight plug-in does include a cut-down .NET runtime, but instead of dealing with a large download and the complexities of the Windows installer, the user has a small download of about 4MB, all handled within the browser. In my experience so far, installation is smooth and easy.

3. Performance is promising. Silverlight comes out well in this prime number calculator, thanks no doubt to JIT compilation to native code, though it may not compare so well for rendering graphics.

4. Support for Mono (Moonlight) means there will be an official open source implementation of Silverlight, mitigating the proprietary aspect.

5. Silverlight interprets XAML directly, whereas Adobe’s XML GUI language, MXML, gets converted to SWF at compile time. In fact, XAML pages are included as resources in the compiled .XAP binary used for deploying Silverlight applications. A .XAP file is just a ZIP with a different extension. This also means that search engines can potentially index text within a Silverlight application, just as they can with Flash.

6. Third-party component vendors are already well on with Silverlight add-ons. For example, Infragistics, ComponentOne and DevExpress.

7. Take your .NET code cross-platform. With Macs popping up everywhere, the ability to migrate VB or C# code to a cross-platform, browser-based Silverlight client will be increasingly useful. Clearly this only applies to existing .NET developers: I guess this is the main market for Silverlight, but it is a large one. The same applies to the next point:

8. Uses Visual Studio. Microsoft’s IDE is a mature and well-liked development environment; and since it is also the tool for ASP.NET, you can use it for server-side code as well as for the Silverlight client. For those who don’t get on with Visual Studio, the Silverlight SDK also supports command-line compilation.

9. Choose your language. Support for multiple languages has been part of .NET since its beginning, and having the .NET runtime in Silverlight 2.0 means you can code your client-side logic in C#, Visual Basic, or thanks to the DLR (Dynamic Language Runtime) Iron Ruby or Iron Python.

10. Isolated storage gives Silverlight applications local file access, but only in a protected location specific to the application, providing a relatively secure way to get this benefit.

The cons…

1. If Apple won’t even allow Flash on the iPhone, what chance is there for Silverlight?

2. Silverlight is late to the game. Flash is mature, well trusted and ubiquitous; Silverlight only comes out of beta in the Autumn (we hope) in the version we care about – the one that includes the .NET runtime – and will still lack support on mobile devices, even Windows Mobile, though this is promised at some unspecified later date.

3. The design tools are Expression Blend and Expression Design – but who uses them? The design world uses Adobe PhotoShop.

4. While having solution compatibility between Expression Blend and Visual Studio sounds good, it’s actually a hassle having to use two separate tools, especially when there are niggling incompatibilities, as in the current beta.

5. No support for the popular H.264 video codec. Instead hi-def video for Silverlight must be in VC-1, which is less common.

6. It’s another effort to promote proprietary technology rather than open standards.

7. Yes Linux will be supported via Moonlight, but when? It seems likely that the Linux implementation will always lag behind the Windows and Mac releases.

8. Silverlight supports SOAP web services, or REST provided you don’t use PUT or DELETE, but doesn’t have an optimized binary protocol like Adobe’s AMF (ActionScript Message Format), which likely means slower performance in some scenarios.

9. Silverlight is a browser-only solution, whereas Flash can be deployed for the desktop using AIR (Adobe Integrated Runtime). Having said that, yes I have seen this.

10. You have to develop on Windows. This is particularly a problem for the Expression design tools, since designers have a disproportionately high number of Macs.

JavaFX – just for Java guys?

JavaFX is Sun’s answer to Flash and Silverlight, and it’s partially open source under the GPL. I’ve just downloaded the bundle of NetBeans plus JavaFX SDK. JavaFX Script is a new language for creating rich multimedia effects. I’ve also downloaded “Project Nile”, which includes “a set of Adobe PhotoShop and Adobe Illustrator plug-ins that allow graphics assets to be easily exported to JavaFX applications”. Unlike Microsoft, Sun is choosing to work with the designer’s existing favourite tools rather than trying to wrench them away to a brand new set (Expression).

According to Sun JavaFX is happening quickly: it is promising “Version 1.0 of JavaFX desktop runtime by the fall of 2008”.

The bit that makes me sceptical, aside from the speed of events, is that if I’m reading the following diagram right, users will require both the Java Runtime Environment (could be Java ME) and the JavaFX runtime in order to enjoy the results:

By contrast, Microsoft’s Silverlight does not require the full .NET runtime to be present, making it a much smaller download; and Flash has always been small.

The win for JavaFX is access to all the services of Java:

…JavaFX applications can leverage the power of Java by easily including any Java library within a JavaFX application to add advanced capabilities. This way application developers leverage their investments in Java.

On the other hand, it means a more complex and heavyweight install for users who do not have the right version of Java itself already installed. The Windows JRE is currently around 15MB for the offline version – there’s a 7MB “online” version but my guess is that it downloads more stuff during the install. I suspect that Adobe’s Flash would never have taken off if it had been that large a download.

When I spoke to Sun’s Rich Green earlier this year I recall that he agreed that a small download was important. Maybe I have this wrong, or a smaller runtime is planned for some future date.

It’s interesting that in his official blog post today, Josh Marinacci takes a Java-centric view:

So why am I excited about JavaFX? Because it gives us the freedom to create beautiful and responsive interfaces like never before. This isn’t to say you can’t do it in plain Java. If you’ve been to any of the last 4 JavaOne’s then you’ve seen great interfaces we’ve built. But these demos were a ton of work.

Right; but you could easily build these “beautiful and responsive interfaces” in Flash, both then and now. It’s a question of positioning. Is JavaFX just a new GUI library for Java – which will be welcome, but limited in appeal to the Java crowd? Or a serious alternative to Flash? At the moment, it looks more like the former.

Technorati tags: , , ,

WCF Sessions with Silverlight and Flex

I wanted to adapt my Silverlight CRUD sample (which I also ported to Adobe Flex) to fix a glaring weakness, which is that any user can amend any entry.

I decided to add some logic that allows editing or deleting of only those rows created during the current session. The idea is that a user can amend the entry just made, but not touch any of the others.

WCF has its own session management but this is not supported by the BasicHttpBinding which is required by Silverlight.

Fortunately you can use ASP.NET sessions instead. This means setting your WCF web service for ASP.NET compatibility:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

Then you can write code using the HttpContext.Current.Session object.

This depends on cookies being enabled on the client. In my simple case it worked fine, in both Silverlight and Flex. In a real app you would probably want to use HTTPS.

I’d post the sample but unfortunately my Windows web space doesn’t support WCF.

Technorati tags: , , ,

Testing a web service with IIS 7 on Vista

Not long ago I created a simple CRUD example using Silverlight 2.0 beta 2. I used Visual Studio 2008 and the ASP.NET Development Server. I wanted to test the same WCF web service with a different client (more on that soon), so I decided to deploy it to the instance of IIS 7.0 which comes with Windows Vista. I created a new web site on a different port than the default.

Nothing worked. Reason: although I have installed .NET 3.5 SP1 beta and Vista SP1 – which should do this automatically – the IIS 7 mime types and  handler mappings were not configured for Silverlight and WCF. How to fix the mime type is here and the handler mappings, here.

The web service still didn’t work. I got:

A first chance exception of type ‘System.ServiceModel.ProtocolException’ occurred in System.ServiceModel.dll.

I changed the debug options to break on all managed exceptions, and got this further detail:

The remote server returned an unexpected response: (404) Not Found.

Problem: Silverlight is looking for a cross-domain policy file.  The reason was that at this point I was still running the Silverlight app from the ASP.NET Development server, and it considered IIS to be on a separate domain. The 404 error does not make this obvious; but a quick Google for Silverlight 404 shows that this is a common problem.

Silverlight is designed to support cross-domain policy files in either Microsoft’s format (clientaccesspolicy.xml) or Adobe’s format (crossdomain.xml). If the service is just for Silverlight, use Microsoft’s format; otherwise I suggest adding both.

Nearly there; but I still had to fix SQL Server authentication. I normally use Windows authentication, and if you are using the ASP.NET Development server this just works. Move to IIS though, and it does not work unless you set up ASP.NET impersonation, or create a SQL Server login for the account under which the application pool is running. Oddly, when I tried the app without fixing the SQL Server login I still got a 404 exception; I’m not sure why.

Incidentally, I noticed that if you configure ASP.NET impersonation for a web site, the username and password gets written to web.config in plain text (bad). If you configure the application pool to run under a different account, the password is encrypted in applicationHost.config (better). In the end I decided to use good old SQL Server authentication.

One last tip: when debugging a web service, put the following attribute on the class which implements your ServiceContract:

[ServiceBehavior(IncludeExceptionDetailInFaults = true)]

Otherwise you get generic fault messages that don’t help much with debugging. Remove it though for release builds.

Once I’d fixed the SQL server login, everything was fine.

The messy world of the Web 2.0 user interface

Verity Stob’s Web 2.0 app diagram is worth a look.

So is it back to plain old HTML+forms then? That won’t do either; your app will look a decade old, and offline will never work.

This is why the current RIA wars are fascinating – particularly since Apple seems averse to runtimes like Flash, Java or Silverlight on its iPhone.

Which leaves what? JavaScript, hélas.

The RIA dilemma: open vs predictable

There’s recently been a bit of hype (RoughlyDrafted.com) for Charles Jolley’s Sproutcore, yet another JavaScript framework, mainly because Apple is using it as its “Cocoa for the Web”, according to AppleInsider.

I tried the sample controls demo in IE7 but it didn’t work quite right. For example, the Picker pane opened but would not close. Tried again in Firefox 3.0 and everything was fine.

I’ve got no idea what the problem is with IE7; it is probably because of weak standards support in IE. However, it illustrates the advantages of a plug-in like Flash, Silverlight or Java. With these platforms, the application is largely insulated from differences between browsers.

The snag with the proprietary plug-in approach is that the vendor may not support every platform equally. Microsoft is entrusting the bulk of Silverlight Linux support to a third party. There are also issues of control. Apple most likely does not want any runtimes on iPhone because they open up a route to application deployment that bypasses its App Store and 30% revenue share. Google seems wary of Flash; RoughlyDrafted says that is because of the risk of content being turned into “opaque binaries” that are beyond the reach of its contextual advertising analysis, but it may just be  reluctance to cede such an important part of its platform to a third party.

Still, as a developer in search of a predictable app platform I’d rather target a plug-in than trust the browser vendors to be sufficiently consistent, and the Javascript libraries sufficiently smart, to enable my code to run reliably everywhere. It is easier to get away with a requirement for, say, Flash 9, than to insist that users choose a particular browser or operating system.

There are other factors of course. On the Javascript + HTML side, there are advantages in that it extends rather than replaces the HTML model. Things like clipboard support just work. Plus, it runs on iPhone.

On the plug-in side, you get the fast execution of a JIT compiler, and easy use of graphical and multimedia effects that take effort to do in JavaScript, or can’t be done at all.

I would be interested in comments from developers about what RIA platform you are choosing, and why.

Why developers don’t write apps for Vista

From Evans Data we get this statistic (email address required):

Only eight percent of North American software developers are currently writing applications to run on Microsoft’s Vista operating system, while half are still writing programs for XP, according to Evans Data’s Spring 2008, North American Development Survey. These same developers forecast a fragmented Windows market in 2009 with only 24 percent expecting to target Vista and 29% expecting to continue with XP.

Matt Asay picks this up, saying that 92 percent of developers are ignoring Vista.

Sorry, this is silly. Sane Windows developers are writing apps that work on both XP and Vista. Writing an app that only works on Vista is equally as short-sighted as writing an app that only works on XP. Even WPF apps work on XP. So what are these 8% of Vista-only developers doing? Targeting DirectX 10?

Or did they get a somewhat ambiguous questionnaire and were collectively inconsistent over which boxes they ticked?

I agree that Vista has some problems, but this is not a useful analysis.

Two more interesting questions would be:

1. What proportion of developers are starting new projects that are cross-platform rather than Windows-only?

2. What proportion of developers are starting new projects that run from the Internet with zero desktop install, or maybe just a plug-in dependency?

There is a reason why Microsoft is fighting to establish Silverlight, and why Flex and Flash are suddenly so interesting to developers.

Technorati tags: , , , , ,