Finding Related Messages in Apple Mail

After migrating my company’s email away from Gmail a few years ago, I’ve become firmly entrenched with Apple’s Mail.app on the desktop. Everything works great, but I do miss having access to Rapportive’s Gmail extension. It’s great at providing extra information related to the person you’re emailing with. To make up for this lack of functionality, I’ve created a quick AppleScript that automatically opens up a new Mail window and finds any previous conversations I’ve had with the sender. I use it all the time whenever a customer emails so I can quickly see any past conversations.

I’ve built the script into an Alfred workflow that lets me run it via a keyboard shortcut. For Alfred users, here’s the workflow. And the raw AppleScript is below for those of you using FastScripts or some other script launcher.

Remember to Backup

I’ve written twice before about how important it is to have reliable, automatic backups running on all of your machines. I’m especilly thankful for mine this weekend.

After travelling for the American holiday, I returned home to find my iMac in an unbootable state. I’m not sure what happened exactly — all I could tell is that a hard drive error occurred around 3am one night, corrupting the system. Disk Utility, which often works magic, couldn’t fix the error. But, not to fear, four hours later Time Machine had me back up and running exactly where I left off.

The best part of the whole situation is I was never once worried. Between Time Machine, Dropbox, Backblaze, and GitHub, I knew all of my data was safe.

I can’t encourage you enough to take a moment right now during this holiday weekend and make sure your backups are in place and working. (Make sure you test them, too! A backup you can’t recover from does you no good.) And, if they’re not, take my advice and set them up now.

A Big Mouse Cursor

I spend about ten hours a day staring at two 27-inch Apple cinema displays. It makes coding great. But, with that much screen real estate, I keep losing my mouse cursor. I’ll have to jiggle it around for half a minute trying to find where it’s disappeared to.

No more!

Yesterday I discovered OS X has an option in the Universal Access Preferences pane that lets you adjust the size of the cursor from normal all the way up to holy-gigantic. I have mine set to a comfortable 33% — which is just big enough to keep from getting lost, but not so large that I can’t tell where I’m clicking.

I haven’t misplaced my cursor since.

Posted in Mac

Syncing Your Adium Chat Logs into Dropbox (again)

Two years ago I posted some quick instructions on how I keep my Adium chat logs synced between Macs using Dropbox. I’ve tweaked my setup slightly since then. Here’s my new approach.

First, if you already have Adium on multiple machines, copy all your logs over to a single Mac. You can merge the folders easily with an app like Changes. Once you’ve got a canonical folder of all your combined chat logs, place it somewhere in your Dropbox. Then…

cd "~/Library/Application Support/Adium 2.0/Users/Default/"
mv Logs ~/Desktop/LogsBackup
ln -s ~/Dropbox/Path/To/Adium/Logs/ Logs

Repeat the symlink steps on each Mac you want to sync.

This new approach keeps your files physically in Dropbox and a symlink in your Adium support folder pointing to their real location.

And that’s it. Enjoy.

(Really though, this would be a lot easier if Adium had an option to choose where your chat logs are stored.)

Posted in Mac

Search Mac and iOS Documentation From Chrome’s Omnibox

