Archive for August, 2009


Coda and the Economy of Motion

Within the last year and half we’ve seen the introduction of a new text editor for Mac called Coda. Built by the guys at Panic up in Portland, it’s more than a text editing environment. Coda includes the ability to edit text files as well as having a command line editor integrated in it, the ability to use Books, which are built in references for scripting languages, guides and so on. Coda includes a powerful model for taking care of bookmarks that includes a preview pane of a website, unlike some FTP clients that only show a favicon for the site (I’m also talking about Panic’s Transmit here).

I’ve been keeping Dreamweaver CS 2 around strictly for editing tables, about everything else I code by hand This was also useful so that I could continue to use Lasso Studio on projects that had hundreds of fields per table and still have some sense of manageability with them without having to edit the table code by hand. It’s possible that I have reached the time to ditch it. I haven’t even checked into a CS4 upgrade.

Coda embodies the economy of motion for an IDE (integrated development environment), short of adding code folding I can’t really think of any improvements. This year BBEdit and Coda both added Lasso Syntax highlighting, which is my preferred language (Lasso allows you to build applications against a myriad of datasources — in one website — truly king of mashups), and while BBEdit and Coda both allow multiple files to be open in one pane Coda goes several steps further.

Coda consolidates all the actions developers previously had done separately, I.E. using an ftp client, a command line editor – or CLI for short, and a file browser and navigator, into one handy interface.

Sites are configured in coda’s main preference page in an easy to view array of thumbnails where the slider adjusts their size. Sites have preferences for local and remote filepaths, support for SFTP, and svn as well. I wish the guys at Panic would add support for git but with the git-svn module, it’s not really needed. I’ll be presenting at the Lasso Developers Conference in Amsterdam in October of this year on managing workflow within Coda and on versioning control systems.

I’m going to just get to the meat of why I love Coda. I rarely have to touch the mouse. If you’ve read my page on the economy of motion and our workflow practices you understand that, like Victor Wooten, I don’t want to be wasting time with a lot of superfluous hand movement. 15,000 switches between keyboard and mouse ever day is a waste of motion.

Here’s how my set up works. I usually will have several windows open in Coda. One window is always used as a browser, I have .me mail, gmail in this so I can keep only one app open on my machine at a time (white lie, I usually have Adium and Skype up also) and several other windows with different sites. Usually there is a main site I’m developing on and one or two others that are at or near launch that have small five minute maintenance things being done in them. I can use – ~ to toggle through these until I get the one I want.

Within these windows I have one window for each workspace I’m working on, usually this is one per client but some clients have multiple sites so I won’t draw that parallel. I have the /etc/hosts file configured on my Powerbook with local development domains like etc. This allows me to toggle between the code view and the preview mode with two keystrokes – 2 and – 3. I can also navigate through tabs with the – shift – [ and – shift – ] combos, the same as safari or many other tabbed applications on Mac.  For those of you who still want to use a browser instead of the preview pane in coda don’t forget that you can toggle – tab to move between apps.

My specific setup involved two terminal tabs, a preview tab and five or six code tabs. When working with a framework it’s not easy to use preview as you may be working on an OOP module or something else that does not directly relate to a single page. The two terminal tabs allow me to make commits and pushes to my git repo locally and deploy on the server when I need to by doing a pull.

As a best practice I try to code for longer and longer periods without refreshing the browser or the preview pane. This is a principle of the economy of motion as well. Do not waste time refreshing your browser 20 – 30 times an hour to check small changes. Code a substantial amount, then review, make notes for changes and then review again. Don’t develop this bad habit or if you are doing it stop now. Additionally don’t fall into the trap of making commits with every small change to your version control system. Commits are for substantive points of change in an application and represent points where forks, reviews or other activities need to take place and when combined with test driven or test-first development, need only be done when working tested code is ready to be added to the repository.

If you follow these tips and start to practice the economy of motion in the keyboard usage it can only make you a better, more productive developer.

For more on Coda read Gruber’s review of Coda on Daring Fireball.


FileMaker and AppleScript – Using FileMaker to Build Glueware Applications Part 2

200908142352.jpg Now that iCal is launching from within FileMaker we’re going to move on from just compiling a simple launching script to actually getting iCal to work with the text fiel that we are exporting from Billings.

Lets see how in Billings we need to export the time slips for the range we are working with. Go into the left pane (under projects) and click on the “All Slips” icon. Once the slips show up on the main window select the range that need exported and select File > Export > Export Slips to Text

