To be specific, I have an event table that logs when a user joins or leaves a team.  It looks something like the following:  ------------------------------------- | user | event  | team | timestamp | ------------------------------------- | A    | joined | 1    | 2016-1-1  | | B    | joined | 1    | 2016-1-1  | | C    | left   | 1    | 2016-1-1  | | C    | joined | 2    | 2016-1-1  | | A    | left   | 1    | 2016-1-2  | | A    | joined | 2    | 2016-1-2  | | B    | left   | 1    | 2016-1-3  | | A    | left   | 2    | 2016-1-3  | -------------------------------------   I need to restructure this in a view to look something like the following  -------------------------------------- | user | team | joined    | left     | -------------------------------------- | A    | 1    | 2016-1-1  | 2016-1-2 | | A    | 2    | 2016-1-2  | 2016-1-3 | | B    | 1    | 2016-1-1  | 2016-1-3 | | C    | 1    | null      | 2016-1-1 | | C    | 2    | 2016-1-1  | null     | --------------------------------------   How can I achieve this?  For more detail, I'm attempting to do this in Amazon Redshift (PostgreSQL)
To be specific, I have an event table that logs when a user joins or leaves a team.  It looks something like the following:  ------------------------------------- | user | event  | team | timestamp | ------------------------------------- | A    | joined | 1    | 2016-1-1  | | B    | joined | 1    | 2016-1-1  | | C    | left   | 1    | 2016-1-1  | | C    | joined | 2    | 2016-1-1  | | A    | left   | 1    | 2016-1-2  | | A    | joined | 2    | 2016-1-2  | | B    | left   | 1    | 2016-1-3  | | A    | left   | 2    | 2016-1-3  | -------------------------------------   I need to restructure this in a view to look something like the following  -------------------------------------- | user | team | joined    | left     | -------------------------------------- | A    | 1    | 2016-1-1  | 2016-1-2 | | A    | 2    | 2016-1-2  | 2016-1-3 | | B    | 1    | 2016-1-1  | 2016-1-3 | | C    | 1    | null      | 2016-1-1 | | C    | 2    | 2016-1-1  | null     | --------------------------------------   How can I achieve this?  For more detail, I'm attempting to do this in Amazon Redshift (PostgreSQL)
Does the plastic cap on a Presta valve serve any purpose once fitted to a rim? I can see the use of the valve cap on a Presta valve when the tube is still packaged (it obviously stops the valve puncturing the tube), but does it do anything except look pretty (or not) once you've fitted the tube to a rim?  I've kept them on out of habit, because I've had problems with sticking Schrader valves in the past when I've lost the caps and dirt/grime has got in there - but the design of Presta valves suggests to me that they wouldn't suffer this fate.  Given that I really need to , is replacing this cap something I can leave out of my daily chores? How do I re-position the displayed image on my laptop? I want to re-position the display on my ASUS K53SM laptop's screen because I somehow managed to damage some portion of it (and I don't want to spend on this laptop for the time being).  Please refer the following image:    I changed the resolution from 1366x768 to 1280*768 to avoid the bad portion of the screen, but the screen is now centered and the right portion of my screen is now rendered useless.  What I want to do is, set a custom resolution of my laptop and re-position it in a way that is utilizes all the working area of my screen.  How do I re-position the displayed image on my laptop? Will taking a gap year after my Master's degree improve or degrade my potential of doing a PhD? What can a wizard take instead of a familiar at 1st level? The familiar is brilliant feature for a wizard, but not for a prestige multiclassing one. Such a wizard stops upgrading his familiar once getting off the main road. So if he still wants to utilize his familiar, he should take the obtain familiar feat, but this would made the basic familiar feature redundant.  So what options can a wizard take instead of gaining a familiar at 1st level? Help needed in understanding proof: Every odd prime $p$ has exactly $(p-1)/2$ quadratic residues and $(p-1)/2$ quadratic nonresidues. Help needed in understanding proof: Every odd prime $p$ has exactly $(p-1)/2$ quadratic residues and $(p-1)/2$ quadratic nonresidues.   We assume there exist $k$ incongruent quadratic residues and each yield two solutions of the equation $x^2 \equiv a (\mod p)$. Also each of these solutions are incongruent, right ? So we have $2k$ solutions to quadratic congruences.  Then there are $p-1$ squares of the least residues, $1$ through $p-1$. But these need not be incongruent (consider $p = 7$ and $1^2, 6^2$). Then $2k = p-1$, why ?  Could someone explain to me in details what the reasoning is ? Eigenvectors of real symmetric matrices are orthogonal Can someone point me to a paper, or show here, why symmetric matrices have orthogonal eigenvectors? In particular, I'd like to see proof that for a symmetric matrix $A$ there exists decomposition $A = Q\Lambda Q^{-1} = Q\Lambda Q^{T}$ where $\Lambda$ is diagonal. How to give a medicine with really bad taste My 4 year old daughter recently have scarlet fever. It seems antibiotics are non-negociable for it, and since she has great chance of being allergic to Penicillin, there is only one antibiotic she can get. It is not the first time we have to give it to her, and probably not the last time.  Apparently, that medicine tastes really REALLY bad. She cries a lot, panics every time we say it's time for this medicine, and vomit it most of the time, resulting in even more medicine being force into her mouth.  It is only this medicine that causes problem. She does not tantrum for other medicine, and most of them, she can take the dose we give her all by herself.  We tried reassuring her, explaining why it is mandatory to get it, explaining it will make the scarlet fever go away. We tried mixing it into other food (which seems clearly worse, taste-wise). We tried asking her to take her herself. It seems we tried everything, and the only thing that achieve it for the moment is actually forcing it into her.  We really do not want to force her in any way. Her mother cried yesterday because we had to force her, and we need to do it twice a day. It is very exhausting, and we would welcome any input or new ideas on how to give her this really bad tasting medicine to her.  EDIT : For clarification, it is a liquid medicine that is administrated with a syringe. It seems there are no alternative, although we will check with the doctor again (particularly if pills are available) Why does $\sum_{k=1}^{\infty}\frac{{\sin(k)}}{k}={\frac{\pi-1}{2}}$? Inspired by  (and far more straightforward, I am guessing), Mathematica tells us that $$\sum_{k=1}^{\infty}\dfrac{{\sin(k)}}{k}$$ converges to $\dfrac{\pi-1}{2}$.   Presumably, this can be derived from the similarity of the Leibniz expansion of $\pi$ $$4\sum_{k=1}^{\infty}\dfrac{(-1)^{k+1}}{2k-1}$$to the expansion of $\sin(x)$ as $$\sum_{k=0}^{\infty}\dfrac{(-1)^k}{(2k+1)!}x^{2k+1},$$ but I can't see how...  Could someone please explain how $\dfrac{\pi-1}{2}$ is arrived at? I have up until Cov(X+Y,X-Y) = E[((X-E(X))+(Y-E(Y)))((X-E(X))-(Y+E(Y)))] and now I am stuck and do not know how this turns into Var(X)-Var(Y) Evaluate   $$\lim_{n\rightarrow \infty}\frac{1}{2n}\cdot \ln \binom{2n}{n}.$$   $\underline{\bf{My\;\;Try}}::$ Let $\displaystyle y = \lim_{n\rightarrow \infty}\frac{1}{2n}\cdot \ln \binom{2n}{n} = \lim_{n\rightarrow \infty}\frac{1}{2n}\cdot \ln \left(\frac{(n+1)\cdot (n+2)\cdot (n+3)\cdots (n+n)}{(1)\cdot (2)\cdot (3)\cdots (n)}\right)$  $\displaystyle y = \lim_{n\rightarrow \infty}\frac{1}{2n}\cdot \left\{\ln \left(\frac{n+1}{1}\right)+\ln \left(\frac{n+2}{2}\right)+\ln \left(\frac{n+3}{3}\right)+\cdots+\ln \left(\frac{n+n}{n}\right)\right\}$  $\displaystyle y = \lim_{n\rightarrow \infty}\frac{1}{2n}\cdot \sum_{r=1}^{n}\ln \left(\frac{n+r}{r}\right) = \lim_{n\rightarrow \infty}\frac{1}{2n}\cdot \sum_{r=1}^{n}\ln \left(\frac{1+\frac{r}{n}}{\frac{r}{n}}\right)$  Now Using Reinman Sum  $\displaystyle y = \frac{1}{2}\int_{0}^{1}\ln \left(\frac{x+1}{x}\right)dx = \frac{1}{2}\int_{0}^{1}\ln (x+1)dx-\frac{1}{2}\int_{0}^{1}\ln (x)dx =  \ln (2)$  My Question is , Is there is any method other then that like Striling Approximation OR Stolz–Cesàro theorem OR Ratio Test  If yes then please explain here  Thanks I just want to write a script which changes my directory.  I put the below commands in the file /home/alex/pathABC  #!/bin/sh cd /home/alex/Documents/A/B/C echo HelloWorld   I did   chmod +x pathABC   In the Terminal, while in /home/alex, I ran ./pathABC, but the output is just HelloWorld and the current directory is not changed.  So what is wrong? How to bake to vertex colors in blender cycles? What's the opposite word for "sin"? I would like to know if there is an opposite word for sin in English.  I mean, how could I say the opposite of     I committed a sin   other than using a negation? What is the fallacy that privileges one person over another? I see this a lot, someone in a category of people attempts to shut down anyone with an opinion that is not from the same category. For example, people without children weighing in on parenting; the parent may say something like "well, since you don't have kids and I do, my position is of more validity than yours."  Another example: a drug user (of some kind) telling someone who has never done drugs and does not care to, "until you tried it, you have no right to judge me."  People frequently try to limit the consideration on opinions to those in their same group, while it is perfectly reasonable that the non-drug user, especially if they are a chemist or well read on the subject, may have an equally valid opinion, or even more valid. In fact some might even say that someone NOT in the category has a better chance of being objective and seeing the forest for the trees.  So what is the fallacy of trying to shut down opinions when the source of the opinion is not someone who has personally had the experience under discussion? Generate random numbers uniformly over an entire range I need to generate random numbers within a specified interval, [max;min].  Also, the random numbers should be uniformly distributed over the interval, not located to a particular point.  Currenly I am generating as:  for(int i=0; i&lt;6; i++) {     DWORD random = rand()%(max-min+1) + min; }   From my tests, random numbers are generated around one point only.  Example min = 3604607; max = 7654607;   Random numbers generated:  3631594 3609293 3630000 3628441 3636376 3621404   From answers below: OK, RAND_MAX is 32767. I am on C++ Windows platform. Is there any other method to generate random numbers with a uniform distribution? Checking the maximality of a principal ideal in $R[x]$ Let $R = \mathbb{Z}_{(2)}$ be the localization of $\mathbb{Z}$ at the prime ideal generated by $2$ in $\mathbb{Z}$. Then prove that the ideal generated by $(2x-1)$ is maximal in $R[x]$. I heard myself saying something was "tickety-boo", meaning good, successful, or satisfactory. Does anyone know where this strange-sounding phrase originated? I'm writing a web app using Twitter Bootstrap with PHP on server side. My app makes regular ajax requests via jQuery and i want to disable certain parts of the UI until the server completes processing and hands back the control to Client-Side.  I wonder what would be best practices for the same? Currently my bibliography says "Literatur" (german). But I want something completely different there. How can I achieve that? How to use figure inside a minipage? I'm trying to include an image, and keep it centered, and prevent from wrapping from the next page.  The following code works for that:  \begin{minipage}{\textwidth}     \begin{center}         Caption for image          \includegraphics[scale=0.5]{myimage.png}      \end{center} \end{minipage}   I'd like this image to be in a figure, with a caption.  The following doesn't compile:  \begin{minipage}{\textwidth}     \begin{figure}         \includegraphics[scale=0.5]{myimage.png}         \caption{Caption for image}         \label{fig:sample_figure}     \end{figure} \end{minipage}   I get the errors:  ! LaTeX Error: Not in outer par mode. ! Undefined control sequence.   How can I fix this?