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
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 Arvind Kini

Hello

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

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.io.IOException;
import java.io.PrintWriter;
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;

res.setContentType("text/html");
PrintWriter out=res.getWriter();
String ename = req.getParameter("Emp_no");
int Emp_no = (new Integer(req.getParameter("Emp_no"))).intValue();
out.println(ename);
//String y = ename;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
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>");

while(rs.next())
{
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>");
out.println("</table></center></body></html>");
}
catch(ClassNotFoundException e){}
catch(SQLException e){out.println(e);}
finally
{
try
{
if(conn!=null)
conn.close();
}
catch(SQLException ignored){}
}
}
}


Bye!
16 years ago
JSP
Hello,
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/
Thanks
Arvind
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??
Thanks...
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
regards
arvind
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
arvind
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
arvind
how can I get ip address of any server if given a name ? for ex.whats the ip address of javaranch.com?
thanks and regards
arvind
19 years ago
actually I have been using command.exe instead of cmd.exe. and hence the problem
thanks guys
arv
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
arv
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
regards
arvind
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
I wud say FOLLOW WHAT MAHA SAYZ AND GOOD SCORES WUD FOLLOW THEREON!!!
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
arv

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!
regards
arv
19 years ago
Thanx a ton guys for gettin rid of my confusion . I wud be appearing for SCJP on sat !
arvind
just came across this in one of the mocks
Que:
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.

Answer

C is correct: Other Threads can modify data in the animC object using synchronized or unsynchronized methods.
Explanation
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
arvind