MacOS, Flex Builder, libs directory and nightmares

October 16th, 2008

At some point of time I decided to be cool for once in my life and try to use this “libs” folder feature (See the overexcited Ted’s article here). Because I had to add a number of SWCs to the project I decided not to add them manually one by one as I usually do, but instead I created a sub-directory under libs (I should be listening to that ominous voices) and placed a bunch of SWCs there.  Then I just added a new “SWC Folder” location to the library path and I was enjoying the fact that as soon as I place anything in that directory, Flex Builder catches it up (after a refresh though).  But then storm cloud gathered. I.e. our Mac designer updated the code from the SVN.  The symptoms were:


a) Flex Builder hangs (freezes) at the startup while loading the project which referes to that libs/cool_dir directory.

b) In the log file we saw the following:
Caused by: org.eclipse.core.internal.resources.ResourceException: The resource tree is locked for modifications.

After 4 hours of the tambourine dancing around Mac we have figured out that the cause of the problem was my libs/cool_directory. As soon as you remove it, everything gets back to normal. And only Flex Builder for MacOs is prone to this problem.

Damn it!  The number of hours I’ve already spent in the last 2 years troubleshooting Mac’s problems is now probably equal to the unforgettable hours I’ve spent installing SCSI board drivers for WinNT3.51/4.0 on SMP servers.  Oh…. sweet unpretentious Windows…


NB On the way, I’ve been really pissed off  by MacOS again – if you download zip file in Safari, it automatically unpacks it. And if folder in the archive is org.eclipse.core smart Safari-MacOs-SteveJobs-whatever unpacks it into the org/eclipse/core.  This is so sweet, caring and mindful.
I’ve been told that there is a setting somewhere in Safari to stop doing this, but we’ve got a presumption of innocence, right? Why should arrogant, ill-mannered and unsophisticated bloke like me know, that there is an option somewhere in the MacOs which says “let’s be stupid, OK/Agree?”

Anyway, enough about this bloody MacOs.  Allons! Revenons à nos moutons! Qu’en fut-il?

Easy multiple items selection in DataGrid

August 24th, 2008

