Is this your first visit? You may want to subscribe to the feed.

Articles tagged with mac

Site-specific app for Rails docs

Unless you’re a Rails genius, you probably need to frequently reference the Rails API docs. And if you haven’t discovered it yet, railsapi.com is awesome.

John Nunemaker suggested that I create a site-specific browser and point it to a local copy of the docs from railsapi.com. I did and have been loving it, so I’m suggesting that you do it too.

Download Fluid (or the comparable app for your platform if you’re not on a Mac). Then download a copy of the docs from railsapi.com and create a new app pointing to that local copy.

Better yet, head over to railslogo.com and grab the Creative Commons licensed logo to use as the icon.

Now my only complaint is that I don’t have docs for Ruby and other gems in this app, but I have a hunch that it won’t be long until that changes.

Code: mac May 05, 2009 ● updated May 06, 2009 4 comments

Network Time Machine backups to another Mac

For a while now I’ve been wanting to setup Time Machine on my MacBook Air to backup to the external drive plugged into my Mac Mini, but one thing has been stopping me: transferring 80GB over wifi. I’ve tried it a couple times and even after 24 hours it’s nowhere near done (Time Machine slowness + wifi slowness = double slowness).

I also tried getting an initial backup by plugging the drive directly into my MacBook and then moving it back to the Mini once it’s done. But Time Machine stores network backups differently than it does if the drive is plugged in locally. When backing up over a network, it creates a sparse bundle disk image.

So last night I finally tried again and got it to work. The trick was to start the backup over the network which sets up the sparse bundle, and cancel it shortly after it started. Then when I plug the drive directly into my laptop, Time Machine is smart enough to see the sparse bundle and use that.

Here’s the recipe for getting network backups to an external drive started without doing the initial backup over the network:

  1. Share the drive: With the backup drive still plugged into your host Mac (not the one that needs backed up), share the drive by going to Sharing in System Preferences. Enable file sharing and add the drive to “Shared Folders”.

  2. Start the network backup: First, you need to enable backing up to “unsupported” network volumes (a.k.a. ones you didn’t shell out extra money to apple for). On the machine you want to back up over the network, open up terminal and run:

    defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

    Now, go to Time Machine preferences and you should be able to select your shared drive should appear in the list of disks.

  3. Cancel the backup: After the backup is done preparing and starts copying data, cancel it.

  4. Attach drive directly: Eject your external drive from the host machine and plug it directly into the machine you want to back up. There should be a file on it titled [machine-name]_[MAC-address].sparsebundle. Make sure there is NOT a folder in Backups.backupdb with your machine name. I believe Time Machine will try to use that if it exists instead of using the sparse bundle.

    Now go to Time Machine preferences and switch your backup drive to the local drive. It should run a full backup now using the sparse bundle.

  5. Switch back to network backup: Move your drive back to your host machine and switch Time Machine preferences to use the network disk. Sit back and enjoy network backups.

This worked for me. Let me know in the comments how it works for you.

The network backups have been working great so far. I closed my laptop while a backup was running this morning. When I opened my laptop back up on a new network, it complained that the network connection had been lost to the backup drive, but as soon as I got home this evening, the backup started again immediately.

Code: mac Jan 14, 2009 ● updated Jan 14, 2009 8 comments

Bending iTunes to my will with RubyOSA: take 1

A couple months ago I expressed my frustration about iTunes not letting me move podcast files into my library. Several people commented with suggestions, such as converting the ID3 tag to an older version, re-importing the track, and then converting the ID3 tag back to 2.4. This is definitely better than the solution I had found, but still a pain.

I tried to find a scriptable solution, but iTunes doesn’t expose, though AppleScript, the ability to change the ID3 tag version or the mystical ID3 tag attribute that tells iTunes that it’s a podcast.

So, I’ve turned to Ruby. Though a little introspection and experimentation with ID3lib-ruby, I’ve figured out that it is the CTO (Content Type) ID3v2 tag set to “Podcast” that iTunes is using to put the files in the Podcasts folder. Clearing the CTO tag and readding the track in iTunes will move it into the Library.

So, with RubyOSA, I’ve written a little script that will loop through the selected tracks in iTunes and clear the CTO ID3 tag.

require 'rubygems'
require 'rbosa'
require 'ID3lib'

itunes = OSA.app('itunes')
itunes.selection.get.each do |track|
  if track.is_a?(OSA::Itunes::Track)
    location = URI.decode(URI.parse(track.location.__data__('furl')).path)
    tag = ID3Lib::Tag.new(location)
    tag.content_type = nil
    tag.update!
  end
end

