user-input

How can I limit the number of characters for a console input? C#

Basically I want 200 characters maximum to come up in Console.ReadLine() for user input before characters start being suppressed. I want it like TextBox.MaxLength except for console input. How would I go about this? And I don't want to do input.Substring(0, 200). Solved: I used my own ReadLine function which was a loop of Console.Read...

Dealing with simultaneous button presses and changing shift states

I am currently working on a (Python2.5) application which handles input from a game controller. We've designated a button as a shift button to change the mapping (inputtype,value->function) of the other buttons on the fly. The mapping also depends on the mode our application is running in. We are running into lots of hairy edge cases (e....

Objective-C block not being released for background-only applications

I have an application that runs in the background only (by specifying LSBackgroundOnly in the info.plist file). The problem is, that all blocks that I run on parallel queues are not being released. The (simplified) code looks like below. Blubber is just some dummy class that holds an NSDate for testing. Also, it overwrites retain, rele...

Creating a gui around a python script using Tkinter

I have an existing python script and I want to wrap it in a GUI. Since I already have tkinter installed I would like to use it if possible. At the moment my script has many places where it asks for user input using raw_input(). I would like to replace these with either a modal pop-up asking for user input or (preferably) an Entry obje...

Creating basic PHP script to add lines to a webpage.

I'm predominately a Java guy, which is why I need some assistance on what I assume is rather simple to do in PHP (and rather simple with Java too, although perhaps a bit... verbose). Simply put, I want to construct a webpage which has a list of string items that users have added. At the bottom of the page would be a place in which a use...

HTML input readonly security risk?

Is it safe to rely on the data of a html input field set to readonly? What is the purpose of a readonly field? I know the disabled fields are not pushed to $_POST whereas readonly are? Essentially what I want is a dynamic value in my form that is unchangeable to the user. Would it be more appropriate to place this in session or w...

track user input from UIKeyboard

How can I get user input of the UIKeyboard on the iPhone? I want to track, if the user hits "backspace" when the firstResponder UITextField is empty. I know how I can track a text change but if the field is empty the text don't change when hit "backspace". ...

Limit width of formatted user input - Javascript, CSS or jQuery

How do you prevent formatted user input past a max width? (e.g., 800 pixels) The user input is formatted because it is entered into a WYSIWYG text editor (CK Editor). This solution doesn't work: // Replicate user input in hidden div // Check width // If width > 800px, remove characters ...because you'd be removing characters fro...

Would someone explain to me why type(foo)(bar) is so heavily discouraged?

I have a dict of configuration variables that looks something like this: self.config = { "foo": "abcdef", "bar": 42, "xyz": True } I want to be able to update these variables from user input (which, in this case, will always be in the form of a string). The problem I'm facing is obvious, and my first solution seemed good e...

PHP & MYSQL : building a query based on multiple input values from users

Hypothetically I three tables: * recipes - contains recipes * ingredients - list of items * meals - list of meals I have a form that generates a selection like: Choose what ingredients you have: - apples - bananas - cherries Choose the meal this is for: - breakfast - lunch - dinner I want the user to be able to choose from either o...

PHP - Single Quotes Filtering

i have some HTML code saved in a PHP string $str = "<font size=2 color=#e0e0e0>you don't have a clue</font>"; i have to write this string to DB so the $str has to become part of the query.. now whatever my query... its working fine as long as there are no 'SINGLE QUOTES in the string.... any of the following two will solve my prob...

WPF tab-control with the same controls for all tabs

How do I create n-numbers of tabs with the data controls in wpf? Let's say the main application has a button called "new customer" and "save data." When "new customer" is pressed a new tab appears with two text boxes "Name" and "Customer Number" contained in the tab, and so on. Once the two fields are populated, pressing the "save Data"...

C#- Getting error when trying to parse user input to int

Hi, I am new to c#, and I can't figure out why I keep getting a 'FormatException was unhandled' error when I run this method: public void bet() { int betAmount; Console.WriteLine("How much would you like to bet?"); betAmount = int.Parse(Console.ReadLine()); Console.WriteLine(_chips - betAmount); } The program does no...

unable to create SP Library in Bulgarian

hi, I am using one Aspx page where it takes the input from user and create the wiki library with the name entered by User. The issue is , when I am creating name in Eglish it is creating properly. but suppose I give library name ¿¿¿¿¿¿¿ TEXT 4, I get the following error http://vm2003/ Наредби TEXT 4/Forms/AllPages.aspx?PageView=Shared ...

Platform-independent detection of arrow key press in C++

In a C++ console program, I've found how to detect and arrow key on Windows, and I've found a lot of other stuff that had nothing to do with the question (despite what I thought were good search terms), but I want to know if there is a platform-independent way to detect an arrow key press. A decent second place for this would be how to ...

HTML Input field force numbers

Is it possible to create an input field that sets the default input character set to numbers on a mobile phone? For example to make it easier type in a telephone number into a HTML form. ...

Problems with dynamic RegExp construction in Javascript

This method is to prevent users from entering anything but numbers and "allowed characters." Allowed characters are passed as the parameter allowedchars. So far, the method prevents number entries but the allowedchars doesn't work (tried with passing "-" (hyphen) and "." (period)). So I'm assuming my dynamic regex construction isn't...

Terminating multi-line user input?

Hey all, having a bit of a problem with a recent project. The goal here is to be able to input several lines of text containing a date in mm/dd/yyyy format followed by a whitespace and then a description of the event. I've accomplished actually allowing for multiple lines of text input (I think), but now I'm not exactly sure how to stop ...

What is a more elegant solution to these nested if/elseif statements?

I'm building a website that contains users with user profiles. Many of the fields in the profile are optional. There is an opportunity for a lot of user-generated content, and so I need to display the author of this content in many different locations of the site (comments, posts, etc.). In the user's profile, he is able to (optiona...

While loop designed to break on null user entry, doesn't break on null user entry

I'm making an app that lets people make surveys. My idea is to let people enter unlimited choices for a question, and to signal when they're done with that question by pressing Enter on a new line, at which point I let them enter the next question and that question's choices. I thought that pressing Enter on an empty line would result in...