Auto Answer FaceTime Call | When FaceTime was introduced by Apple the first time, I was thinking, it can be ...

Use Automator to quick edit "hosts" in Mac OS X

Sunday, May 24th, 2009

A web developer often edit hosts file for developing use. In windows, you can create a shortcut to use notepad to open and edit the hosts file. In Mac OS X, I like using Spotlight to quick open the stuffs I want. But the hosts files is hidden by default and can not be found in Spotlight. So I use Automator to triger TextMate to open hosts file for editing.

Here's what I did in Mac OS X 10.5.6:

  1. Open Automator
  2. In Library of Automator, choose "Get Specified Finder Items" in "Files & Folders" category. Drag it to the right panel.
  3. Open Finder, select "Go -> Go to Folder..." from menu (or use shortcut key "CMD+SHIFT+G"), input "/private/etc/". You can find "hosts" file here. Drag it to Automator, the file list area in "Get Specified Finder Items".
  4. In Library of Automator, choose "Open Finder Items" in "Files & Folders" category. Drag it to the right panel. Choose the application you like to open the hosts file. As to me, I chose TextMate.
  5. Click "Run" button on the top right to test it.
  6. Save it as application in "Application" folder.

This works alright in 10.5.6. But I just upgrade to 10.5.7 a few days ago and I found that it does not work. When test run, the automator can find out the file but cannot open it, even after I repairing the disk permissions. Then I changed another way for step 4 here:

4. In Library of Automator, choose "Run AppleScript" in "Utilities" category. Input following lines:

on run {input, parameters}
tell application "TextMate"
open input
end tell
return input
end run

Test run and bingo!

A few tips for Mac OS X

Sunday, March 15th, 2009
  • Q: When save Automator as a plug-in for Finder, where on the earth is it?
    A: Find it here "~/Library/Workflows/Applications/Finder"
  • Q: How can I get the full path of a file as soon as possible?
    A: Use AppleScript + Automator in this way. Or install the contextual menu plugin below.
  • Q: I want more handy commands in mouse right click menu?
    A: OnMyCommand is exactly what you need. Though it's somewhat complicated, there are already a bunch of ready-to-go commands for beginners.

Mac widget Currency Converter error

Tuesday, March 10th, 2009

We are experiencing the most serious financial crisis since the Great Crash of 1929. So WHOSE fault, when $1 does not worth $1 any more?

Mac widget Currency Converter error

Okay, I'm sorry for bluffing. First, we might meet currency deflation not inflation, second, it's all about a bug of Mac OS X build-in widget.
After upgrading to OS X 10.5.6, this widget does not work right.
To fix this problem, make a copy of /Library/Widgets/Unit Converter.wdgt on your Desktop, Control-click on it and choose Show Package Contents from the pop-up menu, then open the UnitConverter.js file in a text editor. Search for "USD" (with the quotes). There should be only one matching line:

if (a.iso == "USD") return -1;

Delete this line. Then, delete the else at the start of the next line, i.e. change the line from this...

else if (a.name < b.name) return -1;

...to this...

if (a.name < b.name) return -1;

Save the changes and close the document. I suggest keeping the original widget in /Library/Widgets, and installing the corrected version in ~/Library/Widgets, so that the system's version remains untouched.

The solution was found here:

http://www.macosxhints.com/article.php?story=20090225162441861

Easy way to sync iCal with google calendar

Monday, February 16th, 2009

Google Calaboration for iCal

You can add google account in iCal to sync the calendar. Previously you have to do that manually by a few copy and paste steps, really boring. Last night I found google had released a tool named Calaboration on December 9th last year, which is tiny but easy to use. Simply login with your google account, it will show the calendar you have. Check the ones you want to sync with iCal and click "Add to iCal" and it's done.

Note that the calendar with a lock after it, is read-only. For example, the calendar shared to you by your friends. You can change the setting in preference if it can be ADDED into iCal, but you can not modify it in iCal(either in Google Calendar of course).

Download it here.

I decided to add Chinese version of each post from today. Have to remove to avoid unwanted ads.

Reason of Apple Mail starts automatically

Monday, February 16th, 2009

Previously I met the problem that the Apple Mail application starts automatically. I tracked the history for a few days and now I find out the reason. Here under is my analyze:

  • There was no sign that the Apple Mail run in a fixed frequency.
  • The chance of virus is slim too. Because virus often hides itself when doing anything bad like sending email to all contacts. And in another hand, OS X is much safer than Windows at present and no too much virus is reported so far.
  • It could be triggered by some application that I had to find out.

