infinite-loop

TCP Freezing with VB .Net

Hello, I made a game in VB .Net that uses tcp and sends messages back and forth. What is happening is, every so often, the message cannot be sent quickly enough, so then the TCPObj.connect() method goes into a loop, until it reaches the timeout and then spits out an error. Most of the time though, it never gets to the error, my applica...

Dynamically loading posts with Wordpress

This helpful idea from Andy Gaskell supports 50% of my next question: I'd like to load posts dynamically with WordPress. Fetching them with Andy's function does work, but How do I bind the load to each and every one of the posts? Can I insert PHP generated content (post permalink, for example) to the JS script? Thank you. ...

How to test that a method should take more than X seconds to finish(with JUnit)?

Basically I need the opposite behaviour of the @Test(timeout=X) annotation. The problem I want to solve is to detect in some way that the method never ends (as a right behaviour). I am assuming that if the method didn't stop after X seconds, I am sure "it will never end". Thanks! ...

for ( ; ; ) or while ( true ) - Which is the Correct C# Infinite Loop?

Back in my C/C++ days, coding an "infinite loop" as while ( true ) felt more natural and seemed more obvious to me as opposed to for ( ; ; ) An encounter with PC-lint in the late 1980's and subsequent best practices discussions broke me of this habit. I have since coded the loops using the for control statement. Today, for the fir...

Custom C# HttpModule Infinite Redirect Loop

I am writing a custom c# HttpModule that will handle requests from all file types. As a simple proof of concept I have setup the module by adding a reference to the httpModules section of the web config and added application extensions for the demo IIS website with a reference to the aspnet_isapi.dll so that it currently only intercepts ...

Infinite Loop in C++

Why the following code could/will result in infinite loop? x=0; y=0; while(x<100) { minnum=100; maxnum=100; while(y<150) { if(random[x][y]<minnum) { minnum=random[x][y]; minX=x; minY=y; y++; } else if(random[x][y]>maxnum) { maxnum=random[x][y]; maxX=y...

what to do when windows goes in dreaded 100% cpu usage zombie mode

Hi, happens to me occasionally: I start my program in visual studio and due to some bug my program goes into 100% cpu usage and basically freezes windows completely. Only by utter patience requesting the task manager (takes forever to come up and paint itself) I can kill my process. Do others encounter this too sometimes? Is there a ...

How can I remove the while(true) from my loop in Java?

I've heard that using while(true) is a bad programming practice. So, I've written the following code to get some numbers from a user (with default values). However, if the user happens to type in -1, then it will quit the program for them. How should this be written then without a while(true)? I can think of a condition to make the w...

Infinite loop at compile time?

Is it possible to enter an infinite loop at compile time? My program seems to enter an infinite loop when I attempt to compile it. I have a class with a class constructor that calls the method gameRun(). gameRun() calls itself at the end of its execution, but should have the appropriate checks to be able to break from it during run time...

authlogic crashes with infinite recursion

Hello, I have some trouble with using authlogic in my rails app, so I began using the blank example from github.com/binarylogic/authlogic_example which doesn't work either. I spent a day installing ruby 1.9.1 and 1.8 and jruby1.8, neither did work. The fun thing is that another rails app worked on my server. That said, I just cannot se...

F-Sharp (F#) untyped infinity

I wonder why F-Sharp doesn't support infinity. This would work in Ruby (but not in f#): let numbers n = [1 .. 1/0] |> Seq.take(n) -> System.DivideByZeroException: Attempted to divide by zero. I can write the same functionality in much complex way: let numbers n = 1 |> Seq.unfold (fun i -> Some (i, i + 1)) |> Seq.take(n) -> works...

Method/IBAction stuck in infinite loop. Still no success.

Now this may sound like my earlier problem/question but I've changed and tried a few things that were answered in my other questions to try to make it work, but I've still got the same problem. I am observing a core data property from within a NSManagedObject sub-class and the method that gets called when the property changes calls anot...

Stopping a loop.

As explained in my earlier question … This code … - (void)syncKVO:(id)sender { NSManagedObjectContext *moc = [self managedObjectContext]; [syncButton setTitle:@"Syncing..."]; NSString *dateText = (@"Last Sync : %d", [NSDate date]); [syncDate setStringValue:dateText]; NSEntityDescription *entityDescription = [NSEntit...

Controller must have access to model and view. Model must have access to controller and view. View must have access to controller and model. Look what happens!

<? class Launcher { function launch() { new Controller(); } } class Controller { function __construct () { if(!is_object($this->Model)) $this->Model = new Model(); if(!is_object($this->View)) $this->View = new View(); } } class Model { function __construct () { if(!is_object($this->Controlle...

When test hanging in an infinite loop

I'm tokenising a string with XSLT 1.0 and trying to prevent empty strings from being recognised as tokens. Here's the entire function, based on XSLT Cookbook: <xsl:template name="tokenize"> <xsl:param name="string" select="''" /> <xsl:param name="delimiters" select="';#'" /> <xsl:param name="tokensplitter" select="','" /> ...

When are infinite loops are useful in PHP?

While reading through the great online PHP tutorials of Paul Hudson he said Perhaps surprisingly, infinite loops can sometimes be helpful in your scripts. As infinite loops never terminate without outside influence, the most popular way to use them is to break out of the loop and/or exit the script entirely from within th...

Hudson infinite loop polling for changes in Git repository?

The git plugin for hudson works well. However, the build script must update a version number in the files in the repository, commit, and push back to the repository. When Hudson polls next to check for changes, it goes into an infinite loop because it sees that commit as a "change" builds again, which commits a change, so it builds agai...

Get stacktrace from stuck python process

I have to run a legacy Zope2 website and have some grievance with it. The biggest issue is that, occasionally, it just locks up, running at 100% CPU load and not answering to requests anymore. While the problem isn't reproducible on a regular basis, one page containing 3 dynamic graphs triggers it sometimes, so I suspect some kind of rac...

SQL-Server infinite loop

how does sql-server handle infinite loops? Does it detect it or kill the server. EG: WHILE (@number = 3) BEGIN print @number END ...

Technical non-terminating condition in a loop

Most of us know that a loop should not have a non-terminating condition. For example, this C# loop has a non-terminating condition: any even value of i. This is an obvious logic error. void CountByTwosStartingAt(byte i) { // If i is even, it never exceeds 254 for(; i < 255; i += 2) { Console.WriteLine(i); } } Sometime...