The random utterances of David Arno

Wordpress crashing Firefox on adding an image: bodge solution

Google GearsIn the last couple of days, I’ve found that Wordpress has suddenly started crashing Firefox when trying to add an image to a blog post. A search on Google quickly revealed that I was not alone and that it is Google Gears that is causing the problem. Disabling Gears and restarting Firefox “solved” the problem. Of course Gears is then disabled and Wordpress is then slower as a result, so it’s not an ideal fix. It’ll do until such time as Google or Mozilla fix the problem though.


Share This Post...
1 comment so far, click here to read it or add another

Adobe release public betas of Flash Builder 4, Catalyst and the Flex 4 Framework

Adobe promised us public betas of the next set of Flash development tools in June and they have lived up to their word, releasing it on June 1st and – as a really nice touch – they haven’t made us wait until the start of the business day in California.

Flash BuilderFlash Builder 4
This is the new name for Flex Builder 4, as Adobe feel the Flex moniker was putting AIR and pure As3 developers off using it. The beta download is for the “Premium” version. According to the Flash Builder 4 FAQ on the Adobe Labs site, this is a name change from the fully-featured Flex Builder’s “Professional” tag to avoid confusion between Flash Builder and the Flash designer program, Flash CS4 Professional. Giving the Flash designer package a proper name would have caused a lot less confusion, but at least they have given it a bit of thought.

Flash Builder 4 can be installed as a stand-alone application alongside an installation of Flex Builder 3. So it is possible to test out the beta without losing one’s production environment. Everyone can enjoy a 30 day trial, but you’ll need a Flex Builder 3 license key if you wish to use it longer.

Flash CatalystFlash Catalyst 4
A new addition to the Adobe stable, this tool is designed to fill the gap between Flash developers and designers in a way that the Flash designer program couldn’t. It allows the designer to turn their static picture designs into MXML code, which in turn can be used to skin the new Flex 4 components (sadly the term “gumbonents”  has inevitably been dropped as the new components of now Spark components, rather than Gumbo ones.)

Having installed the beta and experimented with it for twenty minutes or so, my immediate reaction is one of “eh?” It doesn’t seem very intuitive to this developer. The tutorial info on the Adobe Labs is going to be essential reading.

You can download Flash Builder 4, Flash Catalyst and the Flex 4 SDK from the Adobe Labs.


Share This Post...
No comments yet, click here to be the first

Pinning the recycle bin to the taskbar in Windows 7

Windows 7I really like Windows 7 release candidate: it is everything that Vista should have been and more. It runs on low spec hardware, it is slick, looks good and it Just WorksTM in so many ways. I have it installed on an old 1.6GHz single core laptop and yet, even with Aero Glass enabled, it feels faster than my dual-core 2.5GHz main machine. Being a fan of the Dock on OS X machines, I really like the new taskbar too. I have one major gripe with it though: you cannot pin the recycle bin to it. If you try to, it gets hidden away by the Windows Explorer icon that is already there and is accessible only through right-clicking on that icon.

Help is at hand though with this one failing of Windows 7. It is possible to add the recycle bin to the taskbar (and have it support drag and drop). In short, the solutiuon is to create a new toolbar that contains a shortcut to the recycle bin. Full details can be found on sevenforums. See below for the results:

win7-pinned-bin1


Share This Post...
1 comment so far, click here to read it or add another

Never mind the recession; here’s Flash on the Beach

Flash on the Beach 09

It’s nearly summer time and so it’s nearly time to start planning for a very special beach event: Flash on the Beach. This great Adobe Flash-related event returns to Brighton for its fourth year on the 20th – 23rd September.

If previous years are anything to go by, expect a fun mix of presentations ranging from the awe-inspiring, artistic and inspirational to the informative and educational. Previous years have seen presentations on designing adverts and using the “power user” features of Photoshop, through to building your first Flex app and some good best practices for software development.

Tickets are on sale now. The earlier you buy, the cheaper they are. In previous years they have all sold out too. Leave it too late and you’ll be left kicking empty bear cans on Brighton beach whilst everyone else enjoys the Flash on the Beach party. So get yourself over there now and sign up to join in.

ps, getting naked and really flashing is not advised. Doug McCune discovered what happens when you take your clothes off at Flex360 this year. You have been warned… :)


Share This Post...
No comments yet, click here to be the first

Flex Builder is dead. Long live Flash Builder

