Tag Archives: OSX

Let the Mac Speak for Me

The Problem

I often lose my voice temporarily due to allergy. During that time, my main mode of communication is a notepad, or the electronic equivalent: Zen Brush. I was looking for a solution that can convert what I type into spoken words.

The Solution

Since I am using Mac both at home and at work, and Mac has the say command which is useful for this purpose; I decided to roll my own solution. It turned out that the solution is a very simple bash script, which I named speak4me.sh, which I saved in my ~/bin directory:

#!/bin/bash
while read line
do
    say -v Alex $line
done

To make the script executable, I issued the following command:

$ chmod +x ~/bin/speak4me.sh

Using speak4me.sh

To use speak4me.sh, from the terminal, issue the following command:

$ speak4me.sh

After that, start typing your message. As soon as you hit the return key, the script will “say” what you type. You can keep on typing and hitting return. To end the script, just type Ctrl+C.

Discussion

The script is very simple, pragmatic and free from bells and whistles, but it works the way I like it. The -v Alex part of the say command specifies a voice from Alex. OS X comes with a few voices which you can experiment with yourself. To list the voices your system has, issue the following command:

$ say -v ?
Agnes               en_US    # Isn't it nice to have a computer that will talk to you?
Albert              en_US    #  I have a frog in my throat. No, I mean a real frog!
Alex                en_US    # Most people recognize me by my voice.
Bad News            en_US    # The light you see at the end of the tunnel is the headlamp of a fast approaching train.
Bahh                en_US    # Do not pull the wool over my eyes.
Bells               en_US    # Time flies when you are having fun.
Boing               en_US    # Spring has sprung, fall has fell, winter's here and it's colder than usual.
Bruce               en_US    # I sure like being inside this fancy computer
Bubbles             en_US    # Pull the plug! I'm drowning!
Cellos              en_US    # Doo da doo da dum dee dee doodly doo dum dum dum doo da doo da doo da doo da doo da doo da doo
Deranged            en_US    # I need to go on a really long vacation.
Fred                en_US    # I sure like being inside this fancy computer
Good News           en_US    # Congratulations you just won the sweepstakes and you don't have to pay income tax again.
Hysterical          en_US    # Please stop tickling me!
Junior              en_US    # My favorite food is pizza.
Kathy               en_US    # Isn't it nice to have a computer that will talk to you?
Pipe Organ          en_US    # We must rejoice in this morbid voice.
Princess            en_US    # When I grow up I'm going to be a scientist.
Ralph               en_US    # The sum of the squares of the legs of a right triangle is equal to the square of the hypotenuse.
Trinoids            en_US    # We cannot communicate with these carbon units.
Vicki               en_US    # Isn't it nice to have a computer that will talk to you?
Victoria            en_US    # Isn't it nice to have a computer that will talk to you?
Whisper             en_US    # Pssssst, hey you, Yeah you, Who do ya think I'm talking to, the mouse?
Zarvox              en_US    # That looks like a peaceful planet.
Advertisements

Configure GUI FileMerge with the svn diff Command

The Problem

By default, the subversion svn diff command shows the differences in text mode. On my mac, I would like to the FileMerge application, which comes with Xcode instead.

The Solution

I created a wrapper to opendiff, which is in turn the wrapper for FileMerge. I call this wrapper svndiff. The README.md will show how to install and use the tool.

Backup My MacBook Pro

My internal hard drive failed recently, but because of my backup plan, I did not loose any work. Because it works well enough, I would like to share my backup plan with you. Please let me (haiv) know if you have any additional questions.

The Plan

mac_backup.png

I back up my MacBook Pro’s internal drive using two methods: clone and time machine backup. My Mac’s drive is 320GB in size, so I purchased a drive that is more than twice its size, 750GB or 1TB will do, but not 640GB. I am going to partition the drive into two separate drives: the first partition is of the same size with my Mac, and the second utilizes the rest of the available space.

Get An External Drive

I choose a 1TB Western Digital drive because it offers plenty of room and its reliability. When choosing a drive, keep in mind that the size must be larger than twice the size of your Mac’s hard drive. Remember that we are doing two kinds of backup: clone back up requires the backup drive to be the same as your original, while Time Machine requires the backup drive to be larger than your original drive. Thus, if your Mac comes with a 320GB drive, you will need something bigger than 640GB.

Partition My Drive

media_1321399243694.png

With the drive insert, I fire up Disk Utility, select my drive (1), choose the partition tab (2) and make two "Mac OS Extended (Journaled)" partitions. The first, called "mac-clone" (3) is the same size of my Mac’s drive, the second, called "mac-timemachine" (4), uses the rest of the space.

Download and install Carbon Copy Cloner

Install Carbon Copy Cloner from http://www.bombich.com

Setup Clone Backup

media_1321399747089.png

Run Carbon Copy Cloner for the first time, select the source (1) and destination (2), then optionally customize your backup (3), then click on the "Schedule this task" button to go to the next step.

Setup Clone Backup Schedule

media_1321399958570.png

Give your backup task a descriptive name (1), click on the schedule tab (2), then customize the backup schedule (3), then click Save (4)

Setup Time Machine Backup

media_1321400307737.png

Launch Time Machine from the Applications folder, then click "Select Disk" (1) to choose your backup drive. Turn on menu bar status by checking the "Show…" box (2). That’s all.

When Your Drive Failed

Replace your drive, then turn on your Mac while holding the "option" key (the alt key). Choose to boot from your clone drive (mac-clone). Then clone from mac-clone back to your internal drive. It’s that simple.

Related Videos

I have created a couple of short 2-minute tutorial videos outline various steps. Please watch, rate, and comment them. Thank you.

    [watch] Partition an External Drive for Backup
    [watch] Time Machine – How To Set Up
    [watch] Time Machine – Restore a File
    [watch] Clone a Drive Using Carbon Copy Cloner
    

 

Share Your Printer in Snow Leopard – How To

This tutorial solves the following problem: the user wants to print to a printer attached to another Mac.

Open the System Preferences

media_1252769931991.png

Click on the Apple menu at the top left corner of your screen, then click on "System Preferences"

Open Print & Fax

media_1252769994132.png

Locate and click on this icon

Turn on Sharing

media_1252770020623.png

(1) Click on the printer you want to share, then (2) Turn on the share check box.

On the other computer, add a printer and you will find this printer in the list of shared printers.

Switching Between OS X Terminal Windows

Terminal is my bread and butter at work and I usually have more than two Terminal window up side by side and switch between them. Here are some trick I learnt:

  • To switch between the windows, use Command+`
  • To jump to the first window, use Command+1. To jump to the second window, use Command+2 and so on
  • If you have several tabs (new in Leopard), use Command+Shift+[ and Command+Shift+] to jump to the previous and next tab, respectively.
  • Alternatively, you can always use the mouse to click on a window or tab to switch to it.
  • I found out this cool tip which put the focus on the window by merely move the mouse cursor to it: from the terminal, issue the following command: defaults write com.apple.terminal FocusFollowsMouse -string YES and restart the terminal for the change to take effect. Thanks to CLIX (a fantastic collection of command-lines) for this tip.
Overall, I use the Command+<number> quite often, and rarely use the mouse.