validation

how do I validate user input as a double in C++?

How would I check if the input is really a double? double x; while (1) { cout << '>'; if (cin >> x) { // valid number break; } else { // not a valid number cout << "Invalid Input! Please input a numerical value." << endl; } } //do other stuff... The above code infinitely outputs the Inv...

PHP - How to allow only one email address and check for the @ sign to validate the email address?

I was wondering how do I allow only one email address? Also how can I only check for the @ sign in the email address to validate the email? Here is my PHP code. if (isset($_GET['email']) && strlen($_GET['email']) <= 255) { $email = mysqli_real_escape_string($mysqli, strip_tags($_GET['email'])); } else if($_GET['email'] && strlen($_...

Using regular expression for validating data is correct or not?

Hi, I have been finding some articles and post which suggest not to use the regular expression to validate user data. I am not sure of all the things but i usually find it in case of email address verification. So i want to be clear whether using regular expression for validating user input is good or not? if it is good then what is b...

rails 3 validation on uniqueness on multiple attributes

Hi folks, I use Rails 3.0.0.beta4 I want to add a validation on uniqueness on two attributes, that means that my model is valid if the couple of 'recorded_at' and 'zipcode' is unique. On one attribute here is the syntax validates :zipcode, :uniqueness => true thanks ...

Databinding and ValidationRules with radiobuttons on WPF

Hi, I'm new to WPF and have been trying to get the databinding working properly. I have simplified my control a bit for this example. With the code I'm happy with the way that the databinding is working with the textbox but i can't get a similar result from the radiobutton. Theres two things I'm trying to get the radiobutton databindi...

Passing any argument to jQuery validate success option

Hello! jQuery validate has a success option that allows you to perform operations when a user enters valid form data. It typically takes the argument of "label" which is a dynamically inserted tag for displaying a success label (like a checkmark). I can't retrieve siblings of "label" for some reason and it doesn't appear in Firebug. ...

jQuery validation: check for existing username in DB

Hello, I want to put together the functionality of these two links: http://www.bitrepository.com/a-simple-ajax-username-availability-checker.html http://bassistance.de/jquery-plugins/jquery-plugin-validation/ (demo: http://jquery.bassistance.de/validate/demo/) It is actually adding the email existence check to the jQuery Validation plu...

jQuery validation

Hi, I posted http://stackoverflow.com/questions/3278074/alert-with-jquery-on-button-click but when I try to comment or click the Solution thingy nothing happens(?). I had forgot a " However, I now have $("input[value='OK']").click(function() { if ($("input[title='Start Date']").val().length < 1) { $("input[title='Start Date']...

Detect MAC Addresses? - via browser, without a plugin

For validation purposes, is there a way to detect a user's mac address as they're signing up on a webpage, for example? I'd prefer a LAMP approach, but also open to ASP.NET possibilities. ...

Date Validation in MySQL

Can anyone help me on how did MySQL can't read a rows of I've try to execute this query. SELECT * FROM attendance where '2010-07-13 00:06:00' BETWEEN timein AND timeout; This is the date in the table: +-----------------------+-----------------------+ | timein | timeout | ------------------------+---------...

Spring Validation Annotations Order

Hi, I want to ask is it possible to set explicitly the validation order in Spring. I mean, I have this command object: public class UserData { @NotBlank private String newPassword; @NotBlank private String confirmPassword; @Email(applyIf="email is not blank") @NotBlank private String email; @NotBlank private String firstNam...

C# XmlDocument.Validate Method calls the ValidationEventHandler numerus times, but line number and position are allways 0

I'm trying to validate an XmlDocument instance using an XmlSchema object (xsd schema). When I call the Validate method of the XmlDocument my ValidationEventHandler is called, but the Exception.lineNumber and Exception.linePosition are always 0 (zero). This is the code I'm using: //Validate XML against xsd schema XmlDocument doc = new Xm...

C# RegularExpression Attribute constructor called once

I am using data annotations to validate an emailaddress. To show an error message when the emailaddress is not valid, I use a RESX file called ErrorMessages. My code is like this: public class EmailAdressAttribute : RegularExpressionAttribute { public EmailAdressAttribute() : base(@"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0...

Adding server certificate validation to httplib.HTTPSConnection

I've found that httplib.HTTPSConnection doesn't perform an automatic server certificate check. As far as I've understood the problem, I need to add that functionality manually, e.g. by subclassing this class as described here. As I'm using Python2.4.5 and an upgrade is not possible under the given circumstances, I cannot use the workaro...

Code supplied by WordPress breaks my XHTML 1.0 Strict-compliant theme

According to the WordPress wiki pages on developing themes, I have to call wp_head() in the <head> tag so that WordPress can insert some additional HTML code into my theme. Normally this doesn't cause any validation problems, but when I search for something on my custom-themed WordPress blog one of the automatically inserted lines doesn'...

WPF : Propagate a validation error down the visual tree

Hello, I often use and re-use usercontrols in my apps. For example, if a user should enter an integer number, I have a usercontrol named "IntegerEditor", which has a label for the title, a textbox for the user input, and a label for the units (inches, seconds, etc...). My user control already has a validation rule that I called "Integ...

bean validation- hibernate error

I am getting following exception when trying to run my command line application: java.lang.ExceptionInInitializerError at org.hibernate.validator.engine.ConfigurationImpl.<clinit>(ConfigurationImpl.java:52) at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:43) at jav...

Is there a Java equivalent/implementation of cracklib?

I need to implement minimum password complexity checking in a Java web application (Spring/Hibernate). It seems that on Linux I could use pam_cracklib, but is there a pure Java alternative? ...

Model Validation with dictionary

Hi, Say I have a model like so: public class MyViewModel { //some properties public string MyString {get;set;} public Dictionary<string,string> CustomProperties {get;set;} } And I am presenting the dictionary property like this: <%= Html.EditorFor(m => m.CustomProperties["someproperty"]) %> All is working well, however I hav...

How to return a true/false statement off of a select conditional in rails..

I am trying to select an array, and check and see if any of the objects within the array are false. If any of them are false, I want an ultimate value of false returned. If all of them are true, I want true returned.. Here's what I have.. validates_presence_of :email, :if => Proc.new { |user| user.organizations.find(:all).select {|org...