FAQ Database Discussion Community


Endless Loop Error at Runtime

c#,arrays,unity3d,infinite-loop
What I'm attempting to do in this program is create a 3 dimensional array of GameObjects with the tag "Cube". When I created the array cb, the cubes were out of order by name (each is named corresponding to its location in a composite unity 3d cube, ex: Cube000, Cube102)....

C code to read a text file does not find EOF (end of file)

c,text-files,infinite-loop,eof
I've wrote this short code to read a text file and copy its information to a new txt file, but doing some character substitution in the process. My problem is, the code does all the job it is supposed to do but it doesnt end. It cant find the EOF...

ActiveAdmin Devise Cancancan and Three User Models — infinite loop

ruby-on-rails-4,devise,activeadmin,infinite-loop,cancancan
I'm currently running three user models. Staff, customers and suppliers. Each has a devise model and I can seem to nail how to authorize only Staff to get to the activeadmin pages. I have managed to get one Model to access it but then the other two go into a...

What's the difference between these two codes to get the sum of infinite series in MATLAB?

matlab,while-loop,infinite-loop
1 + 1/(2^4) + 1/(3^4) + 1/(4^4) + ... This is the infinite series that I'd like to get the sum value. So I wrote this code in MATLAB. n = 1; numToAdd = 1; sum = 0; while numToAdd > 0 numToAdd = n^(-4); sum = sum +...

VB.NET redirection loop error

asp.net,redirect,webforms,infinite-loop,response.redirect
I have the following code on my multilingual website: (MasterPage.master.vb) Dim pageUrl As String = HttpContext.Current.Request.Url.AbsolutePath Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Dim strLanguage As String = Session("Language") If Not IsPostBack Then Response.Redirect(String.Format("{0}?Language={1}", pageUrl, strLanguage)) End If Response.Write(String.Format("{0}?Idioma={1}", pageUrl, strLanguage)) End Sub It will display the...

Check function going into infinite loop and segmentation fault

