neoacroynism

I think “neoacroynism” (coining a new acronym) is my very first neologism…I haven’t seen it anywhere else, so I’m putting my timestamp on it here.

Asynchronous ASP.NET pages

I ran into a blatant bug where someone had created a worker thread from the page codebehind to allow a page to launch a long-running process. Needless to say, it did not work. In this case, the code being called eventually tried HttpContext.Current, because the Request object was out of scope, but in addition it was gone by now, too. They did this (I guess) to avoid page timeouts, but the errors occurring on the worker thread were not being reported to the user (or even logged), so it was a Bad Thing to do.

The funny thing was that I was able to get it working simply by adding Async=”true” to the page tag, and directly calling the method that had been passed to the worker thread. I did not have to do declare an IAsyncResult-returning method or anything. I know that async pages are helpful in keeping ASP.NET thread pool threads available, but had never heard of using them to extend the Request scope like this. It seems like, in addition to the overhead of setting up the async handler, there could be is some danger in keeping a Request around like that…will see.

More ClearCase command lines

Just can’t get enough. These are for finding recent checkins.

Just find files where you were the last to check in:

cleartool find . -type file -user YOUR_NAME_HERE -print

Files that you have checked in since 20-JUN, regardless of who was last to check in:

cleartool find . -type fd -version "{created_by(YOUR_NAME_HERE) && created_since(20-JUN)}" -nxn -print

Ditto above, but fuller version info supplied, including comments:

cleartool find . -type fd -version "{created_by(YOUR_NAME_HERE) && created_since(01-JUN)}" -print -exec "cleartool descr -fmt \"%n\t%c\n\" \"%CLEARCASE_XPN%\""

Exactly the same as above, but just adding a pipe to the DOS find command to search for a particular comment. Since we enter bug numbers in comments, it allows me to find all checkins for a particular bug, assuming I’m patient enough:
cleartool find . -type fd -version "{created_by(YOUR_NAME_HERE) && created_since(01-JUN)}" -nxn -print -exec "cleartool descr -fmt \"%n\t%c\n\" \"%CLEARCASE_XPN%\"" | find "YOUR_COMMENT_TEXT"

Null spaces and SSRS parameters

Quick summary: Don’t put a null space (“”) into a string parameter you are passing to a SQL Server Reporting Services report. I have confirmed this in SSRS2005 but not 2008 (yet).

Background: We had a change in an application which uses a CHAR(1) in the database to store middle initial (don’t ask), and the data access layer therefore uses a char to store the value in the code (again, don’t ask). When the change was made to initialize the value with ” instead of ‘ ‘ (space), reports started breaking with HTTP 400 errors in the Report Viewer window, but no indication of the underlying error. It took extensive debugging to find that the only thing that broke it was that the username being passed as a parameter was something like this: Joe \0  Smith
…which was plainly visible in the debugger, but even getting that to display in this post required a numeric escape; otherwise, the \0 displays like another space. I failed to pay any attention to for a long time because you get so used to null spaces being treated as a space.

The worst part was that the exception is displayed, logged, and reported as

The request failed with HTTP status 400: Bad Request.
Exception of type 'System.Web.HttpUnhandledException' was thrown

..that’s all. Hence the next task…exception handling for the custom ReportViewer control.

Getting command lines for current processes

Windows XP’s task manager doesn’t let you see the command line that launched a process, something that is available in the later versions and which I got used to when betaing Windows 7…but there is a simple command line to get them all listed. This command will redirect the output to a file, and I add it to a batch file that then launches the file:

@echo off
WMIC /OUTPUT:C:\ProcessList.txt PROCESS get Caption,Commandline,Processid
C:\ProcessList.txt

(stolen from http://windowsxp.mvps.org/listproc.htm)

Change SQL Server default backup location

In the registry, go to (where [MSSQL.1] is the instance name…this is the standard default location):

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\[MSSQL.1]\MSSQLServer

Change the value called BackupDirectory.

Keyboard shortcuts for remote desktop

Shortcut key Description
ALT+PAGE UP Switches between programs from left to right.
ALT+PAGE DOWN Switches between programs from right to left.
ALT+INSERT Cycles through programs in the order that they were started in.
ALT+HOME Displays the Start menu.
CTRL+ALT+BREAK Switches between a window and a full screen.
CTRL+ALT+END Displays the Windows Security dialog box.
ALT+DELETE Displays the Windows menu.
CTRL+ALT+Minus (-) symbol on the numeric keypad Places a copy of the active window, within the client, on the remote computer’s clipboard (provides the same functionality as pressing ALT+PRINT SCREEN on a local computer).
CTRL+ALT+Plus (+) symbol on the numeric keypad Places a copy of the entire client window area on the remote computer’s clipboard (provides the same functionality as pressing PRINT SCREEN on a local computer).
CTRL+ALT+RIGHT ARROW Enables you to “tab” out of the Remote Desktop controls to a control in the host program (for example, a button or a text box). Useful when the Remote Desktop controls are embedded in another (host) program.
CTRL+ALT+LEFT ARROW Enables you to “tab” out of the Remote Desktop controls to a control in the host program (for example, a button or a text box). Useful when the Remote Desktop controls are embedded in another (host) program.

ClearCase command line hacks

Some quick tools for ClearCase that you can’t do in the current GUI (1 & 2), or can do from VS tools menu (3,4)…

  1. To list all “new” (not under source control) files in a snapshot view:
    cleartool ls -l -recurse -view_only
  2. To copy an entire tree into a VOB:
    clearfsimport -recurse -nsetevent \sourcedir vob_parent_dir

  3. Compare to previous version:
    cleartool diff -graphical -predecessor filepath

  4. Get a version tree:
    lsvtree -graphical filepath
  5. Get a decent source control tool:
    not -in my -lifetime