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

Integer.parseInt(scanner.nextLine()) vs scanner.nextInt()

My professor tends to do the following to get a number from the user: Scanner scanner = new Scanner(System.in); Integer.parseInt(scanner.nextLine()); What are the benefits as opposed to simply doing scanner.nextInt() ? java.util.Scanner.java has…
Olavi Mustanoja
  • 2,045
  • 2
  • 23
  • 34
10
votes
4 answers

Detect Keyboard Input Matlab

I have a simple question, although it's harder than it seems; I couldn't find the answer on the interwebs :O I'm writing a script in Matlab. What I want to do is the following: When I press the esc key, I want a helpdialogue to pop up, so my script…
Earless
  • 173
  • 2
  • 3
  • 9
10
votes
13 answers

Why can't I enter a string in Scanner(System.in), when calling nextLine()-method?

How does this program actually work...? import java.util.Scanner; class string { public static void main(String a[]){ int a; String s; Scanner scan = new Scanner(System.in); System.out.println("enter a no"); …
user1646373
  • 149
  • 1
  • 2
  • 6
9
votes
2 answers

Should "http://" be stored with a database record of a URL?

There are a number of fields a user can fill in where they'd enter a URL (their personal website, business site, favorite sites, etc etc). It's the only thing they'd be entering in that particular field. So should I always strip out "http://" to…
Shpigford
  • 24,748
  • 58
  • 163
  • 252
9
votes
3 answers

jmeter testcases which can handle captcha?

We are trying to build a jmeter testcase which does the following: login to a system obtain some information and check whether correct. Where we are facing issues is because there is a captcha while logging into the system. What we had planned to…
Koran
  • 647
  • 2
  • 8
  • 21
9
votes
2 answers

Stop user from leaving web page, except for when submitting form

To stop the user from leaving my page, I'm using this javascript: window.onbeforeunload = function() { if($('textarea#usermessage').val() != '') { return "You have started writing a message."; } }; This shows a message warning the user…
ingh.am
  • 25,981
  • 43
  • 130
  • 177
9
votes
8 answers

How to fix 'RuntimeError: input(): lost sys.stdin' error in python 3.7

I am practicing some codes and seemingly out of nowhere i have got this error when I ran a very usual piece of code. The problem i am solving takes input, calculates something and gives an output. I was running it on an online IDE (some coding…
mach3
  • 117
  • 1
  • 1
  • 6
9
votes
2 answers

wix getting user input

Dialog.wxs In Product.wxs I created a property
johnny
  • 1,241
  • 1
  • 15
  • 32
9
votes
1 answer

Function that asks a ~special~ something and returns an answer

I want to do it, but so far all I have is: print("Will you go out with me?") I want the code to work so that one can answer yes/no and if answer is yes then a message would return saying like the time, place, etc. The person I am asking is an R…
9
votes
4 answers

Allow only selected charcters based on regex in an EditText

I want to allow users only to type certain characters based on the a regex in my android applications. How do I achieve it?
Ragunath Jawahar
  • 19,513
  • 22
  • 110
  • 155
9
votes
4 answers

PHP to clean-up pasted Microsoft input

I have a site where users can post stuff (as in forums, comments, etc) using a customised implementation of TinyMCE. A lot of them like to copy & paste from Word, which means their input often comes with a plethora of associated MS inline…
da5id
  • 9,100
  • 9
  • 39
  • 53
9
votes
1 answer

Haskell - How do I break out of interact?

I am using interact to process some user inputs step-by-step (specifically, it's a chess program). However, I haven't found a way to deal with the situation where the user might want to just break out of the loop and start this match of chess from…
xji
  • 7,341
  • 4
  • 40
  • 61
9
votes
4 answers

PL/SQL: how do I prompt user input in a procedure?

This is a question about a small part of a large project I'm doing. I tried the following but I just get the two errors below it: SET SERVEROUTPUT ON CREATE OR REPLACE PROCEDURE HELLO AS DECLARE variable1 NUMBER(1); variable2…
user3120554
  • 641
  • 2
  • 11
  • 21
9
votes
3 answers

Effective Keyboard Input Handling

What is a good way to implement keyboard handling? In any language, where I write a keyboard-interactive program (such as a tetris game), I end up having some code that looks like this: for event in pygame.event.get(): if event.type == KEYDOWN: …
Claudiu
  • 224,032
  • 165
  • 485
  • 680
9
votes
4 answers

Can keyboard of type UIKeyboardTypeNamePhonePad be made to start in phone mode?

Is there some way to have a keyboard of type UIKeyboardTypeNamePhonePad start in phone number pad mode rather than alphabetic? The keyboard works well for what I need but I'd like it to start in the "other" mode since that is more likely what the…
CBGrey
  • 643
  • 7
  • 22