Questions tagged [validation]

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

Filter by
Sorted by
Tagged with
6
votes
2answers
182 views

Sudoku challenge driver program

For my planned Sudoku with Handicap challenge over at codegolf.SE, I need a driver program. I've decided to write it in Python, for learning purposes. Since I've got no Python experience, I thought I ...
-1
votes
1answer
154 views

Validation function using both for-loops and indexes at the same time [closed]

This function iterates through a open dialog box that has 4 values in it all optional except for aircraft1, aircraft2, warning_or_alert. ...
1
vote
1answer
3k views

A more optimized / cleaner way of validating WCF input parameter using IParameterInspector

I'm having a WCF Rest service which does input parameter validation by using the IParameterInspector, before calling the actual service method. I have Implemented ...
6
votes
3answers
8k views

Checking balanced parenthesis string

I recently wrote a code in online recruitment test. It was very good. With each question, there were associated space and time limits check. If our code executed correctly within both limits, only ...
1
vote
2answers
4k views

Accepting a positive integer from either a command-line argument or System.in

I've been doing a lot of programs for classes that require a prompt from the program. I thought it would be much faster for me to rapidly test inputs if I didn't have to execute the program and then ...
1
vote
0answers
531 views

URL image validation

I'm trying to write a method to validate an image from a URL. The method will accept an array of image URL. The image should be validated by its type, size and dimensions. Right now, I'm able to ...
2
votes
2answers
58 views

Controller method to validate and save

I have built RESTful web services. The services endpoints have a similar logic: If the input validation succeeds, do a database operation and return the result. If the db operation fails, return the ...
7
votes
2answers
9k views

Program that tells if a date is valid in C

I'm reading a book about C programming, at the end of each chapter it has some training exercise and one of them was to make a program that tells if a date is valid or not, the code below is what I ...
4
votes
1answer
2k views

Phone number format and data entry restriction

I created a form that formats phone numbers, allows only allowable keys to be pressed, and converts a lettered entry into its corresponding phone keypad number. Is there some cleanup or better coding ...
29
votes
5answers
3k views

A completely repetitive console prompt, a completely repetitive console prompt

So I wrote this for my Mandelbrot Generator, to collect and use input from the user, and I made it dynamic enough to be useful anywhere. I'm really interested in all critiques of it, as I'm going to ...
3
votes
2answers
1k views

Validating Card Number in Delphi

As part of processing card payments, before even attempting to process, I need to check and validate the card number to make sure it's valid. For this, I've encapsulated this validation in a record ...
12
votes
5answers
2k views

E-mail testing code

I made some code to check that e-mails given apply to the right format, and I'm sure there must be a better way to do this. ...
11
votes
5answers
5k views

Birthday validity-checking

I have written code to check any birthday input's validity. As I am new in programming, and after going through several debugging steps, the code became very ugly. ...
0
votes
1answer
192 views

jQuery form validator

I am new to the world of jQuery plugins, I don't know why I didn't get into this sooner. What I have a working validator that validates bootstrap styled forms. What I have discovered is that the way ...
12
votes
5answers
5k views

Credit card validation

I started following Harvard's CS50 (Introduction to Computer Science) on edX, and as part of their Hacker edition set 1 was the following assignment: I am supposed to write a program (in C), that ...
8
votes
3answers
10k views

Simple Google ReCaptcha validation

Linked: Google reCAPTCHA Validator: Iteration II I have also created a simple Google Recaptcha Validation class to handle verification. I used some code from CodingFusion's post Google New ...
6
votes
2answers
1k views

Google reCAPTCHA Validator: Iteration II

This is a follow-up to the other post I made (less than an hour ago) about my Google reCAPTCHA C# implementation: Google reCAPTCHA Validator This adds support for error messages, so that you can ...
3
votes
1answer
83 views

Validate profile completeness

This function checks these 6 fields for a user profile to determine if they have "completed" their profile. This just feels like it could be done better, but I can't figure how. ...
11
votes
2answers
309 views

Verify that a path doesn't contain . or .. or // and doesn't end with /

This is actually a function from the first commit of the git source code, for the purpose stated in the title: ...
0
votes
1answer
1k views

jQuery .validate() plugin, additional method to validate numbers

A while ago I've written a custom validation method for .validate(). It is a local validation plugin, with some limited validation. I was required to write a validation method with the following ...
2
votes
2answers
412 views

Model object for form validation

In order to perform form validation, I have created a custom object: ...
7
votes
1answer
3k views

Calculations with FX

There have been a lot of calculators lately. It seems like this community challenge all over again, I didn't make a proper one then, so I'm joining the calculatrain now. Building from the lessons ...
3
votes
2answers
106 views

Sidekiq worker to validate survey participants

I have worker code that looks like this: ...
3
votes
2answers
344 views

JavaScript form validation

Is this a "good" method of form validation? ...
5
votes
2answers
106 views

PriceDialog - Prompt & price validation

In a recent CodeReview I presented a Product Manager that manages product listings and prices. Based on the great feedback I have refactored the mentioned Prompt and validator class and want feedback ...
1
vote
1answer
52 views

