Wednesday, January 23, 2008

Integrating Quicksilver Actions with Stata

If you're never used Quicksilver, it's the number one freeware Mac utility for any system. I've raved about MainMenu, WeatherDock is great, iGTD is always open, MagiCal is brilliant, Menushade was in one of my first posts, NetNewsWire is indispensable, and I could go on. (I suggest you subscribe to FreeMacWare or CoolOSXApps if, like me, you love little free utilities, which seem to abound on OS X). Quicksilver gets more use per day that any of these, no matter what I'm doing. That's because it's essential a shortcut program that minimizes the keystrokes required for repetitive tasks.

I mentioned Quicksilver in my previous post on launching Stata. Let's look at what it can do with Stata:

  1. Launching applications. You can launch Stata, of course, but I almost always use Quicksilver to launch applications because I only have a laptop and hate the touchpad for mousing. Quicksilver "learns" your preferences: for example, if you type in "Te" searching for Textwrangler, the first thing that pops up might be TextEdit or Terminal. However, if you select TextWrangler a few times in a row after typing in "te," the program will adjust and start making TextWrangler the first icon that pops up.

    You don't have to wait for the program to adjust, you can directly change the default as well. Say I want Stata to be the first thing that pops up when I type "s". Currently it's Safari:

    S command in QS

    I can change it directly in quicksilver:

    Change QS default

  2. Navigating folders: I find Quicksilver faster and easier than Finder for file navigation. It's also far easier to use mouse-free. Here's an example: suppose I'd like to e-mail the .dta file to a colleague for analysis. In quickilver, it's just a few keystrokes:

    I press "st" and navigate down to my Stata folder, instead of the Stata app:

    Picture 2.jpg

    I press the right arrow and the contents of this folder are displayed:

    Picture 4.jpg

    Right arrow again, and I see the contents of this subfolder. Here's the file I'd like to e-mail:

    Picture 5.jpg

    I press tab and select an action. I could open this file in Stata, show it in Finder, or move it to the desktop. But I'm selecting "Email to..."

    Picture 6.jpg

    Finally, I press tab again and type a few characters of the colleague's name and their email pops up:

    Picture 7.jpg

  3. Open a file in a non-default application.I have my computer set up so all .do files open by default in Textwrangler, my preferred editor. However, obviously sometimes you want to open them in Stata. This is very simple with Quicksilver:

    Find the folder:

    Picture 8.jpg

    Navigate with the arrow keys to the preferred file:

    Picture 9.jpg

    Tab over to the action pane and select "Open with..."

    Picture 10.jpg

    Select Stata instead of Textwrangler.

    Picture 11.jpg

Additional notes on Quicksilver:

You can also tell quicksilver how "deep" you'd like to index things. Do you want every single file in every single sub-sub-folders available? I wouldn't recommend this, because it slows down the application to index all of this into its cache. You don't want every photo you've ever taken popping up when you type in "im" as the first two letters. Generally one or two levels is sufficient. This can be set in the "Catalog" preference pane.

You may also want to turn off the iTunes module. This allows you to switch to any song, but also really slows down the search and indexing since most people have thousands of songs, podcasts, and in my case, books on tape.

Tuesday, January 15, 2008

Launching Stata: Dock, Spotlight and Quicksilver

