Category Archives: web authoring

Apple rapped by ad standards body for not supporting Flash and Java

The UK’s Advertising Standards Authority has upheld a complaint (from all of two viewers) against an Apple ad which stated that “all the parts of the internet are on the iPhone”.

In its adjudication, the ASA stated:

Upheld
The ASA noted that Java and Flash proprietary software was not enabled on the iPhone and understood that users would therefore be unable to access certain features on some websites or websites that relied solely on Flash or Java.  We noted Apples argument that the ad was about site availability rather than technical detail, but considered that the claims "You’ll never know which part of the internet you’ll need" and "all parts of the internet are on the iPhone" implied users would be able to access all websites and see them in their entirety.  We considered that, because the ad had not explained the limitations, viewers were likely to expect to be able to see all the content on a website normally accessible through a PC rather than just having the ability to reach the website.  We concluded that the ad gave a misleading impression of the internet capabilities of the iPhone.

Nobody comes out of this with any credit. Apple’s point, when challenged, was this:

Apple said the aim of the ad was to highlight the benefit of the iPhone in being able to offer availability to all internet websites, in contrast to other handsets which offered access to WAP versions or sites selected by service providers.

Somewhat misleading I’d say. All the smartphones I’ve seen recently support HTML as well as WAP. Still, Safari on the iPhone has a larger screen and more complete standards support than other mobile browsers, and on these points Apple is on firmer ground.

What about Flash and Java? Apple apparently said:

They said they could not ensure compatibility with every third party technology in the marketplace and, in order to create the best customer experience, had created their platform on open standards.  They said Java and Flash were examples of proprietary software they had chosen not to enable on the iPhone.

A reasonable point, surely. But the ASA says:

…viewers were likely to expect to be able to see all the content on a website normally accessible through a PC…

Naive viewers, perhaps. Most would figure out at least that a much smaller screen will introduce limitations. And why stop at Flash and Java? What about ActiveX, Silverlight, Real Player, or any site that needs a plug-in to operate correctly? Of course the ASA doesn’t say that Apple should enable all that stuff. It merely says that the ad implies it. That strikes me as a fragile argument. I’d back Apple here.

Nevertheless, it is interesting to see this pressure on Apple to support proprietary plug-ins. I wonder who complained?

Technorati tags: , , ,

Silverlight 2 threading issues, Quickstarts not working

I’ve been working on a Silverlight tutorial involving reading an RSS feed. Silverlight has a SyndicationFeed class which is meant to make this easy – as Microsoft’s Scott Barnes enthuses here.

It is handy, but I discovered that the Quickstart Barnes refers to does not work in Silverlight 2 Beta 2. The Quickstart section on Silverlight.net needs some work. Even if you get to this Quickstart via the link for Silverlight 2 Beta 2 examples on this page, it is soon apparent that it is actually for Silverlight 2 Beta 1. Click the Run It button and you’ll see that it asks for the older runtime.

The code doesn’t work in Beta 2 either; and as so often with thread-y stuff, it’s not immediately clear what’s going wrong. I got a blank page and the following message in the Debug output window in Visual Studio:

A first chance exception of type ‘System.UnauthorizedAccessException’ occurred in mscorlib.dll

In situations like this I recommend breaking on all CLR exceptions (Debug – Exceptions – check the Thrown box for Common Language Runtime exceptions in Visual Studio). Run again; and this time Visual Studio stops on the line which updates a Silverlight TextBlock:

feedcontent.Text += "* " + item.Title.Text + Environment.NewLine

with the message “Invalid cross-thread access”:

Rooting about a bit, I found this post from Karen Corby on changes in Silverlight 2 Beta 2:

HttpWebRequest’s delegates are called on a new non-UI thread.

  • Delegates were previously always called on the UI thread.
  • You must invoke back on to the UI thread if the data you’re retrieving will be consumed by a UI element.
  • For an example, see the updated networking post series (part one).

What this means is that you have two doses of asynchronous coding to think about if you use HttpWebRequest. First, the request itself; and second, in the code you write for the response handler if it needs to update the UI – which in most cases it will.

The example referenced by Corby shows a neat solution using a SynchronizationContext object, or you can use the Dispatcher class as explained by Wilco Bauwer here – he also draws attention to locking issues. See also Shawn Wildermuth’s post though note that CheckAccess is available despite what is said here.

This adds a significant dose of complexity to Silverlight coding. I’m not sure if any of this will change again in the final release.

I also noticed that VB coders are not well served by the Silverlight examples out there, which are overwhelmingly C#. Looks like this is the language of choice if you want an easy life.

Is Silverlight evil?

That’s really the question John Markoff is asking in this New York Times piece about the way the NBC Olympics streaming video is putting Microsoft’s browser plug-in on the map. Someone has even popped up to state that this is another go at technology monopoly:

