Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Zafer Abu saeed

Ranch Hand
+ Follow
since Mar 28, 2004
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 Zafer Abu saeed

Hello all,
I need to generate XML files according to an XSD (schema).
The schema is somehow complex, and I need to know which is an easy and flexible (minimal hardcoding) way to generate XML files to be valid based on this schema.
I heared about several APIs and tools, but I have no experience in none of these, so can somebody please help me and advise for the best way to generate XML files.?
Thanks in advance
Thank you for the answer.
One more question, the exam name is "Sun Certified Developer for Java 2 Platform", notice the "Java 2". Is Java 1.5 a member of the Java 2 family ?
My assignment is Bodgitt and Scarper, version 2.1.2. I downloaded it in March 2004, and due to the complexity of my life I was not able to work on it until last week. (Actually I have started several times, but never succeeded to continue). Is this assignment still valid ? Can I implement and submit it ? On what JDK ?
One final thought..

I was searching for all magic-cookie-related threads, and read them all, found that many guys are hard-coding the value of the magic cookie in the Data class source.
Therefore it will not be possible to use the same Data class for interpreting other database files without touching the source code first (to change the hard-coded magic cookie value).
If this is the case (source code will be modified anyway) then I don't see another reason not to make the Data class singleton.

(+) I think it will be better to set the magic value in the properties file instead of hard-coding it in the source code.

[ November 23, 2005: Message edited by: Zafer Abu saeed ]

Any unimplemented exceptions in this interface must all be created as member classes of the suncertify.db package. Each must have a zero argument constructor and a second constructor that takes a String that serves as the exception's description.

Does this mean that only two constructors (zero argument, and String) are allowed?
Starting JDK 1.4 there is a very useful feature of wrapping exceptions using the Exception(Throwable cause) constructor. Can we use (implement) this constructor as well?
I love it when someone answers my questions.
And I love it more when someone can understand the issues that I face from my confused questions and answer them for me.

Thank you very much Andrew.

For me, I will use Single Data instance (but not singleton class) and single RAF instance. This will be easier for me and for the junior programmer!
Hello everybody,

I'm to implement the Data class, and I have the following options regarding the realtionship
between Data class, RAF instance(s), and clients:

- Singleton Data/static RAF to server all clients
- Singleton Data/new RAF object for each call to a data-access-method (read, update,..)
- One Data instance+RAF object for each client

I think the second way (new RAF for every data-access call) is superfluous, but what about the
first and the third options?

Can someone please elaborate on which of these methods is better and why..

Thanks in advance.
Thank you Valentin. This is nice to know.
Yesterday was my first lesson on Webservices (just read the preface of the blueprint), and I'm planning to focus on webservices for the next few months. I will be visiting this forum constantly.
Hello everybody,

I'm planning to set for the SCDJWS exam within the next two months, however I'm wondered if releasing the new Java EE 5 (scheduled for the second half of 2005 or the first quarter of 2006) will cause the exam to be upgraded, thus the SCDJWS 1.4 certification will be outdated quickly..

- How long it takes usually from Sun to upgrade an exam after releasing new SDKs?
- I have downloaded the Java BluePrint for webservices, is there any better/recommended resources to prepare for the exam?

I will use the Integer.parseInt() method

(also I think writing a checking method is a sort of re-inventing the wheel).
15 years ago
Thank you Pascal and Ben.

I realized that checking for digits may not be enough.
So, I will modify our checking method to be:

This way, a String will be considered as representing an integer if:
1. All characters are digits.
2. The length of the String is less or equal ot the length of the MAX_INT.
3. char(i) of the String is "smaller" than char(i) of the MAX_INT.

(even though you could find other problems with this method, always there will be a work-around

Basically my question is: Is it better to use such a method, or use parseInt() and catch NumberFormatException.
I know parseInt() is easier, less coding, and may be faster, but isn't bad to cacth RuntimeExceptions ?
15 years ago
Hello all,
My understanding is that its not a good practice to catch RuntimeExceptions, right?

Now if I have a String that is supposed to represent a number (an integer) and I want to check if the String is representing a valid number or not, what is the better way:
1. Using Integer.parseInt(str) and catch NumberFormatException (which is a RuntimeException, and should not be catched!)

2. Or implementing a utility method that checks every character in the String to see if its a digit or not, and return a boolean. (though this could be slower than the first way).
15 years ago
Originally posted by Andrew:

If you are using RMI, then the RMI server will be creating new threads for each connected client (which means you must ensure your server code is thread safe).

But as far as I know, a request to a remote server could cause a
new Thread to be created (and could reuse an already created Thread).

see this from the RMI 1.4 specs:

A method dispatched by the RMI runtime to a remote object implementation
may or may not execute in a separate thread. The RMI runtime makes no
guarantees with respect to mapping remote object invocations to threads.

I beleive that even identical assignments (same version) can be implemented
in several ways. All of them can pass.
(For me, most importantly, this applies to the thin vs fat client issue, I beleive both of them are acceptable).

Why I'm saying that?

Yesterday I had a problem with our web application at the company, it was
tested on Tomcat and confirmed to work without problems. When we moved
it to Weblogic, we immediately had a problem with the ServletContext.getRealPath() method, and discovered that different containers are implementing it different ways.

Then I found a nice opinion about this from a person who encountered the same problem:

"After few hours of playing around i've managed to run my application on all 3 containers and in the process i've learned that they all slightly differ. In most cases they are all correct in their specification interpretation but since the specification leaves some freedom here and there, you can encounter different and strange errors if you move your application across containers."
(see the source)

So, if the specification of Servlet Containers can be interpreted several ways, all of them considered correct and certified, then so the specifications of the assignemnt!
I'm using the same Dialog (actually JFrame) for getting the configurations
for all modes: stand-alone mode, network-client mode, and server mode.

For each mode, I hide some fields (the unused fields) and show others.

For example:
-In the stand-alone mode, I show the "file-location" field, and hide
the "port" field and the "server IP" field.
- In the server mode, I show the "file-location" field and the "port"
field, and hide the "server IP" field.

Is this a bad design?

Would it be better to implement two dialogs, one for the client modes, and
one for the server mode, so that changes for one side will not affect the