Wai Iu

Ranch Hand
+ Follow
since Apr 04, 2000
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 Wai Iu

Just passed SCWCD 1.4 with 84%. I am very satisfied with the score. It is better than what I thought.

The exam questions are straighforward. I got 70 questions. One of them is a test question for the furture exam. It doesn't be counted in the score. But the exam didn't tell which one it is.

How did I prepare for the exam?
I used HFSJ book to study exam, did the mock exams from www.j2eecertificate.com and JWebPlus, and used Servlet 2.4 spec, JSP 2.0 spec and JSTL 1.1 spec as the references. I read HFSJ book two times (Three times for some of chapters). Before I took the exam, I passed the final mock exam in HFSJ with 68%. Since I am busy on my daily work, only studied the exam at night and at weekend. It took me 8 weeks to finish the exam.

Anyway, now I can relax a little for a happy holiday season.

Many thanks to the posts in this place. They gave me the great helps. Wish your guys good luck in your exam and have a happy holiday.

Wai Iu
Question 12 : Wich is true about the lifecycle of a Simple tag?

answer D: The JspFragment of the tag body is invoked by the Container before the tag handler's doTag method is called. This Value, a BodyContent object, is passed to the tahe handler using setJspBody method.

I think D is a correct answer. But the book says it is wrong. The reason is " Option D is invalid becuase the fragment is invokde by the doTag implementation, NOT before doTag is called."

I check the lifecycle of the simeple Tag in JSP 2.4(pg. 2-81) and the HSF book(pg. 506). The JspFragment is invoked by setJspBody method before doTag(). Where am I wrong here?

Thanks!

Waiyung
Hi, Ricardo Polero, for your question:


Would you explain a little bit you design , the used patterns and
the docs? How did you deal with the local/remote Dataclient?


please refer to the response that I give to Andras Nemeth.
Hi, Ricardo Polero, for your question:


Would you explain a little bit you design , the used patterns and
the docs? How did you deal with the local/remote Dataclient?


please refer to the response that I give to Ricardo Polero.

Hi, Andras Nemeth, for your question:


Could you write a bit about your General Consideration and Documentation, inasmuch as you got maximum points on them.


General Considerations includes three areas: 1) ease of use; 2)coding standards and readibility; 3) clarify and Maintainability of the design and implementation. You must following the Java code styles to satisfy 2). 1) and 3) relate to your program structure and design.

    My program structure as following:
  1. use RMI
  2. directly modify Data.java file instead of subclassing it.
  3. on the server side, use adapater pattern to generate one instance of Data object and put it into RMI registry.
  4. on the client side, use factory pattern to code a DataClient.java class. It enbles clients to assess the local db.db file or network db.db file with the same method signature.
  5. use adapter pattern code a business layer bewteen GUI and DataClient.java. This business layer seperates businness logic from GUI.
  6. In GUI, use Command pattern. This pattern seperates the GUI objects from their corresponding actions. This will make code maintainence much easier.
  7. Use JTable to display the data. I use AbstarctTable Model to build this JTable.

  8. For Documentaion, it is a great pain. I spent amlost one week to finish documentsation. You must provides user documentation, javadoc files, and comments according to the exam specification. One thing I think is important. You must provide a clear, concise and readable README.txt file. Even you do not do very well in other portions of documentation, having a good README.TXT will do youself a great flavor.
Hi, everyone. I passed the Developer exam. I took the written exam on August 8th, 2001. On August 19, 2001, Sun post my test result on the web. The following is my detailed result:

This place gives me a lot of helps and expedites my learning process. Thanks!
I use RMI to code Network connection. My RMI program structure as following:

I have a server program call DBServer in suncertify\server directory. I use rmic create DBServer_stub.class file in this directory.
I create a client jar file, called client.jar, which including the following files:

The strange thing is when I use the command

to run client code, the computer complains that it can not find suncertify\server\DBServer_stub.class. If I just directly run my
client code using java command, like

it just works fine. ALl these code are in proper package.
I do not know the reason? any one can help?
Thanks!

Thanks, Peter, Kevin, Trevor. It really helps.
I am doing FBN project. When we directly assess the Data class locally, for the ticket booking function, do we need lock() and unlock() functions just like Network access does? I think that we do not need lock() and unlock() functions here because only one user can assess that db.db file locally. There are no multi-threads here. There is no way the sequence-read, modify and write can be changed.
Any thought about htis? Please help.
Thanks
Peter:
Thanks for your advice. This thread safe issue really annoys me. I carefully read your reply:
1 You relpy:


You cannot safely let multiple Data classes operate on the
same file.
[/qoute]
I totally agree.
2. You reply:


