This week's giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Production-Ready Serverless (Operational Best Practices) and have Yan Cui on-line!
See this thread for details.
Win a copy of Production-Ready Serverless (Operational Best Practices) this week in the Cloud/Virtualization forum!

Robert Watkins

+ Follow
since Sep 20, 2005
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Robert Watkins

Originally posted by shankar Iyer:

Why doesent the JREF also prove something to us!!!
Why dont u disprove the existance of God??

The nature of God, as stated literally in the Bible, is well and truly disproven. That's one reason why the definition of God (and, in particular, the location of Heaven) has shifted over time - religion always runs to where science can not shed light at the moment.
13 years ago

Originally posted by Sripathi Krishnamurthy:

MIND is the best example of what science cant explain. It does not mean mind does not exist.
There are numerous experiments conducted on human brain to see how mind operates, but scientists are not able to get even 1% breakthrough.
Why and How does one dream?
Why does 2 kids who may be brothers/sisters have completely differently attitudes? even though they are in a controlled environment.
It boils down to perception. And why do each person percieve a single thing differently.
If science cant explain these, that means science has its limitations.
So if science cant explain ghosts, that does not really mean ghosts cant exist.

Mind is probably an emergent characteristic of the neural network that is the brain. It does not have to be supernatural, and probably isn't. Emergent characteristics of even simple dynamic systems are known to be able to produce extreme complexity.

How does one dream? That's been explained (though don't ask me for an explanation - I'm not a neuroscientist). The _mechanics_ of dreaming, like the mechanics of thought, are understood. Why do we dream? Who knows? However, it's not just a human characteristic. Many mammals dream.

2 kids with different attitudes? Why not? They're not identical, even if they are identical twins. Furthermore, life is chaotic - you can not repeat events exactly, even if it is deterministic. Even minor differences in initial conditions can contribute to dramatic differences (the so called butterfly effect).

Science has no limits - the scientific method is perfectly adequate to dealing with any situation. Humans, however, do. And just because science can not disprove ghosts (or prove them - many parapsychologists are trying to prove ghosts exist) doesn't mean that they do any more than it means they don't - it just means that there is no scientific evidence.
13 years ago

Originally posted by Dave Lenton:

Possibly. Some species do suffer from over population, but I would guess that the vast majority of extinction events have other factors contributing significantly to them, commonly environmental changes. Often global warming/cooling or changing gas make up of the atmosphere are put forwards as likely theories.

No species suffers from over population for more than a few generations. All ecosystems, by definition, however in stable states (which are not static) - if an ecosystem becomes unstable, it is because of a new factor, and results in an often rapid transition back to a stable state (possibly a different one).

Note that population cycles of boom-bust can be considered stable.
13 years ago

Originally posted by shankar Iyer:

Dinosaurs were wiped out because their numbers increased to a massive proportion unable to handle by the planet!!! Some other species may have existed even before dinosaurs and were wiped out beacause of the same reason.

Dude, the dinosaurs had a run of over 300 million years. Their population was stable for most of that time (as, indeed, all populations are over the long term). They went extinct (over a period of some 50 million years) due to a number of reasons, believed to be mostly around climatic change caused by changes in the sun (well out of human or saurian control) and from increased vulcanism in the Earth (ditto).

There were lots of earlier species to dinosaurs. Dinosaurs evolved from them. And yes, there were earlier mass extinctions - the biggest and baddest probably being the Cambrian extinction. It happens.

Human race will also meet its end in a similar fashion , because of the increasing burden it is causing on the planet.
All these are nature's ways of protecting itself from external influences causing atrocities on it and is controlled by a power greater than physics, chemistry or Maths can explain .

What burden on the planet? Humanity represents almost no threat to the biosphere of the Earth. Individual species, yes, but even if we nuke or overpollute ourselves to hell and back, life would survive and bounce back, bigger and better than ever. Nothing humanity can do to the planet hasn't already been done before, up to and including a runaway greenhouse effect.

The belief that some people hold that humans can "destroy the earth" is really just a symptom of our species narcissim. We can not destroy the Earth. We can certainly destroy ourselves, but that will be our own fault, not some mystical supernatural effect.

Nature doesn't "protect itself". Nature doesn't care, and would not need protecting even if it did. And humans are part of nature - a beaver's dam or a wasp nest or a bee hive are all just as "unnatural" as a skyscraper.
13 years ago

Originally posted by Devesh H Rao:
Going back to the start almost literally, can science explain how life was created?

Actually, yes.

Life is a general term for self-organising, reproducing assemblies of matter. And the simple maths of the situation says that self-organising reproducing assemblies of matter will continue to trend towards the complex, defying entropy's arrow. Basically, anything which allows repeated reproduction will win out.

All that is needed is a way to kick start the self-organising material. It turns out that there is a very common substance which will help structure organic matter in complex fashions - enough to make the creation of amino acids and protein chains possible. It's clay. Clay has a structure which essentially allows it to be a template factory for life.

