Sort nested array by properties
Sort array of objects by string property value
I'm trying to use grep to show only lines containing either of the two words, if only one of them appears in the line, but not if they are in the same line.  So far I've tried  grep pattern1 | grep pattern2 | ... but didn't get the result I expected. A very recent post asking people to go "on strike" was just deleted How can I get the list of files in a directory using C or C++? How can I determine the list of files in a directory from inside my C or C++ code?  I'm not allowed to execute the ls command and parse the results from within my program. What is the minimal set of parts for a circut with this AVR microcontroller? My Arduino Uno has a ATMEGA328P-PU microcontroller, and bunch of other stuff on the board. I'd like to program the chip without the Arduino software, and only the minimum of other components.  I want to eventually create things without the cost of Arduino, and I want to learn about the other parts on the board and add them back as as needed.  I'm comfortable with C and gcc, so I can probably figure out the software part. But what, if anything, besides these two products below, do I need to have in the breadboard with the microcontroller? Suppose we have functions $f:A→B$ and $g:B→C$. Prove that if $f$ and $g$ are invertible, then so is $g \circ f$. Suppose we have functions $f:A→B$ and $g:B→C$. Prove that if $f$ and $g$ are invertible, then so is $g \circ f$. Is the converse true? I.e., if $g \circ f$ is invertible, does it follow that $f$ and $g$ are both invertible?  I know that if $f$ and $g$ are invertible, then they are both injective and surjective. Therefore, I assume from this that I have to show $g \circ f$ is injective and surjective as well, thus proving it is invertible. However, I don't know how to show $g \circ f$ is bijective based only on the information I have. How to change the title of ToC? I need to change default title of ToC. Is it possible with titlesec package? Here is my MWE:  \documentclass{book}  \usepackage{titlesec} \titleformat{\chapter}{\normalfont\Large\scshape}{\thechapter}{1em}{} \vspace{6pt}]  \usepackage{lipsum}   %-------------------------------------------------------------------------  \begin{document}   \newpage \thispagestyle{empty} \tableofcontents \thispagestyle{empty} \newpage \thispagestyle{empty}  \setcounter{footnote} {0}\chapter*{{\fontsize{11}{14}\selectfont\normalfont{Author1} \\ {\scshape\Large Title}}} \addcontentsline{toc}{chapter}{\normalsize\normalfont{Author1} \\ \normalfont\scshape{Title}} \thispagestyle{empty} \Author{Author1} \Title{Title} \lipsum \newpage \thispagestyle{empty}    \end{document} Notification for reviews shows way too many Conditional Expectaction 3 variables Suppose $X,Y$ and $Z$ are multivariate normal with means and full covariance matrix. The conditional expectation $E(X | Y)$ is well know. What is the conditional expectation of $E(X | Y,Z)$ if $Y$ and $Z$ (and $X$) are correlated? Standard textbooks only seem to cover the case when $Y$ and $Z$ are uncorrelated. Let $x_0 \in \mathbb{R}$ and $f,g: \mathbb{R} \to \mathbb{R}$  such that $f$ is discontinuous at $x_0$ but $g$ is continuous at $x_0$, then $f+g$ at $x_0$ is...   My approach: After some graphical attempts to construct such a pathological case as given above I claim that the described scenario isn't possible. That is $$f \text{ disc. at } x_0 \text{ and } g \text{ cont. at } x_0 \implies f+g \text{ disc. at } x_0 $$  Proof: I was trying to come up with a contradiction, because if they happen to work out I find these kind of proofs to be most satisfying.   Assume $f+g$ is continuous at $x_0$ that is $$\forall \epsilon &gt; 0 ,\exists \delta_1 &gt; 0 : \forall x \in \mathbb{R}, |x-x_0| &lt; \delta_1 \implies |f(x)+g(x)-f(x_0)-g(x_0)| &lt; \epsilon  $$  Since this statement must be true for all $\epsilon &gt; 0$ I could choose $\epsilon:=1$. Next I know that also $g$ is continuous at said point $x_0$, thus  $$\forall \epsilon &gt; 0, \exists \delta_2 &gt; 0 : \forall x \in \mathbb{R}, |x-x_0| &lt; \delta_2 \implies |g(x)-g(x_0)| &lt; \epsilon $$  and I have that $f$ is NOT continuous at $x_0$ therefore: $$\exists \epsilon^* &gt; 0, \forall \delta&gt;0: \exists x \in  \mathbb{R}, |x-x_0| &lt; \delta \wedge |f(x)-f(x_0)| \geq \epsilon $$  My problem is to bring all these three statements nicely together. Mainly I get confused by the quantors. In order to match all three statements I assume I have to choose $\epsilon &gt; 0$ such that the last statement is met, so say $\epsilon:= \epsilon^*&gt;0$, so statement 1 and 2 are still true for said $\epsilon$  I also need to choose $\delta$. Lets say $\delta = \min{(\delta_1,\delta_2)}$ now I should be able to work with all three statements at the same time right? But then I stumble with my argumentation.  Let $|x-x_0|&lt; \delta$, then we obtain $$ |f(x)+g(x)-f(x_0)-g(x_0)| \leq |f(x)-f(x_0)| + |g(x)-g(x_0)| &lt; - \epsilon + \epsilon =0 $$ which means that $|f(x)+g(x)-f(x_0)-g(x_0)| &lt;0$ and I hope that this is a contradiction because $|.| \geq 0$. Please comment (or answer) if I am right or absolutely on the wrong path. I'd also appreciate it if you criticize my formulation. Why does $(\frac{p-1}{2}!)^2 = (-1)^{\frac{p+1}{2}}$ mod $p$? Assume $p$ is prime and $p\ge 3$.  Through experimentation, I can see that it's probably true. Using Wilson's theorem and Fermat's little theorem, it's equivalent to saying $2^2 4^2 6^2 \cdots (p-1)^2 = (-1)^{\frac{p+1}{2}}$ mod $p$, but I can't figure out any more than that. How do I remove the limit on PC keyboard button presses? Whenever I play a PC game with the directional keys, I can only press two buttons at a time.  For instance if I am playing a shooter like R-Type, I cannot hold down the fire button while moving diagonally at the same time.  The computer simply ignores the extra button press.  How do I remove this limit so I can shoot while moving diagonally?  This limitation seems to apply for every game.  I am running Windows 7 if it makes any difference.  I noticed the same problem back when I used Windows XP. Quick easy way to migrate SQLite3 to MySQL? Anyone know a quick easy way to migrate a SQLite3 database to MySQL? Export each image from a collection in Google Earth Engine Prove that any complex matrix can be expressed in term of Hermitian and anti-Hermitian matrices How can we prove that any complex matrix can be expressed in term of hermitian and anti-hermitian matrices of the following form $A = H_1 + iH_2$ Where, $H_1$ is hermitian and $H_2$ is an anti-hermitian matrix The  prohibited the development or use of cloaking technology by the Federation. This treaty was a peace treaty and use of cloaking technology in one's own space couldn't disturb peace. Plus, the Romulans already had cloaking technology, so banning it was unfair for the Federation. So, why was this ban introduced?  Another thing: There were many things to ban, but why cloaking technology? Smooth structure of embedded submanifolds Here is a rather long quotation from "Introduction to smooth manifolds" by J. Lee.     Proposition 5.2 (Images of Embeddings as Submanifolds). Suppose $M$ is a   smooth manifold with or without boundary, $N$ is a smooth manifold, and   $F: N \to M$ is a smooth embedding. Let $S = F(N)$. With the subspace   topology, $S$ is a topological manifold, and it has a unique smooth   structure making it into an embedded submanifold of $M$ with the   property that $F$ is a diffeomorphism onto its image.      Proof. If we give $S$ the subspace topology that it inherits from $M$,   then the assumption that $F$ is an embedding means that $F$ can be   considered as a homeomorphism from $N$ onto $S$, and thus $S$ is a   topological manifold. We give S a smooth structure by taking the   smooth charts to be those of the form $(F(U), \phi \circ F^{-1})$, where $(U, \phi)$   is any smooth chart for $N$; smooth compatibility of these charts   follows immediately from the smooth compatibility of the   corresponding charts for $N$. With this smooth structure on $S$, the map   $F$ is a diffeomorphism onto its image (essentially by definition), and   this is obviously the only smooth structure with this property. ...   My question is about the bold sentence. He says that it is obvious, but it is not obvious to me. Why is the constructed smooth structure the only smooth structure that makes $F$ a diffeomorphism between $N$ and $S$? What does character set and collation mean exactly? I can read the MySQL documentation and it's pretty clear. But, how does one decide which character set to use? On what data does collation have an effect?  I'm asking for an explanation of the two and how to choose them. I have a product key for windows 8.1 (Single language edition or not that i can't remember). I have currently windows 10 pro installed.  I am planning to install windows 10 Home so i activate with windows 8.1 key.  So my question is will i be able to activate it if the Product Key is Windows 8.1 Single Language and i install Windows 10 Home(Multiple language edition) or vice versa. Travel to Romania with a residence permit of Germany I am a student in Germany and i have a residence permit here for 2 years, which is also a Schengen visa, I suppose. Do I need a separate visa if i wish  to travel to Romania? Ok, so I have made a .tmx file for my first level, but I am unsure how I would load it into my game. Currently I am iterating through an internal array to set the blocks, but I need to know how to load the .tmx file into the code.  Here is my World.java:  import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import javax.imageio.ImageIO; import java.io.*;  class World {     Image ground;     Block[] blocks = new Block[46];     int map[][] = {             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},             {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},         };     World() {         int enc = -1;         for (int i = 0; i &lt; map.length; i++) {             for (int j = 0; j &lt; map[i].length; j++) {                 if (map[i][j] == 1) {                     enc++;                     blocks[enc] = new Block(j * 32, i * 32, 32, 32, 1);                 } else if (map[i][j] == 2) {                     enc++;                     blocks[enc] = new Block(j * 32, i * 32, 32, 32, 2);                 }             }         }     } }