Validation is used to check data to make sure it fits whatever required specifications are set for it.

learn more… | top users | synonyms

0
votes
0answers
19 views

Data validations for reading a file [on hold]

I'm attempting to make some data validation code to validate a read in file. Example of what I want the output to look like: ...
1
vote
1answer
34 views

A simple Ruby EmailAddress class

I wrote this short, plain Ruby lib to handle email address validation inside and outside of Rails applications, and I would like to know what you think. ...
3
votes
2answers
44 views

Validator part 2

This is a follow up to: Validating individual properties and whole items I have a custom class I've written which allows me to validate individual properties of items, without firing validation ...
3
votes
1answer
36 views

Check secure image upload

I want to upload images to server from browser window. I'm using this function for image upload. Images are uploaded by GD library. What is your opinion of this code? Is there still a way to upload a ...
4
votes
1answer
46 views

Data-checking class supporting letters

I'm starting to learn OOP with PHP, and all I've learned so far is just by searching and reading. So I have this need to check input data for certain things like min of chars, max of chars, spaced or ...
2
votes
1answer
54 views

Validating individual properties and whole items

I have a custom class I've written which allows me to validate individual properties of items, without firing validation errors on other properties. This allows me to individually validate what my ...
3
votes
2answers
65 views

Removing synchronization from an agent for a trading system

Is there any way to easily remove synchronization from this code, when there is a validation step before acquiring a lock? I tried an ...
5
votes
2answers
304 views

Calculating the volume of a tetrahedron

Here's my function for calculating the volume of a tetrahedron. I've tried to comment well and perform a few checks on the types of the objects passed to it. Can ...
1
vote
1answer
58 views

An easier way to test a valid username

I have the following requirement for valid usernames: Only alphanumeric characters and - Must not start with a - I wrote this regex (on Rubular): ...
5
votes
3answers
152 views

Constraining data in idiomatic Java

Playing with a simple Java Point class where I would like to constrain the X and Y values to be doubles that must be in the range -10 to 10, inclusive. I've written ...
6
votes
2answers
146 views

Registration form with validation and error messages

I've been working on a registration form page in jQuery Mobile and I think I'm starting to get it fully complete. What I need feedback on is if I've forgotten anything in terms of accessibility, ...
5
votes
2answers
108 views

A way to handle integer input

I'm working on a simple code which purpose is to read input where: The first line is a number of cases to consider. The next lines are integers separated by a space that will be tested lately. ...
2
votes
1answer
39 views

Flask form validation technique

This is currently the code that I'm using to validate and check for errors in a flask app, where the form fields are coming from a /registration html page: ...
4
votes
2answers
77 views

Credit card checking

I am practicing test-driven development in Python. Feedback about both the tests and the code is appreciated. I'm using luhn algorithm and regex to check credit card numbers for validity. Here are ...
5
votes
3answers
134 views

Validating email addresses through temporary mail message

I was given this project and have changed a lot of code on it, now I am going over the code to make sure that I know what everything does and can maintain it efficiently, and to make sure I want my ...
1
vote
0answers
54 views

Laravel controller for form validation skinny

I'm trying to make controllers skinny as possible. I use repositories for accessing the database and I use Services to do other stuff. In this case, I use it to insert a new post to the database. For ...
7
votes
4answers
208 views

Calculating a specific entry in a Pascal’s triangle recursively

Our task was to calculate the entry of a Pascal’s triangle with a given row and column recursively. The triangle was specified in a way that the tip of the triangle is ...
4
votes
4answers
61 views

Validating a Collection of IPv4s

I have a method within a class that validates all proxy addresses are valid on initialization. I've tried to refactor this a bit, but this seems to be the best I can do. Any suggestions and/or tips as ...
2
votes
1answer
36 views

Sane ranges for DB queries

I have a function that has, as input, a ranges object which may define from, to and ...
2
votes
1answer
61 views

Validating input against rules

I have created a method that validates inputs based on a set of rules. If an error is found, it is put into an array which can later on be used to display the errors to the user. Below is my code: ...
7
votes
3answers
95 views

Better card validity check in JS card game

I am writing a card game in Javascript. The game is played with a 32 card deck. When a card is selected to be played by a user, i do a validity check on the server to check whether it matches the ...
4
votes
3answers
212 views
6
votes
1answer
107 views

C# Multi-checkbox validation MVC4

I wrote the following custom validation annotation for my project to confirm that at least one checkbox of a group of checkboxes is checked: ...
3
votes
2answers
51 views

Refactoring IEnumerable<ValidationResult>

I have the below code which increases the code complexity. Any way to refactor it? I am trying to refactor the below code so that the CCM can be reduced for the code. i.e code complexity matrix. ...
3
votes
1answer
55 views

Test if a string is a number

