File.applicationDirectory.resolvePath – Can’t get to the relative parent

I was banging my head against a wall trying to do this in a unit test:
var file : File = File.applicationDirectory.resolvePath(“./../src/test/SomeFile.txt”);

Turns out that you can’t get to the relative parent of the applicationDirectory though. Flex/AIR has abstracted that away from you, presumably to prevent you from looking in places you shouldn’t. (Edit: I no longer believe that, as you can easily get to any arbitrary folder you want via the File constructor.) So, I just told the project to copy non-embedded assets to the output folder, and now as long as the files for my tests are located somewhere in one of my source folders, I can reference the test files I want relative to the applicationDirectory.

UPDATE: Thanks to Jijith chandran for making the following suggestion and spelling out how to use the File constructor:
You can get it using the following
[code lang="as3"]

new File(File.applicationDirectory.nativePath).resolvePath(”./../src/test/SomeFile.txt”);


Comments ( 4 )

Automatic Flex Formatting

There is a cool MXML and Flex AS3 automatic code formatter that some cool guys published on SourceForge.

I was having a hard time getting it installed the manual way, so here is the easy way:
1) In Flex Builder (standalone or Eclipse), go to Help->Software Updates->Find and Install
2) Choose “Search for new features to install”
3) New Remote Site
4) Name it whatever you want and use this as the URL:
[code lang="as3"][/code]

Now hit next a couple of times and you should see it downloading and installing. It will recommend that you restart (good advice), and then you’ll know if it installed because a) you’ll have some new toolbar buttons, and b) you’ll have a new “Flex Formatting” option in “Flex Builder->Preferences”

Good stuff!

Comments ( 0 )

To open aum.flexbuilder.osx, you need to install Rosetta.

Is anyone else getting the above error message when starting up Flex Builder on Snow Leopard? It appears to load/run just fine in spite of this warning, but it would be more fun if it wasn’t there at all…

Comments ( 0 )

Fonts not antialiased correctly in Snow Leopard?

In my ongoing saga that is upgrading to Snow Leopard (mainly so I could search in specific folders from the finder), I just fixed yet another issue: The fonts on my 26″ LG screen looked awful, particularly in Eclipse. Sure enough, there is a bug that causes Apple not to detect that my screen is capable of doing sub-pixel anti-aliasing. Luckily I found a fix on jjgod’s blog.

Run this command from your terminal, then log out and log in:

[code lang="as3"]defaults -currentHost write -globalDomain AppleFontSmoothing -int 2[/code]

Woo hoo! Text looks good again.

If people had this many problems with a Windows Upgrade, they would have been crucified everywhere. Apple botches an upgrade and it’s radio silence…

And did I mention the color profile issue? Oh yeah, after you upgrade to Snow Leopard, your screen might look washed out because they forgot to include a the right color profile for your LCD. Or, as in my case, it just looks weird and I wasn’t sure why. All I knew is that I had to recalibrate it. Even after calibrating, it still didn’t look quite right to me, so I ended up picking one of the other included color profiles and going with that.

You can read more about it here, here, here, and here.

Comments ( 0 )

More Ant/Adobe AIR/Snow Leopard fun

For some reason, after I upgraded to Snow Leopard, our builds of YNAB 3 weren’t running correctly. They worked fine from the debugger, but the builds spit out by our build machine (powered by Hudson, which rocks) weren’t functioning. Turns out that it was because my ANT script that FX2Ant was spitting out had a line like this:

[code lang="as3"]<arg value="-runtime-shared-library-path+=${PROJECT_FRAMEWORKS}/libs/framework.swc,framework_3.3.0.4852.swz,,framework_3.3.0.4852.swf,"/>[/code]

In short, my understanding is that it was attempting to dynamically load my Flex libraries. After I upgraded to Snow Leopard, I no longer had these Flex libraries cached on my machine, so it crashed on startup. Of course, since Flex/AIR/Flash has no #$@!#$ way to tell the user about an uncaught runtime error, I had to use adl to debug my air package to get to the bottom of it.

I added this line to the ant script:

<arg value=”-static-link-runtime-shared-libraries”/>

(which Flex Builder already does) and all was well again.

Comments ( 0 )

Starting Firefox in Safe Mode on Snow Leopard (Mac OS X 10.6)

According to, this is the way you start Firefox in safe mode on the Mac:

go to Utilities (in the Applications folder) and open Terminal, then run (for Firefox):
/Applications/ -safe-mode

But when I did that, I got a lot of errors:

[code lang="as3"]dyld: Library not loaded: /usr/lib/libsqlite3.dylib
Referenced from: /System/Library/Frameworks/Security.framework/Versions/A/Security
Reason: Incompatible library version: Security requires version 9.0.0 or later, but libsqlite3.dylib provides version 1.0.0
/Applications/ line 131: 457 Trace/BPT trap "$prog" ${1+"$@"}
[code lang="as3"]