Earlier this week, the Chromium Blog announced an official extension API for Chrome’s omnibox (search bar). I’ve always loved keyboard driven interfaces — the command line, [Quicksilver](http://en.wikipedia.org/wiki/Quicksilver_(software)), Alfred, etc — so, I immediately started thinking about what I could build with it.

My first idea was a documentation browser for Apple’s Mac and iOS libraries. I’m always googling for class and framework names as a way to quickly jump to Apple’s documentation site. The problem is that many times the developer.apple.com link is buried down the page, which means I waste time scanning for the link rather than just hitting return for the first search result.

This extension solves that problem by allowing you to type “ios” or “mac” followed by a keyword. It then presents and auto-completed dropdown of matching search results which take you directly to the relevant page on Apple’s documentation site. Here’s a screenshot after typing “ios UIImage”

Sample iOS Chrome Search

For those among you wondering how I’m searching the Apple docs, I caught a lucky break. Apple’s Mac and iOS reference site includes a small search box that autocompletes your queries. I tried sniffing the network traffic to see what web service they were using for suggestions (hoping to hook into that myself) but found they were showing search results without sending any data over the wire. A little more digging and I realized they were pre-fetching a dictionary of results as a giant JSON file on page load. With that data — and a sample Chrome extension courtesy of Google — it took no time at all to connect all the pieces and get the extension working.

If you’d like to install the extension, just click here for Mac and here for iOS. You’re also welcome to download and improve the code yourself from the GitHub project page.

How I Backup my Mac

Four years ago, on another blog, I wrote about my file backup strategy — everything I use to keep my data safe. A lot has changed since then. CD’s and DVD’s have fallen by the wayside, raw hard disk space has gotten insanely cheap, and online storage has finally taken off in a big way. At the prompting of a friend, I thought it might be fun to revisit the topic and show — four years later — how my backups have evolved.

Previously, my backups were done piecemeal with all of my data segregated into groups depending on priority and size of the data. Movies and music went here, documents there, email someplace else, etc. It was largely due to time, available storage, and cost. But now that storage is cheaper and I’m a little bit richer, I feel completely confident in my backup plan in any situation.

Time Machine

With external hard drives costing well under $100, there’s no reason any Mac user shouldn’t be using Time Machine. My 1TB iMac (where I do all of my work) is connected wirelessly to a 1TB Western Digital World Edition which plugs in directly to my router via ethernet. The drive appears as an AFP share in Finder, and Time Machine has no trouble backing up to it.

I used to backup to a network attached Drobo (see my review here), but every time a backup would start the Drobo would slow down, causing video on our home media center (Mac Mini + LCD TV + Drobo) to stutter. It’s worth noting that this was a first generation Drobo — the new ones are probably better.

Time Machine has saved my butt a bunch of times. Twice I’ve done full system restores, but much more often I find myself going back in time to retrieve a lost file or an earlier version.

So that’s my first layer of protection. Time Machine offers full system recovery plus the added bonus of incremental file versioning in case my hard drive dies or I do something stupid.

SuperDuper!

Next. I have two 1TB Western Digital Studio drives. These things are crazy fast since they connect directly to my Mac over Firewire 800. Of course, only one is connected at a time. The other stays locked safely away in my bank’s safe deposit box. Every morning, at 5am, SuperDuper! does a full, bootable system clone to the connected drive. And twice a month I swap the one at home with my duplicate off site.

With a local Time Machine copy already in place, why do this one? A few reasons.

First, in the event of a disaster or robbery, I have a backup stored elsewhere I can rely on. It may be two weeks out of date, but it’s certainly better than nothing. Second, having a bootable backup means no downtime. Zero. In the event of major data loss, if my Mac’s hard drive is unusable, it’ll probably take five hours to restore from Time Machine. But what if that drive is actually broken? How long would it take to purchase a replacement drive and install it? If you do it yourself, maybe a day. But if you have to rely on an Apple warranty repair? Possibly a week. With a bootable copy, I can be back online and working in five minutes. I work from home 100% of the time — I can’t afford any downtime. This keeps me covered.

Oh, and for those who are extra curious, I have the following cron job on my Mac:

{% highlight bash %}
00 05 * * * /usr/sbin/diskutil mount /dev/disk1s3
{% endhighlight %}

Because I don’t like having my backup drive plugged into my system 24/7 (it slows down Open/Save dialogs whenever it has to spin up), I keep it unmounted. That cron script automatically mounts it every morning at 5am. When that happens, SuperDuper! automatically launches and performs a backup and unmounts the drive when finished.

One last bit of esoterica: if the drive unmounts and SuperDuper! quits after every backup, how do I know it actually ran each morning? Simple, I configured SuperDuper!’s Growl settings to leave a “sticky” notification on screen when done. That way I have a message waiting for me each morning telling me if the backup finished or failed.

Backblaze

As mentioned before, my SuperDuper! copies give me an offsite backup in case of catastrophe, but they could be up to two weeks out of date. Backblaze solves this by keeping an always up-to-date copy of my data stored online in their cloud. It’s a simple Preference Pane that runs in the background. Once you get through the initial backup process (took a full week for me), your data is always backed up with negligible network and CPU usage for only $5 per machine. It really is an excellent service and excellent software that, unlike many of their competitors, feels like a first-class citizen on your Mac.

So, if my house gets swept away in a flood (which it nearly was), what happens? Well, for $99 Backblaze will overnight me a DVD of my data. If that’s not large enough (which it isn’t), for $189 they’ll overnight an external hard drive containing everything. Sure it’s pricey, but this is a worst case scenario. And $189 is an absolute bargain when it comes to recovering my data.

Miscellany

Those three layers of protection keep me pretty well covered from a full system perspective. I’ve got incremental backups, offsite backups, and disaster recovery backups. In addition to that, there are a few other tools I use.

All of my source code, and I mean all of it, is stored in GitHub. I used to run my own Subversion server which got backed-up nightly to Amazon S3, but GitHub’s ease of use and UI are exceptional. I’m happy to say I’m a paying customer. But that still doesn’t mean my data is completely safe. What if GitHub were to lose my code? Due to the nature of Git, I have full copies of my repositories on my hard drive — which is, of course, backed up along with everything else mentioned earlier.

Email. All of my personal and work email goes through Gmail. I trust Google up to about 99%. But there’s always 1% of me that worries they might fuck-up my data or simply lock me out of my account. So, I keep a copy of Mail running on our media center (which is backed up, too) that downloads all of my mail via POP3. The only way to lose my email is if Google fails and my house burns at the same time. I feel confident that won’t happen . . . probably.

Contacts and calendars? Synced via MobileMe of course. In case Apple screws up? I can recover via Time Machine or one of my SuperDuper! backups.

Finally, miscellaneous documents, financial records, 1Password keychains, etc. I stopped using my Mac’s “Documents” folder a long time ago. Instead, everything gets saved into Dropbox and mirrored across two other Macs and in their cloud. In addition, super important files like tax returns, warranty receipts, etc get copied into Amazon S3.

Whew

So that’s it. That’s my backup solution. It’s changed quite a bit over the last four years. Of particular note is that I’ve completely eliminated CD/DVD backups. I can’t even remember the last time I burned a disc, as everything is handled over the network now. Also, I’ve moved from backing up only the critical pieces of my system to full-on, multiple, bit-for-bit backups. Again, as storage prices have fallen, this was inevitable — and I’m so glad it’s finally happened.

So take my advice as someone who has lost and seen others lose critical data in the past. Backups aren’t something you “get around to”. They’re processes you need to put in place and do, now.

I pester a lot of my friends about this who don’t backup at all. They always say to me “Oh, I don’t really have anything important.” That may be the case for a very few people, but now that our lives are almost completely digital, there’s always something at risk. You need to take a few minutes and really think — imagine standing on your lawn at night, watching your house burn. Get past all your possessions, your furniture, your clothes, even your prized DVD collection from college and the note your first girlfriend wrote you. Where are your photos? Your home videos? Your tax returns? What about the insurance records you’ll need to start rebuilding your life? Do you even have your agent’s phone number on you?

I admit my solution may be over the top for some people, but you’re a fool if you don’t have at least one backup in place.

Sync Your Adium Chat Logs With Dropbox

Here’s a handy trick that will let you sync your Adium chat logs across multiple Macs using Dropbox. From a command line, cd into your Dropbox folder

cd ~/Dropbox

and then

ln -s ~/Library/Application\ Support/Adium\ 2.0/Users/Default/Logs "Adium Logs"

That will create a symlink from your Dropbox folder to your Adium log directory. When syncing, Dropbox will follow this link and process your chat logs as if they were stored inside your Dropbox folder.

Do this on each Mac you want to sync. I have two Macs at home and another at work — it’s worked like a charm so far. But, be sure to backup your chat logs the first time you do this just in case something goes wrong.

Posted in Mac

Forward Your Growl Notifications to Twitter

I’ve got three Macs that I regularly use. One at work, a laptop for personal use, and a Mac Mini connected to our living room TV. I use Growl on all three — it’s so ingrained in my workflow (IM notifications, new emails, background tasks) that I often forget it’s not a part of OS X.

Keeping track of notifications on your local machine is easy — they just appear — but for computers in another room (or timezone even) it becomes trickier. Growl has support for sending notifications over a network (I’ve written some PHP code to send them), but they don’t work beyond your LAN unless you want to mess with firewalls and changing IP addresses.

While that can work if setup correctly, it can be somewhat annoying. It doesn’t matter if you have broadband packages from o2 or any other ISP, it’ll still cause headaches in the end. Luckily, with a little help from Twitter, we can route around these problems.

For a long time I’ve wanted a way to receive Growl messages from any of my machines no matter where I am. A few months back I even created a (now aborted) fork of Growl that integrated with Amazon’s Simple Queue Service. It worked ok, but it was kludgy and not something that the average Mac user would want to spend time configuring.

Last night it dawned on me that Twitter was exactly the sort of distributed notification system that I was looking for. All I needed was a way to forward my Growl notifications to a Twitter account. (Or tweet them as all the cool kids say.) I did some Googling and found lots of people using Growl to show new tweets but nothing that would go the opposite direction.

So, I sat down and began looking through the source for Growl’s display plugin protocol. Two cans of Red Bull and four hours later, I saw my first Growl message appear in my Twitter timeline.

How Does It Work

Simple. Download this Growl plugin, unzip it, and double-click to install. You should then see a new style called “Twitter” under the “Display Options” in Growl.

Just fill in your Twitter username and password. You can also choose a prefix that will be added to the front of each tweet (@username for example).

A Few Examples

Growl is super customizable. You could set Twitter to be your default display style, but that would be too noisy. A better solution would be to set only certain apps to send notifications via Twitter — or only specific messages within those apps.

For example, I use my Mac Mini to download torrents using Transmission, which supports Growl. I configured Growl to tweet whenever a download completes.

My Mac at work does a full SuperDuper backup each night. I configured it to tweet whenever a backup fails.

Both of my parents have MacBooks. Even though we’re 3,000 miles apart, it’s still my job to keep them running smoothly. I setup nightly cron jobs on their machines which check for low disk space, pending Apple software updates, and other maintenance tasks that they might not think to check. Any problems are growled and posted to Twitter.

Final Thoughts

I’ve setup each Mac to send its Growl notifications to its own Twitter account. That keeps the notifications separate between machines. Then, I protect their updates (I don’t want strangers viewing my growl logs), and subscribe to them via my primary Twitter account. All of the tweets from each machine appear in my timeline.

And that’s when the power of Twitter really shines — because those updates are portable.

I can view them on the web, on my phone, I can subscribe to them via RSS, have them sent to my phone as SMS messages, or mix and mash them using any one of the many Twitter add-on services. You could even use Yahoo! Pipes to filter the messages.

My point is that by sending your Growl messages to Twitter, you’ve suddenly freed up a ton of data that had been stuck on your local machine and combined it into a portable format you can take anywhere.

Thanks to Matt Gemmell for MGTwitterEngine which does the Twitter heavy lifting in this plugin.

Download

Download Growl Twitter.

How to Stream Your iTunes Music Over the Internet

Update: Want to stream your iTunes music over the internet? Try Highwire! It streams your iTunes library and a whole lot more :-)

