The holidays are coming …

Aand I will (hopefully) have more time to post some more on the blog. I’ve been working with some interesting stuff lately, mostly regarding Flex, Ajax or a combination of the two. So, as I will get some more free time to put my thoughts in order, I’ll post things here. Until then, Merry Christmas.

Flash on linux?

Some time ago Adobe posted on their labs a Beta version of Flash Player 9 for Linux. A much expected move, as most other will confirm. And now, when doing a new install of Ubuntu Edgy, and following the standard steps to install the flash player i discovered that the beta 9 player was installed instead of the 7.x version.

Sweet!

Now back to work 🙂

The file(s) with no death

Aas I was working with some ANT scripts today (well, yesterday by the time I finish the post) I stumbled upon a strange situation (or so I thought at first): my ANT task failed when trying to delete some JAR files. I checked the path to the file – it was correct. I checked if the file existed – it was there, waiting quietly. I checked its properties – it was read-only. I said bingo, changed the attribute and ran the task again. 2 seconds later, the same error. I checked whether other programs had the file opened. None.

Some minutes later, after searching for a bit on the net I verified the system CLASSPATH environment variable. And there were the two causes: I had the .  added to the classpath. And so it seems that this is why JARS cannot be removed automatically by ANT.

Now, as a rule of thumb, it’s not very smart to have the . in your classpath variable (in my defence I added it for a test before leaving work the previous day and forgot to put it out), but if you run into files that will not die, check it out – it’s worth a look.

Link preview without the hastle

Snap launched one of these days a new service called Snap Preview Anywhere that allows bloggers and site owners display a preview of a link’s target as a tool tip. This seems to aim at adding AJAX style value to a site but without all the hard work. The service is embeded into your page through same JavaScript code that you must place in the <head> tag of your page. If you have a blog, editing the theme allows access to this area of the page, so you can take advantage too.

The only issue is now if you’re willing to allow snap.com take a peak at what links your users follow the most or you prefer to spend another hour or so coding the feature yourself.

Setting up the envirnoment to develop enterprise Flex apps

Flex is an Adobe product which enables developers use an enterprise approach to add a rich interface to the web-based applications. It uses both an XML based syntax (the MXML) in order to describe the interfaces and various applications states and ActionScript to tie all of the actions together. You can find out a lot more on Flex from the Adobe website, or by searching for resources on the web.

When it comes to devloping Flex applications you can go about it several ways:

  1. Get the free SDK, the ActionScript VI syntax file and VIM and write your app at virtually no cost.
  2. Get the Flex Builder, install it separately or as a plugin to one of your Eclipse folders and use it to boost the developing speed.

As an extra step you can get the free Flex Data Services Express edition and use it in conjunction with an existing Java server (JRun, Tomcat, Jboss, you name it) and even have the mxml files compiled on the fly.

But how do you set up your work environment if you need to develop an enterprise J2EE application? You could use two different projects – one with your J2EE enabled Eclipse and one with the Flex Builder and intermix their location, or use manual sync – e.g. copy folders all day long – and two very separate projects. However there is a better way which allows you to use a single Eclipse and a single project for the entire applications. To set it up you will need:

  1. The latest Eclipse SDK. You can grab the latest, 3.2.1 SDK here.
  2. The Flex Builder. You can download a trial version here.
  3. Flex Data Services. You can download the free Express edition here.
  4. A Java server which can serve JSP’s and supports servlets. Tomcat does just fine, and you can get it here.

Now to set up the environment:

  • First unzip the downloaded Eclipse SDK into a folder of choice. If you’re like me, you probably already have at least one Eclipse installed. You can simply create another folder.
  • Open Eclipse. From the Help > Software Update > Find and Install check the Callisto Discovery Wweb Site and install the Web and J2EE plugins. Make sure you press the Select Required button to get everything it needs in order to work.
  • When it finishes, start the Flex Builder installer. Make sure you check the option to install the Builder as a plugin to an existing Eclipse installation and supply the path to the recently created folder.
  • After some time (it takes a while to unpack and install everything) you can start up Eclipse and check that the builder installed allright. You should have the option to create Flex projects in the New menu.
  • Also install the Flex Data Services you downloaded and the Tomcat server.
  • Now for the glue between them. There is a plugin on the Flex Exchange, formerly created by the Iteration Two guys which does just that – adds Flex nature to a Dynamic Web Project. Since the automatic update site does not work at the moment you can as well download the zip file here and unpack it in your Eclipse folder. Only unpack the features and plugin folders.

And this is it. Now you can define a regular Dynamic Web Project and you will have the option to use a Flex Data Services 2 Configuration. This will allow the server you pick in the runtime configuration to compile mxml’s on the fly. By switching to the Flex Development perspective you can also take advantage of the builder’s visual tools.

Happy coding!