sai challa

Ranch Hand
+ Follow
since Feb 06, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by sai challa

Hello,
I need to test an user interface which uses java swing,openGL,SVG(Scalable Vector graphics).It has a frame with a split pane,with two panels on left side and three panels on right side. A left side panel contains 3000 elements which are basically labels.Double clicking an element causes the element's text to appear on the other panel on the left side and a 3D figure to appear on one panel of the right side ,and some plots to appear on the other two panels on the right side.Each element has a popup-menu.Selecting an item in the pop-up menu opens several new panels.I need an automated testing tool that runs through each of these 3000 items ,double clicking them and selecting the items of the pop-up menus of these elements and checks whether all panels appear and also reports any exceptions.
Could anybody suggest me a suitable Automated Testing Tool in Java ?. Thanks in advance.
22 years ago
Thanks a lot Joshua. I shall look into the site
22 years ago
Could anybody suggest some statistical software packages which are written in java and can be integrated with java programs which cover aspects of statistics like cluster analysis and come with plots?.Thanks in advance.
22 years ago
If a java client does a timed wait for a UDP msg from the server, by blocking on DatagramSocket.receive(DatagramPacket) and if it times out on couple of tries, then the socket figures out that the Server is down and sets its state such
that the next call to receive() will not block but would rather
straight away give IOException.

After a while if the Server is up, even then the socket is not able to receive any data. This wasn't the case with older JVMs. In older netscape, the Java client(an applet) will be able to resume receiving packets.
Could anybody help me by answering if there is a way to reinitialize the socket that has given up on the server, to start receiving data when the server is up?
[This message has been edited by sai challa (edited June 07, 2001).]
I saw this material in JLS which might be of use to you.
Each class variable, instance variable, or array component is initialized with a default value when it is created :
1.For type byte, the default value is zero, that is, the value of (byte)0.
2.For type short, the default value is zero, that is, the value of (short)0.
3.For type int, the default value is zero, that is, 0.
4.For type long, the default value is zero, that is, 0L.
5.For type float, the default value is positive zero, that is, 0.0f.
6.For type double, the default value is positive zero, that is, 0.0d.
7.For type char, the default value is the null character, that is, '\u0000'.
8. For type boolean, the default value is false.
9.For all reference types (class types,interface types or arrays), the default value is null.
Example Program:
class Point
{
static int npoints;
int x, y;
Point root;
}
class Test
{
public static void main(String[] args)
{
System.out.println("npoints=" + Point.npoints);
Point p = new Point();
System.out.println("p.x=" + p.x + ", p.y=" + p.y);
System.out.println("p.root=" + p.root);
}
}
prints:
npoints=0
p.x=0, p.y=0
p.root=null
[This message has been edited by sai challa (edited May 11, 2001).]
[This message has been edited by sai challa (edited May 11, 2001).]
22 years ago
Hello,
You can use a StringTokenizer.
Suppose ,
String s="a b c d";
You can use the StringTokenizer constructor:
StringTokeizer(String s)
Constructs a string tokenizer for the specified string. The tokenizer uses the default delimiter set, which is "\t\n\r\f": the space character, the tab character, the newline character, the carriage-return character, and the form-feed character. Delimiter characters themselves will not be treated as tokens
StringTokenizer st=new StringTokenizer(s);
while(st.hasMoreTokens())
System.out.println(st.nextToken());
The method hasMoreTokens() of the StringTokenizer returns true if there are more tokens available from this tokenizer's string s in this case.
The method nextToken() of the StringTokenizer returns the next token of the String.
The StringTokenizer will parse your String s and return the tokens a,b,c,d and in the above case it will print them as
a
b
c
d
22 years ago
Regarding your first question:
the constructor Vector(int capacity,int increment) creates a Vector object with an initial capacity of 'capacity' and the capacity will be increased by 'increment' elements each time more space is needed.
In your case a Vector object is created initially with a capacity of 5 and when a sixth element is to be added it's capacity is incremented by 10 i.e 5+10=15 .Hence the answer is 3.
The GridLayout() constructor creates a grid layout with a default of one column per component, in a single row .
Hence panel and buttons marked One to four running from the left to right are displayed which is answer choice 2.
At line 3 ,the Employee object 'e' is assigned a reference to the object created as new Employee("Bob",48);
At line 6 e is assigned a null reference ,it no longer refers to the object it was earlier referring to.
At line 7 it is assigned a reference to a new Employee Object("Denise",36).
There are no more references to the earlier Employee object ("Bob",48). Hence it may be garbage collected
1.To find the hexadecimal number of a given decimal:
Divide the decimal number by 16,divide the quotient obtained
by 16 and store the remainder at each step.keep dividing the quotient by 16 at each step until quotient becomes 0.The remainders at each step taken in reverse order is the hexadecimal number.I would like to illustrate with an example.
decimalno:=1000
1.dividend1=1000 divisor=16 quotient1=62 remainder1=8
Now for the second step dividend2=quotient1
2.dividend2=62 divisor=16 quotient2=3 remainder2=E(decimal 14=hexadecimal E)
3.dividend3=quotient2=3 divisor=16 quotient3=0 remainder3=3
since quotient3=0 the hexadecimal number for 1000=(remainder3 remainder2 remainder1)
=(3E8)
To obtain the octal number of a decimal number repeat the above process by 8.
for 1000 the octal number would be:
1 dividend1=1000 divisor=8 quotient1=125 remainder1=0;
2.dividend2=quotient1=125 divisor=8 quotient2=15 remainder2=5
3. dividend3=quotient2=15 divisor=8 quotient3=1 remainder3=7
4.dividend4=quotient3=1 divisor=8 quotient4=0 remainder4=1
since quotient4=0 octalnumber=(remainder4 remainder3 remainder2 remainder1)=(1750)