This is not to say that life arose on this planet from clay. It merely indicates that this was such a possibility - naturally, there is no evidence to support this either way. It is equally possible (perhaps more probable, even) that life on Earth was "bootstrapped" by the arrival of interstellar bacteria. We know that bacteria can survive being frozen, and can tolerate vacuum). Given that complex self-organising reproducing matter will win out over time, it would not be surprising to find deep space riddled with floating bacteria colonies (very sparse ones, of course). This explanation does beg the "well, where did that life come from" question, of course, but as already indicated, there is a possible answer for that, too. This theory (known as panspermia) will be able to be tested if we ever do get samples of interstellar life - nearly all life on Earth is closely related genetically, and if there is a similar degree of relationship with interstellar life, then panspermia is almost certainly true. We (the human race) will almost certainly find out one day.
13 years ago

Originally posted by Max Habibi:
I'd really like to see an Intelligent Falling focus, to counter the inconsistencies in the theory of gravity.


Actually, one of the dominant theories before Gallieo was an "intelligent falling" variant. Archimedes held that it was a natural property of matter to "want" to move in a particular direction, and that it would do so unless restrained.

In any case, there is no gravity, there is merely the curvature of space/time, so the inconsistencies in the theory of gravity isn't really relevant, is it?
13 years ago

Originally posted by Vallabhaneni Suresh Kumar:
Can an inner class belonging to one package be imported to another package?

Thank you

Yes. The syntax (which presumably is what is stopping you trying it yourself) is perhaps a little non-obvious.

Note, though, that you are probably better off just importing the OuterClass, then referring to the InnerClass as OuterClass.InnerClass.
13 years ago
Yes, a static method can access the instance variables of a parameter (of the same type) that is passed in, or that it has obtained in another way (for example by creating it)

Originally posted by Stian Almaas:
You can pass the value of an instance variable to a static method but there would be no point. You would be better off defining a non-static method instead.

There are uses. Some that spring to mind are:
  • Factory methods (setting instance variables after the constructor)
  • Utility methods (e.g. extract common information from a parameter list)
  • Manipulating a static Singleton

  • In general, however, it's probably better to go with waht Stian said, and put the behaviour directly on the instance.
    13 years ago
    For a slightly less verbose version of what Norm said, try this:

    13 years ago

    Originally posted by Jenny raj:
    can anyone plz explain
    thank u.

    Normally, when you start a new Thread, the JVM will not terminate while that thread is running. This means you need to monitor it and terminate it yourself when you want to shut the application down.

    A daemon thread, by contrast, will not stop the JVM from terminating. They are good for tasks such as regular monitoring of events, or periodic polling of external systems (amongst other uses). Because they don't stop the JVM from terminating, you can treat them as "fire-and-forget" - launch them once at startup and don't worry anymore.

    The event-polling thread in a Swing or AWT application is an example of a daemon thread.

    (The terminolgy comes from Unix - a daemon process is one that is detached from your normal terminal session)
    13 years ago

    Originally posted by nareshk kumar:

    is there any possibilities to apply clone methode on singleton class oblect?

    if possible , how it will be satisfied the singleton design pattern?

    if not possible, why ? and what happens by the jvm?

    Of course it is possible. If your Singleton class implememnts Cloneable, and makes the clone method public, then you will be able to clone the Singleton. This may even be desirable, depending on exactly [i]what[\i] the nature of the singleton is.

    What happens is what you'd expect: you get a new object with the same data inside, exactly like any other clone.

    Does it satisfy the Singleton pattern? Who cares - it's not like you get points for how closely your solution conforms to a pattern. The real question is: does it solve whatever it is you are trying to do?

    Strictly speaking, of course, it does _not_ count as a Singleton any more, because you've created a way to make multiple instances. However, like I said - who cares?
    13 years ago

    Originally posted by Vladas Razas:

    Not sure what is meant by "multi-classloaders eviroment". Either the question is too specific or not-well formed, IMO. This way interviewer will filter out 99 of 100 or 199 of 200 Java programmers.
    Did you mean "how singleton would work in distributed web application?" ?

    No, I meant how would you do Singleton in an environment where you have multiple class loaders within a single JVM, _without_ JNDI.

    Static variables are associated with the class - if a class is loaded in more than one class loader, you may well get multiple instances of static variables.

    By contrast, the Singleton in the distributed application is fairly easy - that's what JNDI is for.
    13 years ago

    Originally posted by Sonny Gill:
    I suspect there are only very few cases where you need lazy instantiation, perhaps when/if the getInstance() method needs to be passed arguments at Runtime...but then it would perhaps be a Factory method or something.

    Actually, another good reason is if the construction can thrown an exception - having exceptions come out of a getInstance method is a lot nicer than having one exception, followed by a zillion ClassDefNotFoundErrors.
    13 years ago

    Originally posted by Vladas Razas:

    That is really funny interview question. Almost rivals with "what I have in my pocket?"

    What's funny about it? Multi-classloader environments need Singletons too, you know... (well, at least as much as single-classloader environments need Singletons)
    13 years ago

    Originally posted by soniya saxena:

    Also, you can still get away with doing "Singleton s = new Singleton()" and create your own instance from a class in the same package (bypassing the Instance() method) since the constructor is not private, which defeats the whole purpose of a Singleton class.
    Again no. The constructor is protected. Hence any class in the package cannot do "Singleton s = new Singleton()". Only a subclass can do that; and it might be legal to do so considering that it is a subclass of the singleton; however, that could be debatable; also could be done depending on the need.

    *cough* You just failed one of my standard interview questions with that statement... any class in the same package has full access to the protected methods, variables, and constructors.
    [ September 21, 2005: Message edited by: Robert Watkins ]
    13 years ago