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
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 ...
kleinfreund's user avatar
  • 3,681
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. ...
Jon Grey's user avatar
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 ...
user avatar
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 ...
n00b's user avatar
  • 279
7 votes
2 answers
3k views

Python 3.6+ function to ask for a multiple-choice answer

...
user avatar
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? ...
Addioioi's user avatar
  • 191
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 ...
Curtis Poe's user avatar
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 ...
CaptainCodeman's user avatar
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 ...
Caridorc's user avatar
  • 27.4k
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 ...
DarkEvE's user avatar
  • 173
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 ...
user2921414's user avatar
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 <...
PRobert's user avatar
  • 73
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? ...
Grzegorz Piwowarek's user avatar
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: ...
Patrick85's user avatar
  • 491
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 ...
Calvin's user avatar
  • 175
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 ...
EugeneProut's user avatar
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, ...
Chrillewoodz's user avatar
7 votes
2 answers
284 views

Test if string is numeric

I want to implement the following function: ...
Arun's user avatar
  • 171
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 ...
Espo's user avatar
  • 171
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 ...
user avatar
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 ...
EJoshuaS - Stand with Ukraine's user avatar
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 ...
DS2830's user avatar
  • 263
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 ...
PerfectContrast's user avatar
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: ...
James Anderson Jr.'s user avatar
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 ...
Daniel Lorenz's user avatar
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 ...
j_quelly's user avatar
  • 171
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 ...
Lukas Pirkl's user avatar
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 ...
suitedupgeek's user avatar
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 ...
Rajesh's user avatar
  • 393
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 ...
Legato's user avatar
  • 9,819
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 ...
user833970's user avatar
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 ...
Der Kommissar's user avatar
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 ...
user avatar
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 ...
daydreamer's user avatar
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 ...
Sumeet's user avatar
  • 319
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 ...
Yashi Srivastava's user avatar
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 ...
Михаил Хамхоев's user avatar
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 ...
user2961575's user avatar
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 ...
Enrico Massone's user avatar
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 ...
vincentes's user avatar
  • 197
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 ...
jess's user avatar
  • 1,378
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: ...
Jacob's user avatar
  • 371
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 ...
andrew's user avatar
  • 63
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 ...
t3chb0t's user avatar
  • 44.1k
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. ...
Mike's user avatar
  • 113
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 ...
Jack Galt's user avatar
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 ...
Tom's user avatar
  • 215
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: ...
newbie's user avatar
  • 169
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 ...
Der Kommissar's user avatar
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. ...
geohei's user avatar
  • 245

1 2
3
4 5
15