But add a "-bin" to the end of the firefox command, and all is well:

[code lang="as3"]/Applications/ -safe-mode[/code]

Now I still have to figure out why Firefox won't let me click on any Windows when it starts. I think it might have to do with the new 1Password beta I just installed, but I'll know more soon.

UPDATE (9/14/09): Nope! It wasn't 1Password! (Man, I love that software.) I disabled all of my plugins and then re-enabled them one at a time, and it seems to work well now. Just another Snow Leopard fluke...

Comments ( 0 )

Building an AIR file from the command line is MUCH harder than it should be

I need to take some time to write about my saga in getting a continuous integration system set up with our Adobe AIR product (YNAB 3), but for now let me just say: Using ANT to build an AIR project is a lot more finicky than it needs to be. Why, oh why can’t I just tell Flex Builder to build my projects in headless mode? Luckily, it looks like that’s exactly what Flex 4 will offer, but until then, it’s a major pain to keep our Flex Builder projects in sync with our Ant scripts. I’ll write more later…

Comments ( 0 )

Photoshop “Not Responding”?

Yeah, I just had that happen, and here’s what I did to fix it. It was completely frozen after a couple of hours of work. Yeah, I should have been saving, but I didn’t…Anyway, what finally worked was telling Windows to restart. Lots of programs started shutting down, and then it told me Photoshop wasn’t responding…Instead of hitting “End Now”, I hit the “X” on that window and by that time Photoshop was already responsive again! Woo hoo!

I think it had to do with a ZumoDrive error to be honest, because it got responsive shortly after ZumoDrive shut down…And I’ve had Photoshop crash on me before when saving to ZumoDrive. Anyone else ever noticed ZumoDrive strangeness when working with Photoshop?

Comments ( 0 )

Making Mac keyboard Bindings Work Like Windows (Even in Firefox)

Leaving Windows

Over the past couple of weeks, I’ve been making a real transition to a Mac. When I made the transition to working on YNAB full time, I bought a Mac laptop because I knew we’d be working on YNAB 3, which is Mac compatible. Since then, I’ve been putting off actually transitioning to it. But this month I’m in Utah, and over the summer I’ll be in Buenos Aires. So it’s time to really make the transition to a laptop. I run Windows (via Parallels) on one screen, but that Mac interface is where I’m doing a lot of web surfing and Flex development.

A fair assessment of Mac keyboard usability

After about 15 years on Windows, I just can’t deal with the Mac key bindings. A lot of that is my procedural memory I’m sure. It was hard to remember to hit alt-arrow instead of ctrl-arrow to move back and forth by the word, but plenty of it is because the Mac key bindings suck. What is more common: Wanting to go to the beginning/end of an entire document, or wanting to go to the beginning or end of a line? If you answered the latter, you’re right. But according to the default Mac key bindings, home and end should take you to the end of the document. After about the 1000th time I accidentally skipped to the end of an email I was writing, I decided to stop trying to fix my finger memory and start fixing the bindings.

How to fix the bindings

Thanks to a couple of handy references I found, I discovered that it’s easy to bring the Mac keys back in line.

First, go to this lovely article on changing the Mac key bindings and follow the instructions. The file that they have you download, the DefaultKeyBinding.dict file does not include the common Windows keys for cut, copy, paste. To get that behavior, add the following lines to that file:

[code lang="as3"]
"^x" = "cut:";
"^v" = "paste:";
"^c" = "copy:";

After the file is installed, you’ll get will fix copy and paste, CTRL-ArrowKeys, home and end, and a few others.
BUT, much to my surprise, this will not not fix the keys in Firefox! To make the home, end, and word forward/backwards keys, you need Keyfixer, which is easily installed as an add-on.

Now I’m happily writing emails, coding, and even making this blog post using my familiar Windows keys. My Mac is usable again.

Comments ( 1 )

Getting a blank wordpress homepage?

In the course of programming, I seem to spend a lot of my time solving really strange errors. Although, since they’re a daily occurrence, maybe “strange” isn’t the right adjective. I started this blog in part to document the solutions I find and hopefully help other folks out.

Case in point:

Right after I install WordPress, the homepage is completely blank. The admin page is working like a champ though. I promptly view source, and I see nothing. I start thinking that maybe PHP is messed up. A bit of searching, and although I turn up some potentially helpful pages, they didn’t help me.
Then I load up trusty Beyond Compare (best program ever), and promptly see that my index.php page is bigger on the server than my local page. A quick compare shows me that something (FileZilla?) “helpfully” inserted backspaces in front of every single quote in the index.php page. I promptly re-upload index.php, and I’m reading my blog again…

Comments ( 0 )