Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Arvind Kini

Ranch Hand
+ Follow
since Dec 28, 2000
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arvind Kini


I had appeared for 486 on Sunday the 6th and got the free voucher yesterday !! now waiting for 141 ! :roll:

The following code is used to search a particular details from database(here database i used is Ms-access). the following code is in servlet.. convert into jsp.. that is quite easy....

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Search extends HttpServlet

public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException, IOException
Connection conn=null;
Statement stmt=null;
ResultSet rs=null;

PrintWriter out=res.getWriter();
String ename = req.getParameter("Emp_no");
int Emp_no = (new Integer(req.getParameter("Emp_no"))).intValue();
//String y = ename;
conn = DriverManager.getConnection("jdbc dbc:EMP","","");
stmt = conn.createStatement();
rs =stmt.executeQuery("select * from Emp where Empno = '" + Emp_no + "'");

out.println("<html><body ><center>");
out.println("<table border=2 width=60% bgcolor=silver>");
out.println("<tr><th width=30%>Employee Name</th><th width=15%>EmpNo</th><th width=15%>Age</th><tr>");

out.println("<tr><td>" +rs.getString("Name") +"</td><td>"+rs.getString("Empno")+"</td><td>"+rs.getString("Age")+"</td>");

out.println("<A HREF=\"/examples/jsp/Menu.jsp\">Go To MainMenu..</A>");
catch(ClassNotFoundException e){}
catch(SQLException e){out.println(e);}
catch(SQLException ignored){}

16 years ago
is it possible to save a html file to a word document on the client side on click of a button?
I have a SAVE button on a web page. I need to save its contents into a word document on click of the save.
Help gr8tly appreciated/
Hi all,
I am using IE 5.5 for validating a XML file against an internal DTD. Problem is that even if I remove a mandatory element from the XML document IE does not popup an error. When I try to open same XML doc in XMLSPY it gives error that an expected element is missing.

When I removed the <grade> element from above code, XMLSPY gave error that mandatoru element is missing, but IE5.5 did not give any error.
Can anyone pls tell me why IE5.5 is unable to detect the error?
Or am I missing something elementary??
Hi Frank ,
I am sorry I am not well versed with the XML terminologies. well ..As regards the display of this XML document , U R right ! I am using XSL for that.
I shall try and make it clear.
The following is my xml doc in addbook.xml file

The following is the XSL code in addbooklist.xsl for that

so with this say , I want to display all the people working in the organisation which is selected from the dropdown (obtained on viewing the above xml doc in the browser)
The display is to be shown in another XML-XSL doc . What I wanted to know is whether we have anything in xsl which wud capture data values from the previous page. i.e do we have something like parameter passing in XSL?

hope now the problem is a bit clear
let me know what U say
Hi frank
The XML doc I have here is static. I am building a drop down in one xml file. and on change event of the values in the drop down I want appropriate value to be displayed in the other xml doc. so I just want to pass the selected list value from the dropdown to the other xml file.
Please help
Hi all ,
can anyone explain if I can pass parameters from one xml doc to another? for eg.
I have a drop down list box in one doc say a html doc . and I am using method = get and directing it to an xml doc. So now in this xml doc . can I have something like getParameter() (like we have in servlets). to get the passed values from the html doc?
thankx and regards
how can I get ip address of any server if given a name ? for ex.whats the ip address of
thanks and regards
19 years ago
actually I have been using command.exe instead of cmd.exe. and hence the problem
thanks guys
19 years ago
Hi ,
I am havin a small problem out here after installing jdk1.3.1. I cannot move to the dir (C:\jdk1.3.1)thru command prompt. it says invalid dir . Any reasons WHY?
Please help
19 years ago
Hi guys,
just happened to clear JCP 2 with a score of 93. I intend to learn JSP and EJB ASAP . please guide me as how I shud be going abt this . what I mean is just lemme know as the required APIs I cud download , and where I wud find those .
Thankx a lot to all U guys
19 years ago
Hello guys ,
sorry cudnt catch U earlier .
neway as regards swing , its not included
the questions division were :
Threads around 9 ques ( mostly revolving around the synchronized keyword)
IO - 5 que( take special care to the arguments of every stream)
exceptions around 7 ques ( I got 3 wrong here )
java util 3 ques
awt around 7 ques
rest all were java concepts
Shes a gr8 personality . also download all the disscussion that she has explained
javaranch/maha/discus -> wud definitely help
download java API and java tutorial and JLS.
and refer khalid if U R aiming for a good score.
it took me around a month and a half (me too w.o prior java experience) for this .
Thanks once again guys

19 years ago
Hi all ,
passed SCJP 2 with 93 %. all credit goes to Jim,ajit, and MAHA o'course. !!! for all others a hearty thanx!
19 years ago
Thanx a ton guys for gettin rid of my confusion . I wud be appearing for SCJP on sat !
just came across this in one of the mocks
You are working on an applet that does animation. There is a single object animC, derived from java.awt.Canvas, which holds all the animation data and a memory image. There is a single Thread, animT, which uses this data to create a new image for the next animation frame and then calls the following method: synchronized void waitForPaint()
painted = false; repaint();
while( !painted ){
try{ wait();
}catch(InterruptedException x){}
The paint method in animC executes the following code after the new animation frame has been shown: synchronized(this){painted = true; notify();} After animT has entered waitForPaint and before the paint method has been executed, which of the following statements is true? [Check all correct answers]
A) Other Threads cannot modify data in the animC object.
B) Other Threads can only modify data in the animC object using synchronized methods.
C) Other Threads can modify data in the animC object using synchronized or unsynchronized methods.
D) If the animT Thread is interrupted, it will exit the waitForPaint method.


C is correct: Other Threads can modify data in the animC object using synchronized or unsynchronized methods.
Answer c is correct. When animT calls wait, the lock on the animC object is released. Answers a and b are incorrect. Other Threads can modify data in animC using any method because animT does not hold a lock on the object while in the wait state. Answer d is incorrect because when a Thread is interrupted, an InterruptedException is thrown. Because this exception is caught inside the while loop, animT will re-enter the wait method.

what I thot was the thread animT wud never lose the lock on animC, since in the code the wait() comes after repaint()(method calling paint()) and so doesnot relinquish control on the object !! also its mentioned that what wil happen after the thread animT enters the synchronized method and before executing the paint() method
Had the call to repaint() been after wait() , then this answer wud have had been fine .
my bet wud be none of these if there was any option

Please help
Thanks and regards