Damien Howard

Ranch Hand
+ Follow
since Apr 01, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
(keep public parts private until JForum day)
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt
Moderation Tools

Recent posts by Damien Howard

That is really good. although refresh rate seems too low. Do you use dual buffers?
12 years ago
Wow it is amazing how many people don't know the speed limits in this country (USA)
12 years ago
Hi Ms. Barker,

I find that when I try to follow "proper" OO concepts I end up with a gazillion objects. I attempt to use the IS-A, HAS-A, and CAN-DO relationships that Kathy Sierra and Bert Bates expound. Sometimes I feel I'm taking the concepts too far. Do you have any advice on when to merge objects? Does your book cover this?

Thanks.
12 years ago


I am running this on a windows machine. It goes into the windows clause and it assigns cls to my var, but I get an IOException and my cmd window is not cleared. Does anyone know why?
12 years ago
For some it is part of assimilation with Western culture
For some it is to make their lives easier in an English langauge dominated world since English speakers can have a tough time pronouncing non-English names.
For some, they don't give English names, they are assigned or chosen names when they enter an English context.
I have a friend who does not have an English name, but he uses one when dealing with non-Chinese. He has used it in so much of his life he might as well have it become part of his official name.
For some it is just because the name they happen to like is English.
Lastly, for some it is just because they felt like it, no basis whatsoever.

Oh, and it is not just Chinese that do this it happens in all cultures that interact with other cultures.
[ June 17, 2005: Message edited by: Damien Howard ]
12 years ago
What do you do with students who the only way you can give them a passing grade is to curve the class so much that everyone else would get As?
I feel bad failing students, but there seems no way to pass them and be fair to those who earned their passing grades.

Why do students wait until it is too late to come talk to the instructor?
12 years ago
"Ook?"
12 years ago

Originally posted by reubin nibuer:
I have this thought

"if the main thread ends before Tux thread' life time, (which print 1,2,3), the Tux thread will end accordingly, since Tux is created by main thread. This also indicates if the parent thread ends, all of its child threads will ends immediately accordingly."

is because I see the correct answer is saying: either "vandeleur", "vandeleur 0", "vandeleur 0 1" "vandaleur 0 1 2" or "vandaleur 0 1 2 3". -- the output sometimes does not output all of 0,1,2,3 in case main thread ends before Tux thread.

If the Tux thread always completes its task, the output should always contain vandeleur, 0, 1, 2, 3 with different orders, isn't it? How should it be explained about the case that 0,1,2,3 isn't printed fully, like: "vandeleur 0", "vandeleur 0 1" "vandaleur 0 1 2".

Thanks



This is because your print statement is in the main thread. So since the main thread has ended, even though your String has changed you don't see that printed since the print already executed. This is why I suggest you add an additional print in the Tux thread at the end of the run() so that you can observe this occurring.
[ June 08, 2005: Message edited by: Damien Howard ]

Originally posted by Geethakrishna Srihari:
1.Whether a static reference to an object if either reassigned or assigned to null, the object becomes eligible to garbage collection?

2.Whether a string if reassigned to another or assigned to null becomes eligible for garbage collection?



1) Yes the object will be eligible for collection if there are no live references to it.

2) A String object yes, but a String constant no. The garbage collector only deals with objects and thus anything in the string constant pool is not dealt with by the garbage collector

Originally posted by reubin nibuer:

This means if the main thread ends before Tux thread' life time, (which print 1,2,3), the Tux thread will end accordingly, since Tux is created by main thread. This also indicates if the parent thread ends, all of its child threads will ends immediately accordingly. Am I right?

static sName value is not changed, which is because piggy method only changes its own parameter variable's value. Thanks for that notice, Soumya.

[ June 08, 2005: Message edited by: reubin nibuer ]



That is not the case. If the threads are not Daemon threads, which in your example they are not, then they have a life of their own. Even if the main thread has completed the Tux thread will still run to completion.
Try putting a print at the end of the Tux threads run method to test this

Originally posted by reubin nibuer:
I have a question here:


I thought answer is 2 but it is 4. Shouldn't it be t to call start(), not within piggy()?

Thanks




t is of type tux. Piggy is a method within tux. Calling start from within piggy is the same as calling it on your t object of type tux. It is also the same as saying this.start();
Not everyone checks this forum. I suggest posting this info at the top of javaranch and the top of the forum board to warn all users.
12 years ago

Originally posted by Jesse Torres:


Thanks for your input. Which phone do you have? I have Motorola V300.



I have an old motorola. Don't know the model, it is not written on the phone but it is a GSM phone about 4 years old.
12 years ago
No, but every once in a while my phone goes crazy and I need to do this and it fixes the issue. But I think that is more of a problem with my phone than with T-Mobile.

I think the power cycle thing could possibly make sense depending on how the software in your phone works and how the software in their towers work as well as the power handling of your phone and that of the tower.

I have noticed similar problems with home routers. Sometimes they seem to overload or something and they need to be unplugged for a minute or so as the power dissipates and then once I reconnect them they work fine again. I have had this happen with several routers of varying brands. Always with small home routers though, I imagine thousand dollar business routers are made to be more reliable.
12 years ago
a volatile variable means it could be changed by several threads so a thread should always reconcile the value with what is saved in memeory rather than assume that the variable it finds is valid. If a variable is final it can't be changed so there is no reason to need to reconcile values. Thus final and volatile are contradictory in a way. It doesn't make sense to be able to combine them thus java does not allow it.