I keep all of my iTunes music stored on a Drobo attached to an Airport at home. This frees up valuable space on my laptop and lets me listen to it via Front Row on my TV as well. It’s a much more convenient solution all around.

The only problem is that I lose access to my music when I’m on the road or at work. I’ve seen other services or 3rd party apps that let you stream your music online. They work well enough, but I’ve always thought it silly to pay for a feature that iTunes used to have. In honor of iTunes’ new 8.0 release this morning, here’s my simple workaround.

First off, you’ll need a Mac at home with iTunes open that is always connected to the net. In my case, that’s a Mac Mini in our living room. It also needs to have “Remote Login” (ssh) enabled in System Preferences → Sharing.

Then, poke a hole in your router’s firewall to that machine on TCP port 3689. Here’s a screenshot of my router’s settings:

(Note: your computer’s IP address might be different than mine.)

Then, with that done, anytime you want to listen to your music elsewhere, run these two commands in Terminal on the Mac you’re listening with — not your Mac at home.

ssh your_username@your-home-ip-address -N -f -L 3689:your-home-ip-address:3689

That creates a tunnel from port 3689 on your local machine to port 3689 on your Mac at home. (That’s why you needed to open the hole in your firewall.)

mDNSProxyResponderPosix 127.0.0.1 squeal "My Music" _daap._tcp. 3689 &

That creates an iTunes Bonjour broadcast notification locally which points back to your Mac at home. In other words, it tricks your copy of iTunes into thinking there’s a Mac nearby sharing its iTunes library. When iTunes tries to connect, the traffic is automatically rerouted to your other Mac.

Sidenote: if you don’t have the mDNSProxyResponderPosix command installed on your Mac, I have download links at the bottom of this post.

So that’s it. No need for third party software. When you open iTunes, you should see your music library appear in the “Shared” section of the sidebar. (Much to my excitement, the newly announced Genius playlists appear as well!) You can close the Terminal window once you’ve connected to your music library. (The mDNSProxyResponder command needs to stay active until then.)

Making it Better

To speed things up a bit, I’d put those two command into a shell script and place it in your ~/Library/Scripts folder. I call mine music-tunnel. That way, you can run that one command and have everything up and running automatically.

Or, if you’re feeling adventurous, you could wrap the whole thing inside a simple Cocoa app with a nice On / Off button. But that’s a project for another day…

Downloading mDNSProxyResponderPosix

Here’s a binary download of the mDNSProxyResponderPosix command for Intel. Place it somewhere in your path. And here’s the source if you’d like to compile it yourself for PowerPC.