Questions tagged [infinite-loop]

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.

3528 questions
1
vote
1 answer

Javascript 'console' infinite loop

I'm experimenting with javascript programs and I hit a snag. The program suddenly lags my browser (infinite loop maybe), dunno why. function fullscreen() { if (document.body.requestFullScreen) {document.body.requestFullScreen();} else if…
m93a
  • 8,866
  • 9
  • 40
  • 58
1
vote
1 answer

I want to use a anonymous function inside an object

I have this code for a newsfeed that I want to use. I want it to look kind of like this: function News(){ //Load new comments every 5 sec setTimeout((function(){ console.log(this); //Returns Object #News …
Muqito
  • 1,369
  • 3
  • 13
  • 27
1
vote
2 answers

CakePHP Login Infinite Redirect

I have looked at quite a few similar issues on SO but none have answered my question or been able to help me resolve this... Basically when i comment out the $this->auth->allow line in the NewsController (because i only want authenticated people to…
medoix
  • 1,189
  • 2
  • 16
  • 36
1
vote
1 answer

image arrays using JavaScript

I need help creating image arrays using JavaScript. I need to create an array of images to cycle through using their src attribute to cycle through them. Then the images need to be cycled to the next and previous buttons. the images must loop…
Ingrid
  • 11
  • 2
1
vote
1 answer

crash proof scanner--infinite loop error (beginning java)

So this is my code for a crash proof scanner class: import java.util.*; public class BPScanner { Scanner kb = new Scanner(System.in); public int nextInt() { while (true) { try { String input =…
Le Dude
  • 47
  • 1
  • 5
1
vote
1 answer

Using the now() function and executing triggers

I am trying to create a trigger function in PostgreSQL that should check records with the same id (i.e. comparison by id with existing records) before inserting or updating the records. If the function finds records that have the same id, then that…
theuserkaps
  • 300
  • 2
  • 6
  • 15
1
vote
0 answers

Infinite loop in custom VirtualPathProvider causing IIS Crashes

Our IIS is crashing at regular intervals and we have made a crash dump through DebugDiag that we are investigating. The exception code is always e053534f which I believe is a stack overflow so have been looking at the stacktraces to find an…
LarsHJ
  • 205
  • 1
  • 11
1
vote
1 answer

Why does cin.clear() fix an infinite loop caused by bad input to cin?

I've written a switch statement, and created a default which would simply say the user picked a bad option and repeat the input. I wanted to make sure that if there was an issue, it would clear the buffer first, so I used cin.sync(), but entering an…
Daniel B.
  • 1,254
  • 1
  • 16
  • 35
1
vote
2 answers

issue with multiple methods and infinite loop happening

i am writing a program that needs to have 5 methods other than main each method does something specific, main calls all other methods outputs warning to users about incorrect input, second method just pulls main input of how many variables user…
1
vote
6 answers

Why is this while loop infinite? JavaScript appendChild

I swear this was just working fine a few days ago... elm = document.querySelectorAll(selector); var frag = document.createDocumentFragment(); while (elm[0]){ frag.appendChild(elm[0]); } Right, so, this should append each node from our elm node…
Randy Hall
  • 7,716
  • 16
  • 73
  • 151
1
vote
1 answer

jQuery addClass removeClass with timer

I have an issue with a 'Latest News' module. Please have a look at http://www.proudfootsupermarkets.com/ to see an example of the module (it's the div close to the top of the page which has a large image in it). At the moment I have it set up so…
user1817708
  • 45
  • 1
  • 1
  • 6
1
vote
1 answer

infinite while loop, .nextLine() user input

Hi I have a question regarding the use of .nextLine and why it skips user input the second time around during the infinite loop. The .next function (letter input) still asks for user input everytime but the .nextLine function (phrase input) does…
user1798299
  • 173
  • 2
  • 4
  • 12
1
vote
3 answers

Odd behavior with Perl system() command

Note that I'm aware that this is probably not the best or most optimal way to do this but I've run into this somewhere before and I'm curious as to the answer. I have a perl script that is called from an init that runs and occasionally dies. To…
1
vote
3 answers

For loop input in BlueJ (infinite loop)

I'm working on a project for school and am stumped at where I am at the moment. When I run my project, the VM seems to be stuck in a loop and will not load (A console should pop up allowing me to input characters for the CombinationLock class…
Josh Ferrara
  • 757
  • 2
  • 9
  • 25
1
vote
4 answers

Why are while and do-while loops preferred over for loops when looping infinitely?

I'm new to programming and am in my first year of computer science and am a bit confused about loops. When it comes to infinite loops, why are while and do-while loops preferred over for loops? I created a simple infinite for loop and it's just as…
Cucko Oooo
  • 91
  • 4
  • 14
1 2 3
99
100