Hooray [Flex Builder] Snippets! (Follow-up)

UPDATE: I gave up on using the CFEclipse plugin a while ago mainly due to it’s inoperability in MXML files and have switched to using Sourcemate; The templates feature is pretty much everything i could ask for and it’s loaded with a ton of other great features. With Sourcemate and the Flexformatter, I’m pretty pleased with my IDE setup but I’ve been meaning to check out FDT now that it has progressed significantly.

I really love the CFEclipse snippets feature that I mentioned in my previous post. It is exactly what I’ve been after for quite a while. The snippets are stored as simple XML files in a folder in your workspace, which makes them really easy to edit and move from one workspace to another.

Insert ActionScript Header
Insert top-level ActionScript header.


Oh, and get this! You can specify that a snippet as a class template, and then you can use it to create new files that are pre-filled with the syntax you want. Hot damn! I remember digging through a ton of folders in the FlexBuilder plugin trying to figure out how to customize the default ActionScript class template. The interface for creating a new class from a template is a little strange since you have to browse to the package in which you want to create the class and explicitly specify the class name and the file name. But still…

As far as sharing snippets via SnipEx, it’s not quite what I had hoped for. SnipEx is a ColdFusion application that allows you to share your snippets with others. There is a public repository at http://www.cfsnippets.org/ that you can use if you don’t have access to a ColdFusion server where you can install the application. The CFEclipse plug-in offers an “Export to SnipEx server” option, but it’s not yet compatible with cfsnippets.org. :(

Mrinal Wadhwa and I talked briefly about teaming up and cranking out a bunch of useful Flex Actionscript and MXML snippets and posting them to cfsnippets.org, but the disappointing thing is that I can’t figure out how to pair a remote snippet with an abbreviation the way you can with your local snippets. Because of that, I’m not sure if it’s worth the effort to post to cfsnippets.org, but I’d be happy to zip up my snippets folder and share it with anyone who’s interested.

Perhaps my favorite feature about this plugin is that it intelligently indents multi-line snippets. All other solutions I’ve worked with screwed up the first line if you were trying to indent it at a level other than the one it was created at. Props to CFEclipse for figuring this one out.

The variable support is what other text expander are really lacking, and I’m really impressed with the implementation of it in CFEclipse.

Read more about some of the things you can do with your snippets here.

Posted in Flash | 7 Comments

Hooray [Flex Builder] Snippets!

I just came across Lee Brimelow’s tutorial for using the dynamic snippets feature of CFEclipse. His step-by-step walk though guides you through installing the CFEclipse plugin and setting it up to work with ActionScript files. He’s explaining how to do it in the context of a Flash project, but it works with any text file that you’re editing with in Eclipse.

The feature is less like the WST Snippets feature that you can install as described here and here, and more like how TextMate or TextExpander expands short text abbreviations. Really, this is a much better solution, in my opinion. The WST plugin requires that you browse for a snippet and then interact with a rather kludgy interface to enter the values you want for the variables. Also, the WST Snippets seem a little volatile. I found myself losing snippets anytime something happened to corrupt my workspace.

I’ve been using TextExpander for the last week or so, but found it somewhat limiting when it came to inserting complex snippets, like say a getter/setter block. There was no support for passing in any variables (other than what was on your clipboard), and even specifying where the cursor should end up after pasting the snippet was pretty weak since it didn’t just jump to the location but rather slowly backed up until it go where it was supposed to be.

With CFEClipse, your snippets can contain as many variables as you want, which you are prompted to insert when you paste the snippet. It even allows you to specify the default value for the variable. I’m thoroughly impressed… this is just the sort of thing I’ve been looking for.

I literally just installed this 5 minutes ago (and it only took a minute to set up), but it looks like there’s some sorta of snippet sharing feature via something called SnipEx. I’ll dig into this and share my snippets with everyone if I can. I typically use snippets for getters/setters, varying levels of comment headers, and common function declarations like the one used to override updateDiplayList.

Posted in Flash | Tagged , | 1 Comment

Center Adobe AIR Window

I always end up digging around in past projects for this snippet, so I’m putting it here for safe keeping, and maybe it’ll help you out too.

public static function centerWindow(win:WindowedApplication):void
   var screenBounds:Rectangle = Screen.mainScreen.bounds;
   win.nativeWindow.x = Math.floor((screenBounds.width - win.width)/2);
   win.nativeWindow.y = Math.floor((screenBounds.height - win.height)/2);