“They’re still playing the same games,” said Michael R. Nelson, professor of Internet studies at Georgetown University. “It’s a way to lock up the content, and it’s not enabling as much innovation as we would like to see.”

It seems to me that Microsoft cannot win here. If the NBC servers were stuttering then it would prove that Silverlight isn’t up to the job and can’t compete. If Microsoft were not doing Silverlight, it would confirm that the company doesn’t grok the Internet and is still stuck in the world of Windows and Office.

As it is, the NBC Olympics streaming video seems to be working pretty well, judging by reports like this from CNET:

The picture quality is quite spectacular. The mist is so real it could not possibly have been photoshopped in there by the Chinese authorities to provide some extra menacing ambience. This makes YouTube seem like student video.

From a PR perspective, accusations of being evil is probably the best Microsoft can hope for.

But is Silverlight evil? I spoke to Dean Hachamovitch, the IE general manager, at the Mix conference in the Spring. My impression was that Microsoft has back-pedaled on improving browser-hosted JavaScript because it would rather see developers target Silverlight. There is some substance to the idea that Microsoft is promoting its own technology at the expense of open standards.

Still, without Silverlight would we all be using the OGG Theora format and the HTML 5 Video tag? In reality, the alternative is Adobe Flash; and the competition is if anything energising Adobe, which is not a bad thing.

Even if Silverlight achieves its aims, and becomes a widely used cross-platform runtime for web applications, I doubt we will see anything similar to the Windows/Office dominance of the nineties. Microsoft’s investment in Silverlight is conceding the point: that the future belongs to cross-platform clients, zero deployment, and both data and applications in the cloud.

According to Markoff’s piece, Adobe’s Kevin Lynch questions Microsoft’s cross-platform commitment, mentioning:

Microsoft’s decision to reserve certain features like 3-D effects and downloading for the company’s Windows Vista operating system.

I think this is a reference to the full WPF (Windows Presentation Foundation), which only runs on Vista and XP. I’m not sure what the “downloading” bit means; but Lynch is right, in that the relationship between WPF and Silverlight must be a subject of intense debate within Microsoft. Cross-platform .NET is a huge step to take, and there must be internal voices questioning why on earth the company is helping its customers to deploy applications that are not tied to the Windows client.

Still, I think that bridge has now been crossed. Nobody wants to build Internet applications that only work on Windows; it isn’t an option. Therefore I doubt that Microsoft will hobble Silverlight in order to promote WPF; doing so would only help competitors. I may be proved wrong; it’s smart of Lynch to draw attention to Microsoft’s conflicted interests.

Silverlight is great work, and only a little bit evil.

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

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

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

Web 2.0 for the rest of us?

We all know what Web 2.0 means. Google, Flickr, Facebook, Yahoo, mash-ups usually with Google Maps or Flickr, Salesforce.com, and anything but Microsoft. But what does it mean for everyday businesses, like some of the small businesses I talk to from time to time? Some are sceptical. One I can think of sells a successful software application but does not even run a support forum – why make it easy for others to discuss and publicise flaws and problems in your product?

I was interested therefore in a recent book by Amy Shuen, called Web 2.0: A strategy Guide. A foreword by Tim O’Reilly says, "it is the first book that really does justice to my ideas". It was O’Reilly who popularized the Web 2.0 concept – and yes, it is anO’Reilly book.

Shuen writes enthusiastically about network effects, using Flickr, Netflix, Google, Facebook, LinkedIn, Amazon and Apple (iPod/iTunes/iPhone) as case studies. I enjoyed it, but the problem with this kind of book is the chasm between these few web giants and everyone else. Another problem is the tendency to ignore the Web 2.0 graveyard – thousands of start-ups that fail, or moribund and/or spam-infested blogs and forums. Since there are more failures than successes, it would be sobering to investigate these rather than riding a wave of Web 2.0 hype. Nevertheless, it is a thought-provoking book with an extensive bibliography, and not a bad starting point for investigating Web 2.0 concepts. I liked the “five steps to Web 2.0”, which begin with finding collective value and end with perhaps the most important, which is what Shuen calls “recombining innovations”:

New-style click-and-mortar, online-offline network partnerships focus on bridging and building new networks rather than replacing or disrupting the infrastructures of offline companies.

I’ve also received a short Web 2.0 book by Marco Cantù, called The Social Web. It is a brisk tour of the sites and concepts that form today’s online communities. Typical readers of this blog probably won’t find anything new here; but I liked the common-sense tips on things like blogging and creating interactive web sites.

I would argue that almost all businesses either are, or should be, “click-and-mortar” entities. Whatever business you are in, a useful question is: what proportion of purchases in your sector begin with or include a Google search? If the answer is significant, you are in the Web 2.0 business.

That does not mean SEO (Search Engine Optimization) is the answer to everything. I am an SEO sceptic. All too often, SEO is lipstick on a pig. Optimise your web site for users, not robots. Further, it is no good trying to get users to interact with you, if you are not willing to interact with them. Surprisingly, I see this all the time. I suggest spending less time worrying about high Google ranking, and more time worrying about what users find when they do land on your site.

