Calgary Joomla Website Design and Hosting

Website Development: 1-877-228-0422

Calgary Website Design Ideas
Blah-de-BLOG!

Tips, Tricks, and Insights about Joomla and the Web

How To Compare Two Documents
Written by Douglas Helmer   
Monday, 23 March 2009 09:27

Have you ever wanted to compare two text documents to see exactly what has changed from one version to the next? I find myself in this situation frequently when I need to compare two versions of code contained in separately dated versions of a PHP or HTML page. To make the comparison between the two text files I use a powerful text-difference analyzer called CSDiff by Component Software. CSDiff is an easy-to-use, powerful, feature-rich application, and best of all, it's free!

The program could not be easier to use: Simply download, install, then start CSDiff using the supplied shortcut. You'll be greeted by the following screen:

csdiff-v1

As you can see from the above image, you can compare text documents or the files between two folders. Very handy! For the purposes of this article, I'm going to stick to comparing two documents.

With the default of Analyze Document selected, just browse to your Base revision and your Compared revision using the Browse buttons. You also have the option to use the older file as the base revision. The Options tab shows the following available settings:

csdiff-options

As the Options screen above shows, you can show the full document with all the changes, or only the changed lines. You can also compare "by letter," "by word," or "by line." These options are very useful depending on the nature of your documents. Play with them to see the differences. Once you have your options to your liking, press OK, then press OK in the original dialogue screen to show the comparison. Here's a comparison of two versions of the US Constitution. The base version is the established version and words unique to it are in red; the compared revision is written in hippy slang and its unique words are in blue.

csdiff-compared

As you can see, it's quite simple to spot the differences between the two documents. Now here's what's really cool about CSDiff: if you want to share this view of the compared documents with your colleagues you can save the compared document file as either a text file or as an interactive HTML document. Here's the interactive HTML for the above comparision (note, the "Navigate Changes" button has been disabled in the example below):

Base file: C:\demo\constitution-v1.txt

Compared file: C:\demo\constitution-v2.txt

Generated by CSDiff on 3/23/2009 11:41 AM

We the People Brothers and Sisters of the United States, in Order to form a more perfect groovy Union, establish Justice, insure domestic Tranquility, Mellowness, provide for the common defence, peace, promote the general Welfare, Love, and secure the Blessings Awesomeness of Liberty to ourselves and our Posterity, Kids, do ordain and establish this non-judgemental Constitution for the United States of America. and any planets hidden by comets.

Of course, with such a well-known document, you might not even need a program like CSDiff to recognize the changes, but what about a legal contract?

Last week, one of the ad aggregators I use on one of my content websites sent me an email informing me of an update to their terms of service. The nature or scope of the changes were not included in the email, but I was required to agree to the new terms in order to continue receiving payments. I sent a reply to the company's legal department wherein I asked for a summary of the substantive changes to the contract. Predictably, I received a reply from the company that the changes were many and varied and that it was my responsibility to read and compare both the old and new versions myself. With some difficulty, I did manage to get text copies of both the old and new versions of the agreement.

I plugged the old (base) revision, and the new (compared) revision into CSDiff, and was instantly able to see, clearly and precisely, what changes had been made to the contract. Everything from spelling corrections, to insertions of new verbiage, and wholesale additions and deletions were visible immediately with CSDiff's user-friendly colourized formatting. Here's a sanitized HTML comparison version as generated by CSDiff.

Bottomline: Powerful, easy-to-use text difference analyzer. Free. HIGHLY Recommended! Download CSDiff.

 

Add comment


Security code
Refresh

Doug's Twitter

New Addon: Art Twitter Search - Art Twitter Search is Free extension for Joomla! that can slide tweets in a nice scr... http://ow.ly/18lN2h
New Addon: VM SlimCart - As the name suggest, it is a very slim,one-line, text based cart module. The cart uses Virt... http://ow.ly/18kOG1
New Addon: FW Gallery Latest - FW Gallery latest is a module that displays a picture or several pictures you`ve chos... http://ow.ly/18jQaW
New Addon: yKhoon Block Failed Login - yKhoon Block Failed Login is an extension that will automatically block your ... http://ow.ly/18iROn
News Update: Joomla 1.6 Beta 6 Now Available - The Joomla Project is proud to announce the immediate availability of... http://ow.ly/18iROm