Friday, March 30, 2007

Query Textml for Documents by Size and Collection

I wanted to search Textml for documents over a certain size and in a particular collection to help track down some problems we were having. Here's a query that does it:
<?xml version="1.0" encoding="UTF-16"?>
<query VERSION="3.6" RESULTSPACE="R1">
<property NAME="Collection">
<property NAME="Size">
<start INCLUSIVE="True">
Note that you can also set the upper limit for the interval by using the <end> element.

Wednesday, March 21, 2007

SELECT Using a Full Text Catalog in SQL Server

This is a pretty simple example. There's a heck of a lot more that you can do.
SELECT Distinct(i.imageFile), i.caption, i.fileID, i.fragmentID, i.path, c.title 
FROM metadata_image AS m JOIN image AS i ON
LEFT JOIN fragments AS c ON i.fragmentID=c.cid
WHERE Contains(i.*, '"some" or "word"') OR
Contains(c.*, '"some" or "word"') OR
Contains(m.*, '"some" or "word"')
ORDER BY c.title, i.caption

ALTER Full Text Catalogs in SQL Server 2005 for Diacritic Sensitivity

Pretty simple:
USE AdventureWorks;

Tuesday, March 20, 2007

SELECT Duplicate Records with Matching IDs

So painfully simple, but I can never remember this when I need it, so here it is!
SELECT l.fileid, l.title, a.title
FROM pub_books AS l
JOIN books AS a
ON l.fileid = a.fileid

Monday, March 12, 2007

"Index was outside the bounds of the array" Error and VS.NET 2005 SP1

After upgrading my Visual Studio.NET 2005 installation to SP1, none of my website applications would publish. Aggravating. I started getting the hideously vague error "Index was outside the bounds of the array." Here are some suggestions on how to handle this problem.

My solution was to go into my Projects/[project name]/ directory and rename the current directory, there from my last Publish run, and then to try and publish it again. This worked for all of my projects.

Monday, March 5, 2007

Set "Week of" Date in PHP

As of this writing, I'm very much a PHP newbie, but here's a snippet for setting a "Week of" date where Monday is zero day and the date format is along the lines of Monday March 5, 2007.

function getWeek()
$today = date("l"); // That's a lower case "L."
$shift = "0";

if($today == "Sunday") $shift = "-6 days";
elseif($today == "Monday") $shift = "0 days";
elseif($today == "Tuesday") $shift = "-1 day";
elseif($today == "Wednesday") $shift = "-2 days";
elseif($today == "Thursday") $shift = "-3 days";
elseif($today == "Friday") $shift = "-4 days";
elseif($today == "Saturday") $shift = "-5 days";

return date("l F j, Y", strtotime($shift, strtotime(date("l F j, Y")))); // "Ls"

echo getWeek();

Thursday, March 1, 2007

Running Apps with Vista

I bought a new machine with Vista but, of course, I have a fair number of apps that I want to install on it. Here's a log.
  • ActivePerl seems to run fine
  • Eclipse ...
  • Java 5 EE displayed a compatibility error before the installer really even began it's work, so I stuck with the Java 6 SE SDK
  • IIS seems fine after I followed the instructions in this article.
  • MarkLogic Server ...
  • Office 2003 seems to run fine, though I don't use Outlook
  • Sam Spade ...
  • Subversion and TortiseSVN seem to run fine
  • Visual Studio.NET 2005 needs to run in compatibility mode and as an administrator
  • UltraEdit 8.10 needs to run in compatibility mode and as an administrator
  • Windows Updates
    • After running a truck-load of updates and restarting, a driver compatibility warning comes up and even throws a blue screen of death for the Sonic Solutions DLA. Roxio says it's Dell's problem because it's a Dell machine with an OEM version. Dell says it's Roxio's problem. In any case, Roxio has a solution for it which seems to work.
  • XMLSpy 2006 Home Edition seems to run fine, although it did try to call home after registering and while I started it up the first time
To switch to a compatibility mode and/or run as an administrator, do the following.
  • After install, right-click on the app icon, switch to the Compatibility tab
  • Check the compat. mode checkbox and switch the drop-down to Windows 2000 (or whatever is appropriate for you)
  • Check the run as admin checkbox
  • After this, you should be able to enter your authorization info.