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