Why would I need to do this, when it is mandatory for implementing class to define all methods of the interface? interface A{  void func1(); void func2();  }  class B implements A{  // must implement fucn1 and func2  }  // What is the point of this?  A a = B b;
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?
How to automatically reinvest in non-dividend paying funds I've read Einsteins quote stating "The most powerful force in the universe is compound interest." However, everywhere I read this is basically only possible with dividend paying stocks and then applying a dividend reinvestment plan.  Is there a re-investing strategy like this for non-dividend paying mutual funds (or even non-dividend paying stock)? I figured that the only way would be to sell all your funds and then buy x+1 funds again, but this would cause a big loss because of transaction costs from the broker. I don't know how to disconnect a face from the rest of the mesh in edit mode.  This isn't like pressing P to separate the selection into a completely different object. I just want to select a face and disconnect/rip it away from the rest of the mesh but keep it as a part of the original object.  One way to do it would be to duplicate the face with ShiftD and then delete the original face. But I suspect there is a "native" command for disconnecting selected faces and I would like to learn it. I am trying to really understand why the gradient of a function gives the direction of steepest ascent intuitively.  Assuming that the function is differentiable at the point in question, a) I had a look at a few resources online and also looked at this   , a popular question on this stackexchange site. The accepted answer basically says that we multiply the gradient with an arbitrary vector and then say that the product is maximum when the vector points in the same direction as the gradient? This to me really does not answer the question, but it has 31 upvotes so can someone please point out what I am obviously missing?  b) Does the gradient of a function tell us a way to reach the maxima or minima? if yes, then how and which one - maxima or minima or both? Edit: I read the gradient descent algorithm and that answers this part of my question.  c) Since gradient is a feature of the function at some particular point - am I right in assuming that it can only point to the local maxima or minima? Creating a default preamble Since I am using (almost) the same set up for my tex documents, I wonder if there is a way to create a preamble with my default packages and to recall it anytime I want to create a tex document.  If yes, how I can call this "default" preamble?  Thanks in advance Remove marker using lat or long gmaps v3 What is the distance a creature or player can travel if they have multiple types of movement speeds? Can I have 8 GB RAM on 32-bit Win 7? Possible Duplicate:             According to , Win 7 only supports 4 GB of RAM. I, however have been reading some forums and some say they are using 8 GB RAM with good performance. I am wondering if I can use 8 GB before I purchase. I am currently watching . Should I watch the other  anime films?  What's the difference between this version and the 1412 version?  And another question, what's the meaning of 1412? In The Matrix Reloaded, the Architect reveals to Neo that Trinity is about to die. I can't help but wonder if Neo would still choose the left door if the Architect had withheld that information.  The Architect could have designed a better choice mechanism so as to trick Neo into making a choice in the machine's favor rather than a highly risky one.   Did I miss anything important in the movie? Recursive cast from SimpleXMLObject to Array Acro package provides "! Missing number, treated as zero." after update to acro-v2.7b I am trying to use the MailManager class in Drupal 8 to send HTML mail. I got it working, but it isn't parsing the HTML markup. I think something is wrong with the headers of the email.  What I have is a custom module (Custom_forward) that contains a form and that calls Mailmanager::mail() in its submitForm() method, which contains the following code.          // Email body         $header = $sender . ' thought you would like to see this page from the website.';         $personal_message = $form_state-&gt;getValues()['message_body'];         $entity_url_value = '&lt;a href="' . $entity_url-&gt;toString() . '"&gt;Go to article&lt;/a&gt;';         $message = $header . '&lt;br&gt;' . $personal_message . '&lt;br&gt;' . $entity_url_value;          // Email         $langcode = 'en';         $mailManager = \Drupal::service('plugin.manager.mail');         $to = $form_state-&gt;getValues()['recipient'];          $params['title'] = 'Forward';         $params['message'] = $message;         $result = $mailManager-&gt;mail('custom_forward', 'forward', $to, $langcode, $params, NULL, true);          if ($result['result'] !== true) {             drupal_set_message(t('There was a problem sending your message and it was not sent.'), 'error');             \Drupal::logger('mail-log')-&gt;error($message);         }         else {             drupal_set_message(t('Your message has been sent.'));         }   According to Drupal you also need the hook_mail method in mytheme.theme to be able to send message, you can see this method here:  function custom_forward_mail($key, &amp;$message, $params) {   $message['body'] = [];   $message['subject'] = [];   $message['headers'] = array(     'content-type' =&gt; 'text/html',     'charset' =&gt; 'UTF-8',     'format' =&gt; 'flowed',     'delsp' =&gt; 'yes',     'from' =&gt; \Drupal::config('system.site')-&gt;get('mail')   );    switch ($key) {     case 'forward':       $message['subject'] = $params['title'];       $message['body'][] = '&lt;html&gt;&lt;body&gt;' . $params['message'] . '&lt;/body&gt;&lt;/html&gt;';       break;   } }   As you can see, I am setting the content type to text/html and that should tell the mail system to parse the content as an HTML, but this is not working for some reasons.  This is a testing email. All the HTML markup is not shown, but also not working.  Bassem thought you would like to see this page from the website. personal message Go to article [1] [1] http://myhost/node/81 Windows 7 Automatically Connecting To Unsecured Wireless Networks On Startup Most of the questions on this topic related to folks connecting to somebody else's wireless network when their own was available and could remedy the situation by going to their connections and unchecking the "connect automatically" box.  See this: "  " as an example.  In my situation, I've noticed that Win 7 will automatically connect to any unsecured wifi network - even if I have never connected to it in the past.  If I am traveling and boot Win 7, it will start and connect to what appears to be the best signaled unsecured network without prompting me for confirmation (note: in the above link, "Naveen" seems to have same problem).  Obviously, that is a security concern to me.  Further, when I open "Network and Sharing" and "Manage wireless networks"  the network is not displayed (probably because I labelled it a public network).  Again, these are new, never connected with before, wireless networks.  I always promptly disconnect from them but don't want to have to be on constant guard for an auto connection to a malicious network.  This began about a month ago, as I recall, Win 7 did not behave like this in the past, I didn't monkey with wifi settings, and don't use a 3rd party connection manager.  I did have to download some internet security certificates for army website access but I don't think that should mess with network settings.  Any ideas how I can tell Win7 cease automatically connecting to networks or, at least, to prompt me for a confirmation before connecting? Enumerated description list How can a list be created, whose items are both    enumerated (a,b,c,d,...)  and allow for setting a description via \item[texthere] ?   Im am using MikTex on Windows. $\sqrt{c+\sqrt{c+\sqrt{c+\cdots}}}$, or the limit of the sequence $x_{n+1} = \sqrt{c+x_n}$ (Fitzpatrick Advanced Calculus 2e, Sec. 2.4 #12)  For $c \gt 0$, consider the quadratic equation $x^2 - x - c = 0, x &gt; 0$.  Define the sequence $\{x_n\}$ recursively by fixing $|x_1| \lt c$ and then, if $n$ is an index for which $x_n$ has been defined, defining  $$x_{n+1} = \sqrt{c+x_n}$$  Prove that the sequence $\{x_n\}$ converges monotonically to the solution of the above equation.  Note: The answers below might assume $x_1 \gt 0$, but they still work, as we have $x_3 \gt 0$.    This is being repurposed in an effort to cut down on duplicates, see here: .  and here: . Show $||Tx||_2 \leq ||(v_n)||_2 \cdot ||x||_{\infty}$ Let $(v_n)_{n \geq 1} \in \ell ^2$ be a fixed bounded sequence of real numbers. Define a mapping $T$ on $\ell ^{\infty}$ using the formula $$T(a_1, a_2,...)=(v_1a_1,v_2a_2,...), \, \, \, \, \, x=(a_1,a_2,...) \in \ell^{\infty}$$  We can use the fact that, $Tx \in \ell^2 $ for every $x \in \ell^{\infty}$ and $T: (\ell^{\infty},||\cdot ||_{\infty}) \rightarrow (\ell^{2},||\cdot ||_{2})$ is a linear operator.  Show $||Tx||_2 \leq ||(v_n)||_2 \cdot ||x||_{\infty}$ for all $x \in \ell^{\infty}$    Here is what I tried:  $||Tx||_2 = \bigg( \sum v_k^2 a_k^2 \bigg)^{1/2} \leq (||x||_{\infty}^2 \sum v_k^2 )^{1/2}= (||x||_{\infty}^2 ||(v_k)||_2^2 )^{1/2} = ||(v_k)||_2 \cdot ||x||_{\infty}$  Is this OK? What is the role of NS records at the apex of a DNS domain? $ORIGIN example.com. ; not necessary, using this to self-document  $TTL 3600 @        IN     SOA   ns1.example.com. admin.example.com. (                       1970010100 7200 1800 1209600 300)  @        IN     NS   ns1.example.com. @        IN     NS   ns2.example.com.  @        IN     A    198.51.100.1 ns1      IN     A    198.51.100.2 ns2      IN     A    198.51.100.3  sub1     IN     NS   ns1.example.edu.  sub2     IN     NS   ns1.sub2 ns1.sub2 IN     A    203.0.113.1 ; inline glue record   The role of a NS record beneath the apex of a domain is well-understood; they exist to delegate authority for a subdomain to another nameserver. Examples of this above would include the NS records for sub1 and sub2. These allow the nameserver to hand out referrals for portions of the domain that it does not consider itself authoritative for.  The purpose of the NS records at the apex of a domain, ns1 and ns2 in this case, seem to be less understood by the internet at large. My understanding (which may not be holistic) is as follows:   They are not used by caching DNS servers in order to determine the authoritative servers for the domain. This is handled by , which is defined at the registrar level. The registrar never uses this information to generate the glue records. They  used to delegate authority for the entire domain to other nameservers. Trying to do so with software such as ISC BIND will not result in the "expected" referral behavior at all, as the nameserver will continue to consider itself authoritative for the zone. They are not used by the nameserver to determine whether it should return authoritative responses (AA flag set) or not; that behavior is defined by whether the software is told to be a master or a slave for the zone. Most nameserver software will quite happily serve apex NS records that disagree with the information contained by the upstream glue records, which will in turn cause well-known DNS validation websites to generate warnings for the domain.   With this being the case, what are we left with? Why are we defining this information if it doesn't appear to be consumed by caching DNS servers on the internet at large? If you have an array of Java objects which have a primitive type (for example Byte, Integer, Char, etc).  Is there a neat way I can convert it into an array of the primitive type?  In particular can this be done without having to create a new array and loop through the contents.  So for example, given  Integer[] array   what is the neatest way to convert this into  int[] intArray   Unfortunately, this is something we have to do quite frequently when interfacing between Hibernate and some third party libraries over which we have no control.  It seems this would be a quite common operation so I would be surprised if there's no shortcut.  Thanks for your help! Genetic linkage greater than 50 centimorgans Classically, the linkage between two loci can be measured in centimorgans (cM), which represents the percent chance that these two loci will recombine an odd number of times (generating a recombinant genotype).  Due to independent assortment, markers on different chromosomes are expected to recombine 50% of the time. As I understand, if one conducts a classic experiment and counts various progeny, then deduces the apparent linkage, values of 50 cM or more are interpreted as "impossible to determine whether on separate chromosomes or just recombines very often". See (), with grammar corrected:     The final point that we need to make regards the maximum distance that we can measure. Because of the way in which the calculations are performed, we can never have more (than) 50% recombinant gametes. Therefore the (maximum) distance that two genes can be apart and still measure that distance is just less (than) 50 cM. If two genes are greater than 50 cM apart, then we can not determine if they reside on the same chromosome or are on different chromosomes.   Wikipedia gives an  and also remarks that (d is physical distance):     The probability of recombination is approximately d/100 for small values of d and approaches 50% as d goes to infinity.   However, what happens if the linkage is greater than 50 cM? It seems like classical experiments aside, such a situation is possible in reality.  For instance, , and . Let's take two genes on Chr.IV:    is at about +631 kb.  is at about +1370 kb.   The physical distance between these is about 734 kb. According to the cM/kbp value, the centimorgan distance is $734\text{ kb} \cdot 0.31\text{ cM}/\text{kb} = 228 \text{ cM}$ . How to interpret this 228?  If I mate a haploid yeast which is DNF2 TOM1 with another which is dnf2 tom1 (lowercase indicating minor allele rather than deletion), then sporulate them, what is the chance of getting spores with DNF2 tom1 or dnf2 TOM1 genotypes?  I realize that the cM/kbp value is only a simplification and that in practice linkage is a more complex phenomenon. Nevertheless, it seems plausible that several crossover events can happen on Chr.IV since it is so big. This includes the possibility of 1, 3, 5 and more crossovers which would create a hybrid (assuming they all happen between these two loci), as well as the possibility of 2, 4, etc crossovers which would create a non-hybrid spore (at least as far as our chosen markers are concerned). Finding matrix $B$ is not zero matrix where $AB= 0$