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
10
votes
4answers
608 views

Repetitive validation of Console inputs

I have this code that asks the user for inputs and validates the inputs if they are Integers (no other inputs are allowed). I'd like to ask for some help in terms of elegance of the code or ...
-1
votes
0answers
37 views

Student record validation [closed]

I want to refactor my code to take in ~10 dataframes instead of just 1. This code is working, I'm just not happy with my list comprehensions/data structures. This script extracts, or reads and cleans ...
7
votes
3answers
328 views

IP4 strings validator

Trying to write fast non dependency IP4 string validator for embedded system, It should counts leading zeros, values over 255 and other corrupted strings. Not sure if I missed something. Сan you guys ...
7
votes
1answer
49 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 ...
3
votes
1answer
35 views

Validating partially filled objects

The following classes are a simplification of an auto-generated code of an ORM (targeting Microsoft's Dynamics CRM): ...
3
votes
0answers
25 views

Form deserializer for Python Flask

I've started working on a small Flask project for no real reason other than fun, and pulled myself back on form validation. I realize that there are existing libraries like WTForms, but wanted to try ...
6
votes
2answers
115 views

Asynchronous IBAN API with validation

I am working on an iban api which is about saving the iban of some members after (iban validation) in a database. The code is split between Domain (entities, behaviour for iban validation), Database ...
3
votes
2answers
45 views

Checking the strength of a password using regexes

I'm a beginner in Python and I made a password checker. I'm following these rules: I have to use regex password must be at least 8 characters must have at least one lower case character must have at ...
1
vote
1answer
34 views

Integer field in Python with extra constraints (Testable class)

I am trying to write an integer field in Python with the following attributes: Minimum Exclusive minimum Maximum Exclusive maximum Multiple of Value Basically, given the constraints and the value, ...
1
vote
0answers
38 views

React.js hook to validate a form on submission

I am fooling around with hooks in React and I'm stumbling against decisions that I need to make regarding implementation. Below is the code for the custom useForm hook which can be used to hook up ...
0
votes
1answer
31 views

Upload image with GD library

First of all I just started learning OOP. My priority is to make safe code. I think my code is safe, because I use GD to make a copy of the uploaded image and I use an image proxy to make sure nobody ...
2
votes
0answers
40 views

jQuery validation for multi-page registration form

I use JS/JQuery validation for radioboxes, input field etc. Because of AJAX I use one global validation (in a separate file) and 4-5 other files to coverage actions in a relevant registration form ...
0
votes
1answer
49 views

Generate an ID number for each new row of text that is pasted into the worksheet

This code checks if "B2" and so on is filled in and if it is then it will generate a new ID number for the row of data that was transferred to the worksheet on the next empty row, I know this code ...
2
votes
1answer
154 views

Checking if an object meets certain criteria to amend to certain Entity Objects?

I am trying to check if a class has only numeric values in it and then return a bool, however, some instances there may be non numeric chars in an object that ...
2
votes
0answers
31 views

Range validator for multiple types

I have an existing overloaded set of functions that I cannot change and need to be tested: ...
7
votes
3answers
847 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 ...
6
votes
3answers
271 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 ...
2
votes
0answers
69 views

Pricing data checker script

I was recently given a task to implement a data-checker script which given an input file containing (date, last_price) values should check for 3 different kind of errors - missing values, stale values ...
3
votes
1answer
54 views

Servlet to let a user download a file

Is the code below an efficient way to get the zip file from the server? The code works fine but I'm wondering if I should throw some exceptions for the following conditions: ...
1
vote
1answer
59 views

Sign-up serialization in Python [closed]

I built a small project using Django-Rest-Framework. Please comment on the best practice style for the code below, which will make it simpler. ...
2
votes
2answers
64 views

Validating that a Java program has two equal-length arguments

I'm writing a small almost one method Java class for a job application and the advice given was to write it as though it was a piece of commercial software. The ...
4
votes
0answers
36 views

Vuejs - input validation

I'm in a project that's currently using vue. I'm at the moment developing validations for the inputs and in a way to make them more flexible, my idea was to create an intermediate component "Group ...
5
votes
1answer
76 views

PHP program to validate phone numbers from a file

As part of job interview, I was asked to write a cli script that takes a list of phone numbers to validate from a file and as an option in the command line. It will then produce a CSV file with three ...
5
votes
1answer
52 views

Add-in for input() with validation

What do you think about this code? Do you have some advices and remarks for me about them? I have started learning python recently. ...
6
votes
1answer
85 views

Simple function to create Tokens from user input

I am new to programming in Rust and as an exercise I was making a simple Lottery checker program. It has a simple menu, the user enters a number for the corresponding option such as 'Add a line', '...
0
votes
1answer
107 views

Chaining ConstrainableSet<T> [closed]

Based on feedback on my previous question, I made many small adjustments to the code, added more APIs and tried to follow through with delivering on the excellent advice I have received in regards to ...
4
votes
1answer
97 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 ...
3
votes
2answers
61 views

POSIX shell function for asking questions

I've written a tiny function for asking questions intended for my POSIX shell scripts, where I often need user input. The function takes 2+ arguments, where: Is a string containing the question. , 3....
2
votes
1answer
164 views

Filtering and Validating value in SETTER

I have been working on a side project for input filtering/Validation. First I would like to go over my interface. ...
3
votes
1answer
46 views

checksum hash verification functions for bash scripts

just a little script, or a bit of a template of one that I used to submit an assignment. I believe it all works fine, I just wanted to give it to other people, and get some feedback on it; maybe make ...
2
votes
0answers
38 views

Validating Amazon CloudFormation templates using Rspec

I have created an open source project that uses Rspec to validate the formatting of AWS::CloudFormation::Init YAML blocks in CloudFormation templates.1 My project is here. Some general concerns: Is ...
1
vote
2answers
84 views

Input class in Java

I'm a newcomer to Java (I primarily do C# ) and I have to say that they have made I/O handling much more difficult than it should have been. I am accustomed to the scenario where when I need keyboard ...
3
votes
1answer
155 views

Login page using RxSwift in MVVM

I am building a simple login page which will check for username before navigating to another screen and here is how I am doing the binding now. I would like to know if I am doing it right and if I am ...
2
votes
0answers
70 views

WebAPI: Async Filtering CSV content + Json/XML Serialization

I am coding a csv file filtering api in ASP.NET Core, which takes a csv file located at a given uri (and retrieved via the query string) convert the content to a collection of records, then apply a ...
4
votes
1answer
168 views

Swedish 'Personnummer' validator

I have a small C# program that validates Swedish social security numbers ('Personnummer'). I chose to use Regex as there are many different ways it can be input. ...
7
votes
2answers
1k views

Validate IP4 address

Validate IP Address I got this problem during an interview. And would like to get some code review. I also wrote several tests with the expected output, and they all passed as expected. Validate ...
4
votes
0answers
48 views

Winforms MVP Validation

I have a Winforms MVP application where I need to use the ErrorProvider on the view. I have added the following methods to my presenter to allow me to show the ErrorProvider but it just doesn't feel ...
7
votes
1answer
75 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 ...
6
votes
2answers
694 views
5
votes
1answer
106 views

Ship placement verification function for Battleship game

I wrote a server-side Battleship game simulator in nodeJs/Javascript: A random player who begins is chosen. Both players place their ships. Software recognizes if they are placed correctly. One of ...
2
votes
1answer
81 views

Form validation function for React

I need to validate multiple input fields using React. I am using a simple if-else block for each input field but I would like to optimize my code and make it better. I feel there can be a better way ...
1
vote
0answers
21 views

Optimistic validation on tab change

I have a rather large UI for editing a user within a Angular application. It is split in multiple tabs and in order to reduce complexity the user cannot change the tab unless there is no validation ...
9
votes
2answers
550 views

Bash script to truncate subject line of incoming email

I'm going to put this script into production in a mail server /etc/aliases file: we have a system that receives email but the subject line must be limited to a certain size. The proposed usage in the ...
1
vote
2answers
95 views

Validation and business logic for a form for milling jobs [closed]

I have the following BLL (Business Logic Layer) class. It is the first class I have created that takes away all responsibility from the UI (where this class is instantiated/created/called) in terms of ...
5
votes
3answers
566 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 ...
1
vote
0answers
20 views

jQuery plugin for allowing only digits to be entered in html form input

I wrote this small jQuery plugin to set some fields so that they allow only 0-9 digits to be entered. I intended to do that by preventing user from typing, pasting or dropping non-digit content. It ...
2
votes
0answers
50 views

Textbox validation component

My intention is to have a component that serves as a textbox wrapper and able to set the error state, error message, and allow the parent to pass a function that sets its local error as I did not see ...
1
vote
1answer
77 views

Using a form with formsets in Django

I'm learning Django and making my (technically second) project. The project features several apps, including player_interface and manager_interface. Here's the player_interface/models.py: ...
10
votes
7answers
2k views

Versatile string validation

I passed a technical test the other day, one part included a cheap string validation and I am wondering this can be further improved to be more versatile to requirement changes. The requirements were ...