The real trick here is that you have to call this on creationComplete instead of one of the other events that seems like it might work like applicationComplete. A callLater() couldn’t hurt either. ;)

Posted in Flash | 2 Comments

Using p4merge as a git mergetool

So, don’t get me wrong, I hate Perforce. It actually makes my head hurt a little remembering my experience with it. The only saving grace was the Perforce merge tool, p4merge. There are number of different diff/merge tools that will work with git on OS X, but I’m not all that impressed with them — even the rather expensive Changes left me feeling underwhelmed.

Perforce Visual Merge Tool

Perforce Visual Merge Tool (shown on Windows)

After figuring out how to configure git to use Changes as its merging and diff tool, I set out on a mission (read: Google search) to figure out how to use p4merge instead. It turns out it’s pretty simple, but that all the pages with instructions on how to do it no longer exist.

Here are the steps to get it working:

Download and Install P4V

Download the free Perforce Visual Client dmg from here. Once it’s downloaded, copy p4merge from the disk image to your /Applications directory.

Write some simple shell scripts


Create a new text file in /usr/local/bin called p4merge and add the following lines:

/Applications/p4merge.app/Contents/MacOS/p4merge $*

Make the script executable by entering this command:

chmod +x p4merge


Create a new text file in /usr/local/bin called p4diff and add the following lines:

[ $# -eq 7 ] && /usr/local/bin/p4merge "$2" "$5"

Make the script executable by entering this command:

chmod +x p4diff

Configure Git to use the scripts

Open your git configuration file (probably ~/.gitconig) and add these lines:

	keepBackup = false;
	tool = p4merge
[mergetool "p4merge"]
	cmd = p4merge "$BASE" "$LOCAL" "$REMOTE" "$MERGED"
	keepTemporaries = false
	trustExitCode = false
	keepBackup = false
	external = p4diff

Use it!

That’s it. Now when you run git-mergetool or git-diff the visual Perforce merge tool will launch with the files you want to merge or diff. Hope this helps!

Posted in git | 19 Comments

Repeater width? Really?

So, I came across a weird bug in a project that I’m working on where I’m getting a flicker when transitioning between children within a view stack.  On each child in the stack I’ve specified a hide and show effect so that when I switch from one to the other, the existing view slides out and the new one slides in.  I have this functioning perfectly fine on 4 other sections of this site, but on one particular section where the views are dynamically created from an XML file, I’m getting this flicker.  The existing view slides out, then I see the new view for just a split-second already in its end position, and then I see it slide in.  I was able to identify that this was what was happening until i set the duration on each transition to something like 1000ms so that everything was slowed down.  The flicker only occurred when a view was loaded for the first time. I tried a couple of things like changing the value of suspendBackgroundProcessing from true to false, and changing the creation policy of the view stack.  Nothing seemed to make any difference.  Then, for whatever reason, I decided to try setting the width of the repeater that’s dynamically adding the views to the view stack and it fixed it.  I don’t get it, but whatever, it worked.  It makes no sense why a Repeater component even has a width and height property, or why setting it would fix this quirky glitch.  My only guess is that somewhere in the measurement routine is getting hung up when it encounters a parent component that doesn’t have a width and it’s spitting out a NaN which equates to 0. Shrug.

Posted in Flex | Comments closed

If you're going to write a book…

I highly recommend that you write it with a friend.  Sometimes the only thing that keeps me writing is the guilt I feel knowing that Juan is working and I am not.  Well, that and emails like this:

Posted in Flash | 7 Comments

Another Comparison of GTD systems

Check out this post by Ian Beck, the guy that put together the Things screencast and TagaMac.  The post is full of great info on most of the available GTD applciations available for Mac, and the rest of his blog is outstanding too!

Posted in General | Leave a comment

Things vs. OmniFocus

I woke up last Saturday morning to find that the OmniGroup had finally opened a public beta of their long-awaited OmniFocus application. Oh, man, I was excited! OmniFocus is designed to be a GTD (David Allen’s Getting Things Done) trusted system for collecting and organizing your tasks so you can, um, well, get things done. The teasing screen-casts and feature lists have made it look like it’s going to be way better than the current version of iGTD, or any other GTD tool available right now. I sent out half-a-dozen emails to friends to tell them the great news, then watched the latest screen-cast before anxiously downloading the app. I spent an hour or so manually importing all of my tasks, projects and contexts from iGTD. It was a little tedious, but what a refreshing way to interact with my tasks! It has a nice clean interface, reasonably intuitive input methods, and a few new powerful paradigms (which we’ll get into later). It doesn’t get any better than this… or does it?

A week later, a friend and co-worker announced via Twitter that he was going to start messing with iGTD and learn that until he could get his hands on Things. What the hell is Things, I thought? I googled and found this beautiful CulturedCode website. How could I have missed this? My heart sank. I’d just spent the last week falling in love with OmniFocus, and now here’s this sexy young Thing flirting with me, and testing my loyalty. While no one was looking, I clicked the Get Preview button at the top of the page. The link merely took to me to the bottom of the page where I could enter my email address and be among the first to try the upcoming beta once it’s available. Damn it. Then I found the Things screen-cast. I watched skeptically, hoping to find some fatal flaw in Things so I could rest easy knowing that OmniFocus was still a superior solution; hoping not to see a slew of Things-only features that I’d be dying to try, thus starting another long wait for a beta release.

Obviously, I was biased, but I did indeed find [what I thought to be] a fatal flaw in Things. Where the hell are contexts?! The guy on the screen-cast seemed to spend an awful lot of time organizing his tasks into projects (cool) and areas (huh?), and then dragging them around and prioritizing them into today, someday and postponed categories. I am not a GTD expert, but this doesn’t seem very GTD to me. When I create tasks with a GTD system, I very rarely enter due-dates, let alone start-dates. I create them and assign them a context. That way when I’m in that particular context I can figure out what I should be doing Right Now, not Today, Someday, or Maybe Never. The more I thought about it, the more worked up I got. I thought maybe I had incorrectly assumed that Things was a GTD tool, when actually it was intended to be just a killer to-do list application. I restarted the screen-cast, and listened closely. Dude definitely said "GTD". Hmm…? Am I missing something? I emailed CulturedCode and diplomatically explained my concern about there seeming to be no support for contexts, and too much emphasis on prioritizing tasks.

I got a very prompt response from someone named Jürgen explaining that Ian, the guy that did the screen-cast, is not a typical GTD user, and he agreed that the screen-cast put emphasis on certain aspects of Things that might be misleading. He further explained that the using the Today list is optional, but provides a way for people (like him) with a ton of to-dos to some broad-sweep prioritization. That’s cool, I can dig that. In my email to him I asked if users were expected to "create a notion of context using the tags in Things". His response really cleared things up, so here it is:

If you are just using contexts then you can simply think tag = context. You don’t have to ‘"create a notion" of contexts using tags. It just works like contexts should work. But if you are interested in implementing what David Allen describes in Chapter 9 "Doing: Making Best Action Choices" then you can do that as well. In Chapter 9 he describes the "Four-Criteria Model for Choosing Actions in the Moment". Those criteria consists of "Context", "Time available", "Energy available", and "Priority". The beauty is, you don’t have to use those. There is no input form that requires you to enter such stuff, no empty columns when you don’t. But these options are readily available if the user so desires. In that respect, I think we are even closer to the book than many other apps, but we let users decide whether they want to make use of those options.

At this point, I’ve calmed down from when I wrote the email and would be feeling like a bit of a jerk for sending it, except that along with his response, Jürgen also sent me an invitation to the pre-release beta. Sweet. I replied to Jûrgen to thank him for the clarification and the pre-release invitation, and told him I’d be happy to manage two GTD systems in my ongoing quest to find the [near] perfect trusted system.

So, I’ve told you all of this to share with you my experience of OmniFocus vs. Things, now that I’ve used them both.

And in this corner…


  • Things is not done. I mean, OmniFocus isn’t either, but Things isn’t as far along as OmniFocus (I don’t think).
  • I’ve only used Things for a couple of days, and OmniFocus for a little over a week, so I haven’t had a chance to touch all the features of either system.

Round 1: Creating/Editing Tasks (in the application)


Adding new tasks in OmniFocus is a lot like creating an outline using OmniOutliner (go figure). It’s like you’re creating a to-do list as a single document, which makes sense, but this actually feels really strange to me. Pressing Cmd+N creates a whole new OmniFocus window, not a new task, which was really confusing. Instead you press enter while one task is focused to create another. There’s not a really intuitive way to just say "create new task". Also, one way to remove a task is by deleting all the characters in the description (as you might expect you could do if you were editing an outline), but it’s really easy to push delete too many times and delete half the description of previous task. You can also remove a task by selecting the task, and pressing delete. The trick here is selecting a task without also focusing the description field (it depends where on the task your mouse is when you click). If the description field is focused, pressing delete will just backspace the characters in your description. All in all, I found entering tasks in OmniFocus to be rather kludgy; not better than iGTD, just quirky in different ways.


Hey, this makes sense! Cmd+N gets me a new blank task or I can click a New Task button at the bottom. Once I fill out the mini task form (which appears right inline), and press return, I get another blank task. Cool. It was so much easier to migrate all of my tasks into Things than it was into OmniOut…err OmniFocus. To remove a task, I click on it (anywhere) to select it and press delete, or drag it to the trash can. To edit it, I double click it and I get the same mini form I got when I created it. Simple.

Winner: Things, obviously

Round 2: Creating New Tasks (with quick entry)

While iGTD had QuickSilver integration, both OmniFocus and Things have their own globally accessible quick entry dialogs.


With OmniFocus you can create more than one entry at a time. Type in the description, and optional context and project, press return and you’ll get a blank line on which you can create another task. Create as many as you’d like, and then click save (or press Cmd+S) to save them and close the window. This is pretty slick. If you don’t like having to save, you can adjust the OmniFocus preferences so that return also invokes save. But, beware, if return invokes save, there’s no way to enter more than one task in the quick entry dialog, at least not that I can figure out.


The Things quick entry dialog looks nicer. It’s stylized more like what I might expect a HUD to look like, and not just another system-chromed window. But, it only lets you enter one task at a time. You get to choose where your task goes: inbox, project, etc., which is pretty cool, I suppose.

Winner: OmniFocus, multiple tasks at once is pretty handy.

Round 3: Organizing Tasks

A mile-long to-do list is intimidating, it’s good to keep them organized.


Tasks in OmniFocus either live in your inbox or in your library. It’s as simple as that. Your library can subdivided using folders and projects. Folders can have other folders or projects. Projects have tasks, which can have sub-tasks. Suffice it to say you can go wild here organizing your tasks. A project is only a project if it lives in your library. As far as I can tell, that’s the only thing that distinguishes it from a task with sub-tasks. I had to mess around a bit before I came up with a good system for my stuff, and found myself wanting to add sub-projects to projects in the library, but having to use folders instead. Also, getting a hold of a task and dragging it around to the correct project or folder or whatever, is sorta tricky… it’s another symptom of the document-ness of the lists… it’s way to easy to select and focus the description field. I find myself clicking-and-holding the check box on a task so that I can get a hold of it, which is really counter intuitive.


Things lets you put tasks into projects or areas [of responsibility]. I didn’t understand this at first, but then I realized I had effectively tried to use the notion of areas of responsibilities in OmniFocus. I had created some projects in a folder called "Personal" that are kind of on-going projects. Projects like, finance, household, travel, etc. This is exactly what areas are for. Projects can then be assigned an area of responsibility, though I really had to hunt around to figure out how to do this. You have to click on top-level Project link under Organize. From there you can drag the projects into an Area. I’d love to see a more discoverable way to do this. Maybe there’s an inspector for a project that allows me to choose what area it belongs to.

Winner: Things, while not as powerful, I find the simplicity of this refreshing. I was having anxiety with OmniFocus because I could have organized my tasks hundreds of different ways.

Round 4: Assigning Contexts, Priority, Energy available, Time available

Tasks are more useful with some important meta-data


OmniFocus comes with several pre-defined contexts, and I only had to add a couple to suit my needs. It supports nested contexts, which I find really handy. Many of my tasks classify as errands, but some of them are specific to a certain store (usually Target). With OmniFocus I can assign somethings to Errands and some to Errands:Target. If I’m going directly to Target, I’ll just look at what’s in Errands:Target, but if I’m going out to run errands, which might include a Target run, I’ll check out everything in Errands. Assigning these context to tasks with the auto-complete gadget in OmniFocus is a breeze. Nice work guys! Now, what about the other stuff like priority? Well, I can flag a task, but I don’t see support for much more. Admittedly, I don’t often use any thing other than context, though I messed around a bit with priority in iGTD.


Jürgen told me that tag support was developed for Things so that we could assign context, priority, energy available, time available, or any combination thereof. If you don’t use some of these, don’t use ‘em, and they’ll never be there to bother you or clutter your interface. That sounds sorta nice, right? I’m not so sure. You can have nested tags in Things, which is sorta like nested contexts in OmniFocus, but that structure doesn’t live through the rest of the application. For example, when I choose a tag for a task, there’s no indication that Target is a sub-tag of the Errand tag. Weird. There is also no differentiation between a priority tag and a context tag. Maybe I got carried away when I defined my contexts in OmniFocus but I like the work flow it afforded me. I’m still not sold on tags for everything. It feels a bit too one-size-fits-all for me.

Winner: OmniFocus, even though it doesn’t support stuff other than context, I like it being more structured

Round 5: Doing Something

When I’m not capturing tasks, I use a GTD system to figure out what I should be doing, naturally.


OmniFocus has introduced an idea I’ve never seen in a GTD system. There are two discrete modes in the application: one for planning and one for doing. I actually like this. In the doing mode, I see a hierarchal list of my contexts, and I simply choose the context I have access to right now, and look at what I should be doing. If I select the Errands context, I see a list of my general errands and the items in my sub-contexts of Target and Safeway. If I click on Target, I see my Target errands. OmniFocus fell short in the last round in being able to prioritize things, but once I have a list of things to do in a given context, I can do some quick ad-hoc prioritization… though, it might be nice to do a little more with the items in the list. I guess I could flag them.


I’ll tell you right now that Things is going to lose this round. The only place I can see a comprehensive list of my tasks is to select the Next focus, and I only see them all here because I’ve not moved any of them into a different focus like Today or Someday. When looking at the list in the Next focus, my tasks are sub-categorized by project and areas, but not in a way that I can distinguish projects from areas. "Send out christmas cards" is a project that in an area called "Friends / Family". The tasks within it show up under the Send out.. project, and not in the Friends/Family area. I’m so confused. Ok, forget it, seeing a comprehensive list isn’t really what I want to do right now anyway, I want to see what errands to run. I guess the only way to see tasks with the errands tag is to use the search input. I type in "errands". I see things I’ve tagged errands, but not my Target or Safeway tasks. Apparently giving something a tag does not implicitly assign it the parent tag of the one I just picked. Weak. Forget that too… I’m going to Target and then to Safeway. Crap. I can’t enter more than one tag in the search field, and if I could, I wouldn’t know if it would show me tasks that had both tags or had one or the other. I can’t really trust that I’m seeing enough tasks here to make an informed decision. This seems like a fatal flaw.

Winner: OmniFocus, far from perfect, but at least I can see the tasks I so painfully entered previously.

The results

There is no winner here, which sucks. One system does well what the other one doesn’t, at least for how I want to use a GTD system. I guess I’ll keep tracking them both. Just between us, I’m hoping that Things shapes up and costs less than $80. It’s got a lot of potential, and a better icon.


Things does show a bit of support for the nested tag structure when you select tags from the tag bar instead of searching for them.  This more or less enables the work flow I was hoping for.  Also, I set it up so that all my context tags are prefaces with an @ symbol, so that they are distinguished from priority or time/energy available. And, I’m using a naming convention for my nested contexts that makes it so I can search for them… my Target errand tag now looks like @Errands:Target.

Posted in General | 21 Comments

SVN does not work with Pages documents

Something relating to the structure of the Pages file, and it being a “package” and not an actual binary file makes it so that version controlling it with SVN doesn’t work.  You can check it in and out, but as soon as you open it again, it overwrites some meta stuff that SVN wrote inside of the package, and will no longer play nice.  I thought I’d save you the trouble in case you were considering co-authoring a book with someone and considering SVN as a good way to collaborate.  I knew we wouldn’t be able to “diff’ the files or anything, but I figured we could at least be able to intelligently handle the case when we both worked on the same chapter with out the other person knowing it.  Looks like we’re going to use FTP, and come up with some convention for checking stuff in and out.  Meh.

Posted in General | 5 Comments

Discovery Cancer Collage demo @ MAX 2007

Check out our own Anthony Franco discussing and demonstrating Discovery Channel’s Cancer Collage with Adobe’s Julie Campagna:


Posted in Flash and Flex, General | Leave a comment