Validation is used to check data to make sure it fits whatever required specifications are set for it.
11
votes
2answers
729 views
“Who are you, and where do you live?” — a Q&A exercise
This is my first attempt at a programme. Is it good form? Does it follow best practice? Or am I completely off the mark?
...
4
votes
1answer
43 views
Cron expression validator for Apache Quartz
Not too long ago, I had to create a cron expression for a route in Apache Camel. I had a bit of a struggle to find the right expression. So I made a small program to output the n next valid dates ...
15
votes
7answers
1k views
Password validation in Java
I just wrote this password validation code function that checks to see if a password will be accepted in AD or not. I'm not sure this is the best way to do it, but for now it works fine. I would love ...
3
votes
2answers
39 views
Null checks in user validation
I would like to know an alternative, more elegant way to write the following method. I am especially not enthusiastic of the nested if statement.
...
7
votes
2answers
80 views
JavaScript Validation
Bit of a preface on my motive: I'm self taught and have never really worked in a collaborative environment. My only benchmark for quality is "does it work" and I've never been really subject to peer ...
8
votes
3answers
86 views
Validation check and code-saving
I have the ubiquitous "validate and save" scenario, wherein the Save() method performs various validity checks and proceeds to save the data. The solution works ...
4
votes
3answers
168 views
Error-handling / Self-Validating mechanism
The below idea seemed to look clean, to allow the object itself to validate its values for different scenarios.
For eg:
While creating the object, the value of Object1 and Object2 in ...
5
votes
1answer
129 views
Service class that handles form validations
I've made a (service) class to handle all form validation of my application. It contains a set of frequently used validation callables extracted into private methods that I use to build each ...
2
votes
1answer
16 views
Script for validating a booking form
This PHP script to validates a booking form. (There is also a JavaScript validation as well, but please ignore.). I want to know if there is a better/more efficient way of writing it?
I have created ...
0
votes
0answers
34 views
Mini eCommerce Application and Message/Warning/Error Handling
I decided to build a basic eCommerce application in C++ as a learning experience. In the past, I've gone with a fat controller, skinny model approach, and while it has worked, my results always end up ...
2
votes
2answers
66 views
Ruby Mod 11 implementation
I wrote this Ruby Mod 11 (perhaps it's a bit generous to call it that) implementation to validate Brazilian CPF documents, which use a Mod 11 algorithm. CPF format is a 9 digit number followed by two ...
2
votes
1answer
29 views
Form data handler class
I've started to write a form data handler class in PHP. Can you please review it and point out any mistakes or logic errors, or perhaps if a method can be written in a better way?
...
6
votes
1answer
69 views
Agnostic means of identifying a member
I'm attempting to provide an agnostic means of identifying a member. I need a nickname, a guid, and one of ...
6
votes
1answer
80 views
MVC Model validation callback
I have made a simple MVC framework of my own for my personal website to learn a thing or two about how this whole thing even works. I think I've got the idea, but there's one thing I'm not sure about.
...
5
votes
3answers
133 views
Reducing boilerplate when validating parameters and using a tuple for the parameter list of a case class
I had designed a simple case class that looks like this:
case class StreetSecondary(designator: String, value: Option[String])
I needed to add validation (to ...
1
vote
2answers
38 views
Refactoring complex phone validations
I have a complex phone validation that does the following:
First, check if either a home phone, mobile phone or work phone is provided (there will be 3 text fields in form and at least one type of ...
2
votes
1answer
54 views
Redirect browser
I've got a 'menu' within a Master page which include a number of image buttons with click events.
Within each click event, I want to redirect the user to a specific page. However, if the user is ...
3
votes
2answers
45 views
Pagination filtering
I want to check if there is page variable (in URL) and if it is, if it's correct - it cannot be number 1 because this is default page and it should be valid int ...
2
votes
2answers
54 views
Validation using preg_match functions
I need some improvements on my code. I did some validation by preg_match and functions. I need some special characters restrictions every field.
...
5
votes
2answers
107 views
13
votes
3answers
723 views
Credit Card Validator Algorithm
I'm writing an algorithm to read from a file a list of numbers, and for each, determine if it is valid. If it is, then display which card type it is. Here is my code so far (using Luhn's algorithm):
...
14
votes
4answers
784 views
Determining if all strings are parsable to int
I have to loop through a list of strings and validate that all are parsable to int and not less than 1. Also, if a string is ...
4
votes
3answers
50 views
Validation on a form in JS
I've got a form that needs validating before the data in the form is added to a service queue:
...
0
votes
1answer
77 views
Is this a better way to validate a text box for mobile number only?
Is this a better way to validate a text box for mobile number only?
Validation:
allow only numbers
will not allow to paste string including characters
allow copy from the box
length is set to 10 ...
10
votes
2answers
323 views
ISBN missing number solver
This is a programming contest question. Question as follows
Problem Definition
An ISBN (International Standard Book Number) is a ten digit code that
uniquely identifies a book. The first 9 ...
4
votes
1answer
52 views
Using/storing server-side data on the client side
I've a slot booking script which is as follows:
My Current Algorithm
A calendar is shown to the user
The user clicks on a date
I make an ajax call to determine if at least 1 slot is booked on the
...
4
votes
1answer
246 views
Bank account number validation in IBAN format
I wrote a JavaScript function for validation bank account numbers in IBAN format. Please tell me how can I make this better.
...
3
votes
2answers
50 views
Simple IPv4 and port validation for chat client
This is part of my chat client's code. It works fine but it looks messy. Any ideas?
...
10
votes
1answer
83 views
Bitcoin address validator in C
Here is a Bitcoin address validator I am looking to have reviewed in C. Normally I would have the enum and function prototypes declared in a header file, but I ...
10
votes
2answers
231 views
Calculating the checksum digit with the Luhn-algorithm
I'm doing some exercises in Python and this one is about using the Luhn-algorithm to calculate the checksum digit in Swedish personal identification numbers.
The description is the same as this ...
3
votes
2answers
117 views
Determining if an entity exists in a database via a stored procedure
Here is a short and simple Ajax method that returns "True" or "False" if an entity exists in a database via a stored procedure ...
11
votes
2answers
114 views
Calculating Luhn-algorithm checksum digit
Today I decided to learn some basic Haskell, and for starters I made a program for calculating the checksum of a Swedish personal identification number. It uses the Luhn-algorithm, aka. ...
2
votes
2answers
103 views
Validate multiple regexes without a for loop in JavaScript
For a project, I need to validate a VAT number against the correct algorithm. I found a library for this here (freeware, so I should be able to reuse it) that I'm grateful exists. However, I feel like ...
7
votes
3answers
205 views
Refactor a selection validator
I have a data table and have to validate every field in it. I have refactor this code to this below, but the complexity is 15(!!) Should I make something like dictionary with ...
5
votes
3answers
152 views
Regex to validate font names
/((([\w -]+)|("[\w -]+"))( *, *)?)+/
http://refiddle.com/18ql
I'm trying to use a PHP regex to sanitize a user input for a list of fonts. The above one seems to ...
2
votes
2answers
64 views
Generate the Norwegian equivalent to social security numbers - follow-up
First of, here is my previous post.
That should explain a fair bit. The reason I'm posting one more time, is I have changed a lot. Using more classes, let them do all the work, and the overall ...
6
votes
3answers
129 views
Pattern tokenization program
I am writing this program to try and get some practice at C++ and correct and proper styling.
This code is meant to take user input from a pip and then run it through the program. The user enters a ...
8
votes
3answers
97 views
Validation/error handling of user input values
This is a tiny learning program that lead to an interesting question: how can I best/most elegantly handle user entered numbers? This method works, fails cleanly, and reads well. It doesn't apply to ...
2
votes
1answer
67 views
Validation invoking queries?
I have a question regarding whether it is viable or deemed correct if a validation object invoked a query. Essentially, I have some code that looks like this:
...
3
votes
1answer
48 views
Can this date-validation function can be simplified further or is it the correct approach?
I am doing a date validation. I have no. of pages, which have the date field. User can input the date like "220875" or "22AUG75" - I need to test both and check the length as well.
...
4
votes
1answer
79 views
Multiple drop down validation
I have written some jQuery which validates a group of drop downs. It checks the text value selected in all the drop downs (first three characters), and if there is a duplicate, it warns the user.
...
4
votes
1answer
48 views
2
votes
2answers
96 views
Validator extended to handle domain objects / entities
I started improving my validator library even more, and I think I'm at the last final element (domain object / entity validations) before I can gladly say that my Validator library is completely done ...
6
votes
5answers
1k views
Regex validation for Email Address
I need to validate whether my regex is correct for below scenario. Suggestion's if the regex is correct:
Wiki Link Local_part
The local-part of the email address may use any of these ASCII ...
11
votes
3answers
523 views
Bank card validation module
I hope that someone could review a module I wrote for bank card validation. I included a class that tests some of the methods, this is purely to show the methods work, rather than unit testing. I ...
3
votes
3answers
78 views
Validating a string under few conditions
Following code validates NIC number of a person (National Identity Card, no like SSN)
Requirements are...
Length should be 10 digits or characters
All should be digits except the last one
Last one ...
2
votes
1answer
56 views
Using a single validation handler for all controllers in a form
In input validation I'm using this validation method in my all Forms. Here I have a single handler for all TextBoxes in my Form and if I have other controllers like ...
3
votes
4answers
281 views
Input validation for text boxes in a Form
In a Win Form I'm doing initial validation in the Form. So before saving data, I want to validate whether all the required fields are filled (Text Boxes) by the user. There are about 18 such Text ...
3
votes
1answer
85 views
Can this form validation be simplified made to memory leak free for all browsers?
I am doing a validation and I believe that there are many things that can be reduced or removed. I am still re-working this. But I am looking for some experts to look at my code and offer the very ...
2
votes
1answer
118 views
Checking if variable is defined before accessing its properties [closed]
I didn't write this but I noticed it in our codebase at work.
...