I am a beginner in java and just getting into collection framework, an arraylist can be declared a few ways like   List&lt;String&gt; list=new Arraylist&lt;&gt;();    or  Arraylist&lt;String&gt; list=new Arraylist&lt;&gt;();   each of them with or without the diamond brackets.  I Wanted to ask what are the differences between the two declarations and why use the diamond brackets if it is not needed.
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?
Can I completely disable Cortana on Windows 10? Windows 10 has Cortana, which I don't like. I disabled it as soon as I could. However, looking in Task Manager, the process for Cortana is still running, and can't be effectively terminated: ending the task simply results in the process respawning a few seconds later. Using the command  taskkill /IM Cortana.exe /F   has the same result: the process respawns.  Is there any way to disable Cortana so that the process doesn't keep running in the background, and doesn't respawn if terminated? Why can charges outside be ignored in Gauss's Law? In MIT's 8.02 course, it is shown in lecture 3 that we can derive Gauss's Law from Coulomb's to get  $ \phi = \oint \vec{E} \cdot \vec{dA} = \frac{Q_{enc}}{\epsilon_{0}} $  However, in the lecture, it was assumed that there were no charges outside the surface. Later, Gauss's Law was used and the charges outside the sphere were ignored.  I've been thinking about it and came across .  The first answer by user levitopher helped a bit. I think that the lecture's argument still holds when there are charges outside because $ \vec{E} $ is added vectorially.  Suppose we have $ Q_{enc} $ in a sphere and $ Q_{out} $ outside the sphere. Then,  By definition, $ \phi = \oint (\vec{E_{Q_{enc}}} + \vec{E_{Q_{out}}}) \cdot \vec{dA} $ $ = \oint \vec{E_{Q_{enc}}} \cdot \vec{dA} + \oint \vec{E_{Q_{out}}} \cdot \vec{dA}$ $ = \oint \vec{E_{Q_{enc}}} \cdot \vec{dA} + 0 $ $ = \frac{Q_{enc}}{\epsilon_{0}} $  This assumes that $ \oint \vec{E_{Q_{out}}} \cdot \vec{dA} = 0 $ because any field lines that go in must come out (hand wavy but I'm just going to accept it for now).  I'd just like to know if this argument is sound. Extracting extension from filename in Python Is there a function to extract the extension from a filename? Can US stocks list on one stock exchange but trade on other US stock exchanges? I am trying to understand how the US stock market works. From my understanding, there is one stock exchange where a company is &quot;listed&quot;. This stock exchange listing requires the company to adhere to the regulations of the stock exchange where it is listed. Once a company is &quot;listed&quot;, its shares can start to trade on any stock exchange. For example, once a company lists on NASDAQ, its shares can be traded on NASDAQ, NYSE, Boston Stock Exchange, Philadelphia Stock Exchange, National Stock Exchange, EDGX Exchange, EDGA Exchange, NYSE Arca, etc. Is my understanding correct? Is it true that once a stock is listed on a US stock exchange, the stock can then trade on any US stock exchange? Consider the Level 2 quotes for Microsoft (NASDAQ: MSFT). Microsoft is only listed on NASDAQ, but it also trades on the NYSE and other stock exchanges:  My questions are:  Does this mean that companies only need to be listed on one stock exchange in order for their stock to trade on other stock exchanges?  If so, do companies need to adhere to the &quot;listing requirements&quot; of all the stock exchanges where their stock is traded, even though they are not &quot;listed&quot; on those stock exchanges? Does Microsoft have to follow the listing requirements of the NYSE even though it is not listed there?  If stocks can trade on any US stock exchange regardless of which US stock exchange the stock is listed on, why don't NYSE-listed companies reduce their yearly listing fees by listing on NASDAQ instead? I don't know anything about Star Trek except for the fact that it's about spaceships.  In  the person only wanted to watch the TV series. I want to watch every movie and TV series there is about Star Trek but I don't know where to start. I found this page on  which is about a time line. Do I need to watch it in this order? Are the movies and TV series related? I’m making a little movie with using multiple computers. I can't use the network so I've divided the frames of the animation over the computers. Unfortunately now there are frames missing. What I'd like to do is using 1 machine to render all the missing frames. For example: 4-24-35-64-143 but ideally in such a way that I don't have to re-start blender multiple times. Is this possible somehow? I would like to show the author names using \citet but I get just the reference number. Here is a minimal code:  \documentclass{report} \usepackage[utf8]{inputenc} \usepackage[english]{babel} \usepackage{natbib}  \begin{document}   The author \citet{toschi09} has shown that ..  \bibliographystyle{plain} \bibliography{foo}  \end{document}   And here is foo.bib  @article{toschi09, author = {Toschi, F. and Bodenschatz, E.}, title = {Lagrangian Properties of Particles in Turbulence}, journal = {Annual Review of Fluid Mechanics}, volume = {41}, number = {1}, pages = {375-404}, year = {2009},  }   What I get is:     The author (author?) [1] has shown that ..   Any help will be more than welcome, thank you! When did 5 foot squares become standard in D&D? Why do I get blurry pictures when I take a lens attachment off? Detecting an undefined object property What's the best way of checking if an object property in JavaScript is undefined? Login not redirecting back to page where login link was clicked if account created Maximum power transfer proof I have the following homework problem.  Consider a power supply with fixed emf $ε$ and internal resistance $r$ causing current in a load resistance $R$. In this problem, $R$ is fixed and $r$ is a variable. The efficiency is defined as the energy delivered to the load divided by the energy delivered by the emf.  When the internal resistance is adjusted for maximum power transfer, what is the efficiency?  The answer is 50% but I'm confused how this is calculated. Here is my thought process so far.  The power dissipated in the load is $I^2R$ and $\displaystyle I = \frac{ε}{r+R}$ so $\displaystyle P = \frac{ε^2R}{(r+R)^2} = \frac{ε^2}{\frac{r^2}{R} + 2r + R}$ and so power transferred to the load will be maximum when $\displaystyle \frac{r^2}{R} + 2r + R$ is a minimum. Taking the first derivative $\displaystyle \frac {d}{dr}(\frac {r^2}{R} + 2r + R) = (\frac{2r}{R} + 2)$ and this equals 0 when r = -R. The second derivative is $\displaystyle \frac{2}{R} &gt; 0$ so this point would be a minimum and therefore max power transferred when r = -R.  But having $r = -R$ doesn't make sense to me. From what I read, for maximum power transfer $r$ should equal $+R$. So I've probably done something wrong in my calculations or assumptions in the previous paragraph. Also wouldn't max power be transferred when the internal resistance is as close to zero as possible?  Can someone please show me a proof that shows why $r = R$ for max power transfer and then how to calculate the efficiency. Could a Homorphus Charm Change a Werewolf Back Into a Human Before the Moon Cycle Ends? ‘Nice loud howl, Harry – exactly – and then, if you’ll believe it, I pounced – like this – slammed [the werewolf] to the floor – thus – with one hand, I managed to hold him down – with my other, I put my wand to his throat – I then screwed up my remaining strength and performed the immensely complex Homorphus Charm – he let out a piteous moan – go on, Harry – higher than that – good – the fur vanished – the fangs shrank – and he turned back into a man. Simple, yet effective – and another village will remember me forever as the hero who delivered them from the monthly terror of werewolf attacks.’   Gilderoy Lockhart - Chamber of Secrets - chapter 10 - The Rogue Bludger   Yeah, yeah. I know: consider the source! We all know Gilderoy Lockhart is a fake and a fraud in that he took credit for other heroic wizards' work. However, it occurred to me that in order to sell his books, he would have had to have written accurate and real spells and charms and potions, etc, into the books, or else everyone would have known right away that he was a turkey.   So is it possible there's an actual Homorphus Charm that will change a werewolf back into a human before the werewolf's moon cycle is over? If so, why on earth would they not have used it on Remus Lupin (for Lupin's safety) or Fenrir Greyback (for the community's safety)? My local hackerspace has a CNC machine.  I can give them my Gerbers and they can print out the PCB.  The machine does not plate VIAs.  I need to do this after the CNC machine is finished.  What is the best process and materials to use? Find the general solution of $xy''-(1+x)y'+y=x^2$ knowing that the homogeneous equation has the following solution: $e^{ax}$, where $a$ is a parameter you have to find.  I have found that $a=1$ or $a=1/x$. How do I find packages to install via apt-get Limits, find a limit that exist in absolute value but not outside the absolute value. Schema for a multilanguage database I'm developing a multilanguage software. As far as the application code goes, localizability is not an issue. We can use language specific resources and have all kinds of tools that work well with them.  But what is the best approach in defining a multilanguage database schema? Let's say we have a lot of tables (100 or more), and each table can have multiple columns that can be localized (most of nvarchar columns should be localizable). For instance one of the tables might hold product information:  CREATE TABLE T_PRODUCT (   NAME        NVARCHAR(50),   DESCRIPTION NTEXT,   PRICE       NUMBER(18, 2) )   I can think of three approaches to support multilingual text in NAME and DESCRIPTION columns:   Separate column for each language  When we add a new language to the system, we must create additional columns to store the translated text, like this:  CREATE TABLE T_PRODUCT (   NAME_EN        NVARCHAR(50),   NAME_DE        NVARCHAR(50),   NAME_SP        NVARCHAR(50),   DESCRIPTION_EN NTEXT,   DESCRIPTION_DE NTEXT,   DESCRIPTION_SP NTEXT,   PRICE          NUMBER(18,2) )  Translation table with columns for each language  Instead of storing translated text, only a foreign key to the translations table is stored. The translations table contains a column for each language.  CREATE TABLE T_PRODUCT (   NAME_FK        int,   DESCRIPTION_FK int,   PRICE          NUMBER(18, 2) )  CREATE TABLE T_TRANSLATION (   TRANSLATION_ID,   TEXT_EN NTEXT,   TEXT_DE NTEXT,   TEXT_SP NTEXT )  Translation tables with rows for each language  Instead of storing translated text, only a foreign key to the translations table is stored. The translations table contains only a key, and a separate table contains a row for each translation to a language.  CREATE TABLE T_PRODUCT (   NAME_FK        int,   DESCRIPTION_FK int,   PRICE          NUMBER(18, 2) )  CREATE TABLE T_TRANSLATION (   TRANSLATION_ID )  CREATE TABLE T_TRANSLATION_ENTRY (   TRANSLATION_FK,   LANGUAGE_FK,   TRANSLATED_TEXT NTEXT )  CREATE TABLE T_TRANSLATION_LANGUAGE (   LANGUAGE_ID,   LANGUAGE_CODE CHAR(2) )    There are pros and cons to each solution, and I would like to know what are your experiences with these approaches, what do you recommend and how would you go about designing a multilanguage database schema. Comparing two logit or probit curves using a single parameter I've conducted a psychological experiment on the same subject, under two different condition. For each condition I've collected the number of correct and wrong answer for each stimulus (number of trials per stimulus = 10; number of stimulus = 15). From the data collected I fitted a psychometric curve (probit or logit curve), and now I want to compare the results.  Consider subject 1: His answers are collected in the following matrices  **COND_1**     correct cnt   Y  N   1   0 10   2   0 10   3   0 10   4   0 10   5   0 10   6   0 10   7   1  9   8   4  6   9   5  5   10  7  3   11  8  2   12  7  3   13 10  0   14 10  0   15 10  0  **COND_2**     correct cnt   Y  N   1   0 10   2   2  8   3   2  8   4   3  7   5   2  8   6   4  6   7   8  2   8  10  0   9   8  2   10 10  0   11  9  1   12 10  0   13 10  0   14 10  0   15 10  0  COND_1.1 &lt;- matrix(c(0, 2, 2, 3, 2, 4, 8, 10, 8, 10, 9, 10, 10, 10, 10, 10, 8, 8, 7, 8, 6, 2, 0, 2, 0, 1, 0, 0, 0, 0), byrow=F, ncol=2)  COND_1.2 &lt;- matrix(c(0, 0, 0, 0, 0, 0, 1, 4, 5, 7, 8, 7, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 6, 5, 3, 2, 3, 0, 0, 0), byrow=F, ncol=2)  cnt &lt;- seq(from=0, to=1.4, by=0.1)  ddprob.1.1 &lt;- glm(COND_1.1 ~ cnt, family = binomial(link = "probit"))  ddprob.2.1 &lt;- glm(COND_2.1 ~ cnt, family = binomial(link = "probit"))     Observing the plot, you can surely say that performance under condition 2 is better then the performance under condition 1. In fact if you compute some parameters like AUC, p25, p50, p75 (the value of the stimulus at which the number of correct answers are 25%, 50% and 75% each) [threshold parameters], you'll see that:  COND_1      COND_2 AUC    &lt;    AUC p25    &gt;    p25 p50    &gt;    p50 p75    &gt;    p75     Now consider subject 2:  COND_1     correct cnt   Y  N   1   0 10   2   0 10   3   0 10   4   0 10   5   3  7   6   3  7   7   4  6   8   5  5   9   9  1   10  9  1   11 10  0   12 10  0   13 10  0   14 10  0   15 10  0  COND_2     correct cnt   Y  N   1   0 10   2   1  9   3   0 10   4   4  6   5   2  8   6   6  4   7   4  6   8   7  3   9   4  6   10  7  3   11  7  3   12 10  0   13  9  1   14 10  0   15 10  0   COND_1.2 &lt;- matrix(c(0, 0, 0, 0, 3, 3, 4, 5, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 7, 7, 6, 5, 1, 1, 0, 0, 0, 0, 0), byrow=F, ncol=2) COND_2.2 &lt;- matrix(c(0, 1, 0, 4, 2, 6, 4, 7, 4, 7, 7, 10, 9, 10, 10, 10, 9, 10, 6, 8, 4, 6, 3, 6, 3, 3, 0, 1, 0, 0), byrow=F, ncol=2) cnt &lt;- seq(from=0, to=1.4, by=0.1)  ddprob.1.1 &lt;- glm(COND_1.2 ~ cnt, family = binomial(link = "probit")) ddprob.2.1 &lt;- glm(COND_2.2 ~ cnt, family = binomial(link = "probit"))   The plotted curves are shown in the image below.    Can you say what performance is better? Under condition 1 or under condition 2? Extrapolating AUC, p25, p50, p75, you have:  COND_1      COND_2 AUC     &gt;   AUC p25     &gt;   p25 p50     =   p50 p75     &lt;   p75   So my question is: Is there a method to say that a generic curve (logit, probit or whatelse) is HIGHER then another? Is there a method to compare (a single number of "performance") that describe the differences of the two curves? My example shows that AUC, p25, p50, p75 are not good parameters. I'd like to compute a single numeric parameter for each curves, to make a simple t-paired test, extrapolated from the distribution seen. Proving the total number of subsets of S is equal to $2^n$ Student here! Just reading Liebecks Introduction to pure mathematics for fun and I made an attempt at proving the total number of subsets of S is equal to $2^n$.   I realized that the total number of subsets of S is just:  $ \binom{n}{1} + \binom{n}{2} + \cdots + \binom{n}{n} + 1$  And so I put together the cool looking formula  $ \displaystyle \sum_{r=1}^n \frac{n!}{r!(n-r)!} = 2^n - 1$  But I have no clue how to approach proving this formula analytically. Any help?    So if I try a proof by induction:  $\displaystyle \sum_{r=1}^n \frac{n!}{r!(n-r)!} = 2^n - 1$  $\displaystyle \sum_{r=0}^n \frac{n!}{r!(n-r)!} = 2^n$  obviously true for $n = 1$:  $1 + \frac{1}{1!0!} = 2 = 2$  assume true for $n$, I could multiply both sides by $2$?  $\displaystyle 2\sum_{r=0}^n \frac{n!}{r!(n-r)!} = 2^{n+1}$  How could I go about proving that  $\displaystyle 2\sum_{r=0}^n \frac{n!}{r!(n-r)!}  = \sum_{r=0}^{n+1} \frac{(n+1)!}{r!((n+1) - r)!}$