user-input

How do you implement a good profanity filter?

Many of us need to deal with user input, search queries, and situations where the input text can potentially contain profanity or undesirable language. Oftentimes this needs to be filtered out. Where can one find a good list of swear words in various languages and dialects? Are there APIs available to sources that contain good lists? ...

How to scan in two arrays from user??

I'm relatively new to programming and I have to write a function that reads in input from the user and to fill two arrays then compare them. I guess what I'm confused on is how to read in both arrays. This is what I'm supposed to do, Write a table_diff fuction that compares two arrays of integers and returns the subscript of the first ...

Input handling in WinForm

What is the best way to block certain input keys from being used in a TextBox with out blocking special keystrokes such as Ctrl-V/Ctrl-C? For example, only allowing the user to enter a subset of characters or numerics such as A or B or C and nothing else. ...

How do you handle/react to user input concurrency on the GUI layer?

What are good ways to handle user input concurrency? As the answers to this question already rule out database locking, how do you handle concurrent user inputs in general? Is locking always a bad idea, even if it is not implemented by row locking? Are there best practices which are not use case dependant? What were your experiences wi...

Effective Keyboard Input Handling

What is a good way to implement keyboard handling? In any language, where I write a keyboard-interactive program (such as a tetris game), I end up having some code that looks like this: for event in pygame.event.get(): if event.type == KEYDOWN: if False: pass #make everything an elif elif rotating: pass ...

JavaScript: Check if mouse button down?

Is there a way to detect if a mouse button is currently down in JavaScript? I know about the "mousedown" event, but that's not what I need. Some time AFTER the mouse button is pressed, I want to be able to detect if it is still pressed down. Is this possible? ...

PHP to clean-up pasted Microsoft input

I have a site where users can post stuff (as in forums, comments, etc) using a customised implementation of TinyMCE. A lot of them like to copy & paste from Word, which means their input often comes with a plethora of associated MS inline formatting. I can't just get rid of <span whatever> as TinyMCE relies on the span tag for some of i...

Use Javascript to change which submit is activated on enter key press.

I have a form on an HTML page with multiple submit buttons that perform different actions. However, when the user is typing a value into a text input and hit enters, the browsers generally act as though the next submit button sequentially was activated. I want a particular action to occur, so one solution I found was to put in invisible ...

Using user input to find information in a Mysql database

I need to design a program using python that will ask the user for a barcode. Then, using this barcode, it will search a mysql to find its corresponding product. I am a bit stuck on how to get started. Does anyone have any tips for me? ...

Java - UserInput.* doesn't work on my Mac

I do most of programming work on the Windows terminals in my university. However, my computer is a Mac and, for some reason, the javac command throws up an error when I use UserInput methods. Is there anything to install or an alternative command to use to make this compile properly? ...

How do you handle user input during full-text search on ms sql server?

Hi all, I have a simple search mechanism on ms sql server that uses full-text "contains". I pass search value as a parameter to contains predicate - directly from user's input (via asp.net web site). The problem is that i get sql exception in variety of cases: - when user inputs two words, like 'simple case' - when user adds qoute to se...

WYSIWYG textarea component security

Really my question has more to do with the server-side scrubbing of html that's accepted via the WYSIWYG form component. Right now I'm leaning toward using htmlpurifier.org's library. I'm using php strip_tags() function elsewhere. Anyone have an advice/preferences/recommendations? ...

Java - Easier way to guarantee integer input through Scanner?

For a program I am writing, I need to ask a user for an integer between 1 and 8. I've tried multiple (cleaner) ways of doing this but none of them worked, so I'm left with this: int x = 0; while (x < 1 || x > 8) { System.out.print("Please enter integer (1-8): "); try { x = Integer.par...

Best method for pre and post processing multilingual user input for a php/mysql CMS

Okay, there is a ton of stuff out there on sanitizing strings but very little, that I can find, on the best methods to prepare user input (like what I'm typing now) for inserting into a content management system then how to filter it coming out. I'm building two multilingual (Japanese, English + other Romance languages) CMSs and having ...

Converting user-entered search query to where clause for use in SQL Server full-text search

What's the best way to convert search terms entered by a user, into a query that can be used in a where clause for full-text searching to query a table and get back relevant results? For example, the following query entered by the user: +"e-mail" +attachment -"word document" -"e-learning" Should translate into something like: SELECT...

Selecting a date on a mobile web site

I'm working on a web site that includes creating appointments on the mobile site. I have to make it work on IE Mobile. The biggest challenge is to come up with a way to do date selection on a mobile site that: Is compact enough to not take forever to load on the limited-bandwidth cell network. Will work on Windows Mobile 6 Prevents t...

Best way to preserve user-generated HTML across a post request?

I am building a site that is an interface used to create XML files that are read as input by a server side program. The website allows users to dynamically create blocks of HTML. Each block can be thought of as an object and contains several input fields. When the user submits the form, the data is turned into an XML file. What is th...

What's the best approach to get Date/Time input from the user?

This is a wheel that's been re-invented again and again over the years. The Problem: The user needs to input a Date/Time Basic considerations We want to make it as easy as possible for the user to enter the desired date/time Some applications call for historical dates, some applications call for future dates only, some will need to ...

Handling From and To Range Field Values

Say for example I am getting a range of integers from a user: Generate between nnn and nnn widgets. Yes, most users will ensure that the first number is equal to or less than the second number: Generate between 3 and 7 widgets. But then there's that user, who wants to enter this data "back to front"; Generate between 7 and 3 widgets...

How to disable input pad when pressing done on iphone?

I want to disable input pad on iphone when pressing 'done'. Any ideas about how to detect button press event? ...