Thursday, June 23, 2011

Google to FTS Syntax Cheat Sheet

OPERATOR EXAMPLE

DESCRIPTION

 

nut

Searches for inflectional forms of the word nut

crank arm

crank AND arm

Searches for documents containing inflectional forms of the words crank AND arm crank and ann. The keyword AND is optional.

tire OR air

Searches for documents containing inflectional forms of the words tire or air,

“reflector bracket”

Performs a phrase search for the phrase "reflector bracket".

hardware -bracket

Searches for documents containing inflectional forms of the word hardware but not the word bracket.

+clamp

Searches for the word darn') without generating inflectional forms.

~seat

Searches for thesaurus forms of the word seat

Assemb*

Searches for words that begin with the prefix assemb

. <washer nut>

Searches for documents that contain the words washer in close proximity to the word nut



The SOUNDEX coding algorithm

The SOUNDEX code is a substitution code using the following rules:

The first letter of the surname is always retained.

The rest of the surname is compressed to a three digit code using the following coding scheme:
A E I O U Y H Wnot coded
B F P Vcoded as 1
C G J K Q S X Zcoded as 2
D Tcoded as 3
Lcoded as 4
M Ncoded as 5
Rcoded as 6

Consonants after the initial letter are coded in the order they occur:

HOLMES = H-452

ADOMOMI = A-355

The code always uses initial letter plus three digits. Further consonants in long names are ignored:

VONDERLEHR = V-536

Zeros are used to pad out shorter names:

BALL = B-400

SHAW = S-000

Double consonants are treated as one letter:

BALL = B-400

As are adjacent consonants from the same code group:

JACKSON = J-250

A consonant following an initial letter from the same code group is ignored:

SCANLON = S-545

Abbreviated prefixes should be spelt out in full:

ST JOHN = SAINTJOHN = S-532

Apostrophes and hyphens are ignored:

KING-SMITH = KINGSMITH = K-525

Consonants from the same code group separated by W or H are treated as one:

BOOTH-DAVIS = BOOTHDAVIS = B-312



Asp.net GZIP compression

// Authenticate here as we need Session and Request objects to be initialised
protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
{

//HttpApplication app = sender as HttpApplication;
//string acceptEncoding = app.Request.Headers["Accept-Encoding"];
//System.IO.Stream prevUncompressedStream = app.Response.Filter;
//if (!(app.Context.CurrentHandler is Page || app.Context.CurrentHandler.IsReusable.GetType().Name == "SyncSessionlessHandler") || app.Request["HTTP_X_MICROSOFTAJAX"] != null)
//{
// return;
//}
//if (acceptEncoding == null || acceptEncoding.Length == 0)
//{
// return;
//}
//acceptEncoding = acceptEncoding.ToLower();
//if (acceptEncoding.Contains("deflate") || acceptEncoding == "*")
//{
// // defalte
// app.Response.Filter = new System.IO.Compression.DeflateStream(prevUncompressedStream, System.IO.Compression.CompressionMode.Compress);
// app.Response.AppendHeader("Content-Encoding", "deflate");
//}
//else if (acceptEncoding.Contains("gzip"))
//{
// // gzip
// app.Response.Filter = new System.IO.Compression.GZipStream(prevUncompressedStream, System.IO.Compression.CompressionMode.Compress);
// app.Response.AppendHeader("Content-Encoding", "gzip");
//}

}

Removing the Whitespaces while rendering the webpage

Removing the Whitespaces while rendering the webpage



//Overrides the Render method
        //protected override void Render(HtmlTextWriter writer)
        //{
        //    using (HtmlTextWriter htmlwriter = new HtmlTextWriter(new System.IO.StringWriter()))
        //    {
        //        base.Render(htmlwriter);
        //        string html = htmlwriter.InnerWriter.ToString();

        //        if ((ConfigurationManager.AppSettings.Get("RemoveWhitespace") + string.Empty).Equals("true", StringComparison.OrdinalIgnoreCase))
        //        {
        //            html = REGEX_BETWEEN_TAGS.Replace(html, "> <");
        //            html = REGEX_LINE_BREAKS.Replace(html, string.Empty);


        //            html = Regex.Replace(html, @"(?<=[^])\t{2,}|(?<=[>])\s{2,}(?=[<])|(?<=[>])\s{2,11}(?=[<])|(?=[\n])\s{2,}", string.Empty);
        //            html = Regex.Replace(html, @"[ \f\r\t\v]?([\n\xFE\xFF/{}[\];,<>*%&|^!~?:=])[\f\r\t\v]?", "$1");
        //            html = html.Replace(";\n", ";");
        //        }
               

        //        writer.Write(html.Trim());
        //    }
        //}