Tuesday, May 29, 2007

Address Book Tips

Another quick post with a few tips on using the Address Book. I knew a lot of it, but didn't know about merging the cards.

I had printed an envelope to someone the other day quite accidentally, but was amazed at how easy it was.

http://www.macosxtips.co.uk/index_files/address-book-tips.html

Saturday, May 26, 2007

RubyCocoa

Just a quick note to point out that RubyCocoa has been updated. It is still probably not ready for building much production software, but it has clearly come a long way since the earlier releases. Check out the demos for examples of using OpenGL, interacting with the Address Book, wrapping WebKit, etc., all from Ruby:

http://rubycocoa.sourceforge.net/HomePage

Saturday, May 19, 2007

iAlertU

A lot of you already know about this, but I wanted to get it out here just as a convenient place to find the link again. iAlertU is on the slappingturtle.com web site.

iAlertU is a great example of synergising the parts of the Mac. It uses the gyroscope (for parking the hard drive) and any key/mouse motion to trigger it. When you run iAlertU, it appears on the menu bar. Using the remote that comes with the machine, you hold down the MENU key, and you'll get the familiar car alarm "chirp-chirp". The machine is now armed (you'll also notice that the camera turns on). If anyone (like Jay) touches it, it sounds a car alarm, blinks the screen, and snaps a picture of the perp. Closing the lid on the machine silences it, but as soon as it is reopened, the alarm continues.

To turn it off or disarm it, use the remote and hold the MENU key down again. You'll get the single car alarm "chirp", and you're back in business.

Whenever I wander away from my machine around my hot-dogging prone co-workers, or at a conference, I arm my machine now so that it causes a ruckus when disturbed.

Wednesday, May 16, 2007

The TextMate Files: Cool Snippet/bash Interaction

As you may have noticed, TextMate snippets are really just a wrapper around a bunch of serious bash-fu: most of the really cool stuff you can do in snippets is actually bash code (with some helpers). I found a great web link that offers a really good tutorial about some of the fu here, along with some of the helpers.

Here's an example of one of the helpers. The problem: I need to annotate a bunch of Ruby code in RDoc, and I want to add a link to the bottom of the RDoc in every file that points to the source directory of the file in question. But, it needs to be a relative path. There is probably some really much cooler way to solve this, but here is the snippet I created:

---
source: link:../${TM_FILEPATH/\/Users\/jNf\/Documents\/dev\/ruby\/meta-programming\///}

This says to add a horizontal rule (the "---" in RDoc), then do a substitution for the built-in TM_FILEPATH variable, substituting the full path stuff (up to the file name) with nothing. The general syntax for the substitution is ${VARIABLE/pattern/substituion}. The resulting link looks like this:

---
source: link:../16.delegation/forwarding.rb
Which is exactly what I want.

Friday, May 11, 2007

The Quicksilver Files: Clipboard History

Quicksilver plug-ins can add some cool functionality. One great one is the Clipboard History plug-in. Install it from the plug-ins page (which also allows you to set the history size via the plug-in's propteries). Then, when you invoke Quicksilver, hit APPLE-L to get to your clipboard history list. From this clipboard history list, you can paste by either using the arrow keys or using the number that shows up in the left-hand column.

One of the tips in The Productive Programmer is to use clipboard history tools so that you can start copy and pasting in batches, rather than the wrist-achingly inefficient copy-switch-paste-switch-copy-switch-paste operation most people do.

Quicksilver: just your type

Thursday, May 3, 2007

The QuickSilver Files: Quick Folders and Select All

When spelunking the file system with QuickSilver, you can use the "/" key to navigate one level down on a folder and "SHIFT-/" to back up a folder. The combination of this with smart incremental search for names makes QuickSilver more efficient than most Finder operations.

One other file/folder related trick. If you want to select all the files in a folder, navigate into the folder and hit "APPLE -A". This is the standard "select all" keyboard shortcut, but it took me a little while to realize this worked in QuickSilver too.

QuickSilver: let go

Pesky hidden files, beware

I was doing some spring cleaning on my hard drive this morning ("rm -Rf *" -- no, NOT in my home directory...). As an afterthought, I did a "ls -al" to verify that, indeed, everything was gone. To my surprise, there were a couple of StuffIt droppings left behind. ".$$ StuffIt Temp 1143648937" Big 'uns, too. Almost a gig worth of dead air. Them files needed killing.

Strange, though, that they wouldn't die. "rm -Rf *" is the command-line equivalent of "slash and burn, take no prisoners". I was the owner of the files, yet couldn't delete them. Perhaps it was a permissions problem. "sudo rm -Rf *" foiled my all-powerful alter ego, Root, as well. Apparently these files were laced with kryptonite.

The leading "." makes the directory or file hidden, but it shouldn't tattoo it to my hard drive. I'm pretty sure that it was the dollar signs that was slipping bash a mickey. Surrounding the file name in single quotes didn't help -- "rm -Rf '.$$ StuffIt Temp 114364'". Neither did letting the bash shell tab-complete the file name -- "rm -Rf .\$\$\ StuffIt\ Temp\ 114364". This was really beginning to harsh my mellow.

So, I pulled out the big guns. TinkerTool, among other things, gives Finder x-ray vision. It is, refreshingly, a free utility in a sea of $20 Mac add-ons. The very first checkbox on the very first tab of the utility is what I needed -- "Show hidden and system files". Once Finder could see 'em, Finder could delete 'em. Odd that the GUI came through when the CLI failed, but I'm not asking questions.

As TinkerTool rode off into the sunset, I heard him mutter under his breath, "I love the smell of Napalm in the morning." Me too, TT. Me, too.

Tuesday, May 1, 2007

Keyboard Access to Menus and Trays

One of the great things about the Mac is the pervasive keyboard support. When I first started with the Mac, I was kind of annoyed that it doesn't have as much consistency between applications for keyboard shortcuts, and the ALT-key combination style from Windows isn't as well supported (most applications primarily do APPLE-key combinations).

Then I discovered two key keyboard shortcuts: CTRL-F2 and CTRL-F8. CTRL-F2 sends focus to the menu, highlighting the Apple logo on the upper left-hand side. Then, you can start typing the name of the menu you want to invoke. When you hit the one you want, hit RETURN and it opens the menu, ready for more incremental search typing. This I find is even faster than the ALT-key style combinations in Windows because it is consistent across all applications (well, except for abysmally bad applications like Lotus Notes), and you can type the first part of the menu item you want very quickly. Incremental search is a powerful way to get to stuff in a very few number of keystrokes.

CTRL-F8 focuses the task-tray portion of the menu bar, allowing you to highlight some of the icons (like the AirPort icon) and turn on AirPort from the keyboard. CTRL-F8 + some arrow keys gets you into the icons that allow keyboard access.

I recently found another great use for this. I use an EVDO card for ubiquitous Internet, and I've been starting the Verizon Wireless little application to start the Internet connection. I was talking to Jason Hunter this weekend, and he just turns on the modem display (found in the standard Apple utility Internet Connect, you check the "Show modem status in menubar"). This allows me to CTRL-F8 up to the menubar, pull down the list, and get online with EVDO faster.