user-input

C++ CIN cin skips randomly

I have this program, but cin in randomly skips.. I mean sometimes it does, and sometimes it doesn't. Any ideas how to fix this? int main(){ /** get course name, number of students, and assignment name **/ string course_name; int numb_students; string assignment_name; Assignment* assignment;...

How to change this C++ code to make input work better

cout << "Input street number: "; cin >> streetnum; cout << "Input street name: "; cin >> streetname; cout << "Input resource name: "; cin >> rName; cout << "Input architectural style: "; cin >> aStyle; cout << "Input year built: "; cin >> year; The problem ...

Represent user preferences in XML for web layout reconfiguration

I want to allow users to configure the theme while browsing my web-site(like Joomla uses templates), but it should not be just choosing from the templates I provide them, rather they should be able to choose the visual layout themselves. I think its called end-user-computing or programming by demonstration in research terminology. For th...

supply inputs to python unittests

I`m relatively new to the concept of unit-testing and have very little experience in the same. I have been looking at lots of articles on how to write unit-tests; however, I still have difficulty in writing tests where conditions like the following arise:- Test user Input. Test input read from a file. Test input read from an environmen...

What are the basics of dealing with user input events in Android?

Hello. I thought I had understood this question, but something is quite wrong here. When the user (me, so far) tries to press keys, nothing really happens, and I am having a lot of trouble understanding what it is that I've missed. Consider this before I present some code to help clarify my problem: I am using Android's Lunar Lander e...

Programming style question on how to code functions

Hey all! So, I was just coding a bit today, and I realized that I don't have much consistency when it comes to a coding style when programming functions. One of my main concerns is whether or not its proper to code it so that you check that the input of the user is valid OUTSIDE of the function, or just throw the values passed by the us...

Creating phone number format standard php

I found this resource when looking to commonly format user's phone numbers.... http://www.eyesis.ca/projects/formatphone.html I was wondering if someone else might have a better solution. ...

PHP - HTML Purifier - hello w<o>rld/world tutorial striptags

I am just looking into using HTML Purifier to ensure that a user-inputed string (that represents the name of a person) is sanitized. I do not want to allow any html tags, script, markup etc - I just want the alpha, numeric and normal punctuation characters. The sheer number of options available for HTML Purifier is daunting and, as far...

How can I get user input without waiting for enter in Perl?

I am trying to make an interactive shell script in Perl. The only user input I can find is the following: $name = <STDIN>; print STDOUT "Hello $name\n"; But in this the user must always press enter for the changes to take effect. How can I get the program to proceed immediately after a button has been pressed? ...

User input... How to check for ENTER key

I have a section of code where the user enters input from the keyboard. I want to do something when ENTER is pressed. I am checking for '\n' but it's not working. How do you check if the user pressed the ENTER key? if( shuffle == false ){ int i=0; string line; while( i<20){ cout << "Playing: "; songs[i]->prin...

SML/NJ: getting user input

how do i prompt for user input in a running function? ...

Assembly LC3: How to read input without "input a character" being printed to the display?

I'm writing an assembly language program using lc3 and when I run trap x23 (IN) the message "input a character" comes up. I want it to come up saying Please enter an integer between 1 and 15: but it ends up like this: Please enter an integer between 1 and 15: input a character: Help please ...

C# dealing with invalid user input

Have a simple console app where user is asked for several values to input. Input is read via console.readline(). Ex Name: Fred //string Lastname: Ashcloud //string Age: 28 //int I would like to make sure that int and double types are entered and if the user enters garbage, lets him repeat the procedure. Example, if the user enters "...

Wait set time for user input C# console app

For a Console app, I need to know how to wait at set amount of time (about 10 seconds), for a user to input a key or set of keys, before proceeding with an 'auto run' portion of the application. This is bugging me because I can't quite figure out how the timer works, or threading.sleep, what should I use? Been googling all day. some ps...

Populating a foreign key table with variable user input

I'm working on a website that will be based on user contributed data, submitted using a regular HTML form. To simplify my question, let's say that there will be two fields in the form: "User Name" and "Country" (this is just an example, not the actual site). There will be two tables in the database : "countries" and "users," with "user...

Doctesting functions that receive and display user input - Python (tearing my hair out)

Howdy! I am currently writing a small application with Python (3.1), and like a good little boy, I am doctesting as I go. However, I've come across a method that I can't seem to doctest. It contains an input(), an because of that, I'm not entirely sure what to place in the "expecting" portion of the doctest. Example code to illustrate ...

Changing video on mouseclick?

I have two videos, and I want to loop the first video until the user clicks the mouse, at which point I want to switch to playing the second video. Does anyone know what the best way to do this would be? Edit: Sorry, to clarify, I would prefer to use HTML 5 (assuming this is possible). I am trying to have the two videos swapped out seam...

Cocoa Touch: How do I show a done button on the number input?

I found this question http://stackoverflow.com/questions/584538/how-to-show-button-done-on-number-pad-on-iphone and the solution works in the simulator but not on the device. Is there any way to make this work on the device? Using SDK 3.1.3 ...

Python get raw_input but manually decide when string is done

I want someone to type words in the console, and autocomplete from a list when they hit "tab" key. However, raw_input won't return a string until someone hits [Enter]. How do I read characters into a variable until the user hits [Enter]? *Note: I don't want to use import readline for autocompletion because of OS issues. ...

C++ Detecting ENTER key pressed by user

I have a loop where I ask the user to enter a name. I need to stop when the user presses the ENTER key..... or when 20 names have been entered. However my method doesn't stop when the user presses the ENTER key //loop until ENTER key is entered or 20 elements have been added bool stop = false; int ind = 0; while( !stop || ind >= 20 ){ ...