Questions tagged [validation]
Validation is used to check data to make sure it fits whatever required specifications are set for it.
64
questions
23
votes
4
answers
2k
views
Celsius → Fahrenheit conversion table
It's harder to do than criticize. Here's my attempt to implement a Celsius-to-Fahrenheit conversion table in C++.
...
0
votes
1
answer
139
views
Advent of Code 2020 - Day 2: validating passwords
Previous: Advent of Code 2020 - Day 1: finding 2 or 3 numbers that add up to 2020
Next: Advent of Code 2020 - Day 3: tobogganing down a slope
Problem statement
I decided to take a shot at Advent of ...
36
votes
3
answers
11k
views
Ensuring user input is an integer in a range
I have isolated a little bit of code that was causing a small debate between myself and another user. I have taken some of the things that he said and meshed it with the code that was being reviewed ...
31
votes
5
answers
4k
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 ...
20
votes
6
answers
16k
views
Simple object validator
I wrote a simple validation tool that allows me to quickly define validation rules and check my data objects against them. I know there is this another tool called FluentValidation but... I'm not a ...
14
votes
7
answers
47k
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 ...
6
votes
1
answer
113
views
Validating a StreamingPin
Recently I was thinking about the keyless entry on my car and how simple it has to be, so I wrote a C# programme to validate a StreamingPin, that is, a pin that is ...
6
votes
2
answers
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
1
answer
143
views
Newspaper Bill Calculator CLI with Python (2 of 3, CLI)
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 1 of 3, Core: Newspaper Bill ...
2
votes
1
answer
186
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 ...
2
votes
1
answer
278
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.
...
2
votes
1
answer
101
views
Newspaper Bill Calculator CLI with Python (1 of 3, Core)
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 2 of 3, CLI: Newspaper Bill ...
1
vote
1
answer
110
views
Theme picker for Laravel 8 blogging application
I am working on a blogging application in Laravel 8.
The application supports themes. In a nutshell, theme support works like this:
In the views directory, I have ...
1
vote
1
answer
49
views
UPDATE on Newspaper Bill Calculator CLI with Python (2 of 3, CLI)
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 1 of 3, Core: UPDATE 1 on Newspaper ...
61
votes
6
answers
5k
views
Accurate email syntax validation (no seriously)
So a friend happened to show me how odd and specific the general email syntax rules are. For instance, emails can have "comments". Basically you can put characters in parentheses that are just ignored....
56
votes
5
answers
37k
views
Verifying password strength using JavaScript
I have a function which verifies the "Password" field and suggests the user to enter a strong password. I also have a label named "Password Strength", referring to the strength of a password (very ...
31
votes
7
answers
56k
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 ...
23
votes
6
answers
15k
views
Validating Yes/No answers in C++
I intend to accept all of the following answers:
y
Y
yes
YES
Yes
plus mixtures, such as yeS, yES, which I didn't intend to accept but it's a consequence of my code
the same applies to No and its ...
20
votes
2
answers
48k
views
Email validation using JavaScript
I have a function where I validate emails via a regex. I was wondering if this is the best regex to use or if there's a better way of doing it.
Also is there a ...
19
votes
2
answers
1k
views
Enforcing string validity with the C# type system
One of my biggest complaints about .NET is that there's no way to guarantee a string match a certain type in the type-system.
Note
This started as more of a proof-of-concept than a real usable system,...
12
votes
5
answers
12k
views
Validation that also returns error messages
My Create, Update and Delete methods should return a ...
10
votes
2
answers
948
views
Monad transformers in C# for use in validation
I am working on using monad transformers in C#. I would like to know if the following code I present, shows that I have understood this. I am fairly new to this so any feedback / comments are really ...
10
votes
4
answers
10k
views
Password checker in PHP
I have written a password checker using PHP, consisting of many if else statements. Is there any possible way to shorten this code?
...
9
votes
3
answers
222
views
Check Accounting Journal for Errors
I wrote this sub in Excel VBA. I am a novice, but I was able to get my code to work how I wanted it to.
Unfortunately, I can see there is a lot of repetition, but it is too complex for me to ...
8
votes
4
answers
8k
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 ...
8
votes
3
answers
404
views
Unicode Chess PvP with Move Validation
Main Purpose
This script allows two players to play chess on a virtual chessboard
printed on the screen by making use of the Unicode chess characters.
Visual appearence
...
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
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
284
views
Test if string is numeric
I want to implement the following function:
...
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 ...
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.
...
6
votes
3
answers
420
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
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
2
answers
250
views
Simplifying this form validation script
Can anyone please help me to simplify this form validation script? It works great but I was just wondering if I can get some help to make it simpler. Your opinion on the approach I used below is ...
6
votes
2
answers
342
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:
...
5
votes
2
answers
359
views
5
votes
1
answer
4k
views
Class-based user input validation
Having contributed to this Community Wiki on StackOverflow regarding validating user input, I thought I'd finally sit down and write something more robust to do these kinds of tasks. I wanted ...
5
votes
3
answers
2k
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?
...
5
votes
2
answers
522
views
Validating a password format
How should I make this more Ruby-like or just "better"?
...
5
votes
1
answer
863
views
Validation extensions v2
I have still another version of my validation extensions. I've reworked it and added some new features. It doesn't relay on expression trees any more but as a compensation the same extensions can be ...
4
votes
1
answer
2k
views
Luhn algorithm MS-SQL
This a solution Luhn algorithm for credit validation.
This algorithm is a basic one inspired by wikipedia. I mean no check for length, type, and so on. You can enhance the base code as you want it to ...
4
votes
2
answers
2k
views
Credit card checking
I am practicing test-driven development in Python. Feedback about both the tests and the code is appreciated. I'm using luhn algorithm and regex to check credit card numbers for validity.
Here are ...
4
votes
1
answer
147
views
Constraining a property setter fluently
The below code is aimed at providing you the most amount of control and flexibility with control which value gets set to a property.
I Introduce to you, the ...
4
votes
2
answers
839
views
Big Nerd Ranch Bronze Challenge: Disallow Alphabetic Characters
I just completed BNR's bronze challenge for disallowing alphabetic characters, and would love some feedback on what I did right and wrong, and how I can improve my code for reusability and ...
4
votes
3
answers
2k
views
Hold and validate an EAN13 code
I've created a class that holds an EAN13 code. This class is an attribute of the Product class.
In the Ean13 class, the ...
4
votes
1
answer
118
views
Validating company registration numbers
N.B. The next stage of this project, which covers parsing filenames and checking numbers against the list produced in this question, is covered here.
I have a list of company numbers (UK companies ...
3
votes
3
answers
292
views
Email Validation in PHP
Is this script sufficient enough to validate user email input?
...
3
votes
2
answers
663
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 ...
3
votes
1
answer
4k
views
Validating an entity using a dynamic list of predicates
I have a generic extension method for validating my entities. The main idea is to be able to specify at runtime (context related) the criteria for validating a specific entity (with the end goal of ...
3
votes
1
answer
2k
views
Change password after being validated
I'm doing Python programming challenges and have come across one where the object of the challenge was to create a script to change passwords. The script must validate that the password contains, one ...