flashbuilderLast Friday, Adobe announced that Flex Builder 4 will actually be called Flash Builder. As many folk use Flex Builder to create non-Flex SWFs, it does make sense. Remember Flex is little more than just a bunch of ActionScript classes after all, so Adobe could well have been limiting sales of Flex Builder with its old name.

What seems odd though is that there seem to be no plans to rename the Flex SDK at the same time. The Flex SDK is equally inappropriately named as it contains all of the core Flash classes, the compiler, ASDoc generator etc, as well as the Flex classes. Also without a change to the Flash Pro designer tool, confusion will continue to reign as Adobe will have two products called Flash Pro and Flash Builder Pro respectively. Such a half-baked name change smacks of some poorly thought-out marketing decision at too low a level within the company.

Another oddity of the name change is with regard to trademarks. According to the Adobe website, the fully qualified name of Flex Builder is the ridiculously cumbersome Adobe® Flex® Builder™. Presumably Adobe will try to slap a trademark on Flash Builder too. I’m no lawyer, so may be wrong here, but I suspect that as existing products using the name Flash Builder have been around for years, the TM on Adobe’s Flash Builder will mean little more than “Totally Meaningless”. See a4desk.com and the flashbuilder tool on tucows for example. Third party software houses will presumably therefore be free to use the term in their products too. Given how anal Adobe normally are over trademarks, I’m surprised at the name choice therefore.


Share This Post...
No comments yet, click here to be the first

Stack Overflow isn’t just a software Q & A site

Back in the days when Commodore were able to advertise 64K of memory as being synonymous with the large memory of an elephant, stack overflow errors were common. With limited memory, only a small amount could be spared for the stack, and a series of function calls could easily fill it up.

These days, when computers have 5-6 orders of magnitude more memory, the concept of a stack overflow has been relegated to an in-joke name for an excellent developer Q & A site. I was therefore more than a little surprised when a Flex app produced the following stack trace:

Error: Error #1023: Stack overflow occurred.
    at mx.collections::ListCollectionView/listChangeHandler()[E:\dev\
       3.0.x\frameworks\projects\framework\src\mx\collections\
       ListCollectionView.as:1049]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at mx.collections::ArrayList/internalDispatchEvent()[E:\dev\3.0.x\
       frameworks\projects\framework\src\mx\collections\
       ArrayList.as:510]
    at mx.collections::ArrayList/addItemAt()[E:\dev\3.0.x\frameworks\
       projects\framework\src\mx\collections\ArrayList.as:311]
    at mx.collections::ListCollectionView/addItemAt()[E:\dev\3.0.x\
       frameworks\projects\framework\src\mx\collections\
       ListCollectionView.as:501]
    at mx.collections::ListCollectionView/addItem()[E:\dev\3.0.x\
       frameworks\projects\framework\src\mx\collections\
       ListCollectionView.as:470]
    .
    .
    .

Scrolling down through the stack trace, everything that came after what I’ve copied above was just many references to the one method. I’d written a recursive method who’s test for the end of the recurse would always fail, so it had gone into an “infinite loop”. It just goes to show, no matter how much memory you have, a run-away recursive method will always run out of stack space. Stack overflow errors still exist, they are simply hidden away from all but sloopy recursion junkies… :)


Share This Post...
No comments yet, click here to be the first

How to filter all nodes of a Flex Tree component

Flex logoIf you have ever tried to display filtered data in a Flex component, you’ll likely be aware that you can use an XMLListCollection object as the data source and that you can apply a filter function to that collection. The component only then displays the filtered data. However if you have tried this with a Tree component, you’ll have discovered that it doesn’t work. The filter is only applied to the top-level node(s) in the collection. The filter isn’t recursively applied to child nodes.

There is a an open bug related to this problem in the Flex Bug and Issue Management System. It is currently targeted to be fixed for Flex 3.4.0. In the meantime though, there is a simple work-around that I’ll describe here.

When rendering its nodes, a Tree object relies on a helper class that implements one of the ITreeDataDescriptor or ITreeDataDescriptor2 interfaces. By default it is an instance of DefaultDataDescriptor, but one is free to supply the tree with a different implementation. By overriding the tree’s data descriptor with one that supports filtering, the tree’s content can be easily filtered. The simple Flex SWF below demonstrates this point. Try selecting/ unselecting the checkboxes on the right and you’ll see that the tree’s content changes accordingly.

