And speaking of version control...
Posted Jul 12, 2007
(updated Aug 3, 2007)
If you're developer looking for an easy way to display differences between two different chunks of text, I highly recommend Neil Fraser's diff-match-patch code library. Neil works for Google, and his library is used in Google Documents... and now Big Medium, too.
The open-source library (LGPL license) is available in Java, JavaScript and Python and makes for a great drop-in to add diff support to your app.
Big Medium uses the JavaScript library to diff text versions, and it reduces the whole operation to just four lines of code:
var dmp = new diff_match_patch();
var d = dmp.diff_main(oldText, newText);
dmp.diff_cleanupSemantic(d);
var html = dmp.diff_prettyHtml(d)
Sweet.
Tags:
programming,
versioncontrol
Want more?
Recent blog entries...
More from this section
The Future in Your Pocket, and Why I'm Writing Another BookMy new book,
Best iPhone Apps, comes straight out of my childhood yearning for this very device.
iWork ’09 Tips, Interviews, and Book ReviewsI hit the bricks this month to spread the word about my book,
iWork ‘09: The Missing Manual.
Marathons, Makers, and Surviving the Dark MiddleIn the dark middle of the race, runners need encouragement, reminders that they're strong, that the finish is ahead: plausible, real, within reach.
Message from BeyondA missive from quite another big medium arrives in my mailbox.
David Byrne Never Stops Making SenseDavid Byrne's concert in Paris was an inspiring reminder of the simple pleasure of sharing the amazing stuff you make.
My Latest Project: A BookI signed a contract last month with O’Reilly to write a book about Apple’s iWork software, and I couldn’t be more tickled.
Dot Your I’sA clever logo solution smuggles in the required legalese without cluttering the design.
Jacques Villeglé: The Original MashupAn exhibition of torn poster art asks fascinatingly relevant questions in an era of online mashups and user-generated content.
Winning the Uphill BattleParis solves a problem with its bike-sharing program by turning hill-climbing into a game.
Add a Comment
Don't be shy.