user-input

Change hardcoded file path to user prompted in VBA?

北战南征 提交于 2019-12-30 07:17:48
问题 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. 回答1:

Need To Take Input To Array Until User Enters 0 JAVA

女生的网名这么多〃 提交于 2019-12-30 05:37:05
问题 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) { /

Use Javascript to change which submit is activated on enter key press

笑着哭i 提交于 2019-12-30 03:43:05
问题 I have a form on an HTML page with multiple submit buttons that perform different actions. However, when the user is typing a value into a text input and hit enters, the browsers generally act as though the next submit button sequentially was activated. I want a particular action to occur, so one solution I found was to put in invisible submit buttons into the HTML directly after the text inputs in question, like this: <input type="text" name="something" value="blah"/> <input type=submit name

Handle spaces in argparse input

為{幸葍}努か 提交于 2019-12-30 01:36:12
问题 Using python and argparse, the user could input a file name with -d as the flag. parser.add_argument("-d", "--dmp", default=None) However, this failed when the path included spaces. E.g. -d C:\SMTHNG\Name with spaces\MORE\file.csv NOTE: the spaces would cause an error (flag only takes in 'C:SMTHNG\Name' as input). error: unrecognized arguments: with spaces\MORE\file.csv Took me longer than it should have to find the solution to this problem... (did not find a Q&A for it so I'm making my own

R Shiny display full dataframe without filter input until filterinputs are changed

寵の児 提交于 2019-12-29 09:22:29
问题 I am trying to build an app which displays a dataframe as a datatable. I wanted to provide users with ability to subset the datatable with selectinput and daterangeinput filters on the sidebar panel. Heres when I ran into issues, it only subsets the datatable when all the inputs are selected it displays an empty datatable on loading the app when one of the inputs are changed back it doesnot update the datatable. Here is my sample code for shiny app Region <- c("USA","UK","JPN","JPN","UK","USA

making valgrind able to read user input when c++ needs it

邮差的信 提交于 2019-12-29 08:51:48
问题 I am trying to run my c++ program with valgrind, however I have some points in the program which require user input from stdin, but when i run with valgrind, it wont let the user input anything for the program, is there a way around this? Been searching all around but have not found the answer. 回答1: I haven't tried it, but I found this in the man pages: --input-fd=<number> [default: 0, stdin] Specify the file descriptor to use for reading input from the user. This is used whenever valgrind

making valgrind able to read user input when c++ needs it

人走茶凉 提交于 2019-12-29 08:51:30
问题 I am trying to run my c++ program with valgrind, however I have some points in the program which require user input from stdin, but when i run with valgrind, it wont let the user input anything for the program, is there a way around this? Been searching all around but have not found the answer. 回答1: I haven't tried it, but I found this in the man pages: --input-fd=<number> [default: 0, stdin] Specify the file descriptor to use for reading input from the user. This is used whenever valgrind

detecting end of input with cin

别等时光非礼了梦想. 提交于 2019-12-29 06:58:13
问题 I want to read a line of integers from the user. I'm not sure how to check to see if the input has ended. For example I want to be able to do something like int x[MAX_SIZE]; int i = 0; while(cin.hasNext()) { cin >> x[++i]; } Example input: 2 1 4 -6 how can I check to see if there's any more for cin to take? 回答1: Yo have to do the following int temp; vector<int> v; while(cin>>temp){ v.push_back(temp); } also you can check for end of input using if(cin.eof()){ //end of input reached } 回答2: If

Linux/X11 input library without creating a window

假如想象 提交于 2019-12-29 06:55:13
问题 Is there a good library to use for gathering user input in Linux from the mouse/keyboard/joystick that doesn't force you to create a visible window to do so? SDL lets you get user input in a reasonable way, but seems to force you to create a window, which is troublesome if you have abstracted control so the control machine doesn't have to be the same as the render machine. However, if the control and render machines are the same, this results in an ugly little SDL window on top of your

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

痴心易碎 提交于 2019-12-28 04:50:13
问题 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 once. If I do that it shows the following error in my console : 1: Read 0 items 1: Read 0 items Error in while ((n <= 0) | (acr <= 0) | (acr >= 1)) { : argument is of length zero I have tried to identify the problem but I have not been able find the