import time stop_time = time.time() + 5 #5 seconds while time.time() &lt; stop_time:     for i in range(1000000):         print(i)         for x in range(654165):             print(x)   How to stop this loop after 5 seconds?
Given the following code (that doesn't work):  while True:     #snip: print out current state     while True:         ok = get_input("Is this ok? (y/n)")         if ok.lower() == "y": break 2 #this doesn't work :(         if ok.lower() == "n": break     #do more processing with menus and stuff   Is there a way to make this work? Or do I have do one check to break out of the input loop, then another, more limited, check in the outside loop to break out all together if the user is satisfied?
I noticed that if I transfer a few large files between two hard drives, it's pretty speedy, at around at least 30&nbsp;MB per second, but if I transfer thousands of files less than 5&nbsp;KB, it is pretty damn too slow.. around 1 to 2&nbsp;MB per second.   Is there a way to speed up the copy/paste process with thousands of small files on Windows 7? How can I add a Login link to the "Main navigation" menu?  When a user clicks on the link, it should take them to the /user/login page. Once they login, the link should change to say "Logout" instead of "Login".  Is there any way to add such a link? Is it acceptable to say "We'll get back to you as quick as we can"? Is "quick" a flat adverb in this case? Can someone explain this trigonometric limit? I have $$\lim \limits_{x\to 0}  \frac {\tan(2x)}{\sin(x)}$$ and in my case the result is $\frac{2}{1}$ =2 not whether it is right.  This is my procedure.  $$\lim \limits_{x\to 0}  \frac{\frac {\sin(2x)}{\cos(2x)}}{\frac{\sin(x)}{1}}= \lim \limits_{x\to 0}  {\dfrac {\sin(2x)}{(\cos(2x))(\sin(x))}}=\dfrac{2x\frac {\sin(2x)}{2x}}{\cos(2x)\frac{x\sin(x)}{x}}$$  I separate the limit.  $$\frac{\left(\lim \limits_{x\to 0}2x\right) \cdot \left(\lim \limits_{x\to 0}\frac {\sin(2x)}{2x}\right)}{\lim \limits_{x\to 0}\left(\cos(2x)\right)\cdot\left(\lim \limits_{x\to 0}\frac{x\sin(x)}{x}\right)} = \lim \limits_{x\to 0} \dfrac{2x}{x}=\frac{2}{1} =2$$ I'm trying to set an alias for sudo !! in Bash. I tried alias sbb='sudo !!', but it interprets that as a literal  !! and prints   sudo: !!: command not found   If I use double quotes, it substitutes the double bang in the string itself, so that doesn't work.  Is there any way to make this work? Or an alternative alias? ` Resize image proportionally with CSS? Protagonist becomes the avatar of an alien deity and has to cope with adversary god I read this at least 20 years ago, and I believe it was originally published in the '60s.   The main character is a human, but somehow "inherits godhood" from an alien, whose species is very long lived. IIRC this is one of the old-style god thingies, i.e. "god of thunder" not "omniscient omnipotent omnipresent transcendent being".  The plot somehow revolved around identifying and fighting some enemy which, I believe, was in turn a member of the alien species who acted as the avatar of the opposite god in the alien pantheon.  The only thing I remember for sure is that the enemy was identified as "green green" or "gringrin" (sadly, I read this in translation so I am not sure what the original meant) Simple enough question. Why not use a  in a target circuit or anyone's target circuit? What are the reasons not to use it? What might be the reasons to still choose this part? I am writing a novel and fairly new to using LaTeX.  Please bare with me if this is a silly question.  I am working off of the novel demo LaTeX file using the TexWorks software.  I have inserted my words into the file.  When I run the LaTeX code, I get the error message saying "! LaTeX Error: File `novel.cls' not found."  Do I need to download this file from somewhere?  If so, where can I get it? How to load and parse SVG documents Have Kylo Ren's Force abilities been shown before? I'm only familiar with the movies, so in The Force Awakens I saw some use of the Force that was new to me.  Most notable were these two abilities:      freezing blaster bolts in mid-air, and directly reading someone's mind like he tried with Rey.   Have either of these happened before? What is the best choice for .NET inter-process communication? Should I use Named Pipes, or .NET Remoting to communicate with a running process on my machine? Name lookups in C++ templates Best location for theme translation files I usually store language files in /languages folder that is located in theme folder and it's also recommended location by WordPress as well. However, it still doesn't look like the best solution because files will be overwritten after theme updates.  load_theme_textdomain function allows to specify a different location and I've been thinking to put languages folder inside of /uploads folder in order to prevent overwriting after theme updates. That folder will be created right after theme activation and language files will be copied there.  My question is, do you think this is a good solution or there is a better way that I'm missing?  I appreciate your insight about this matter. RegEx: Grabbing values between quotation marks I have a value like this:  "Foo Bar" "Another Value" something else   What regex will return the values enclosed in the quotation marks (e.g. Foo Bar and Another Value)? Equivalent statement of AC or not? Here's a corollary of AC stating that: if there exists an onto mapping $f:A\to B$, then there exists a 1-1 mapping $g:B\to A$. What I'm confused about is that whether or not  AC can be derived from this proposition, in return? I have tried but haven't found a proof. Any help would be appreciated. My English teacher feels very strongly that exact same is redundant and therefore incorrect. I disagree with her.  She feels that exact should be used in place of exact same, but I have rarely heard someone use exact by itself. For example:     I have the exact same shirt   I have the exact shirt   In the same manner, I believe that she shuns exactly the same as well.  What support is there (if any) supporting the use of exact same or exactly the same? What proof can I provide for using exact same when challenged? How to use downloaded fonts with pdfLaTeX on Ubuntu I want to use the  font in my pdfLatex document.  What steps should I do for using a downloaded font   Should I download the TTF or the OpenType version? Where should I store the font? Should any font processing be done? How can pdfLatex find this font?   I am using TexLive 2011 installed in a custom location (/somepath/texlive/2011) on Ubuntu I would like to manipulate the HTML inside an iframe using jQuery.  I thought I'd be able to do this by setting the context of the jQuery function to be the document of the iframe, something like:  $(function(){ //document ready     $('some selector', frames['nameOfMyIframe'].document).doStuff() });   However this doesn't seem to work. A bit of inspection shows me that the variables in frames['nameOfMyIframe'] are undefined unless I wait a while for the iframe to load. However, when the iframe loads the variables are not accessible (I get permission denied-type errors).  Does anyone know of a work-around to this? Extreme cursor delay with Acer Aspire E15 on Ubuntu 16.04 Occasionally my laptop will enter a state where the cursor starts lagging so bad that it's unusable.  Oddly during this state, everything other than the cursor is still completely responsive.  I.e. anything that only involves the keyboard (opening a terminal, typing, etc) is unaffected.  Once it enters this state, on successive reboots and shutdowns it re-enters this state within seconds.  However, if I shutdown and leave it alone for a few minutes, it does not immediately re-enter this state.  Based on search results for "acer aspire ubuntu freeze" I have tried setting the intel_idle_max_cstate field in grub to 0, 1, and 2, but this did not seem to help.  To be clear - I am not experiencing any crashes, the system is completely responsive except for the cursor is delayed to the point where it would take several seconds to go from one edge of the screen to the other.