There are a few remaining problems that I would like to tackle:

  1. I can’t figure out how to delete and add the track through RubyOSA. There is a delete method on the track, but doesn’t appear to do anything.
  2. I want the script to display a dialog confirming the actions about to take place.
  3. I want to be able to execute the script from the Scripts menu in iTunes, which appears to involve installing OSA Components.

Overall, this has been a fun experiment (and a reason to play with RubyOSA). I’m looking forward to Leopard when this is all built in!

Code: mac Jun 30, 2007 ● updated Jun 30, 2007 3 comments

Firefox + Mac + Flash + CSS opacity = peek-a-boo

I came across a fun browser bug this morning that I thought I would share. You can’t have a semi-transparent element cover a Flash animation Firefox on the mac.

I had a popup menu that used CSS opacity to make the menu semi-transparent. It was working fine, but then we threw in a Flash header and the Flash would hide any time you moused over a menu item.

Here are some screenshots that demonstrate the bug. The first is how it looks in Safari, the second demonstrates the bug in Firefox, and the third shows Firefox if I remove the opacity attribute from CSS.

Menu in Safari

Menu in Firefox showing bug

Menu in Firfox

The solution: for now, I’ll just have to live without semi-transparent menus (but they looked so good).

I would venture to guess that this is intentional behavior by Firefox. Since Firefox isn’t a native Cocoa app, it doesn’t have access to all the fancy OS X rendering, so it can’t render transparent elements over elements that it doesn’t have control of (Flash), and it just removes the Flash.

Code: mac Apr 26, 2007 ● updated Apr 26, 2007 12 comments

Creating encrypted Zip archives with OS X

Sadly, OS X Tiger doesn’t come with a way to create or open encrypted Zip archives, even from the command line (hopefully this will change with Leopard if you have Leopard then you can skip the MacPorts part and just use the command at the end). The man pages for zip say that it supports it, but when you pass the -e or -P option, it complains:

zip error: Invalid command arguments (encryption not supported)

Fortunately, MacPorts (formerly DarwinPorts) to the rescue! There’s a version of the command line zip utility in MacPorts that works as advertised.

Install MacPorts, and install the new command line zip utility:

sudo port install zip

Move the old /usr/bin/zip out of the way, and then create encrypted Zip archives to your hearts content.

zip -re myarchive.zip mydir/
Enter password: ********
Code: mac Apr 08, 2007 ● updated Feb 04, 2009 5 comments

An extra GB makes all the difference

When I bought my MacBook Pro back in March (wow, I’ve been a Mac user for almost a year now), I was cheap and just went with 1GB of RAM. I’ve never really had any issues with performance until lately, when I’ve been needing to do more intensive tasks like working in Photoshop, using Aperture, and testing in IE (via Parallels). Running any one of those apps required closing pretty much everything else.

So Last week I ordered an extra GB of RAM. It finally arrived today, so I installed it and have been doing a bit of informal testing. For the record, 1GB of RAM makes a HUGE difference. I was able to open Photoshop, Aperture and Parallels at the same time, and the performance was better than it was before with just one of them open.

Code: mac Feb 24, 2007 ● updated Mar 20, 2007 2 comments

Using GPG on OS X

I’ve been posting a lot about GPG and public key encryption lately, so I thought I should at least give some pointers for how to set it up on the Mac. This post is based off of directions written up by Daniel Morrison and Matt Slack, so kudos to them.


Getting up and running with GPG on the Mac is quick and very easy. Everything you need is available from the Mac GPG project on sourceforge:

  • GNU Privacy Guard (currently version 1.4.1) installs the command-line tools.
  • GPG Keychain Access is a simple GUI for managing and creating keys.
  • GPGPreferences is a System Preferences panel for managing GPG from the GUI.
  • Optional tools such as GPGFileTool (encrypt/decrypt files) and GPGDropThing (drop text to encrypt/decript) are available at the project page

After you have those installed, you need to generate a key pair. Open GPG Keychain Access and select “Key->Generate…”. Of all the options you are presented with, the only one you should need to think about is the key size. While 1024 is secure, 2048 or 4096 are obviously better. Larger sizes can slow you down if plan to encrypt large files, but are unnoticable for email. Note: the larger the key, the longer it will take to generate (one-time process only), so go grab a cup of coffee if you do 4096, unless you have a shiney new MacBook.

Install plugin for Mail Clients

Plugins for your mail clients will allow you to encrypt, decrypt, and sign messages in Mail. Since email is (probalby) the reason we want GPG, it makes a lot of sense to install them.

If you have commercial PGP installed it is best to uninstall before installing an email plugin. Apple Mail, for example, will not work with both. You can uninstall just the PGP email plugin by deleting it from your /Library/mail/bundles directory.

Use It!

