Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it?
Every season near the trade deadline, we see teams that are out of it trading expensive players and/or free agents-to-be, typically for younger players or prospects.  For example, Matt Garza, set to become a free agent after the season, was traded to the Rangers for a few prospects.  It made sense for the Cubs to trade Garza, because he wasn't under contract any further than this season, and thus doesn't have much value to them.  Compare Garza to someone like Mike Trout, who is likely the most valuable property in baseball, given his skill and inexpensive cost over the next several years.  There's no way the Angels would trade him, because he'll be the cost-controlled centerpiece of the team for years to come.  However, with the Angels out of it this year, what if they wanted to trade Trout to a contender (say the Pirates), but only for the remainder of this season?  That is, they'd get several top prospects now, and would have an agreement with the Pirates that they'd trade him back in the offseason (for something pretty worthless, say for a journeyman minor leaguer).  The Pirates get Trout for the stretch run and are happy to give up a few prospects.  Trout doesn't have much value to the Angels this year, but he has a ton of value for next year.  So they get a few prospects for him, in exchange for the part of his career which has very little value to them.  So in effect, the Pirates are renting or borrowing him for the remainder of 2013.  Why don't trades like this happen?  Are there any rules prohibiting trades like this? I'm looking for the name of a sci-fi series, intended for children. Robots have control over the humans. There is a squad of humans who attack them. Every member in this squad has a badge on their suit, and when they touch this badge the suit becomes armed. This series was not cartoon series, it was performed by real people. The main robot character is very similar in style to Darth Vader in Star Wars. The series aired in the 1990s. I am sorry but I can't recall many details. State-of-the-art algorithms for the training of neural networks with GRU or LSTM units I recently read a lot about neural networks using GRU or LSTM units. There are many easy to use frameworks like tensorflow that do not even require high knowledge about programming. Unfortunately, I never really found good information on how the training of those networks work. Simple backpropagation might probably not work for gated recurrent networks or is just too inefficient for networks with such a high number of variables to learn.  So my question is:  What are the state-of-the-art algorithms used for the initialization and training of neural networks with GRU or LSTM units? I am not looking for frameworks to use, but for initialization and update equations for the internal parameters. I was working on a problem that resulted in the calculation: $20 \equiv 10x \pmod{11}$.  I got the answer $x \equiv 2 \pmod{11}$ with the thought process: Since $10$ is a factor of $20$ I can rewrite $20 \pmod{11}$ as $10x \pmod{11}$ with $x=2$. But isn't this basically the same as using division, which we aren't supposed to do in modular spaces?  If I solve by multiplying $20$ by the multiplicative inverse of $10 \pmod{11}$ which is $10$, I get $200 \pmod{11}$ which simplifies to $2 \pmod{11}$ anyway. Did these numbers just happen to be the same or is my original method valid? If $x_1,x_2,\ldots,x_n$ are the roots for $1+x+x^2+\ldots+x^n=0$, find the value of $\frac{1}{x_1-1}+\frac{1}{x_2-1}+\ldots+\frac{1}{x_n-1}$ Let $x_1,x_2,\ldots,x_n$ be the roots for $1+x+x^2+\ldots+x^n=0$. Find the value of   $$P(1)=\frac{1}{x_1-1}+\frac{1}{x_2-1}+\ldots+\frac{1}{x_n-1}$$   Source: IME entrance exam (Military Institute of Engineering, Brazil), date not provided (possibly from the 1950s)  My attempt: Developing expression $P(1)$, replacing the 1 by $x$, follows $$P(x)=\frac{(x_2-x)\cdots (x_n-x)+\ldots+(x_1-x)\cdots (x_{n-1}-x)}{(x_1-x)(x_2-x)\cdots (x_n-x)}$$    As $x_1,x_2,\ldots,x_n$ are the roots, it must be true that   $$Q(x)=(x-x_1)\cdots(x-x_n)=1+x+x^2+\ldots+x^n$$ and  $$Q(1)=(1-x_1)\cdots(1-x_n)=n+1$$ Therefore the denominator of $P(1)$ is  $$(-1)^{n} (n+1).$$ But I could not find a way to simplify the numerator.  Another fact that is probably useful is that  $$1+x^{n+1}=(1-x)(x^n+x^{n-1}+\ldots+x+1)$$ with roots that are 1 in addition of the given roots $x_1,x_2,\ldots,x_n$ for the original equation, that is  $$x_k=\text{cis}(\frac{2k\pi}{n+1}),\ \ k=1,\ldots,n.$$  This is as far as I could go...    Hints and full answers are welcomed. python ImportError: No module named primes If $ad$ and $bc$ are odd and even, respectively, then prove that $ax^3+bx^2+cx+d$ has an irrational root. $\displaystyle ax^3+bx^2+cx+d$ is a polynomial with integer coefficients. It is given that $ad,\,bc$ are odd and even respectively. Then prove that not all roots of the polynomial are rational.  It is easy to see that none of the roots are integer. But how to tackle the rational case? Any help is appreciated. Training on the full dataset after cross-validation? How do you deal with a player that's determined to play the game in a way that is detrimental to the advancement of the story? How to check if a string contains a substring in Bash I have a string in Bash: string=&quot;My string&quot;  How can I test if it contains another string? if [ $string ?? 'foo' ]; then   echo &quot;It's there!&quot; fi  Where ?? is my unknown operator. Do I use echo and grep? if echo &quot;$string&quot; | grep 'foo'; then   echo &quot;It's there!&quot; fi  That looks a bit clumsy. Can a mathematically sound prediction interval have a negative lower bound? I have used R to form a 95% prediction interval for the number of endemic species on an island. My lower bound is negative – is that mathematically sound?  In the linear model used in the prediction interval, the data used are:  Area Surface area of island, hectares DiscSC Distance from Santa Cruz, kilometres Elevation Elevation of higher point in metres and it is coded as such:   selected.model &lt;- lm(ES ~ Area + Elevation + DistSC + I(Elevation^2)                      + (Elevation:DistSC) + (A‌​rea:Elevation))    and stepwise regression was performed to find this "best" model   I'm not exactly sure how a prediction interval works. I just want to make sure it is OK. Obviously a negative number of species is incorrect, but I know it takes into account the uncertainty of the mean as well as data scatter. How to convert decimal to hexadecimal in JavaScript How do you convert decimal values to their hexadecimal equivalent in JavaScript? is a psychological phenomenon wherein an individual is convinced that they do not deserve the success that they have achieved despite (perhaps extensive) empirical evidence to the contrary.  Some people with imposter syndrome doubt their own ability level. For me, this usually manifests in the thought:  I've somehow convinced everyone into believing that I'm actually good at this.  followed by the horrifying notion that eventually I'll be found out and my world will collapse. I believe that the imposter syndrome is not uncommon in academia. I'm interested to know how other people here have experienced and dealt with it.  In particular, I'm looking for actual tactics that someone might use to combat imposter syndrome.   Why I asked this question: Beyond the obvious reason that this is something I have struggled with for many years and only recently gotten a handle on myself, there's also some evidence that merely realizing that other people experience imposter syndrome helps fellow imposters. As a grad student, I've managed to meet a fair number of people who are in their own struggles with imposter syndrome; however, the tactics and self-trickery that have helped me don't always speak to them and perhaps someone else's methods might. A field extension of prime degree Suppose that $E$ is an extension of $F$ of prime degree. Show that $~~\forall~ a \in E : ~ F(a)=F$ or $F(a)=E$   Attempt: Suppose that $E$ is an extension of a field $F$ of prime degree, $p$. Therefore $p = [E :F] = [E : F(a)][F(a) : F]$. Since $p$ is a prime number, we see that either $[E : F(a)] = 1$ or $[F(a) : F] = 1$.   Now, $[E : F(a)] = 1 \implies $ there is only one element $x \in E$ which forms a basis and every element in $E$ is generated by $x$ i.e. $E = \{x~c~|~ c \in F(a)\}$  $[F(a) : F] = 1 \implies $ there is only one element $y \in F(a)$ which forms a basis and every element in $F(a)$ is generated by $y$ i.e. $F(a) = \{y~d~|~ d \in F\}$  Have I inferred it correctly? How do I move ahead?  Thank you for your help. How do I select an object in the 3D viewport? I am trying to select the cube that in the middle of the scene. How can I select it? All I see is a crosshair appearing everywhere I click. Is this a bug? As an online shopper, I regularly use Amazon to purchase lots of stuff.  When I reconcile my credit card spending, I use Mail.app to search all mailboxes for specific dollar figures (e.g. command-option F, then type 24.95). Prior to Big Sur, finding dollar figures in Mail.app worked perfectly, whether the email messages resided &quot;On My Mac&quot; or on iCloud.  However, since Big Sur, doing a global Mail.app search for numeric strings, especially with a decimal point, doesn't work reliably. For example, I'll do a global search in Mail.app for 65.88 and I'll get one result from a locally archived message from years ago, however a very recent message in my InBox containing that figure is not found.  When I do a single message search (command-F) looking for 65.88, the value IS found. Unsurprisingly, using Spotlight delivers the exact same results. Using mdutil, I've manually erased and rebuilt the Spotlight index, rebuilt my Mail.app mailboxes, deleted all ~/Library/Mail/V8/MailData/Envelope* files to force the Mail.app to re-import everything, and reinstalled Big Sur.  I've also confirmed all my Spotlight settings to assure that Mail and Messages are included in searches, and that the volume where my mail resides is not excluded.  Nothing worked. I should note that I am using one SSD for macOS, and a separate SSD for my Home directory (c/o &quot;Advanced Options&quot; under Users &amp; Groups).  I've had this setup well before Big Sur, again, without any issues. Interestingly, I tried using the Spark email app, which DID successfully find dollar figures without any issue.  I suspect that Spark is not relying on Spotlight to obtain search results, and that's why it works.  (I would use Spark, however it doesn't support local mailboxes.) I've already sent Apple a report using the Feedback Assistant, and I can only hope something will get fixed. Can anyone else confirm this issue with Mail.app on Big Sur?  Any ideas on what else I can do? Why doesn't Neo teleport at random? I'm interested if any of the following explanations have enough predictive capability to explain the observations we see today. The claim is that the Universe is not expanding, and that red-shift of light is caused by:    Though a couple of these are simply ridiculous, I'm still interested. Keep in mind that I am not a creationist, but am looking for reasons to see if any of these are valid or invalid. How can I have  for Ubuntu? When connected to the Internet, the system checks if it's in a walled garden, which is simply trying to connect to Google. If it fails, in Android 5, there'll be an exclamation mark on the WiFi icon or signal icon.   In some situations, this is annoying. Say, in China, Google is blocked, the exclamation mark will always be there, which is meaningless.  How can I disable this check, and make the system assume, connected WiFi/mobile data is connected Internet?