Import JSON data into Python
Reading JSON from a file?
I have a Unicode string in Python, and I would like to remove all the accents (diacritics). I found on the web an elegant way to do this (in Java):  convert the Unicode string to its long normalized form (with a separate character for letters and diacritics) remove all the characters whose Unicode type is &quot;diacritic&quot;.  Do I need to install a library such as pyICU or is this possible with just the Python standard library?  And what about python 3? Important note: I would like to avoid code with an explicit mapping from accented characters to their non-accented counterpart. Iteration over std::vector: unsigned vs signed index variable What is the correct way of iterating over a vector in C++?  Consider these two code fragments, this one works fine:  for (unsigned i=0; i &lt; polygon.size(); i++) {     sum += polygon[i]; }   and this one:  for (int i=0; i &lt; polygon.size(); i++) {     sum += polygon[i]; }   which generates warning: comparison between signed and unsigned integer expressions.  I'm new in the world of C++, so the unsigned variable looks a bit frightening to me and I know unsigned variables can be dangerous if not used correctly, so - is this correct? With the announcement of the Ubuntu Phone OS I'd like to know what phone (and tablet) models are supported at this time.  Note from foss &amp; Oli: We are making this the master question for all future "Will this work on &lt;insert random tablet/phone/device here&gt;?!" questions Suppose every subsequence of X converges to 0. Show that lim(X)=0 Question: Suppose that every subsequences of $X = (x_n)$ has a subsequence that converges to $0$. Show that $\lim(X) = 0$   My attempt:   Suppose that $\lim(X) =L \neq 0$  Let $\epsilon &gt; 0$, and let $K(\epsilon)$ be s.t. $n \ge K(\epsilon)$   then $|x_n-L| &lt; \epsilon$  let $n_k \ge k$, and then $k \ge K(\epsilon)$ and $n_k \ge k \ge K(\epsilon)$ s.t. $|x_{n_{k}}-L| &lt; \epsilon$, which is a contradiction. therefore $\lim(x) =0$ How do I forward/NAT all traffic to one interface/IP to a remote IP? I have one "server A" that has multiple IPs attached to it, like so:  eth0:0 1.1.1.1 eth0:1 1.1.1.2 eth0:2 1.1.1.3   I have another "server B" that also has multiple IPs attached to it, like so:  eth0:0 2.2.2.1 eth0:1 2.2.2.2 eth0:2 2.2.2.3   Now, I want to setup iptables on "Server A" to forward/NAT all incomming traffic on "eth0:2" to IP 2.2.2.3 on "Server B".  I have verified that "Server A" is able to "talk" to "Server B" on IP 2.2.2.3. Ping and telnet to open ports works just fine and I have the forward-flag turned on (net.ipv4.ip_forward=1)  I have tried multiple different ways, DNAT, SNAT, MASQUERADE etc, but I cannot get anything to work.  This line works fine if I try to forward traffic between IPs on the SAME server:  iptables -t nat -A PREROUTING -d 1.1.1.3 -j DNAT --to-destination 1.1.1.2   But if I switch out the "1.1.1.2" for "2.2.2.3", it does not work.  I assume that I need a second iptable rule to solve it. I have tried with the following POSTROUTING rules without any luck (not at the same time):  iptables -t nat -A POSTROUTING -d 2.2.2.3 -j MASQUERADE iptables -t nat -A POSTROUTING -d 2.2.2.3 -j SNAT --to 1.1.1.3 iptables -t nat -A POSTROUTING -j MASQUERADE   What am I missing?  EDIT 1:  I finally got it to work by using the following:  net.bridge.bridge-nf-call-iptables=0  iptables -t nat -A PREROUTING -d 1.1.1.3 -j DNAT --to-destination 2.2.2.3 iptables -t nat -A POSTROUTING -d 2.2.2.3 -j SNAT --to 1.1.1.3   However, now another problem appeared. All logs etc on server 2.2.2.3 shows that ALL traffic now comes from 1.1.1.3, like apache logs, mail logs etc. I assume this is the nature of NAT.   However, when I do standard port forwarding on my home-router to my laptop that is running apache, I see the original "requester IP" in the logs. So, how does the router do this? And how can I do the same on my server setup?  Bottom line, I want to forward all traffic from Server A (1.1.1.3) to Server B (2.2.2.3), BUT I also want to be able to see where the traffic came from on Server B (2.2.2.3), i.e the apache logs should show the original IP of the requester.  I assume I should use some other way than NAT to make this happen, and it should be possible, as even my simple home-router is able to do this.  One extra thing, the IPs attached to Server A and Server B is LOCKED to each respective server. Thus, Server A is NOT able to send out traffic FROM IP 2.2.2.3. It is locked by my provider in the router. What is a word for "cannot-be-wrong" attitude? When speaking with someone recently I was continuously taken aback by how he could not concede even the slightest detail in my argument (which was not unreasonable), and it happened another time previously. Both times had to do with me pointing out 'error' in his action.  He very much exhibits that 'I cannot be wrong' attitude.  I first thought to call this arrogance or pride but he is not overbearing like arrogance demands and he does not show excessive self esteem that pride demands.  What is a word that can accurately describe this attitude? Probability of people attending same and different places $5$ tourists plan to attend Octoberfest. Each attends a location at random from the choices: Alpine, Bingeman, Concordia, Kitchener, Queens, Schwaben, Transylvania. Q What is the probability that two attend one location and three attend another same location?  I get that there are $\binom{5}{2}$ possibilities to create 2 groups. There are $\binom{7}{2}$ ways to choose 2 places so shouldn't it be $\frac{\binom{7}{2}\binom{5}{2}}{7^5}$? What happens if my order exceeds the bid or ask sizes? What will happen if my order exceeds the bid or ask size? For example, if the bid or ask is 100 shares, but I want to buy 100,000 shares, is it possible to do so? How to get the pid of the last executed command in shell script? I want to have a shell script like this:  my-app &amp; echo $my-app-pid   But I do not know how the get the pid of the just executed command.  I know I can just use the jobs -p my-app command to grep the pid. But if I want to execute the shell multiple times, this method will not work. Because the jobspec is ambiguous. When is an Integer a Rational Number, and are All Ratios Rational, Even $\frac{\sqrt{7}}{2}$? $$\Bbb{Q} = \left\{\frac ab \mid \text{$a$ and $b$ are integers and $b \ne 0$} \right\}$$ In other words, a rational number is a number that can be written as one integer over another. For an integer, the denominator is $1$ in that case. For example, $5$ can be written as $\dfrac 51$.  Is $5$ a rational number? Or is $\dfrac 51$  a rational number? I'm not able to figure out what the definition is actually saying. What are the numbers that cannot be written as one integer over another?  Irrational numbers are the numbers that cannot be written as one integer over another. Roots of numbers that are not perfect squares are examples of irrational numbers.  However, what is this then: $\dfrac {\sqrt 7} {2}$? How are unbalanced forces even possible, given Newton's 3rd law? I was going through the fundamental theorem in Number Theory where any non zero integer n can be represented as a product of distinct primes. A related problem with this theorem is to prove that for every such number, there exists a prime $p$ such that $p&lt; \sqrt n$. I was wondering if there is any mathematical proof that no prime $p$ exists for the number $n$ such that $p&gt; \sqrt n$. What are the differences between Generics in C# and Java... and Templates in C++? I mostly use Java and generics are relatively new. I keep reading that Java made the wrong decision or that .NET has better implementations etc. etc.  So, what are the main differences between C++, C#, Java in generics? Pros/cons of each? How to download all required Ubuntu drivers What is "anycast" and how is it helpful? I'd never heard of anycast until a few seconds ago when I read "".  The wikipedia "" article on it is quite formal and doesn't really evoke a mental picture of how it would be used.  Can someone explain in a few informal sentences what "anycast" is, how you configure it (just in a general sense), and what its benefits are (what does it make easier)? Why massless particles have zero chemical potential? Let $\mu(\Omega)$ be a probability measure (i.e. $\mu(\Omega) = 1$), and let $f,g$ be non-negative measurable functions on $\Omega$ such that $fg \geq 1$. Show that $1 \leq (\int f^p )(\int g^p)$ for all $0 &lt; p &lt; \infty$   I'm a bit at a loss of what to do. I know that since $fg \geq 1$, we may obtain:  $$\int_{\Omega} d\mu = \mu(\Omega) = 1 \leq \int_{\Omega} fg = \int_{\Omega} |fg|$$ The right-most integral is true since $fg$ is positive and it is equal to $||fg||_1$.  By Hölder's inequality, we obtain:  $$1 \leq \int |fg| \leq ||f||_p ||g||_q = (\int f^p)^\frac{1}{p}(\int g^q)^\frac{1}{q}$$  where $p$ and $q$ satisfy $\frac{1}{p} + \frac{1}{q} = 1$. Raising the left-most and right-most sides of this inequality to the power $p$, I may obtain:  $$1 \leq (\int f^p)(\int g^q)^\frac{p}{q}$$  I now wish to show that $(\int g^q)^\frac{p}{q} \leq \int g^p$, but I've been at a loss of how to do it. Any tips or hints would be greatly appreciated. Question statement is as in the title:     $\varphi:G\to H$ is a Lie Group Homomorphism, then $\ker \varphi$ has Lie algebra $\ker D_e \varphi$   Since $\varphi$ is a Lie group homomorphism, in particular it is continuous. As $H$ must be Hausdorff, every point set is closed, and hence $\{e\}$ is closed in $H$, which implies that $\ker\varphi = \varphi^{-1}(e)$ is closed as well.  So $N=\ker\varphi$ is an embedded Lie subgroup of $G$. Therefore, the inclusion $j:N\to G$ is a Lie Group homomorphism, and induces a Lie algebra homomorphism $D_e j :T_e N \to T_e G$. So I only need to show that $D_e j$ is in fact an isomorphism between $T_e N$ and $\ker D_e \varphi$.  But I'm stuck at this point. I know that for $X\in T_e N$, we have, for $f\in C^{\infty}(H)$,  $$ D_e\varphi (D_e j(X))(f)=D_e j (X)(f\circ \varphi)=X(f\circ \varphi\circ j)=0$$  So $D_ej(T_e N) \subset \ker D_e \varphi$.  At this point, I can either show inverse inclusion: that is, for every $X\in \ker D_e \varphi$, we can find $Y\in T_e N$ such that $D_e j (Y)=X$, or for all $f\in C^{\infty}(G)$, $Y(f\circ j)=X(f)$  Or I can somehow show that dimensions of the two spaces are the same.   But I can't proceed from here.  It'd be great if someone could help me Ability to update profile from the Stack Exchange Android App Is it possible to retrieve a previous un-evaluated, un-normalized input?