March 6, 2001

Examine the Number of Extents in a Table

The amount of time it takes to retrieve data blocks is proportionate to the number of extents in the table. Ideally, a table should have one to three extents. Run this script from sqlplus to get those segments (tables or indexes) that have a surplus of extents. Here

Customizing JFileChooser

The class JFileChooser inside javax.swing.* can be customized to display your own labels using the UIManager.put() method. It is a static method that takes an Object key (Original value) and an Object value (New value). For example, the following code changes the label Look in to Drive: UIManager.put (

Eliminating Duplicate Values

To eliminate duplicate values in a collection, Java provides it own API. HashSet (java.util.*) is the class which implements Set interface. import java.util.*;class Duplicate{ static void main(String[]arr){ HashSet set=new HashSet(); String[]data={

“Shrink” the Size of a File

Visual Basic lacks the ability to make a file smaller without having to recreate it. But it is possible to use the SetEndOfFile API. Here is a function for it: Private Const FILE_BEGIN = 0 Private Const OPEN_EXISTING = 3 Private Const INVALID_HANDLE_VALUE = -1 Private Const GENERIC_WRITE = &H40000000

Expanding All the Subnodes For a Node in a TreeView

The following recursive function allows users to do an expand all via apopup menu: Public Sub ExpandAll(ByVal aNode As Node) Dim l_Counter As Long Dim l_Children As Long Dim temp_Node As Node l_Children = aNode.Children If l_Children Then aNode.Expanded = True Set temp_Node = aNode.Child For l_Counter = 0 To

Generic Name Property Procedure with TypeName

One easy way to implement a generic name property of a class is to make a property procedure with TypeName function. Public Property Get Name() As String Name = TypeName(Me)End Property

A Super-Efficient Toggle Case Using XOR

My benchmarking shows that ToggleCase can crunch through a 2,000,000character string in under 4 seconds on a Pentium II. Public Function ToggleCase(ByVal strData As String) As String ‘This technique gets its blistering ‘speed from the super efficient ‘bitwise operation. Dim i As Long Dim lngUBound As Long Dim str() As

No more posts to show