So I check the system log in Console. I found out an error of iCal occurred at the same time that Mail run. When I look into the details, yes, it was there, iCal called a function to run Mail to send a email out. Since I have never set up an account in Mail, it pops up an notice to let me set one. The log also recorded what kind of mail iCal wanted to send. Then everything is clear: I sync the iCal to my google calendar, my google calendar has a series of email reminders to send to myself. While google has it's own mechanism to send them out, iCal uses Apple Mail.

This is just a specific problem. But the way of wisely using the Console and tracking down the history is the key to find out the reason for most problems.

You see, there is only one constant, one universal, it is the only real truth: causality. Action. Reaction. Cause and effect.

-- The Matrix Reloaded

Mac OS X Mail application starts unexpectedly

Sunday, February 8th, 2009

Updates: Reason has been found here.

The Mail app started itself unexpectedly just now (2009-02-08 at 1:15 am). I remember this is the second time in 24 hours. Generally, if any mail application starts, it means a email link has been clicked to trigger it, or something strange behind the scene is using it.  I did not set any account in Mail. The application just notifies me to setup one when it starts. Good side is nothing to lease out. Bad side is I'm not sure what is going on. So I put a note here to remind when it happens again. It is said that Mac OS X is a very safe operating system. I hope it's not a virus but a mis-clicking on email link by myself. - Update on 2009-02-13 at 0:00 The mail application started itself again. - Update on 2009-02-13 at 23:51 Started again. - Update on 2009-02-16 at 0:02 Again 2/13/09 12:00:03 AM Mail[1674] DeliveryAccounts are missing. Trying to restore from backup. (null) 2/13/09 11:50:02 PM Mail[686] DeliveryAccounts are missing. Trying to restore from backup. (null) 2/16/09 12:02:00 AM iCal Helper[328] CALScriptUtils error: send_mail_sbr /System/Library/Frameworks/CalendarStore.framework/Versions/A/Resources/iCal Helper.app/Contents/Resources/Scripts/Mail.scpt ( "Alarm - \U884C", "February 18, 2009 : \U884C", "username@maildomain.com", "" ) |  { NSAppleScriptErrorAppName = Mail; NSAppleScriptErrorBriefMessage = "AppleEvent timed out."; NSAppleScriptErrorMessage = "Mail got an error: AppleEvent timed out."; } 

Use BlackBerry as bluetooth modem in Mac OS X in China

Sunday, January 25th, 2009

Use BlackBerry8100 as Bluetooth Modem
After trying over and over again, I finally succeeded to set up BlackBerry bluetooth modem in Mac OS X. In fact, there are already several articles talked about this. I just made it work in China Mobile network.
This article is for those who:

I tested it in MacBook aluminum, OS X 10.5.6, BlackBerry 8100 (ROM version 4.3)
The basic configuration is described clearly here: How do I use my Blackberry Pearl as a bluetooth modem with a Mac?. It should work well when you use T-Mobile or Cingular.
If you are in China and using China Mobile, here are some settings you should change:

  1. Open the file BlackBerry 8100 or BlackBerry 8300 in the /Library/Modem Scripts/ folder with text editor. Find out "ATDT*99***1#" and replace it with "ATDT*99#" then save the file. Or you can simply download the file I made, unzip it and put it into the folder I just mentioned.
  2. In "System Preference => Network" panel, use "cmnet" as the Telephone Number, Account Name, Password.

The step 2 wasted a lot of my time. Because in windows, there's no need to set a user name and password when dialing. Before filling the two blanks in OS X, I thought failure of connecting was caused by some other reasons.

Auto scroll and capture the whole web page in Mac OS X

Tuesday, January 20th, 2009

In Windows, HyperSnap could help auto scroll the window and capture the whole web page. The Mac OS X build-in software Grab can not do this. After googling, I found out this software Paparazzi! really helps.

Paparazzi!

Mac OS X:Delete strange file in trash

Friday, January 2nd, 2009

Strange File In Trash This file with strange file name has lived in my Trash for over a month. I finally get rid of it today.

It's caused by the FAT32 partition for Windows. I booted Windows and deleted the files in the hidden directory "C:\.Trash" and similar folders. Then the problem is solved.

iriver E10 icon for Mac OS

Friday, November 7th, 2008

iriver E10

I just know how the icons in Mac OS work. 1st, The resolution is higher than Windows, as high as 512x512; 2nd, there are several different size of images in the icon file (format: .icns). That's why the icons look so nice, even when zooming. I just tried to make one by myself. I drew iriver E10 with Fireworks and converted it to icon for Mac OS use. Click the image above to download it.