infinite-loop

How can I test potentially “browser-crashing” JavaScript?

我与影子孤独终老i 提交于 2019-12-10 12:49:34
问题 I've been having a crack at some of the problems over at http://projecteuler.net/ with JavaScript. I've been using a simple html page and running my code in script tags so I can log my results in the browsers' console. When experimenting with loops I sometimes cause the browser to crash. Is there a better environment for me to do this kind of development? 回答1: a browser that has separate processes for each tab debugger breakpoints an if that breaks the loop if some threshold for time is hit

Find infinite loop in progress?

[亡魂溺海] 提交于 2019-12-10 12:38:32
问题 Is there a way to find out the current execution of the code to find out the infinite loop? I have the application running with the current source. I'm attached with the visual studio debugger. I just need to know where the code is currently at so that I can debug it further. 回答1: If you're running it from Visual Studio, you can pause the execution with the 'pause' button in the code page. The current line will be in green. 来源: https://stackoverflow.com/questions/2767750/find-infinite-loop-in

c++ breaking out of loop by key press at any time

ε祈祈猫儿з 提交于 2019-12-10 11:35:11
问题 What I have here is a loop that is supposed to read the output on a piece of equipment every 500 milliseconds. This part works fine. However, when I try to introduce cin.get to pick up the key "n" being pressed to stop the loop, I only get as many outputs as the number of key presses up to this point. If I press any keys (apart from 'n') several times followed by enter, I will get a few more outputs. What I need is the loop keep looping without any interaction until I want it to stop. Here's

Passing variable through URL with angular js

余生长醉 提交于 2019-12-10 03:47:16
问题 I am using angular to make an e-commerce, and I'm setting an infinite scroll to the products list page. Everything worked fine, but I want to use the URL to set the page, so the user can access an specific page through URL. how do I set a variable like "pageNumber" in the URL with angular? like "www.page.com/page/2/"(I want to get the number 2 and pass it to the store controller) Here's the code I have now (function() { var app = angular.module('concurseirosUnidos', ['store-directives',

Infinite loop invalidating the TimeManager

徘徊边缘 提交于 2019-12-10 01:04:31
问题 I am experiencing a very tricky defect in my WPF application to track down. The error message is: An infinite loop appears to have resulted from repeatedly invalidating the TimeManager during the Layout/Render process. The stack trace (for what it's worth) is: at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget) at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget) at System.Windows.Threading.ExceptionWrapper

When sliding sprite, if sprite disappears off the side, it will wrap around to the opposite side?

醉酒当歌 提交于 2019-12-10 00:19:55
问题 When sliding sprite, if sprite disappears off the side, i want to make it wrap around to the opposite side but I do not know how to do this while the sprite is simultaneously being pushed off one side i want the other bit that you can't see to appear on the opposite side like a loop some sort of wormhole thing. here is my code so far but it crashes and it only transports the sprite once the whole of the sprite disappears of the side. Loop also needs to run as an infinite loop until someone

Why is infinite loop protection being triggered on my CRM workflow?

半腔热情 提交于 2019-12-09 05:36:17
问题 Update I should have added from the outset - this is in Microsoft Dynamics CRM 2011 I know CRM well, but I'm at a loss to explain behaviour on my current deployment. Please read the outline of my scenario to help me understand which of my presumptions / understandings is wrong (and therefore what is causing this error). It's not consistent with my expectations. Basic Scenario Requirement demands that a web service is called every X minutes (it adds pending items to a database index) I've

How to unit test a method that runs into an infinite loop for some input?

落花浮王杯 提交于 2019-12-09 02:27:57
问题 This question just occurred to my mind and I want to ask this here. The case is intentional, I just write a loop which runs infinitely. How do I go about unit testing it? I ask this because, this situation may occur anywhere in the code. Say my method delegates to several other methods, and I want to know How it ran into an infinite loop What set of input caused it Call to which method (from this method) has caused this I have no code written for this. The question is purely for knowledge

jQuery .remove() call in callback triggers infinite loop

房东的猫 提交于 2019-12-08 19:45:31
While I have the problem itself seemingly resolved, I'm hoping someone can shed some light on the why of this... Below are two snapshots of the same function whose job is to remove a div that contains a user feedback message. It's setup to use an optional timeout, if a timeout is specified it makes a call to itself using setTimeout() which then removes the div. The only difference between the two versions of the function is where this.remove() is called - in the problem version I send a message to the log using blackbirdjs first and then call this.remove() - after this executes the log is

How can I use the Haskell timeout function (in System.Timeout) to halt runaway computations?

坚强是说给别人听的谎言 提交于 2019-12-08 17:34:48
问题 The timeout function in System.Timeout sometimes fails to halt an infinite computation. For example, timeout 1000 $ print $ length [0..] returns Nothing as expected because the timeout interrupts the infinite computation. But timeout 1000 $ print $ length $ cycle [1,2,3] loops forever. This is on a Mac, using ghc or ghci 8.6.4. I expect the second example to behave like the first, interrupting the infinite computation after 1 millisecond and returning Nothing . Instead, the second example