Tuesday, August 28, 2007

Querying a MarkLogic Server Collection for a Title List, Plus Performance

The real theme of this post is, "Keep it simple, stupid."

I had a query I was using to generate a list of documents stored in a MarkLogic Server collection. The results were being passed to a web application for use as a title list. I was getting the results I wanted, but the query was taking about 20 seconds to complete and there were fewer than 200 book-length XML files to search. The key line in that query was:
for $i in cts:search(//book, cts:collection-query($myCollection))
I knew there had to be a better way to express this, but I couldn't find anything in the API that helped. Then someone suggested using the built-in XQuery function, collection(). I changed the query to...
for $i in collection($myCollection)/book
...and now the query runs in less than .05 seconds, including some trips down into the structure to grab metadata. That's what I was expecting.

Thanks to the people on the Mark Logic developer email list for helping with this.

TortoiseSVN Icon Overlays Disappearing in Windows Explorer

We're using TortoiseSVN as a Subversion client for Windows and it's been great, but the icon overlays that appear in Windows Explorer have suddenly started to disappear. What's really strange is that they may appear at the top-most directory, but disappear when you drill down.

I haven't found the root cause yet, but here's how to get them back.
  1. Open the Task Manager. Find TSVNCache.exe and click End Process.
  2. Shutdown and then restart Windows Explorer. Go to Start > Shutdown. Hold down the Shift+Alt keys and then click the Cancel button. To bring up the Task Manager, hold down the Ctrl+Shift keys and then click Esc. Now, in the Task Manager, go to File > New Task and type in explorer.exe. Supposedly, this is the "proper" way to kill and restart the Windows Explorer process.
Others have reported similar problems. See http://svn.haxx.se/tsvn/archive-2007-01/0190.shtml for one example.

UPDATE: In XP Pro, all I needed to do was end TSVNCache.exe and then I could refresh Windows Explorer and the overlays came back.

Saturday, August 4, 2007

ASP.NET Value of a Month as Text Instead of an Integer

To get the value of a month as text (it's name) instead of an integer use,
string myMonth = DateTime.Now.ToString("MMMM", 
For additional date formatting options, see http://msdn2.microsoft.com/en-us/library/8kb3ddd4.aspx.