Vegan Katsu Curry 2nd Try

This is a refinement to Vegan Katsu Curry 1st Try to make it easier and less faff, this time we are killing the battered stuff and using pre fried or braised tofu from our local oriental shop (it costs about £1.40), just wash it with boiling water to get the oil off it, and after you have blended the curry mixture, slice it into bite size chunks and mix it in, much simpler 🙂

how alike are 2 strings

Showing and ordering how alike strings are is something I have a use for nearly every week, from “name rationalisation” jobs in address books, through admin helper utilities to “did you mean?” on web sites, but I did not realise the best way has a proper name, its called Levensnshtein distance and is defined as:

“The Levenshtein distance between two strings is defined as the minimum number of edits needed to transform one string into the other ”

It is already built into apache commons String utils as “getLevenshteinDistance

but here is a near complete list of implemlimentions for different languages, I include the Java one from that page below (in case the source page goes down)

public class LevenshteinDistance {
        private static int minimum(int a, int b, int c) {
                return Math.min(Math.min(a, b), c);
        }
        public static int computeLevenshteinDistance(CharSequence str1,
                        CharSequence str2) {
                int[][] distance = new int[str1.length() + 1][str2.length() + 1];
                for (int i = 0; i <= str1.length(); i++)
                        distance[i][0] = i;
                for (int j = 0; j <= str2.length(); j++)
                        distance[0][j] = j;
                for (int i = 1; i <= str1.length(); i++)
                        for (int j = 1; j <= str2.length(); j++)
                                distance[i][j] = minimum(
                                                distance[i - 1][j] + 1,
                                                distance[i][j - 1] + 1,
                                                distance[i - 1][j - 1]
                                                                + ((str1.charAt(i - 1) == str2.charAt(j - 1)) ? 0
                                                                                : 1));
                return distance[str1.length()][str2.length()];
        }
}

Yes its sad, so just go away and leave me to my string comparisons 😉

Hearing it again, out with the old in with the new

Its funny how history repeats its self, I was listening to the Grails Podcast 122 and listening to the netflix boys describing their working enviroment and the features they used, these include

  • Rapid Application Deployment (Groovy and Grail’s)
  • Everybody building apps all over the place
  • Timed jobs (Quartz)
  • Shared infrastructure (AWS)
  • None Relational Data storage (simpleDB and Cassandra)It sounds as if they are really getting stuff done and making things work for them and growing all the time with the best they can get hold of, I have heard this before, last time was in the heyday of lotus notes.Draw you own conclusions.but mine are:
  • If you think your way is the best and only way, then you have not looked around in the last 5 mins.
  • Always look to grow and change, treat it as fun rather than a challenge.

Old Comments

Jerry Carter(06/04/2011 17:02:05 GDT)

+1 esp. facing change. learned just this week that crutches can be used to turn off lights, activate the power lock toggle on the car door, as a temporary door stop and to entertain children. Oh, and keep weight off a blown out hip.

More in line with this post though, some of the concepts that have come along in the past ten years really make what we already know how to use more useful if we’re willing to take the time to understand and embrace them, even if only for the duration of a single project.

Mark Myers(06/04/2011 21:45:23 GDT)

sage words Jerry sage words!!