Tao Te KaChing
Workin' the cash register of the Great Tao

Baby Toys, Potty Words, SQL, and Me...

So little Liam just had his first birthday last Thursday.  Among the plethora of toys dumped on him is an incredibly annoying, er, wonderful alphabet speaking caterpillar:

My fat son!

There's a small yellow bow switch just below the head with three settings, plus off (dear God): letter pronouncing, alternate letter pronouncing, and color word.  These obviously coincide with the feet, so if you press the A foot, the caterpillar will speak "A" on the letter pronunciation, "ah" on the alternate pronunciation, and "red" on the color one.


I had the setting on alternate pronunciation, and was lying back letting Liam play and climb on me.  While smashing the caterpillar, he hit a bunch of keys, seemingly at once.  The F key said "fuh" first, then the caterpillar giggled and said "that tickles!", and then "kh" for the K key.

This immediately caught my attention, and I had to make the evil caterpillar curse violently so mom would toss it in the closet.  With Liam's full attention, I hit the F, then K keys.  Again, "he he he, that tickles!" between the two keys.  I took the caterpillar from Liam.  This was now science!  I tried K, O, "he he he, that tickles!", K.  FASCINATING!  They built in anti-potty-wording!  It blocked T-I-"he he he, that tickles!"-T, F then C, K-O-"he he he, that tickles!"-C, C-O-"he he he, that tickles!"-C, C-U-"he he he, that tickles!"-M, and P-I-S (latin for to pee).  J-I-Z worked, as well as B-U-T.  The word for buttocks or donkey (A-"he he he, that tickles!"-S) did not.

This makes me wonder about other alphabet toys and whether they were as thoroughly scrutinized or not.  Needless to say, I had been working on some SQL for work and decided to see how well it tells the SOUNDEX difference between various spellings of rather naughty words using DIFFERENCE.  Using SQL 2005, the results were startlingly poor.  In a few instances, SQL was smart in its comparisons, however in many cases a comparison between, say, a naughty reference to a woman's genitals and a man's returns a DIFFERENCE value of 3.  For those who don't know, the value returned ranges from 0 to 4, 0 being completely dissimilar to 4 being extremely similar if not identical.  The values in the above case should have been a 0.  The SQL and source for the simple tests are here.  Basically, I'd at least look at additional resources for filtering potty language from user input.

I guess really the only useful thing that came out of this arguably utterly useless exercise is some quick C# I threw together to de-Cartesian-ize my SQL result set:

using System;

using System.Collections.Generic;

using System.Text;


using System.IO;


namespace ConsoleApplication1


    class Program


        static void Main(string[] args)


            List<string> csv = new List<string>(File.ReadAllLines("potty.csv"));

            List<string> csvmod = new List<string>();

            csv.FindAll(delegate(string s)


                string[] l = s.Split(new char[] { ',' });

                if (csvmod.FindIndex(delegate(string s2)


                    return (s2.Contains(l[0] + ",") && s2.Contains(l[1] + ",") && (s2.IndexOf(l[0] + ",") != s2.IndexOf(l[1] + ",")));

                }) < 0)


                return false;


            File.WriteAllLines("potty-less.csv", csvmod.ToArray());




Just an example of hot anonymous delegate action for ya.