David Miranda

Ranch Hand
+ Follow
since Mar 14, 2005
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 David Miranda

EUREKA!

Well, the fix was remarkably easy.

Turns out that I needed to set the constraints fill to GridBagConstraints.BOTH for the component that I want to fill the remainder of both the horizontal and vertical space.

Here's the code for those who may come after with this problem (I've seen at least a half-dozen before me using search)


[ July 01, 2007: Message edited by: David Miranda ]
16 years ago
Thanks Mike

Does anyone know why the GridBagLayout code crushed the contents when the panel resize made it smaller?

Thanks
[ July 01, 2007: Message edited by: David Miranda ]
16 years ago
Hello,

Im trying to left-orient a JLabel and JList in a GridBagLayout panel thats in a split pane.

I'm using a GridBagLayout because I'm trying to left orient everything in the panel...I tried to use a BoxLayout but everything was center-oriented, the only way I found to get the Label to become left-oriented in the pane was to increase the size of the label to size of the surrounding pane (I dont want to hard code the size of the label )

I want the the GridBagLayout panel to resize correctly when the split pane is pulled up and down....but when I move the drag the split pane up towards the list, the JList gets crushed...not shrunk like expect...crushed and center-oriented in the panel

Please tell me what I'm doing wrong!

Also, if anybody can tell me how to left-orient components in the surrounding pane without using a GridBagLayout or hard-coding the component size, that'd be great.

Thanks,

David

Here's my code:



[ June 30, 2007: Message edited by: David Miranda ]
[ July 01, 2007: Message edited by: David Miranda ]
16 years ago
Turns out that I can use the mouseMove(int, int) method in the java.awt.Robot class
17 years ago
Hello,

I'm playing around with developing first-person perspective game. The player's view (look left/right/up/down) will be mouse driven. The only problem is that when the mouse pointer reaches the edge of the monitor, the mouse stops, and the rotation stops. It would be nice to be able to control the mouse pointer so that once the mouse hits the edge of the monitor, the mouse pointer can be programatically moved to the center of the screen, so that the user can continually mouse in one direction without interruption.

I'm not sure if it is possible to do this in Java...and I'm a little worried that I'll have to use jni calls to native libraries that handle this.

Anyways, my questions are:

1) Is it possible to control the pointer using standard Java libraries?
2) Is there a better way to produce this effect besides controlling the mouse?

Thanks,

David
17 years ago
Hello,

I've come across this Java VM performance article...

http://www.shudo.net/jit/perf/

It pretty much has performance metrics for many different JVMs (including other languages like Visual C++).

Anyways, they have metrics for the Java/Sun JDK 1.5.0 Client and Server VM.

The server VM performance seems significantly better than client VM (looks like server is twice as fast)...and it appears anyone can switch from client to server by simply adding the "-server" in the java call (correct me if Im wrong here).

My question is...why ever use the client when the server's performance seems to be so much better?

Thanks,

David
17 years ago
Hello all,

Is there any reason why a Java program would only process a partial resultset from LDAP?

I queried an LDAP database using a Java program, the LDAP logs say LDAP sent 10232 entries back:

op=1 msgId=2 - RESULT err=0 tag=101 nentries=10232 etime=1206 notes=U

But my program while(results.hasMoreElements()) returned 3012. No exceptions were thrown.

Any ideas why this would happen? Buffer overflow? Network issues? Client memory issues?

Thanks
17 years ago
Thanks for your input, Stefan and Bear!
18 years ago
JSP
Hi Rathi,

Im going through HD & JM's SCWCD book and came across a similiar example of code...according to them requests are typically thread safe, but they can become unsafe if the developer tries to create threads that access the request object in the doGET/POST() methods.
18 years ago
JSP
Hello all,

Is there anyway to pass a return statement back to a jsp?

(Reason why I ask is because sometimes my calling jsp will call a bean or servlet that will need to do response.sendRedirect() and do not want the calling jsp to continue processing...instead I want the calling jsp to just immediately redirect to avoid response already committed exceptions)

For instance,



To get the same effect as this at runtime:



Edit: Just to clarify a little bit. The reason why I do not want to handle the if/then return statement in the calling jsp is because I do not want others to have to write the if/then return logic into their calling jsps should they want to implement my bean/servlet.

Thanks!
[ December 15, 2005: Message edited by: David Miranda ]
18 years ago
JSP
Great! thanks!
18 years ago
Interesting...

Let me see if I got this right.

When you serialize an object, you serialize the object's non-static class-level properties?

The object itself is just a pile of property data in memory. Methods are not stored in the object. That's why an object can be serialized, because its just property data?

For instance, when a reference variable is declared as a type of class, eg:
String myString; //step 1
Im guessing the runtime environment knows that the myString reference can invoke methods of class String...but at this point there is no data to manipulate with this reference.

When this is called:
myString = new String("asdf"); //step2
The reference variable now points to a pile of data in memory. The data can now be manipulated by invoking methods of the reference class used in step 1 (String).

Is this correct?

Thanks

David
18 years ago
Hrmmm

Any idea how to get another app context using ServletContext.getContext(String uripath) in Weblogic 8.1?

Thanks!

David
18 years ago
Hello,

Is it possible to use the RequestDispatcher.forward() method to forward to a servlet in a different context path?

For example:

I have the following jsp:
http://localhost:8080/app1/index.jsp
...that tries to forward to:
http://localhost:8080/app2/myServlet

Here is the code that I am using in index.jsp:

RequestDispatcher rd = request.getSession().getServletContext().getRequestDispatcher("/app2/myServlet");
rd.forward(request,response);

It returns null.

I could use:
response.sendRedirect("/app2/myServlet");
But that sends the response back to the user before requesting the servlet, and would rather not use it if possible. :-/

Thanks!

David
18 years ago