Tuesday, August 21, 2012

Compare two folders' contents in Terminal

You should have the need of comparing two folders in Mac.

Here is a free way to do it:

It just requires a quick trip to Terminal to put it to use. The program is called diff, and it’s quite simple to use.

Launch "Terminal" and run the following command:

diff -rq folder1 folder2

It is better to have FULL PATH of those folders. If you get use to Linux/UNIX, you will understand what I said.

This is a pretty simple command, with two command-line switches (-rq). The r tells diff to look at each directory recursively, including subdirectories. The q switch sets diff brief mode. If we didn’t set brief mode, diff would not only tell you which files are different between the two folders, but also show the actual line-by-line differences for any text files that exist in both locations but are not identical. Given that we’re just interested in comparing the folders’ contents, we don’t need that level of detail, so we’ll use brief mode to suppress it. And that’s all there is to it. Here’s how it looks in action:

$ cd phpcode
$ diff -rq comments_new comments_old
Only in comments_new: config.php
Only in comments_old: config_old.php
Only in comments_old: functions.inc

By the way, you can download a program here

Sunday, August 19, 2012

Make AFP on Centos

  1. You will need gcc and some packages/libs for building berk-db and netatalkd, like “patch” and “make”
    1. yum install openssl.x86_64 libssl-dev gcc automake autoconf GSSAPI libgssapi-devel libgssapi  libgssapi-devel krb5-devel pam-devel shadow-devel openssl-devel cracklib wge
  2. Download the latest berkeley-db 4.8 (5.0 and 5.1 did not work for me), compile and install
    1. wget http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz
    2. tar xpf db-4.8.30.tar.gz
    3. cd db-4.8.30/build_unix/
    4. ../dist/configure
    5. make
    6. make install
  3. Download latest netatalkd, compile, install and copy config files to /etc/atalk
    AFP works fine with the default configuration files.
    1. wget "http://downloads.sourceforge.net/project/netatalk/netatalk/2.1.5/netatalk-2.1.5.tar.bz2?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fnetatalk%2F&ts=1293643408&use_mirror=biznetnetworks" 
    2. tar xpf netatalk-2.1.5.tar.bz2
    3. cd netatalk-2.1.5
    4. ./configure --enable-redhat --enable-pgp-uam --enable-krb4-uam --enable-krbV-uam --with-bdb=/usr/local/BerkeleyDB.4.8/
    5. make
    6. make install
    7. mkdir -p /etc/atalk/
    8. cp -a config/*.conf /etc/atalk/
    9. chkconfig netatalk on
    10. service netatalk start
  4. When you mount this filesystem on mac, all files and directory permissions will be reset to 755, which is really annoying, specially if you use git. Git will show all the file permission changes to 755 instead of 644 for files. So, to solve the problem edit the file /etc/atalk/AppleVolumes.default and update the last line on the file
    1. vi /etc/atalk/AppleVolumes.default
        # change from
          :DEFAULT: options:upriv,usedots
        # to
          :DEFAULT: options:upriv,usedots dperm:0755 fperm:0644



Sunday, August 12, 2012

Mountain Lion Upgrade ?

Do you upgrade to Mountain Lion from Lion  ?

I did.....

If you don't do yet , go the following link to check whether your software can run in Mountain Lion or not.

It will save you a lot of time and reduce some headache ..... :D


Saturday, June 23, 2012

Unexpected Uses of Control Key

1. Open a folder in a new window (or not)
If you are not setting your "Finder Preferences" to "Always Open Folders In A New Window", command key + double click can always reverse your default setting. You can also press "Command-Control-O" to open a new window with your current directory.

2. Open a new window for the enclosing folder
When you are looking at the contents of a folder in the Finder, pressing "Command-Up Arrow" opens its enclosing folder.

3. Get a summary of info with multiple files or folders
Selecting multiple files and then "right click " or "command-I", it shows you the information of the files  with several windows. But with "Control", it shows you the information with a single windows. 
-- "right click" + Control

Set Default Calendar on iPhone, iPod touch, iPad

To set a default calendar on iPhone, iPod touch, and iPad, do the following:
  1. Press Settings > Mail, Contacts, Calendars.
  2. Go to the section labeled Calendars.
  3. Press Default Calendar.
    • If you do not see Default Calendar in the Calendars section, then your device has only one calendar.
  4. Select the calendar you want to set as the default calendar for your device.
  5. Press Mail... at the top of the screen to return to the previous page.

Tuesday, April 24, 2012

MBA fan noise with no apps running ?


  1. Loudly fan but no apps is running
  2. Battery showing 0% charged in "Energy Saver" in "System Preferences"
You may try to reset the SMC, here is the instruction for MacBook Air

  1. Shutdown your MacBook Air (go to the Apple menu and choose “Shut Down…”).
  2. Make sure your MacBook Air has external power. Connect the power adaptor, if it isn’t already.
  3. Using the Air’s built-in keyboard (not a plug in keyboard or bluetooth keyboard), of the left hand side of the keyboard press Control-Shift-Option and on the top right of the keyboard, the power key at the same time.
  4. Release all the keys at the same time.
  5. Press the power key to start the computer.

Friday, March 9, 2012

iPhone App --- Producteev

I would like to share one iPhone App for Project Management and To-do list which called Producteev.


It is task management tool with cloud technology so that you can sync your task everywhere. Furthermore, it has iPhone, Android , Mac and Windows version so that you can sync your task in every platform. The free version can invite one more person into your "workspace" which is a "category" in the application holding all the tasks within the same project. Once you invited people into your "workspace", you can assign tasks to him/her and they will have the task in their workspace.
Each task can have discussion part so that you can update or sharing your thought in the particular task.

It is useful and powerful than a general to-do list tool.

Try it.
And share here :-)

Sunday, January 22, 2012

iStat Menu 2 Cannot Status in Lion

The Problem
After you migrate your Mac OS from Snow Leopard to Lion, iStat Menu 2 still works fine. But when you do some changes of iStat Menu 2, you will get the following error.

"Could not load extra
iStat menus could not load the disk activity extra"

The Solution
First, go to download the latest MenuCracker.menu from SourceForge and mount the disk image(.dmg).
Then, open "Terminal.app" and run the following commends.

sudo killall SystemUIServer
sudo cp -rp /Volumes/MenuCracker\ 2.2/MenuCracker.menu /Library/Application\ Support/iStat\ local/extras/  (single command)
sudo killall SystemUIServer

Then it will work!