I am probably missing something really simple.  So here is my code:  def test():     return 'Hello!'  if __name__=="__main__":     print test()   On executing python module_name.py there in no output. When I import the module and execute module_name.test() I get my the expected output. What am I missing here?
Given the following code, what does the if __name__ == "__main__": do?  # Threading example import time, thread  def myfunction(string, sleeptime, lock, *args):     while True:         lock.acquire()         time.sleep(sleeptime)         lock.release()         time.sleep(sleeptime)  if __name__ == "__main__":     lock = thread.allocate_lock()     thread.start_new_thread(myfunction, ("Thread #: 1", 2, lock))     thread.start_new_thread(myfunction, ("Thread #: 2", 2, lock))
What book features people living in a tree who move up it in a bubble? "No such file or directory" when trying to remove a file, but the file exists? I am trying to remove a png image that was uploaded to my server via a PHP script. Whenever I try to delete it both through ftp and terminal, I get the error   No such file or directory   However, when I ls in the dir, the file is listed and it is also listed in my ftp client. I have tried creating a file with the same name and I end up getting two files with the same name.   I can open the file that supposedly does not exist, but I still can't remove it. I have also tried rebooting my server. Any ideas what may be the issue? I am running a 64 bit version of Ubuntu, but I don't think its a 32/64 bit issue. I should also note I have removed many other png files uploaded by the same PHP script.  Output for ls -l  total 224  -rw-r--r-- 1 www-data www-data 222838 May 13 04:14 qyxdshyikfr_fishing_timeout.png  -rw-r--r-- 1 root root 272 May 14 06:54 upload.php   Output when trying to rm  rm: cannot remove ‘qyxdshyikfr_fishing_timeout.png’: No such file or directory   upload.php: How to create dummy webcam? I would like to join some videoconference, but I don't own a webcam and the conference software requires one.  So my question is, can I create a dummy one? I don't care what the cam will cast, I just need to appear to have one. tar files only, no directories Why does chown report "Operation not permitted" on OS X? I am trying to do the following on my Mac (10.6.7):  sudo chown myusername:wheel ./entries   but Unix/Mac is returning "Operation not permitted". When I ls -lash the culprit file, it looks as follows:  8 -rwxrwxrwx   1 myusername  staff   394B Apr 26 23:26 entries   I've tried sudo and sudo su; nothing works. Any ideas what's up?  I'm trying to chmod files I've copied from my old Ubuntu box. Most of the files have successfully chmod'ed recursively; just this one is stuck and I don't understand why. Inform moderators migrating a question if the migration would have been normally blocked What does the colon in Tikz coordinates mean? What is `^M` and how do I get rid of it? I have already had the same problem before. On that occasion, I found a program that could scan my entire hard drive for string pieces so I could recover it. Unfortunately I don't remember the name of the program. It had to access the hard drive data directly, normal searches won't get any data from the hard drive before formatting. Azure DNS does not lookup SPF policies for certain domains I am using eclipse and i get this error--I think it's an error with the way i imported becker.robots running a bash file states:date: command not found I've installed a version of Ubuntu Server and although I'm fairly still fresh with Ubuntu, I'm trying to create a bash file to run a program in the background. More importantly, I'm trying to get a file nameto display correct and create it before I start running the program (I like my debug stuff).  However, here is my bash script:    #!/bin/bash  PATH="/var/log/servers/Game/"  FILENAME="startup"  EXT=".log"  DATE=$(date +%d-%m-%Y)  NEWFILE=${PATH}${FILENAME}_${DATE}${EXT}   I have verified that the file does exist in the PATH directory. However, the issue is with the date command. When I run the script bash -x game.sh this is what is displays.   + PATH=/var/log/servers/Game/  + FILENAME=startup  + EXT=.log  ++ date +%d-%m-%Y  game.sh: line 5: date: command not found  + DATE=  + NEWFILE=/var/log/servers/Game/startup_.log  + echo /var/log/servers/Game/startup_.log   I don't understand why it would say the command doesn't work, when I can go to the main console and run date and get a valid response.  Any help is greatly appreciated! Proof: $\det\pmatrix{\langle v_i , v_j \rangle}\neq0$ $\iff \{v_1,\dots,v_n\}~\text{l.i.}$ How do I get:  $$\cos{\theta} \lt \frac{\sin{\theta}}{\theta} \lt 1$$ Rules for forming demonyms Are there specific rules / conventions at play when creating demonyms? Or are they merely formed organically over time - the most popular winning out?  There are many suffixes to choose from, but I cannot find concrete guidelines as to which is proper to use in which instance. After reading an article about Ubuntu's netflix support I decided to try running netflix through chromium but I got this error code: M7063-1913 I assumed that it was a problem with html5 but in the playback preferences it doesn't give me the option to use it. Limit $ a_{n+1} = \frac{1}{3}(2a_n + \frac{5}{a_n^{2}}), a_1 > 0 $ Let $ a_{n+1} = \frac{1}{3}(2a_n + \frac{5}{a_n^{2}}), a_1 &gt; 0 $. Show the sequence converge and find it's limit.    I did the following:  We see that $a_n$ is positive for every n obviously (considering $a_1 &gt; 0$). Then:  $$ a_{n+1} - a_n = \frac{2a_n^{3} + 5}{3a_n^{2}} - a_n = \frac{5 - a_n^{3}}{3a_n^{2}}$$  We see that for each $a_n &gt; ^3\sqrt{5}$ the sequence is decreasing. That means the proof collapses to prove  $a_n &gt; ^3\sqrt{5}$ in order for $a_n$ to be decreasing. Suppose $ a_n &gt; ^3\sqrt{5}$ then obviously $a_{n+1} = \frac{2a_n^{3} + 5}{3a_n^{2}} &gt; \frac{2(\sqrt[3]{5})^{3} + 5}{3(\sqrt[3]{5})^{2}} = \sqrt[3]{5}$ so we deduced $a_{n+1} &gt; ^\sqrt[3]{5} $.  (It's important to note $a_1$ might be less then $\sqrt[3]{5}$, hence the sequence will decrease from the second element.) So we observed $a_n$ is always positive and decreasig hence it's bounded below so it's bounded. As for it's limit:   $$\begin{align} L = \lim_{n \to \infty} a_{n+1} = \lim_{n \to \infty} \frac{1}{3}(2a_n + \frac{5}{a_n^{2}}) = \frac{1}{3}(2L + \frac{5}{L^{2}}) =  \sqrt[3]{5}\end{align}$$  I'm not sure as of the correctness of the solution. I'm aware that it's not a contradiction because it only implies it's in the epsilon-environment of $\sqrt[3]{5}$, or rather in this case $(\sqrt[3]{5}, \sqrt[3]{5}+\epsilon)$.  Is it correct?  EDIT: If anyone encounter a question in the likes, to sum it up you obviously should show the sequence is montonic and bounded. In this case for example we can show it using AM-GM inequality to see the sequence is bounded by $\sqrt[3]{5}$ and then in the difference of two consequective elements we see the difference is negative due to every element being greater then the third root of 5. From here we know the sequence is bounded below and decreasing hence it's bounded. If we plug in the limit of the sequence to itself we will see it's the third root of five. And that's it. I wish to calculate the volumes of a truncated cone whith asymetry over all axes and ellipses as base and top - how do I do that?  I have height and radii of the corresponding ellipses. (I assume correctly I need the geometric means of the 2 radii describing the ellipsis.)  Kind Regards Is there a way to search the latest version of every file in TFS for a specific string or regex? This is probably the only thing I miss from Visual Source Safe...    Currently I perform a Get Latest on the entire codebase and use Windows Search, but this gets quite painful with over 1GB of code in 75,000 files.    EDIT: Tried the powertools mentioned, but the "Wildcard Search" option appears to only search filenames and not contents.  UPDATE: We have implemented a customised search option in an existing MOSS (Search Server) installation. If $f(x + y) = f(x) + f(y)$ showing that $f(cx) = cf(x)$ holds for rational $c$ For $f:\mathbb{R}^n \to \mathbb{R}^m$, if $f(x + y) = f(x) + f(y)$ for then for rational $c$, how would you show that $f(cx) = cf(x)$ holds?  I tried that for $c = \frac{a}{b}$, $a,b \in \mathbb{Z}$ clearly  $$ f\left(\frac{a}{b}x\right) = f\left(\frac{x}{b}+\dots+\frac{x}{b}\right) = af\left(\frac{x}{b}\right) $$ but I can't seem to finish it, any help?