I've the following array with multiple repetitions and I want to remove them mantaining the order.  v = ['maier', 'tapa pure', 'embega', 'maier', 'tapa pure', 'embega', 'maier', 'tapa pure', 'embega', 'maier', 'tapa pure', 'embega', 'maier', 'tapa pure', 'embega', 'maier', 'tapa pure', 'embega', 'maier', 'tapa pure', 'embega', 'maier', 'tapa pure', 'embega']   I use list(set(v)) and I get the following output: ['embega', 'maier', 'tapa pure']  What I want to have is to remove the repetition, but maintain the original order: ['maier', 'tapa pure', 'embega']  I cant use v[:3] because the repetitions length is variable.  How can I do it?  Thanks in advance.
Is there a built-in that removes duplicates from list in Python, whilst preserving order? I know that I can use a set to remove duplicates, but that destroys the original order. I also know that I can roll my own like this:  def uniq(input):   output = []   for x in input:     if x not in output:       output.append(x)   return output   (Thanks to  for that .)  But I'd like to avail myself of a built-in or a more Pythonic idiom if possible.  Related question:
Double booked - User bookmarking question recorded twice How can I make a peer-to-peer multiplayer game? How can I make a p2p multiplayer game? I would like to have a server-less multiplayer game. But then, how all the clients know each other?  Why the p2p-protocol is so famous in file transfer but not in multiplayer games? I am trying to print a simple value for $AR1_p1 but the variable $i is not evaluating. for i in 1 2 3 4 do     AR1_p1=22     AR1_p2=23     AR1_p3=24     AR1_p3=25     echo $AR1_p$i done   It's like concatenating dynamically. Any suggestions on how to fix this?. What is a word/phrase for using a term for a popular special case instead of a generic term? What are some alternatives to "hover" on touch-based devices? Came up recently in a 37signals podcast:    The straightforward, "brute-force" solution is to just use the first touch on a UI object as the hover.    It works. But are there other, more elegant solutions? For instance, could the hardware ever be made to support actual finger hovering? How do I make a bootable USB from Windows? Who knows about the summation of this series: $$\sum\limits_{i=1}^{n}i^m $$  where $m$ is constant and $m\in \mathbb{N}$?  thanks I read this story a long time ago and cannot remember either the title or the author. It was written in the 60s or 70s. The setting is sometime in the 21 century.  Here is a summary of the plot.  One of the great classical composers (maybe it was Schubert, I'm not sure) is revived with some future technology. All the guys in the lab are very happy about it, the world cheers the achievement. The composer is also quite excited to be alive. Naturally, he is asked to perform a concert. He asks for ink and music paper. Nobody knows what that is: in those days everybody writes music directly in "frequency spectrum" and similar stuff.  The composer, excited to create music again, tries to come up with something but he doesn't like anything he writes. The music is well written, but lacks something essential, it doesn't sound like his real music. Finally, the composer realizes that the lab guys recreated his mind from reviews by music critics, and his music just sounds like that. He performs the concert. The audience enjoys it, applauds and bravos. Not only to composer, but also to the lab guys.   At the end, if I remember it right, the composer gloats over the  primitive taste of the audience. The audience who writes music in frequency spectrum and applauds to lab guys at the music concert did not see the failure in the concert and ate it as it is.  Does someone recognize the story?  PS all the recent talk of advent of AI machines with Machine Learning algorithms reminded me of this story. Understanding p-value I know that there are lots of materials explaining p-value. However the concept is not easy to grasp firmly without further clarification.  Here is the definition of p-value from Wikipedia:     The p-value is the probability of obtaining a test statistic at least   as extreme as the one that was actually observed, assuming that the   null hypothesis is true. ()   My first question pertains to the expression "at least as extreme as the one that was actually observed." My understanding of the logic underlying the use of p-value is the following: If the p-value is small, it's unlikely that the observation occurred assuming the null hypothesis and we may need an alternative hypothesis to explain the observation. If the p-value is not so small, it is likely that the observation occurred only assuming the null hypothesis and the alternative hypothesis is not necessary to explain the observation. So if someone wants to insist on a hypothesis he/she has to show that the p-value of the null hypothesis is very small. With this view in mind, my understanding of the ambiguous expression is that p-value is $\min[P(X&lt;x),P(x&lt;X)]$, if the PDF of the statistic is unimodal, where $X$ is the test statistic and $x$ is its value obtained from the observation. Is this right? If it is right, is it still applicable to use the bimodal PDF of the statistic? If two peaks of the PDF are separated well and the observed value is somewhere in the low probability density region between the two peaks, which interval does the p-value give the probability of?  The second question is about another definition of p-value from Wolfram MathWorld:     The probability that a variate would assume a value greater than or   equal to the observed value strictly by chance.   ()   I understood that the phrase "strictly by chance" should be interpreted as "assuming a null hypothesis". Is that right?  The third question regards the use of "null hypothesis". Let's assume that someone wants to insist that a coin is fair. He expresses the hypothesis as that relative frequency of heads is 0.5. Then the null hypothesis is "relative frequency of heads is not 0.5." In this case, whereas calculating the p-value of the null hypothesis is difficult, the calculation is easy for the alternative hypothesis. Of course the problem can be resolved by interchanging the role of the two hypotheses. My question is that rejection or acceptance based directly on the p-value of the original alternative hypothesis (without introducing the null hypothesis) is whether it is OK or not. If it is not OK, what is usual workaround for such difficulties when calculating the p-value of a null hypothesis?     I posted a new  that is more clarified based on the discussion in this thread. How to select more layers with GIMP? In Adobe Photoshop I am able to select multiple layers at once with Shift+Click.  How can I do that in GIMP? Why does lightning emit light? What exactly is causing the electric discharge coming from the clouds to emit light while traveling through the air. I've read and thought about it a little but with my current knowledge I cant really figure what is happening at a subatomic level. In other words, what causes the emission of photons during lightning. What I want to know is, is there some sort of collisions taking place that produces the photons we see, or is it some other interaction that is causing it?. I don't know too much about particle physics, I've only read a couple of pages in the Introduction to Elementary Particles by Griffihts. So if you could keep the answer simple then that would be great. How to subtract a day from a date? I have a Python  object. What is the best way to subtract one day? Automatically adding user and password to openvpn script I have a working script, which allows me to do a vpn connection. It looks like this:  openvpn --config VPNBook.com-OpenVPN-Euro1/vpnbook-euro1-tcp443.ovpn   All is good, but I have to input the publicly available vpn and password every time I run this script. (Don't worry, I'm not going to do banking or anything serious over a free VPN, this is more for learning).  This is the username and the password available publicly on their website:  Username: vpnbook  Password: he2qv5h   After firing up, the script prompts me for username and password which now I need to copy and paste.   Tue Aug 15 11:54:51 2017 library versions: OpenSSL 1.0.2l  25 May 2017, LZO 2.08 Enter Auth Username: vpnbook Enter Auth Password:    Is there a way of doing it so the script inputs the values on its own?  I tried echoing it, but it isn't that easy.  Or do I have to edit the command itself, somewhere in the files? If yes, can someone point me in the right direction for doing it? Essentially, all is in the title: Is it possible to compute the integral $$\int_1^{+ \infty} \frac{dx}{x^2(1+e^x)} \hspace{1cm} ?$$  I suspected some relation with a , but I was not able to find something explicit. Is there a way to show that $\sqrt{p_{n}} < n$? Is there a way to show that $\sqrt{p_{n}} &lt; n$?  In , I show that $f_{2}(x)=\frac{x}{ln(x)} - \sqrt{x}$ is ascending, for $\forall x\geq e^{2}$. As a result, $\forall n \geq 3$ $$\frac{p_{n}}{ln(p_{n})} - \sqrt{p_{n}}\leq \frac{p_{n+1}}{ln(p_{n+1})} - \sqrt{p_{n+1}}$$ Also (and as a result), $\forall n \geq 3$ $$ \frac{p_{n}}{ln(p_{n})} - \sqrt{p_{n}} &gt; 0$$ Or $$ \frac{\pi (p_{n})}{p_{n}/ln(p_{n})} &lt; \frac{\pi (p_{n})}{\sqrt{p_{n}}}$$  According to  $$\displaystyle\smash{\lim_{n \to \infty }}\frac{\pi (p_{n})}{p_{n}/ln(p_{n})}=1$$ Or, $\forall \varepsilon &gt;0$, $\exists N(\varepsilon )$: $\forall n&gt;N(\varepsilon )$ $$1- \varepsilon &lt; \frac{\pi (p_{n})}{p_{n}/ln(p_{n})} &lt; 1+ \varepsilon$$ Or $$1- \varepsilon &lt; \frac{\pi (p_{n})}{p_{n}/ln(p_{n})} &lt; \frac{\pi (p_{n})}{\sqrt{p_{n}}}$$ As a result $\forall \varepsilon &gt;0$, $\exists N(\varepsilon )$: $\forall n&gt;N(\varepsilon )$ $$(1 - \varepsilon ) \cdot  \sqrt{p_{n}} &lt; \pi (p_{n}) = n$$  But this is not enough.  Interestingly,  is true iff function $f_{4}(x)=\pi (x) - \sqrt{x}$ is strictly ascending ($x &lt; y \Rightarrow f(x) &lt; f(y)$) for prime arguments.  If $f_{4}(p_{n}) &lt; f_{4}(p_{n+1})$ then $$\pi (p_{n}) - \sqrt{p_{n}} &lt; \pi (p_{n+1}) - \sqrt{p_{n+1}}$$ Or $$\sqrt{p_{n+1}} - \sqrt{p_{n}} &lt; \pi (p_{n+1}) - \pi (p_{n}) =1$$  And vice-versa, if $$\sqrt{p_{n+1}} - \sqrt{p_{n}} &lt; 1$$ Then $$-\sqrt{p_{n}} &lt; -\sqrt{p_{n+1}} + 1$$ Or $$\pi (p_{n})-\sqrt{p_{n}} &lt; \pi (p_{n}) + 1 -\sqrt{p_{n+1}} = \pi (p_{n+1}) -\sqrt{p_{n+1}}$$  So, if Andrica's conjecture is true then $\forall n \geq 3$ $$\pi (p_{n})-\sqrt{p_{n}} &gt; 0$$ Or $$\sqrt{p_{n}} &lt; \pi (p_{n})= n$$ bibtex and genitive / possessive 's: the proper way to obtain "Kuran's (1989) model" Is there an automatic way to attach a genitive apostrophe or " ' s " to an author's name?  Currently I use:  \citeauthor{kuran1989}'s \citeyear{kuran1989}   But since this comes up regularily I'd like to know whether there's a general solution. I was really happy when I heard that HoTD would be continued. And even happier when the first new chapter actually came. but now after several months of waiting there still has been no other chapter. So my question is, has HoTD gone on hiatus again ? Why do I get "unresolved external symbol" errors when using templates? When I write C++ code for a class using templates and split the code between a source (CPP) file and a header (H) file, I get a whole lot of "unresolved external symbol" errors when it comes to linking the final executible, despite the object file being correctly built and included in the linking.  What's happening here, and how can I fix it? While studying the problem of determining the orbit of a binary star system, my astronomy notes say: "the projection of an ellipse onto a plane is still an ellipse (except the special case in which it's a segment)". How could I prove this?  EDIT: As suggested i'm adding what I know about ellipses. I know the basics of ellipses in the plane, the equation of an ellipse in a plane in cartesia coordinates, the equation of an ellipse in polar coordinates, the fact that ellipses can be obtained by the intersection of planes with a cone. In my geometry course we defined ellipses as the the points of the plane such that the ratio between the distance from a point and a line is constant and less than 1. I also know that the sum of the distances of the points of the ellipse from the foci is constant. I have two internet connection from two different ISP. ADSL on eth0 and 4G on wlan0. Is there any way that if one ISP fails, the other take over automatically without a physical router and by Host OS (Ubuntu 18.04)?