Doanh Nguyen

Ranch Hand
+ Follow
since Dec 02, 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 Doanh Nguyen

Originally posted by Mike Curwen:
...My WHERE clause kills off any rows that make it past the outer join I guess.


The result from a Left Outer Join should include the rows from the left table that were missing from the inner join.
May I suggest that you remove the WHERE clause to see if 5 rows are indeed returned? If yes, then you need to work on your predicate. Without sample data from 2 tables and the intended result, it's difficult to suggest a code.
[ May 12, 2003: Message edited by: Doanh Nguyen ]
[ May 12, 2003: Message edited by: Doanh Nguyen ]

Originally posted by Roy Huang:
...the exception will be thrown and the other HTTP application thread will be stopped.
...since when the HTTP application is finished, it can not stop the timer thread correctly.


I am confused. Do you want the timer to stop the HTTP application or the HTTP application to stop the timer?

Originally posted by Venkat Suryadevara:
I am unable to run a java program from a batch file that i created.spiderpackage.EntryPoint is a class file which I am trying to run with a -v option to output something.What should I do to get the output?


I think a web page, i.e., IE, runs in the windows operating system whereas a batch file runs in its dos-like address space, which accommodates JVM to run your java class. I am not sure if direct communication between these two address spaces is possible. You may want to modify your Java program to write to a file...
18 years ago

Originally posted by kimsy:
On one of my recent job interviews, I was asked "In C/C++ and Java, why does the array index start with 0 instead of 1"?


Why not?
18 years ago

Originally posted by Shyam Purkayastha:
a few monitering utilities available for java


I would be happy if only one exists. No I cannot name any. Maybe none exists. JVM controls execution of threads, which may run concurrently but independent of one another. If there is any monitoring exist, it must come JVM itself.
19 years ago
Would you care to elaborate on the requirement to display such line number? Is it for debugging?
[ September 25, 2002: Message edited by: Doanh Nguyen ]
19 years ago

Originally posted by hallian:
Is there a nice way to catch this error and do some clean up and kill a Thread while letting other Threads to keep continue and finish properly.


To me an out-of-memory error implies a logic error. Without any memory left, JVM will crash because there is nothing left to run. Instead of catching it and ignoring it, I would try to fix the cause.
If the cause is the number of threads generated then you can increase memory or limit the threads.

Originally posted by hallian:
What happens to a Thread if OutOfMemory error occurs.


Will it be captured by UFO?
[ September 24, 2002: Message edited by: Doanh Nguyen ]
19 years ago

Originally posted by Shyam Purkayastha:
Yes that is my idea even.


I guess you need a monitoring utility...
[ September 24, 2002: Message edited by: Doanh Nguyen ]
19 years ago
Just a thought: Create a separate thread to run concurrently with the main thread. Every time the main thread creates an object that you want to track, it increments a static counter. The other thread has only to display that counter.
19 years ago

Originally posted by Jose Botella:
Doanh we mean the size of a boolean within the JVM.
This is from JVMS 3.3.4


Yes , many computer languages use only one bit to handle binary conditions such as on or off, true or false, yes or no... From the storage viewpoint, it takes a little bit more than one bit to hold that one bit. In fact, it takes 8 bits. Languages with bit-manipulating capability used to pack up to eight boolean bits in one byte to save storage.
The answers should be A,C.
The AWT thread invokes the update() method, which in turn, calls the paint() method. These method are "internal" to AWT. Application programs should call repaint().
[ September 21, 2002: Message edited by: Doanh Nguyen ]
Hi everyone,
I passed the SCPJ2 this afternoon with %88. My hope was to achieve a minimum of 80%. So I am very happy to meet my goal. There were two
surprises in my test: First, the passing score is 61% instead of 71% as stated in my Mughal book (3rd ed. p.612). Second, the first 2 or 3 questions were about non-disclosure agreement and granting Sun permission to use my data. They WERE part of the allocated 120 minutes! I was quite alarmed after spending nearly 5 minutes answering them when I noticed my clock was ticking. If there was another request to sign my house over to Sun after that, I would not have noticed. Any way, I think this is the worst part of the exam. If they don't know how to start the timer after these questions. I would be more than happy to help. Again, I wondered about the intelligence of the exam maker. By the time I finished all the questions, I only had about 10 minutes left to review them, and changed nothing. I never felt I had to answer any question in a hurry.
My preparation strategy consisted of one book, A Programmer's Guide To Java Certification, roughly 700 mock exam questions collected over the internet, and the indispensable and friendly help from JavaRanch folk.
For every question that I failed, I made a flash card on the points missed. So I ended up making over 300 cards. And the rest of the time was devoted to "playing" these questions and flash cards over and over... The so-called "pattern recognition effect", the effect that caused me to remember the answers just by glancing at the questions without really thinking through them, was minimized by putting these questions in a pool
and randomizing their order. Also, questions that originally incorporate their question numbers in their class names, e.g., public class Q045, Qd5b6c, Q12, etc, were changed to more generic class names to minimize this effect.
My conclusion: There is no better way to prepare for an exam than to take an exam. And lots of them. No single book or set of questions could have prepared me as well as these 700 questions because they touched every aspect of the exam. Indeed, I recognized several questions that matched the patterns of the mock exam questions. One book (any good book) and 700 hundred questions did it for me.
Here are the collections, in no particular order: JHunt, Jxam, Kumar, TestCafe, Mughal, Marcus 1, 2, 3, MindQ, and Valentin.
And I am indebted to these authors and the JavaRanch folk.
Good luck to all,
Doanh Nguyen SCPJ2
19 years ago

Originally posted by Dirk Schreckmann:
Doanh's strategy doesn't work in anything I can construe.


Hi Dirk,
What seems to be the trouble?
When I read the original post, I remembered once I was quite annoyed for having to position the mouse inside a text area and click it before I could start typing. And I solved the problem with the requestFocus() function. That's why I suggested it so the poster can explore the method and apply to his GUI. My solution is now buried inside a few hundred-line program, which calls another few hundred-line program and reads one file. It would be easier for me to write a new code than ripping it apart... But I don't recall having much trouble with it.
Another nagging problem encountered by beginning GUI developers is when the text is longer than the view area and the display always shows the end instead of the beginning of the text, so the user had to scroll up just to view the beginning of the text. Now that was a MAJOR annoyance. As you may have discovered, the setCaretPosition(0) on a swing text area solved it.
19 years ago
This code seems to suggest that it's 1 byte long:
import java.io.*;
public class Java {
public static void main(String[] args) throws IOException{
RandomAccessFile raf = new RandomAccessFile("test.dat","rw");
raf.writeInt(1);
raf.writeShort(2);
raf.writeByte(3);
System.out.println(raf.length());
boolean b = true;
raf.writeBoolean(b);
System.out.println(raf.length());
raf.seek(raf.length()-1);
b = raf.readBoolean();
System.out.println(b);
}
}

Originally posted by Rob Petterson:
Where am I going wrong with this?


I think you mean i >>>=1; not i >>> =1;
>>> is an unsigned shift operator.
[ May 05, 2002: Message edited by: Doanh Nguyen ]