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
12
votes
4answers
2k views

C Program which compares software version strings

I wrote the following C program to compare software version strings. Please provide any general feedback you'd like, but with special focus on error handling decisions, user input validation/...
2
votes
0answers
57 views

WPF: An implementation of INotifyDataErrorInfo

An abstract base class which derives from the ObservableObject (MvvmLight), implementing the INotifyDataErrorInfo interface. ...
8
votes
1answer
232 views

Validate an IBAN

I've found an explanation on Wikipedia on how to validate an IBAN. Since the number generated from the transformation can cause overflow with all data types available in VBA, I've worked with ...
1
vote
0answers
37 views

App that Builds a list of “targets” for a Text-Based RPG using the games' API

all! I am developing a web "app" with JavaScript and jQuery with the help of a couple of other libraries for ease of use. Its purpose is to collect user ID's and to build a list of "attackable" ...
3
votes
1answer
70 views

Parsing opening hours, discarding insane ones (part of the OpenStreetMap editor)

This code is used to check opening hours data from OpenStreetMap can be handled by an editor app. In case where opening hours is not too complex data is also turned into an usable form. It is a part ...
3
votes
2answers
106 views

Validate if either or both of two fields has been provided, as a ValidationAttribute

I have a binding model where at least one of two fields must be specified. I can't just set them both as [Required]. Here is what I came up with: ...
2
votes
2answers
401 views

Beginning BMI calculator in Java

This is my first program so no doubt I've made mistakes. The code works and meets all requirements as far as I can see. (Further info: program to calculate Body Mass Index (BMI) allowing user to ...
9
votes
1answer
1k views

C function to check the validity of a date in DD.MM.YYYY format [closed]

I was tasked with writing a function, that checks whether a date is valid in the following format: DD.MM.YYYY. Here's what I wrote: ...
6
votes
2answers
434 views

Angular control for inputting latitude and longitude with validation

I've built a custom control to handle user input in a human-readable format, but save in a machine-format. It needs to have input validation, and to convert UI-input to a base format. I'm interested ...
1
vote
1answer
118 views

better multiple fields validation on ruby/rails

I have a form for an item (Job Item), that has sets of 2 fields based on a type. field and field + _dolar e.g: ...
2
votes
1answer
47 views

Validate (Possible) File/Directory Path

I am working on a "comprehensive" library for use in my internal applications and I have created a working method (as far as all of my testing has shown thus far) to ensure that a file/directory path ...
1
vote
0answers
80 views

Generics and aggregated evaluation of validation rules

I have a custom system for data validation; it handles anything from method parameters, return values, objects, etc. The core of this system is IValidationRule and ...
2
votes
0answers
79 views

Sanitize input for a “robot on a grid” kata

I have the following piece of code which is FSI tested and works. However, I want to trim it as much as possible (not only the comments, which are there for my own future reference) and make it as ...
6
votes
4answers
190 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 ...
2
votes
2answers
78 views

Manipulate urls with regular expressions instead of the slip approach

Basically I have an url which looks like this structurally speaking: http://www.my-site.com/topic1/topic2/topic3/topic4/topic5 and I want to do 2 things to it: <...
3
votes
1answer
126 views

Validate URL with Regex and java.net.URL

I'm writing a URL validator. Firstly, it checks for special characters in the input. Secondly, it adds 'http://' and checks for validity. ...
3
votes
1answer
63 views

Constructing constrained/validated objects

I'm trying to do some rudimentary DDD in validating my objects to ensure they are of a particular type. I.e. an Email object would always look like "my@example.com" ...
0
votes
2answers
84 views

Python code to continue if a certain type is seen, otherwise try again to get valid input [closed]

I am very very new to programming, and this is my first day using Python. I want to check to see if an input is of type 'int' and to proceed with my program if the user has entered an 'int', ...
2
votes
0answers
39 views

Ensuring a valid JavaScript string in security-critical application

I'm writing an application where users can write custom expressions which are then converted to JavaScript functions and executed. The expressions are used for filtering and sorting data from a ...
2
votes
1answer
28 views

Conditional validation for credit card payment information on form submission

This is the piece of code I'd like to refactor. Basically, when the credit card option is selected, then do I want the credit card number, zip code, and Cvv inputs to be validated. ...
4
votes
1answer
201 views

Regex XML validator

I have written a Regex to validate XML/HTML, along with any attributes. It aims to: Match any XML-like text Not match any unclosed tags Adapt for any spacing, newlines, etc. Be as generous as ...
10
votes
4answers
698 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 ...
7
votes
3answers
342 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
255 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
37 views

Validating partially filled objects

The following classes are a simplification of an auto-generated code of an ORM (targeting Microsoft's Dynamics CRM): ...
4
votes
0answers
38 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
240 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
80 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
39 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
54 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
34 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
54 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
167 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 ...
3
votes
1answer
58 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
1k 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
304 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
81 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
60 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
66 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
71 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
89 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
147 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
54 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
100 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
110 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
107 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
76 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
244 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
74 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 ...

1
2 3 4 5
14