20091030

SQL 2005 FTS Thesaurus Doesn't Allow Duplicate Terms PROOF!

Was trying to find a way to use '&' and 'and' as expansions for my SQL 2005 FTS Thesaurus, and found this gem:
Because the thesaurus file already contains the term "Windows," the thesaurus file now contains duplicate terms. Therefore, the full-text thesaurus component does not load the thesaurus file.
From: http://support.microsoft.com/kb/923317

Again, would have been nice to know three Days ago.


20091029

SQL 2005 FTS Thesaurus Difficulties

Had my list of names all setup, dropped it into the file, it was all formatted correctly, then no test searches used of the expansions.  Pared the file down to just the original test I was working with, got it to work again, added another group of names, nothing.  went through and found some duplicate lines, removed the duplicates, got two sets of expansions to work, so I think if I remove all duplicates from my file it will work.  I can understand not allowing duplicates in the file, I just wish it would have let me know that was the problem.

As far as I can tell:  DUPLICATES ARE NOT ALLOWED IN THE THESAURUS FILE

UPDATE: Duplicates are not Allowed, see SQL 2005 FTS Thesaurus Doesn't Allow Duplicate Terms PROOF!

20091028

SQL Server 2005 Full Text Search FTS Thesaurus tsENU.xml issues

Been spending time reading up on SQL Server 2005 FTS Thesaurus files here is what I've learned:
  1. You have to make your own Thesaurus file, can't seem to find one with common expansions.
  2. When you have finished your new file, you need to restart SQL 2005 (if it's 2008 there's a stored procedure to reload it "EXEC sys.sp_fulltext_load_thesaurus_file 1033;" 1033 for the language in this case ENU (US English).
  3. Make sure your search terms are not surrounded by double quotes because you thought they were necessary from a previous hacked together project using SQL FTS.
  4. Run tests and query comparisons to make sure it's working the way you think it should.
  5. Wonder about all the other predicates you can add to your search terms because you can't find a definitive list. 
    FREETEXT(<FieldNames>,formsof(thesaurus,<searchterms>))
    FREETEXT(<FieldNames>,'"<SearchTerm_1>" NEAR "<SearchTerm_2>"')
    FREETEXT(<FieldNames>,'isabout("<SearchTerm_1>" weight(<DecimalWeightValue_1>), <SearchTerm_2> weight(DecimalWeightValue_2>))')
    FREETEXT(<FieldNames>, '<SearchTerm>', LANGUAGE <LanguageCode>)    [for a list of language codes "select [name], alias, lcid from master.sys.syslanguages", use the lcid field]
  6. If you're having problems getting the Thesaurus to appear to work, try using these to look at language settings
    exec sp_configure 'default language'
    SELECT @@language, @@langid
    select [name], alias, lcid from master.sys.syslanguages
  7. You may end up with lots of web pages open, maybe some of them are actually helpful:
    http://www.mssqltips.com/tip.asp?tip=1491
    http://msdn.microsoft.com/en-us/library/ms345187.aspx
    http://msdn.microsoft.com/en-us/library/ms345186.aspx
    http://www.mssqltips.com/tip.asp?tip=1353
    http://www.mssqltips.com/tip.asp?tip=1342
    http://www.mssqltips.com/tip.asp?tip=1332
    http://www.ureader.com/msg/1147186.aspx
    http://msdn.microsoft.com/en-us/library/cc280598.aspx
    http://msdn.microsoft.com/en-us/library/ms176076.aspx
    http://blogs.geekdojo.net/richard/archive/2006/09/01/13805.aspx  (this one is funny as well, which can be nice after not finding anything that seems useful)
    http://www.eggheadcafe.com/community/aspnet/13/10024815/need-help-on-sql-server-2.aspx  (this one seems useful until you realize that there are no replies with answers)
    http://arcanecode.com/2008/05/28/creating-custom-thesaurus-entries-in-sql-server-2005-and-2008-full-text-search/
    http://arcanecode.com/2008/04/29/sql-server-full-text-search-the-fulltextcatalogproperty-function/
    http://www.simple-talk.com/sql/learn-sql-server/sql-server-full-text-search-language-features/
  8. You finally get a sample working, then you realize you need to build a full list of all the Expansions and Substitutions you want.










20091026

VB Trim()

Didn't realize until recently that Trim has an optional parameter, just dump any single char in and it will trim that character instead of whitespace.  Handy, that.

20091023

.NET Extension Methods - "ExtensionName" is not a member of "TypeName"

Was getting a Compilation Error: BC30456: 'DayOfWeek_Offset' is not a member of 'Date'.  On one my extension methods, was working in one project but not in another, it was a configuration issue I needed to add some code to my web.config:

    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
                <providerOption name="CompilerVersion" value="v3.5"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler>
            <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4">
                <providerOption name="CompilerVersion" value="v3.5"/>
                <providerOption name="OptionInfer" value="true"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler>
        </compilers>
    </system.codedom>



.NET Extension Methods - BC30002: Type 'Extension' is not defined.

I was trying to add an extension module to a project and my <Extension()> declaration said it was undefined.  Found out I needed to include System.Core in my Assemblies in my Web.Config

BC30002: Type 'Extension' is not defined.
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>



SQL Full Text Search FTS And Wildcards

Looks like SQL FTS doesn't allow wildcards at the beginning of a search term. I ran into this a few days ago while trying to get FTS to work for a project, didn't understand why it wasn't working, but here is the answer from Microsoft(R) SQL Server 2005 Unleashed:
"However, SQL Server FTS does not allow a wildcard at the beginning of a word; for these types of prefix-based searches, you still have to use a LIKE clause."
Knowing this 4 days ago would have been extremely beneficial.


20091022

Working with Telerik & Ajax

Needed to have a button click on a Return Confirm to do an operation, and my button wasn't being clicked.
Turns out it was because I was having conflicting Ajax requests, got around it using this.

VB Code:  
RadScriptManager.RegisterStartupScript(Page, GetType(String), "confirm", "ProcessAnyway('" & btnProcessAnyway.ClientID & "','" & strMessage & "');", True)

JavaScript Code:
   function ProcessAnyway(strButtonIDToClick, strConfirmText)
    {
        var prm = Sys.WebForms.PageRequestManager.getInstance();

        //see if there is an Ajax request in progress.
        if (prm.get_isInAsyncPostBack())
        {
            //wait 1/4 second and try again (recursive)
            setTimeout(function() { ProcessAnyway(strButtonIDToClick, strConfirmText) }, 250);
        }
        else
        {
            //Yay, not AsyncPostBack run code
            ProcessAnywayAgain(strButtonIDToClick, strConfirmText);
        }
    }

    function ProcessAnywayAgain(strButtonIDToClick, strConfirmText)
    {
        if (confirm(strConfirmText))
        {
            document.getElementById(strButtonIDToClick).click();
        }
    }


20091016

Do the Intuit Developers Know the Reference They Made?

Seen in Intuit Sample Code:
Dim city17 As String
city17 = invoiceRet.BillAddress.City.GetValue()

Hah, City 17, Get 'em Gordon.  

Quickbooks QBFC 80040154 "Co-Create error"?

Today I got "Retrieving the COM class factory for component with CLSID {EE7620FE-2EE1-4077-8A52-E485E85DD6B1} failed due to the following error: 80040154." Found out it was because I was including multiple instances (different versions) of the same class (QBFC4,6,8) so excluded the old dlls and everything worked.

QuuuiiiicckkkBoooocckkkkssss!

Every time I try to have my integrated application try to open QuickBooks in "Unattended" mode it tells me my Internet Explorer Security Settings are too high for it to work properly.  So I try adding the address to the Trusted Sites list, and then IE says that the address is not in a proper format.  Note to Intuit, if you're going to require this stupid help file to come up, don't make it required, you know, since it's NOT necessary.  Also, please don't let it break integrated applications.  So annoying.

20091015

QuickBooks SDK 8.0, QBFC8 and Windows Server 64 Bit

Was having problems with QB SDK 8.0 not working properly, discovered via intuit developer forum that I needed to force x86 compilation instead of "Any CPU".  Was getting an error similar to "Could not find the COM Class with CLSID *****-******....".  Switched the compilation method to x86 explicitly, and it started working.  Yay!

20091007

ASP.NET 2.0 TreeView

Ugh, this control does not work with AJAX. It's giving me all sorts of horrible return values. Select Item # 3031, (CALLBACK! Change selection to 5608!). Now you have no idea what was clicked on. Have a nice day!

Will Likely switch to Telerik RadTreeView