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
35
votes
4 answers

DataInputStream deprecated readLine() method

I am on java 6. Using DataInputStream in = new DataInputStream(System.in); to read user input. When the readLine() is deprecated. What is the work around for reading user value? DataInputStream in = new DataInputStream(System.in); int num; try { …
Some Java Guy
  • 4,992
  • 19
  • 71
  • 108
35
votes
4 answers

Command line input in Python

Is it possible to run first the program then wait for the input of the user in command line. e.g. Run... Process... Input from the user(in command line form)... Process...
Viin
  • 427
  • 1
  • 4
  • 9
34
votes
4 answers

How to supply stdin, files and environment variable inputs to Python unit tests?

How to write tests where conditions like the following arise: Test user Input. Test input read from a file. Test input read from an environment variable. It'd be great if someone could show me how to approach the above mentioned scenarios; it'd…
user277465
33
votes
5 answers

bash user input if

I am trying to do a simple question in bash: Do you want to do that? [Y,n] _ Tried echo "Do that? [Y,n]" read DO_THAT if ["DO_THAT"="y"]; then do_that fi but it fails: bash: [y=y]: command not found what am I doing wrong??!
frnhr
  • 12,354
  • 9
  • 63
  • 90
32
votes
1 answer

Accept user input

I am currently writing a text-adventure type game in Malbolge. Can anyone tell me how to accept a user input in Malbolge? I am able to output text to the screen, however, I can't seem to figure out how to accept input.
jgallant
  • 11,143
  • 1
  • 38
  • 72
32
votes
10 answers

Prompt user to rate an Android app inside the App

In my Android app, I want to prompt the user at some point of time to rate the app in Android market. Having searched for an approach, I've found some code on this website. This code seems to work very well. But unfortunately, this code seems to…
caw
  • 30,999
  • 61
  • 181
  • 291
32
votes
4 answers

Is it ever useful to use Python's input over raw_input?

I currently teach first year university students python, and I was surprised to learn that the seemingly innocuous input function, that some of my students had decided to use (and were confused by the odd behaviour), was hiding a call to eval behind…
luketparkinson
  • 322
  • 3
  • 7
32
votes
8 answers

How to read an integer input from the user in Rust 1.0?

Existing answers I've found are all based on from_str (such as Reading in user input from console once efficiently), but apparently from_str(x) has changed into x.parse() in Rust 1.0. As a newbie, it's not obvious how the original solution should…
Sundar R
  • 13,776
  • 6
  • 49
  • 76
31
votes
4 answers

Commas messing with number input in Javascript

I have a page with some elements that are controlled by the user. One of these is a text input field, where the user is supposed to input a number. Everything works well if the user only inputs digits (EG 9000), but is the user uses comma notation…
MrGlass
  • 9,094
  • 17
  • 64
  • 89
31
votes
2 answers

What is the correct way to ask for user input in an R program?

The my program below(which is in two parts) works if I run them separately – that is, if I paste the first part into the R Console, run it and then paste the second and run it. However, that is not how I want it. I want to run the whole program at…
Son
  • 5,295
  • 5
  • 19
  • 10
28
votes
1 answer

Prevent screen from sleeping with C#

I have created a small C# console app to move the pointer around the screen, in the hope that this would prevent the screen from sleeping / locking after a few minutes. Unfortunately the screen still goes to sleep after a few minutes. Does anyone…
devklick
  • 2,000
  • 3
  • 30
  • 47
28
votes
3 answers

Simple InputBox function

I'm aware of a simple pop-up function for PowerShell, e.g.: function popUp($text,$title) { $a = new-object -comobject wscript.shell $b = $a.popup($text,0,$title,0) } popUp "Enter your demographics" "Demographics" But I am unable to find an…
Rhonda
  • 1,661
  • 5
  • 31
  • 65
28
votes
1 answer

How to use int16_t or int32_t with functions like scanf

The way that I understand int16_t or int32_t in C is that they are typedefed to be 16 and 32 bit numbers respectively on your computer. I believe you would use these when you need to guarentee a number is 16 or 32 bits because different systems do…
guribe94
  • 1,551
  • 3
  • 15
  • 29
27
votes
5 answers

Bootstrap Datepicker (avoid text input or restrict manual input)

Here is my website: http://splash.inting.org/wp/ I currently use the Bootstrap Datepicker (range branch) for my Call Date field and it's been great. Although I have 2 Problems: 1) You can manually enter strings in the input field. This is weird…
AnimaSola
  • 7,146
  • 14
  • 43
  • 62
26
votes
16 answers

Stop data inserting into a database twice

I was wondering what methods/preventions other programmers use to stop data being entered twice into a MySQL database when a user refreshes on the same page as a form? Obviouly it happens and I need a good way to stop this.
Ben McRae
  • 3,551
  • 13
  • 36
  • 31