Scotty Sinclair

Greenhorn
+ Follow
since Jun 26, 2003
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 Scotty Sinclair

You could try the high tatras in solvakia.
http://www.tanap.sk/
But I don't know if they would have snow in the sommer, you would have to check. They are in the solvak republic so it should be on the cheaper side.
18 years ago
It should work just like when compiling, i.e. a chain reaction. If a class is referenced by the class you are compiling then it is compiled too. It should be the same for class loading, any required classes will be loaded by the same class loader which loaded the referring class.
Or you could create a class for hadling the library which makes sure the proper class loader is used or something.
class Library {
private ClassLoader c;
public Class getClass();
}
I have never tried any of this, they are just suggestions
19 years ago
If a classloader is no longer referenced then it will be grabage collected.
If any classes loaded by that classloader is no longer referenced then that class will be unloaded from the JVM.
I am having a similar problem, I am destroying all references to objects created by one classloader and then creating another classloader and loading the classes freshly. But the classes aren't unloading in my application even though I got them unloading in a test example.
here is some code which I wrote to test the unloading of classses

GetValue is just some class which we load dynamically using the URLClassloader. If you run the JVM in verbose mode you should see the classes get unloaded after the grabage collect
19 years ago
The reason you cannot access the Supervisor methods even though you have a supervisor object is that the supervisor object is referred to as an employee.
You have two things:
The runtime type information on the object which is Supervisor because the actual object you are dealing with is an instance of Supervisor.
The compile time information which says we have access to some object defined to be an Employee.
Supervisor s = new Supervisor();
s.initWorkers(); //ok handle 's' is type Supervisor
Employee e = s;
e.initWorkers(); //compile error
The compiler system uses types to check what methods can and can't be called on objects. So we have to specify a type to use i.e. Employee. Then the compiler can say "hang on, initWorkers isn't part of employee".
So it is not what the object is but the type of the reference you have to it. This is also what makes polymorphism possible that we have compile time safe references to dynamic data.
It is probably simplest to just upcast to supervisor as long as you are in a context to know that the employee is a supervisor. There are other possibilities though. But thinking about it gives me headaches!
And casting doesn't create a new object it just changes the type of the reference you have to it.
19 years ago
1) It is possible,
2) It is allways public because an interface by default makes all members public even when a modifier isn't specified.
3) This class is allways static but I'm not sure of the reason why, it could be that interfaces don't have any "this" pointer thus making it impossible for an inner class to reference i
4) It can call the methods as long as the inner class method has a reference to an object which implements the outer interface.
5) False, it can call any method in the interface, a static inner class means that an instance of the inner class has by default no relationship to an instanceof the outer class. Infact a non-static inner class CANNOT be created unless the outer class is created first.
19 years ago
Hi,
I want to be able to unload classes on this server which I have. Now I heard (and have experienced) that a Class can unload when the classloader used to load it AND the class in question are no longer referenced.
I have finalize outputs from both my Classloader and loaded class saying that they are being finialized, but unfortunately no unloaded classes
I am running the garbage collector after dereferencing the required object and that helped to prompty call the finalize methods.
Can anyone help me? Or does anyone have any more information on unloading classes?
19 years ago
I heard some guy bought the rights to 21st century fox
Clever fellow!
19 years ago
A Haiku for you all!
A break from work
Put on my well worn cowboy boots
Off to the ranch.
19 years ago
A shutdown hook could work. A shutdown hook is a thread which is executed before the JVM terminates.
I guess this would only be work if the CTRL-C sent a signal to the JVM asking it to terminate itself, instead of the process actually being killed.
19 years ago
Hi,
Just to clarify, A class is immutable a long as no method calls will change the state of the class. So the above example is fine.
19 years ago
There are two sausages in a frying pan,
One sausage says, "cor it's hot in here!".
The other sausage look to him and says "jesus christ it's a talking sausage!".
(I made this one up)
There are two cows in a field one cow says "have you heard of this mad cow disease?",
The other cow says, "what you talking to me for I'm a tractor!".
19 years ago
A horse walks into the bar, the barman says, "why the long face".
19 years ago
There is another type of school which places a higher importance on the child's psycological well-being. So although they also strive for academic excellence, they also try and show the child the place of knowledge, and also try and cultivate an appreciation for the whole of life. Here are some quotes.


With the very young what is most important is to help them to
free themselves from psychological pressures and problems.
Now the very young are being taught complicated intellectual
problems; their studies are becoming more and more technical;
they are given more and more abstract information; various
forms of knowledge are being imposed on their brains,
thus conditioning them right from childhood. Whereas what
we are concerned with is to help the very young to have no
psychological problems, to be free of fear, anxiety, cruelty, to
have care, generosity and affection. This is far more important
than the imposition of knowledge on their young minds. This
does not mean that the child should not learn to read, write
and so on, but the emphasis is on psychological freedom
instead of the acquisition of knowledge, though that is necessary.



Surely they must be centres of learning a way of life which is not based on pleasure, on self-centered activities, but on the understanding of correct action, the depth and beauty of relationship, and the sacredness of a religious life. (Krishnamurti 1981b) (Letter dated 15th October 1980)


These schools were founded by J. Krishnamurti a man who spent his whole life travelling, meeting and discussing with people the problems of living, and on living an intelligent life.
Oooh, I also found this link which I imagine would be of interest.
http://www.pathsoflearning.org/magazine.cfm
19 years ago
I lived in Edinburgh as a student for four years, and I have to say it my favourite city bar none! The people are in general very friendly, the city is not too big and not at all congested. The center with princess street, the gardens and the castle are amazing. And if you mention the center you must mention Waterstones, a huge bookstore with mahogany stair cases and bookshelves. The bookshelves stretch from ceiling to floor and span the entire walls, four stories worth, and with a Starbucks on the top floor where you can sit down by a bay window overlooking the gardens and the castle, there isn't more you could want.
There is so much going on there, the place has a very young studenty culture, it is a total risk with the weather, could be beautifull sunshine or rain.
There is no way you would regret making a visit, it is also only 30 minutes by train to Glasgow, so you could check out Glasgow while you were in the area, (30 minutes is all you'll need! ), or hire a car and go where you please, (up north).
edinburgh pictures:
http://www.edinburgh247.com/photos/
pictures from up north:
http://www.caithness.org/atoz/dunnet/aerialdunnethead.htm
19 years ago
You should be able to do this is you have tighter synchronization between the client & server using acknowledgements for example.
InputSream is = mSocket.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader mReader = new BufferedReader (isr);
CommandReader cReader = new CommandReader(mReader);

//client hs only sent command data
Command c = cReader.readCommand();
sendCommandAck(); //notify we have read the command so that the client can send the data
c.handleInput(mReader); //handle the input
19 years ago