Using Ctrl or Shift keys in multiple items selection is a common thing. Unfortunately, it is appeared that it is common only among the advanced users. So, I decided to simplify the interface: simulate Ctrl key, so user will use single mouse click to select/unselect items in the DataGrid.

    import mx.controls.DataGrid;
    import mx.controls.listClasses.IListItemRenderer;

    public class EasySelectionDataGrid extends DataGrid
        //this flag simulates holding a Ctrl key
        private var _holdCtrl:Boolean = false;

        public function EasySelectionDataGrid()

        public function set holdCtrl(value:Boolean):void
            _holdCtrl = value;

        public function get holdCtrl():Boolean
            return _holdCtrl;

        override protected function selectItem(item:IListItemRenderer,
            //override values if necessary
            return super.selectItem(item, shiftKey,
                              _holdCtrl ? true: ctrlKey,

“Error #2046: The loaded file did not have a valid signature.”

August 21st, 2008

After I’ve updated to Flex SDK 3.1.0 I’ve got this Error #2046: The loaded file did not have a valid signature.

Everything in the projects was pointing to the new sdk 3.1.0, instead of 3.0.0, but RSL libraries in the bin-debug folder were still from the old SDK (framework_3.0.0.477.swf, rpc_3.0.0.477.swf, datavisualization_3.0.0.477.swf along with corresponding SWZs)

After some head scratching I’ve opened up the properties of the main application,
Flex Builder path => Library path and looked into the settings of the framework libraries -bingo! It was still using the old settings.

So, all you have to do is to remove old RSLs and add new ones (both swf & swz), so it will look like that:

RSL setup screen

Diff on mxml files in Flex 3 sucks big time

August 21st, 2008

Internal diff tool in FB3 sucks big time. It worked in FB2, but someone decided that this thing is too good for this world and changed it. This ugly proportional font and this terrible performance are just unbearable!

Single diff on 1000 lines files takes around 50 seconds. Multiply it by 10-20 per day and this is a stolen time from you.

It is time to change this. Here is the place to vote for this bug:

Sweet Adobe, please have a mercy on us all and give us back the
simple, no-gimmick diff, which just works.


Data binding will not be able to detect assignments to “SOME_STATIC_VARIABLE”.

August 18th, 2008

If you want to bind in MXML to some static variable compiler will warn you that data changes to the value will be unnoticed with the following warning:

Data binding will not be able to detect assignments to "SOME_STATIC_VARIABLE".

I don’t like compiler errors and don’t like compiler warnings as well. So, to avoid this warning you can do the following:

Instead of:

    <mx:TextInput enabled="{iUserAccessId == GLOBAL.m_iAllowTextInput}" />;

you can do this:

            private var iCanEdit:uint = GLOBAL.g_iAllowTextInput;
    <mx:TextInput enabled="{iUserAccessId == iCanEdit}" />


ComboBox selectedItem problem

August 18th, 2008

ComboBox is definitely one of the lousiest Flex components.
First, you can’t customise the itemRenderer for the main control (not the drop-down list).
Second, it has very uncertain behaviour with item selection.

Problem 1:
setting ComboBox.selectedItem = null does not do anything. Logically, it should be equivalent to setting selectedIndex=-1. But it does not work.
There is Flex bug registered and it is marked as Fixed in Flex 3 (Released), which is a bullshit. It is still there.

Problem 2:
The whole Flash/Flex framework is event-driven thing. But sometimes developers forget about it. Unfortunately, including the framework designers.
Somehow, someone thought that dataProvider property will be always set first, and selectedItem second. This is wrong. Here is an example how it could be in a real world:

A multi-state Panel has Combobox. The Panel is cached (after creation it is saved to be reused in later calls).

Here is the sequence of events:
1. Already cached Panel is opened up by PopUpManager
2. Panel is initialised with new data
3. selectedItem property is getting initialised first (by data binding)
4. Panel performs the state change
5. Panel in new state initialises ComboBox by setting the dataProvider (by databinding)

Because there are no new dataChange events coming after this point, selectedItem won’t be set.


Here is the overridden class which addresses both problems.

    import mx.controls.ComboBox;

    public class RightComboBox extends ComboBox
        public function RightComboBox ()

        override public function set selectedItem(value:Object):void
            if (value == null)
                super.selectedIndex = -1;
                super.selectedItem = value;

        override public function set dataProvider(value:Object):void
        var l_savedSelectedItem:Object = super.selectedItem;
            super.dataProvider = value;
            super.selectedItem = l_savedSelectedItem;


call validateNow() on parent for correct results

August 2nd, 2008

It is never too late to learn. After a lot of time spent on fixing the mighty “Flex Printing Engine”(tm), I’ve learnt an important lesson: you have to call validateNow() on parent component as well to get child component properly measured and rendered.

Midnight Commander under Cygwin/Vista

August 2nd, 2008

For many years I’ve been using Far Manager which is really great commander for Windows.
It has many useful plugins like SCP/SFTP, Network Browser, reasonably good editor with Colorer, PocketPC connection etc.

On the downside FAR editor has a couple of problems which bothered me a lot:
– Internal editor which is quite powerful, sometimes starts using Windows line endings (CRLF) and because I am working in a mixed environment I had to run the dos2unix utility on the routine basis to convert all the files into the UNIX format.

– FAR has a mysterious feature of changing file permissions or file sharing by adding user “None” with special permissions which were preventing files from to be executed. I.e. you’ve download ZIP file using FAR’s FTP browser, unpack it, try to run EXE file, Windows says:

"You don't have permissions to run the file"

. So you have to Explorer->Security settings and kill this None user.

After my recent upgrade from XP to Vista these problems became even worse.
So, I tried to start using the Midnight Commander, which I’ve been using for ages in Unix environment.
But under Cygwin/Vista it behaves quite differently.

Problems I’ve met so far are:

– no mouse support under Vista.
I’ve even tried to use Cygwin’s SSH port with PuTTY and then run MC – no way to have mouse working in Cygwin window.

– I am unable to browse/open any .zip files.
MC says:

 ./ ./ cannot execute binary file

What the heck? Somehow it opens the TAR files, but only by F4(Edit) command. If you try to open TAR file it writes similar bullshit about running a binary file.

-And the last thing which drives me mad – I am unable to save some of the MC’s config files, such as .mc/bindings. Every time it accesses it, it sets up the sharing, adding this infamous user None with special permissions and this file becomes read-only for MC.

PS While writing this post, I have found that you can get a Midnight Commander’s subshell working under Cygwin – you have to explicitly enable the subshell support via parameter (even if it is a default):

#&gt; mc.exe -U

Flex debugging session is stuck at the loading stage (IE only)

August 2nd, 2008

I’ve found that when you start debugger from Flex using IE, in most of the cases the debugging session is stuck at the stage when Flash Player shows Loading/Initialising progress bar.
I can’t recall this happening in the Firefox. I still have got intermittent problem with debugging in both browsers but at the later stages, when I load and initialise dynamically SWFs and loading/screen update is stuck.

To overcome this I used to a trick: right-click to get into the Flash Player menu -> click “Play” to shove the debugging session. Sometimes it worked, sometimes it was crashing in the guts of the SystemManager. So I had to restart the whole thing all over again.

It is appeared that the culprit for this freezing is an Anti-Phishing filter.
As soon as added my sites to the Trusted domain and in the IE settings disabled the anti-phishing filter it immediately stopped doing this nasty thing.

svn: This client is too old to work with working copy; please get a newer Subversion client

July 11th, 2008

I’ve bumped into this problem again – Subclipse was refusing to do anything (Share the project, update, commit, etc) with the source files.

It is appeared that the culprit was a Tortoise SVN – it is already built on subversion 1.5, while Subclipse is using 1.4.x.

The problem appears everytime when you do anything using newer client, like Tortoise SVN.  Newer client  leaves a different footprint, so Subclipse is getting upset with that fact.

To overcome the problem I’ve added subversione client into the Cygwin port – it is still some relatively old version (1.4.6-3). Then I checked out the project via cygwin version of svn.

It also helps when only a part of the source tree is damaged by a newer client, so you can simply overwrite these bits from an tree checked out using older version.  Just be sure to copy modified files to some safe location first.

UPD  The final solution is to upgdade to Subclipse >=1.4.2 as it is using Subversion 1.5.x. The problem will be completely fixed.

To do this you have to simply add new remote site in Eclipse:
Name: Subclipse 1.4.x (Eclipse 3.2+)

and remove the old one which refers to Subclipse 1.2.x.

The full installation instructions could be found here: