August 22, 2006

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*;import*;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