April 23, 2002

Trim the Leading and Trailing Spaces in a Given String

This functionality is not currently available in Javascript. However, tou can add this function to perform trimming in the strings. Trimming is useful in checking for empty spaces. function RTrim(str){ var whitespace = new String(” “); var s = new String(str); if (whitespace.indexOf(s.charAt(s.length-1)) != -1) { var n = s.length

Use Any Image as a Background

This code allows any image to be used as a background, and scales that image to fit the browser. Just add it to the end of your HTML page:

Delete Duplicate Rows from a Table Using the Cursor

This is an advanced solution to delete duplicate Rows from a table using the cursor: create table DupTable ( Field1 varchar(20))goinsert DupTable (Field1) select ‘A11111111’ UNION ALL select ‘B22222222’ UNION ALL select ‘C33333333’ UNION ALL select ‘C33333333’ UNION ALL select ‘C33333333’ UNION ALL select ‘A11111111’ UNION ALL select ‘B22222222’ UNION

BCP Out All Tables with One Line of Script

BCP is a command line tool that allows you to obtain data quickly, whether that data is in or out of a database or tables. The script below uses an undocumented stored procedure to go through each table in the NorthWind database, BCP-ing the contents of each table out to

An Easy Way to Add a Record Number to an Existing Table Using T-SQL

Using the IDENTITY function, you can add a Record number to an existing table.For Example: select * from addresscity state zip contract——————– —– —– ——–Lawrence KS 66044 0Nashville TN 37215 0Corvallis OR 97330 1Ann Arbor MI 48105 1Gary IN 46403 1Rockville MD 20853 1Salt Lake City UT 84152 1Salt Lake

Translating errno Error Codes to Text

To translate an error code to its verbal description, use the function strerror(). strerror() is declared in as follows: char * strerror(int errcode); The function takes an error code and returns a statically allocated char array describing that code. Remember that subsequent calls to strerror() overwrite the description string. Therefore,

The sig_atomic_t Datatype

Applications that handle signals must distinguish between atomic and non-atomic datatypes. Reading or writing an atomic object is guaranteed to take one instruction. By contrast, accessing a non-atomic object may take more than one instruction. In such cases, a signal might interrupt the process in the middle of reading or

Obtaining a Verbal Description of errno

System calls and Standard Library functions assign a zero value to the global variable errno to indicate success. In case of an error, they assign negative values to errno. On each invocation of a system call or library function, the environment overwrites the previous errno value. errno and its associated

No more posts to show