devxlogo

Tip Bank

Use a Macro to Improve Your Debug Output

Frequently, and especially during development and debugging, you want to write out the values of a variable. To distinguish these variables, label them by putting this directive in: #define PUTOUT(x)

Hiding Columns in a DataGrid

Using the column index to hide columns in a DataGrid can pose a problem if the index changes. Here’s a quick workaround for when the columns are auto-generated. Using column

Ping with J2SE 1.5.0

The following code shows you how to simulate the “ping” command with the J2SE Tiger InetAddress.isReachable method. import java.io.*;import java.net.*;public class reachable{ public static void main(String args[]) { String[] addrs=

Using the java.lang.reflect.Modifier Class

You know that you can extract constructors, methods, and variables from a Java class file. Generally, when you use Field fields[] = c.getDeclaredFields( ); where c is initialized using Class

A Quick Way to Copy DataRow

Instead of copying DataRow column by column, the following code copies data in one line from the source to the destination row: DataTable dtDest = new DataTable();dtDest = dsActivity.Tables[0].Clone();foreach(DataRow dr

Retrieving a Single Value from a Database

This PHP function pulls a single field from a single record in the database once the MySQL connection has already been established: function getField($field, $tbl_name, $condition = 1){ $result =

Read and Write Strings Using String Streams

String streams allow reading and writing strings just like cin and cout allow reading standard input and writing standard output. String streams may be used by including . Reading from

The Value of Data Archiving

Table(s) holding every day transaction data can grow huge in size over period of time. This not only slows down applications, it also causes database contention leading to maintainence nightmare.A