Stop all c++ threads

I have a thread that is calling std::getline(std::cin,input) and another thread that wakes up every x mins and checks a status. If the status is True my whole c++ application needs to terminate/shutdown. Problem is getline() is a blocking call and when I set loop_status to true it still wont stop since getline() is blocking.… Read More Stop all c++ threads

why does bash 'read' expand a wildcard appearing in stdin to yield a directory listing?

I’m writing a script to process a data file, and started with these two command lines: proc(){ echo $1 ; } while read -r line ; do proc "$line"; done <data.csv | less To my surprise, I found a listing of the current directory in the middle of the output, and realised it appears where… Read More why does bash 'read' expand a wildcard appearing in stdin to yield a directory listing?

How to read stdin keys in rust with termion using dynamic char values?

I have the following code to read user input keys from terminal using termion use std::io::{stdin, stdout}; use termion::event::Key; fn main() { let mut stdout = stdout().into_raw_mode().unwrap(); let stdin = stdin(); let char_from_config = ‘e’; for c in stdin.keys() { match c.unwrap() { Key::Char(‘q’) => { break; } Key::Char(‘h’) => { // do something }… Read More How to read stdin keys in rust with termion using dynamic char values?

continue loop even if one host is not available

import time import paramiko import sys from getpass import getpass #First Unifi AP IP Address firstip=3 fistdigits = ‘10.0.0.’ #how can we prevent from crashing if 10.0.0.19 is not an available device while firstip<=100: host= f'{fistdigits}{firstip}’ #first one will be 10.0.0.3 then 10.0.0.4 etc username="username" password="password" session= paramiko.SSHClient() session.set_missing_host_key_policy(paramiko.AutoAddPolicy()) session.connect(hostname=host, username=username, password=password) #upgradeurl="https://dl.ui.com/unifi/firmware/U7PG2/4.3.13.11253/BZ.qca956x.v4.3.13.11253.200430.1420.bin&quot; #stdin, stdout,… Read More continue loop even if one host is not available

Why do I keep getting the error "File "TypeError: 'int' object is not callable"?

Hope someone can help explain why I keep getting the following error in Python. Python version: Python 3.10.4 OS: Windows 11 in a vm Steps to reproduce the error in REPL or JuyterLab. def minmax(items): return min(items), max(items) lst = [98, 34, 78, 1, 0, -10, -19, -1] (min, max) = minmax(lst) # **no error**… Read More Why do I keep getting the error "File "TypeError: 'int' object is not callable"?