Friday, December 12, 2008

CONTAINSTABLE query shows error "..full-text query is too complex"

Problem:
I have found that using the sql ContainsTable statement which finds too many results returns the error message "Too many full-text columns or the full-text query is too complex to be executed".

SELECT * FROM CONTAINSTABLE(mytable,myFullTextColumn,N'"Starbucks *"')

The error message really doesn't tell you that there were too many results (the real problem here ) which caused me to bang my head against the wall for a few hours.

Solution:
Run a query with more details in the search string or change your query so the search string is more specific.

Thursday, December 11, 2008

Google API SpreadsheetQuery doesnt work with at symbol (@)

I hate wasting time on stupid issues... and this was one of them. For the life of me, I couldn't figure out why I could not return a ListEntry when I was searching with an email address.

Problem:
ListQuery Lquery = new ListQuery(listFeedLink.HRef.ToString());
Lquery.SpreadsheetQuery = "user@google.com";

Solution:
ListQuery Lquery = new ListQuery(listFeedLink.HRef.ToString());
Lquery.SpreadsheetQuery = "\"user@google.com\"";


I figured it probably had something to do with the string delimiter, but the odd thing was that the google service would accept the full email address without throwing an error and just return no results. (Probably a bug) Regardless, it is still good to know that the string delimiter for the SpreadsheetQuery is a quotation mark since it isn't well documented.

Tuesday, December 9, 2008

TSD01261: The syntax check failed 'Incorrect syntax near ].' in the batch near '] '

Problem: Database Project fails to build with warning: The syntax check failed 'Incorrect syntax near ].' in the batch near ']. Project also fails to show the exact location of the error:

Source of the Problem:
I've found this to occur when the following two things happen together:
  1. You have a variable defined for the project that isnt set.
  2. You are using an ALTER AUTHORIZATION ON DATABASE statement with this variable.
Fix:
As you would expect, the fix here is to set the variable correctly since the real problem here is that visual studio doesn't tell you where the problem is occurring.

Tuesday, November 25, 2008

Getting browser scrollbar to scroll on silverlight content

Took me awhile to figure this one out.... probably because I didnt really understand how silverlight works. (hey, no better time to learn than when you are stuck on a problem, right?)

Problem:
The browser scrollbar doesnt appear when the silverlight control grows beyond the size of the page.

Solution:
The first point in finding the solution is realizing that the silverlight control itself resides WITHIN the asp.net control defined on your webpage and that this control's size doesnt change when the silverlight control changes. (When you first create a silverlight project, the size of the silverlight control is automatically set to 100%)

To overcome this we need to do 3 things:
  1. Remove the Height="100%" attribute from the control in your hosting asp.net page.
  2. Create a function that determines the height of all the controls within your root panel object.
  3. Utilize the HtmlElement object to set the height of your ASP.NET silverlight control

Here is how I did it:

private void UpdatePageHeight()
{
double totalHeight = 0;
foreach (RowDefinition rd in ((Grid)(Content)).RowDefinitions)
totalHeight += rd.ActualHeight;

HtmlElement he = HtmlPage.Document.GetElementById("silverlightControl");
he.SetAttribute("height", totalHeight.ToString());
}

Notes:

  • I'm using a Grid for my root panel, so I add up the height of all the rows to get my total height.
  • I call this function whenever my grid size changes.... seems to cover all cases

Monday, November 10, 2008

Setting within your httpModules removes the HttpContext







I guess this makes sense now that I blog about it.... but it really had me stuck for a few hours yesterday when I stumbled across it.
When you use the node within your httpmodules section of your web.config, it will also clear out whatever is filling the Identity.Name value as well.

I was using this setting to eliminate some errors I was getting because my application is inheriting some modules from the parent application.

Monday, June 30, 2008

.xls is not a valid Win32 application with Windows Vista SP1

Annoying little problem I've been having with my office applications for a few weeks. At various times, I would try to open an Excel or word document and I would get the error:

"% is not a valid Win32 Application" or "This file does not have a program associated with it for performing this action..."

The only thing I knew for sure was that it would happen during the times I would hibernate my computer. (I hibernate my computer in the evening most of the time)

The actual problem turned out to be a Vista bug with running certain applications for a long period of time. Although not directly related to hibernate, by working all day and then hibernating my computer I was effectively leaving my computer running for a long period of time.

This is a known problem and it has been fixed with a Reliability update from Microsoft:
http://support.microsoft.com/?kbid=952709

Thursday, May 29, 2008

SQL: Could not obtain information about Windows NT group/user

I received the following error when doing a sql install:

CREATE ASSEMBLY [Dan.ImportFile]
AUTHORIZATION clrUser
FROM 'E:\Dan\SQL\ImportFile.dll' WITH PERMISSION_SET = EXTERNAL_ACCESS

