validation

Should I mysql_real_escape_string all the cookies I get from the user to avoid mysql injection in php?

When a user goes to my site, my script checks for 2 cookies which store the user id + part of the password, to automatically log them in. Its possible to edit contents of cookies via a cookie editor, so I guess its possible to add some malicious content to a written cookie? Should I add mysql_real_escape_string (or something else) to al...

Best way to validate drag/drop operations for a TreeView in C#

I want to verify a drag & drop operation is allowed. A valid item can come from another one of our "controls", or internally from within the custom treeview. Currently I have this: bool CanDrop(DragEventArgs e) { bool allow = false; Point point = tree.PointToClient(new Point(e.X, e.Y)); TreeNode target = tree.GetNodeAt(point...

Is there a .NET function to validate a class name?

I am using CodeDom to generate dynamic code based on user values. One of those values controls what the name of the class I'm generating is. I know I could sterilize the name based on language rules about valid class names using regular expressions, but I'd like to know if there is a specific method built into the framework to validate a...

Any Yahoo YUI validation framework that I can implement in asp.net MVC?

Hi, Has anyone seen a Yahoo YUI validation framework that I could implement into asp.net MVC? I've seen a jQuery one but I want to work wit YUI. ...

WCF faults and exceptions

I'm writing a WCF service for the first time. The service and all of its clients (at least for now) are written in C#. The service has to do a lot of input validation on the data it gets passed, so I need to have some way to indicate invalid data back to the client. I've been reading a lot about faults and exceptions, wrapping excepti...

How do you go about validating check boxes in ASP.NET MVC?

Hi, I am wondering what methods people are using for validating check boxes in ASP.NET MVC (both client and server side). I am using JQuery currently for client side validation but I am curious what methods people are using, ideally with the least amount of fuss (I am looking for a new solution). I should mention that I am currently u...

ASP.NET: Syncing client and server-side validation rules

Are there any easy, smart ways to keep your client and server-side validation-rules synchronized? On the client side we have JavaScript, maybe some kind of framework like jQuery or YUI. On the server-side we have ASP.NET WebForms or ASP.NET MVC. What is validated are things like: Correct e-mail-addresses Correct home-addresses and p...

Validate XML using a custom DTD in PHP

Is there a way (without installing any libraries) of validating XML using a custom DTD in PHP? ...

WPF Validation for the whole form

Hi, I have been seriously disappointed with WPF validation system. Anyway! How can I validate the complete form by clicking the "button"? For some reason everything in WPF is soo complicated! I can do the validation in 1 line of code in ASP.NET which requires like 10-20 lines of code in WPF!! I can do this using my own ValidationEng...

How verbose should validation output be?

I have an application that reads a database and outputs alerts to any dependencies that are not being met. My thinking on this issue is "Give the minimum information that points the user to the issue." I have been told by a co-worker that I should be as verbose as possible, printing out the values of the database fields for each field ...

Whats the best way to pass html embed code via rss feed to a rss parser in php?

Im trying to put an html embed code for a flash video into the rss feed, which will then be parser by a parser (magpie) on my other site. How should I encode the embed code on one side, and then decode it on the other so I can insert clean html into the DB on the receiving server? ...

UTF-8 validation

I'm processing some data files that are supposed to be valid UTF-8 but aren't, which causes the parser (not under my control) to fail. I'd like to add a stage of pre-validating the data for UTF-8 well-formedness, but I've not yet found a utility to help do this. There's a web service at W3C which appears to be dead, and I've found a Wind...

What Event to Trigger Javascript Form Field Validation and Formatting?

Let me first say, we validate every field on the server side, so this a question about client-side usability. What is the conventional wisdom on exactly when to validate and format html form input fields using javascript? As an example, we have a phone number field. We allow numbers, spaces, parentheses, and hyphens. We want the fiel...

Problem with Asp.Net RequireFieldValidator and Javascript WYSIWYG

I am using the open source Javascript WYSIWYG from OpenWebWare and Asp.Net RequiredFieldValidator on the TextBox which I am calling the WYSIWYG for. Everything works fine, but the first time I try to submit the form, I get the server-side RFV ErrorMessage "Required", but if I submit a second time, it goes through. Am I missing somethin...

A comprehensive regex for phone number validation

I'm trying to put together a comprehensive regex to validate phone numbers. Ideally it would handle international formats, but it must handle US formats, including the following: 1-234-567-8901 1-234-567-8901 x1234 1-234-567-8901 ext1234 1 (234) 567-8901 1.234.567.8901 1/234/567/8901 12345678901 I'll answer with my current attempt, b...

XML Schema (XSD) validation tool?

At the office we are currently writing an application that will generate XML files against a schema that we were given. We have the schema in an .XSD file. Are there tool or libraries that we can use for automated testing to check that the generated XML matches the schema? We would prefer free tools that are appropriate for commercial...

Is there a way to validate hAtom microformat?

I have implemented hAtom microformat on my blog. At least, I think I have, but I can't find any validator (or any software that uses hAtom) in order to determine if I have done this correctly. A Google search for "hatom validator" currently doesn't return anything useful. Does anyone know of a way to confirm that it is implemented cor...

How to change "3 errors prohibited this foobar from being saved" validation message in Rails?

In my rails app I use the validation helpers in my active record objects and they are great. When there is a problem I see the standard "3 errors prohibited this foobar from being saved" on my web page along with the individual problems. Is there any way I can override this default message with my own? ...

Unit Testing data?

Our software manages a lot of data feeds from various sources: real time replicated databases, files FTPed automatically, scheduled running of database stored procedures to cache snapshots of data from linked servers and numerous other methods of acquiring data. We need to verify and validate this data: has an import even happened i...

Detecting WPF Validation Errors

In WPF you can setup validation based on errors thrown in your Data Layer during Data Binding using the ExceptionValidationRule or DataErrorValidationRule. Suppose you had a bunch of controls set up this way and you had a Save button. When the user clicks the Save button, you need to make sure there are no validation errors before proc...