Monthly Archives: April 2010

jQuery UI DatePicker Scrolls to Top After Select

I have been struggling with the jQuery UI DatePicker and almost started using an alternate one. If my grid causes the page to scroll down, and I open a dialog with a DatePicker on it, after I choose the date, the window would scroll to the top. I looked over the code for the DatePicker and nowhere are they setting the scroll position.

After banging my head I noticed that the date selector was simply an anchor tag with href=”#”, which defaults to the top of the document.

In the jQuery UI code I simply replaced all of the href=”#” with javascript: function() { return false };


Delete and Constraint Handling Stored Procedure Using SQL Server 2000

This is an older article I wrote on Code Project. The solution stems from a very unique problem I encountered when assigned to fix a WinForms application created by a nightmarish codegen. It deals with SQL Server 2000 and is probably no longer applicable, but definitely an interesting read. If anything it may inspire a WTF.

Here is an excerpt:

I was providing consulting services, developing an application in C# and .NET 2.0 with a SQL Server 2000 database. The application framework was based on a custom code-generator, which created SQL scripts, business objects, and UI code. Because the previous consultant who designed the code-generator was no longer available, time constraints restricted us from discovering and modifying the generator, leading me to take a different approach to my solutions.

In this article, I describe how I created the ability to perform deletes. The framework did not include proper scripts for cleaning up and deleting records, and for reasons beyond the discussion of this article, I chose to do all of the constraint checks and deletes from a stored procedure, and return an error message if any constraint violations would occur from a delete.

The solution actually involves permanently modifying master database and system level objects. When I wrote the article I may not have clearly stated the reason for the solution in the first place. SQL Server 2000 does not do well when trying to cascade delete a record that has an unimaginable number of restraints on very large tables. If you look at the master level stored procedure, it actually checks the constraints, lets the delete process throw the error anyway. This results in very slow deletes. In this case it could take up to a minute to return an error. The solution is actually an aim to rewrite those stored procedures to behave correctly. I wouldn’t recommend it. I would never do it again. But in this case, I had no choice. Here is the article for a full implementation:

Team Foundation Sidekicks: Command Line Killer

I’ve had great success using Team Foundation Sidekicks. If you are tired of using command line for tools that should already be in TFS, this is your goto free product.

Using DiffMerge with Visual Studio

I won’t take credit for this, but it is necessary if you ask me. The TFS merge tool is awful. I am posting the link below for the credit.

Go to Tools, Options, Source Control, Visual Studio Team Foundation Server, Configure User Tools, and Add.

From there it is pretty intuitive.

Important excerpt:

The above just shows the simple configuration for comparing files.  It doesn’t show how to configure DiffMerge as your merge tool.

First, the above arguments work, however the documentation says to use the following arguments when setting up DiffMerge for comparing:  /t1=%6 /t2=%7 %1 %2

To configure for merge, Add a new setting (step 3), repeat step 4, select Merge in Operation, repeat step 5, and use the following command line:  /m /r=%4 /t1=%7 /t2=%8 /t3=%6 /c=%9 %2 %3 %1

Color Sorting in jQuery jqGrid

I am developing a project management application. One of the requirements is to implement project state colors (red, yellow, green) and be able to sort by them in grids. In my case this is client sorting. To accomplish this without any custom sorting functions this is what I did.

I put the name of the color as the value of the cell. I wrapped the value in a div with a specific style using a custom formatter. The style sets the background-color and the color to the same color to hide the text, and I go an extra step and set the text-indent to -1000 and set overflow to hidden. Voila! jqGrid uses the color to sort.

Here is the example:

    color: #87D27E;
    background-color: #87D27E;
    width: 100%;
    overflow: hidden;    
    text-indent: -1000px;
formatter: function(cellvalue, options, rowObject) {
     return "<div class="_pv-pstat-&quot; + cellvalue.toLowerCase() + &quot;">" + cellvalue + "</div>";

Issues integrating AXIS Web Services with .NET

I have been integrating with ITIM 5.0 using the unsupported Web Services that use AXIS 1.3. All of the issues I have experienced were fixed in 1.4, and seeing as the product is over 5 years old, I don’t understand why they chose to stick with an older version. There are several issues I have found besides the well published one about how AXIS represents arrays by pointing to a centralized value store. One of those issues is namespacing. AXIS tends to generate WSDL with a namespace, but the return values do not have a namespace, .NET just fails to find the value during deserialization. It took me forever to find out why, but I solved it by manually removing the namespace requirement from the proxy code. The second issue I ran into was how the WSDL represents collections of items. The collection is named SomeCollection with the items underneath being named Item. When the service returns, the items are named the same as the collection (SomeCollection contains SomeCollection(s)). I had to manually rename all of these references in the proxy to be the same as the collection. These cost me countless hours. If I find anymore I will post them here. Obviously the solution is to upgrade to 1.4, but IBM won’t support it or turn over the source code to do so.