Questions tagged [validation]
Validation is used to check data to make sure it fits whatever required specifications are set for it.
728
questions
7
votes
4
answers
12k
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 ...
7
votes
5
answers
140
views
readable validation with python regex and simple logic
I have come with such a code for checking IP addresses. But would like to know how clean and good it is from 1 to 10. What I care about are readability and simplicity. Please give me any feedback.
...
7
votes
3
answers
3k
views
Fluent Validation of Objects
Inspired by this question by t3chb0t and as an elaboration of my own answer, I have written the following solution. My goal was to reduce complexity both in implementation and use. Eventually - I have ...
7
votes
2
answers
10k
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 ...
7
votes
2
answers
3k
views
7
votes
2
answers
405
views
Simple validation script
I'm playing about with JavaScript and wanted to create a simple validation script.
It works ok but is a bit clunky. How could I improve it?
...
7
votes
3
answers
184
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 ...
7
votes
2
answers
1k
views
Simple username validation
This checks if a given username is valid, before doing any database lookups.
(I know it's possibly better to use regular expressions, but I wanted to be able to give specific errors.)
I'm curious if ...
7
votes
3
answers
429
views
Ordering an un-ambiguous scrambled date
A date is un-ambiguous when each number may be
decided to be day or month or year given the range
limitation of these numbers.
For example
\$14\$ cannot be a month number
\$2008\$ cannot be ...
7
votes
3
answers
476
views
Validating lines in a file using certain specifications
I have written a program which basically reads a file named "data.txt" line-by-line. As a line is read, it validates the line with a certain specification. If the specification is met, it will ...
7
votes
3
answers
4k
views
Simple MPG calculator in Python
I am a self taught coder taking a Programming Fundamentals class to work towards a degree. It's based on Python, which I'm not as familiar with as other languages. I added error handling like I would ...
7
votes
2
answers
847
views
OOP PHP form builder with validation
Yes, another PHP form builder... I wrote this solely to demonstrate OOP principles.
My questions are:
Could this be written better? OOP-wise.
How could I better implement error handling?
Index.php
<...
7
votes
2
answers
24k
views
Bank account number validation in IBAN format
I wrote a JavaScript function for validating bank account numbers in IBAN format for my own joy. Could you have a look if you don't see any obvious mistakes or places for improvement?
...
7
votes
1
answer
7k
views
Validating a list of dictionaries of names and tags
I created a Python function to check the types from a list and also check the keys inside an dictionary within that list.
I have the following data:
...
7
votes
2
answers
525
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 ...
7
votes
1
answer
2k
views
Credit card validation - Python 3.4
Just completed a piece of code - a credit card validation program in python - as a little side project. Having no experience with classes in the past, I decided to employ classes in this project.
I ...
7
votes
2
answers
44k
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, ...
7
votes
2
answers
284
views
Test if string is numeric
I want to implement the following function:
...
7
votes
2
answers
699
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 ...
7
votes
2
answers
491
views
Am I implementing BDD correctly?
I'm writing a utility that validates fields. I decided to try my hand at Behaviour Driven Development (BDD). The validator utilises "rules" to determine if field is valid.
Three different types of ...
7
votes
1
answer
4k
views
Code that uses reflection to validate arguments
I wrote an answer to this question on the Software Engineering SE site and was hoping to get it critiqued. (I'm told that it's acceptable to do so).
Essentially, this code uses reflection to check to ...
7
votes
1
answer
563
views
Infix to postfix conversion in C++
Here is a program for conversion of an infix expression to a postfix expression using a stack. I would like to know how I could improve my checking for invalid input, make my code more expressive, and ...
7
votes
1
answer
2k
views
Validating user input
I've written the below code to validate user input but I feel it's quite excessive for what seems to be a simple operation. I want to only accept non-negative integers or doubles as an input. This ...
7
votes
1
answer
1k
views
Auto-Format GPA while typing
I'm looking for a more cleaner and simpler solution to auto-format a text-box field intended only for the user to enter their college Grade Point Average (GPA). Here is my code:
...
7
votes
2
answers
1k
views
Validation for a CQS system that throws an exception
I've been reading that exceptions should only be for something "exceptional" and not used to control the flow of a program. However, with a CQS implementation, this seems impossible unless I start ...
7
votes
1
answer
12k
views
Unit tests for React component to submit an input form with validation
I'm very new to front-end/unit testing and have been having a difficult time understanding the point altogether, but I managed to push my way through testing literally everything I could possibly ...
7
votes
2
answers
948
views
MembershipProvider with Entity Framework and IoC
I am using Castle Windsor as my IoC container and I registered it as a DependencyResolver to let the MVC framework know about it.
With the Entity Framework I have ...
7
votes
2
answers
622
views
Basic form validation
Question + Desired Outcome
The code below works currently, however I'm not convinced the utilisation of an Array to iterate through numerous non-existent form ...
7
votes
1
answer
510
views
JavaScript date validation
I have a date control which has a dropdown for each date, month and year.
The issue is, I can select 31st Nov. 2015 as well, and when I create date object, I get 1st Dec. 2015.
Example
...
7
votes
1
answer
4k
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 ...
7
votes
1
answer
203
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 ...
7
votes
1
answer
105
views
Streaming a Pin functionally(ish)
Earlier today I wrote a question (Validating a StreamingPin) and I thought it was a good idea (apparently I was the only one who thought so, but whatever), so I proceeded further with it and developed ...
7
votes
2
answers
83
views
Checking whether various form fields are filled in
This is a customer information data entry form. First name and Last name are required. In addition phone number, e-mail and birth date are used to check the database for existing customers with the ...
6
votes
5
answers
7k
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 ...
6
votes
4
answers
9k
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 ...
6
votes
3
answers
7k
views
Chess move validator
I have written code for making a Chess Validator, which will validate the moves of a chess game.
There is a Main class which is taking the input from the user, about the move.
Problem Description
...
6
votes
3
answers
754
views
Insertion sort with high OOP and error processing
The input file contains data of one of two types: integers or strings. Data recorded in the column (each line of the file is a new element). Strings can contain any non-whitespace characters. The ...
6
votes
2
answers
3k
views
iOS App - Interface for user log in using a call to a web service API
I have a navigation controller set up with a user code and password and a log in button. When the user clicks on the Log In button or the return key on the keyboard on the password text box - the ...
6
votes
4
answers
254
views
A C# struct representing a string that can be neither null nor white space
I've written a C# struct in order to encapsulate the idea of a string being neither null nor ...
6
votes
3
answers
4k
views
Validating an IP address and returning the reason it's invalid
I have a method that validates a user-written IP address in an Android application. If it's invalid, I need to know why and notify the user using a Toast.
I ...
6
votes
3
answers
242
views
C date information program
Inspired by a section from K&R C (exercises 5-8 and 5-9), I decided to write a program that would take a date numerous numeric forms, all based around DD/MM/YYYY, and from the given date determine ...
6
votes
2
answers
341
views
A way to handle integer input
I'm working on simple code that 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.
Possible input:
...
6
votes
3
answers
545
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 ...
6
votes
3
answers
418
views
Simple object validator with a new API
Quite some time ago I have created the Simple object validator (see also self-answer). The more I used it the more I thougt its API could be better so I have heavily refactored it and would like to ...
6
votes
2
answers
283
views
Valid memory address in Python
I am looking for suggestions of improving this function to check whether a memory address is appropriate or not.
...
6
votes
4
answers
285
views
Numeric integrity check
I'm a beginning C programmer. I need a function that will take a string and determine if it's a number. The data is coming from files created by different people and the number formats WILL vary. So ...
6
votes
2
answers
2k
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 ...
6
votes
3
answers
17k
views
Data validation for preventing blank entries
I want to create a validation wherein blank entries will not be accepted. So if I call this code:
...
6
votes
2
answers
888
views
Validate a password mostly to NIST-2017 standards
I have an application that needs to validate user passwords to a very reasonable custom validator, which is heavily based on NIST-2017 requirements. The validator intends to satisfy the following ...
6
votes
3
answers
207
views
Weekday+day validation
The string I'd like to check is something like "abcSun24def". If any valid "xxxyy" (xxx = weekday and yy = day) is found, return the position inside the string. If "xxxyy" is not found, return -1.
...