This movie requires Flash Player 9

The key to how it works is that the tree calls the data descriptor’s getChildren() method for each node. The filter function can therefore be called at this point and we only return to the tree the set of children that we want displayed.

My implementation of the ITreeDataDescriptor is far from complete. I have only implemented those methods needed to demonstrate the point, though it implements the required functionality just fine. The DefaultDataDescriptor is more complex, as it implements all the methods, plus it uses some clever caching mechanisms. I may implement a full replacement class at some stage that will support drag and drop for example, but for now that is left as an exercise for any reader who needs such functionality.

You can download the full FlexBuilder project source code for the above SWF here.


Share This Post...
7 comments so far, click here to read them or add another

Using PowerISO to overcome major missing feature in VirtualBox

Sun VirtualboxOne of the great things about modern computers is that they have multiple cores and gigabytes of memory. This means that it is practical to run multiple operating systems on one machine using virtual machines (VMs). There are a raft of VM products available for desktop PCs. The best by far in my view is VMware Workstation. It however has one big problem: it costs $189, whereas there are many good-enough products that are free. So my VM product of choice – after trying many of them – is Sun’s xVM VirtualBox.

Whilst it serves its purpose the vast majority of the time, I recently came across a fundamental problem with it: it doesn’t support shared folders, or copying files, when the “guest” (VM) is Solaris. It is possible to copy files from a Solaris box to a Windows or Linux guest; from a Windows box to a Linux guest etc, but Solaris guests cannot do this. A search for solutions yielded various complicated ways of mounting/ unmounting USB drives or setting up Samba and the like to share files over the network. There seemed to be no simple way around the problem though.  I have hit upon what I feel is a fairly simple work-around myself, so I’m sharing it with others here.

The solution I used for getting files from Windows onto the Solaris guest may surprise people: I used ISO images. However it doesn’t involve burning real CDs/ DVDs; just creating .iso files. To do this, I used a program called PowerISO. The free version will create images up to 300Mb, so it’s likely to be usable in many situations. There are other programs capable of creating ISO’s too if you prefer to use them, but I like PowerISO (I bought the full product), so I’m describing that here.

The steps to transferring files from Windows to Solaris are:

  1. Open PowerISO and a Windows Explorer window.
  2. Navigate to the required files in Explorer and drag them to PowerISO
  3. Go to File menu -> Image Properties in PowerISO and turn off “Enable file optimization” (this’ll save lots of time in the next step)
  4. Save to an ISO file. I found 200Mb took around 10 seconds to save on a 5400 RPM laptop disk.
  5. Now switch to Solaris guest and select Devices menu -> Mount CD/ DVD-ROM
  6. Add your ISO image to the list and mount it.
  7. A File Browser window will open up in Solaris. Copy the files from there to where you want them on the Solaris file system

And that’s it: job done. To then transfer more files:

  1. Eject the “CD” on Solaris
  2. Select Devices -> Unmount CD/ DVD-ROM from the menu
  3. Now delete the files from PowerISO, drag some new ones across and save again. Say yes when prompted whether to overwrite them.
  4. Repeat steps 5 and 7 above

UPDATE

No sooner did I write this post than the Sun VirtualBox team let me know via twitter that a new version of VirtualBox is due in a few weeks, that will fix this problem. This is great news, even though it renders my work-around unnecessary almost as soon as I find it :)


Share This Post...
No comments yet, click here to be the first

Is it time to retire Java?

DukeYesterday, the boss and I took a trip up to London for Sun’s UK Developer Update event at the Royal Geographical Society. There was a “keynote” by James Gosling, followed by presentations on JavaFX, Java EE 6 and details of what is likely to be in Java SE 7.

Now I should make it clear that until recently, I regarded myself as a C# and ActionScript programmer. I’m new to Java. This isn’t strictly true, as I used Java back in its Java 1.1 days, but its changed so much since those days (and I’d forgotten most of it anyway), that in practice I’m a Java newbie. As a result, I naturally judge Java against C# (and to a far lesser extent, against ActionScript).

C# owes its existence to Java. Languages prior to Java may have had garbage collection, reference types rather than pointers,bytecodes, just-in-time compilation etc, but Java bought these technologies into the mainstream. As it came after Java, C# was able to adopt all the good points of Java, and scrap the bad stuff (the getter and setter mess of Java is replaced with elegant properties for example). Whether it did this successfully or not is a matter of opinion of course. From my point of therefore, Java automatically deserves respect, but it doesn’t deserve automatic authority. People grow old and wise, but also grow set in their ways. Programming languages appear to do the same.

