user-input

Multiple Key Gestures for custom keyboard shortcuts in WPF

馋奶兔 提交于 2019-12-06 14:15:44
问题 Does anyone know if it's possible to have key combinations for keyboard shortcuts in WPF? Right now if I want to use CTRL + S as a shortcut I can do the following: InputGestures.Add( new KeyGesture( Key.S , ModifierKeys.Control )); But if I want to use CTRL + S , D ... I don't have an overload that takes the D . Is there a way to override this an accept combinations? 来源: https://stackoverflow.com/questions/2194714/multiple-key-gestures-for-custom-keyboard-shortcuts-in-wpf

Get user input from IDE/Console in selenium webderiver

孤者浪人 提交于 2019-12-06 13:43:27
问题 I want to get the key(send key) from user input how should I implement it? driver.findElement(By.xpath(".//*[@id='vehicleNum']")).sendKeys("1121"); in input box what ever user type i want gen then i want to send through selenium? 回答1: Even your question is not clear properly but as I am assuming you need below solution. To get the input value from textbox, you can use below code: driver.findElement(By.xpath(".//*[@id='vehicleNum']")).sendKeys("1121"); String str = driver.findElement(By.xpath(

confused by control flow execution in C++ Primer example

…衆ロ難τιáo~ 提交于 2019-12-06 12:18:09
I am going through C++ Primer (5th ed). In section 1.4.4, there is the following example: #include <iostream> int main() { // currVal is the number we're counting; we'll read new values into val int currVal = 0, val = 0; // read first number and ensure that we have data to process if (std::cin >> currVal) { int cnt = 1; // store the count for the current value we're processing while (std::cin >> val) { // read the remaining numbers if (val == currVal) // if the values are the same ++cnt; // add 1 to cnt else { // otherwise, print the count for the previous value std::cout << currVal << "

User idle time while typing in input

删除回忆录丶 提交于 2019-12-06 07:32:53
The problem I'm having is a search function which should call my doSearch() -method after the user stopped typing for at least 100ms in my $("input#q) field. I tried to achieve this by using the logic of this answer , but I'm stuck with where I should set/unset the setInterval() which increments the idleTime . var idleTime = 0; $("input#q").keyup(function() { idleTime = 0; idleInterval = setInterval(function() { idleTimeIncrement(); }, 25); }); function idleTimeIncrement() { idleTime += 25; if (idleTime >= 100) { doSearch($("input#q").val()); } } The error I'm getting in Firebug Console says:

In Python, how could I get a user input while simultaneously running the script?

不羁的心 提交于 2019-12-06 06:14:05
In my program I am trying to take the chat from a website and printing it on my console. While that's going on I'm using raw_input to get chat from whoever is using it. My problem is that raw_input pauses the rest of the script until i say something or press enter. Is there a simple way to fix this? You have to multithread. One thread for user input and another for the background tasks. The documentation is a bit complex (I'm pretty confused by it), but it's a start: http://docs.python.org/library/threading.html You may also want to look into the curses module: http://docs.python.org/library

google apps script: html - form submit, get input values

自作多情 提交于 2019-12-06 04:31:10
问题 I'm trying to use a sidebar with a form to get user input. The code is bound to a Google Sheets file. Code.gs: function onOpen() { SpreadsheetApp.getUi() .createMenu('Custom Menu') .addItem('Show sidebar', 'showSidebar') .addToUi(); } function showSidebar() { var html = HtmlService.createHtmlOutputFromFile('Page') .setTitle('My custom sidebar') .setWidth(300); SpreadsheetApp.getUi() .showSidebar(html); } function processForm(formObject) { var ui = SpreadsheetApp.getUi(); ui.alert("This should

Best way to check whether a TextBox is empty or not

落爺英雄遲暮 提交于 2019-12-06 04:23:22
问题 I have a TextBox. And I want to check if it's empty. Which way is better if(TextBox.Text.Length == 0) or if(TextBox.Text == '') ? 回答1: You should use String.IsNullOrEmpty() to make sure it is neither empty nor null (somehow): if (String.IsNullOrEmpty(textBox1.Text)) { // Do something... } More examples here. For practical purposes you might also consider using String.IsNullOrWhitespace() since a TextBox expecting whitespace as input probably negates any purpose, except in case of, say,

Problems with 'int'

谁说我不能喝 提交于 2019-12-06 04:21:20
I'm new to programming, so I want to write a code that will let me input a 2 dimensional array (or a matrix in my case) and print it afterwards. #include <iostream> using namespace std; void printArray( const int *array, int count ) { for ( int i = 0; i < count; i++ ) cout << array[ i ] << " "; cout << endl; } int main () { int n; cout<<"Please enter the length of your matrix : "<<endl; cin>>n; int * y=new int [n]; for (int w = 0; w <= n-1; w++ ) { y[w] = new int [n]; cout<<"Insert the elements "; for (int z = 0; z <= n-1; z++) { cin >>y [w][z]; } } printArray(y, n); } However I get errors

How to stop a running method with keyboard input in a Console Application on C#?

旧巷老猫 提交于 2019-12-06 01:48:00
问题 In short, I'm utilizing C# to scientific computation and I've written a method that has a while loop that may run to a user-specified quantity of steps... Actually, this method may take too long to execute (like more than 5 hours). When it takes this long, I may want to stop the method pressing Esc key, for example. As I read something about breaking while , it is as simple as a Boolean flag or something like this. So I thought in something like this: public Double? Run(int n) { int i = 0;

python library for user input

♀尐吖头ヾ 提交于 2019-12-06 01:43:15
问题 I am implementing a small command line tool in python that needs to ask the user a couple of questions. I use raw_input('Are you male or female?') all the time. Now I would like to be able to deal with dumb users (or those too lazy to read/remember the documentation), so I need to check whether the answer makes sense. gender = '' while gender not in ['male', 'female']: gender = raw_input('Are you male or female?') I am wondering whether there exists something like argparse that would automate