Msg 15404, Level 16, State 19, Line 1
Could not obtain information about Windows NT group/user 'DOMAIN\usersql', error code 0x5.


What I am trying to do is give sql access to a .net assembly through a user/login/assymetric key.

Traversing through the web and looking for the cause led me to the following article:
http://support.microsoft.com/kb/834124


Although this was great, it didnt get me to the final solution. The problem actually ended up being pretty simple. My sql server service is running under a domain account. The domain account password was expired so when the lookup tried to access the active directory we received the error message.

SOLUTION: Update the password on the SQL Server service(s)

Confirmation of the problem could be found in the windows security event log where my DOMAIN\usersql account was failing logon.

Wednesday, March 26, 2008

MSN Messenger displaying active status when user is away



I've been having problems for a few months with the online status of messenger. What happens is they leave their computers on all day and periodically their messenger status shows them as active when nobody is actually at the computer. This drives me nuts because I never know when they are actually there... effectively defeating the whole purpose of status.

Recently I have had them try a few changes and it looks like it is working again. Here is what they did:

  1. Open the Control panel -> Power Options.

  2. Under whatever plan you currently have selected, choose "Change plan settings".

  3. Click "Change advanced power settings"

  4. Scroll down to the bottom and expand item "Multimedia Settings" and then "When sharing media"
  5. Change option from "Prevent idling to sleep" to either "Allow the computer to sleep" or "Allow the computer to enter into Away mode"

  6. Click OK to save changes.

* Note: you may want to change this option on the other power plans you have in case you switch in the future.

I dont know what the option "Prevent idling to sleep" actually does but it does seem to trigger MSN messenger into thinking you are active at the computer.

Friday, February 15, 2008

No anchor member was specified for recursive query Problem

Recently I've been playing around with Common Table Expressions (CTE) and I've had a little difficulty figuring out exactly what the syntax is for it.
The main problem I was having was figuring out how the recursive member integrates with the CTE table. I kept getting the following error.

No anchor member was specified for recursive query "MemberRelation".

After a few hours of troubleshooting I realized that I didnt fully understand what the first line of code for the CTE was doing. In actuality, it is describing the table layout of the result set. (Not a table in the database.) Now the expression is working and making sense:

with MyRelation
(
ID1,
ID2,
Level
)
as
(
-- Anchor member definition
select ID1
,ID2
,0 as Level
from relation as e
UNION ALL
-- Recursive member definition
select e.ID1
,e.ID2
,Level + 1
from relation as e
join MyRelation R on R.ID2 = e.ID1
)
-- Statement that executes the CTE
select top 1 * from MyRelation
where Level = 3
option(Maxrecursion 3)
GO

Thursday, February 14, 2008

TFS - Getting files that have changed since a particular date

One of the most annoying parts of source control in visual studio is the lack of some basic features that are in other source control systems. One such feature is to get files that have changed since a particular date. You can do this in TFS, but it isnt straightforward.

Here is how you do it:

1. Create a new folder on your local hard drive to be used temporarily.

2. In visual studio, create a new workspace mapping the directory in source control you want to get the changes on, to the folder created in step 1 above.

3. Under source control, right-click on the folder and select "Get Specific Version..." on the directory that you want to get the changes on.

4. From the Version checkbox, choose "Changeset" and enter the changeset that has the files without the changes you are retrieving.

5. Click Get to get all the files.

6. Once complete, go to the directory on your local hard drive (created in step 1) and delete all the files you just retrieved.

7. Under source control, right-click on the folder you wish to get the changes on and select "Get Latest Version"

After all the files are done downloading, your local folder will only have files that have changed since you last retrieved the files in step 3. Why? - "Get Latest Version" doesnt actually look at the files on your local machine to determine what files need to be updated. Instead, it keeps track of the files you downloaded on the server and gets any changes from your previous download.

Saturday, February 2, 2008

GenerateAndPersistNewIndex causing "Not enough storage is available" error

Here is a good “gotcha” for the GenerateAndPersistNewIndex setting in the Fuzzy Lookup component delivered with SSIS and SQL 2005.

Problem: MaxMemoryUsage set to 0 (Unlimited) - When this is set to 0, and the MatchIndexOpetion set to GenerateAndPersistNewIndex, the package will fail stating: "Not enough storage is available to complete this operation"

Fix: Set MaxMemoryUsage to 256

There are a few things really odd things that I've discovered:

· The description of MaxMemoryUsage from MS says it applies to the transformation process, not the index creation process.

· With MaxMemoryUsage set to 0 and plenty of RAM, the package may still fail even though it isnt close to maxing out the RAM.

· Even with MaxMemoryUsage set to 256, it is going past this memory requirement. (although I can see it is using a lot less memory than with a setting of 0)