An "infinite loop" is a loop in which the exit criteria are never satisfied; such a loop would perform a potentially infinite number of iterations of the loop body. The general problem of determining whether the execution of a loop with given preconditions will result in an infinite loop is undecidable; in other words, there is no algorithm to determine whether an execution of a loop will eventually terminate. This is known as the halting problem.
Questions tagged [infinite-loop]
3528 questions
1
vote
1 answer
How to interrupt an infinite loop on Python under the Enthought Canopy enviroment?
I do not know how to interrupt an infinite loop on python 2.7 running through Canopy on a Windows 7 OS. Ctrl+C doesn't work, "Interrupt Kernel" under the "Run" menu also never seems to work. On linux (ubuntu) the keyboardinterrupt ctrl+c works just…

Frâncio Rodrigues
- 2,190
- 3
- 21
- 30
1
vote
1 answer
While Loop Through An Array
Creating a block builder that loops through blocks pulled form database in order.
if( loop_blocks()) {
while( loop_blocks()) {
if( have_block('standard-content-block')) {
echo 'standard-content-block';
}
…

user2759865
- 235
- 2
- 16
1
vote
1 answer
Scheme (Racket) Properly written function not working with some inputs
So I have written I function in racket that calculates Sums:
(define (sum term a next b)
(if (> a b)
0
(+ (term a) (sum term (next a) next b))))
Term is what function is applied to every argument. A is the beginning next is how we…

MitakaJ9
- 191
- 1
- 2
- 11
1
vote
1 answer
C - Nice way to terminate
Is there a nice way out of an infinite loop? (I tried catching a SIGINT, but it won't let me clean up before exiting)
I'm doing a client-server.
Each time a client connects, the server forks and designates a child to the client (this child will…

Leandro Libarona
- 147
- 2
- 11
1
vote
4 answers
Redirect loop issue in prestashop 1.6
I have installed Prestashop 1.6 in my local Wamp server and it was working fine. When I moved this shop to the actual online domain, it's showing as "This webpage has a redirect loop" in chrome and "The page isn't redirecting properly" in…

user2999253
- 81
- 2
- 2
- 9
1
vote
2 answers
While scanf EOF loop misbehaving
I'm a beginner in C, and I've got problem I can't figure out, and wasn't able to find a solution on other threads here.
I'm trying to read integers from a keyboard input/ txt file with the following code:
int grades[MAX_GRADES_LENGTH]={0},…

Avishay Cohen
- 19
- 1
- 4
1
vote
1 answer
Why are these mod_rewrite rules not working?
I have an .htaccess file that looks like the following:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?)/(\d+?)/?$ index.php?cmd=$1&num=$2 [L]
RewriteRule…

HartleySan
- 7,404
- 14
- 66
- 119
1
vote
3 answers
jquery infinite loop (to move a div position)
I have the following jquery code to move a rectangle from one place to another. It works.
jQuery(function ($) {
$(document).ready(function () {
loop_pos = function () {
var docHeight = $(document).height(),
…

colombo2003
- 121
- 9
1
vote
2 answers
How to trigger a function once, after focusin on input element?
I want to trigger a function only one time at focusin in a element input. The follow code calls the function in a infinite loop.
$(document).on("focusin",".dateRangeEducLev",function(e){
…

IgorAlves
- 5,086
- 10
- 52
- 83
1
vote
1 answer
infinite loop for listening to socket
I have an implementation where I listen to a port for events and do processing based on the input. I have kept it in a infinite loop. However it only works once and then I have to restart the program again. Does control never come back. Is this…

avinashkr
- 512
- 1
- 5
- 20
1
vote
1 answer
How avoid infinite loop during Json Serialization in Java
I retrieve a list of Brothers using hibernate
public class Brother {
public int brotherId;
public string name;
public List brothers;
public Brother()
{
brothers = new ArrayList();
}
//Getter…

UserMan
- 471
- 2
- 10
- 20
1
vote
0 answers
applescript with loop stops (on Yosemite) when user interacts with application
Forgive me if this turns out to be a dumb question, I've been writing cocoa apps for a long time but have only recently started to make them scriptable.
Scripting with this particular app is working well. But if the script has a loop like…

Shiela Dixon
- 13
- 2
1
vote
0 answers
Ruby Array Infinitely Referencing itself
A future classmate of mine brought this up a while ago, but we are all pretty new to ruby, and can't seem to find any explanation online. Hope someone here can explain.
As displayed in the image, when declare h as an empty array, and assigning the…

Firyn
- 312
- 3
- 15
1
vote
1 answer
Check if a list is made up of N instances of X (repeat X N times)
Given a query such as:
containsN(4,2,Z).
I should get: Z = [2,2,2,2].
or
containsN(4,W,[3,3,3,3])
I should get: W = 3.
So in other words, for the first example I need 4 instances of 2 in a list bound to Z.
For the second example I need the element…

user2962883
- 57
- 1
- 8
1
vote
3 answers
Prolog: Check if X is in range of 0 to K - 1
I'm new to prolog and every single bit of code I write turns into an infinite loop.
I'm specifically trying to see if X is in the range from 0 to K - 1.
range(X,X).
range(X,K) :- K0 is K - 1, range(X,K0).
My idea behind the code is that I decrement…

user2962883
- 57
- 1
- 8