I have this code &lt;?php $query1 = &quot;SELECT users.id, testtable_result.id as result_id, testtable_result.user_id, testtable_result.cad_id, testtable_result.medication, testtable_result.color, testtable_category.category_id, testtable_category.name FROM users INNER JOIN testtable_result ON testtable_result.user_id=users.id INNER JOIN testtable_category ON testtable_result.cad_id=testtable_category.category_id WHERE users.id = '{$userID}' AND color LIKE '%blue%';&quot;; $result1 = query($query1); confirm($result1); if (row_count($result1) &gt; 0) : while($row1 = fetch_Array($result1)) {   $medication = $row1['medication'];   $data[] = $row1; } foreach ($data as $value) { $categoryname = $value['name']; $medication = $value['medication']; $arrmaincatname = explode('(', rtrim($categoryname, ')')); if($categoryname == &quot;Saba&quot;){ $datacat = $arrmaincatname[0]; $medicacat = $medication; ?&gt; In &lt;?php echo $datacat; ?&gt; category -- [&lt;?php echo $medicacat ?&gt;] &lt;?php }} ?&gt;  it shows result like this In Saba category -- [ProAir RespiClick®] In Saba category -- [Proventil® HFA] I want to remove all the duplicate results and want to show it like this. In Saba category -- [ProAir RespiClick®, Proventil® HFA]
Using MySQL, I can do something like:  SELECT hobbies FROM peoples_hobbies WHERE person_id = 5;   My Output:  shopping fishing coding   but instead I just want 1 row, 1 col:  Expected Output:  shopping, fishing, coding   The reason is that I'm selecting multiple values from multiple tables, and after all the joins I've got a lot more rows than I'd like.  I've looked for a function on  and it doesn't look like the CONCAT or CONCAT_WS functions accept result sets.  So does anyone here know how to do this?
This is from Fraleigh's First Course in Abstract Algebra (page 82, Theorem 8.16) and I keep having hard time understanding its proof. I understand only until they mention the map $\lambda_x (g) = xg$. Can someone explain this proof step by step? Thank you so much! Here is the proof:  Let $G$ be a group. We show that $G$ is isomorphic to a subgroup of $S_G$. Define a one-to-one function $\phi: G \to S_G$ such that $\phi(xy)=\phi(x) \phi(y)$ for all $x,y \in G$. For $x \in G$, let $\lambda_x: G \to G$ be defined by $\lambda_x (g) = xg$ for all $g \in G$. The equation $\lambda_x (x^{-1} c) = x(x^{-1} c) = c$ for all $c \in G$ shows that $\lambda_x$ maps $G$ onto $G$. If $\lambda_x (a) = \lambda_x (b)$, then $xa=xb$ so $a=b$ by cancellation. Thus $\lambda_x$ is also one to one, and is a permutation of $G$. We now define $\phi: G \to S_G$ by defining $\phi(x) = \lambda_x$ for all $x \in G$. To show that $\phi$ is one to one, suppose that $\phi(x) = \phi(y)$. Then $\lambda_x = \lambda_y$ as functions mapping $G$ into $G$. In particular $\lambda_x (e) = \lambda_y (e)$, so $xe=ye$ and $x=y$. Thus $\phi$ is one to one. It only remains to show that $\phi(xy) = \phi(x) \phi(y)$, that is, that $\phi_{xy} = \lambda_x \lambda_y$. Now for any $g \in G$, we have $\lambda_{xy} (g) = (xy)g$. Permutation multiplication is function composition, so $(\lambda_x \lambda_y)(g) = \lambda_x (\lambda_y (g)) = \lambda_x (yg) = x(yg)$. Thus by associativity, $\lambda_{xy} = \lambda_x \lambda_y$. What is wrong with this chi-squared calculation? I am calculating chi-squared in R and manually, and getting two different answers. I believe that R is correct, but I am not 100% sure.  Can someone please help me understand why?  In R:  test           &lt;- matrix(c(4203, 4218, 786, 771), ncol=2) dimnames(test) &lt;- list(group = c("control","exp"), click = c("n","y")) print(test) print(Xsq      &lt;- chisq.test(test, correct=F))    This gives me $\chi^2 = 0.1712$.  If I do this by hand, however, I get $0.339$.  Here is my calculation: \begin{align} \frac{(E1 - O1)^2}{E1}     &amp;+ \frac{(E2 - O2)^2}{E2}    &amp;  \\ \frac{(4203-4218)^2}{4203} &amp;+ \frac{(771 - 786)^2}{786} &amp;= .3398 \end{align} Every finite set contains its supremum: proof improvement. Every finite subset of $\mathbb R$ contains its supremum (and its infimum)   Proof Let $A=\{a_1,...,a_n\}$ be a finite subset of $\mathbb{R}$. Since it is non-empty and it is bounded ($\max A$ is an upper bound), it has supremum, that is $\exists \sup A$ and by definition $\forall a \in A \;\, a \leq \sup A$. Let's suppose that $\sup A  \not\in A$ then, since $\max A \in A$ we have that $\max A &lt; \sup A$. But considering that $\mathbb Q$ is dense in $\mathbb R$ we can conclude that $\exists r \in \mathbb Q$ s.t. $\max A &lt; r &lt; \sup A$, but this is absurd since $r$ is an upper bound of $A$ and it is lower than the supremum. Necessarily, $\sup A\in A$.  Is there anything wrong? Is there any way to prove this without using density of $\mathbb Q$ or another property? Thanks in advance. How can I explain why DRM cannot work? I am looking for the shortest comprehensive way to explain to people that are trying to use DRM as a technology to prevent users from using their data in some fashion deemed undesirable, why their solution cannot work by definition.  Ideally I'd like something that:   Covers why technically it is impossible to have people access local data, but only in such-and-such a way Imparts an understanding of why this is, to avoid follow-on "But what if" rebuttals Is intuitive enough and short enough that even a politician (j/k) could grasp it   When faced with this situation I try to be clear and concise, but I usually end up failing at least on one of these points. I'd really like to have a 'stock' answer that I can use in the future. Removing lines from text file that contain string at beginning and string at end - and keep one It took me a while to word this best.  Problem 1:  Is there a way to find lines in a text file that have the same string at the beginning and the same strings at the end?   Beginning and end strings not necessarily equal to each other.  Text between the two strings is not consistant in number of characters or number of hyphens.  A hyphen is in between notable strings (which I added to my large text file).  For example:  File:    AAAAA-tjhut-ghyut-FILE1.txt   BBB-fhuj-dnbhg-frt76-FILE2.txt   AAAAA-ghtujukr-hgute7gr-xhyutt-FILE1.txt   AAAAA-VGYT-4d7tt-xhyutt-FILE1.txt   CCCC-fjuk-dryy-fhuj-FILE3.txt   Lines to detect:    AAAAA-tjhut-ghyut-FILE1.txt   AAAAA-ghtujukr-hgute7gr-xhyutt-FILE1.txt   AAAAA-VGYT-4d7tt-xhyutt-FILE1.txt   Problem 2:  Is there a way to remove all but one of the lines containing the duplicate strings at the beginning and end from above?  Before:    AAAAA-tjhut-ghyut-FILE1.txt   AAAAA-ghtujukr-hgute7gr-xhyutt-FILE1.txt   AAAAA-VGYT-4d7tt-xhyutt-FILE1.txt   After:    AAAAA-tjhut-ghyut-FILE1.txt   Big thanks for any advice.  Note: I think using the occurances of the first hyphen and last hyphen can be used to locate the duplicate strings. Why do we say "Eastern Europe" but "East Asia"? Is it true that a language is regular? Is it true that for every regular language $L \subseteq \{0,1\}^*$, language $\big\{ w^{|w|} \big| w \in L \big\}$ is regular? I don't know how to prove that.Could you give me a hint? Thank you Merging Raster Datasets of Different Resolutions using ArcGIS Desktop? I am using ArcGIS Desktop.  I have two DEMs in .tif format and I am looking to merge the two. The main problem with merging these are that they are different resolutions (one is 10m and one is ~20m). Also, another problem with merging the two is that they overlap and I am not sure of the most effective way of dealing with that overlap. Obviously I want to keep the values of the better resolution.   So what are the best methods here?   Is there a python script available that works best with merging rasters? I would like to automate this with a script if possible. Which process of resampling is best for DEM data? Bipolar, Cubic... ? What is the best way to merge overlapping DEMs? Human vs. alien to avoid extinction by omnipotent being Details on the Origin of Sting Proof : $2^{n-1}\mid n!$ if and only if $n$ is a power of $2$. I want to prove that:  $2^{n-1}\mid n!$ if and only if $n$ is a power of $2$. How to prove that a simple graph having 11 or more vertices or its complement is not planar? It is an exercise on a book again. If a simple graph $G$ has 11 or more vertices,then either G or its complement  $\overline { G } $ is not planar.  How to begin with this? Induction?  Thanks for your help! According to , if there is a potential difference, $V$, across a resistor then there is a current, $I$, flowing through it.   Since we assume that points along the connecting wire are at the same potential, how can current, $I$ flow between points at the same potential, $V$? Isometry from Manhattan plane to Euclidean plane? Does there exist an isometry from a Manhattan plane $A$ to a Euclidean plane $B$? I.e. a function $\varphi:A \to B$ that suffices $\|\varphi(a)\|_B = \|a\|_A$ for all $a \in A$, where  $\| \cdot \|_A$ is the Manhattan norm and $\| \cdot \|_B$ the Euclidean norm. iOS 7 Locked Bug via Ubuntu 13.10 I wanted to bring up an issue with the latest Ubuntu release that I hope can be solved. Although I will agree with the community that iOS 7 is not the most open platform release, it still is my desire to be able to grab Photos, Music, and Files off my Phone similar to what I would do to any other device.  Every time I connect my device to Ubuntu, I receive the following notification:  The device "Justin's iPhone" is locked. Enter the passcode on the device and click "Try again".   On my iPhone, I select the following   Unfortunately, this is where problems start to arise. It appears that Ubuntu either does not recognize the permissions from my iPhone or the iPhone is not allowing itself to truly be unlocked. As we can see the permissions are   Browsing askubuntu, I encountered the following   After running the code, I receive the following error:  justin@justin-CT15:~$ idevicepair unpair &amp;&amp; idevicepair pairERROR: Device d1fea2c56e51199f901eb34020a1581ea31a2a50 is not paired with this host   If I call the command again, i receive another error:  justin@justin-CT15:~$ idevicepair pair ERROR: Could not pair with the device because a passcode is set. Please enter the passcode on the device and retry.   Ultimately, I am stuck to experiment with solutions that end up not working. I am troubled by the lack of information and support for the iOS 7 platform on Ubuntu's latest release. If anyone has a workable solution or experiment for a workaround, I am happy to try  Thanks for reading and have a wonderful day! Say we have two integers $n$ and $k$, such that $0 &lt; k &lt; n$ and $gcd(n, k) = 1$.  Why is it that if we take every integer $x\in\{0,\dots, n-1\}$ and compute $k\cdot x \ (mod \ n)$, we get as remainders all numbers from $0$ to $n-1$, with no repeats?  In other words, why is $\ f:\{0,\dots,n-1\}\rightarrow\{0,\dots,n-1\}$, $\ f(x)=k\cdot x\ (mod\ n)$ a bijection for $k,n\in\mathbb{N},\ gcd(k,n)=1$? Opening a file with std::string Understanding of the theorem that all norms are equivalent in finite dimensional vector spaces The following is a well-known result in functional analysis:     If the vector space $X$ is finite dimensional, all norms are equivalent.     Here is the standard proof in one textbook. First, pick a norm for $X$, say  $$\|x\|_1=\sum_{i=1}^n|\alpha_i|$$ where $x=\sum_{i=1}^n\alpha_ix_i$, and $(x_i)_{i=1}^n$ is a basis for $X$. Then show that every norm for $X$ is equivalent to $\|\cdot\|_1$, i.e.,  $$c\|x\|\leq\|x\|_1\leq C\|x\|.$$ For the first inequality, one can easily get $c$ by triangle inequality for the norm. For the second inequality, instead of constructing $C$, the  is applied to construct a contradiction.   The strategies for proving these two inequalities are so different. Here is my question,      Can one prove this theorem without Bolzano-Weierstrass theorem?   UPDATE:     Is the converse of the theorem true? In other words, if all norms for a vector space $X$ are equivalent, then can one conclude that $X$ is of finite dimension? When does an expired domain become available for others to register? Proof of inequality $2(\sqrt{n+1}-\sqrt{n}) < \frac{1}{\sqrt{n}} < 2(\sqrt{n} - \sqrt{n-1})$ using induction Prove that $2(\sqrt{n+1}-\sqrt{n}) &lt; \frac{1}{\sqrt{n}} &lt; 2(\sqrt{n} - \sqrt{n-1})$ if $n \ge 1$ using induction.  Can someone help me with this problem please. Base case is easily shown, and for the inductive step I know I have to use the inequality for $n\gt1$ to show that it is true for $n+1$, but I am not quite sure how to.   Thanks.