Category Archives: .net

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: , , ,

FluorineFx and Weborb bring fast web services to .NET and Flex

Adobe’s Andrew Shorten contacted me following my piece on consuming .NET SOAP with Flex.

He mentioned two free products which integrate Flex with .NET.

Fluorine “provides an implementation of Flex/Flash Remoting, Flex Data Services and real-time messaging functionality for the .NET framework.”

WebORB from Midnight Coders “supports Action Message Format (AMF) version 0 and 3 and can be used to process Flex and Flash Remoting requests. Additionally, WebORB provides an implementation of the RTMP protocol and supports the following real-time messaging and streaming features: Flash Video streaming, video recording, data push, server-to-client invocation and remote shared objects.” There are also implementations of WebORB for Java, PHP and Ruby.

These look useful if you want to take advantage of the faster AMF protocol or use other features like RTMP. The disadvantage: more server-side gunk.

Technorati tags: , , ,

My first Google Knol

On reading this morning that Google has opened Knol to everyone, I thought I should have a go. There seems to be a predominance of medical Knols right now, so my Knol redresses the balance by covering a programming topic. Here it is:

Visual Basic

I deliberately did not look at whatever Wikipedia already has on the subject; knowing how good Wikipedia is on technical topics I am sure it is much longer and better than mine, and probably less opinionated.

Now I’m going to sit back and let the world improve my Knol.

But will anyone find my Knol? Oddly, if I try a search for Visual Basic on the Knol home page, my article doesn’t come up, although I’ve published it:

Oh well, maybe it is still being indexed.

It seems to me that the rating system is key here, and one to which I gave too little attention last time I thought about Knol. The thing is, there’s nothing to stop someone else writing an article about VB, and if it gets rated higher (sniff), my contribution will be lost at the bottom of the Knol dustbin – because I suspect Google will use the ratings heavily when ranking Knols in searches.

Other points of interest: I started creating my Knol in IE7, but gave up because of script errors and continued in FireFox. Second, I tried to verify my identity by telephone, but this only works for USA telephone numbers. It’s a beta.

Update: Danny Sullivan has a good commentary. I agree with him about credit cards. I declined.

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.

Microsoft accused of reinventing EJB – ouch!

There is a lot of discussion around Microsoft’s object-relational efforts right now. There are a couple of key issues:

  • Is Microsoft really committed to Linq to SQL, or is it shifting its attention to Entity Framework?
  • Is Entity Framework being pushed out before it is ready? A “vote of no confidence” open letter along those lines has been signed by over 300  including more than a dozen MVPs (Most Valued Professionals), experts in Microsoft data technologies.

Now a post from MVP Ian Cooper makes the frightening suggestion that Microsoft is ignoring the lessons of Java’s problems with EJB:

The .NET community had a huge amount to gain from this experience. Ports of Hibernate and Spring offered the community the chance to avoid the mistakes of the past. However, seemingly unaware of the lessons of history the EF team embarked on a project to produce a complex framework, of which persistence is just one aspect, reminiscent of the EJB initiative. So the reaction against the EF comes from its failure to learn lessons that another community has struggled with around complexity and ambition.

Microsoft’s success with .NET has been partly enabled by over-complexity in the Java world. Microsoft’s secret sauce is enabling developers to build stuff that works quickly and easily – which, incidentally, is why I am really disappointed that Visual Studio 2008 is still such a mess for quick database applications.

My own knowledge of the Entity Framework is rather thin. I’ve treated it as a layer that you have to generate in order to use ADO.NET Data Services, a REST API that I really like. It has to be said though – Microsoft’s data story is getting confusing. Roger Jennings is doing a great job of tracking developments.

Native code client coming for CardSpace as .NET runtime too demanding

I spoke this morning to Paul Mackinnon and Steve Plank at Microsoft, about Information Cards and CardSpace. CardSpace is part of .NET Framework 3.0 and higher. It enables uses to authenticate on web sites by presenting a virtual card, instead of typing in a username and password.

The CardSpace concepts strike me as sound, but as far as I can tell adoption has been minimal. I expressed my frustration; why is it that 18 months after the 1.0 release even Microsoft is not using it to any noticeable extent? I still see username/password dialogs whenever I need to sign into a Microsoft property like MSDN subscriptions or Live Mesh. Actually there is a beta service which lets you sign in with CardSpace – but I believe my point is still valid – how many people even know about this?

I was told that it is still early days and that we will hear more about the Live ID service when it comes out of beta. Mackinnon also mentioned that Microsoft is working on a native code client for CardSpace. Currently users need at least .NET Framework 3.0 which is a huge download and can be problematic. A native code client will be a small download with few dependencies. There is no firm date for release, though it is at least a year away (maybe previews before then).

Technorati tags: , ,

Ruby interpreter flaws make the case for JRuby?

The official Ruby blog reports:

Multiple vulnerabilities in Ruby may lead to a denial of service (DoS) condition or allow execution of arbitrary code.

More discussion here and here. The community is fixing the problems energetically; but they do appear serious, and some are struggling with compatibility issues.

Since these seem to be bugs in the interpreter, it strikes me that this makes a good case for JRuby or in due course IronRuby, on the grounds that the Java and .NET runtimes are more mature. When I spoke to ThoughtWorks about its extensive Ruby work, I was told that JRuby is almost always used for deployment, partly because enterprises are more comfortable with it.

Technorati tags: , , ,