Select records using PDO with where clause in PHP
How do I create a PDO parameterized query with a LIKE statement?
Good keyboard layouts for typing (La)TeX When typing (La)TeX some keys are used a lot more often then in plain text, especially \, {, }, [, ], $, ^ and _. On most keyboard layouts these keys are rather cumbersome to type. The English QWERTY keyboard is a lot better than the German QWERTZ, but is still far from optimal.  Given that I mostly type mathematical texts in English, what keyboard layout would you recommend?  Bonus points for the following:   Ability to type non-English Latin characters, especially German umlauts. Some similarity to QWERTZ or QWERTY as I'm most used to these layouts (I currently use the US-International layout from Linux) Ability to type math symbols directly (Greek letters, \times, etc.) Python provides the "*" operator for unpacking a list of tuples and giving them to a function as arguments, like so:  args = [3, 6] range(*args)            # call with arguments unpacked from a list   This is equivalent to:  range(3, 6)   Does anyone know if there is a way to achieve this in PHP? Some googling for variations of "PHP Unpack" hasn't immediately turned up anything.. perhaps it's called something different in PHP? Weird line in my mirrored mesh was following a tutorial where I stumbled into this weird line in my mirrored mesh (sorry for the feet lol)      You can also download the blender file Does JavaScript have the interface type (such as Java's 'interface')? How to make listings code indentation remain unchanged when copied from PDF? So I am using  package for code examples. But there is a problem. When I copy the code examples from the final PDF document, they are usually not the same - the indentation is gone, there are random spaces after parenthesis, etc. Does anyone know how to make sure that the code that I copy from the final document is the same as I wrote it in the LaTeX document?  Here is what I mean. Compile this document:  \documentclass[12pt,oneside]{memoir}  \usepackage{listings} \usepackage[T1]{fontenc} \usepackage{xcolor} \usepackage{textcomp}  \definecolor{codebg}{HTML}{EEEEEE} \definecolor{codeframe}{HTML}{CCCCCC}  \lstset{language=Awk} \lstset{backgroundcolor=\color{codebg}} \lstset{frame=single} \lstset{framesep=10pt} \lstset{rulecolor=\color{codeframe}} \lstset{upquote=true} \lstset{basicstyle=\ttfamily} \lstset{showstringspaces=false}  \begin{document}  This code example prints out all users on your system:  \begin{lstlisting}[language=c] #include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;string.h&gt;  #define MAX_LINE_LEN 1024  int main() {     char line[MAX_LINE_LEN];     FILE *in = fopen("/etc/passwd", "r");     if (!in) exit(EXIT_FAILURE);      while (fgets(line, MAX_LINE_LEN, in) != NULL) {         char *sep = strchr(line, ':');         if (!sep) exit(EXIT_FAILURE);         *sep = '\0';         printf("%s\n", line);     }     fclose(in);     return EXIT_SUCCESS; } \end{lstlisting}  \end{document}   Now compile it, open it, select and copy the code example and paste it in a text editor. Here is the result I get:  # include &lt;stdio .h&gt; # include &lt;stdlib .h&gt; # include &lt;string .h&gt; # define MAX_LINE_LEN 1024 int main () { char line [ MAX_LINE_LEN ]; FILE *in = fopen ("/ etc / passwd ", "r"); if (! in) exit ( EXIT_FAILURE ); while ( fgets (line , MAX_LINE_LEN , in) != NULL ) { char * sep = strchr (line , ':'); if (! sep ) exit ( EXIT_FAILURE ); * sep = '\0 '; printf ("%s\n", line ); } fclose (in ); return EXIT_SUCCESS ; }   Jeez! What's this... The indentation is gone. There are spaces in included headers &lt;stdio .h&gt;, there are spaces after parenthesis [ MAX_LINE_LEN ].  Anyone knows how to fix this? I'd like the code examples in my book to be copy/paste-able into a text editor so people can try them out easily. mod Distributive Law, factoring $\!\!\bmod\!\!:$ $\ ab\bmod ac = a(b\bmod c)$ I stumbled across this problem  Find $\,10^{\large 5^{102}}$ modulo $35$, i.e. the remainder left after it is divided by $35$  Beginning, we try to find a simplification for $10$ to get: $$10 \equiv 3 \text{ mod } 7\\ 10^2 \equiv 2 \text{ mod } 7 \\ 10^3 \equiv 6 \text{ mod } 7$$ As these problems are meant to be done without a calculator, calculating this further is cumbersome. The solution, however, states that since $35 = 5 \cdot 7$, then we only need to find $10^{5^{102}} \text{ mod } 7$. I can see (not immediately) the logic behind this. Basically, since $10^k$ is always divisible by $5$ for any sensical $k$, then: $$10^k - r = 5(7)k$$ But then it's not immediately obvious how/why the fact that $5$ divides $10^k$ helps in this case. My question is, is in general, if we have some mod system with $a^k \equiv r \text{ mod } m$ where $m$ can be decomposed into a product of numbers $a \times b \times c \ \times ...$, we only need to find the mod of those numbers where $a, b, c.....$ doesn't divides $a$? (And if this is the case why?) If this is not the case, then why/how is the solution justified in this specific instance? I'm setting up an Nginx web server and and want to perform load balancing using the round robin method.  This is what I have found thus far:  upstream backend  {    server backend1.example.com;    server backend2.example.com;    server backend3.example.com; }   According to the page they says i need to add the above lines to my nginx.conf file and upload it to server to load balance.  I do not understand what it means by server backend3.example.com;.  How do I setup a backend instance? I could install with an error message "unknown media /ALL". It could not run WPS Office. What does this pen notation in my UK entry stamp mean? I entered the UK from Paris once (riding the Eurostar train), and after the UK border control officer placed an entry stamp in my passport, he added a notation in pen (picture below).  What does it mean?  I suspect it is some sort of "warning" (the border control officer was not happy with me, though thankfully did not refuse entry).  I've always been curious about what it means more precisely or whether my prediction is even correct.  I've entered the UK only once again after getting this stamp.  I was admitted then too, but it took a while (the border control officer went away for about 10 minutes to do something before letting me in). Can "who" as a relative pronoun sometimes be omitted? Proving that the Intersection of any Collection of Compact Sets is Compact I was trying to do this problem this way:  Let $\mathcal{B}=\{B_i\}$ be a collection of compact sets. By Heine-Borel, each of the $B_i$'s are closed and bounded. We already know that the intersection of a collection of closed sets is once again closed, so $\cap \mathcal{B}$ is closed.  If I can prove $\cap\mathcal{B}$ is bounded as well, I can use Heine-Borel to say it is compact. So I was not sure how to show it was bounded, but a friend showed me his way of doing it. He did it the following way:  Let $b,a\in\mathbb{R}$ be an upper and lower bound for $B_1$, respectively. Since $\cap\mathcal{B}\subset B_1, a$ is a lower bound for $\cap \mathcal{B}$ and $b$ is an upper bound for $\cap\mathcal{B}$. Therefore, $\cap\mathcal{B}$ is bounded and then by Heine-Borel, it is compact.  My question is on the paragraph right above. I don't understand why what he did means that $a$ and $b$ are lower and upper bounds for $\cap\mathcal{B}.$ Can anyone explain why this is? Thanks. Why is Outlook 2010 Changing my Embedded Spreadsheet to a GIF? Years ago I figured out how to embed a spreadsheet in an Outlook email to automate a task I do regularly.  Whenever I want to send a new quote request I open an old email, tell Outlook I want to resend it, fill in the new values in my embedded spreadsheet and then send it off.  This method worked well for years.  After switching to a new computer however, I have found that when I open the latest emails I have sent, I cannot edit the embedded spreadsheet because Outlook interprets it now as a GIF.  Saved emails that I sent with the old computer however, still work fine - I can still open, edit and resend and Outlook interprets the embedded spreadsheet correctly.  I would like to figure out how to setup Outlook in the new PC correctly so that the embedded spreadsheet is interpreted correctly when the email is reopened. Some sort of security setting, maybe?  Any help anyone could provide would be appreciated.  Edit: I developed the spreadsheet originally in Excel. Then I went into Outlook, created a new email, did Insert->Object->Excel Spreadsheet. At that point I had a blank spreadsheet in my email. Then I copied and pasted the spreadsheet from Excel into the blank spreadsheet in Outlook and it worked perfectly (until this recent problem) Adobe Illustrator: strange behavior while aligning objects How to implement Enums in Ruby? Let $a\ge 2$ be an integer. Show that for positive integers $m,n$, we have $a^n - 1$ divides $a^m - 1$ if and only if $n$ divides $m$.   I am having trouble showing this. I've seen a similar problem on here but it only shows one direction for the proof. I would like to see both directions.  This is what I have so far: Let $m = nq + r$, then $a^m - 1 = a^{nq + r}- 1 = a^{nq}a^r - 1 = a^{nq}a^r - a^r + a^r - 1 = a^r(a^{nq} - 1) + a^r - 1$. Since $0\le r\lt n$, $r = 0$ then $a^m - 1$ = $a^{nq} - 1$ so $a^m$ = $a^{nq}$ . Thus $m = nq$ hence $n\mid m$. Rings' second isomorphism theorem I am thinking about the proof of the second isomorphism theorem, and something isn't very clear to me.   Let $R$ be a ring, $S\subset R$ a subring and $I\subset R$ an ideal. We have the natural homomorphism $f:R\rightarrow R/I$. The theorem states that $\mathrm{Im}(S)=(S+I)/I$. My question is why not simply $\mathrm{Im}(S)=S/I$?  I understand that it is not true (for starters, $S/I$ need not be a subring), but I cannot explain that to my self in a convincing way. This question is a result of having too much free time years ago during military service. One of the many pastimes was playing tic-tac-toe in varying grid sizes and dimensions, and it lead me to a conjecture. Now, after several years of mathematical training at a university, I am still unable to settle the conjecture, so I present it to you.  The classical tic-tac-toe game is played on a $3\times3$ grid and two players take turns to put their mark somewhere in the grid. The first one to get three collinear marks wins. Collinear includes horizontal, vertical and diagonal lines. Experience shows that the game always ends in a draw if both players play wisely.  Let us write the grid size $3\times3$ as $3^2$. We can change the edge length by playing on any $a^2$ grid (where each player tries to get $a$ marks in a row on the $a\times a$ grid). We can also change dimension by playing on any $a^d$ grid, for example $3^3=3\times3\times3$. I want to understand something about this game for general $a$ and $d$. Let me repeat: The goal is to make $a$ collinear marks.  I assume both players play in an optimal way. It is quite easy to see that the first player wins on a $2^d$ grid for any $d\geq2$ but the game is a tie on $2^1$. The game is a tie also on $3^1$ and $3^2$, but my experience suggests that the first player wins on $3^3$ but the game ties on $4^d$ for $d\leq3$. It seems quite credible that if there is a winning strategy on $a^d$, there is one also on $a^{d'}$ for any $d'\geq d$, since more dimensions to move in gives more room for winning rows.  to a related question tells that for any $a$ there is $d$ so that there is a winning strategy on $a^d$.  This brings me to the conjecture:     There is a winning strategy for tic-tac-toe on an $a^d$ grid if and only if $d\geq a$. (Refuted by TonyK's answer below.)   Is there a characterization of the cases where a winning strategy exists? It turns out not to be as simple as I thought.  To fix notation, let $$ \delta(a)=\min\{d;\text{first player wins on }a^d\} $$ and $$ \alpha(d)=\max\{a;\text{first player wins on }a^d\}. $$ The main question is:     Is there an explicit expression for either of these functions?   Or decent bounds?   Partial answers are also welcome.   Note that the second player never wins, as was discussed in .    A remark for the algebraically-minded: We can also allow the lines of marks to continue at the opposite face when they exit the grid; this amounts to giving the grid a torus-like structure. Now there are no special points, unlike in the usual case with boundaries. Collinear points on a toric grid of size $a^d$ corresponds to a line (maximal collinear set) in the module $(\mathbb Z/a\mathbb Z)^d$. (If $a$ is odd, then $a$ collinear points in the mentioned module add up to zero, but the converse does not always hold: the nine points in $(\mathbb Z/9\mathbb Z)^3$ with multiples of three as all coordinates add up to zero but are not collinear.) This approach might be more useful when $a$ is a prime and the module becomes a vector space. Anyway, if this version of the game seems more manageable, I'm happy with answers about it as well (although the conjecture as stated is not true in this setting; the first player wins on $3^2$). How do I drag and drop files into an application? Prove that the union of the interior of a set and the boundary of the set is the closure of the set I'll denote closure of A with $\overline{A}$, $A^\circ$ as the interior of A, $\partial A$ as the boundary of $A$ and $A'$ as the accumulation points. I'm trying to prove the following:   $$\overline{A}=A^\circ \cup\partial A$$  Is this a valid proof?  Take $x \in A^\circ \cup \partial A$ then $x \in A^\circ$ or $x \in \partial A$   if $x \in A^\circ$ then $x \in \overline{A}$  if $x \in \partial A$ then $x \in \overline{A} \cap\overline{(X\setminus A)}$ thus $x \in\overline{A} $ so $A^\circ\cup\partial A\subset\overline{A}$  Take $x \in \overline{A}$ then $x \in A' \cup A$ thus $x \in A'\setminus A$ or $x \in A^\circ$  if $x \in A'\setminus A$ then $x \in \overline{(X\setminus A)}$ so $x \in \overline{A}\cap\overline{(X\setminus A)}$ and $x \in\partial A$ so $x\in A^\circ\cup\partial A$  if $x \in A^\circ$ then $x \in A^\circ\cup \partial A$ so $\overline{A}\subset A^\circ\cup\partial A$ Minecraft extra folders? Once I click to run minecraft a small window appears saying "Downloading runtime", then three other folders appear onto my desktop: Game, Native Log, and Runtime. This really annoys me, as I have to keep deleting them after I am done with a session of minecraft. Why is this? It never use to happen before.