I know that we cannot instantiate an interface.  HashMap method, keySet(), its return type is Set.  public class aMap{     public static void main(String args[]) {         HashMap newmap = new HashMap();         newmap.put(1, "please");         newmap.put(2, "help");         newmap.put(3, "me");         System.out.println("Key set values are: " +                 aMap.keySet());     }     }   Output: Key set values are: [please, help, ma]  -Why can the method return a Set, which is a interface?(if Set cannot instantiate)  -Suppose Set interface can only have static final attributes and empty methods, why can it (stores) Strings into a Set?
I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this?   I know what interfaces do, but the fact I am not clear on this makes me think I am missing out on using them correctly.   Is it just so if you were to do:  IInterface classRef = new ObjectWhatever()   You could use any class that implements IInterface? When would you need to do that? The only thing I can think of is if you have a method and you are unsure of what object will be passed except for it implementing IInterface. I cannot think how often you would need to do that.   Also, how could you write a method that takes in an object that implements an interface? Is that possible?
What Nikon lens for both macro and portrait? All three lenses are available at a local store near me:   85mm 1.8 at about 400USD  85mm 1.4 at about 1000USD 105mm 2.8 at about 1015 USD   I plan on doing macro and portrait photography and have the ff thoughts so far:   I can save a lot with the 85mm 1.8 and a site claims that AF-wise it is much faster than the 85mm 1.4 at twice the price 105mm has VR but I don't know if that would be of much use with portrait and macro as I usually don't use slow shutter speeds with such subjects 105mm has AF-S which means I can get better insect shots because of the silence( and the 105 mm range) I don't know why I should prefer the 85mm 1.4 over the 105mm, when the 85mm may only have AF speed as an advantage, though I am not so sure if it is faster   so as you can see, I'm leaning towards 105mm f/2.8 or 85mm f/1.8 and less towards the 85mm f/1.4. However, I don't want to finalize the decision as many also claims that the 85mm f/1.4 is so good.  Any professional insights to add in helping me make the decision? How does the Hogwarts Headmaster know whom to invite to school? So all wizards get an invitation to Hogwarts at 11... How do they know whom to invite?  If a wizard is Muggle-born, then nobody would know about their existence.  Or do they register some weird magical stuff being done by them before 11? This is Exercise 26 from Chapter V Algebraic Extensions in Lang's Algebra.  $F$ is finite normal extension over $k$ and $f(x)$ is irreducible in $k[x]$. If $f(x)=g(x)h(x)k(x) \in F[x]$ where $g(x),h(x)$ are monic irreducible factors in $F[x]$, I need to show that there exists an automorphism of $F$ which takes $g(x)$ to $h(x)$.  Any hints would be appreciated.  Sending one root to another is okay but how to do that for a collection of roots? What is the correct definition and usage of "for all I know"? I saw some sentences using this phrase "for all I know" but wasn't quite sure what is its exact definition and also whether a modal verb such as "could, may or might" expressing uncertainty must be present in the sentence.  The following are some possible definitions:   According to the information I have; I think; probably. (usually implies uncertainty) Based on what I know (usually expressing displeasure)  As far as I know (used to show indifference)  I really don't know (used to show complete ignorance)    And these are statements containing the phrase:   For all I know, the mayor has resigned already. She may have gone to town for all I know. He wears a ring, but he may be single, for all I know. For all I know, there may be someone with you now. The man I met on the beach yesterday seemed friendly, but he could be a thief, for all I know. For all I know, the girl was buried alive in the Arabian sands. They've decided to hire Jack for all I know.   References:        What does the phrase "for all I know" mean exactly? Why is Tony Stark in the Iron Man suit unaffected by G-forces, inertia and blunt force trauma? Tony's suit is an engineering marvel, and they explain many facets of the technology to help give legitimacy to the special powers, abilities and weapons it has.  I never read the Iron Man comics, but in the movie they really don't have a technological explanation for how he miraculously seems to be unaffected by crushing G-forces of sudden acceleration, the inertia of sudden stops and hair-pin turns, and especially the blunt force trauma from getting smashed in the face with Thor's hammer.  Certainly it appears the suit takes punishment, but Tony always remains unscatched, never a collapsed lung, broken bone or even a bloody nose.  In my infantile understanding of theoretical physics, the same technology that would be used to counter G-forces and sudden blunt force trauma to the body inside would be the very same technology used for  which in my honest opinion would be a much more stunning technological achievement than his heralded Arc Reactor.  Was their ever an explanation proferred for this and if so was it indeed attributed to Anti-Gravity? Is a constant condition more costly than switching shaders? Possible Duplicate:          In a question, I see that each time I refresh the page, the answers were placed in a different order. The question has 3 answers each with zero votes. The users' reputation was something like 6, 1200, and 7300 but these numbers didn't affect the order.  What is the criteria of the sort order of the answers? What is the purpose of /home on a Mac? On Linux, (which I am used to), /home is the place where home folders live.  On a Mac, home is some kind of crazy mutant:  $ mount /dev/disk1 on / (hfs, local, journaled) devfs on /dev (devfs, local, nobrowse) map -hosts on /net (autofs, nosuid, automounted, nobrowse) map auto_home on /home (autofs, automounted, nobrowse)   Other than to be non-conformist, is there some purpose to this auto_home mount point?  Considering how it mucks up things that come right out of the box, there must be some wonderful thing that it accomplishes, but I can't figure out what that would be..... Show that $\frac{1}{x_1^2}+\frac{1}{4\cdot x_2^2}+\ldots+\frac{1}{n^2\cdot x_n^2}\leq\frac{3n-2}{2n-1}$. Let $$x_n=\frac{1}{1^2}+\frac{1}{2^2}+\ldots+\frac{1}{n^2},\;\forall n\geq 1.$$ Show that $$\frac{1}{x_1^2}+\frac{1}{4\cdot x_2^2}+\ldots+\frac{1}{n^2\cdot x_n^2}\leq \frac{3n-2}{2n-1}.$$   I tried to prove it by induction  but I got a contradiction. I have written code like below and all works fine, but while submitting the form I get the error below. I am trying to filter the second dropdown based on the first drop down selection.     An illegal choice has been detected. Please contact the site administrator.   How do I overcome that error?       function dynamic_location_dropdown_form_alter(&amp;$form, $form_state, $form_id) {   if($form_id == 'product_node_form') {    $location_options = array();    if(isset($form['field_destination']['und']['#default_value'][0])) {     $destination = $form['field_destination']['und']['#default_value'][0];   }   else {     $destination = 0;   }    $location_options = dynamic_location_dropdown_locations($destination);    $form['field_destination']['und']['#ajax'] = array(     'event' =&gt; 'change',     'wrapper' =&gt; 'squadron-wrapper',     'callback' =&gt; 'dynamic_location_dropdown_ajax_callback',     'method' =&gt; 'replace',   );   $form['field_product_location']['#validated'] = true;   $form['field_product_location']['und']['#prefix'] = '&lt;div id="squadron-wrapper"&gt;';   $form['field_product_location']['und']['#suffix'] = '&lt;/div&gt;';   $form['field_product_location']['und']['#options'] = $location_options;   } }  function dynamic_location_dropdown_ajax_callback($form, $form_state) {   $country_id = $form['field_destination']['und']['#value'];   $form['field_product_location']['#validated'] = true;   $form['field_product_location']['und']['#options'] =  dynamic_location_dropdown_locations($country_id);    return $form['field_product_location']; }  function dynamic_location_dropdown_locations($destination_id) {   $nodes = array();   $nodes[''] = '- None -';   if($destination_id != '') {     $select = db_query("       SELECT node.title AS node_title, node.nid AS nid, node.created AS node_created       FROM {node} node       LEFT JOIN {field_data_field_location_country} field_data_field_location_country        ON node.nid = field_data_field_location_country.entity_id        AND (field_data_field_location_country.entity_type = 'node'        AND field_data_field_location_country.deleted = '0')       WHERE (( (node.status = '1')        AND (node.type IN  ('location'))        AND (field_data_field_location_country.field_location_country_nid = $destination_id)))       ORDER BY node_title ASC     ");     $nodes[''] = '- None -';     foreach ($select as $node) {       $nodes[$node-&gt;nid] = $node-&gt;node_title;     }   }    return $nodes; } How to copy the filename quickly in windows Prove that if $n \in \mathbb{N}$, then $$\sum_{d|n}{(d(n))^3}=(\sum_{d|n}{d(n)})^2$$ where $d(n)$ is the divisor function. I have know only information is $d(n)=\sum_{d|n}{1}$. Every partial order can be extended to a linear ordering How do I show that every partial order can be extended to a linear ordering?      I think that I manage to prove that claim for finite set, how can I prove it for infinite set?  Thank you. I installed Dev C++ using Wine on Ubuntu 18.04 and the program is compiling but it not showing any output screen. Why doesn't C3PO recognize Leia in R2's recorded message? Is there a word with phobia suffix for fear of waking others up? I usually come home after basketball at like 12:30 a.m. and at this time my mom and sister usually sleep (my Dad though is usually up). When I come home, I don't go to sleep right away and will sometimes eat or do something else. When I do so, I do it in stealth, so that I don't wake up anyone. I do out of two things, to be polite as I do not want to wake anybody up and also the fact that if I make a loud noise and wake my mom up, my mom will get mad and lecture me. Does this count as a phobia? In addition, if it does what would the name of it be. Grouping functions (tapply, by, aggregate) and the *apply family Solutions of $x^2 \equiv 1 \pmod N$ I am stuck with this exercise:     Show that $\forall s &gt;0 \quad \exists N &gt;0$ such that $$x^2 \equiv 1\pmod N$$ has more than $s$ solutions.   I think I cannot use the theory if quadratic residues, because the modulus is not prime, so maybe I must prove it with square roots or roots of unity, but I don't know how to approach it at all.  Thanks for any help. A common scenario we run into on Stack Overflow is that we have a troll, spammer, or obvious sock puppet of another user and moderators decide to delete this user. We go on about our business only to find out an hour or two later that the account we just deleted has been recreated, using the same credentials, and is now back to trolling, spamming, or committing voting fraud once again.  I've seen some people recreate an account like this using the same credentials four or five times (multiple times in the last week, in fact). The only thing that stops them is if we remember to suspend the account for right before we destroy it. Accounts recreated using the same credentials as an account that was suspended will be locked into the same suspension the old account was serving.  In particular, this becomes a real problem with sock puppet accounts that have a network association reputation bonus attached to them, because the recreated accounts keep getting that 100 point bonus and can immediately be used for voting fraud, to troll chat, or to spam comments. I've had to deal with quite a few puppet accounts like this by suspending them for a year before deletion.  I propose that all moderator-deleted accounts behave as if they were suspended for a year upon deletion, so that recreating these accounts using the same credentials will cause the new account to be locked in a one-year suspension. This would prevent the new accounts from being used to abuse the site in the same manner as their old account did.  This won't put an end to people creating new spam, troll, or puppet accounts after we delete them, but it will at least slow them down by forcing them to create new login credentials each time. It also would curb abuse of account association bonuses by puppets. I want to kill a whole process tree.  What is the best way to do this using any common scripting languages? I am looking for a simple solution.