May 29, 1999

Obtain the ASCII Value of a Character

To obtain the ASCII value of a character, simply assign the char variable to an int variable. For example: char aChar=’B’;int charVal = aChar; Then System.out.println(“”+charVal); will print the ASCII value of ‘B’ which is 66. On the other hand, to obtain the character representing an ASCII value, you’ll need

Simplify Command-Line Argument Parsing

ArgumentParser simplifies command-line argument processing by separating arguments into positional parameters and options (any argument starting with “-” or “/” is considered an option, which may specify a value). Construct an ArgumentParser instance with your command-line arguments, then ask the ArgumentParser for parameters and options: java YourClass -level=5 firstParam -verbose

Create C++ DLLs to be Used in VB Apps

Some C++ programmers develop Win32 API DLLs that can used from Visual Basic programs. Use the __stdcall prefix with functions exported from the C++ DLL that you want to access from VB 5.0. For example, the code in a simple Win32 DLL exporting GetMyComputerName using .def would be: .Def File

Move the Cursor to the Center

Use this simple subroutine to move the mouse/cursor to the center of an object. It’s useful for tab-like functions and default settings: Private Declare Function SetCursorPos& Lib _ “user32” (ByVal x As Long, ByVal _ y As Long)Private Declare Function GetWindowRect& Lib _ “user32” (ByVal hwnd As Long, lpRect _

Assure Compatibility

When working with ActiveX DLLs, many VB programmers build a reference DLL first, copy it to a subdirectory of the project directory, and set version compatibility to binary with a pointer to the reference build. Many of these same programmers believe-or have been taught-they can now forget about compatibility because

Free Internet Information Server Resources With Session.Abandon

The ASP Session object helps you maintain state in the Web’s stateless environment. That means that you can track users and their choices from one page to another. However, all this takes up resources on your server–even if after the browser has left your site. If you know that there’s

Find Methods, Events, and Properties Using VID’s Object Browser

You don’t need a lot of documentation to use objects in your Active Server Pages. Because objects are self-documenting, you can usually find the information you need about their methods, events, and properties using the Object Browser. The trick is that you have to add an object to the browser

Operators Can Only be Overloaded for User-Defined Types

An overloaded operator must take at least one argument of a user-defined type (operators new and delete are an exception). This rule ensures that users cannot alter the meaning of expressions that contain only fundamental types. For example: int i,j,k;k = i + j; //always uses built-in = and +