Thursday, July 31, 2008

System configuration in solaris

Running of "/usr/sbin/prtconf" will give the System configuration...

To filter Details you can use grep
ex:
/usr/sbin/prtconf | grep Memory

ResultSet Behaviour in Java

A ResultSet cursor is initially positioned before the first row;
the first call to the method next makes the first row the current row;
the second call makes the second row the current row, and so on.
If an input stream is open for the current row, a call to the method next will implicitly close it.
A ResultSet object's warning chain is cleared when a new row is read.
Returns: true if the new current row is valid; false if there are no more rows
Throws: SQLException if a database access error occurs

smple prgram to read from console in java

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;
import java.text.ParseException;

public class ReadDoubleFromConsole {
public static void main(String[] args) {
System.out.println("Enter a number.");
double numberFromConsole;
try {
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String s = br.readLine();
DecimalFormat df = new DecimalFormat();
Number n = df.parse(s);
numberFromConsole = n.doubleValue();
} catch (IOException e) {
numberFromConsole = 0;
} catch (ParseException e) {
numberFromConsole = 0;
}
System.out.println(numberFromConsole );
}
}