Blog

Levenshtein Distance in SQL Server

11 January 2005

Merry Christmas, Happy New Year, and all that. This is a kind of dull post but I know some people who come here will find it useful:

I have found an implementation of the Levenshtein distance function in TSQL. This allows you to calculate the similarity between two strings, which is particularly useful for searching features. You will also need a simple user-defined function called MIN3 that is not listed at the above link, here’s the super quick one I wrote:

1   CREATE function Min3( @a int, @b int, @c int ) returns int AS
2   BEGIN
3   	DECLARE @Retval int
4   	if @a <= @b AND @a <= @c
5   		BEGIN
6   		SET @Retval = @a
7   		END
8   	if @b < @a AND @b <= @c
9   		BEGIN
10  		SET @Retval = @b
11  		END
12  	if @c < @a AND @c < @b
13  		BEGIN
14  		SET @Retval = @c
15  		END
16  RETURN @Retval
17  END

New IE Vulnerability

17 December 2004

A new and very dodgy vulnerability has been found in IE that allows fraudsters to create web pages that pose as other sites; and it is increadibly simple to set up. A few weeks ago an ex-colleague asked some advice after receiving an email with a link to a spoofed version of the e-commerce section of their site, so as you can see this is could be pretty nasty. You can find out more information at Secunia.com.

Basically, be very careful using e-commerce links from emails and untrusted websites. Or else use FireFox.

DHTML: Event Based Animation Demo

9 October 2004

At someone’s request I have set up an example demonstrating event based animations in DHTML. The "Toolkit" code is extracted from a Thirteenth Parallel project that never got completed, as such it is not all that stream lined or complete; however this example should illustrate a neat and quick way for developing complex animations.

To put the example into context: you could use an animation object and a 5-dimensional curve to animate an expanding panel while changing it’s colour (2d for the element’s y-position and height; 3d for the red, green and blue components of it’s colour). Also, because the animation object is not tied directly to any element or property, the on-animate event handlers could be used to animate anything from colours, widths and element positions, to frame sizes and window positions.

PHP graphing classes

14 June 2004

Not quite as interesting as my previous post on quitting my job, but nevertheless some people may be interested in this small collection of classes for drawing graphs in PHP.