Validation is used to check data to make sure it fits whatever required specifications are set for it.
9
votes
4answers
968 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.
...
9
votes
5answers
378 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
0answers
33 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
999 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
86 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
61 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
30 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
289 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
32 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
37 views
Model object for form validation
In order to perform form validation, I have created a custom object:
...
5
votes
0answers
52 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 ...
0
votes
0answers
19 views
Generic Razor view Model property validation for Form
I have run into instances where someone would add columns to a table in the database, update the Entity Framework models for our solution, but forgot to update the forms to compensate for the added ...
3
votes
2answers
134 views
5
votes
2answers
47 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 ...
0
votes
1answer
33 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
47 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
34 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 ...
2
votes
1answer
102 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
160 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 ...
1
vote
1answer
35 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
87 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
108 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
96 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
64 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
47 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
25 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
45 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 ...
2
votes
1answer
31 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
54 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
81 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 ...
6
votes
3answers
482 views
Checking for Roman numeral validity
I am working on a Roman numerals calculator. For an input validity test I'm using this function:
...
0
votes
0answers
77 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
55 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
234 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
833 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
117 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
64 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
153 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 ...
3
votes
1answer
50 views
Validating a User via Save Method
I'm fairly new to object oriented programming here and am trying to get my head around the best way to go about creating Users and Validating them in the system.
My first attempt is below and my main ...
2
votes
1answer
87 views
Date validation in Java
I'm learning Java, and would really appreciate any tips on how to improve this code.
It's just a simple date validation class.
...
1
vote
1answer
82 views
Server side form validation library
Have I followed best practices for PHP development, or can this class be improved?
GitHub
...
2
votes
2answers
83 views
Validation class
Can someone help me furnish my PHP validation class? I want to reduce its size and make it easier to use.
...
4
votes
2answers
181 views
TextField Validation for Teleport Feature in Game
I've implemented a teleport feature for my game and I would like some feedback on the way that I validate the user input. I am using the libGDX library.
When the player clicks the Teleport Menu ...
2
votes
2answers
82 views
Verbose mailing function
I have multiple forms that send an email. As of this moment I have 3 forms that send mail and vary only by the number of inputs:
One requires just an email
Another requires a name and email
Another ...
7
votes
5answers
314 views
Reserving seats in a movie theater
I'm writing a C program to reserve seats in a movie theater. I am validating the selection of seats:
...
11
votes
1answer
575 views
0
votes
2answers
314 views
Input and Validate Dates
Question:
Write a function that accepts integer values for day, month and year and returns them in a valid format. If the day is above 30, then convert it to 30. If the month is above 12 then ...
2
votes
1answer
153 views
User input function keep looping until valid filename entered
The following function is basically asking the user to input a file name for a file that the calling program is going to do something with. If the user enters an invalid file name, I want the program ...
8
votes
2answers
359 views
Reference implementation of HTML-to-JSON converter for PCG
I have opened a puzzle at Programming Puzzles and Code Golf. The question is not perceived well (yet) and one of the reasons is that no reference implementation is provided. To mitigate this ...
3
votes
2answers
150 views
PHP contact form
I recently had my site hacked, with the main index file being overwritten (nothing else was touched). I'm assuming they hijacked my form input.
Are there any vulnerabilities in the code or does this ...