input

How to convert a character in to equivalent System.Windows.Input.Key Enum value?

I want to write a function like so, public System.Windows.Input.Key ResolveKey(char charToResolve) { // Code goes here, that resolves the charToResolve // in to the Key enumerated value // (For example with '.' as the character for Key.OemPeriod) } I know I can write a huge ...

How to retrieve the size of a file before uploading it?

I have an file input tag in my web app. I'd like to check that the file isn't too big before sending it to the server. Of course, I still have validation server side. Is there any way to do this with JavaScript? It must work in IE7+ and FF3+. Thank you. EDIT: somefileinputobject.files[0].filesize works in FF, but not IE. ...

Getting input and output from a jar file run from java class?

Hi, I have a jar file that runs this code: public class InputOutput { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { boolean cont = true; BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); while (cont) { System.o...

What is the best way to filter URLs for input?

I have a form that is accepting URLs from users in PHP. What characters should I allow or disallow? Currently I use $input= preg_replace("/[^a-zA-Z0-9-\?\:#.()\,\/\&\'\\"]/", "", $string); $input=substr($input,0,255); So, it's trimmed to 255 chars and only can include letters, numbers, and ? - _ : # ( ) , & ' " / Anything I should b...

Avoiding a SAS error message: "NOTE: Invalid argument to function INPUT"

Is there a way to test if a variable will fail the INPUT conversion process in SAS ? Or alternatively, if the resulting "NOTE: Invalid argument" message can be avoided? data null; format test2 date9.; input test ; test2=INPUT(PUT(test,8.),yymmdd8.); if error =1 then do; error=0; test2=INPUT(PUT(test-1,8.),yymmdd8.); end; put te...

Setting a timeout on ifstream in C++?

Hi! We're trying to read data from 2 usb mice connected to a linux box (this data is used for odometry/localization on a robot). So we need to continuously read from each mouse how much it moved. The problem is that when a mouse is not moving, it doesn't send any data, so the file stream from which we get the data blocks execution and t...

How to obtain the keycodes in Python

I have to know what key is pressed, but not need the code of the Character, i want to know when someone press the 'A' key even if the key obtained is 'a' or 'A', and so with all other keys. I can't use PyGame or any other library (including Tkinter). Only Python Standard Library. And this have to be done in a terminal, not a graphical i...

Why does Firefox use the IE box model for input elements?

Try the following simple example: <html> <head> <style> div, input{ border: 1px solid #000; margin: 2px; padding: 3px; width: 100px; } </style> </head> <body> <div>div</div> <input value="input" /> </body> </html> Notice the div and the input gets different widths. In fact, the width of the input is 92px. For the input...

How to disable file input text box in IE?

Is it possible to prevent a user from typing in a file input text box in IE? The reason I ask is that if a user enters text that does not look like a file system path (eg. doesn't start with something like c:...) then when the user clicks the submit button nothing will happen. I would either like to not allow the user to type in the bo...

How can I send a ByteArray (from Flash) and some form data to php?

I have a sketch pad made in Flash AS3 like this one here: http://henryjones.us/articles/using-the-as3-jpeg-encoder I want to send the jpg to the server and some data from a html form field with php. Is there a way to force the Flash movie to deliver the image file when one presses the submit button? ...

CSS to hide INPUT BUTTON value text

I am currently styling an input type='button' element using something like: background-url: url(someimage); color: transparent; background-color: transparent; -the point is i want the button to show as an image, and i want the value-text to NOT display on top of it. This works fine for Firefox as expected. However, on IE6 & IE7 i can ...

How do I use jQuery's form.serialize but exclude empty fields

I have a search form with a number of text inputs & drop downs that submits via a GET. I'd like to have a cleaner search url by removing the empty fields from the querystring when a search is performed. var form = $("form"); var serializedFormStr = form.serialize(); // I'd like to remove inputs where value is '' or '.' here window.l...

Problem getting Javascript variable to hidden input value

Hi, I'm trying to create a system where you can drag and resize divs (jquery ui) and then save the positions and sizes to a css file. I already got the system working with one div, but now that I tried to update the system to support multiple divs, I ran into a problem. The source: http://ezmundorf.110mb.com/problem.txt (It's ugly, but...

How do you read a word in from a file in C++?

So I was feeling bored and decided I wanted to make a hangman game. I did an assignment like this back in high school when I first took C++. But this was before I even too geometry, so unfortunately I didn't do well in any way shape or form in it, and after the semester I trashed everything in a fit of rage. I'm looking to make a txt ...

How to extend array's in C#

I have to do an exercise using arrays. The user must enter 3 input (each time, information about items) and the inputs will be inserted in the array Then i must to display the array. The difficulty i face is that i don't know how to increase the array's length without changing the information within it and how to allow the user to ent...

Why is a second cin.ignore() necessary?

I've noticed that whenever I write a program that uses std::cin that if I want the user to press Enter to end the program, I have to write std::cin.ignore() twice to obtain the desired behavior. For example: #include <iostream> int main(void) { int val = 0; std::cout << "Enter an integer: "; std::cin >> val; std::cout...

ASP.Net MVC RC2 ValidationMessage and form field conflict?

I am having problems with MVC RC2 where upon validation failure, the failed field will throw a NullReferenceException when the view is passed back to the user. A short term solution was found: which was to rename the Html.ValidationMessage to be different than the Target Form Field. This works! BUT now the automatic highlighting is di...

file input optput

i want to read a microsoft word file without use of data connection, ...

restrict user input using javascript

Hi there, Can someone show me some example for restricting user input (on input tag) in Javascript? Something that when we set the input (type="text") to only accept numeric, so it will ignore any other input except for numeric... I think it's handy for number input (such as zip, credit card, money, value, score, date etc...), and if ...

System.InvalidOperationException: Unable to generate a temporary class (result=1).

Hi, I have developed an application using .net 3.5 and have deployed it as an .exe on a number of machines with the same environment. However, on one particular machine I get the following error. Am puttin in the Stack Trace. See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog bo...