Aron Daburn

Ranch Hand
+ Follow
since Mar 18, 2007
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Aron Daburn

I understand that. How do I point the code to said directory? I don't want to hard code a path to that directory into the class. I want it to be configurable by the web app. So how does the web app pass in a variable to the controller class in Spring?
13 years ago
They will be "permanent files which should still be accessible even if your application, or the application server, is restarted".
13 years ago
New to Spring here trying to get a file upload. I have everything set up to handle the file, the form, controller, etc. I have it such that the controller gets the actual file, but my problem is now where to have the controller actually write the file to.

How do I get a path such that it will place it in a temp directory to have it available for the rest of the web application? I see an example where it saves to DB, gets a path from the System.properties (which seems bad to me) and then a hard coded value. How do I get a web application variable (relative path to tmp dir) from within the controller class?



(Code is just a simple prototype for learning)
13 years ago
Note: When I add

right before getting the lock

it works fine.


What is going on requiring a pause prior to getting the read lock? Am I not implementing ReentrantReadWriteLock properly?

How could this effect the behavior of getting the readLock? I'm at a loss here. Can I rely on this Thread.sleep() to always work? How do I respond when this goes through code review and am asked why the sleep is there? "Uh, it just made it work"
I am trying to use ReentrantReadWriteLock. I am getting some strange behavior that I can not figure out what is going on or how to remedy it.

The basic psudo code is as follows:




The code seemed to be running serially, with one thread entering the getRequest() at a time. I then added logging (basically a System.out.println) to try to debug where the unnecessary locking was occurring. When I added the debug line, it worked properly... ?

When I run the above with the log line commented out, it appears to run in a serial manner, as if getting the read lock locked out another thread from getting the read lock. When I uncomment the log line (have it log) it then works and all threads run the getRequest simultaneously. How could adding in the log line possibly effect the process!?


Output without the log line:

START TIME RTS| START INITIALIZATION : 1267116081402
RTS| DONE INITIALIZATION (0) : 2062
RTS| START GET VALUES : 0
Thread[9] GetValue
RTS| START GET VALUES : 0
RTS| START GET VALUES : 0
RTS| START GET VALUES : 0
RTS| START GET VALUES : 0
Thread[9] DoneGetValue
Thread[8] GetValue
RTS| DONE GET VALUES : 579
RTS| DONE PROCESSING VALUES : 0
test: 1;0001118143060001=1111234567000001;

Thread[8] DoneGetValue
Thread[10] GetValue
RTS| DONE GET VALUES : 593
RTS| DONE PROCESSING VALUES : 0
test: 1;0001118143060001=1111234567000001;

Thread[10] DoneGetValue
RTS| DONE GET VALUES : 594
RTS| DONE PROCESSING VALUES : 0
test: 1;0001118143060001=1111234567000001;

Thread[11] GetValue
Thread[11] DoneGetValue
Thread[7] GetValue
RTS| DONE GET VALUES : 594
RTS| DONE PROCESSING VALUES : 0
test: 1;0001118143060001=1111234567000001;

Thread[7] DoneGetValue
RTS| DONE GET VALUES : 781
RTS| DONE PROCESSING VALUES : 0
test: 1;0001118143060001=1111234567000001;


Output with the log line (desired behavior):
START TIME RTS| START INITIALIZATION : 1267116802941
RTS| DONE INITIALIZATION (0) : 2266
RTS| START GET VALUES : 31
Thread[10] Getting READ lock
Thread[10] GetValue
RTS| START GET VALUES : 0
RTS| START GET VALUES : 0
RTS| START GET VALUES : 0
RTS| START GET VALUES : 0
Thread[10] DoneGetValue
RTS| DONE GET VALUES : 750
RTS| DONE PROCESSING VALUES : 0
Thread[11] Getting READ lock
Thread[8] Getting READ lock
Thread[7] Getting READ lock
Thread[9] Getting READ lock
test: 1;0001118143060001=1111234567000001;
Thread[11] GetValue
Thread[7] GetValue
Thread[8] GetValue
Thread[9] GetValue

