Describe the Strategy Design Pattern in Java?
Real World Example of the Strategy Pattern
How to replace ${} placeholders in a text file? I want to pipe the output of a "template" file into MySQL, the file having variables like ${dbName} interspersed. What is the command line utility to replace these instances and dump the output to standard output? Suppose $u$ is an element of a ring with a right inverse. I'm trying to understand why the following are equivalent.   $u$ has at least two right inverses $u$ is a left zero divisor $u$ is not a unit   If $v$ and $w$ are distinct right inverse of $u$, then $u(v-w)=0$, but $v-w\neq 0$, so $u$ is a left zero divisor. It's also clear that if $u$ is a left zero divisor, it cannot be a unit (else I could cancel $u$ from $ub=0$ to see $b=0$).  I'm having a heck of a time seeing why $u$ is not a unit implies $u$ has at least two right inverses. I tried the contrapositive, but saw no good approach. What am I missing? fp - How to keep running sum in variable? I have this code in my LaTeX:   \FPset{totalHours}{0}  \newcommand{\entry}[5]{     \FPeval{totalHours}{(totalHours)+#5}     #1 &amp; #2 &amp; #3 &amp; #4 &amp; #5 \\ }   Where \entry is meant to be an entry in a time log. The 5th argument is a number representing the number of hours in that entry. I want to keep a running total of the hours in a variable I can print later on, totalHours.   This seems to do the \FPeval but then totalHours gets reset to 0 by the next time I write \entry. What is the correct way to keep a running total? Thanks. What is the use of percent signs (%) at the end of lines? (Why is my macro creating extra space?) I see that the code in many packages and examples contains percent signs % at the end of (many) lines. What are they used for? Do they affect the parsing of those lines? Remove spaces from std::string in C++ What is the preferred way to remove spaces from a string in C++? I could loop through all the characters and build a new string, but is there a better way? I was working on a tower and painted my own texture for it. I saved halfway though and took a break. When I returned to my little project, I could paint on the image and it shows up in the material view but not the render. I did everything in my power but still couldn't understand why?  I have used:   Nodes, including mapping and insert UV coordinates. Unwrap UVs Used lights Deleted and replace nodes Deleted and replace Mat Removed image and replace it Reload image Painted on mesh   Even though use blender, I am not a programmer. So I find it really helpful if someone could give me an answer. Is it possible to disable X at boot time? I'm setting up a server so it would be nice if it wouldn't load the graphical interface every time I boot. There are no interfaces on which a capture can be done Find all primes $p>2$ for which $x^2+x+1$ is irreducible in $\mathbb{F}_p[x]$ Find all primes $p&gt;2$ for which $x^2+x+1$ is irreducible in $\mathbb{F}_p[x]$   Attempt. Since $x^2+x+1$ is of degree 2, it is reducible iff it has a root in $\mathbb{F}_p$. It has a root in $\mathbb{F}_p$ iff $x^3-1=(x-1)(x^2+x+1)$ has a root other than 1. The latter has a root other than $1$ iff $\mathbb{F}_p$ has elements of order $3$, which happens iff $3\mid |\mathbb{F}_p^{\times}|=p-1$, which happens iff $p\equiv 1\bmod 3$. So $x^2+x+1$ is irreducible iff $p\not \equiv 1\bmod3 $.   I am getting a different answer than my professor, who has $p\equiv 1\bmod 3$. If I am incorrect, were am I going wrong?  Update. Now I am unsure about my own reasoning. What if $1$ is a root of $x^2+x+1$? I don't know why I am considering roots of $x^2+x+1$ other than $1$ when $1$ can be a root. Continuous footnote numbering I would like footnote numbering to continue over pages and chapters. In my document it's reset every chapter. I'm using the report documentclass. Combinatorics Question Asking How Many Integer Solutions Given Different Restrictions How many integer solutions of $x_1 + x_2 + x_3 + x_4 = 28$ are there with:  (a) $0 ≤ x_i ≤ 12$?  (b) $−10 ≤ x_i ≤ 20$?  (c) $0 ≤ x_i, x_1 ≤ 6, x_2 ≤ 10, x_3 ≤ 15, x_4 ≤ 21$?  \ \  My attempts (I was really only able to solve part (a) but I would appreciate if you could check my work for this one as well):  (a) First I took the total number of integer solutions with no restrictions: There would be ${28+3\choose 3}$ = ${31\choose 3}$ total solutions with no restrictions.   Then I used the inclusion exclusion principle and knew I would have to subtract [P(A) + P(B) + P(C) + P(D)] where A --> $x_1$ is greater than or equal to 13, ..., D--> $x_4$ is greater than or equal to 13. The probabilities of all these cases would equal ${15+3\choose 3}$ = ${18\choose 3}$ because once we assign 13 to one of the $x_i$ there would be $28 - 13 = 15$ remaining to distribute among the $x_i$ values. We would also need to choose which of the $x_i$ to give the 13 to so we would multiply the ${18\choose 3}$ by ${4\choose 1}$ = ${4\choose 1}{18\choose 3}$  We would then have to add back, since we "oversubtracted", the case in which there is an intersection between two of the $x_i$ or in other words two of the $x_i$ receive 13 or more. P$(A\bigcap B)$ = $28-2(13) = 2$ remaining to distribute among the $x_i$ values. So we would also have to choose which of the $x_i$ to give the 13 to so we would have ${4\choose 2}$ ways to choose them. So there would be ${4\choose 2}{2+3\choose 3}$ = ${4\choose 2}{5\choose 3}$ solutions in this case.   Thus the number of solutions would be: ${31\choose 3} - {4\choose 1}{18\choose 3} + {4\choose 2}{5\choose 3}$.  I'm not sure if this is correct and I'm really stuck on b and c so I would appreciate any help or feedback. Thank you! Can Raise Dead revive a character with zero maximum Hit Points? So, a character died from Draining Kiss of a succubus and his Max HP is 0. Can he be restored by Raise Dead, or does he need a higher level spell? Or a Greater Restoration cast on his lifeless body before Raise dead? I'm probably interested in RAW interpretation, since the character is in Adventurerer's league. Difference between ' and " on command line (bash)? How do simulacra behave? What does unwrapping a model do and why is it important? I've taken up self-study of math. (How smart can that be?) I've just about finished a course in real analysis which spent a lot of time on metric spaces and some time revisiting calculus.  I was thinking of trying abstract algebra. I would appreciate any book recommendations.  Thanks in advance.  Andrew Sound of a next scene starts one moment earlier than video The  mentions the following matrix identity $$\det\begin{pmatrix}A&amp;B\\B&amp;A\end{pmatrix}=\det(A+B)\det(A-B),$$ valid for squared matrices $A$ and $B$ of the same size.  How is this result proved? Introduction to statistics for mathematicians What is a good introduction to statistics for a mathematician who is already well-versed in probability?  I have two distinct motivations for asking, which may well lead to different suggestions:   I'd like to better understand the statistics motivation behind many problems considered by probabilists. I'd like to know how to better interpret the results of Monte Carlo simulations which I sometimes do to form mathematical conjectures.   I'm open to the possibility that the best way to go is not to look for something like "Statistics for Probabilists" and just go to a more introductory source. How do I fix these M4 macro errors? I am trying to compile  but when I run ./autogen.sh the script terminates with these errors  Checking for required M4 macros...   libtool.m4 not found   glib-gettext.m4 not found   intltool.m4 not found   pkg.m4 not found   gtk-doc.m4 not found   yelp.m4 not found ***Error***: some autoconf macros required to build mate-desktop   were not found in your aclocal path, or some forbidden   macros were found.  Perhaps you need to adjust your   ACLOCAL_FLAGS?   What do I need to do to get rid of these errors? I tired installing the latest versions of inittool, glib, gtk, yelp, etc... but I still get the macros errors.