Linux Flash Player Bugs

As a user of Linux on the desktop (I use Ubuntu 7 on an HP nc8430 laptop), the release of a current version of the Flash Player for Linux was great news. As well as allowing me to look at the latest Flash web sites, it allowed me to develop and test content produced using the Flex SDK. Unfortunately there are a couple of annoying bugs in the player related to use of the FileReference class – the class that lets you upload files back to the server.

The first of these bugs relates to sending parameters back to the server at the same time as uploading the file. This is useful as it lets the page send back information that the user may have entered to be associated with the file, such as a title and description for the file. Normally you use the URLVariables class to add variables to the file, for example:

var fileRef:FileReference = new FileReference();
fileRef.browse();
// In handler for Event.SELECT
var params:URLVariables = new URLVariables();
params.title = "Sleeping Cat";
params.description = "My cat having a sleep on the patio.";
var request:URLRequest = new URLRequest("http://localhost:8080/FileUploadServlet");
request.method = URLRequestMethod.POST;
request.data = params;
fileRef.upload(request);

Now under Flash Player in Windows this works just fine – the parameters are encoded into the request and uploaded just as Adobe says they should be. Try it under Linux though, and you just get the uploaded file – no parameters sent. This is very annoying as it means I have to encode the information I want to sent differently if I want to support Linux, which I do or otherwise I won’t be able to see my own application.

The workaround that I have implemented is to put the parameters into the URL itself, eg:

var requestString:String = "http://localhost:8080/FileUploadServlet?title=" + title \\
 + "&description=" + description;
var request:URLRequest = new URLRequest(requestString);

This works fine in both Linux and Windows, although you may have to encode your parameters of course before creating the URL to avoid illegal characters in there.

But unfortunately that is not the only problem with FileReference in the Flash Player. Adobe introduced an event to UPLOAD_COMPLETE_DATA that allows you to get at any response from the server once your file is uploaded. This allows you to make your server-side code send a response back to the player, for example a reference number or even XML with more complex data, for example:

fileRef.addEventListener(DataEvent.UPLOAD_COMPLETE_DATA, fileUploadCompleteDataHandler);

…and then…

private function fileUploadCompleteDataHandler(event:DataEvent) : void
{
   Alert.show("File upload OK - response from server: " + event.data, "Debug");
}

This all sounds great, but unfortunately it doesn’t work under Linux either – although its just fine under the Windows player.

I’ve reported both of these issues to Adobe, so I hope that they get resolved soon. Sadly though it does make life more complex because of course so many people will have older versions of the Flash player that are broken. Fortunately I suspect Linux users are more amenable to upgrading, and of course the majority of users have Windows or OS/X.

Right tool for the right job

Most people who do any sort of software development have probably read something from Joel on Software. This week, Joel Spolsky commented on the idea that blogs shouldn’t have comments, an idea that Dave Winer had written about previously.

Comments on any item can tend to end up as just meaningless drivel as soon as a certain type of person, ie. those who revel in the anonymity of the Internet, start “contributing”. You just have to look at the example given by Joel, or in fact pretty much any video on YouTube, or any link on Digg, Reddit, or similar sites that allow commenting. Somebody creates interesting content, and assuming it gets published widely then it will be inundated with a mass of comments – mostly one liners, probably slagging off the content in some way. Eventually the whole thing descends into a slanging match.

I believe that the problem with blog comments is that they are the wrong type of tool for the job. If people want to discuss a posting, they should do that in a place more suitable for discussions, such as a forum. Forum software has been around for ages and provides a much better environment for discussion than the simple comments system most blogs have. Typically forums allow a much better, threaded structure for discussion and better administrative controls than any blog does.

Most forum software isn’t perfect though. Slashdot is an example of a site that effectively provides forum-like discussion on the back of each article posted. They have long had to deal with the problem of inane comments, trolling etc. and so have developed a heavily customised system where the community moderates itself (or at least tries to). I still read Slashdot partly because it is relatively easy to scan through the newest articles, but also because when you look at the discussion I can quickly find the best comments and ignore the rubbish.

Joel actually follows this tactic himself – no comments on blog entries, but the site has a forum system where people can comment. Unfortunately there is still a lot of rubbish in there, but it’s a lot better than just a linear comments system attached to each blog entry. Of course it’s just a fairly vanilla forum system, as are most out there. Improving forums is probably a discussion for another day though.