Thread[8] DoneGetValue
RTS| DONE GET VALUES : 797
RTS| DONE PROCESSING VALUES : 0
test: 1;0001118143060001=1111234567000001;

Thread[7] DoneGetValue
RTS| DONE GET VALUES : 47
RTS| DONE PROCESSING VALUES : 0
test: 1;0001118143060001=1111234567000001;

Thread[9] DoneGetValue
RTS| DONE GET VALUES : 31
RTS| DONE PROCESSING VALUES : 0
test: 1;0001118143060001=1111234567000001;

Thread[11] DoneGetValue
RTS| DONE GET VALUES : 2031
RTS| DONE PROCESSING VALUES : 0
test: 1;0001118143060001=1111234567000001;
Henry, a read/write lock seems to be exactly what I am looking for, thanks!

I have an object O that establishes a connection with a server and requests are rean through that object. To not have each thread have performance hit of initializing a connection, I am caching that object and having each thread simply call the get request (object O is thread safe to handle simultaneous get requests). My code needs to reinitialize the connection after X get requests which means when one thread is reinitializing the connection, no get requests should proceed. So, I think a read/write lock will be perfect for this.
Here's a riddle for you all.

The Setup:
I have function A and function B. I want function A and B to be synchronized within object O. Multiple threads will be accessing object O. When function B is running, no function As will be running and vice-versa.

The Problem:
Function A should not stop another function A from running. Simply having a lock for A and B will cause one A to lock out another A. How do you synchronize A and B together without locking multiple threads on A?
This is just to work with locally. I will be doing final testing on a Mac.


OK, working with Safari 3 for Windows XP, *most* of the frame issues work. However, there is a rather odd behavior happening.

This code snipit does not display the frame's contents:


But this does:


The only difference is I threw in some | characters around the frameset to determine where in the page the frame was at, and then it works!? I did a double take and removed them, didn't work. Added them back, worked... what gives?
Does Safari not allow frames to link to your local host? The following frame snipit works fine in Firefox and IE, but then doesn't make the call for the frame in Safari.




But if I replace the src to http://google.com, it loads google...




It is also not loading the frame contents when the pages are moved up to the server. Though, there javascript then sets the src of the frame on the page load. (It works perfect in IE and Firefox.)



What am I doing wrong for Safari? Why does it not load my page, but loads google's perfectly fine?

Edit:
I just downloaded Safari 4 for Windows XP, which I now see is 'beta'. I'll try it on Safari 3 and report back...
I figured it out. It seams a little silly having the solution, but for some reason I just wasn't coming up with it. On the first span I just set its width to give the proper spacing to move the other span to the right. Thanks for the help guys
If only the style sheet is accessible, is this possible to do?
I have a div with two spans in it. I need the first span to align left within the div, and the second span to align right within the div. I have tried everything I could think up to try and nothing seams to work. What do I need to do?

Say the following HTML



Then the .CSS file is


What do I need to fill in the CSS to get it such that all of the 'form-label' spans align left, and all of the 'form-input' spans align right within the div.
I am using a class loader and in one instance, it works perfectly fine, and then in another instance I get a ClassNotFoundException when trying to load a class, particularly on the loadClass() method.

Here is the background information: I am developing a website using MyEclipse and it is being ran on a JRun server. The instance on when the class loader works correctly is when the class I am trying to load is in a separate jar folder that has been included in the web project's class path. The instance where it throws the ClassNotFoundException is when the class is in a package in the web project itself. Now, the class loader is in a separate jar folder from the project.

Why is the class loader throwing the exception when the class it is trying to load is in the webproject itself but not when it is in a separate jar? Shouldn't it be able to find it when it is in the webproject?
17 years ago
Does anybody know of a good JSP page counter solution out there? It has to be free, allowed for commercial use, track hits per session, and I will need to have the ability to customize what it records.

Thanks for any suggestions!
17 years ago
JSP
I just found out what the problem was. Though, I'm not yet sure what caused the problem. Apparently a jar file being used by the listener was not being updated when I was replacing it. Thus, the call to the new debug String I added was not allowing it to compile correctly.

Something seemed a little fishy so I thought I would ask, but it is working now. Thanks for the help.
17 years ago