Java NullPointerException when reading SerialPort Names
What is a NullPointerException, and how do I fix it?
Is there an equivalent of MATLAB's Workspace window in Mathematica? How can I control a servo motor with the PWM output of a microcontroller? I wanted to control the direction of servo motor with a switch. I am using an Atmega32.  Outputs are PIND4 and PIND5 and the input is PINA3, but the two servo motors turn only in 1 direction.  #ifndef F_CPU  #define F_CPU 1000000UL   #endif  #include &lt;avr/io.h&gt; #include &lt;util/delay.h&gt; #include &lt;avr/interrupt.h&gt;   int main(void) { DDRD= 0xFF ; DDRA=0x00; PORTA =0x00; // FAST PWM TCCR1A |= 1&lt;&lt;COM1A0 | 1&lt;&lt;COM1A1 | 1&lt;&lt;WGM11 |1&lt;&lt;COM1B0|1&lt;&lt;COM1B1 ; TCCR1B= 1&lt;&lt;WGM12|1&lt;&lt;WGM13 ; ICR1 = 19999 ;  TCCR1B |=1&lt;&lt;CS10 ; while (1) {    if(PORTA==0x08) //if pina3 is 1    {     OCR1A = ICR1 -2000 ;   //turn servo 1     _delay_ms(1000);          OCR1B=ICR1-2000;    //turn servo 2     _delay_ms(1000);     }     if(PORTA==0x00)// if pina3 is 0     {       OCR1A = ICR1 -900 ; //turn servo 1 in the other direction       _delay_ms(1000);               OCR1B=ICR1-900;     //turn servo 2 in the other direction       _delay_ms(1000);      } }       return 0 ;  } RSA encryption with private key and decryption with a public key Failed to load map. Error contacting Google servers. This is probably an authentication issue How to achieve this 3D "Card" effect Derivation of Mode of grouped data A formula to calculate the mode for grouped data's is given in my text book: Mode = $l + \dfrac{(f_1 - f_0)h}{2f_1 - f_0 - f_2} $ Where, $l = $ lower limit of the modal class, $h = $ size of the class interval, $f_1 = $  frequency of the modal class, $f_0 = $ frequency of the class preceding the modal class, $f_2 =$ frequency of the class succeeding the modal class. Can you please explain the derivation of this formula, as it is not given in my T.B. Thanks . Using PyQGIS to transform layer of polygons into layer of holes inside bbox? Templated check for the existence of a class member function? Is it possible to write a template that changes behavior depending on if a certain member function is defined on a class?  Here's a simple example of what I would want to write:  template&lt;class T&gt; std::string optionalToString(T* obj) {     if (FUNCTION_EXISTS(T-&gt;toString))         return obj-&gt;toString();     else         return "toString not defined"; }   So, if class T has toString() defined, then it uses it; otherwise, it doesn't. The magical part that I don't know how to do is the "FUNCTION_EXISTS" part. Today in a match the setter set the ball too low for me to spike it, so I just dinked it over.  The bottom of the ball was lower than the top of the net at the point where I made contact.  When the defender made contact, again, the bottom of the ball was lower than the top of the net (the top of the ball was over the top of the net though).  I felt that this wasn't technically a block and that he shouldn't have been allowed to hit it a second time, but I wasn't sure so I just let it go.  Was this a legal block or should it have been our point when he hit it a second time in a row?  Edit:  I don't think I was clear about the part where, after I hit the ball, the ball travelled over the net onto the other team's side of the court.  The other player did not reach over the net so there is no issue there.  It's just an issue of whether or not their first contact was a block or a hit.  I believe it was not a block but I can't find a specific ruling to address it. Inverse metric in linearised gravity PDF of function of X I'm learning about functions of random variables and am trying to work out an example I made up. If $y = \sin(x)$ and $x$ has domain $[0, 4\pi]$, is the following the correct expression for the pdf of $y$: $$\begin{align*} f_Y(y) &amp;= \frac{d}{dy}F_Y(y)\\ &amp;= \frac{d}{dy}[F_X(2\pi) - F_X(\pi) + F_X(4\pi) - F_X(3\pi)]\\ &amp;= \frac{d}{dx}F_X(2\pi)\left|\frac{dg^{-1}(y)}{dy}\right| - \frac{d}{dx}F_X(\pi)\left|\frac{dg^{-1}(y)}{dy}\right| + \frac{d}{dx}F_X(4\pi)\left|\frac{dg^{-1}(y)}{dy}\right| - \frac{d}{dx}F_X(3\pi)\left|\frac{dg^{-1}(y)}{dy}\right|\\ &amp;=f_X(2\pi)\left|\frac{1}{\sqrt{1-0}}\right| - f_X(\pi)\left|\frac{1}{\sqrt{1-0}}\right| + f_X(4\pi)\left|\frac{1}{\sqrt{1-0}}\right| - f_X(3\pi)\left|\frac{1}{\sqrt{1-0}}\right|\\ &amp;= f_X(2\pi) - f_X(\pi) + f_X(4\pi) - f_X(3\pi)\\ \end{align*}$$ File.Copy is giving exception Atiyah-Macdonald, Exercise 5.4 I was having some trouble with the following exercise from Atiyah-Macdonald.     Let $A$ be a subring of $B$ such that $B$ is integral over $A$. Let $\mathfrak{n}$ be a maximal ideal of $B$ and let $\mathfrak{m}=\mathfrak{n} \cap A$ be the corresponding maximal ideal of $A$. Is $B_{\mathfrak{n}}$ integral over $A_{\mathfrak{m}}$?   The book gives a hint which serves as a counter-example. Consider the subring $k[x^{2}-1]$ of $k[x]$ where $k$ is a field, and let $\mathfrak{n}=(x-1)$. I am trying to show that $1/(x+1)$ could not be integral over $k[x^{2}-1]_{\mathfrak{n}^{c}}$.  I have understood why this situation serves as a counterexample. But I am essentially stuck at trying to draw a contradiction. A hint or any help would be great. Facebook authorization fails on iOS6 when switching FB account on device Origin of the Mustache Twirling Villain Whenever someone thinks about silent cinema the image of the laughing villain, twirling his mustache, and tying the hapless blonde beauty to the railroad, pops up in our collective memory. But in which movie (or movies) did that particular image first appear? If I have several classes with functions that I need but want to store separately for organisation, can I extend a class to have both?  i.e. class a extends b extends c  edit: I know how to extend classes one at a time, but I'm looking for a method to instantly extend a class using multiple base classes - AFAIK you can't do this in PHP but there should be ways around it without resorting to class c extends b, class b extends a Class imbalance strategies When dealing with the class imbalance problem in a binary classifier, there are three ways I know of to address it: over-sampling, under-sampling and using cost-sensitive methods.   Are there any guidelines, rules of thumb or general strategies to choose among these methods? A possible answer would be: over-sample when the positive class has more than 100 instances (I just made it up). TikZ arrow emanating from node at an angle for a distance How do I draw a line of length l and at an angle of a from a circular node N in TikZ? Calendar date to yyyy-MM-dd format in java Good books on complex numbers I searched on this site but I found posts asking for books on complex analysis which I guess is not what I want.   I want a book on problems concerning with roots of unity, argand plane, exponential form, inequalities etc. Some examples : , , .  I don't think these types of problems are covered in a analysis book but I don't know. I think I want a book on algebra of complex numbers.   Are these topics covered in analysis book ? If not, please suggests some books on this topic. I guess my question is bit vague, sorry for that. :).      As suggested in the comments I would like to have books similar to .