I tried to insert name into database.  name = 'test' cur.execute("INSERT INTO scholars(name) VALUES('{}') returning id".format(name)) id = cur.fetchone() print(id)   error message:  psycopg2.IntegrityError: duplicate key value violates unique constraint "idx_16514_primary" DETAIL:  Key (id)=(2321) already exists.   When id=2301, it succeed,and return ID. After that,id += 1and returns the error below.
I ran into the problem that my primary key sequence is not in sync with my table rows.   That is, when I insert a new row I get a duplicate key error because the sequence implied in the serial datatype returns a number that already exists.  It seems to be caused by import/restores not maintaining the sequence properly.
Using FFmpeg and IPython Cannot determine size of graphic I'm trying to include graphics in my Latex-file, which I compiled with latex+dvipdf on OS X. Latex however returns this error: "Cannot determine size of graphic"  My graphic is exported from PowerPoint, so I have tried both .pdf and .png. I get the same errors for both.  Sample code that doesn't work:  \begin{figure}[htb] \begin{center} \leavevmode \includegraphics[width=0.8\textwidth]{graph.png} \end{center} \end{figure}   If I have to manually set some measurements of the image, please tell me how I can find out those measurements. I need the image to take up about 80% of text width and be centered. Thanks. multisite: allow only specific users to update sites Here is what I do:   restart machine with Windows 8.1 determine "EFI System" partition with the Disk Management utility run command prompt as administrator type diskpart type select disk 0 then select partition 2 then assign open windows explorer windows+e refresh if the drive is not showing F5 try to open drive by double clicking   What I expected to happen:  I can at least look at my EFI partition files.  What happened:    after clicking continue    after clicking "security tab" link, no security tab    What do I need to do to access my EFI partition on Windows 8.1? This question is a result of having too much free time years ago during military service. One of the many pastimes was playing tic-tac-toe in varying grid sizes and dimensions, and it lead me to a conjecture. Now, after several years of mathematical training at a university, I am still unable to settle the conjecture, so I present it to you.  The classical tic-tac-toe game is played on a $3\times3$ grid and two players take turns to put their mark somewhere in the grid. The first one to get three collinear marks wins. Collinear includes horizontal, vertical and diagonal lines. Experience shows that the game always ends in a draw if both players play wisely.  Let us write the grid size $3\times3$ as $3^2$. We can change the edge length by playing on any $a^2$ grid (where each player tries to get $a$ marks in a row on the $a\times a$ grid). We can also change dimension by playing on any $a^d$ grid, for example $3^3=3\times3\times3$. I want to understand something about this game for general $a$ and $d$. Let me repeat: The goal is to make $a$ collinear marks.  I assume both players play in an optimal way. It is quite easy to see that the first player wins on a $2^d$ grid for any $d\geq2$ but the game is a tie on $2^1$. The game is a tie also on $3^1$ and $3^2$, but my experience suggests that the first player wins on $3^3$ but the game ties on $4^d$ for $d\leq3$. It seems quite credible that if there is a winning strategy on $a^d$, there is one also on $a^{d'}$ for any $d'\geq d$, since more dimensions to move in gives more room for winning rows.  to a related question tells that for any $a$ there is $d$ so that there is a winning strategy on $a^d$.  This brings me to the conjecture:     There is a winning strategy for tic-tac-toe on an $a^d$ grid if and only if $d\geq a$. (Refuted by TonyK's answer below.)   Is there a characterization of the cases where a winning strategy exists? It turns out not to be as simple as I thought.  To fix notation, let $$ \delta(a)=\min\{d;\text{first player wins on }a^d\} $$ and $$ \alpha(d)=\max\{a;\text{first player wins on }a^d\}. $$ The main question is:     Is there an explicit expression for either of these functions?   Or decent bounds?   Partial answers are also welcome.   Note that the second player never wins, as was discussed in .    A remark for the algebraically-minded: We can also allow the lines of marks to continue at the opposite face when they exit the grid; this amounts to giving the grid a torus-like structure. Now there are no special points, unlike in the usual case with boundaries. Collinear points on a toric grid of size $a^d$ corresponds to a line (maximal collinear set) in the module $(\mathbb Z/a\mathbb Z)^d$. (If $a$ is odd, then $a$ collinear points in the mentioned module add up to zero, but the converse does not always hold: the nine points in $(\mathbb Z/9\mathbb Z)^3$ with multiples of three as all coordinates add up to zero but are not collinear.) This approach might be more useful when $a$ is a prime and the module becomes a vector space. Anyway, if this version of the game seems more manageable, I'm happy with answers about it as well (although the conjecture as stated is not true in this setting; the first player wins on $3^2$). How do I load an mp4 video with multiple audio tracks into blender? Question  Let $X_n\geq 0$ be independent for $n\geq 1$. The following are equivalent.  $\sum_{n=1}^\infty X_n&lt;\infty$ a.s. $\sum_{n=1}^\infty[P(X_n&gt;1)+E(X_nI(X_n\leq 1)]&lt;\infty$ $\sum_{n=1}^\infty E(X_n/(1+X_n))&lt;\infty$   My attempt I was able to prove $(1)$ implies $(2)$ and $(2)$ implies $(3)$ but not $(3)$ implies $(1)$. For $(1)$ implies $(2)$, observe that by Borel-Cantelli $\sum_{n=1}^\infty P(X_n&gt;1)&lt;\infty$, else $X_n&gt;1$ infinitely often w.p.1 so that $(1)$ is violated. To see that $\sum_{n=1}^\infty E(X_nI(X_n\leq 1)]&lt;\infty$, apply Kolmogorov three-series theorem (I think). For $(2)$ implies $(3)$ we can write that $$ \begin{align} \frac{X_n}{1+X_n}&amp; =\frac{X_n}{1+X_n}I(X_n\leq 1)+\frac{X_n}{1+X_n}I(X_n&gt;1)\\ &amp;\leq X_nI(X_n\leq 1)+ I(X_n&gt;1). \end{align} $$ Now take the expectation of both sides and sum on $n$ using $(2)$ to conclude $(3)$. For the last implication $(3)$ implies $(1)$, I tried to use Kolmogorov three series theorem. To this end put $Y_n=X_nI(X_n\leq 1)$. First note that $\sum_{n=1}^\infty P(X_n&gt;1)&lt;\infty$ since $$ P(X_n&gt;1)\leq P\left(\frac{X_n}{1+X_n}&gt;\frac{1}{2}\right)\leq 2E\frac{X_n}{1+X_n} $$ by Markov's inequality. But I am unable to show that $\sum EY_n&lt;\infty$ and $\sum\text{Var}(Y_n)&lt;\infty$. Any help is appreciated. Suppose that   $$f(x)=1+\sum_{n=1}^\infty a_n \frac{x^n}{n!}\ \ \forall \ x\in \mathbb{R}$$   where $\sup_{x&gt;0}\left|e^xf(x)\right| &lt; \infty$ and $\sup_{n\in\mathbb{N}} |a_n|&lt; \infty$.      Prove that $a_n = (-1)^n$ , $\forall n\in \mathbb{N}$   It seems amazing to me. What we need to prove is $f(x)=e^{-x}$. It seems insufficient to prove this strong conclusion, but actually it is true and all the "counterexamples" I found were wrong.  My attempt  Put $g(x)=e^x f(x)$. $$\left|g^{(n)}(0)\right|=\left|\sum_{k=0}^n \binom{n}{k} f^{(k)}(0)\right|\le 2^n\sup_{n\in\mathbb{N}} |a_n|  $$ Put $h(x)=g(\frac{x}{2})$. Thus  $$h^{(n)}(0)=\frac{1}{2^n}g(0) \le \sup_{n\in\mathbb{N}} |a_n|$$ which implies that $$h(x)=1+\sum_{n=1}^\infty b_n \frac{x^n}{n!}\ \ \forall \ x\in \mathbb{R}$$ where $$|b_n|\le \sup_{n\in\mathbb{N}} |a_n| \ \ \forall \ n\in\mathbb{N}  \,\,\,\,\,\&amp; \,\,\,\,\,  \sup_{x&gt;0}\left|h(x)\right| &lt; \infty $$   And hence if $b_k&lt;0$, then there exists $l&gt;k$ such that $b_l&gt;0$. I want to yield a contradiction by supposing this, but I failed.  Any hints or other new ideas? Thanks in advance!   (I heard that this problem can be solved by complex analysis. This is the reason why I attach the complex-analysis tag.) What is the Necessity of $...$ Around Numbers? I typed up an assignment with a lot of numbers in LaTeX and turned it in to my adviser.  When he returned it to me with some corrections, one of which was a lot of $ around my numbers.  I understand that $ are necessary around some mathematical formulas, but I was just using numbers like -2 and 4.  I did not see any change in the font of the numbers when I added the $ either.  Since my adviser did not want to give me an explanation, what is the rationale? Direction arrows on a circle I would like to plot circle (or another curve) with positive direction (and show it wit arrows).  This plots the circle  \documentclass{article} \usepackage{tikz} \RequirePackage{pgfplots} \usetikzlibrary{shadows} \usetikzlibrary{shapes} \usetikzlibrary{decorations} \usepackage{verbatim} \usepackage[active,tightpage]{preview} \PreviewEnvironment{tikzpicture} \setlength\PreviewBorder{5pt} \begin{document} \begin{tikzpicture}     \begin{axis}[             xmin=-1.5,xmax=2.5,ymin=-1.5,ymax=1.5,             axis lines=center,             ticks=none,             unit vector ratio*=1 1 1,            ]                   \addplot [very thick, smooth, domain=(0:2*pi)] ({1.+cos(deg(x))},{sin(deg(x))});        \addplot[only marks,mark=*] coordinates{(1,0)};         \end{axis} \end{tikzpicture} \end{document}   And I want to add arrows like that    Would you advise me how to add such arrows? How come such different methods result in the same number, $e$? I guess the proof of the identity $$ \sum_{n = 0}^{\infty} \frac{1}{n!} \equiv \lim_{x \to \infty} \left(1 + \frac{1}{x}\right)^x $$ explains the connection between such different calculations. How is it done? What happened to the link to the duplicate when a question is closed as a duplicate? Possible Duplicate:          This question:      has been closed as an exact duplicate, but there is no link to the duplicate so we can neither assess whether the closure is valid nor see the explanations in the duplicate question.  It wasn't so long ago that the duplicate links were shown &mdash; is there a policy change (and if so, why?), or is it just a glitch? Check ping statistics without stopping Is there a way to tell ping to show its usual termination statistics without stopping the execution?  For instance, I'd like to quickly view:  --- 8.8.8.8 ping statistics --- 2410 packets transmitted, 2274 received, +27 errors, 5% packet loss, time 2412839ms rtt min/avg/max/mdev = 26.103/48.917/639.493/52.093 ms, pipe 3   without having to stop the program, thus losing the accumulated data. For which values of $\alpha$ and $\beta$ does the integral $\int\limits_2^{\infty}\frac{dx}{x^{\alpha}\ln^{\beta}x}$ converge? It'd be nice to see reputation updates in the app, as we get on both the desktop and mobile sites.  Mock-up of how this would look:        Other possible icon states:        While I understand reputation is shown in the feed, it's a bit unwieldy, and has no notification.   With this feature implemented, the feed could arguably lose both reputation and inbox items, and be left with the interesting questions that fill it up. This would make for a much more consistent UX across app and desktop. A doubt on the definition of limit of a function definition I want to prove the definition of limit of a function from definition (1) to definition (2).  (1) A function $f(x)$ is said to have $f^*$ as the limit as $x$ tends $x^*$ iff for every sequence $\{x_n\}$ with limit $x^*$, the limit $\lim_{n-&gt;\infty}f(x_n)$ exists and is equal to $f^*$. (2) A function is said to have $f^*$ as the limit as $x$ tends $x^*$ iff for each $\epsilon &gt;0$, there exists a $\delta_\epsilon &gt;0$ such that $|f(x)-f^*| &lt;\epsilon \forall |x^*-x|&lt;\delta_\epsilon$  I am confused about the steps. Suppose I am given an $\epsilon &gt; 0$ and $x^*$. I have to show the existence of a $\delta_\epsilon &gt;0$ such that for all $x$ satisfying  $|x^*-x|&lt;\delta_\epsilon$ I can construct a sequence $x_n$ which converges to $x^*$ and $x_n=x$ for some $n \geq N$. Then I can say that $f(x_n)-f^*=f(x)-f^* &lt; \epsilon$. I think I may have made some mistake about the steps.  My main confusion is the following : Suppose I choose $\delta_\epsilon=\epsilon$. Then if a sequence $\{x_n\}$ converges to $x^*$ then $x_n=x$ (where $x$ satisfies $|x-x^*|&lt;\epsilon$) for some $n\geq N$. Now, $\lim_{n-&gt;\infty}f(x_n)$ exists implies there exists an $M$ such that $\forall n\geq M$, $f(x_n)-f^* &lt;\epsilon$. Now, I need to show that for some $n \geq M$ indeed $x_n=x$. How do I show that ? This $M$ and $N$ are different. I am not sure of the meaning of this sentence:     The significance of culture and identity in development has to do not so much with the cultural factor in the process of development as with abandoning Eurocentric development thinking.   I'm not sure what the use of as is supposed to convey. Does it mean "development has to do not so much ... as with abandoning", i.e. not as much as abandoning? Does the abandoning have more to do with it?  And the second question: Why does it use "has to do not so much". Why not "has not so much to do"? Is "have to" a verb? Enumerate after \label How to install Blender from the official website I installed Blender from official Ubuntu repository but its version is always behind the version available from the official Blender website.  I'm aware that I can launch the program within the downloaded folder, but i want to replace the install version with a new version downloaded from the website?   It must be present in the unity launcher.  I'm also aware of the available PPA's that are available, however I just want to install Blender manually.  Thanks in advance Can a set be neither open nor closed? An example would do. I cant think of any.   Thanks in advance!