c++,segmentation-fault,infinite-loop
void InputStatisticalData() { //variables declaration cout << "\n[Here to take in data]" << endl; //cin data while (exit == false) { cout << "Entered Loop" << endl;//for troubleshooting purpose cout << "CountCheck: " << countcheck << endl;//for troubleshooting purpose if (!Vector.empty()) { cout << "Entered Vector check IF" << endl;//for...

Laravel 5 redirect loop error

php,redirect,laravel-5,infinite-loop,middleware
I trying to make a login and admin script, the problem is that I have a redirect loop I dont know why. I want the login users and can be in the / path not /home. If change return new RedirectResponse(url('/')); to return new RedirectResponse(url('/anotherpage')); it works but I want...

Counting array reference input and displaying count — infinite loop

java,infinite-loop
I am trying to display the occurrence of how many times an integer occurs in an array but I get an infinite loop/logic error. For instance, if the user enters: 2, 5, 6, 5, 4, 3, 23, 43, 2, 0 then it should display: 2 occurs 2 times 3 occurs...

Infinite recursion in PHP echo statement

php,recursion,infinite-loop,tostring
Why does this code cause an infinite recursion? class Foo { public static function newFoo() { return new Foo(); } public function __toString() { return "{${Foo::newFoo()}}"; } } echo new Foo(); // Infinite recursion new Foo(); // Finishes normally Is this because __toString() is returning an object? But that can't...

Visual basic 2008 - Do…While until infinite loop when shuffling 52 card deck

vb.net,visual-studio-2008,boolean,infinite-loop,do-while
I'm starting to make a Hearts game in VB2008. Currently I'm stuck with the dealing: For q = 0 To 51 Do Randomize() dealrand = Int(Rnd() * 51) cards(q).Image = pics(dealrand) Loop Until dealused(dealrand) = False dealused(dealrand) = True Next What I'm trying to do is check if the card...

c#: Self referencing object conversion [closed]

c#,converter,infinite-loop,self-reference
I have a self referencing object, which I need to converted from one to another object which is similar. I'm unable to find suitable method to do the convert with recursion without leading into an infinite loop. Any help would be appreciated.Still learning my ropes in c# Object 1: public...

Infinite loop without accepting input

c++,infinite-loop,heap-memory
I am writing a simple C++ Program which allocates dynamic memory to my Program and then deletes this memory. Here is my Program: #include <iostream> #include <new> using namespace std; int main () { int i,n; int * p; cout << "How many numbers would you like to type? ";...

JavaScript: infinite loop, or not?

javascript,angularjs,infinite-loop
In my function I'm looping through a tree looking for a specific attribute in a node. The function is called recursively and stops when the attribute is found or when there are no more nodes in the tree. However when I run the function it goes into what I assume...

Iterating over object results in infinite loop

javascript,object,recursion,iterator,infinite-loop
I have an object that I am trying to recursively iterate over, but get stuck in an infinite loop. I suspect that the issue is that the variable i in my for loop does not increase, but why? My code: var failsafe = 0; function iter(obj) { for (i =...

Infinite loop seems to confuse Scala's type system

scala,infinite-loop,type-inference,return-type
Here is an artificial toy example that demonstrates my problem: def sscce(): Int = { val rand = new Random() var count = 0 while (true) { // type mismatch; found: Unit, required: Int count += 1 if (rand.nextInt() == 42) return count } } How can I help the...

Infinite loop detection

java,infinite-loop
I wonder if it is possible to detect and/or stop infinite loop with basic java knowledge. I got a school task(which considers our programming knowledge is on basic level) where we should take an input (int) from user and then take the sum of squares of the digits of that...

Why is this callback function being called infinitely?

javascript,recursion,infinite-loop
I'm recursively calling a function and its callback, the done() function, is being called infinitely and I don't know why. When I log i, it reaches the length of data and then the condition is met and it stops, but the done function is called infinitely. The done function is...

From bash script to bash script in infinite loop

bash,infinite-loop
A very simple example of the "just run once" version of my Script: ./myscript.sh var1 "var2 with spaces" var3 #!/bin/bash echo $1 #output: var1 echo $2 #output: var2 with spaces echo $3 #output: var3 Working as intended! Now I try to just start the script and enter the vars in...

AJAX POST 500 INTERNAL SERVER ERROR

php,ajax,wordpress,nginx,infinite-loop
I just finished creating infinite loop for my wordpress blog, It's working great on my local PC( WAMP), but when I put it online (nginx server) its showing POST http://www.siteurl.com/infinite-loop.php 500 Internal Server Error Infinite_loop.php <?php $infinite_loop= $_POST['pcount']; ?> <?php require_once("/wp-blog-header.php"); ?> <div class="x-container-fluid max width main"> <div class="offset cf">...

Java Swing Timer infinite loop

java,swing,timer,actionlistener,infinite-loop
I'm having an issue with a simple Java swing Timer I set. It does everything fine up until having to stop. I think it is creating an infinite loop of timers upon timers but I've been following multiple tutorials and I can't see where I have gone wrong. Code explanation:...

Holo Calendar crashes when using Calendar.SATURDAY as last day of week

java,android,calendar,out-of-memory,infinite-loop
I am using Holo Calendar library. It is a large amount of code, and so I cannot include it in this thread. Hopefully someone will see this who has used it, but the library is free and there is a link at the bottom of the page to a completed...

function keeps asking for input

python-3.x,infinite-loop
The function I've written draws either a square, triangle or a rectangle. it asks the user to input which shape they want to be drawn. if the the input is not one of the following, it re-asks the user to enter a valid input: Valid inputs square, triangle, rectangle, q...

Python - Infinite loop script running in background + restart

python,infinite-loop,kill
I would like to have a python script that runs in background (infinite loop). def main(): # inizialize and start threads [...] try: while True: time.sleep(1) except KeyboardInterrupt: my.cleanup() if __name__ == '__main__': main() my.cleanup() In order to have the application run constantly in infinite loop what is the best...

infinite loop with changing timeouts

javascript,node.js,loops,infinite-loop
I have an array that contains time windows. For a simple case I'm making these 10 second windows as follows, (In the begging the current time will be inside window 1) var now = new Date(); windowList = [ { id: 1, start: new Date().setSeconds(now.getSeconds() - 5), end: new Date().setSeconds(now.getSeconds()...

PWC1232: Exceeded maximum depth for nested request dispatches: 20 at org.apache.catalina.core.ApplicationDispatcher.doInvoke

jsf,glassfish,infinite-loop,facesservlet
I am using jsf 2.1 (mojara) with glassfish 3.1 , and my web .xml looks like : <welcome-file-list> <welcome-file>NewFile.xhtml</welcome-file> </welcome-file-list> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.xhtml</url-pattern>...

Regex timing out

regex,timeout,infinite-loop
I'm trying to match something like foo: anything after the colon can be matched with (.*)+ foo.bar1.BAZ: balh5317{}({}( This is the regex I'm using: /^((?:(?:(?:[A-Za-z_]+)(?:[0-9]+)?)+[\.]?)+)(?:\s)?(?:\:)(?:\s)?((?:.*)+)$/ Excuse the non-matching groups and extra parens, this is being compiled from a builder class This works on the examples. The problem arises when I...

Never-ending quicksort

c,infinite-loop,quicksort,gcc4.9
I tried to implement a quicksort on arrays of int64_t like this: void quicksort (int64_t *array,size_t size) { int64_t *split; size_t i=0; size_t j=size-1; if (size>1) { split=({ int64_t p=array[0]; do { for (;array[i]<p;i++); for (;array[j]>p;j--); swap(array[i],array[j]); } while (i<j); swap(array[i],array[j]); swap(array[j],array[size]); &(array[j]); })-1; quicksort(array,j-1); quicksort(split+1,size-j); } return; } Which...

Find largest number from user input

python,python-2.7,while-loop,infinite-loop
I trying to make a code which print largest and smallest number from user input. I want that user can input the number until there is ValueError I have tried something like this: value = raw_input(">") largest_so_far = None smalest_so_far = None while(value): if value > largest_so_far: largest_so_far = value...

Read all lines with BufferedReader

java,bufferedreader,infinite-loop,inputstreamreader
I want to type a multiple line text into the console using a BufferedReader and when I hit "Enter" to find the sum of the length of the whole text. The problem is that it seems I'm getting into an infinite loop and when I press "Enter" the program does...

Endless Loop with localhost and not with domain

php,infinite-loop
A while ago I was working on a website that I was making for my self (not to publish it). Now I want to continue it, but what I get when I go to: localhost/Login/index.php it just redirects to: localhost/Login/logout.php And the page says it is an endless loop. Now,...

Infinite loop when calling the stack print function

c++,stack,output,infinite-loop
This program should takes a postfix arithmetic expression then compiles the values of that expression.. Each time an integer is read, its gonna get pushed into the stack.. Otherwise, Two integers would be popped if +,-,* is read. class Stack { Node *head; public: Stack() { head = NULL; };...

My While True loop is getting stuck in python

python,while-loop,raspberry-pi,infinite-loop,raspbian
Hello I have been working on an infinite While True loop for the main file in my python code. I am working on a Raspberry Pi and my goal is that whenever one of the GPIO Pins senses an input it will print out a string. However When I push...

How to fix infinite loop error?

php,.htaccess,mod-rewrite,laravel,infinite-loop
I have a script, and it is preventing me from accessing urls such as example.com/hi that are not part of the script. How can I add an exception so that these urls work? This is my htaccess right now. Options -MultiViews RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1...

VBA - UserForm with multiples TextBoxes in infinite calculation loop

vba,excel-vba,textbox,infinite-loop,userform
I have an UserForm with 5 TextBoxes, and each time one is updated I recalculate the others. But how do I avoid a "infinite loop" as the first will recalculate second which will recalculate the first and so on... Here is a part of my UserForm's code, only the TextBox_Change(s)...

Infinite loop during CGAL::Delaunay_triangulation_3

c++,infinite-loop,triangulation,cgal,delaunay
I am using the CGAL library for triangulating a 3D point-cloud. Some times the application works fine, but most of the time it gets stuck. It enters an infinite loop while inserting a new 3D point in the triangulation. This problem I get only on Windows, on Linux it works...

Prolog - Avoid Infinite Loop

prolog,infinite-loop
I am currently studying logic programming, and learn Prolog for that case. We can have a Knowledge Base, which can lead us to some results, whereas Prolog will get in infinite loop, due to the way it expands the predicates. Let assume we have the following logic program p(X):- p(X)....

Infinite loop heisenbug: it exits if I add a printout

c++,floating-point,infinite-loop
This is my source code: #include <iostream> #include <cmath> using namespace std; double up = 19.0 + (61.0/125.0); double down = -32.0 - (2.0/3.0); double rectangle = (up - down) * 8.0; double f(double x) { return (pow(x, 4.0)/500.0) - (pow(x, 2.0)/200.0) - 0.012; } double g(double x) { return...

How could this code enter an infinite loop? aka how to implement a counter in Haskell?

haskell,counter,infinite-loop
I have this code inside a function with side effects ... -> IO() let index_player = (-1) dronePositionByPlayer <- replicateM nb_players $ do let index_player = index_player + 1 dronePositions <- replicateM nb_drones $ do input_line <- getLine let input = words input_line let dx = read (input!!0) :: Int...

Quick Sort infinite loop Numerical Recipies

c++,c,sorting,infinite-loop
I am trying to export some code from MATLAB to MEX files (a.la C). For the code segment i am trying to export i need to implement an algorithm that can sort a 2D array. Opening up a copy of numerical recipes i find the index based sort. I have...

Infinite Loop with execvp in C

c,shell,fork,infinite-loop,execvp
This program is supposed to be shell which executes commands entered by the user. My program worked fine until I made it accept flags as well as commands. Now, the program loops infinitely at execvp. Any command entered will do this(I've primarily been testing with ls -l). If it matters,...

Why is my code entering an infinite loop when using AJAX?

javascript,ajax,infinite-loop
I am using these two functions to try to add a customer and an order to my database. The problem im having is that i want to execute add customer, and then addOrder but when i try it this way, it enters an infinite loop. function addCustomer(){ customer = localStorage.getItem('customer');...

Why is this loop infinitely repeating?

c,while-loop,infinite-loop
The purpose of this program is to count the digits in an alphanumeric input. However, I used a loop to not execute the program unless the input is alphanumeric. This is the code: #include <stdio.h> #include <stdlib.h> #include <math.h> #include <ctype.h> int main(){ int input,isanum,digitcount; printf("\nEnter a number: "); scanf("%d",&input);...

CLIPS incrementing variable without endless loop

infinite-loop,clips,expert-system
I would greatly appreciate some assistance with my CLIPS project. Okay so I'm attempting to create a dog breed adviser. The deftemplate looks like this: (deftemplate breed (multislot name) (slot size) (slot type-owner) (slot Living_Space) (slot children) (slot grooming) (slot exercise) (slot noisiness) (slot trainability) (slot aggression) (slot playfulness) (slot...

Ruby Infinite While Loop

arrays,ruby,infinite-loop
My goal is to take each element in multidimensional array, create 12 copies that will be processed (without changing the original value), append the processed values to the array, and repeat if necessary to meet the total number of desired values: total = 4 arr = Array.new(1) { Array.new(3, 127.5)...

Java infinite loop performance

java,multithreading,performance,infinite-loop
I have a Thread that only has to work when a certain circumstance comes in. Otherwise it just iterates over an empty infinite loop: public void run() { while(true) { if(ball != null) { // do some Calculations } } } Does it affect the performance when the loop actually...

How detect infinite loop in Java?

java,infinite-loop
I run a Java program, and it doesn't ends in a long time. I guess it may be a infinite loop in the code, but I can't see the code(can't modify it). How to judge it's in a infinite loop or not? It's an interview question and my answer is...

Ternary Operator in For Loop causing infinite iterations

c,for-loop,infinite-loop,ternary-operator,operator-precedence
I was working on a function to transpose an NxN matrix which is stored in an array of floats. My first implementation seemed to cause the function to loop infinitely and I can't seem to figure out why. Here is the original code: for(int i = 0; i < numRows...