Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!

Carlos A. Perez

Ranch Hand
+ Follow
since Apr 09, 2004
Merit badge: grant badges
For More
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 Carlos A. Perez

Campbell Ritchie wrote:

Carlos A. Perez wrote:. . . Hope they don't ban me . . :

They won't. Jeanne has previously said it is all right to make such small quotes.

Not sure, but the documentation for Files#move() says it is implementation specific whether the file is moved or whethr an exception is thrown, so you cannot say that an exception is always thrown.

Ok yes, but then what I'm understanding is that a directory called: "/animals" could be a valid file on certain implementation?? Because on windows I'm pretty sure it will always throw and exception.

So, on the test, if they don't explicitly say something is a valid directory (even when "/animals" looks like directory) then I can't assume is a valid or invalid one? and same for files? really?

Campbell Ritchie wrote:Pease supply full details of the question for those of us who don't have that book.

Is it possible? Hope they don't ban me from Javarach because some kind of legal infringements:

Assume monkey.txt is a file that exists in the current working directory. Which statements about the following code snippet are correct? (Choose all that apply.)

Files.move(Path.of("monkey.txt"), Paths.get("/animals"),

A. If /animals/monkey.txt exists, then it will be overwritten at runtime.
B. If /animals exists as an empty directory, then /animals/monkey.txt will be the new location of the file.
C. If monkey.txt is a symbolic link, then the file it points to will be moved at runtime.
D. If the move is successful and another process is monitoring the file system, then it will not see an incomplete file at runtime.
E. The code will always throw an exception at runtime.
Hi Jeanne & Scott:

On question #11 on Chapter 9 about copying a file named monkey.txt to /animals

And the answer is option D. If the move is successful and another process is monitoring the file system, then it will not see an incomplete file at runtime.

But also there is an answer E. The code will always throw an exception at runtime.

I think the correct option is E because that you are copying to a dir no to a file. On my machine i did the test and unless I change "/animals" to "animals" there is no way that this code doesn't throw an exception. Certainly option D says that "if its successful" but is never going to be successful if you don't modify it, and the option E is correct as it will always throws an exception.

Did I found an error or what is that I'm missing?


Hi everyone!

I'm new here so i think i need to introduce myself.
I have done programming for quite some time but then i started to have some management assignations so left it for a couple of years but i have returned and at this moment I'm trying to get certified on Java.
I did OCA 8 and I pass the exam, I read that we have the option to get certified on OCP 11 by taking the second test on 11 version so I'm studying for it BUT i just got noticed that OCP 11 is being replaced by one single java test for 11 version, so, I'm trying to rush before oct 1st but not sure if I'm going to make it by that date but I will do my best.

3 years ago
Hi everyone:

Im using Websphere for an application and we need to add/modify users and roles through the applicacion no via the administrative console or LDAP.

LDAP exists and contains all users but we can not change the user parameters to add or change their roles because is a global LDAP and the enterprise politics says that we can not change anything there (yes i know is a bad politic but exist), we can validate a user with their username an password but not add their roles or modify anything.

�Is there a way to add/modify users and roles via code inside my web app?

�Can we use the existing LDAP to authenticate users but having their roles somewhere else?

�Is there a way to authenticate a user against a DB but being able to use getRemoteUser inside the servlets? I need the user be able for the application, the libraries i use (and i can not use others) checks against getRemoteUser whos is the user so i can not just validate the user against the DB an put the user in session.

if someone can help me with one of this options that would be helpfull.

15 years ago
Hi, im migrating an app from 1.3 to 1.5. The window has a table with some components inside the table. When i mouse click in one type of component (a non standar component, someone did it) i got an exception, the second time i mouse click on the component it works fine. It happens only with a certain component.

The exception i get is:

at javax.swing.JComponent.registerNextFocusableComponent(Unknown Source)
at javax.swing.JComponent.setNextFocusableComponent(Unknown Source)
at javax.swing.JTable.prepareEditor(Unknown Source)
at javax.swing.JTable.editCellAt(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.adjustFocusAndSelection(Unknown Source)
at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at Source)

all of the classes displayed are from swing or awt so i dont have any idea how to solve this. Any Idea?

Also inside the table when whe have an Combo Box i have to clic twice so it display the list, the first time i mouse click it seems to display the list very very fast and then hide the list. Ive checked the events but no one seems to hace problems. Again, any idea?
[ November 14, 2007: Message edited by: Carlos A. Perez ]
16 years ago
First we detected performance problems in an specific point, we fixed it (the one i talked that took arround 20 seconds) it was a very poor programmed code.

BUT we still detect performance problems in general in all the application. (1.2 still runs faster in general)

This aplication is arround 17000 classes, we can not review all the code to fix bad code like we did in the code we fixed. Anyway badly or good programed its supposed to run faster with the new JVM.

Why not 1.4 o 1.5? They said that it was a lot of risk. So we did it first from 1.2 to 1.3

Do you think that any compiler option could help? which one?

It doesnt make sense to me that 1.3 runs slower.
16 years ago

I have an application that we are migrating from 1.2 to 1.3 we thougth that the change of versi�n would improve the performance but not.

The application is a fat client (AWT/Swing). In some test we get that in 1.2 takes 9 seconds to complete the task and in 1.3 the worse time was arround 20 seconds!!

I have test the app with some javac and java options but the results are similar.

�Is the JVM 1.3 slower than 1.2??? �Wasnt it suppose that new VM are faster than older? �whats happenning?
16 years ago

Has someone ever imported libraries compiled in for example java 1.3 in a project compiled with 1.2?? did you have any problem? how did you fix it?

In the company i work for is migrating an application from 1.2 to 1.3 but some other applications still will use 1.2 but the import some classes from the aplication migrated to 1.3. I know that is supossed that should be compatibility but mmmm... im not really sure.

16 years ago
Hi every one, im studing for SCWCD and found this question in a mock exam:

�Witch HTTP methods are NOT considered idempotent? but i dont understand what do they mean by "idempotent" in the context of web applications.

Also i would like to know what the doTrace method is for? an if its possible an example. I have read that its for to ask for a loopback but that doesnt give me an idea of how to write one.

The webpage says:

Javassist (Java Programming Assistant) makes Java bytecode manipulation simple. It is a class library for editing bytecodes in Java; it enables Java programs to define a new class at runtime and to modify a class file when the JVM loads it. Unlike other similar bytecode editors, Javassist provides two levels of API: source level and bytecode level. If the users use the source-level API, they can edit a class file without knowledge of the specifications of the Java bytecode. The whole API is designed with only the vocabulary of the Java language. You can even specify inserted bytecode in the form of source text; Javassist compiles it on the fly. On the other hand, the bytecode-level API allows the users to directly edit a class file as other editors.

But i still havent found any class to work with sources, im gonna try another aproach instead of what i wanted to do. im thinking seriously about starting an own project to have clases to work with surce code as i wanted to work with i think it could be usefull to create source code or modify source code in the same way Javassist does with byte codes.

17 years ago
Javassist is almost exactly what i want the problem is that it works with classes and y need it to work with sources (.java). Webpage says that has two levels of API, source and bytecode but i cant find any class to load, modify and write source files. The tutorial and the api never says something about source files.
17 years ago
Does anyone know about a Java Code Parser? i need to know how many methods a class has, the fields, etc, everything form the code of a .java. I know i could do it by reflection but i need to manipulate the code (add or remove methods/fields etc) thats why i need a parser for the code.
17 years ago
How do i port visual age's visual editor classes to websphere's visual editor?
My problem i that i cant open the visual age classes in the websphere's visual editor because it opens some components but other times doesnt show anything.

17 years ago