September 4, 1999

NdxShellSort -Sort Indexed Arrays using ShellSort

‘ Indexed ShellSort of an array of any type” Indexed Sorts are sort procedures that sort an index array’ instead of the main array. You can then list the items in’ sorted member by simply scanning the index, as in’ For i = 1 To numEls: Print arr(ndx(i)): Next” NUMELS

BubbleSort – Sort Arrays using the BubbleSort Algorithm

‘ Bubble Sort an array of any type’ BubbleSort is especially convenient with small arrays (1,000′ items or fewer) or with arrays that are already almost sorted” NUMELS is the index of the last item to be sorted, and is’ useful if the array is only partially filled.” Works with

VolumeLabel – Read the label of a disk volume

‘ Return the volume label of a disk’ Pass a null string for the current diskFunction VolumeLabel(drive As String) As String Dim temp As String On Error Resume Next temp = Dir$(drive, vbVolume) ‘ remove the period after the eigth character VolumeLabel = Left$(temp, 8) + Mid$(temp, 9)End Function

GetDiskFreeBytes – Determine number of free bytes on disk

Private Declare Function LoadLibrary Lib “kernel32” Alias “LoadLibraryA” (ByVal _ lpLibFileName As String) As LongPrivate Declare Function GetProcAddress Lib “kernel32” (ByVal hModule As Long, _ ByVal lpProcName As String) As LongPrivate Declare Function GetDiskFreeSpaceEx Lib “kernel32” Alias _ “GetDiskFreeSpaceExA” (ByVal lpDirectoryName As String, _ lpFreeBytesAvailableToCaller As Any, lpTotalNumberOfBytes As Any,

QuickSort – Sort Arrays using the QuickSort Algorithm

‘ QuickSort an array of any type’ QuickSort is especially convenient with large arrays (>1,000′ items) that contains items in random order. Its performance’ quickly degrades if the array is already almost sorted. (There are’ variations of the QuickSort algorithm that work good with ‘ nearly-sorted arrays, though, but this

The Parameter of a Copy Constructor Must be Passed by Reference

The canonical form of a copy constructor of a class C is: C::C(const C& rhs); You can also declare the copy constructor’s parameter as follows: C::C(C& rhs); //no const, OK That is, the const specifier is not mandatory. However, the parameter may not be passed by value: C::C(const C rhs);

Using SQLMAINT.EXE Command-Prompt Utility

You can use SQLMAINT.EXE command-prompt utility to perform routine database maintenance activities. It can be used to run DBCC checks, to dump a database and its transaction log, to update statistics, and to rebuild indexes. It returns 0 if it runs successfully or 1 if it fails. Remember that because

Using the Query Governor Advanced Server Configuration Option

You can use the query governor advanced server configuration option to prevent long-running queries from executing, thus preventing system resources from being consumed for long. By default, this option allows all queries to execute, no matter how long they take. The query governor can however be set to the maximum

Correctly Defining a Function in an Unnamed Namespace

The use of the static keyword is deprecated when declaring objects in a namespace scope; the unnamed-namespace provides a superior alternative. Nonetheless, it is important to know how to define the members of an unnamed namespace correctly. Declaring a function in an unnamed namespace and defining it later, somewhere outside

No more posts to show