user-input

How to add a wait timer on an input field keyup event?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 00:06:59
问题 I have an input field, and it has a keyup event: $(document).ready(function() { $('#SearchInputBox').keyup(function() { DoSearch($(this).val()); }); }); How can I add a delay time, so that only when the user stopped typing for 1 second, then it will run the DoSearch function. I don't want to keep running it every time the user types a key because if they type fast, then it will lag. 回答1: Basically, set a timeout on each keyup. If there's already a timeout running, clear it and set another.

Change hardcoded file path to user prompted in VBA?

无人久伴 提交于 2019-12-01 00:01:29
Right now, I have a VBA macro for Word which parses a document for a certain font and outputs all font of the selected type to a text file. The hard coded line which I open the text file is something like this: Open "C:\Documents and Settings\Output.txt" For Output As #n Can I change this so the user is prompted to enter the file path at this point in the macro? Something like: Open (PROMPTS USER FOR FILE PATH HERE) For Output As #n Sorry if this seems trivial. I am new to VBA coding. Two ways: Simple Dim path As String path = InputBox("Enter a file path", "Title Here") Open path For Output As

Datetime conversion and parsing

混江龙づ霸主 提交于 2019-11-30 23:35:53
My code gives the following error: Input string was not in a correct format. with this hint: When converting a string to DateTime, parse the string to take the date before putting each variable into the DateTime object Below is my code: (Edited to only show problematic code) string username ="aits"; string password = "12345"; Int32 intresortid=7; string strPartySurname = "Kumar"; ; string strPartyFirstName = "Test"; string strPartyPrefix = "Mr & Mrs"; Int16 intQtyAdults=1; Int16 intQtyTotal=1; string PromotionCode = "TIF"; string flightNO = "FlighDJ76"; string strNotes = "<nl>Provide Breakfast

How do I display a website with html-forms locally using python and collect the user input?

≯℡__Kan透↙ 提交于 2019-11-30 23:24:35
I am a behavorial scientist and usually collect data by letting participants do some tasks on a computer and record their responses (I write the programs using the pyglet wrapper PsychoPy ). That is, the program runs locally and the data is stored locally. Now I would like to know if there is a way to use Python to display a (local) website with html-forms to the user and collect the input (locally). The reason for this idea is that currently whenever I want to display checkboxes, radiobuttons, or input fields I use wxPython. This works quite well, but programming and layouting in wxPython is

What is the easiest way to get an int in a console app?

放肆的年华 提交于 2019-11-30 23:02:52
问题 I want to process user input as an integer, but it seems as though C has no way to get an int from stdin. Is there a function to do this? How would I go about getting an int from the user? 回答1: #include <stdio.h> int n; scanf ("%d",&n); See http://www.cplusplus.com/reference/clibrary/cstdio/scanf/ 回答2: scanf() is the answer, but you should certainly check the return value since many, many things can go wrong parsing numbers from external input... int num, nitems; nitems = scanf("%d", &num);

How to allow multiple inputs from user using R?

跟風遠走 提交于 2019-11-30 21:30:10
For example, if I need that the user specifies the number of rows and columns of a matrix: PROMPT: Number of rows?: USER INPUT: [a number] I need that R 'waits' for the input. Then save [a number] into a variable v1. Next, PROMPT: Number of columns?: USER INPUT: [another number] Also save [another number] into a variable v2. At the end, I will have two variables (v1, v2) that will be used in the rest of the code. "readline" only works for one input at a time. I can't run the two lines together v1 <- readline("Number of rows?: ") v2 <- readline("Number of columns?: ") Any ideas or suggestions?

R Shiny store the user input from multiple dynamically generated textAreaInput fields in an object in the server part

ぃ、小莉子 提交于 2019-11-30 20:00:58
问题 New to shiny and struggling with this for more than two days now. I have created an application where the user loads .csv data file and chooses one or more variables whose names appear in the application as check boxes. When a checkbox is checked, a new checkbox appears under with the same name and when it is clicked too, a textAreaInput appears next to it where the user can add variable names that constitute the target variable as a scale. Here is an oversimplified version of the application

Handle the KeyDown Event when ALT+KEY is Pressed

有些话、适合烂在心里 提交于 2019-11-30 17:23:36
问题 How do you handle a KeyDown event when the ALT key is pressed simultaneously with another key in .NET? 回答1: The KeyEventArgs class defines several properties for key modifiers - Alt is one of them and will evaluate to true if the alt key is pressed. 回答2: private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.Alt && e.KeyData != (Keys.RButton | Keys.ShiftKey | Keys.Alt)) { // ... } } 回答3: Something like: private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.Alt) { e

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

旧时模样 提交于 2019-11-30 17:14:10
问题 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 it is not working for me. I am in a fresh Leiningen project, and I have added a :main clause to the project.clj pointing to the only source file: (ns textgame.core) (defn -main [& args] (println "Entering -main") ; (flush) ;makes no difference if

Need To Take Input To Array Until User Enters 0 JAVA

被刻印的时光 ゝ 提交于 2019-11-30 17:04:38
I need help understanding how to write a for loop that takes in a certain amount of integers (must be 1 through 10) and it stops taking in numbers once 0 is entered (0 will be the last number). My code so far is: import java.util.Scanner; public class countNum { public static void main(String[] args) { int[] array; Scanner input = new Scanner(System.in); System.out.println ("Enter in numbers (1-10) enter 0 when finished:"); int x = input.nextInt(); while (x != 0) { if (x > 2 && x < 10) { //Don't know what to put here to make array[] take in the values } else //Can I just put break? How do I