Tag: diff

meld – cvs diff with ease

Visualization of the "history tree" ...
Visualization of the “history tree” of a revision controlled project, showing branching, merging, tagging, etc. (Photo credit: Wikipedia)

There are couple of ways to make life easier with CVS diff. But here is one that is really good.
First if you haven’t, install meld:

sudo yum install meld

meld is basically a diff viewer and pretty good at it 😉

Now open meld from the menu or from the terminal. And then select New. In the dialog box that appears select “Version Control Browser”. In the Directory box, browse to the folder where you have the code checked out and select ok. And you are all set.

To see the diff with cvs version just double click.

Note: If you are getting issues when you double click, ensure that you do not have any commands for diff in .cvsrc file.

There are other ways of doing this, but thats for some other day.

Enhanced by Zemanta

Compare files excluding certain lines.

Quick tip, you can use any expression for the sed commands in the (). With this trick you can redirect the stdout of 2 commands to the diff command. This might become very useful, if you want to compare 2 files, excluding the first  line.

diff <(sed '1d' file) <(sed '1d' file2)

More interesting example is where the string ABC is converted to abc before comparing in the second file with the following command:

diff file <(sed 's/ABC/abc/g' file2)
Enhanced by Zemanta

Find out why a program can\’t seem to access to a file


$ strace php tias.php -e open,access 2>&1 | grep foo.txt Sometimes a program refuses to read a file and you\’re not sure why. You may have display_errors turned off for PHP or something. In this example, fopen(\’/var/www/test/foo.txt\’) was called but doesn\’t have read access to foo.txt.

Strace can tell you what went wrong. E.g., if php doesn\’t have read access to the file, strace will say \”EACCESS (Permission denied)\”. Or, if the file path you gave doesn\’t exist, strace will say \”ENOENT (No such file or directory)\”, etc.

This works for any program you can run from the command-line, e.g., strace python myapp.py -e open,access…

Note: the above command uses php-cli, not mod_php, which is a different SAPI with diff configs, etc.

\"\"

by David Winterbottom (codeinthehole.com)

\"\"
\"\"

\"\"

URL: http://feedproxy.google.com/~r/Command-line-fu/~3/Zlwqw2g-10c/find-out-why-a-program-cant-seem-to-access-to-a-file

\"Reblog