September 11, 2001

Trim the Contents of the Text Box

This tip will trim the contents in the input box of an HTML page using java script. Call the Trim function by sending the Textbox element as the parameter. Example:

Implementing Multilevel Ranking in T-SQL

You might have a table with different PEOs for each Company ID. For example: Table name : tblRankingCid peo———– ———–1 200003311 200006301 200009301 200012312 200003312 200006302 200009302 20001231 To give PEO ranking for each CompanyId, add one column, say “Rank” to the present table and use the following script: –///////////////////////////////////////ALTER

Spreading Data across Months on a Single Row

This is a SQL trick for spreading out data across months on a single row. It also works with Sybase TSQL. The 1-ABS(SIGN()) function will evaluate to zero for all months outside of column. SELECT A,B,C,FISCAL_YEAR,may = SUM(T1.number_of_cases * (1 – ABS(SIGN(T1.fiscal_month – 1)))),jun = SUM(T1.number_of_cases * (1 – ABS(SIGN(T1.fiscal_month

Extend the Array JavaScript Object with Your own Functions

The JavaScript Array intrinsic object (and others) can be extended to include user-defined functions in the object definition. These extensions can be placed in a .js file and included in all pages to create a common library.In the example below, the Array object has been extended with a contains function

C++ Smart Pointers

C++ smart pointers are the idea of using a selector to access a class. This gives the class writer an option to control access to class members and function. For example, if you wanted to count references to the object and autodelete it when the count goes to zero. Here’s

Automate Microsoft Office Programs from within ASP

Creating dynamic Microsoft documents may be useful. The problem is that creating Word documents in ASP will result in an error saying that IIS cannot run out of process components. You can change this IIS setting to allow it to use such components so you can deliver dynamic Office documents

Get Value from the Control Irrespective of Control Type

This code shows how to get value from the control irrespective of the control type used in the client side Javascript. function GetValue(ControlName,FormName){var Control=document.forms[FormName].elements[ControlName]alert(Control.type) switch(Control.type) { case “select-one”: case “select-multiple”: if(Control.selectedIndex!=-1) return Control.options[Control.selectedIndex].value break; default: return Control.value }}

Using Count(*)

Using Count(*) is generally better than using Count() with a specific column name, because it gives the query engine the flexibility to find out the row count any way it can. It might, for example, just read an index instead of scanning the table.

No more posts to show