3,594 questions
Advice
2
votes
12
replies
283
views
How do I make a 'for' loop in python run infinitely?
In Python, we know that while loops can run infinitely,
but is there any way to make a for loop run infinitely?
From my prior checking, I found a way to do so by importing the 'itertools' module, but ...
0
votes
1
answer
258
views
How do I prevent have a "Maximum update depth exceeded..." error with react-native-calendars's Agenda?
I have an error with the react-native-calendars's agenda. I quite new to react native, and this is my second attempt to use an Agenda. Every time I tried, I have the "maximum update depth ...
0
votes
1
answer
127
views
How can I define an infinite loop condition in the for loop in java?
I was making a program in which user can keep entering numbers till user enters a multiple of 10. So I wanted to created a for loop for that and didn't knew what should be the infinite loop condition ...
2
votes
4
answers
182
views
Recursive query to figure out record which creates circular dependency
I have a postgress table incoming_records which contains 2 column supervisor_id, emp_id
create table incoming_records(supervisor_id,emp_id)as values
(null,01) --top level resources with blank ...
1
vote
2
answers
98
views
Cyclic Sort Infinite Loop in LeetCode "Set Mismatch" Problem
I am trying to solve the Set Mismatch problem using Cyclic Sort in Python. The problem statement is as follows:
Problem Statement
You have a set of integers s, which originally contains all numbers ...
0
votes
0
answers
239
views
Basic script causing a fault on a Shelly device
someone could help me understand why I had 2 Shelly 1 Mini Gen3 unusable after I run a very simple script on them?
Below is the script:
Shelly.addEventHandler(
function (event, ud) {
print('raw ...
-2
votes
3
answers
136
views
Why there's infinite loop in useEffect hook? [closed]
index.jsx
const { startTransition, useEffect, useState } = React;
const { createRoot } = ReactDOM;
function App() {
const [foo, setFoo] = useState([1]);
const [bar, setBar] = useState("1");
...
0
votes
0
answers
148
views
Infinte loop trying to read last line of InputStream
I am working on a project and am using whisper.cpp for speech to text. I am not using the Java bindings, and am instead compiling examples/stream and running it using the Process/ProcessBuilder API. I ...
0
votes
1
answer
109
views
Why does the partition function in QuickSort work even when the inner while loop seems to cause an infinite loop?
I'm implementing the partition function for QuickSort, and I've come across behavior that seems confusing. Specifically, in the partition logic:
int partition(int A[], int low,
int high)
{
int ...
0
votes
1
answer
74
views
React useEffect Dependency Bug with Async Data Fetching
I'm building a React app where I fetch data from an API and update the state. However, I'm facing a bug related to useEffect dependencies, which is causing an infinite re-render loop. Here's the ...
2
votes
3
answers
174
views
No result when filtering on a random IntStream, in Java
I am representing a collection of turtles, each with a moment when hatched. I want to randomly choose any mature turtle.
I pretend that minutes are years, in this aquarium simulation.
record Turtle(
...
0
votes
0
answers
43
views
Toroidal effect (infinite Loop) in sections of uiCollectionView
I have a mosaic of cells with interleaved movement, but I have not achieved a toroidal effect so that the cells appear again.
import UIKit
class ViewController: UIViewController {
@IBOutlet ...
-2
votes
1
answer
72
views
how do get my code to match? i feel close but im not sure [duplicate]
def stick_game():
num_sticks = 11
player = 1
playing = True
print("***** WELCOME TO NIM! *****")
print("Each player will take turns removing")
print("...
-1
votes
1
answer
386
views
Struck in Infinite Recomposition due to Horizontal Pager's Pager State
this code snippet do infinite recomposition while scrolling , not able to find why?
How to manage state and animation in a HorizontalPager in Jetpack Compose?
I'm working with Jetpack Compose and ...
0
votes
1
answer
369
views
.NET 8 upgrade: OIDC correlation failure with IdentityServer4 on HTTP when using machine name instead of localhost
We’re running an older Identity server on .NET Framework 4.6.2 with IdentityServer4, which we plan to replace early next year. In the meantime, though, we’ve had to upgrade our primary application to ....
-1
votes
2
answers
148
views
Verilog clock implementation gone wrong
I just started learning Verilog and made a system clock and its respective testbench, but it is getting stuck in an infinite loop in the testbench. Could you please help me?
Below is the ...
2
votes
1
answer
65
views
Infinite loop when trying to place strings of length N in an NxN matrix — Word Soup Program in C
I've been attempting to make a word soup program in C for an assignment: the program accepts user-inputted words and places them onto an NxN board, where each cell is a character.
However, I'm running ...
1
vote
0
answers
74
views
Linked List merge sort implementation attempt with Python runs into an infinite loop
Context
I was implementing a LinkedList sort solution with python (over on leetcode.com).
The solution is a bottom up merge sort approach (divide and conquer).
The code below is incomplete, it's ...
0
votes
2
answers
116
views
DataGridViewCellPaintingEventArgs: Infinite repainting loop?
I'm trying to customize certain cells in a WinForms DataGridView, but I'm running into an issue where the painting event is firing over and over again non-stop forever, even when not scrolling through ...
-1
votes
2
answers
205
views
Why does this code not stop to take input?
This is a program which allows only authorized shareholders to attend a meeting, which is given as a file input.
It asks for a name on the terminal and checks if it is in the file. If it is not, it ...
-1
votes
2
answers
76
views
How to get rid of Infinite for loop to find pixel colors?
I have written the code given below to get RGB value of each pixel which belongs to a image uploaded from a file. Then i want to list all color values of every pixels in the listbox. But "for&...
1
vote
1
answer
151
views
Problem extracting a line from a buffer readed from a file descriptor
Well, i am trying to create a program that reads from a file descriptor piece by piece (defined as BUFFER_SIZE), until it finds a '\n' or the EOF. The problem its i am getting stuck in a infinite loop,...
0
votes
1
answer
52
views
Non-upgradeability due to infinite execution time (if any)?
I read somewhere that canister upgrades can be (e.g. maliciously) prevented by another canister called by it by not returning from the call.
But how come that a call could not return? It is limited by ...
1
vote
1
answer
117
views
I'm trying to create an Library management system and not getting why there's a loop in switch case with break statement too
I've not added any features yet in this program and only added some tasks in "1)Create an account" while in this code block when you enter your name after pressing enter, it starts looping ...
0
votes
1
answer
80
views
Changing coordinates with a condition
I have 500x500 grid and random coordinates on this grid. I'm trying to get new random coordinates but they shouldn't be too close to the previous ones. I'm come up with this: In an infinite loop I ...
0
votes
2
answers
123
views
How do I prevent circular dependencies in a general tree?
I have a class in c# called Pose. Its functionality is not really important, but it contains as fields another Pose called _parent, and a List called _children. In the setter for the _parent, I need ...
1
vote
0
answers
40
views
Infinite fetching bug from Firestore
I am implementing this custom hook for a cart where basically fetches productIds, and variants from async storage, then fetch all the information of the products from Firestore. The logic then syncs ...
0
votes
1
answer
113
views
Infinite loop issue for my form using nextjs
this is my component. i don't know why the moment i reload the page it'll always give me infinite loop issue. it'll throw the error the moment i go the page. i can't even fill in anything inside the ...
0
votes
2
answers
180
views
Conditionally rendering a lazy-loaded component only after the parent node is attached results in an infinite loop
React version: 18.3.1
Steps To Reproduce
Create a component that renders the children inside a , but only after it has obtained reference to that div (via putting the div node into a state)
Pass a ...
0
votes
0
answers
133
views
Windows Task Scheduler: run .py script without window opening
I have been asked to run a python script from the Windows Task Scheduler.
In my python script I will substantially use watchdog library in order to instanciate and run an Observer that will monitor ...
0
votes
1
answer
47
views
Apache redirect infinite loop
I want to have a redirect from
https://example.com/app/my.page
to
https://example.com/app/my.page?login=INTERNAL
but unfortunately I go into an infinite loop
I have some staging script for httpd.conf ...
0
votes
1
answer
133
views
Fork in Linux: Weird infinite loop while freeing condition variable
Context
System: Fedora 40
Library Used: pthread.h
Details: Read "To the point" if not interested
I apologize for providing no code here as the whole program is more than 4000 lines of code ...
0
votes
1
answer
89
views
unexpected behavior of python threading.Condition
I'm trying to synchronize multiple threads. I expect script output when using threading.Condition and threading.Barrier will be about the same, but it's not. Please explain why this is happening.
In ...
0
votes
1
answer
208
views
Why is my solve_ivp stuck in an infinite loop?
I'm trying to solve a problem involving a fixed-bed reactor that uses a system of ordinary differential equations, but for some reason it gets stuck in an infinite loop. Here's the code:
import numpy ...
1
vote
3
answers
137
views
Infinite Loop Issue with Static Operators in Swift Extensions (Learning Purposes)
I'm encountering a problem with using both + and * static functions in a Swift extension. I just want + to be * and * to be +. When I use just the + operator, it works fine, but when I include both ...
2
votes
1
answer
115
views
Longest Repeating Substring With Replacement
Working on an online practice problem and ran into an issue that I can't seem to figure out. I am looking to find the longest length of a string of characters whose characters can only be replaced &...
-4
votes
1
answer
85
views
I can't stop my program in Python, even with Ctrl-C
month =
{"January" : "01",
"February" : "02" ,
"March" : "03",
"April" : "04",
"May"...
-4
votes
1
answer
118
views
Changing a single line in my code leads to an infinite loop [closed]
In the following code,
#include <iostream>
#include <vector>
using namespace std;
vector <int> otm;
vector <int> past;
vector <int> strength;
bool leaves(int n){
...
0
votes
0
answers
55
views
while (true) loop executing once more after break statement when reading file [duplicate]
I'm trying to read a file that has this format:
1
2
3
4
I'm trying to store these values into an array using a while loop:
ifstream myfile("file.dat");
int n, i;
int myarray[30];
if (!...
0
votes
1
answer
61
views
how can recyclerview central item highlight?
At first, I tried to use a view pager, but due to the overall size issue of the view pager, I didn't think it was right to implement such a screen.
So I started using Recycler View and even worked on ...
1
vote
1
answer
82
views
I made a one-card game, but it keeps falling into infinite loop
I've tried implementing a one-card game with c, but my code is that when I run about 5 times, I fall into infinite loop at least 2 times. I've talked to chat-gpt a lot to solve this problem, but I ...
1
vote
1
answer
70
views
Compilation and return values of infinite loops with try-catch blocks
I encountered this problem when experimenting with file I/O. This method compiles:
public static int testMethod1() {
try {
while (true);
} catch (Exception e) {
...
1
vote
0
answers
161
views
Throwing Exceptions inside a coroutine causes reactor to go on an infinite loop
I have the following code which attempts to process a kafka message, and if it fails, logs/publish it to another topic for later processing.
@Service
class KafkaConsumerService(
private val ...
1
vote
1
answer
159
views
Why does my code go into an infinite loop?
I have the following code at the moment:
executed = False
while executed == False:
try:
inp = input("Enter the variable you want to change (e.g.: limit = 10): ")
eval(...
-2
votes
1
answer
99
views
Why does useState() run in an endless loop if the argument is an object or array? [duplicate]
I'm using the useState() hook in Deno Fresh, which is based on Preact. In an island I have:
import { useState } from "preact/hooks";
export default function(){
const [state, setState] = ...
0
votes
1
answer
185
views
Correct finite automata diagrams for these simple problems?
Hello I am learnign about finite automata and I want to see if these diagrams and my explanation make sense.
{w ∈ Σ∗ | w contains the substring 1010} using five states
There is the substring of 1010 ...
2
votes
1
answer
70
views
Haskell GriWorld Infinite loop
I'm trying to code a GridWorld simulation in Haskell via reinforcement learning. I'm stuck because I keep falling into an infinite loop on line 109. I've been staring at this problem for a week, and I ...
0
votes
1
answer
67
views
Multiple Users Simultaneously Press Button, Makes Infinite Loop Ineffective on C#
I have a c# infinite loop code on a WinForm project, which uses a value in SQL which alternates between 1/0 and if it's 0 it'll continue the process, while if it's 1 it'll stay in the loop. The ...
0
votes
1
answer
475
views
useCookies from react-cookies causes rendering loop
I have a code that worked before but after I updated all the libraries, it started to render the App component continuously and React is throwing an Infinite Render Loop error: Minified React error #...
-2
votes
3
answers
118
views
Python: Is there a way of stopping an inifinite loop running on a python Class method?
I am running a loop on a python Class method that depends on a boolean variable. When I try to change the value of the variable from outside, it seems like it is stucked in the loop and I cannot ...