tags:

views:

138

answers:

4

Hello folks, I was wondering if there are any free implementations of a string compare, that tells the difference between two multiline strings. I'm lookin for something like the compare screen of Microsoft SourceSafe.

What I want to achieve is, is to compare two html websites and get an overview of the changes.

(The use case will be in comparing static html pages to find out if there are any changes, like annoucments or new downloads. My university hosts seperate pages for each course I visit.)

+1  A: 

Are you looking for a free "diff" tool, like Diffuse?

EDIT: I initially had a note here suggesting this wasn't programming-related, but I realized I was wrong after re-reading your question. I think you want to pull the html and do the diff yourself in a tool that you're writing. If that is what you're trying to do, as opposed to a manual comparison, then Diffuse isn't going to help you, although the project is open-source. That may give you some leads.

JMD
Yeah, something like Diffuse, but not a standalone app, but rather than a .net implementation or at least a .net wrapper.Why isn't this question programming-related? I would run this method in a service, get the html code via HttpRequest and generate Emails if are changes?
citronas
I retracted the note about it not being programming-related after I re-read your question. I'll re-edit to make that clear. :)
JMD
A: 

If you just want to know if there are differences at all: Use a hashing algorithm (crc, md5, sha) and check if the value changed.

What you describe sounds more like a "diff" (good search word for that) tool that visually shows you the differences in the source files - but I doubt that you need if for the given usecase. See above.

Or check if your university actually supports caching in a decent way and just look at a Http HEAD response for the site you are interested in.

Benjamin Podszun
Well, of course I could look if there are changes, if I compare the strings to tell if there are differences. But I'd prefer a diff view. It must not be as visual as SourceSafe or Diffuse, a small datastructure that I can format for my output will be sufficient as well.
citronas
Okay, so a real diff view, not just the pure fact "did something change". Didn't get the question right then, sorry.
Benjamin Podszun
+5  A: 

He's looking for a diff library, not a diff tool.

A quick search on google turns up a few:

BlueRaja - Danny Pflughoeft
+1 Thanks for the great links - for easy integration with any .NET project I'll choose Google's Diff Match Patch.
John K
I think this will get me started . Otherwise you'll hear from me ;)
citronas
A: 

You might want to check out Anyone have a diff algorithm for rendered HTML?

SwDevMan81