<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments for codejanitor</title>
	<atom:link href="http://codejanitor.com/wp/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://codejanitor.com/wp</link>
	<description>open source code and solutions</description>
	<pubDate>Fri, 25 Jul 2008 10:35:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>Comment on Levenshtein Distance as a MySQL Stored Function by Gareth</title>
		<link>http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-1468</link>
		<dc:creator>Gareth</dc:creator>
		<pubDate>Sat, 31 May 2008 23:24:43 +0000</pubDate>
		<guid isPermaLink="false">http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-1468</guid>
		<description>I was stumped getting this to work until I realised you needed to add a "DELIMITER //" line to the top of the code and a corresponding "//" at the bottom when loading this code into MySQL in batch mode.

eg:
DELIMITER //
CREATE FUNCTION[...]
[...code...]
END
//</description>
		<content:encoded><![CDATA[<p>I was stumped getting this to work until I realised you needed to add a &#8220;DELIMITER //&#8221; line to the top of the code and a corresponding &#8220;//&#8221; at the bottom when loading this code into MySQL in batch mode.</p>
<p>eg:<br />
DELIMITER //<br />
CREATE FUNCTION[...]<br />
[...code...]<br />
END<br />
//</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on AJAX, Safari, and Returning an HTTP Error Code by Jason</title>
		<link>http://codejanitor.com/wp/2006/03/30/ajax-safari-and-returning-an-http-error-code/#comment-1352</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Mon, 12 Nov 2007 18:05:23 +0000</pubDate>
		<guid isPermaLink="false">http://codejanitor.com/wp/2006/03/30/ajax-safari-and-returning-an-http-error-code/#comment-1352</guid>
		<description>Erik, I know you can send back additional data besides the header so long as you don't exit after sending the header.  Are you echoing XML out in addition to setting the header?</description>
		<content:encoded><![CDATA[<p>Erik, I know you can send back additional data besides the header so long as you don&#8217;t exit after sending the header.  Are you echoing XML out in addition to setting the header?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on AJAX, Safari, and Returning an HTTP Error Code by Erik</title>
		<link>http://codejanitor.com/wp/2006/03/30/ajax-safari-and-returning-an-http-error-code/#comment-1348</link>
		<dc:creator>Erik</dc:creator>
		<pubDate>Sun, 11 Nov 2007 00:40:02 +0000</pubDate>
		<guid isPermaLink="false">http://codejanitor.com/wp/2006/03/30/ajax-safari-and-returning-an-http-error-code/#comment-1348</guid>
		<description>I'm trying to send an error header like you did, but I also want to send back the error message, how do I do both?  The only thing I seem to get back is the error header... Does it stop outputting after the error header is sent?</description>
		<content:encoded><![CDATA[<p>I&#8217;m trying to send an error header like you did, but I also want to send back the error message, how do I do both?  The only thing I seem to get back is the error header&#8230; Does it stop outputting after the error header is sent?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Levenshtein Distance as a MySQL Stored Function by Jason</title>
		<link>http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-876</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Tue, 22 May 2007 17:30:43 +0000</pubDate>
		<guid isPermaLink="false">http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-876</guid>
		<description>Hi Eric,
The way these VARBINARY variables act as matrixes is as follows:
1. Each binary variable (i.e. cv0) is length 256, which is the same as 256 bytes.
2. Because we will never be storing a number bigger than 255 (length requirement of s1 and s2) we can store up to 256 numbers in each of our binary variables.  It's easier to visualize in hex.  Take, for example a binary variable of length 2.  Empty it would look like: 0x0000.  If we stored the number 255 in position 1 and the number 1 in position 2 it would look like: 0xff01.  So, in essence we can treat these binary variables as an array of numbers, and we can access any element in the array using the SUBSTRING() function.
3. In your link to the modified algorithm, there is a variable d which is a two dimensional table.  That is what cv0 and cv1 act as in the function I posted.  cv0 is the horizontal part of the table and cv1 is the vertical part of the table.

Hopefully that makes sense.  I haven't looked close enough to know how exactly you would implement the Damerau version, but it doesn't look too difficult.</description>
		<content:encoded><![CDATA[<p>Hi Eric,<br />
The way these VARBINARY variables act as matrixes is as follows:<br />
1. Each binary variable (i.e. cv0) is length 256, which is the same as 256 bytes.<br />
2. Because we will never be storing a number bigger than 255 (length requirement of s1 and s2) we can store up to 256 numbers in each of our binary variables.  It&#8217;s easier to visualize in hex.  Take, for example a binary variable of length 2.  Empty it would look like: 0&#215;0000.  If we stored the number 255 in position 1 and the number 1 in position 2 it would look like: 0xff01.  So, in essence we can treat these binary variables as an array of numbers, and we can access any element in the array using the SUBSTRING() function.<br />
3. In your link to the modified algorithm, there is a variable d which is a two dimensional table.  That is what cv0 and cv1 act as in the function I posted.  cv0 is the horizontal part of the table and cv1 is the vertical part of the table.</p>
<p>Hopefully that makes sense.  I haven&#8217;t looked close enough to know how exactly you would implement the Damerau version, but it doesn&#8217;t look too difficult.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Levenshtein Distance as a MySQL Stored Function by Eric</title>
		<link>http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-871</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Tue, 22 May 2007 00:45:49 +0000</pubDate>
		<guid isPermaLink="false">http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-871</guid>
		<description>Forgot the link to the algorithm..

http://en.wikipedia.org/wiki/Damerau-Levenshtein_distance#The_algorithm</description>
		<content:encoded><![CDATA[<p>Forgot the link to the algorithm..</p>
<p><a href="http://en.wikipedia.org/wiki/Damerau-Levenshtein_distance#The_algorithm" rel="nofollow">http://en.wikipedia.org/wiki/Damerau-Levenshtein_distance#The_algorithm</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Levenshtein Distance as a MySQL Stored Function by Eric</title>
		<link>http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-870</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Tue, 22 May 2007 00:45:09 +0000</pubDate>
		<guid isPermaLink="false">http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-870</guid>
		<description>Thanks for the stored function... I'm trying to figure out how you are manipulating the binary into a matrix though...

I want to incorporate 1 change... basically implementing: Damerau-Levenshtein distance... so transpositions only cost 1 instead of 2.

Eg:
Levenshtein: DOG vs DGO = 2
Damerau-Levenshtein: DOG vs DGO = 1

The algorithm is almost identical except for the check with the previous char to check if it was transposed... (i'd do it if i could figure out the binary part. :)

Thanks!</description>
		<content:encoded><![CDATA[<p>Thanks for the stored function&#8230; I&#8217;m trying to figure out how you are manipulating the binary into a matrix though&#8230;</p>
<p>I want to incorporate 1 change&#8230; basically implementing: Damerau-Levenshtein distance&#8230; so transpositions only cost 1 instead of 2.</p>
<p>Eg:<br />
Levenshtein: DOG vs DGO = 2<br />
Damerau-Levenshtein: DOG vs DGO = 1</p>
<p>The algorithm is almost identical except for the check with the previous char to check if it was transposed&#8230; (i&#8217;d do it if i could figure out the binary part. <img src='http://codejanitor.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Levenshtein Distance as a MySQL Stored Function by David Weingart</title>
		<link>http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-756</link>
		<dc:creator>David Weingart</dc:creator>
		<pubDate>Thu, 05 Apr 2007 18:39:21 +0000</pubDate>
		<guid isPermaLink="false">http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-756</guid>
		<description>Hi,

Thought folks interested in this page might also be interested in two alternative compiled implementations (included a precompiled version for Windows).

Source version:
http://joshdrew.com/mysql_levenshtein_udf-1.0.tar.gz

I successfully compiled and installed this on CentOS 4/MySQL 5. The README has compilation notes. I used the BSD instructions, changing the paths from /usr/local/* to /usr/*. The .so library file needs to be installed in /usr/lib for MySQL to find it.

You could possibly compile this on Windows too, but why, since there's a precompiled binary available from another kind soul. :-)

Windows DLL:
http://www.sherlocksoftware.org/page.php?id=58

After copying the dll to your MySql/bin folder, create with: CREATE FUNCTION Levenshtein RETURNS INT SONAME 'LevenshteinUDF.dll'

I've tested both versions and they seem to work correctly, and are hundreds (if not thousands) of times faster than the version implemented in pure SQL.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Thought folks interested in this page might also be interested in two alternative compiled implementations (included a precompiled version for Windows).</p>
<p>Source version:<br />
<a href="http://joshdrew.com/mysql_levenshtein_udf-1.0.tar.gz" rel="nofollow">http://joshdrew.com/mysql_levenshtein_udf-1.0.tar.gz</a></p>
<p>I successfully compiled and installed this on CentOS 4/MySQL 5. The README has compilation notes. I used the BSD instructions, changing the paths from /usr/local/* to /usr/*. The .so library file needs to be installed in /usr/lib for MySQL to find it.</p>
<p>You could possibly compile this on Windows too, but why, since there&#8217;s a precompiled binary available from another kind soul. <img src='http://codejanitor.com/wp/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Windows DLL:<br />
<a href="http://www.sherlocksoftware.org/page.php?id=58" rel="nofollow">http://www.sherlocksoftware.org/page.php?id=58</a></p>
<p>After copying the dll to your MySql/bin folder, create with: CREATE FUNCTION Levenshtein RETURNS INT SONAME &#8216;LevenshteinUDF.dll&#8217;</p>
<p>I&#8217;ve tested both versions and they seem to work correctly, and are hundreds (if not thousands) of times faster than the version implemented in pure SQL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Levenshtein Distance as a MySQL Stored Function by Jason</title>
		<link>http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-755</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Tue, 13 Mar 2007 21:27:42 +0000</pubDate>
		<guid isPermaLink="false">http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-755</guid>
		<description>Thanks nagmat, it looks like some spaces got inserted by wordpress when I posted.  I've updated the code and made sure it works when pasted into MySQL.</description>
		<content:encoded><![CDATA[<p>Thanks nagmat, it looks like some spaces got inserted by wordpress when I posted.  I&#8217;ve updated the code and made sure it works when pasted into MySQL.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Levenshtein Distance as a MySQL Stored Function by nagmat</title>
		<link>http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-753</link>
		<dc:creator>nagmat</dc:creator>
		<pubDate>Tue, 13 Mar 2007 06:14:54 +0000</pubDate>
		<guid isPermaLink="false">http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-753</guid>
		<description>It pasted the code into the editor, but it did not work. it gave errors on 
WHILE j  c_temp THEN SET c = c_temp; END IF;
                SET c_temp = CONV(HEX(SUBSTRING(cv1, j+1, 1)), 16, 10) + 1;
                IF c &#62; c_temp THEN SET c = c_temp; END IF;
                SET cv0 = CONCAT(cv0, UNHEX(HEX(c))), j = j + 1;
            END WHILE;

lines.</description>
		<content:encoded><![CDATA[<p>It pasted the code into the editor, but it did not work. it gave errors on<br />
WHILE j  c_temp THEN SET c = c_temp; END IF;<br />
                SET c_temp = CONV(HEX(SUBSTRING(cv1, j+1, 1)), 16, 10) + 1;<br />
                IF c &gt; c_temp THEN SET c = c_temp; END IF;<br />
                SET cv0 = CONCAT(cv0, UNHEX(HEX(c))), j = j + 1;<br />
            END WHILE;</p>
<p>lines.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Levenshtein Distance as a MySQL Stored Function by Jason</title>
		<link>http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-746</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Thu, 08 Mar 2007 17:17:42 +0000</pubDate>
		<guid isPermaLink="false">http://codejanitor.com/wp/2007/02/10/levenshtein-distance-as-a-mysql-stored-function/#comment-746</guid>
		<description>Thanks for that fix, orangeful.  I tested it out (with english characters anyhow -- not sure how to test with multibyte characters) and it worked fine, so I updated the code.</description>
		<content:encoded><![CDATA[<p>Thanks for that fix, orangeful.  I tested it out (with english characters anyhow &#8212; not sure how to test with multibyte characters) and it worked fine, so I updated the code.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
