infinite-loop

How to fix the endless printing loop bug in Nevrona Rave

Nevrona Designs' Rave Reports is a Report Engine for use by Embarcadero's Delphi IDE. This is what I call the Rave Endless Loop bug. In Rave Reports version 6.5.0 (VCL10) that comes bundled with Delphi 2006, there is a nortorious bug that plagues many Rave report developers. If you have a non-empty dataset, and the data rows for this da...

infinite loop in c++

I'm learning C++ and writing little programs as I go along. The following is one such program: // This program is intended to take any integer and convert to the // corresponding signed char. #include <iostream> int main() { signed char sch = 0; int n = 0; while(true){ std::cin >> n; sch = n; std::cout << n << " -->...

Detecting infinite loop in brainfuck program

I have written a simple brainfuck interpreter in MATLAB script language. It is fed random bf programs to execute (as part of a genetic algorithm project). The problem I face is, the program turns out to have an infinite loop in a sizeable number of cases, and hence the GA gets stuck at the point. So, I need a mechanism to detect infinite...

Have you ever written an infinite loop that made it into production?

I was reading today about every 30 GB Zune failing at exactly the same time. As it turns out, the cause is probably an infinite loop that will only appear on the 366th day of a leap year (see this write-up). So just curious...have you ever written an infinite loop that made it all the way to production without being detected? ...

Java, infinite while loop, incrementation

Hello, in the following example program in Java, I get infinite loop, and I cannot understand why: public class Time { public static int next(int v) { return v++; } public static void main(String[] args) { int[] z = {3, 2, 1, 0}; int i = 1; while(i < 4) { System.out.println(z[i]/z[i]); i...

VB.NET Infinite For Loop

Is it possible to write an infinite for loop in VB.NET? If so, what is the syntax? ...

How to have a FileSystemWatcher thread run forever?

I need to have a FileSystemWatcher run in an infinite loop to monitor a file for changes, but this file will only change every few days, and maybe only once a week. In the MSDN sample of a FileSystemWatcher, there is a loop while the user doesn't enter q at the console: while(Console.Read()!='q'); I don't want this to be constantly a...

Infinite loop while traversing XML in Actionscript 3

Hello, I've narrowed down the code to this (ignore the colourization): var theXML:XML = <xml> word </xml>; for each (var i:XML in theXML.*) { trace(i); } For some reason, this prints out "word" over and over indefinitely. Any thoughts as to why? I'm a bit out of practice and have a feeling it's something obvious...

Why is this looping infinitely?

So I just got my site kicked off the server today and I think this function is the culprit. Can anyone tell me what the problem is? I can't seem to figure it out: Public Function CleanText(ByVal str As String) As String 'removes HTML tags and other characters that title tags and descriptions don't like If Not String.IsNullOrEmpty(s...

How can I avoid this infinite loop?

It feels like there must be some semi-simple solution to this, but I just can't figure it out. Edit: The previous example showed the infinite loop more clearly, but this gives a bit more context. Check out the pre-edit for a quick overview of the problem. The following 2 classes represent the View-Models of the Model View View-Model (...

Are endless loops in bad form?

So I have some C++ code for back-tracking nodes in a BFS algorithm. It looks a little like this: typedef std::map<int> MapType; bool IsValuePresent(const MapType& myMap, int beginVal, int searchVal) { int current_val = beginVal; while (true) { if (current_val == searchVal) return true; MapType::i...

Why does Java toString() loop infinitely on indirect cycles?

This is more a gotcha I wanted to share than a question: when printing with toString(), Java will detect direct cycles in a Collection (where the Collection refers to itself), but not indirect cycles (where a Collection refers to another Collection which refers to the first one - or with more steps). import java.util.*; public class Sh...

C# WinForms: Waiting for a button press inside an infinite loop

I'm making a simple Guess-The-Number game with a GUI. I need to wait on a loop waiting for the user to input a number in a text box and press "OK". How do I wait for an event inside a loop? Note: I don't want message boxes. This is done in the main window, hence the need to wait for input. EDIT: I should have explained myself better. I...

How to detect an infinite loop in a recursive call?

I have a function that is recursively calling itself, and i want to detect and terminate if goes into an infinite loop, i.e - getting called for the same problem again. What is the easiest way to do that? EDIT: This is the function, and it will get called recursively with different values of x and y. i want to terminate if in a recursi...

What is the best way to make a bouncing ball animation with infinite loop on iPhone?

Hi, I am developing an iPhone game in which birds bounce like in this game: http://www.students.uni-mainz.de/rathb000/Fillit/Game.html I have set up the images for animating the wings of the flying bird like this: [imgBird[i] setAnimationImages:birdArrayConstant]; [imgBird[i] setAnimationDuration:1.0]; [imgBird[i] startAnimating]; ...

Looping a PHP Script

I've got a PHP script that checks a directory and deletes any files not modified within 15 seconds (It's for a game). My problem is how to get this script to run all the time. I set up a cron job to run every 10 minutes and then in the PHP script I have an infinite loop with a sleep(10). My thought was that it would run the code every 1...

How to debug, and protect against, infinite loops in PHP?

I recently ran up against a problem that challenged my programming abilities, and it was a very accidental infinite loop. I had rewritten some code to dry it up and changed a function that was being repeatedly called by the exact methods it called; an elementary issue, certainly. Apache decided to solve the problem by crashing, and the...

Php for loop with 2 variables?

Hi, is it possible to do this? (here is my code) for ($i = 0 ; $i <= 10 ; $i++){ for ($j = 10 ; $j >= 0 ; $j--){ echo "Var " . $i . " is " . $k . "<br>"; } } I want something like this: var 0 is 10 var 1 is 9 var 2 is 8 ... But my code is wrong, it gives a huge list. Php guru, help me !! ...

How can Replace infinite loop?

I am working on some rather inefficient C# code that wants to remove blanks lines. It does this: string b; ... while ( b.IndexOf("\n\n") >= 0 ) b = b.Replace ("\n\n", "\n"); A single replace would not cope with (e.g.) \n\n\n in the input, so the loop is needed. I think it ought to work, and it usually does. But...

How to avoid infinite loops in the .NET RegEx class?

Got a simple task to get a XPath expression and return a prefix that matches the parent of the node that (might be) selected. Example: /aaa/bbb => /aaa /aaa/bbb/ccc => /aaa/bbb /aaa/bbb/ccc[@x='1' and @y="/aaa[name='z']"] => /aaa/bbb Because the patterns inside the square brackets might contain brackets within quotes, I d...