A misconceived suggestion. Singleton is one of the most
abused design patterns, and Data should certainly not be
a Singleton. For a start, it is quite acceptable for a
database to have multiple tables...


I am confusing about this. What I originally mean is to generate one instance of Data class from DataServer class by using Singleton pattern. Is this wrong? Data class itself is just an onject, not a Singleton. Singleton is just a pattern name, which generate only one instance of the certain object by using it. Can you clarify it a little more?

By the way, my Dataserver design is to use Data server as a proxy for the Data class. could you give some ideas about this structure of the Data Server? Now I am a little confusing?
Thanks a lot!

The exam document mentioned that we should provide a thread-safe DataServer implementation. I have a question about this issue:
My code:

The above code says that everytime a user tries to request a reference from DataServer, a new instance of Data class will be created for each user. Since the Data class has lock(), unlock() methods(guaranty only one user can update a record at the same time if there are two users try to update the same records) and syncronized methods(guaranty that only one thread can be executed at one time if there are three threads try to assess the db.db file at the same time). I think that my code will be thread safe.
However, I saw some previous dicussions about this issue here. some suggest that when implementing a remote interface(DataServerInterface in this case), the implementation method should apply a Singleton design and only generate one instance of Data class. This means that no matter how many users try to assess db.db fiel, only one instance of Data class will be created.
I am not sure the difference between my code and the Singleton design. Actually, all these come to one question: Does every instance of Data class has its own monitor? Or all instances of Data class have only one monitor? If 1st case, my code is wrong since mutile instances of Data class can assess their own synchronized method at the same time. This definitly is not thread-safe. If 2nd case, my code is right since all instances of Data class will compete for one monitor. This lead to thread safe.
Please help me clarify this? Thanks!

I use jdbc to connect to Oracle 8.1.5 database. In my program,
I have a sentence:
CallableStatement cstmta=conna.prepareCall("begin selectall(?); end;");
It use a callablestatement to call a stored procedure-selectall.
The procedure selectall is:
create or replace procedure
selectall (allrow OUT employee_types%ROWTYPE)
as
begin select * into allrow from employee_types;
employee_types is a table in database.
My question are:
1)how could I associate datatype with the OUT parameter of the stored procedure? What will be xxxx in
"cstmta.registerOutParameter(1,xxxx);"?
2)how could I retrieve a Resultset from the CallableStatement?
Thanks!
Wai

Thanks Kulkarni and Kumar. I have two points needed to be
clarified here:
1. My oracle driver is called classes111.zip. It is located in
the directory c:\jdbc . My code is called jdbc3.java. When
I compiled the code, I used the command:
<CODE>
javac -classpath c:\jdbc\classes111.zip jdbc3.java
</CODE>
It compiled. But when I run the code, It just did not work.
2.Oracle8i 8.1.6.0.1 JDBC-OCI/WIN NT driver is Oracle's type 2
JDBC driver for window NT, not from other vendors.
Please help me out.
Wai
I tried to use Oracle's JDBC/OCI driver to contact Oracle
database. My computer environment as following:
Window NT 4.O1
Oracle 7.3.4
Java JDK 1.2.2
Oracle8i 8.1.6.0.1 JDBC-OCI/WIN NT driver for JDK1.2
I can compile the following codes:
<CODE>
import java.net.URL;
import java.sql.*;
public class jdbc3{
public static void main(String args[]) {
String url = "jdbc racle ci8:@ORCL";
Connection con;
String createString;
createString = "insert into SUP(SUP_ID,SUP_NAME,STREET,
CITY,STATE,ZIP)"+"VALUES(102,'Tofu,Inc.','99 Passaic
Street','Passaic','NJ','07009');";
Statement stmt;
try {
DriverManager.registerDriver (new oracle.jdbc.driver.
OracleDriver());
con = DriverManager.getConnection(url, "xxx",
"xxxxxx");
stmt = con.createStatement();
stmt.executeUpdate(createString);
stmt.close();
con.close();
}
catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
}
}
}
</CODE>
However, I failed to run the above code in Java. I always got
the same wrong message as following:
Exception in the thread"main" java.lang.NoClassDefFoundError:
oracle/jdbc/driver/oracleDriver

This thing drove me crazy. I checked all the oracle documents
about JDBC/OCI driver.It seems that the envrionment setting is
fine, the code is fine and it can compile. But it just does not
work.
Thanks for all possible helps for this problem.
Wai


In my case, I would say 15%. When preparing the exam, I came to
this site not just for my question. I also followed other people
' questions. Interestingly, most of the people shared the
similar difficult problems. I gained a lot from this situation.