Questions tagged [user-input]

User Input is data that the user inputs into the program. It generally takes the form of a String, but may also be an integer, floating-point number, etc.

5580 questions
6
votes
5 answers

Clojure (read-line) doesn't wait for input

I am writing a text game in Clojure. I want the player to type lines at the console, and the game to respond on a line-by-line basis. Research showed me that (read-line) is the way one is meant to get text lines from standard input in Clojure, but…
dukereg
  • 722
  • 5
  • 16
6
votes
1 answer

How to provide your own delimiter for cin?

In c, I can use newline delimeter ([^\n]) with scanf. Using which I can store the line. Similarly for cin, I can use getline. If I have to store a paragraph, I can simulate the functionality using my own special char delimiter like [^#] or [^\t]…
Forever Learner
  • 1,465
  • 4
  • 15
  • 30
6
votes
3 answers

How to prevent "regex injection"?

How to prevent something I'd call "regex injection"? I'm using regular expressions to parse strings that might look like - one of the examples - Size: 10, qty: 20 Writing a regex to capture "10" and "20" is not hard by itself. "Size" and "qty"…
Konrad Morawski
  • 8,307
  • 7
  • 53
  • 91
6
votes
2 answers

User input with timeout doesn't work as hoped

Why don't loop cycles work as before after a timeout (no more printed user input)? #!/usr/bin/env raku loop { my $str; my $timeout = Promise.in( 5 ).then({ $str = 'Timeout'; }); my $user = Promise.start({ $str =…
sid_com
  • 24,137
  • 26
  • 96
  • 187
6
votes
4 answers

Buttons broken using new Input System

I've got a problem that is seemingly impossible to debug. My project originally started using 2019.2 and upgraded to 2019.3 without any problems. I then installed the preview package for the new input system. This "disabled" all the buttons in that…
JudasMoses
  • 378
  • 4
  • 22
6
votes
5 answers

Hide Input in Batch File

I was wondering how I would go about Hiding the input from a 'set /p' command in a batch file. set /p Password=What is your password? We all know that inputting your password, you would be able to see it. How would I go 'bout hiding it ? I tried…
James
  • 63
  • 1
  • 1
  • 3
6
votes
1 answer

How to get data from Angular material dialog?

How do you get data from an input field inside an Angular material dialog? This is my code: TS import { Component, OnInit, Inject } from '@angular/core'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; @Component({ …
Compiler v2
  • 3,509
  • 10
  • 31
  • 55
6
votes
1 answer

Process never ends when using 'process.stdin.once'

In my node script, I am waiting for the user to press enter at some point: console.log("Press enter to continue..."); await new Promise(function(resolve, reject) { process.stdin.once("data", function(data) { resolve(); }); }); The…
goodvibration
  • 5,980
  • 4
  • 28
  • 61
6
votes
3 answers

Wait for a user input for 5 seconds and use a default value otherwise

I would like to give the user an opportunity to enter an input, and use a default value if they do not enter anything after 5 seconds. Here's for the input part: input <- readline(prompt="Do something? (y/n): ") Is there a way to do it in R?
Julien Massardier
  • 1,326
  • 1
  • 11
  • 29
6
votes
1 answer

How to not need user input for install.packages(type = "both")

Normally, install.packages(..., type = "both") requires user input if there is a package that needs to be built from source. For example (currently, with R 3.5.1), install.packages(c("feather", "tidyr"), type = "both")) will install tidyr from…
r_alanb
  • 873
  • 8
  • 21
6
votes
5 answers

How to stop a running method with keyboard input in a Console Application on C#?

In short, I'm utilizing C# to scientific computation and I've written a method that has a while loop that may run to a user-specified quantity of steps... Actually, this method may take too long to execute (like more than 5 hours). When it takes…
Girardi
  • 2,734
  • 3
  • 35
  • 50
6
votes
1 answer

How to create a function for recursively generating iterating functions

I currently have a bit of Python code that looks like this: for set_k in data: for tup_j in set_k: for tup_l in tup_j: The problem is, I'd like the number of nested for statements to differ based on user input. If I wanted to create a…
Daniel
  • 159
  • 1
  • 3
  • 9
6
votes
2 answers

Python3 best way to read unknown multi line input

What is the best way in Python 3 to read in multi-line user input when the amount of input is unknown? The multi-line input will be separated by Enter when I try using while True: line = input() if line: print(line) else: …
Mazzone
  • 401
  • 1
  • 6
  • 21
6
votes
3 answers

Can you use float numbers in this for loop?

I need some help. I'm trying to make my for loop work with decimals, but my code won't accept floats and I'm not sure what to do next. Can anyone point out where I went wrong? It's a code used for converting Celsius to Fahrenheit in steps (Delta)…
Jarbcd
  • 63
  • 1
  • 1
  • 6
6
votes
9 answers

What is a more elegant solution to these nested if/elseif statements?

I'm building a website that contains users with user profiles. Many of the fields in the profile are optional. There is an opportunity for a lot of user-generated content, and so I need to display the author of this content in many different…
Stephen
  • 18,827
  • 9
  • 60
  • 98