What’s the point in having it if you aren’t going to use it? Upload your public key to one of the key servers. Get your friends and coworkers to generate public keys and start sending eachother secure mail (if you don’t have any friends or coworkers, feel free to download my public key and send me an encrypted email).

Code: mac Jul 17, 2006 ● updated Dec 01, 2006 2 comments

Adobe Photoshop CS2 hosed my partition

I’m reinstalling OS X right now. 2 hours and 7 minutes remaining.

My (new) MacBook Pro started acting up this afternoon, so I did the only thing I know how to do on the Mac—I rebooted it. Bad idea! It wouldn’t start back up. It just sat there taunting me with the apple logo and the little spinner, trying to make me think it was actually doing something. I gave it a hard reset and started it in verbose mode (command+v). After a bunch of startup messages, I was greeted by the following message scrolling up the screen…repeatedly…indefinitely.

hsf_swap_BTNode: invalid forward link (0x08003003)
node=220 fileID=4 volume=Macintosh HD Device=/dev/disk0s2

I don’t exactly know what it means, but can’t be a good thing. The only reference to any part of that error is from a C source file hsf_endian.c, which appears to be some low-level filesystem driver.

After many failed attempts with the Disk Utility reporting “Underlying task reported failure”, I discovered fsck_hfs from the bottom of this article. I ran it with -r to rebuild the catalog, and many runs later, it finally reported no more errors. I rebooted again, only to find that OS X still wouldn’t boot up.

I then came across this article about the Disk Utility error I was getting, with this notice:

If you have Adobe Photoshop CS2 or Adobe Illustrator CS2 installed, try removing the following files:
  • /Applications/Adobe Photoshop CS2/Legal.localized/Tiếng Việt.html
  • /Applications/Adobe Illustrator CS2/Legal.localized/Tiếng Việt.html

Ironically, I was running Photoshop CS 2 when I first started having problems. A little more searching revealed this forum discussion about Photoshop CS causing filesystem errors. Most the people there seemed to have more luck than I did, because there systems at least still booted. Fortunately, I just did a full backup of my home directory two days ago, and I was able to copy new files from the last two days from the console on the Installer.

update: Since OS X makes it so stinking easy to install over the top of an existing installation, I’m back up in no time (well, two and a half hours, but you get the point). Now, do I install Photoshop CS2 again?

Code: mac Jun 29, 2006 ● updated Dec 01, 2006 0 comments

The Apple Experience

At the end of March, I paid $2499 plus tax to became one of Apple’s beta-testers. In exchange, I got a first-generation MacBook Pro.

This is my first Mac, and while I’m hooked on Apple software, it has not been a good experience with their hardware and support. Within the first hour of opening up my expensive new beta product I noticed the annoying whine when the CPU was idle and the excessive heat. Over the past few weeks, I’ve had a few more unpleasant surprises. The finish on the palm-rest has slowly started flaking off. At first I though it was just dirt, but then I realized that it was indentations, and rubbing it with my hand made it worst. Not long after, a rattling noise began coming from one of the fans. Annoying, but not consistent or too loud, I decided to put up with it—mainly because I didn’t want to go without a laptop notebook for 10 days.

The latest trick my expensive beta product performed is that with about 40% battery left, it just shuts off (unfortunately, I discovered this after working on a design in Photoshop for an hour and a half without saving it).

So this week I finally called Apple support, and after explaining all my problems to two different people—and two hours later—their conclusion was to just take it to the Apple store where I purchased it. Thanks, you could have told me that in the first 15 minutes.

So last night I went in to the Apple store (40 minutes away) and told them of my troubles. The Mac genius recommended that we send it in for repair and it would be back as soon as next Friday. That’s what I expected, but that sucks! I asked if there were any other options and told him that some of the blog posts that I read that said that some of the Apple stores where just doing exchanges for these problematic MacBook Pros. He said he couldn’t do that and that they don’t even have the a matching configuration.

So, as he was filling out the stuff to send my computer in for repair, I pulled out the trump card. I started telling him about how this is my first Mac and it hasn’t been a great experience. I told him about Dell’s support and how whenever I called or emailed them with a problem, they would show up at my house the next day with the replacement parts and fix it for me. A few minutes later, he asked me to wait and he’d be right back.

After being gone for about 10 minutes, the genius came back out and informed me that Apple really wants to make sure that I have a good experience, so they’re going to exchange my faulty laptop with a new one. And since they don’t have the same configuration, I get bumped up from the 2.0GHz model to 2.16GHz. Sweet!

So, even though Apple’s support sucks, the story still might have a happy ending. I’m going to pick up my new MacBook Pro when the store opens this morning.

Code: mac Jun 22, 2006 ● updated Dec 01, 2006 1 comment

Subscribe

Browse by Tag