www.jlion.com

Wednesday, November 21, 2007

Still reading "Song of Susannah" and my initial reluctance is starting to transmogrify into great interest. What a metaphysical trip! What if we're all figments? OK, comfortable with that? Ok, now: What kind of figments are we? Are we the dreams of God? Iterations of some kind of virtual universe? Stephen King makes The Matrix seem like Sesame Street...

----------------------------------------------------------------------------

I had always labored under the impression that the "stop" button in internet explorer or firefox disconnected the browser from the current request. That seems not to be true as I have long running pages that just can't be canceled, no matter how persistently the user clicks on the red X.

As usual, a bit of surfing revealed gold, in this case in the form of some javascript functions:


function ShowCancel()
{
var oCancel=document.getElementById('cmdCancel');
oCancel.style.visibility='visible';
}

function HideCancel()
{
var oCancel=document.getElementById('cmdCancel');
oCancel.style.visibility='hidden';
}

function Cancel()
{
if (window.stop)
window.stop(); // for firefox
else if
(document.execCommand) document.execCommand("Stop"); // for IE

return true;
}


Here's how a cancel button would work:

<input id="cmdCancel" value="Cancel" style="width: 100px;" onclick="javascript:Cancel();" type="button">


Make the button invisible when the page loads, like this:

<body onload="HideCancel();">


Reference the ShowCancel() function in the OnClick event of the button that executes the long running query, like this:

<input id="cmdRefresh" value="Refresh" onclick="ShowCancel();" type="submit">


----------------------------------------------------------------------------

Do you want to display version information for DLLs that are referenced by your web page? It's handy if you want users to report the version that was in use when they experienced a problem. Here's how I did it.

Step 1: Modify the Assembly Information properties (see AssemblyInfo.vb in the "My Project" directory). The AssemblyVersion and AssemblyFileVersion should look something like this:

<Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyFileVersion("1.0.*")>


Step 2: This function returns the version number, given a reference to any type included in your DLL:

Private Function VersionNumber(ByVal oType As Type) As String
Dim oAssembly As Assembly = Assembly.GetAssembly(oType)
Dim oName As AssemblyName = oAssembly.GetName

Return oName.Version.ToString
End Function


Step 3: Rebuild your solution. Version info returned will be something along the lines of "1.0.2880.30736" and will be automatically updated each time you recompile.

----------------------------------------------------------------------------

The blocking log in SQLAutoDoc came in handy today. Users were reporting mysterious messages with our ERP system. When we looked, we saw no problems. Typically in the past such errors have been due to blocking issues but when we looked, the horizons were clear. No blocks.

When I looked at SQLAutoDoc's block log, however, I saw a different picture. Several processes had deadlocked, causing dozens of blocks to proliferate. After twenty minutes or so, the problem had cleared itself out. Thanks to SQLAutoDoc, we have the culprit processes and can work to get them scheduled at a less congested time of day.

0 Comments:

Post a Comment

<< Home