Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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
1answer
961 views

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

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: ...
5
votes
2answers
86 views
+200

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
50 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
40 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
68 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
73 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 ...
5
votes
4answers
159 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
68 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
42 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
57 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
81 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
38 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
75 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
668 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
334 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
75 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
36 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
30 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
157 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
62 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
45 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
32 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
42 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
161 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
53 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
952 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
288 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
73 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
59 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
61 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
69 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
46 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
90 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
53 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
90 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
108 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
100 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
65 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
182 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
53 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
40 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
85 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
228 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
101 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
239 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 ...