user-input

Prevent screen from sleeping with C#

寵の児 提交于 2019-12-05 08:23:36
I have created a small C# console app to move the pointer around the screen, in the hope that this would prevent the screen from sleeping / locking after a few minutes. Unfortunately the screen still goes to sleep after a few minutes. Does anyone know if it's actually possible to write something in C# which will act like user input (either mouse or keyboard), and prevent the screen from sleeping / locking automatically? Here is what I have, which I thought might do the trick. class Program { [DllImport("user32.dll")] static extern bool SetCursorPos(int X, int Y); static Random rnd = new Random

keep user-generated content from breaking layout?

感情迁移 提交于 2019-12-05 07:47:36
I have a site that wraps some user-generated content, and I want to be able to separate the markup for the layout, and the markup from the user-generated content, so the u-g content can't break the site layout. The user-generated content is trusted, as it is coming from a known group of users on my network, but nonetheless only a small subset of html tags are allowed (p, ul/ol/li, em, strong, and a couple more). However, the user-generated content is not guaranteed to be well-formed, and we have had some instances of malformed user-generated content breaking the layout of the site. We are

Force user input in verbatim mode?

牧云@^-^@ 提交于 2019-12-05 07:08:51
问题 I'm trying to any read user input keys in verbatim from Bash script, and then dump it into hex. That is: read input printf "%b" "$input" | xxd -p If user press 2 keys a BACKSPACE , I would hope the output to be 617f , not empty. How can I achieve that? 回答1: This should work #!/bin/bash while true;do stty_state=$(stty -g) #Save stty to reset to default stty raw isig -echo #Set to raw and isig so nothing is interpretted and turn echo off so nothing is printed to screen. keypress=$(dd count=1 2>

html5 input pattern attribute not working outside a form?

ⅰ亾dé卋堺 提交于 2019-12-05 06:39:01
this fiddle works as intended - it displays a warning when the user enters an invalid country code. This other fiddle , without the form element, doesn't work. It seems the input's pattern attribute needs a form to validate. By the way, I'm doing a complex page without forms and I' d like to validate my input fields with `pattern . Is there a way to do that? This is because the validation is part of the HTML5 form validation ( http://www.w3.org/TR/html5/forms.html#client-side-form-validation ). The validations are triggered when the form is submitted en when there are any errors, the submit

Angular 2 Custom Validator: check if the input value is an integer?

会有一股神秘感。 提交于 2019-12-05 05:13:09
In an Angular2 project I need to validate some inputs. How to easily check if an input value is an integer? I tried using Number(control.value) which returns 0 for an empty field - not good. or parseInt(control.value,10) which dis-considers spaces: If i have something like: 1 space 0,24 = 1 ,024 it returns 1 - which passes the validator with no errors. Lodash functions like: _.isInteger(control.value) or _.isNumeric(control.value) // return false every time -which is expected, because an input value is a string not a number. Combining methods like this creates a messy function with many if

Can keyboard of type UIKeyboardTypeNamePhonePad be made to start in phone mode?

自作多情 提交于 2019-12-05 03:54:39
Is there some way to have a keyboard of type UIKeyboardTypeNamePhonePad start in phone number pad mode rather than alphabetic? The keyboard works well for what I need but I'd like it to start in the "other" mode since that is more likely what the user will enter. futurevilla216 I believe that by setting the keyboardType property to UIKeyboardTypeNumbersAndPunctuation , you will default to the numbers and punctuation view, while still having the option of returning to the "ABC" view. Apple's documentation on it: http://developer.apple.com/library/ios/#documentation/uikit/reference

Woocommerce custom user input fields [closed]

橙三吉。 提交于 2019-12-05 01:34:10
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I have a woocommerce store setup with 2 products that come in many variants, these are wristbands. The customer is able to customise the product by selecting the colour, size, band type and they are able to add text to the band if they want to. I have created a variable product with various dropdowns which is

How can I read keyboard input in Python

一个人想着一个人 提交于 2019-12-05 01:15:52
问题 I have problem with keyboard input in Python. I tried raw_input and it is called only once. But I want to read keyboard input every time user press any key. How can I do it? Thanks for answers. 回答1: So for instance you have a Python code like this: file1.py #!/bin/python ... do some stuff... And at a certain point of the document you want to always check for input: while True: input = raw_input(">>>") ... do something with the input... That will always wait for input. You can thread that

gets not waiting for user input in expect script

£可爱£侵袭症+ 提交于 2019-12-05 00:01:00
问题 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 回答1: 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

Java ArrayList, taking user input of multiple types(int, String etc.) in one line

ぃ、小莉子 提交于 2019-12-04 23:54:17
问题 I'm working on getting a little better at Java, and a problem I've run into is taking user input, all in one line like this: System.out.println("Please input numbers that you would like to work with"); //Read in user input into ArrayList, taking into account that they may input Strings or anything else. Assuming the user inputs something like this 1, 2, 4, 257, dog, rabbit, 7, # or even 1 2 4 257 dog rabbit 7 # I've seen in several places how to read in one input at a time, but I wasn't sure