Win a copy of Head First Android this week in the Android forum!

Varghese Paul

Greenhorn
+ Follow
since Aug 02, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Varghese Paul

JExcel Label API has a method signature of Label(int , int , java.lang.String)
9 years ago
Hi Sabarish

I'm a beginner to Groovy and Grails as well. Groovy contains and may use all of the features of the Java Language. In fact, groovy code can also run on the JVM. Groovy includes features like closures, meta programming etc which are over and above the features in Java language.

As of now, the only lacking in Groovy is the lack of books, articles and documentation compared to Java. It's only a matter of time before this would also be remedied.

Regards
Varghese
9 years ago
Nagaraj:

Sure , I can help you. This is what I've learnt while preparing for the exam.

For me, the hardest part was when to write the exam, was I ready enough, have I learnt all the topics. So I would recommend go for the test once you are truly ready unless there is a deadline you have to meet. I kept changing my intended date, but I finally could score as high as I could. I prepared using K&B Java 5 SCJP Study Guide.

Once you are sure you are ready do as many mock exams as you can. Javaranch FAQ gives you a list of Mock Exam sources. I've tried all the links, some aren't working though. I found Devaka Cooray's ExamLab Simulator very helpful. It's got 5 mock exams and the questions are not easy. Also it's got lesser time than the actual exam. After the mock exams do a thorough review of the questions. I had done a review after every exam so that I knew the Question Model and also how to solve it.

For any doubts regarding the answers, you can search on Javaranch. I've never had to post on Javaranch, I could always find a solution or a similar question by searching.

Also type out the code in an editor, don't copy paste. I've got many many lines of program code on my computer.

BEST OF LUCK !!!


Belakumari :

Drag and drop questions turned out to be relatively easy. There were yellow boxes onto which you had to drag and drop green answer boxes. If you try to review those questions, be warned !!! You will have to answer it all over again.

Like I said, I had used ExamLab Simulator. While reviewing Dr&Dp questions in it, we have no way of finding the what went wrong. And I was always wrong on ExamLab !!! So I would redo only the Dr & Dp questions once or twice more.

So for the exam I was always vary of Dr &Dp and I reviewed every such question in the actual exam, since there is plenty of time.

Have fun !!!
12 years ago
Hi, I've cleared my SCJP 1.5 exam today with 95%. I haven't posted before, but many a times, I had come to the forums to check out that were put up in the forum.

I also thank Kathy Sierra and Bert Bates for the SCJP Java 5 Study Guide. I've spent a lot of time poring over the book. And also the questions at the end of every chapter helped reinforce the concepts. I've certainly become a much better Java Programmer.

Also, I would like to give special mention Devaka Cooray's, ExamLab. The interfaces on ExamLab are very similar to that on the SCJP exam. The questions also challenged my knowledge on Java and whenever I felt I was invincible, ExamLab's brought me crashing down.

I also want to thank for SCJP forums on Javaranch. After ExamLab's results I would turn to these forums for an explanation of the rules.

Thanks a lot everyone. Cheers !!!
12 years ago
Thanks everybody.

This was the solutions that came to mind, but I didn't want to do it because it was very ugly, very unsightly and seems a very inelegant way of doing it.

Is there any Exception which could interrupt the execution-flow? Or is it possible to adapt InterruptedException to handle this situation? How do the sleep() or wait() functions throw the InterruptedException?
Hi,

An enhancement I'm working on requires me to execute sequential lines of time-consuming code in a separate thread so that the user has the ability to terminate that particular task.

Now, since I an not using a loop, I cannot use the time-tested "checking- for-a-flag" method to terminate the thread. Also, the javadocs recommend not using the stop() or suspend() functions.

Is there any other way to stop the thread?
Each query has its own Parameter Object. There are no static variables, except final static variables. Let me show you the debug listing I have created.

