user-input

User input parsing - city / state / zipcode / country

断了今生、忘了曾经 提交于 2019-12-03 15:41:54
I'm looking for advice on parsing input from a user in multiple combinations of City / State / Zip Code / Country. A common example would be what Google maps does. Some examples of input would be: "City, State, Country" "City, Country" "City, Zip Code, Country" "City, State, Zip Code" "Zip Code" What would be an efficient and correct way to parse this input from a user? If you are aware of any example implementations please share :) The first step would be to break up the text into individual tokens using spaces or commas as the delimiting characters. For scalability, you can then hand each

gets not waiting for user input in expect script

て烟熏妆下的殇ゞ 提交于 2019-12-03 15:38:18
When i try to run the following expect script, it just finishes running instead waiting for user input. Could someone tell me what i am doing wrong? #!/usr/bin/expect puts -nonewline stdout "Enter device id:" flush stdout gets stdin id puts -nonewline stdout "Enter device name:" flush stdout gets stdin name Expect alters the Tcl gets command so that it doesn't wait for standard input; to read a line while waiting for it, you need to do this instead of gets stdin id : # Read input to stdin expect_user -re "(.*)\n" set id $expect_out(1,string) Try this code : expect "\\$" puts -nonewline "please

Suggest answer to user input in bash scripting

佐手、 提交于 2019-12-03 14:54:42
问题 Here is an example: #!/bin/bash echo -e "Enter IP address: \c" read echo $REPLY But I want to make it easier for the user to answer. I'd like to offer an answer to the user. It should look something like this: Enter your IP: 192.168.0.4 And the user can just press Enter and agree with 192.168.0.4, or can delete some characters (for example delete "4" with one backspace and type 3 instead). How to make such an input? It is possible in bash? 回答1: bash's read has readline support (Edit: Jonathan

Stop Submit With Empty Input Values

六月ゝ 毕业季﹏ 提交于 2019-12-03 14:11:11
Im Looking for a simple solution to stop a login form from submitting with empty input fields. The code for the form is below. I would like to use a simple Javascript soluiton if possible. <form id="login" method="post" action=""> <input type="text" name="email" id="email" /> <input type="password" name="pwd" id="pwd" /> <button type="submit" id="submit">Login</button> </form> If possible I would also like to change the border of the empty field(s). Thanks in advance. Sample code with dummy checks: <script type="text/javascript"> function checkForm(form) { var mailCheck = checkMail(form

How to detect user presence in android?

送分小仙女□ 提交于 2019-12-03 12:47:05
I know in Galaxy Samsung SIII it is possible to configure in settings an option to avoid the screen turns off when user is looking into the screen. I think the phone uses the camera or a kind of a sensor of presence. is it possible to do it programmatically? even if yes, some devices won't be capable to do that. I imagine some possibilities here: using the camera, accelerometer, or even user activity: if the screen is on, touches, I don't know. There is a specific library about "user presence" to android? Using the best of all sensors when available? Yes, there's something like that. You can

How to use InputConnectionWrapper?

霸气de小男生 提交于 2019-12-03 12:31:32
I have an EditText . Now I want to get all changes made by the user to this EditText and work with them before manually inserting them into the EditText . I don't want the user to directly change the text in the EditText . This should only be done by my code (e.g. by using replace() or setText() ). I searched a bit and found an interesting class named InputConnectionWrapper . According to the javadoc it shall act as a proxy for a given InputConnection . So I subclassed it like this: private class EditTextInputConnection extends InputConnectionWrapper { public EditTextInputConnection

Bootstrap Datepicker (avoid text input or restrict manual input)

蹲街弑〆低调 提交于 2019-12-03 11:31:37
问题 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 since the original by eyecon disallowed it by entering the current date whenever you enter non-date values. I tried the readonly attribute and it doesn't seem to work because it won't allow you to select any date. 2) I limited the date input choices

Javascript - User input through HTML input tag to set a Javascript variable?

耗尽温柔 提交于 2019-12-03 07:52:30
问题 I want there to be a textbox on my screen(like the one i'm typing in now) that you can type in then click a submit button and it sends whatever you typed in the box to javascript and javascript prints it out.Here is my code This is the part that works. <html> <body> <input type="text" id="userInput"=>give me input</input> <button onclick="test()">Submit</button> <script> function test() { var userInput = document.getElementById("userInput").value; document.write(userInput); } </script> </body

What's the best approach to get Date/Time input from the user?

。_饼干妹妹 提交于 2019-12-03 07:12:14
问题 This is a wheel that's been re-invented again and again over the years. The Problem: The user needs to input a Date/Time Basic considerations We want to make it as easy as possible for the user to enter the desired date/time Some applications call for historical dates, some applications call for future dates only, some will need to handle both We want to prevent the user from entering jibberish data We want to auto-populate this control as aggressively as possible. We want this control to be

Get user input from a textbox in a WPF application

梦想的初衷 提交于 2019-12-03 06:29:01
I am trying to get user input from the textbox in a WPF application I am building. The user will enter a numeric value and I would like to store it in a variable. I am just starting on C#. How can I do it? Currently I am opening the textbox and letting the user enter the value. After that the user has to press a button upon which the text from textbox is stored in a variable. private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { } private void Button_Click(object sender, RoutedEventArgs e) { var h = text1.Text; } I know this isn't right. What is the right way? Like @Michael