This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Zero to AI - A non-technical, hype-free guide to prospering in the AI era and have Nicolò Valigi and Gianluca Mauro on-line!
See this thread for details.
Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!

Fernando Matias Valadao

Greenhorn
+ Follow
since Feb 19, 2003
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 Fernando Matias Valadao

Hello, Bert!
Thanks for replying promptly and I'm sorry for not searching the forums before posting this issue.
Regards,

Fernando.
[ February 18, 2006: Message edited by: Fernando Matias Valadao ]
Hello, there!
I have just started to study for the SCJP 5.0 exam using the "Sun Certified Programmer for Java 5 Study Guide", by Kathy Sierra and Bert Bates.
I'd like to share with you a possible mistake that the authors commited in the question number 16, page 634 (Chapter 7, "Generics and Collections").
The answers are supposed to be letters "B", "E" and "F", but if you try to compile the code using any of this "possible" answers, IT WON'T COMPILE .
When using letter B, for example, the compiler error is as it follows:

"Type mismatch: cannot convert from List<capture-of ? super Integer> to List<Integer>"

You'll get similar errors if you use options "E" or "F".

To sum up: in my opinion, the correct answer would be letter "G. none of the above".

Please, Kathy and Bert, I would love that you both post any consideration regarding this question. Does it all of this story make sense or did I misunderstand ithe question?
Best wishes,

Fernando

P.S.: Letters "B", "E" and "F" may be corrected like this:

B. ArrayList<Integer> input = null;
List<? super Integer> output = null;

E. List<Number> input = null;
List<? super Number> output = null;

F. List<Integer> input = null;
List<? super Integer> output = null;

Another possible answer, which is not covered by the question but is quiet interesting to think about, is this:
List<Number> input = null;
List<? super Integer> output = null;
[ February 18, 2006: Message edited by: Fernando Matias Valadao ]
Hello there!
I don't know if this is the most appropriate Sun forum to ask this kind of question, but as I didn't find a better one, I'm gonna post it here, so please, don't blame me

I need to convert some Postscripts files to PDF. The solution I came up with was to print these files to "Adobe Acrobat Distiller printer", as it follows:

...
PrintService[] printers = PrintServiceLookup.lookupPrintServices(null, null);
PrintService printer = //some logic iterating through "printers" to find the "Distiller" printer

//Creates the output file attribute
URI uri = new URI("file:/" + dest);
Destination destFile = new Destination(uri);
PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
attributes.add(destFile);

//Creates the input Postscript doc
InputStream ps = new FileInputStream(path);
Doc printerDoc = new SimpleDoc(ps, INPUT_STREAM.POSTSCRIPT, null);

//Finally prints the doc
DocPrintJob printerJob = printer.createPrintJob();
printerJob.print(printerDoc, attributes);

The problem is that the output file is ALSO a Postscript, and not a PDF (which is the Distiller output format).
It's tricky because if you print any document to Distiller (for example, a Word document inside Word program), the output is a PDF file.
Does anybody know why this is happening? Am I missing any configuration in the Java API?
Please, let me know if you have any issue concerning this problem.

Best wishes,

Fernando
14 years ago
Hi, Arnaud!
It worked!!! I did it this way:

...
InputStream configStream = ClassLoader.getSystemClassLoader().getResourceAsStream("conf/conf.properties");
Properties confFile = new Properties();
try {
confFile.load(configStream);
...

Thank you very much!


Fernando
15 years ago
Thank you for replying, Arnaud, but are you sure it works?
I have tried it the way you posted but the input stream is empty.
Do you have any idea why this is happening?

Fernando
15 years ago
Hi, buddies!
I've packaged my Java app into a runnable jar file, which beyound the .class files also include a "conf/conf.properties".
Therefore, my app.jar looks like this:

com/enterprise/*.class
META-INF/MANIFEST.MF
conf/conf.properties

The problem is that my app runnable class can't find the "conf/conf.properties". The error is "The system cannot find the path specified".

If I take it out and put it in a directory ("conf/conf.properties"), everything works just fine.

Does it mean I have to put the conf/conf.properties outside the .jar file? Or am I doing some kind of ?
Thanks in advance.

Fernando
15 years ago
Hey, guys!
Are you sure that the versions are 2.4 (Servlets) and 2.0 (JSPs)?
Here JavaRanch FAQ we can see that the versions are 2.3 (Servlets) and 1.2 (JSP).
I'm a bit confused about this!
I wish that I might have not read the wrong versions.
Could someone make it clear?
Thanks in advance

Fernando
Hi, Shandilya!
First of all, I'm sorry for the delay in replying your question.
I don't think that HFEJB is enough. You should read the EJB 2.0 specification (almost all of it is covered in the 1.3 exam). If you read it, then I think it's suficient.

Fernando
15 years ago
Ladies and gentlemen,

I'm happy and proud to notice that I passed SCBCD today with the score of 94%!!!
Thanks to all of you who helped me answering my doubts!!!
Now let's head to SCWCD!
Cheers!!!

Fernando
15 years ago
I suppose it's because the primary key can't be "int" or any other primitive type, but I'm not sure about this. It should have been declarad "Integer" or any other wrapper type.
Can anyone confirm this or give us another reason?
Thanks.
Hey Kathy / Valentin / Bert:
Don't you have any tips to solve our question?
Thanks in advance

Fernando
Hi, Dan
Thank you very much for your reply.
I understood your consideration, but what I was arguing about was the instance variables of the bean that is about to be passivated/activated, not the bean itself.
I was asking about the differences between HFEJB and the spec (or maybe there was no difference and I was just
Again: In HFEJB it's written that "bean's local component or home interface are an example of "passivatable" instance variable", while in the spec we can read that "entity's local component or home interface can be serialized".
Hope it became clearer now.
Thanks.

Fernando
Hi, guys!
On page 203 of HFEJB book, you can see that "bean's local component or home interface" are an example of "passivatable" instance variable. That is, it can be either an entity local component interface or a session local component interface.
Unfortunatelly , on page 71 of the spec, you find out that only "entity's local component or home interface" can be serialized.
So according to the spec, isn't a requirement to serialize the references to session local interfaces (component and home)? That's exactly what HFEJB is pointing!
Thanks in advance.
Hi, Bert
The relationship is explictly defined there, ok?
See it:

OrderBean (1) <--> LineItemsBean (n)

I shall say again that it was my fault. I really like the question the way it is
Thank you very much.