infinite-loop

redirect into subdirectory AND out of subdirectory

hi folks i have a mod_rewrite redirection problem i cannot figure out. all requests from a specific domain get "silently" rewritten into a designated subdirectory. e.g. www.mydomain.net/hello.html retrieves the file in /net/hello.html. the following .htaccess (placed in my hosting root) achieves this perfectly: RewriteEngine on Rewrit...

Whats wrong with this while loop?

boolean r = false ; int s = 0 ; while (r == false) ; { s = getInt() ; if (!(s>=0 && s<=2)) System.out.println ("try again not a valid response") ; else r = true ; } The text never displays itself even when a 3 or a 123 is entered and the loop never terminates. Whats wrong here? ...

Dealing with infinite loops when constructing states for LR(1) parsing

I'm currently constructing LR(1) states from the following grammar. S->AS S->c A->aA A->b where A,S are nonterminals and a,b,c are terminals. This is the construction of I0 I0: S' -> .S, epsilon --------------- S -> .AS, epsilon S -> .c, epsilon --------------- S -> .AS, a S -> .c, c A -> .aA, a A -> ...

How to handle an "infinite" IEnumerable?

A trivial example of an "infinite" IEnumerable would be IEnumerable<int> Numbers() { int i=0; while(true) { yield return unchecked(i++); } } I know, that foreach(int i in Numbers().Take(10)) { Console.WriteLine(i); } and var q = Numbers(); foreach(int i in q.Take(10)) { Console.WriteLine(i); } both work fine (and ...

Find infinite loop in progress?

Is there a way to find out the current execution of the code to find out the infinite loop? I have the application running with the current source. I'm attached with the visual studio debugger. I just need to know where the code is currently at so that I can debug it further. ...

Is there any way to kill a setInterval loop through an Onclick button

Hey folks. So, I got an infinite loop to work in this function using setInterval attached to an onClick. Problem is, I can't stop it using clearInterval in an onClick. I think this is because when I attach a clearInterval to an onClick, it kills a specific interval and not the function altogether. Is there anything I can do to kill all i...

Help! I got a runaway PHP script. My server is down.

I got a PHP script that is looping and will continue to do so for about another hour. How do I stop it. The script explicitly overrides the time out and the memory buffer. It's on a shared hosting server with cPanel installed. The entire website is down until the script completes. I had added a usleep(100000) statement, but it doesn't a...

Infinite loop when adding a row to a list in a class in python3

I have a script which contains two classes. (I'm obviously deleting a lot of stuff that I don't believe is relevant to the error I'm dealing with.) The eventual task is to create a decision tree, as I mentioned in this question. Unfortunately, I'm getting an infinite loop, and I'm having difficulty identifying why. I've identified ...

Loading XML with possible infinite tags

(I'm doing this in AS3, but I'm sure the answer could be given in psuedocode) Basically, I have a XML file similar to: <Main> <Event> <Name>Blah</Name> <Event> <Name>Blah2</Name> <Event> <Name>Blah3</Name> ... </Event> </Event> </Event> </Main> Yeah, to some extent it's poor design. But the idea I'm going for...

What happens if a bean attempts to load the Spring application context in its constructor?

Given the following Spring application context and class A, what happens when you run class A? applicationContext.xml (in classpath): <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframew...

PHP: Infinity loop and Time Limit!

Hi, I have a piece of code that fetches data by giving it an ID. If I give it an ID of 1230 for example, the code fetches an article data with an ID of 1230 from a web site (external) and insert it into a DB. Now, the problem is that I need to fetch all the articles, lets say from ID 00001 to 99999. If a do a 'for' loop, after 60 second...

problems with infinite loop

function addAds($n) { for ($i=0;$i<=$n;$i++) { while($row=mysql_fetch_array(mysql_query("SELECT * FROM users"))) { $aut[]=$row['name']; } $author=$aut[rand(0,mysql_num_rows(mysql_query("SELECT * FROM users")))]; $name="pavadinimas".rand(0,3600); $rnd=rand(0,1); if($rnd==0) { $type="siulo"; } else { $type="iesko"; ...

Consequences of an infinite loop on Google App Engine?

I am not a Google App Engine user. However, I understand you're billed for CPU time and other resources. What are the consequences if you happen to create an infinite loop? Will Google ever terminate it, or will you have to do it yourself manually somehow? I'm a hobbyist developer worried about a small error that might end up costing hu...

Deselecting a form input and waiting for a function before submitting

I have a form with an input field where a user enters a unique identifier. I then have some jQuery code that upon the user moving away from the input field (blur) goes out and fetches details about the part and populates some fields on the page. The problem is if the user clicks the submit button before moving out of the input field the ...

Project Euler: Problem #5 in Ruby

I'm trying to solve Problem #5 in Project Euler. The code works for the example, when I check the numbers from 1 to 10 I get 2520 as a result, which is right. But when I check for the numbers from 1 to 20, the code doesn't stop running. Here it is: num = 0 while true num += 1 check = true for i in 1..20 break un...

Python: why does this code take forever (infinite loop?)

I'm developing an app in Google App Engine. One of my methods is taking never completing, which makes me think it's caught in an infinite loop. I've stared at it, but can't figure it out. Disclaimer: I'm using http://code.google.com/p/gaeunitlink text to run my tests. Perhaps it's acting oddly? This is the problematic function: def _t...

How can I test potentially "browser-crashing" JavaScript?

I've been having a crack at some of the problems over at http://projecteuler.net/ with JavaScript. I've been using a simple html page and running my code in script tags so I can log my results in the browsers' console. When experimenting with loops I sometimes cause the browser to crash. Is there a better environment for me to do this ...

Redirect with htaccess for images onto another server without redirect looping

Hey guys, I currently have a host where my main site is hosted on. I have set up nginx on another server to mirror/cache files being requested if it doesn't have it already, in particular images and flv videos. For example: www.domain.com is my main site. www.domain.com/video/video.flv www.domain.com/images/1.png I would like to as...

extraneous empty lines when reading from an ifstream

In my program, I've redirected stdout to print to a file 'console.txt'. A function writes to that file like this: void printToConsole(const std::string& text, const TCODColor& fc, const TCODColor& bc) { // write the string cout << text << "@"; // write the two color values cout << static_cast<int>(f...

Why does my Actionscript 3 program randomly get stuck in an infinite loop?

mBlocks is a 2-dimensional array of Block objects. Every time my application runs, it runs the InitGridNumbers function. Sometimes, it will get stuck in an infinite loop. Other times, it builds and runs without issues. public function InitGridNumbers():void { var tempRow:Array; var tempColumn:Array; var tempNum:int; for ...