Launching Stata doesn't initially seem like an issue worthy of discussion. It's simple: you go to the Dock, and you click the icon, right? Yes. That's one way. There are at least two others. Let's review them all:

  1. The Dock:

    I like to keep the Dock hidden, and I don't use it all that much. But it's certainly an easy way to launch programs. Just mouse over to the Stata icon and click it:

    Picture 7.jpg

    If you hold down the mouse button, or right-click the icon, you get a minimal menu:

    Picture 8.jpg

    Advantages: no keystrokes; only one click required.


    Note that if you're completely mouse-averse, as I am when working with just a trackpad, you can maneuver through the Dock with the keyboard. Press Ctrl-F3 on a full keyboard or Function-Control-F3 on a laptop keyboard. This activates the Dock:

    Picture 9.jpg

    Now you can just use the arrow keys to move down to Stata. This functionality is built into Macs for accessibility reasons (I think) but it obviously can be helpful at other times. However, it's too many keystrokes for everyday use.

    As an aside, I'd suggest Dock hiding for better concentration: press ⌥⌘D to turn on hiding. The dock re-appears when you mouse over in its area.

  2. Spotlight: you can invoke the Spotlight menu with ⌘-space bar and type in Stata:

    spotlight in action

    Advantages: no mousing required.

    Disadvantages: I'm still using OS 10.4 and Spotlight is just too slow for application launching. It chugs when you start it up, and spends too much time finding useless files (1091 hits?).

    By the way, there are two copies of the application because I have a clone backup hard drive mounted, so Spotlight sees a copy of Stata on the backup drive as well.

  3. Quicksilver: This is my preferred method for launching Stata. Quicksilver is an amazing utility that launches applications, runs scripts, searches folders, performs basic calculations, searches the internet, opens bookmarked pages and even modifies text files. Read more about it here. I am a huge advocate of this program, it's the single most useful piece of free software I've got and that's really saying something.

    Quicksilver is invoked with Control-space bar and looks like this:

    Picture 10.jpg

    If I type in "st" then Stata will pop up, and I just need to press enter to launch:

    Picture 2.jpg

    I can also navigate through folders, and open specific files rather than just the executable. Let's look at an old log file:

    Picture 3.jpg

    We can also perform other actions on the Stata executable like Reveal, Get Info, or move file:

    Picture 4.jpg

    And Quicksilver isn't just for applications; it takes many kinds of inputs including URLs, files and text. Here's a quick way to copy a log file to the desktop:

    Picture 5.jpg

    Advantages: no mousing required; faster than Spotlight; allows for other actions on Stata executable (Get Info, Reveal in Finder, Display Path); quick file launch of logs and .do files; flexible. Disadvantages: can be complicated.

As you can probably tell, I'm very pleased with Quicksilver's functionality and I'll deal with it more in the next few posts.

Learn LaTeX Online?

This seems like an interesting web application:

If you want to "test drive" LaTex without downloading it, there is now a web application for you:

Learn and Use LaTeX Online with MonkeyTex

When I taught statistics I learned to use LaTex, a very helpful program for typesetting equations. While we used Stata for the in-class assignments, I used Latex constantly to create handouts, exam review sheets and homework PDFs. For Mac, the distribution is MacTex.

Many scholars I know also use LaTex as a bibliography management tool, though I prefer Bookends even if it's not free.

Monday, January 14, 2008

Recommended Mac Freeware: URLWell

I've already mentioned three indispensible Mac freeware programs: Mainmenu for system cleaning and maintenance, Menushade for dimming the menubar, and AntiRSI for preventing repetitive stress injuries while programming. I have also recommended freeware options for text editing, either Textwrangler or Smultron.

Another tool I use daily is URLWell:
It's a small menubar icon that allows you to drag urls in for later viewing. This is tremendously useful for things you'd like to remember, but have no desire to bookmark permanently. Here's what it looks like (it's the @ symbol):

Picture 1.jpg.

Suppose I've found a piece of software that I may want to download later. I can just add the link to URLWell by dragging and dropping:

Picture 3.jpg

Now when I click on URLwell, it has a list of all of the sites I've marked:

Picture 2.jpg

There are several nice options to clean up your list. You can export an HTML file with links, a text list, or just open all of the pages in separate browser tabs:

There are no keyboard shortcuts, which is too bad, but the interface couldn't be simpler. Urls can be dragged from other applications: I most frequently use this to move blog posts from NetNewsWire for later reading.

Apparently the developer of URLWell disappeared, much to the consternation of the Mac universe. So a kind-hearted web citizen is currently hosting a site for downloading URLWell.

URLWell link from

I'm completely satisfied with URLWell, but if you are looking for more full-featured bookmarking software, the developer of Smultron has developed a similar bookmarking program called Hallon. The advantage - or disadvantage, depending on how you see it - of Hallon is that you can bookmark anything: emails, iTunes songs, blog posts, Finder folders. That might be a little more than I need right now, though I'm intrigued by the idea.