INSERT NEW QUERY -- New Query queued
START Handler: ELECTRIC -- Query title is ELECTRIC
IN getResultSet(),waiting: ELECTRIC -- Handler waiting for resultset
START Querier: ELECTRIC -- Query execution started
IN Querier, serviced: ELECTRIC -- Query execution completed
END Querier: ELECTRIC -- Querier exits
IN getResultSet(),notified: ELECTRIC -- Handler gets notified
IN HandlerThread: Received ResultSet, ELECTRIC query
END Handler: ELECTRIC -- Handler exits
DELETE


Here is the debug statements for the problem where the 2nd query runs the querier of the 3rd.

START Handler: SUBSCRIBER
IN getResultSet(),waiting: TELEPHONE
START Querier: TELEPHONE
IN Querier, serviced: TELEPHONE
END Querier: TELEPHONE
IN getResultSet(),notified: TELEPHONE
IN HandlerThread: Received ResultSet, SUBSCRIBER query
END Handler: SUBSCRIBER
DELETE

As you can see, although SUBSCRIBER query handler has started, it is the Querier for TELEPHONE which is running and it is that result which is getting displayed. Let me remind you, that the code is such that the Querier is started by the Handler, handler waits for the querier to get a resultset.

Some more interesting facts.

  • Inelegant Design

  • Since this is an enhancement for existing code that I'm doing, I did not have the luxury of coding from scratch to a particular design. The code i had to write was far from elegant. The Handler is started in one class, a reference is passed to another class and there the Querier is started. But since my one-off queries are running straight, I believe that my code is running properly.
  • Thread calling Thread

  • The Handler class extends thread and inside this class is a function which starts the Querier thread.

    I can't say if this is where the problem is. I've just mentioned it so you might get a better picture.
    Hi everyone,

    I have observed an odd problem while working on threads. Let me first explain.

    My application queues up queries and each are run one-by-one. Since, the GUI should be responsive while running the queries, I have made 3 external threads.

  • Handler - Takes care of running the query and displaying the results when it receives it. This is done so that the GUI thread can continue accepting new queries.
  • Querier - This thread is the one that actually runs the queries. This thread uses a parameter object to get the query, statement and other flags needed for the execution. This gets started by the Handler thread once there is a statement object (in my case as prepared-statement object)
  • Canceller - This thread is used to cancel the running statement in the Querier thread.


  • I have my own debug statements to find out how exactly the threads are working. The problem arises while simple execution. When I run, say 3 queries, one after the other there is no problem. Each one executes properly, and the output gets displayed properly. Same is the case if 2 queries are queued up. However, for 3 queued up queries, according to the timing, I get strange results.

  • 3 queries queued up

  • In this case, first query runs and results are displayed properly. For the 2nd and 3rd queries however, the outputs are the duplicated even though the conditions are different. So, if I'm searching for records with field = a and field = b, both my 2nd and 3rd query would show results with field =a.
  • 1st query has finished, 2 and 3rd are queued

  • Here, by the time I queued the 3rd query, the 1st one has completed. In this case, the 2nd query's Handler starts, but it runs the 3rd query's Querier.

    As I have mentioned, I pass all the required objects(prepared-statement,start and cancel flags) in a Parameter Object. But I cannot fathom why my program is giving me weird results. Can anyone help me?

    Thanking You in advance.
    Thanks for the suggestions guys !!!


    I have the situation under control now. It was a goof-up on my part.

    I had designed my code to run as a background thread, and it was. But the sequence of events which I had given gave me the impression that it actually wasn't. Let me clarify.

    After the user gives his required query and clicks run, I start the thread which executes the query. Next, I have a form which shows me the executing query with a title in a JTable.

    The confusion arose because as soon as I pressed the run button the query executes and the form becomes displayed. The form is instantiated only the first time i click on run. Hence, it takes some time for the object to be instantiated and the GUI to bring the form up. During this period, the run button remains depressed. So I assumed the query thread was not running as an independent thread, but under the event dispather thread. I also started assuming that threads blocking on I/O or query executions never yielded to other threads to execute.

    I accidentally stumbled upon the solution when I commented out the thread.start() function.

    I did go through the SwingWorker code and yes, it's very straight-forward. I was breaking my head literally for the past 2 days to get a solution. Well, like they say - No better way to learn things than to get down and get dirty.

    Thanks a lot, guys !!! ?
    I have a GUI application. From the GUI app, I can run database queries. During the time the database query is running, my GUI is unresponsive.

    I'd like to modify my application so that my GUI is responsive even while the query is executing. I have tried running the database query through a different thread. However, still the GUI remains unresponsive. Only after the query has completed can i perform any other activity.

    Swing GUI event are taken care of by the EventDispatcher thread. How do I create a thread that would run asynchronous of the EventDispatcher?

    I've gone through a lot of material but they have only mentioned about the background thread in SwingWorker. How does SwingWorker create background threads? Are they using Daemon threads?

    The code I have in the run function of the thread would ultimately contain

    rs = statement.executeQuery(... query statement...);

    So the next doubt i have is, even if i have put this is a query, the remainder of my code would only run once this statement has returned. So even in a background query, wouldn't the whole program execution pause for this statement to return a value? In which case what difference would it make in putting the query execution in a thread?

    I guess I ask too many questions at once. Anyways, Thanks in advance
    [ December 07, 2006: Message edited by: Varghese Paul ]
    Hi

    Thank you very much for your reply. I guess if the experts find your problem too insignificant, then it's upto the "not-experts" to help each others.

    I tried placing the contents in webapps/ROOT/ folder into the webapps folder but still the same error. BTW, the ROOT/ directory was shipped along with the installable and it contains the Welcome page for Tomcat.

    When I go to

    http://localhost:8080/

    I dont get the welcome page. However, there are other examples like servlet-examples/ which I can access when I go to

    http://localhost:8080/servlet-examples/

    (Yes, I also tried http://localhost:8080/ROOT/ but to no avail).

    Probably, there need to be some mappining for '/' to 'ROOT/' in the configuration, but I dont know where to put and how to put.

    Could you help me?
    Thanks anyways

    15 years ago
    Hi... I just recently installed Tomcat 5.5.17 on my Windows 2K machine. Let me just say that it's like a baptism by fire. I could solve a few problems. However, I'm really stuck on this one.

    When connecting to http://localhost:8080/ I'm getting a page with http status 404 and the message "Servlet org.apache.jsp.index_jsp is not available"

    After consulting numerous sites and friends and collegues, the problem still persists (real tough nut).

    I checked the locations. I have the application at %CATALINA_HOME%\webapps\ROOT\WEB-INF\lib.

    In the WEB-INF folder there is a web.xml and it seem to be ok.

    Also in the ROOT\ folder there is a index.jsp.

    I'm convinced that is a problem in the configuration file. But I'm not able to place my finger on it. After spending one whole day on it, Im really tired. So I thought, maybe someone could suggest some way to get the welcome page. (Two heads are greater than one).


    Thanking You in advance.

    Varghese
    15 years ago
    Mr. Herb Schildt I'm enlightened. Just before I opened your message, I was thinking of posting, why does sun have regular updates. As a developer its very hard to keep on re-adjusting to what you've already done from the earlier versions. Then I read your The Tiger Awakens. Its just great. The new features incorporated are just incredible. No, wonder then that jdk1.5 is a revolution in itself. Earlier versions just had some tweaks to existing frameworks. Jdk 1.5 is a quantum leap.
    16 years ago
    I read in a book that we should when not sure of size of string or during concatenation, it would be better if we must use StringBuffers. For example if we were adding two strings

    String a="Hello";
    String b="World";
    //instead of using a=a+b or a=a+"World", where we have declared a as a
    //string, we should have declared a as a type of StringBuffer and then
    //should have called the a.append("WOrld") function.

    Any specific reason?
    17 years ago