Lets say I have a function which I have defined:  def command("filename", function, error):   For 'function' I can input one of the following two functions:  def linear:     return x  def exponential:     return e**x   I want to save the figure under a name depended on the function used. So the name of figure will be something like this: filename_function.jpg  The command for this is plt.savefig(filename_+????+'.png')  How do I input the name of the specific function used into saved file?  So if my command is command("hello.txt", linear, error), then my save file should read hello_linear.png.   Update: Thanks everyone. I am new to Python, and I guess I caught myself tied up in nonsense approaches to something that can be implemented very simply. The answer is function.__name__ exactly as written.
In Python, how do I get a function name as a string, without calling the function?  def my_function():     pass  print get_function_name_as_string(my_function) # my_function is not in quotes   should output "my_function".  Is such function available in Python? If not, any ideas on how to implement get_function_name_as_string, in Python?
If I want to display the IP address that is assigned to eth1, how can I do this in Bash? A potentially dangerous Request.Form value was detected from the client Every time a user posts something containing &lt; or &gt; in a page in my web application, I get this exception thrown.  I don't want to go into the discussion about the smartness of throwing an exception or crashing an entire web application because somebody entered a character in a text box, but I am looking for an elegant way to handle this.  Trapping the exception and showing     An error has occurred please go back and re-type your entire form again, but this time please do not use &lt;   doesn't seem professional enough to me.  Disabling post validation (validateRequest="false") will definitely avoid this error, but it will leave the page vulnerable to a number of attacks.  Ideally: When a post back occurs containing HTML restricted characters, that posted value in the Form collection will be automatically HTML encoded. So the .Text property of my text-box will be something &amp; lt; html &amp; gt;  Is there a way I can do this from a handler? Product and sum of positive operators is positive I want to show that for $S,T\in B(H)$ bounded operators on Hilbertspace with $S\geq 0,T\geq 0$ and $ST=TS$,  we have $S+T\geq 0$, and $ST\geq 0$.  $T\geq 0$ means $(Tx,x)\geq 0$.    To me it seems that $((S+T)x,x) = (Sx,x)+(Tx,x)\geq 0$. But for $ST$ i like some help.   There is a theorem in Rudin (12.32) that says that for every $T\in B(H)$ we have an equivalence:   $T$ is positive $\Leftrightarrow$ $T$ is self adjoint, i.e. $T=T^*$ and $\sigma(T)\subset [0,\infty)$.   Since $S, T$ are self adjoint we know that $ST=TS = S^*T^* = T^*S^*$ ($ST$ is selfadjoint since $S,T$ commute). Also I read somewhere that if $S,T $ commute then $\sigma(ST)\subset \sigma(S)\sigma(T)$, but I am not sure if this is true. Clearly I cant prove it, but if it were true by this ''Theorem'' it would follow that $ST \geq 0$.   Is there a more straightforward way? Attempting official deploy process with single sandbox may reset/remove all existing work? I have a fraction with sums above and under the line. How can I convince LaTeX to write the indices of the sums under the sigma instead of next to it?  \begin{displaymath}   \frac{\sum_{s \in S} s^2}{\sum_{p \in P} p^2} \end{displaymath} How can I create a coffee cream effect with Photoshop? Today I would like to create a coffee cup with the cream floral on it as a text by using Photoshop. It looks like you order a cup of hot cappuccino and the bartender will draw a flower with cream on the surface of coffee but now I want to make it like a text to present a tittle.     I just need to do the cream text effect, no need to draw the whole cup of coffee since i can't use some images. So anyone can tell me how to do this cream effect on Photoshop.  Thanks in advance for any feedback! Is the universe fundamentally deterministic? I'm not sure if this is the right place to ask this question. I realise that this maybe a borderline philosophical question at this point in time, therefore feel free to close this question if you think that this is a duplicate or inappropriate for this forum. Anyway, I'm an electrical engineer and I have some basic knowledge of quantum mechanics. I know that Schrödinger's equation is deterministic. However, quantum mechanics is much deeper than that and I would like to learn more. If this question is not clearly answerable at this point than can anyone point out some recognized sources that try to answer this question. I would appreciate it if the source is scientific and more specifically, is related to quantum theory. Set the maximum character length of a UITextField New messages flagged blue bubble does not go away When someone flags a message in chat all 10k+ users in chat get a little blue bubble to vote on. It shows up in the upper left hand corner of your gravatar (which is in the bottom left of the page).  When someone flags a message and it shows up, if I wait for a second to click on it, and then click on it, and it has already been handled, it shows the message  "There are no flags to display."  In the past, after showing this message, the blue (1) would disappear. However, lately it has not been going away and requires a page refresh in order to remove. Can this be fixed?  This issue is addressed here:  from September 12th 2012. But since it is still occurring 10 months later, I believe the cause is different. How to find the smallest $n$ such that $n^a\equiv 1 \pmod p$ Given a prime $p$ and number $a$, how do I find the smallest $n$ such that $n^a\equiv 1 \pmod p$? Is there a non trial-and-error method?  Edit: obviously removing $n=1$! so there are some idiosyncrasies with the method they use to invert that part of the image which I can't figure out. It could be that they just invert the luminosity but I don't know how i would do that in a dynamic way. a) Let $a&gt;0$ and the sequence $x_n$ fulfills $x_1&gt;0$ and $x_{n+1}=\frac{1}{2}(x_n + \frac{a}{x_n})$ for $n \in \mathbb N$. Show that $x_n \rightarrow \sqrt a$ when $n\rightarrow \infty$. I have done it in two ways, but I guess I'm not allowed to use the first one and the second one is incomplete. Can someone please help me?  We already know $x_n \rightarrow \sqrt a$, so we do another step of the iteration and see that $x_{n+1} = \sqrt a$.  Using limit, $x_n \rightarrow x, x_{n+1} \rightarrow x$ (this is the part I think it's incomplete, don't I have to show $x_{n+1} \rightarrow x$, how?), we have that   $$x = \frac x 2 (1 + \frac a {x^2}) \Rightarrow 1 = a/x^2 \Rightarrow x = \sqrt a$$ b) Let the sequence $x_n$ be defined as $x_{n+1}= 1 + \frac 1 {x_n} (n \in \mathbb N), x_1=1$. Show that it converges and calculate its limit. &quot;Tip: Show that sequences $x_{2n}$ and $x_{2n+1}$ monotone convergent to the limit.&quot; I didn't understand the tip, how can this help me? Does it make a difference if the number is odd or even? Thanks in advance! How to access Winter 13's Push Major functionality We are ISV Partners and all of our packaging orgs have been upgraded to Winter 13. One of the features of Winter 13 was supposed to allow us to push major release versions to subscriber orgs. I would have expected it to be in the previously existing "Push Upgrade" section of our packaging orgs, but that still only allows pushing patch versions.  If it didn't make the final Winter 13 release, I would have expected Salesforce to take it off the release page. Is this something we have to ask to be enabled? I am having a strange problem in ArcGIS Toolbox.  I am trying to use the  tool from ArcToolbox. When I open the tool, there is no possibility to input Simplification Tolerance. Please see the attached image.  I can run the tool as a batch and from the Python window without any problem.  I am using ArcGIS 10(Editor) with Service Pack 5 on Windows 7 64Bit (English) and Windows Server 2008 64Bit (German). On both machines, I have the same problem. Any ideas?    I have reinstalled the software but the problem remains. Let $F$ be a field, let $\omega$ be a primitive $n$th root of unity in an algebraic closure of $F$. If $a$ in $F$ is not an $m$th power in $F(\omega)$ for any $m\gt 1$ that divides $n$, how to show that $x^n -a$ is irreducible over $F$? I'm trying to install  on my Ubuntu box (11.04). The website has a Ubuntu .deb available for download (for 10.10 and 10.04 so I chose 10.10).   However,   sudo dpkg -i mysql-workbench-gpl-5.2.34-1ubu1010-amd64.deb   yields:  (Reading database ... 194069 files and directories currently installed.) Preparing to replace mysql-workbench-gpl 5.2.34-1ubu1010 (using mysql-workbench-gpl-5.2.34-1ubu1010-amd64.deb) ... Unpacking replacement mysql-workbench-gpl ... dpkg: dependency problems prevent configuration of mysql-workbench-gpl:  mysql-workbench-gpl depends on libctemplate0; however:   Package libctemplate0 is not installed.  mysql-workbench-gpl depends on libpython2.6 (&gt;= 2.6); however:   Package libpython2.6 is not installed.  mysql-workbench-gpl depends on libzip1 (&gt;= 0.8); however:   Package libzip1 is not installed.  mysql-workbench-gpl depends on python-paramiko; however:   Package python-paramiko is not installed.  mysql-workbench-gpl depends on python-pysqlite2; however:   Package python-pysqlite2 is not installed. dpkg: error processing mysql-workbench-gpl (--install):  dependency problems - leaving unconfigured Processing triggers for bamfdaemon ... Rebuilding /usr/share/applications/bamf.index... Processing triggers for desktop-file-utils ... Processing triggers for python-gmenu ... Rebuilding /usr/share/applications/desktop.en_US.utf8.cache... Processing triggers for python-support ... Errors were encountered while processing:  mysql-workbench-gpl   My question is, is there a way to tell dpkg to automatically fetch missing dependencies, or do I need to manually apt-get install missing packages like libctemplate0 and  libpython2.6?   (Or alternatively, is there some other way to get MySQL Workbench easily up &amp; running?) I searched wide and far and couldn't come up with a title for a movie I watched somewhere around the mid-90ies up to early 00's as a rerun in late-night television (in Germany, specifically on Vox; but I'm sure it was an American movie to begin with).  Basically, what I remember from the story revolves around a crew in a space station or maybe space ship of some sort. Some crew members murder other crew members and there is some kind of door they are not supposed/unable to go through. Late in the movie they do go through the door and I'm pretty sure one of the first views is a skeleton of a dead security guard. It turns out the whole thing was some kind of simulation gone wrong and they find themselves to be in a (nuclear?) wasteland. And that's pretty much the revelation/wrap-up of the movie, as I recall it.  I would be delighted if somebody had any idea what movie this could be :) Thanks!  EDIT: The whole movie was in color and I think it was feature-length, not just 45 mins. What is the best approach for solving the equations of the form      $p^x = x^q$ ; where $p$ and $q$ are some constants.   Basically, I wanted to solve $2^x = x^2$ to analyze algorithms with respective growth functions. 3rd iterate of a continuous function equals identity function 403 Forbidden with Java but not web browser?