Your Computer Science Resource

Archive for May, 2009

May
7th

HOW-TO: Use the Levenshtein Distance Algorithm

For an anti-plagiarism application I developed about a year ago, I needed a way to calculate the similarity between two strings. I wasn’t sure how to go about doing this at first, but then I came across the Levenshtein Distance Algorithm which gets the job done well. In this example, I’ll show you my Distance class implementing the Levenshtein Distance Algorithm, and how to use it to compare strings (specifically the minimum distance between two strings needed to make them equal). This is also very useful for determining how similar (or dissimilar) two strings are.

(more…)

May
6th

Java JLabel Hyperlink

Have you ever needed a hyperlink in your project? One convenient place for this is in the “About” dialog with a link to your website or e-mail. Unfortunately, there isn’t a JHyperlink class in the standard library, but we can make our own, right? Let’s see how to do it!

(more…)