The case studies that interest me most are where old-style businesses have found ways to engage successfully with Web 2.0 innovations. For example, I’ve written about kitchons.com, which services domestic appliances and tunes its business via Google ads. I came across another example today: a financial company which lets you put an image from Flickr on your credit card. Clever.

Web 2.0: A Strategy Guide by Amy Shuen (ISBN: 978-0-596-52996-3). O’Reilly $24.99.

The Social Web written and published by Marco Cantù. $17.39 print or $8.70 electronic, from Lulu.

Technorati tags: ,

Debugging PHP code to fix a WordPress problem

How do you debug a PHP application? Traditionally developers resort to outputting variable values to HTML, or peering through logs, but why not set breakpoints and step through code just as you would in C# or Java? Maybe because it can take some effort to set this up, as I was reminded today.

I was motivated by an annoying WordPress problem which I’ve blogged about before. For historical reasons, I have a lot of subscribers to an old RSS url which delivers the feed in the now deprecated RSS 0.92 format. I prefer to have a full text feed, and this used to work fine with WordPress, which placed the entire blog post in the element of the feed.

At some point this stopped working, and subscribers got a summary only. In fact, the feed broke completely for a while, after I switched to pretty permalinks; but even after fixing that, I still had the problem with summary items. I tried upping the length of the description, but it was delivered without any HTML formatting so that did not work.

Next I tried the WordPress support forums. There are lots of good folk there; but if you review the posts its clear that many queries go unanswered. That’s nobody’s fault; it is a community, and for whatever reason there seem to be more people seeking help than there are experts with the time to give free advice.

So how about debugging the PHP code and working out what was happening? It seemed a good opportunity to try the latest Eclipse Ganymede, released a couple of weeks ago, along with the PHP Development Tools (PDT). I also figured it would be easier to set this up on Linux, to match what I use on the web server. I used the same Ubuntu on VirtualBox setup that worked well for trying out SproutCore. It worked…

Debugging PHP with Eclipse Ganymede

…but I can’t pretend it was wholly straightforward. Here’s how it went. I installed the latest Ubuntu distro versions of Apache, MySql and PHP – easy. Ubuntu’s Eclipse is not the latest, so I downloaded it from the Eclipse site and used some tips to set it up tidily. Note: make sure Sun Java is installed; I set it as the default JVM. Adding the PHP development tools was more fiddly. I’d half expected this to be part of a standard Eclipse download by now, but it is not, and if you try to install it into Ganymede using the standard update site is does not work because of dependency issues (a big problem with Eclipse). You have to download a 2.0.0 build from here instead.

I’d decided to use the Zend debugger – that’s a separate Eclipse update too, as explained here. Note that even after updating Eclipse, you still have to install the separate Zend debugger server from here, if you want to debug real web applications. I had a few problems getting this working, mainly because of the zend_debugger.allow_hosts directive which you have to edit in php.ini, and which is not brilliantly documented.

I replicated my blog on the Ubuntu virtual box – easy. But how do you get your Eclipse PHP project pointing at this existing code? The method I settled on after a couple of experiments was to start a new PHP project, uncheck the Use default option for project contents, and select the blog directory in /var/www. You then get a scary dialog which observes that files already exist. You can either create your project as a subdirectory, in which case you cannot debug with the existing files, or else pass the scary warning:

Create project in /var/www/blog
(Deleting the project will delete the entire /var/www/blog folder)

I mis-read this at first, thinking it would delete all the files when creating the project. That’s not what it says. Everything was a backup anyway, so I took the plunge; it worked fine. In fact, if you look closely at the screenshot above (click for a full size image) you can see that it is nicely done. You can see the call stack at top left, current variable values, output as it is being generated, and the usual options to step into or over the code.

That said, I did have some problems with Step Into. Just when it was going to be most useful, it bombed out with a message that said Error. If you looked at the detail, that also just said Error. The only fix I found was to set breakpoints in the actual file I needed to debug.

Still, it worked. I found that by adding a single argument to a line in feed-rss.php I could get my full text feed back. I’ve duly reported this in the WordPress support forums.

A couple of observations.

First, I don’t much like the WordPress code. Sorry, because the product is marvelous, but the code seems like a typical PHP tangle. Using pretty permalinks, which I regret, makes it worse.

Second, are there not plenty of developers who use both Java and PHP and would like it to be a tiny bit easier to set up in Eclipse? I’m being a little unfair, since Ganymede is just out and I guess the PDT will integrate better with it soon. Even so, Eclipse is still not quite the smooth plug-in dream that I once hoped it would become.

Note that if you don’t mind paying, you can have Zend Studio which I should think makes life easier. Or perhaps Delphi for PHP.