3D plot from lm model with a nonlinear parameter

I am trying to plot a 3Dplot of a linear regression with two variables. My linear model: ls = lm(mpg ~ disp + qsec, data = mtcars) The minimum and maximum ...
4
votes
1answer
55 views

Long format data - fill episode based on conditional previous episode

The data are organised as long format data. 4 individuals are observed during 4 or 5 days (BCSID is the name of the unique key). Basically, the data describe ...
2
votes
1answer
120 views

Clean phone number

Program that cleans up user-entered phone numbers so that they can be sent SMS messages. The rules are as follows: If the phone number is less than 10 digits assume that it is bad number If the phone ...
5
votes
3answers
1k views

Validating a credit card number using Luhn's algorithm

I implemented Luhn's algorithm explained on Wikipedia to validate a credit card number, in Bash. Does this code follow good practices? ...
2
votes
1answer
4k views

AngularJS image size validation directive

I've written a directive to validate the width and height of an image in AngularJS. I'm not a JS genius but I get along with it. So I would appreciate some feedback on this directives code if this can ...
2
votes
2answers
376 views

PDO wrapper with validation

After moving from mysql_ to PDO I created a PDO handling function. Basically this function takes parameters, checks them and returns end result. The thing is that I created this ~1 year ago and haven'...
1
vote
1answer
186 views

Form validation

I want to know if this would be considered a proper way to validate a form or if there is an easier way that I'm not aware of. I think I was reading somewhere that you are not supposed to use ...
6
votes
1answer
176 views

Relative relationships

This is a question in Udacity JS course. I am starting to like Javascript. I feel its a misunderstood language :) We learned about relational operators and how they can classify the relationship ...
7
votes
1answer
192 views

Validation macro

I would like a review of a Scala validation library I am writing. For now we can focus on the regular expression component. The usage is described in RegexExample.scala There is an outline of the ...
3
votes
2answers
139 views

Inserting a name into a database table

I want to ask you if my PHP code is safe enough. I don't know if I should escape special characters in string after regex validation: ...
3
votes
1answer
923 views

Calculate sales tax from tabular data

This is a Python 3 solution to the problem stated in Sales Tax Problem, rejected for not being up to their standards. It also seems like the same thing as the problem stated in Sales tax calculator, ...
3
votes
2answers
2k views

Check whether all textboxes are filled

I'm doing some simple validations using jQuery to check if all textboxes are filled. ...
2
votes
1answer
38 views

Creating error messages for grammar mistakes - avoiding duplication when refactoring

After my Dialogue parser has parsed a dialogue, it needs to be validated. To that end, I have several checker classes that go through the lines of the Dialogue. These checker classes get huge as I ...
2
votes
1answer
75 views

Fields are required, except if all fields are empty

I have a group of four inputs, the first three are required, the fourth is optional. $fieldA $fieldB $fieldC $fieldD #Optional So to validate the inputs, I just ...
2
votes
1answer
66 views

Reduce the calls to database for validations in rails

I was building a rails web, and used form object to separate the validation logics per form. I had to find_referral_code twice in order to store the user_id of referrer. I wonder how I can improve ...
4
votes
1answer
5k views

Check if a String is a valid Double

For a class, I need to ask the user for a double. To verify that the number can be safely passed to Double.parseDouble, I wrote ...
5
votes
3answers
153 views

Userform that calculates gas mileage

I created a project for a programming class that asks you to make a userform in Visual Studio that calculates mileage, given the user inputs of gallons of gas consumed and distance traveled. The code ...
7
votes
3answers
4k views

Checking for Roman numeral validity

I am working on a Roman numerals calculator. For an input validity test I'm using this function: ...
1
vote
0answers
1k views

Method for realtime form validation

A quick little method for validating form input with jQuery (and some built in bootstrap classes). I know the regex isn't perfect but it's close enough. Thoughts? ...
3
votes
1answer
135 views

PHP validation class using method dispatch

I wrote this validation class. I'm kinda new to the whole OO(PHP) style, so I don't know if my class is acceptable. I looked around at other people's validation classes, but most are huge (1k+ lines ...
5
votes
3answers
876 views

Extending Abstract Person Validator

I have the following code which is responsible for the validation in our app (just an example). Based on the particular tab where user can add person to the database we need to perform additional ...
3
votes
4answers
13k views

Validating Firstname and Lastname

I have written some code in Java that checks if the strings Firstname and Lastname are valid names. These are inputted by the ...
3
votes
1answer
372 views

Instantiating a kind of NumPy array

I am creating a class object which must inherit from numpy ndarrays. I perform an isinstance check and an ...
2
votes
1answer
158 views

Date validation in Java - take two

I read through and implemented the advice I received yesterday. I would, once again, really like some input on how this can be improved. e.g. encapsulation, interfaces, abstract classes etc.. Right ...
4
votes
3answers
2k views

Validate input of month/year, otherwise set it to current month/year

Is there a cleaner way of doing this? I'm using filter_input to first check for valid input, then using it again to assign the variable. Also, my condition in ...