Despite its seniority, Java has some clear advantages over C#. Breaking to labels is a glaring omission in C#, which Java has. C# requires the use of the evil-incarnate “goto” to simulate breaking to labels. Also the XML mess that is documentation comments in C# is pure farce compared with the simple elegance of Javadoc. Java has a whole raft of deficiencies though, and the two biggest ones are the lack of anonymous functions (let alone closures) and the lack of properties. Both have been proposed for Java 7, but – according to Sun’s presentation yesterday – neither will now appear. On a lesser note, Java 7 will not support operator overloading either, so string comparisons will remain using the grossly messy .equals() method to compare string value. This is a minor issue in comparison with properties and closures.

Why are anonymous functions/ closures and properties such a big deal? Both can be worked around in Java. Properties are after all just a neater way of doing getters and setters and people have come up with bodge simulations of delegates for Java. The big deal is that these are basic features of modern languages. Even the somewhat “noddy” scripting language, ActionScript, manages to implement both. Every other JVM-based language that I know of – JRuby, Jython, Groovy and Scala – all support closures.

Java is old and is becoming set in its ways. Language developers always run into problems with balancing feature advancements with avoiding breaking legacy code and Java is no exception. Perhaps we need to accept that closures and properties will never come to Java as it is just too difficult to implement both neatly, without breaking backward compatibility in too big a way. If this is the case, then perhaps Java 7 should be the last version of Java and it ought to be retired and replaced with a younger, more adaptable language.Whether the growth in alternative JVM languages is a sign that people are already moving on from Java to newer languages is difficult to judge. JRuby, Jython, Groovy and Scala are all dynamic languages. Dynamic languages have seen a general resurgence in popularity recently. What is needed though is a static language replacement to Java. One that can seamlessly interact with legacy Java code, whilst supporting modern programming principles such as closures, operator overloading, properties etc, along with support for dynamic types (without being inherently dynamic), functional language principals such as currying and lambda expressions.

The more astute of you may spot where I’m heading here. Just as C# was born of Java, so perhaps we need a new version of Java, born of C#. Being a English tea addict, who is pretty indifferent to coffee, I propose (not very seriously) that we call it Lapsang. C# itself is starting to get old, and many of the new features – such as extension methods – have been implemented in an inelegant manner to avoid the backward compatibility issues that new keywords bring. So just as C# took Java’s good bits and added more of its own, Lapsang could take C#’s good bits, add a few new bits of its own (build concurrency into the core of the language for example) and give the JVM another 10+ years of life.

Java properly is a dying language and it risks taking the JVM with it. If Sun (or IBM perhaps, if they buy Sun) bite the bullet and retire it as the prime JVM language, then there is no reason why the JVM cannot thrive and grow for many more years.


Share This Post...
2 comments so far, click here to read them or add another

How to use third party image editors from within Picasa

Google Picasa logo

Google’s Picasa is a pretty good photo management tool. It’s free for a start and it offers a decent feature set, including the ability to geo-tag pictures and have them appear in Google Earth. However, one aspect of it is utterly bizarre: the way in which it integrates with other programs. I don’t know about you, but the normal way I’d expect a program to integrate with 3rd party tools would either be via preferences, or via a simple, easy to edit, configuration file. I’d expect to specify the path to the application and maybe supply a PNG if the program supported some sort of toolbar.

Picasa takes a very different approach to 3rd party application integration. To make Picasa aware of a 3rd party tool, one must create a zip file which contains an XML file that defines the buttons behaviour, and a Photoshop file that defines the button’s appearance. To then make Picasa aware of this file, one needs to deliver it via a web link or by entering a complex URL into a web browser. Google have produced a button API, which describes the process of adding a new button fairly well. As I discovered though, there are some “gotchas” to be aware of. I use Paint Shop Pro (PSP) as my image editing tool of choice. Also, as I have a Sony Alpha digital SLR camera, I use Sony’s RAW image editor to process the photos I take. I wanted Picasa to therefore support both of these programs.

PSP Button ImageI started by creating a .pbz (the zip file) for Paint Shop Pro. I followed the API’s advice and used a GUID to give my .pbf (the XML file) and .psd (the Photoshop image) unique names. As Paint Shop Pro doesn’t store its executable location in the registery, I hard-coded the path and ended up with the following XML:

