System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (400) Bad Request

Recently I had a WCF service call that was returning the error System.ServiceModel.ProtocolException: The remote server returned an unexpected response: (400) Bad Request.

Looking into this, I discivered that the messages we were sending were increasing in size.  We were using the basic http binding and it turns out the default readerQuotas were too small and were causing the"Bad Request" error.

I increased the readerQuotas to the values below and that resolved the error.

 

<basicHttpBinding>
        ...
          <readerQuotas maxDepth="2000000" maxStringContentLength="2000000" maxArrayLength="2000000"
            maxBytesPerRead="2000000" maxNameTableCharCount="2000000" />

       ...

SQL Server Full-Text search remove noise words

SQL Server full-text search filters out certain noise words by default.  If you want to include some of these noise words in your full text search, you will need to do the following.

  1. Locate the noise file for your language.  For English, this would be noiseENU.txt and is located in the SQL Server install directory.  For example C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData (Your location may vary).  You can also use the following query to help determine the location:

    select * from sys.fulltext_catalogs

  2. Edit this file.  You can add or remove noise words/numbers, etc. from this file.

  3. The last thing you must do is rebuild the catalog (*Note, if you have a large catalog, do this off-hours as it will impact performance):

    ALTER FULLTEXT CATALOG YourCatalogNameHere
    REBUILD WITH ACCENT_SENSITIVITY = OFF
Now, the next time you run a full-text search, your changes will be factored in.

No Software

I continue to see a trend with most businesses to move away from the self hosted, home grown, monolithic applications and move more to service based software.  While there are some big and well know players, such as Salesforce.com, there are many smaller up and comers offering a wide array of software services that do not require any on site software or custom development.

One compnay in particular, Feed.Us offers a wonderful online content management system (CMS) that in addition to traditional content management, offers many value added services.  The real joy of this system is you can get up and running in minutes.  You can transform your static web site into a dynamic web application with little to no custom development.

I really recommend you check out all of the features they offer...

 

 

jQuery UI modal dialog focus issue

I noticed while using the jQuery UI modal dialog that if you have a link (or form element) within your HTML in the modal, the focus will be given to the first one.  If the element is further down on the modal, then it will scroll down, which is not the desired behavior.

To correct this, I simply added a link at the top of the modal and gave it focus:

 Place at top of modal HTML:

<a id="top" href="#" ></a>

In document ready, add focus to #top:

jQuery(document).ready(function() {

            // Tell jQuery that our div is to be a dialog
            jQuery("#dialogTOS").dialog({ autoOpen: false, height: 400, width: 900 });

            jQuery('#linkTOS').click(function() {
                jQuery('#dialogTOS').dialog('open'); 

               // Focus on top element
                jQuery('#top').focus();
            });

        });