Doug Morand

Greenhorn
+ Follow
since Jan 31, 2012
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Doug Morand

Excellent thanks, let me check that out.
12 years ago
What's the best way to handle read/write of files within the same JVM? I thought I should be using file locks, but based on what I read for FileLock it looks like this isn't suitable for threads in the same JVM.
From FileLock javadoc:
"File locks are held on behalf of the entire Java virtual machine. They are not suitable for controlling access to a file by multiple threads within the same virtual machine."

I have 2 threads, one which is creating files, and the other which is reading those files and will move them to another location once finished. What's the best way to handle this so that my thread which reads files doesn't run into a situation where it tries to read a file which Thread1 is trying to write still. Should I just create the File object and check the canWrite() method to make sure I can get access to the file?
12 years ago
I am using the javadoc html location http://download.eclipse.org/jetty/stable-7/apidocs/ to link to the javadoc. I right clicked on my jar file in eclipse and added it in there. I've tried restarting eclipse, but still nothing.
12 years ago
I'm trying to build a new application in eclipse which is using Jetty. I'd like to be able to use content assist (CTRL + space) so that I can view the javadoc info from the jetty classes. I tried to add a javadoc location to a few of the jar files I imported (http://download.eclipse.org/jetty/stable-7/apidocs/) but I'm not getting anything in the content assist window. Has anyone had any luck with this for other apis? I have it working fine for the JDK but only because I attached the src.zip

12 years ago
I got it working. I had the wrong version of subclipse instsalled. We have SVN 1.6 so I needed to install this version:

http://subclipse.tigris.org/update_1.6.x

I had installed this one and it wasn't working properly:
http://subclipse.tigris.org/update_1.8.x

Download site: http://subclipse.tigris.org/servlets/ProjectProcess;jsessionid=59E3F12551957114E5CABB27F497A6E8?pageID=p4wYuA

Thanks for the assistance everyone it lead me down the right path to figure this out.
We are using _trunk _tags and _branches as the folder names. I'm able to view the history on any of the files in the tags/branches I have checked out.
I'm using Eclipse and Subclipse with my SVN repository. I'm trying to compare a tag I have checked out versus another tag so I select Compare With -> Branch (or Tag). In both instances I get the following errors:

"There are no tags for resource"
"There are no branches for resource"

Is there something in the Team preferences that I have to configure so that I can compare with other branches/tags?
Has anyone used this? I'm debating between this site and learnjavanow
12 years ago
I watched a couple sample videos and this looks pretty decent. Has anyone used this site recently? $99 doesn't seem too bad, but I would like to hear from someone if they thought the videos were worth while or not.
12 years ago
Thanks for the info. I was just confused on how the TreeMap worked. I'm going to just use a HashMap instead, and just sort the keys once I'm ready to access it. Thanks!
12 years ago
Does someone have an example of how to use a TreeMap to not insert duplicates, but sort on a different value from the key?
12 years ago
Thanks that makes sense.

Seems that in this case where I don't want duplicate IDs inserted, but then also sort by the Name then I should just use a HashMap and then pass the keySet to a TreeSet with a name comparator
12 years ago

Jeff Verdegan wrote:

Doug Morand wrote:Seems that the TreeMap is a bit tricky to implement.



I doubt you're implementing TreeMap. More likely you're using it. And it's not hard to use at all. But you have to use it consistently. For instance, checking for something being contained should be consistent with it being equal to something else in your tree as per the comparator.



The new class I just posted now has the compareTo and the equals being consistent, but now everything is based off the ID. I was under the impression that I would use the Comparator to sort the list properly, but now I'm seeing that it's being used to determine if the key is contained within the Set
12 years ago
Alright here is an updated class I'm using to test now:



Output:

Entries: 3
Name: Three, id=4, Entries: Test3
Name: Eleven, id=2, Entries: Test2
Name: One, id=1, Entries: Test1
Map contains 1: true
Map contains 2: true
Map contains 4: true

The output looks good, other than the sorting which is now not working

Expected:

Entries: 3
Name: Eleven, id=2, Entries: Test2
Name: One, id=1, Entries: Test1
Name: Three, id=4, Entries: Test3
Map contains 1: true
Map contains 2: true
Map contains 4: true
12 years ago
Seems that the TreeMap is a bit tricky to implement. Seems like it might just be easier to use a HashMap and then a Comparator to sort it after the fact. Is this how it's done normally?
12 years ago