Header Image - charles newman's blog

Mac OS X – “The operation could not be completed because the item is locked”

by Charles Newman

Have you ever gotten this annoying message while emptying the trash from the Finder menu:

The operation could not be completed because the item is locked

When I first started using a Mac, I would get this message, say a bad word, and then go hunt down the file and do a “chmod” on it or unlock it via Cmd-I in the Finder.  Then I discovered this:

Hold down the option key as you select “Empty Trash” from the Finder menu and OS X will delete the locked files without annoying you.

Taking Screenshots in Mac OS X

by Charles Newman

I can never remember these for some reason, but I seem to need one of them every 6 months or so:

  • Command-Shift-3: Take a screenshot of the screen, and save it as a file on the desktop
  • Command-Shift-4, then select an area: Take a screenshot of an area and save it as a file on the desktop.
  • Command-Shift-4, then space, then click a window: Take a screenshot of a window and save it as a file on the desktop.
  • Command-Control-Shift-3: Take a screenshot of the screen, and save it to the clipboard.
  • Command-Control-Shift-4, then select an area: Take a screenshot of an area and save it to the clipboard.
  • Command-Control-Shift-4, then space, then click a window: Take a screenshot of a window and save it to the clipboard.

Flex – Bindable Array Problems

by Charles Newman

Generally, it is not a good idea to bind to an Array object because Flex can’t detect changes to the array. So if you are dynamically adding items to your Array, you probably won’t see the changes at run-time.

I’ve found two workarounds for this:

1) Use an ArrayCollection. Not as fast as Arrays, but bindable at least.
2) Create a temporary array and assign it at run-time to your bound array.

Flex Builder 3 General Tips and Productivity Enhancers

by Charles Newman

Show all shortcut keys:
Cmd-shift-L (Ctrl-shift-L on Windows)

Hide SVN files in the Flex Navigator view:
Click on the down arrow in the upper right corner of the Flex Navigator view and select “Filters”. Click the last check box “.*”. Click OK.

No need to type “mx:”
Just start typing the tag name you are looking for and then select from the code hinting list, the “mx” prefix will be added for you.

Change case
Cmd-shift-x (Ctrl-shift-x on Windows) to change to upper case, Cmd-shift-y to change to lower case.

Find matching brace
Cmd-shift-P (Ctrl-shift-P on Windows) to find the matching ActionScript brace.

Go to an object’s definition
Click on a variable, hold down the Cmd key (Ctrl key on Windows, maybe) and click when the underline appears.

Pop up the AsDoc entry
Select an mx tag, hit shift-F2

Sending Trace Statements to a log file with the Debug version of the Flash Player

Sometimes it’s more efficient to “tail -f” a log file rather than set breakpoints in your authoring environment. This is kind of an “old school” technique for Flash developers and was absolutely necessary for debugging ActionScript “back in the day”. But today this is still a very valuable debugging technique, especially if you are debugging a timing issue.

To do this you need to create a file called "mm.cfg" in the following location:

Mac:
/Library/Application Support/Macromedia

Windows 2000/XP:
C:\Documents and Settings\username\mm.cfg

Windows 7:
C:\Users\username\mm.cfg

Add the following lines to the file:
ErrorReportingEnable=1
TraceOutputFileEnable=1

Load your swf with trace statements and in the following location you should (eventually) see a file called “flashlog.txt”:

Mac:
/Users/yourname/Library/Preferences/Macromedia/Flash Player/Logs

Windows 2000/XP:
C:\Documents and Settings\username\Application Data\Macromedia\Flash Player\Logs

Windows 7:
C:\Users\username\AppData\Roaming\Macromedia\Flash Player\Logs

For up-to-date locations of the mm.cfg, the log file, and other properties you can set in the mm.cfg file see this page from Adobe.

 

”’Not Working?”’

If you are having problems getting the player to write to flashlog.txt, make sure you have the debug version of the player installed, you can get Flash Player versions here:

http://www.adobe.com/support/flashplayer/downloads.html

Check your "mm.cfg" file: make sure it is in the correct place and if you created it with TextEdit for example, make sure it has no RTF stuff in it (open it with "vi" in a terminal window).

Helpful tip:

You can also watch the log file via the Mac OS X Console app. Windows users can search Google for a utility called “WinTail” which gives you “tail -f” functionality in a command window.