<?xml  version="1.0" encoding="utf-8" ?>
<buttons format="1" version="1">
  <button id="psp/{68bd7eb6-3ad1-4036-92f0-8c896a754a75}"
          type="dynamic">
    <icon name="{68bd7eb6-3ad1-4036-92f0-8c896a754a75}/icon"
          src="pbz"/>
    <label>PSP X2</label>
    <tooltip>Edit in Paint Shop Pro Photo X2</tooltip>
    <action verb="trayexec">
      <param name="exe_name"
             value="C:\Program Files\Corel\Corel Paint Shop Pro
                    Photo X2\Corel Paint Shop Pro Photo.exe"/>
	  <param name="export" value="1"/>
	  <param  name="export_message"
                  value="Sending to PSP..."/>
    </action>
  </button>
</buttons>

If you refer to the API documentation, you’ll see that I’ve defined a new button that will save any edits to the selected images and a make a copy of those images. It then launches PSP, and passes the set of temporary files to that application. Also the file defines the inelegantly named – but statistically unique – {68bd7eb6-3ad1-4036-92f0-8c896a754a75}.psd, which contains the button’s image.

Next, I used PSP to create the Photoshop image for the button, zipped it all up and FTP’ed it to my blog’s server and created a test page with the appropriate link in it. I loaded up the test page, clicked on the link, watched Picasa launch and ask me if I wanted to import the buttons. Then the disappointment set in, as the button’s text was all displayed correctly, but it had no image. I checked and rechecked everything, tinkered with PSP’s settings and tried again and again, but to no avail. I couldn’t get an image to appear. I happen to have a trial copy of Adobe Fireworks on my machine at the moment though, so I tried editing the Photoshop image I’d created in that. The layer’s name appeared quite different to what I’d set it as in PSP. So I fixed it, saved it and tried again. The image appeared on the button just fine.

This left me irritated with both Corel and Google. First of all with Corel: why support the saving to file formats like Photoshop if you aren’t going to implement it properly? And with Google: there are well-supported, open, image formats such as PNG that they could have used. So why did they choose a proprietary file format (especially as it’s not even their own proprietary file format!)?

sony-raw-buttonHaving overcome the image problem with my PSP button, I expected the Sony RAW tool to be fairly straightforward, and it almost was. The tool appears in the registry, so I was able to use that path, rather than hard-coding a file path as I’d done with PSP. Aside from that, I copied the XML file, changed the wording and tried using it. It installed correctly, with the correct image (courtesy of Fireworks). However, when I then selected an image and clicked in the new button, the tool complained that it was being given a JPEG file. This is fairly useless for a RAW image editing tool!

All was not lost though. After some experimentation, I removed the export tag from the file and it sprang into life. I had missed the fact that it doesn’t just create temporary copies of the images, it creates temporary JPEG images, regardless of the original file type. So the final XML for my Sony RAW button was:

<?xml  version="1.0" encoding="utf-8" ?>
<buttons format="1" version="2">
  <button id="psp/{a2042007-ba56-40ff-a626-8fe60278b043}"
          type="dynamic">
    <icon name="{a2042007-ba56-40ff-a626-8fe60278b043}/icon"
          src="pbz"/>
    <label>Sony RAW</label>
    <tooltip>Edit in Sony RAW Image Data Converter</tooltip>
    <action verb="trayexec">
      <param name="exe_name_regkey"
             value="HKEY_LOCAL_MACHINE\SOFTWARE\Sony Corporation\
                    Sony Image Data Suite\Image Data Converter SR\
                    2.0\ExeName"/>
      <param name="exe_path_regkey"
             value="HKEY_LOCAL_MACHINE\SOFTWARE\Sony Corporation\
                    Sony Image Data Suite\Image Data Converter SR\
                    2.0\InstalledLocation"/>
    </action>
  </button>
</buttons>

At the end of the process, I now have my two buttons working well. Getting there was a painful process, but hopefully this post will save others time in creating their own buttons.

If you want to use either button in Picasa, click on the Paint Shop Pro X2 installer or on the Sony Image Data Converter SR installer links to import them into Picasa.

Alternatively, you can download the button zip files for Paint Shop Pro X2 and Sony Image Data Converter SR here.


Share This Post...
No comments yet, click here to be the first

Next Page »

Close