I have not seem that Billings has an Apple Event for this. To check this you can launch the Script Editor and drag the application icon (from the Applications folder) to the dock ONTO the Script Editor icon to reveal the dictionary. Alternatively with Script Debugger you can explore the dictionary in a more robust manner.

Once this has happened you should have a new text file in the export location, it will have a filename with the following naming constraint: “project name – working slips.txt”. If you open this up you will see the following format for these items, a tab delimited file with the first row named after the fields from the SQLLite database table that Billings uses as the column names.

I’ll share a little trick here that I use to manipulate text all the time with BBEdit. You can use this whenever you have a need to transpose data from a horizontal to a vertical format or vice versa.


Cut and paste the first row of the timeslips export file to a new BBEdit document, You can do a find and replace on the tab characters as shown above and you can move them to a vertical notation as shown below:

Create Date
Start Date
Due Date
Complete Date
Round Time

Alternatively if you want to create the table for FIleMaker that the solution will need to use, drag and drop the .txt file on filemaker, make a new database and then copy and paste the table (if you have FileMaker Advanced) into your existing solution or use the new file as your starting point.


Notice that I’ve added a _Published flag to differentiate the extra field I created from the ones matching my solution. You can also see immediately that these text fields are holding some dates that are formatted in an ANSI standard that is a little different than what FIleMaker Pro uses for it’s date and time fields. Im going to create some extra calculation fields to handle this. I want to, however, try to find some open source custom functions that will help with parsing the dates. To do tis I turn to Brian Dunnings’ site for a list of custom functions.

I quickly found what I wanted here with this one:

Timestamp ( GetAsDate ( Middle ( DateTime ; 6 ; 2 ) & "/" & Middle ( DateTime ; 9 ; 2 ) & "/" & Left ( DateTime ; 4 ) ) ; GetAsTime ( RightWords ( DateTime ; 1 ) ) )

It seems to work great so I set up the rest of the fields I need:


Go ahead and complete this by creating an import script to import the text file, adding in all the usual stuff that you need for an import by deleting the records in this table (which we’re going to use as a temp table or a staging table) so that you have a clean set each time, and adding another script step to delete the first row since this will be the header field names.

In the next example we’ll look at how to continue with the mashup and automate it.


Tire store post on Remote Desktop w/ popcorn.

Probably there’s no better time to blog that sitting in the tire store. While I sit waiting for a brake inspection on the LandCrusier I’m looking at I thought I might as well throw down on a secret leopard tip I just discovered. Just let me finish my popcorn first…

When you have been a sysadmin for a while you start to accumulate a lot of timbuktu and vnc as well as remote desktop sessions to all the servers and networks that are managed. When you’ve been doing this ten years, like I have that list can start to get pretty long.

Fortunately, Apple has included a simple way to initiate these sessions. We’ve all become aware of the new feature of iChat that allows screen sharing between machines, but did you know that this is available in a separate application inside Leopard? It’s a little app called screen sharing located in:


If you launch this little app you get the following window, which will allow you to start a screen sharing session with any Apple server you manage or any client with remote access enabled.


Here’s where the trick comes in. You can bookmark these sessions in Safari with a url like the following:



200908120916.jpgJust remember to bookmark the url before you hit the return key! You can then build a nice little list of machines to manage in the bookmarks in Safari and not have to worry about launching remote desktop everytime you need to tweak a machine somewhere else, and for those of you who don’t want to have to shell out $500 for Remote Desktop, it’s even better.

I think they are almost done with the brake inspection, and I need another bag of popcorn now ;)


git rm -r –cached

When removing several items from a git repo, especially if you have deleted them through the operating system, you won’t have the time or the inclination to remove them through multiple single statements. Your friend here is to wildcard the directory in the git rm statement using –cached. Yes that’s a double dash, but wordpress shows it as one.

Consider the following in a ‘nix system:

sudo rm -R images/*

This would remove all the files in the images directory. Similarly in git this command:

git rm -r images/.

This would remove all the files in the images directory using git. What you want here is to be able to only remove the items from the git repo that have been staged for removal by having removed them from the command line or gui environment. Use this:

git rm -r --cached images/.

This has the added benefit of staging the remove for the upcoming commit. If you have the git coloring enabled like in this example on the git-svn crash course site, you’ll see the files move from a red coloring to a green coloring. This can be a handy way to determine what changes have been made. Just run the git status command in between stages until you are comfortable with how they change.

git status

To enable coloring run these commands. Note that these are per repository and do not take effect for the whole machine. If you pull a repo for another machine you will need to add them to the preferences by running them for that machine’s repo instance

git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto


Error: Twitter did not respond. Please wait a few minutes and refresh this page. motion