February 2012

set telerik dock popup position

function ShowRadDock()
{
    var myWidth = 0, myHeight = 0;
    var scrollLeft = 0;
    var scrollTop = 0;
     
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
        scrollLeft = window.pageXOffset;
        scrollTop = window.pageYOffset;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
         
        scrollLeft = document.documentElement.scrollLeft;
        scrollTop = document.documentElement.scrollTop;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
        scrollLeft = document.body.scrollLeft;
        scrollTop = document.body.scrollTop;
    }
 
    var dockImport = $find("");                        
    var dockStyle = document.getElementById("");
        
    var left = (myWidth - dockImport.get_width().replace("px","")) / 2 + scrollLeft;
    var top  = (myHeight - dockImport.get_height().replace("px","")) / 2 + scrollTop;   
    if (left < 0){
        left = 0;
    } 
    if (top < 0){
        top = 0;
    }        
    dockStyle.style.left = left + "px";
    dockStyle.style.top = top + "px";
    dockImport.enableModalExtender();
}

How to compare two tables of different database – SQL Server

To find records which exist in source table but not in target table:

SELECT * FROM t1 WHERE NOT EXISTS (SELECT * FROM t2 WHERE t2.Id = t1.Id)

or

SELECT * FROM t1 LEFT OUTER JOIN T2 on t1.Id = t2.Id WHERE t2.Id IS NULL

If the primary key consists of more than one column, you can modify SQL statement:

SELECT Id, Col1 FROM t1 WHERE NOT EXISTS
(SELECT 1 FROM t2 WHERE t1.Id = t2.Id AND Col1.t1 = Col2.t2)

On SQL Server 2005 or newer you can use the EXCEPT operator:

SELECT Id, Col1 FROM t1 EXCEPT SELECT Id, Col1 FROM t2

To find records which exist in source table but not in target table, as well as records which exists in target table but not in source table:

SELECT * FROM (SELECT Id, Col1 FROM t1, ‘old’
UNION ALL
SELECT Id, Col1 FROM t2, ‘new’) t
ORDER BY Id

Note: For tables with large amounts of data UNION statement might be very slow.