user-input

jQuery - remove user input text from textarea

帅比萌擦擦* 提交于 2019-11-30 06:37:37
Okay I have a list of devices where i can select which to edit. I have 3 states for the edit. When no devices are selected, when 1 device is selected or when x devices are selected. The problem i have is when a user type some text in the textarea (commentField) and cancels the edit to edit another device, the text there was typed in the textarea won't disapere. It stays so when i get the new dialog for the new edit, the commentfield has the text from the old commentField (as if it wasn't cleared) I have tried the following codes to remove the text (both when then cancel button is pressed and

How to get graphic tablet pen pressure value?

我只是一个虾纸丫 提交于 2019-11-30 06:32:47
问题 I'm using a Wacom Bamboo Pen tablet and I'd like to be able to get its pen pressure value in my application written in C#. How do I do that? Is there maybe an API that allows one to get pen values on Windows 7? 回答1: Wacom provides an extensive API to get data directly from the tablet.The API includes example code for detecting pressure, tilt and other interactions: Tilt Test: Demonstrates pressure, use of the eraser and pen tilt properties Pressure Test: Demonstrates how to detect and display

Handle spaces in argparse input

孤者浪人 提交于 2019-11-30 05:58:52
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 post) For those who can't parse arguments and still get "error: unrecognized arguments:" I found a

Auto Complete User Input PowerShell 2.0

落花浮王杯 提交于 2019-11-30 04:22:05
问题 I have a large list of data (over 1000 different values) and I want the user to be able to select certain values from the list from a PowerShell console. What is the easiest way from within the console to allow the user to quickly select values? I would like to do something like tab completion or the ability to use the arrow keys to scroll through the values but I am not sure how to do either of these things. Any advice would be greatly appreciated. 回答1: PowerShell tab completion can be

jmeter testcases which can handle captcha?

旧街凉风 提交于 2019-11-30 04:01:26
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 do was to download the captcha link and display, and wait for user to type in the value. Once done, everything goes as usual. We couldnt find any plugin that can do the same? Other than writing our own plugin, is there any option here? Since CAPTHA used to detect non-humans, JMeter will always fail it. You have to make a workaround in your software:

Escaping user input from database necessary?

人走茶凉 提交于 2019-11-30 03:31:05
So I know about MySQL injection and always escape all my user input before putting it in my database. However I was wondering, imagine a user tries to submit a query to inject, and I escape it. What if I then at a later moment take this value from the database, and use it in a query. Do I have to escape it again? So: ( sql::escape() contains my escape function) $userinput = "'); DROP `table` --"; mysql_query("INSERT INTO `table` (`foo`,`bar`) VALUES ('foobar','".sql::escape($userinput)."')"); // insert php/mysql to fetch `table`.`bar` into $output here mysql_query("INSERT INTO `table2` (`foo`,

Opening a Dialog with text input from within a View in Android

假如想象 提交于 2019-11-30 02:31:46
I have an app with a View based on the SurfaceHolder (similar to the Lunar Lander tutorial). The whole GUI is drawn on a canvas, and I want to be able to prompt for user text input at a given moment using a custom layout Dialog, that is then taken care of and rendered to the canvas using standard procedure. My problem, however, is that it seems that best practice is to open Dialogs from the Activity. This is no problem either, since i thought i might create a Handler and then pass it to the View that could in turn use it to pass Messages from the GUI thread in the View on to the Activity, that

HTML Input field force numbers

吃可爱长大的小学妹 提交于 2019-11-30 01:53:26
问题 Is it possible to create an input field that sets the default input character set to numbers on a mobile phone (so the NUMERICAL KEYBOARD POPS UP )? For example to make it easier type in a telephone number into a HTML form. 回答1: It is possible to limit entry on a "mobile phone" The mobile phone form entry uses <!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml"> input here can be limited using format="*N" 回答2: To make inputing numbers easier, use

How can I safely use regexes from user input?

安稳与你 提交于 2019-11-30 01:27:14
问题 My (Perl-based) application needs to let users input regular expressions, to match various strings behind the scenes. My plan so far has been to take the string and wrap it in something like $regex = eval { qr/$text/ }; if (my $error = $@) { # mangle $error to extract user-facing message ( $text having been stripped of newlines ahead of time, since it's actually multiple regular expressions in a multi-line text-field that I split ). Are there any potential security risks with doing this -

In a bash script, how do I sanitize user input?

纵饮孤独 提交于 2019-11-29 22:50:21
I'm looking for the best way to take a simple input: echo -n "Enter a string here: " read -e STRING and clean it up by removing non-alphanumeric characters, lower(case), and replacing spaces with underscores. Does order matter? Is tr the best / only way to go about this? As dj_segfault points out, the shell can do most of this for you. Looks like you'll have to fall back on something external for lower-casing the string, though. For this you have many options, like the perl one-liners above, etc., but I think tr is probably the simplest. # first, strip underscores CLEAN=${STRING//_/} # next,