In need for testing if a string is a number which could be a double or integer, I wrote a simple skeleton, which parses a string like this: ...
3
votes
2answers
68 views

Reservation validation

I got a Reservation model that has reservation_start and reservation_end. Then I have the ...
11
votes
2answers
651 views

Foolproof number validation

I know there have been a lot of post, blog article answer on Stack Overflow (but the validation does return true on a tab character) about this. But I'm still ...
3
votes
1answer
85 views

Testable authentication handler for web API

I need to unit test my authentication handler. I don't really want do an assert against the text message returned by the handler. How could this be improved ? ...
1
vote
0answers
47 views

Singleton request validator and sanitizor class

I have tried to code a PHP singleton class for validating multiple/single fields (sanitizing is optional). When validating single field, on success it will return 1 (...
2
votes
0answers
66 views

Immediately send redirect response, preserving session data

This question is for Laravel 4 only, as the relevant parts are completely refactored in the upcoming Laravel 5. I have written an helper function for validation, so I only have to put this in ...
5
votes
2answers
541 views

Should a class own the responsibility of converting an incorrect data type?

The ElectricalEngine class responds to the horsepower message. Because efficiency is calculated in percent a programmer can mistakenly initialize it with an integer ...
3
votes
2answers
300 views

Getting valid URL from user input

I have a dialog which populates my ConnectionStringData object with the URL of the service that I'm trying to connect to. I then consume that URL with the following ...
3
votes
2answers
47 views

Running validation procedures on a table

I am working on a project that has to parse through a text file and perform validations on certain fields in the file. Some of the validations are basic(i.e. data types), and other's are a little more ...
2
votes
2answers
59 views

SPOJ problem: Life, the Universe, and Everything

Your program is to use the brute-force approach in order to find the answer to Life, the Universe, and Everything. More precisely, rewrite small numbers from input to output. Stop processing input ...
10
votes
3answers
113 views

Preconditions library

Over the past year I've quietly developed a library for checking method preconditions. The project is hosted at https://bitbucket.org/cowwoc/preconditions/ I would like to get your feedback on the ...
3
votes
2answers
95 views

Outputting Errors to User

I currently am making a small application where a user will enter their ID which needs to be in a certain format. When entered in the wrong format, different output errors are produced. I currently ...
2
votes
1answer
393 views

Validating email addresses and phone numbers

I have the following code that I need help with refactoring: Validation class for objects you may create: Email address URL Norwegian Mobile Number (must start with 4, 9 or 59 and be 8 digits ...
2
votes
1answer
61 views

Node2D and Node3D classes implemented using a shared decorator

EDIT: I have made another go at this using metaclasses here. I think it's a much better approach. I have the following classes. validator is a decorator that ...
7
votes
5answers
428 views

Python odd number diamond

I worked up a quick diamond program that takes only odd numbers while returning an error with even numbers or 0. The code looks rather ugly to me, especially with the recurring ...
8
votes
4answers
346 views

Simple PHP Validation Routine

I have created a simple validation routine in php and i'm wanting to make sure I am doing things efficiently.... ...
10
votes
5answers
3k views

while(user == gullible)

The goal for this project was to: Write a program that continues to asks the user to enter any number other than 5 until the user enters the number 5. Then tell the user "Hey! you weren't ...
12
votes
6answers
991 views

Check for balanced parentheses

I was given an assignment to check for balanced parentheses from an arbitrary string where parentheses are defined as (, [ or { and their respective "closing" ...
8
votes
2answers
198 views

Parsing integers safely

Background I'm writing user input validation for a client-side JavaScript web application. Users enter numerals representing an integer into an <input>. As ...
15
votes
2answers
260 views

Custom JavaScript validation using the factory / module patterns

I am in the process of diving a bit deeper into JavaScript development and am looking at some common language patterns (module, and factory in particular). In this code, my aim is to create a ...
3
votes
2answers
91 views

Guard statement extension methods for common object guards

I wrote a couple of extension methods for common guard statements I write a lot. These are extension methods for Object, and allow me to quickly guard against common scenarios. I'm using .Net 3.5 ...
6
votes
5answers
895 views

Given a String, return a boolean if it is a number

Yesterday in an online interview, the interviewer asked me this question: If I give you a string, you have to return if a string is number or not. You are not allowed to use any parse function ...
7
votes
2answers
132 views

Use different contructors of disposable class

I have a very simple helper class to validate credentials. Sometimes the domain has a value, sometimes not. Depending on this, a different constructor for ...
10
votes
3answers
217 views

Proper way to validate from sub to sub

I am using a public validating sub to help validate the other subs. Is this the most efficient way to do this? ...
8
votes
1answer
466 views

Email validation using JavaScript

I have a function where I validate emails via a regex. I was wondering if this is the best regex to use or if there's a better way of doing it. Also is there a ...