user-input

Webchart: user can add points by clicking

What are the best libraries for interactive webcharts allowing the user to add data points by clicking? I would like to basically have a graphical input device sitting on the browser. I think google charts and JFreeChart can do something like this. Wide open license is a plus but this is just for a learning project so not a big deal. A...

PHP: best security practices for displayed information?

In PHP, I know that using parameterized queries is the best way to prevent SQL injection. But what about sanitizing user input that will be used for other purposes, such as: Displaying back to a user (potential cross-site scripting vector) Addressing an email or filling in the message body Is htmlentities() the best way to sanitize ...

Disadvantages of scanf

Hi all, I want to know what disadvantage of scanf() exist. In many of a sites I have read that using scanf will cause buffer overflow some times. What is the reason for that, and is there any other drawbacks with scanf? ...

Running a Java program with input from a file

I am writing a program that reads the input from a file and then prints it to the screen. When I run it without taking the input from the file, it works perfectly fine. However, every time I try to run it from the file it gives me an "Exception in thread "main" java.util.NoSuchElementException: No line found at" error that occurs every p...

user input of one php script pass to another php without modification in first php script

hi all.. Consider two php scripts(o.php & t.php) o.php contains both html and php. html here gets user input for eg:user name and password this information is passed to php using php-self. I want the user input of o.php passed to t.php without any modification in o.php. I ve used include and require in the t.php but the problem is it...

Is it safe to display user input as input values without sanitization?

Say we have a form where the user types in various info. We validate the info, and find that something is wrong. A field is missing, invalid email, et cetera. When displaying the form to the user again I of course don't want him to have to type in everything again so I want to populate the input fields. Is it safe to do this without san...

Prevent python from printing newline

I have this code in Python inputted = input("Enter in something: ") print("Input is {0}, including the return".format(inputted)) that outputs Enter in something: something Input is something , including the return I am not sure what is happening; if I use variables that don't depend on user input, I do not get the newline after for...

Read more numbers in a line in Python

Let say i want to read the integers a, b and c from stdin (in one line, do not need to press return after each number). In c++, i would just do: cin >> a >>b >> c; How to do this in Python ? ...

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

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. ...

How to safely let users submit custom themes/plugins for a Rails app

In my rails app I'd like to let users submit custom "themes" to display data in various ways. I think they can get the data in the view using API calls and I can create an authentication mechanism for this. Also an authenticated API to save data. So this is probably safe. But i'm struggling with the best way to let users upload/submi...

CELLS: User input check - Alert if value is incorrect- If cell blank, do not run macro.

My problem: I have two ranges “R16” and R01”. These ranges were set by swiping a range and then renaming it in the upper left panel of sheet. Each range requires users to fill in each cell with a value. R16 requires users to enter a number of 0 through 6. The range R01 requires a value of 0 or 1 to be entered. NO cell can be left...

How do you handle key down events on Android? I am having issues making it work.

For an Android program, I am having trouble handling key down and key up events, and the problem I am having with them can almost certainly be generalized to any sort of user input event. I am using Lunar Lander as one of my main learning devices as I make my first meaningful program, and I noticed that it was using onKeyDown as an over...

Alerting for incorrect cell values

My problem: I have two ranges R16 and R01. These ranges were set up by swiping each range and then renaming them in the upper left panel of the sheet. Each range requires users to fill in each cell with a value. R16 requires users to enter a number of 0 through 5. The range R01 requires a value of 0 or 1 to be entered. NO cell can be lef...

WYSIWYG-editor with "add custom html feature" and secure (validated) html output?

I've been looking into some of the WYSIWYG editors (TinyMCE, FCKEditor, etc.) and they all seem to offer a lot of options. However, one vital feature that seems to lack is a simple "add custom html" option which would allow the user to input any of these embed-snippets you find all around the web these days, for example a youtube video....

Disable input fields based on selection from drop down

I have a drop down box and some text input fields below it. Based on which item from the drop down menu the user selects, I would like to disable some of the fields. I think I am failing to target the input fields correctly but I can't figure out what the problem is: Here is the script I have gotten so far: $(document).ready(function()...

How to allow multiple inputs from user using R?

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 ...

Removing non-alphanumeric characters from a string

I have a string in PHP and I want it to match the regex [A-Za-Z0-9]. How can I do this? ...

Encapsulating user input of data for a class (C++)

For an assignment I've made a simple C++ program that uses a superclass (Student) and two subclasses (CourseStudent and ResearchStudent) to store a list of students and print out their details, with different details shown for the two different types of students (using overriding of the display() method from Student). My question is abo...

Formatted input in c++

hey, i'm a noob to c++ (and coding in general) i'm looking for an easy way to take two doubles (at once) from the keyboard and store them in a struct i've created called "Point" and then ultimately store the Point into a vector of Points that's a member of a class (called "Polygon"). i know i could do it with a scanf but need to know how...

Optimal UI For Single Zip Code Entry on iPhone

I need to prompt the user to enter his/her zip code at certain times in my iPhone application. I cannot store it or get it from the user's current location. What is the optimal input method? I started with a 5 wheel picker. This seemed like a bad direction, so I opted for a PIN-like entry screen. My implepentation is about the same as ...