May 9, 2002

Creating and Using Thread-Scoped Variables

Sometimes you need variables scoped by thread so that each thread has an independent copy. There’s an easy way to create and manage such variables.The java.lang.ThreadLocal class provides a wrapper

Set the Cursor for Your Components

All AWT component classes have a setCursor() method that allows for dynamically setting the cursor for a particular component and any subcomponents.For example, if you set the cursor for a

An Easy Way to Check Boolean System Properties

Suppose you want to pass a Boolean system property, -DDEBUG=true or -DDEBUG=false, from the command line. Normally, you’d probably use the following in source code to retrieve it: boolean b

Scope of Variables Declared in for()

The new ANSI C++ standard specifies that variables declared as in for(int i=1; …) have a scope local to the for statement. Unfortunately, older compilers (like Visual C++ 5.0) use

Sorting Part of a Field

Use the following code: select *,right(field1,4) as Col1 from [Tablename]order by col1 You can do it by using substring: SELECT *, substring(field1, 3, 5) as col1from [tablename]order by col1

Open Textfile Data as a Recordset Using ADODB

‘*********************************************************************’Text files Reading’You can use Microsoft Text Driver’*********************************************************************Public Function Read_Text_File() As ADODB.Recordset Dim rs As ADODB.Recordset Set rs = New ADODB.Recordset Dim conn As ADODB.Connection Set conn = New ADODB.Connection