I have a function that looks like this:  def test(in1):    if in2 = 151:     print('error')     if in2 == 1:     in1 = 14     print(in1)   The function currently takes in a string value,   I was thinking:  if in2 == 'one':    in2 = 14   But that doesn't work for some reason  Thanks
I need to convert one into 1, two into 2 and so on.  Is there a way to do this with a library or a class or anything?
Bug with Excavator Badge I edited this post today  on stack overflow. I was approved of the edit, so I waited a few minutes to get my  badge because this answer was posted on Jan 28 '10 at 1:06, but it never came. I have read multiple articles on meta that there have been bugs with this badge, but they have been about winning it multiple times (), or earning it then losing it (). Am I missing something here? I will be getting a point-and-shoot camera for taking portraits and only portraits.  Specifically portraits with a shallow depth of field.   Groups portraits sometimes.  It's just too much work to add lens blur at post-prod.  I understand that setting a P&amp;S on macro mode gives a shallow focus and DOF.    How do I read P&amp;S camera specs to shortlist those with the shallowest depth of field?   Added: By point-and-shoot, I mean a camera that is easy to use -- Not necessarily compact, inexpensive, or current.  Also, if there are two or three factors/specs to get a shallow depth of field, then which spec contributes the most to bokeh? which is second most contributing? the third, etc.? $1^n +2^n + \cdots +(p-1)^n \mod p =$? Calculate for every positive integer $n$ and for every prime $p$ the expression  $$1^n +2^n + \cdots +(p-1)^n \mod p$$    I need your help for this. I don't know what to do, but I'll show you what I know.   Wilson's theorem The identity $X^p-X = \prod_{a \in \mathbb{F}_p-1}(X-a)$ $\exists a \in \mathbb{Z}, \ a^2 \equiv -1 \mod p \qquad \iff \qquad p \equiv 1 \mod 4$   Now can you please provide me a hint? DML is not allowed in a constructor. Is there a known reason behind this limit?  I have been searching for the answer &amp; haven't found anything which addresses the question. May be it's not documented anywhere(Or google doesn't know where it is). 2D and 3D vectors in Tikz I would like to draw some 2D and 3D vectors in Tikz with certain properties. The following primitive graph sums what I desire:   I just need the first quadrant of the Cartesian coordinate system for my representation.  I need the vector to be connected to the respective values on the distinct dimensions(not a projection, just orthogonal dashed lines).   The code segment below does what I want to achieve in 3D with two exceptions:  The projections on the xy plane and z dimension are given instead of connecting the head of the vector to the corresponding value in each dimension.  Numerical values are missing in dimensions.   Code: \documentclass[tikz]{standalone} \usepackage{tikz-3dplot} \begin{document}  \tdplotsetmaincoords{60}{120} \begin{tikzpicture}     [scale=3,     tdplot_main_coords,     axis/.style={-&gt;,blue,thick},     vector/.style={-stealth,red,very thick},     vector guide/.style={dashed,red,thick}]  %standard tikz coordinate definition using x, y, z coords \coordinate (O) at (0,0,0);  %tikz-3dplot coordinate definition using r, theta, phi coords \tdplotsetcoord{P}{.8}{55}{60}  %draw axes \draw[axis] (0,0,0) -- (1,0,0) node[anchor=north east]{$x$};     \draw[axis] (0,0,0) -- (0,1,0) node[anchor=north west]{$y$};     \draw[axis] (0,0,0) -- (0,0,1) node[anchor=south]{$z$};  %draw a vector from O to P \draw[vector] (O) -- (P);  %draw guide lines to components \draw[vector guide] (O) -- (Pxy); \draw[vector guide] (Pxy) -- (P); \end{tikzpicture} \end{document} I have no idea how prove that $$\{(z_0,\ldots,z_n)\in\mathbb{C}^{n+1} \quad| \quad z_0^d+z_1^2\ldots+z_n^2=0, \quad |z_0|^2+|z_1|^2\ldots+|z_n|^2=2\}$$ is a $(2n-1)$-compact manifold.  How give the charts. For $n=1$ and $d=2$ not distinguish which 1- manifdold is? Ways to eliminate switch in code What's wrong with XKCD's Frequentists vs. Bayesians comic? makes fun of a frequentist statistician who derives an obviously wrong result.  However it seems to me that his reasoning is actually correct in the sense that it follows  the standard frequentist methodology.   So my question is "does he correctly apply the frequentist methodology?"    If no: what would be a correct frequentist inference in this scenario? How to integrate "prior knowledge" about the sun stability in the frequentist methodology? If yes: wtf? ;-) Table of Contents with Chapter I'm attempting to modify the Table of Contents in my document. Currently, chapter one in my document is listed as   1   Introduction   What I would like to see is  Chapter 1   Introduction   Seems like an easy enough thing to ask for, but can't seem to find a good way to do this. Any feedback would be most appreciative. How can I save application settings in a Windows Forms application? What I want to achieve is very simple: I have a Windows Forms (.NET 3.5) application that uses a path for reading information. This path can be modified by the user, by using the options form I provide.  Now, I want to save the path value to a file for later use. This would be one of the many settings saved to this file. This file would sit directly in the application folder.  I understand three options are available:   ConfigurationSettings file (appname.exe.config) Registry Custom XML file   I read that the .NET configuration file is not foreseen for saving values back to it. As for the registry, I would like to get as far away from it as possible.  Does this mean that I should use a custom XML file to save configuration settings?  If so, I would like to see code example of that (C#).  I have seen other discussions on this subject, but it is still not clear to me. I have two Xbox 360's, one WiFi and the other wired through the same Linksys E3000 router with DD-WRT (v24-sp2 (04/13/11) std-usb-nas firmware).   Mine (the wired one, though hers has been wired in the past and it didn't appear to help) always seems to be open (green), and hers is either moderate or closed (oj/red)  Even with the original router firmware I've never been able to get both consoles into "open nat" mode, and it makes playing certain games together almost impossible for me and my wife  because we can't seem to get into the same game.   I have uPnP enabled and the DMZ disabled, and some minor port forwarding to allow for a Minecraft server (Ports 25565 and 25566 for a testing copy of the server), but other than that the settings are mainly at their default, on the xbox's and the router.   Are there any settings I can configure to allow this to work properly? Maybe the concept, why it's used, and an example. Cooking more than one dish that require different temperatures I'm cooking two different dishes in the oven at the same time that each require different temperatures. One is a roasted vegetable dish that says to cook at 475 for 35-40 minutes and the other is parmesan crusted pork chops at 350 for 40-45 minutes. What do you suggest I do? What is the difference between DX format and FX format lenses, and which to choose for what purpose? What is the difference between DX format and FX format lenses, and which to choose for what purpose?  What are the pros and cons of both? The grammaticality of "that don't impress me much" I'd like to know how the sentence "That don't impress me much" sounds to a native English speaker.  The phrase is the title of a song by Shania Twain, and to my eyes it contains a clear error. It is obviously intended, and I want to know what was the effect that the author wanted to obtain.  Other examples that come to mind:   “She's got a ticket to ride, but she don't care” — The Beatles “My love don't cost a thing” — Jennifer Lopez “It don't matter” — Akon “She don't care about me” — heard in the Lost series “It Don't Mean a Thing” — a jazz album title “The Sun Don't Lie” — another album title I'm training a neural network but the training loss doesn't decrease. How can I fix this?  I'm not asking about overfitting or regularization. I'm asking about how to solve the problem where my network's performance doesn't improve on the training set.    This question is intentionally general so that other questions about how to train a neural network can be closed as a duplicate of this one, with the attitude that "if you give a man a fish you feed him for a day, but if you teach a man to fish, you can feed him for the rest of his life." See this Meta thread for a discussion:   If your neural network does not generalize well, see: Find the product $\prod_{n=1}^{\infty} (1+x^{2n-1}) $ php loop through json array Computer doesn't boot up, shows PXE error and/or "operating system not found", "no bootable device", "insert boot media", or other similar error Configuring Firefox to use a proxy from the command line I'm looking for a way to tell Firefox to use a proxy in Ubuntu Ludid (10.04.1 LTS).   I'm installing Ubuntu semi-automatically on several identical machines. For this, I use a script that, amongst other things, sets system-wide proxy settings:  echo "export http_proxy=http://myproxy:3128/" &gt; /etc/profile.d/proxy.sh echo "export HTTP_PROXY=http://myproxy:3128/" &gt;&gt; /etc/profile.d/proxy.sh chmod a+x /etc/profile.d/proxy.sh   I can confirm that the variables are set correctly when checking in a shell. Most programs respect this setting and use my proxy. Firefox, however, does not. When I open its network connection settings dialog, however, it is pre-set to "use system settings" for the proxy.   What does Firefox expect here? A differently-named variable? Can I set something in FF's prefs.js?