Hello,
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
String line=new String();
line=br.readLine();
//if you enter 24 you can retrieve it by using the method //Integer.parseInt(String)
int number=Integer.parseInt(line.trim());//you should use //line.trim() to get rid of any leading or trailing whitespace
22 years ago
3.BufferedInputStream and BufferedOutputStream
import java.io.*;
public class CopyFileUsingByteStream
{
// Main method: args[0] for sourcefile and args[1] for target // file
public static void main(String[] args)
{
// Declare input and output file streams
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
// Check usage
if (args.length !=2)
{
System.out.println("Usage: java CopyFileUsingByteStream"+ "fromfile tofile");
System.exit(0);
}
try
{
// Create file input stream
bis =new BufferedInputStream(new FileInputStream(new File(args[0])));
// Create file output stream if the file does not exist
File outFile = new File(args[1]);
if (outFile.exists())
{
System.out.println("file " + args[1] + " already"+ "exists");
return;
}
else
bos = new BufferedOutputStream(new FileOutputStream(new File(args[1])));
// Display the file size
System.out.println("The file " + args[0] + " has "+
bis.available() + " bytes");
// Continuously read a byte from fis and write it to fos
int r;
while ((r = bis.read()) != -1)
bos.write(r);
}//end of try
catch (FileNotFoundException ex)
{
System.out.println("File not found: " + args[0]);
}
catch (IOException ex)
{
System.out.println(ex.getMessage());
}
finally
{
try
{
// Close files
if (bis != null) bis.close();
if (bos != null) bos.close();
}
catch (IOException ex)
{
System.out.println(ex);
}
}//end of finally
}//end of main
}//end of class

[This message has been edited by sai challa (edited April 27, 2001).]
22 years ago
2.Using BufferedReader and BufferedWriter
import java.io.*;
public class CopyFileUsingBufferedReader
{
public static void main(String args[])
{
BufferedReader br=null;
BufferedWriter bw=null;
if(args.length!=2)
{
System.out.println(
"Usage: java CopyFileUsingByteStream fromfile tofile");
System.exit(0);
}
try {
//Create BufferedReader
br=new BufferedReader(new FileReader(new File(args[0])));
//Create bufferedwriter
bw=new BufferedWriter(new FileWriter(new File(args[1])));
//read a line from br and write a line to bw
String line=new String();
while((line=br.readLine())!=null)
{
bw.write(line);
bw.newLine();//creates a new line..
}
br.close();
bw.close();
}//end of try block
catch(FileNotFoundException e)
{
System.out.println("File Not Found:"+args[0]);
}
catch(IOException e)
{
System.out.println(e.getMessage());
}
}//end of main
}//end of class
[This message has been edited by sai challa (edited April 27, 2001).]
22 years ago
Hello,
1)Using FileReader and FileWriter:
import java.io.*;
public class CopyFileUsingReader
{
public static void main(String[] args)
{
FileReader fr=null;
FileWriter fw=null;
if(args.length!=2)
{
System.out.println("Usage: java CopyFileUsingByteStream fromfile tofile");
System.exit(0);
}
try
{
//Create FileReader
fr=new FileReader(new File(args[0]);
//Create FileWriter
fw=new FileWriter(new File(args[1]));
//Continuously read an int from fr and write to fw
int i=0;
while((i=fr.read())!=-1)
fw.write(i);
fr.close();
fw.close();
}//end of try block
catch(FileNotFoundException e)
{
System.out.println("File Not Found:"+args[0]);
}
catch(IOException e)
{
System.out.println(e.getMessage());
}
}//end of main
}//end of class
22 years ago
Hello,
My RMI remote interface and server files are in the directory java_home\MyRMI\server and my RMI client files are in the directory java_home\MyRMI\client directory. I want to use the same security policy file for both the client and the server.In which directory should i place the policy file ?.Could anyone explain me how to run the application using this policy file?
Thanks in advance.
22 years ago