If you're wondering about the names, Smultron means "Strawberry" in Swedish, so his other programs are Hallon (raspberry) and Lingon (lingonberry, a Scandinavian fruit you may recognize from IKEA jams).

I'm going to add a freeware link list on the side of the site. Not all of them will be Stata-related, but I think they can all be helpful to Mac users.

Technorati Tags:
, ,

Thursday, January 10, 2008

Quickly Creating New .do files with DocumentPalette


DocumentPalette is an odd little freeware utility I discovered a few months ago. It's definitely not something everyone will find useful, but it does provide a way of quickly creating a new Stata .do file without ever opening Stata or a text editor.

Document Palette allows you to define file templates that can be automatically inserted into any folder. Here's an example:

I'll define a basic Stata .do file that just runs the describe and summarize commands. file

Now I'll save that file to the desktop as

save file

Now we can configure DocumentPallete to make this this default Stata file for insertion in folders. We go to preferences:

DP prefs

We click the "plus" button to add a new file format and select our desktop file:

adding file

We specify that it's a Stata .do file and add a shortcut key (s):

DP prefs again

Now it appears in our list of file formats:

new pref pane

In a Finder window, you invoke DocumentPalette by pressing:

⌃ - ⌥ - ⌘ - N

(that's Control - Option - Apple - N)

Now we insert a new Stata .do file from the DocumentPalette menu. A transparent window pops up allowing you to insert various files in this folder::

DP in action

And here it is in Textwrangler. Notice the path is ~/Documents/Thesis revision/

new file

This may seem like a lot of work just to add a basic file template. It is, but only at the beginning. What makes it much more useful is the possibility of highly specific file templates. Suppose you're doing a lot of work with the 1975 Fraternal Order of Police Survey on Gambling Enforcement (just hypothetically speaking, of course). You can make DocumentPalette automatically insert a .do file that opens this data, opens the relevant logs, and prints some summaries.

This isn't the sort of material you'd want to write into your system .do file, because you won't always be working with this dataset. But when you are, you can add new files easily without a lot of copying, pasting or repetition.

In the next post I'll deal with a related and, I believe, far more helpful idea: defining Stata stationary in Textwrangler.

Monday, January 7, 2008

AntiRSI - Highly Recommended for Mac Stata Coders

I just recently found a piece of freeware I'll recommend to every programmer who gets glazed eyes from long stretches of coding.

AntiRSI is a simple program that reminds you to take breaks while working at your computer. There are two levels of breaks: "micro pauses," 15 second intervals that occur every four minutes, and "work breaks," eight minute periods that occur every 50 minutes. You can of course adjust how frequently these breaks happen.

It's a nice piece of nagging: if you start typing or mousing before the break is over, it starts again. You can also postpone the larger breaks if you're in the middle of something that needs to get done right. Since it's nagging my right now, I'll take a screenshot:

AntiRSI screenshot

The program is small to download ( less than 100K), takes almost no memory and does the job very well. I've noticed a difference since I installed this. Just looking away from the screen for 15 seconds frequently does wonders for shoulder cramps and eyestrain.

AntiRSI from Onne Gorter in the Netherlands - Freeware

More on Mac (and other) Text Editors

I posted a short message about this website on Statalist the other day. I got a few responses, including one from Kit Baum, a professor at Boston College and a Stata Mac guru par excellence. He suggested I add a link to the Boston College Stata text editors page, so I'm doing so, both on the sidebar and in this post:

Notes on Stata Text Editors - Boston College

If you prefer Aquamacs or Smultron to Textwrangler, there's good information here on integration within OS X. The site also contains a lot of general information if you're working cross-platform. My university - and I suspect many others - has a remote PC log-in system where you can use a client like Citrix or Remote Desktop Connect to get into a Windows or Unix system on campus. So I'm necessarily switching to Windows XP temporarily to run larger jobs (the network computers have Stata/MP, the largest version of Stata).