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
-1
votes
1answer
29 views

Java validation void exceptions vs Boolean check [closed]

I was reading this question Is it better practice to have void method throw an exception or to have the method return a boolean? that was asked a while ago and I'm faced with a similar dilemma. Since ...
3
votes
1answer
141 views

Sanitation and validation of a user input 10 digits phone number

phoneNumberCheck() is using 2 helper function to check if a users input of a phone number is valid. this is a client side check, if this code is ok should I check the same at the nodeJS back end? is ...
1
vote
2answers
125 views

Possible speed improvements for a Sudoku board validation algorithm?

I tested this algorithm on 9x9 boards and on average, if the board passed to the function is a (valid) solution, it takes 0.13-0.14 seconds for 1 million executions on my machine. I ran my code in ...
4
votes
1answer
58 views

How to make my code shorter. This Code formats Credit card number. Vanilla JS

How to make my script shorter and better? This code allows only digits, auto-format card number like this XXXX XXXX XXXX XXXX. if user hits delete or backspace to delete space in between digits, ...
7
votes
5answers
105 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. ...
7
votes
3answers
664 views

Input validation

I am learning C from C Primer Plus, and am still a beginner. I have been introduced to only two functions for input, scanf() and ...
1
vote
3answers
77 views

What is the best way to login according to account type with server-side validation?

I have two access roles as of now for example account_type 1 and 2. What I am doing is, <...
2
votes
1answer
61 views

Recursive type checking for containers

This code checks the type, length and depth (highest number of nested containers) of the container as well as the type of its sub-containers and its elements. There are also two simple methods for ...
0
votes
1answer
36 views

optimize integer validation

I have some classes with properties, wich could only have numeric values in a given range (e.g. 0 to 8). This should be validated and wrong values prevented with an exception. The given behavior may ...
2
votes
1answer
24 views

Validator and Sanitizer for HTML 5 attribute regex according to current HTML living standard

According to https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 an HTML 5 attribute name is defined like this: Attribute names must consist of one or more characters other than controls, ...
3
votes
1answer
128 views

Submitting form jQuery checkboxlist

In my requestForm submit function I have this logic that checks three checkboxes and then displays the label with an error message. Is there better logic? I would be happy for any kind of feedback ...
1
vote
1answer
63 views

Advent of Code 2020 - Day 2: validating passwords (C++ version)

Original: Advent of Code 2020 - Day 2: validating passwords Problem statement I decided to translate my Rust solution to Advent of Code 2020 into C++ to increase my familiarity with C++. Here's the ...
1
vote
1answer
60 views

How can I upgrade my validation in JavaScript?

How to improve my validation in JavaScript? Namely I am wondering whether some parts of code can be shortened, improved, or removed althogether. I don't want to change the ES5 syntax because so far I ...
7
votes
2answers
652 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 ...
0
votes
1answer
105 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 ...
2
votes
1answer
66 views

Suitable way for Validating JPA Entities in Spring Boot

I have been around in Spring Boot eco-system since 2012, I have worked on many little projects. The most important thing in development I experienced id Validation ...
2
votes
1answer
64 views

user-facing email validation

I'd like to have a generic way for validating user provided email with a bias toward ease of use. Does the following do so in a clear way for implementations that have the ...
0
votes
1answer
40 views

Attempt on basic input validation and functional programming in a POSIX shell

In spite of all the POSIX shell disadvantages, I am still sticking with it and I love its portability. Recently, I was searching for a way of code re-use, which turns out to be structured programming ...
3
votes
2answers
55 views

C++ PixelComponent struct

Hey I wrote a struct in C++ trying to represent a Pixel Component of a color Here it is ...
6
votes
2answers
140 views

Chess Dictionary Validator from Automatic Boring Stuff with Python

This project is in chapter 5 introduced me to a whole new world of dictionary data structure. To put it briefly, I want to know whether the choice I took between lists, tuples, and dictionaries could'...
2
votes
1answer
242 views

Handle database validation (exists, unique constraint, etc) [closed]

Let's assume you are writing a REST Api with a common structure like Controller > Service > Repository > Database. In the database there's a table with a column with a unique constraint: <...
3
votes
1answer
56 views

Checking Object keys set with value against another Object keys

I'm willing to check an an object's values in typescript, based on another object's keys. The mental model is "the key exists, it's not an object, is the value in obj set, otherwise, it's an ...
4
votes
2answers
82 views

PHP Email List Sign Up

See my original post: here. I have one html page and four php files that allow users to sign up for an email list. One of the php scripts is a cronjob that deletes unverified rows older than 24 hours, ...
3
votes
3answers
155 views

Email Validation in PHP

Is this script sufficient enough to validate user email input? ...
-2
votes
1answer
53 views

Validate Search Binary Tree [closed]

I was looking to this exercise: Is Valid Binary Search Tree I tried to do the exercise by myself without looking to the solution and my code is "much simpler" than the code I found at the ...
1
vote
2answers
224 views

Python Regex to validate an email

I have written this regex to validate an email. It seems to work fine. Can someone advise on the regex used? Does it work properly or can be done in a better way? ...
3
votes
0answers
37 views

Validating a file input whose value is reset to empty string (“”) after selection

My form comprises of a mandatory file input. The form is validated according to the jQuery validate plugin. The file input has attribute required so that the ...
1
vote
0answers
35 views

Find Invalid User Relationships in User to Manager Map (validate map as valid tree structure with no circular relationships)

We have a new service where an admin can upload a spreadsheet of new users they want to add to our application. During our processing we make a union map of all the users both existing and new ...
1
vote
1answer
34 views

Check that elements in list follow a specified date-format schema and are not null/na/nan [closed]

I'm practicing some data-analysis and I'm currently checking the integrity of my data. The elements that do not follow my date-schema, should be funneled to a new separate list so I can work on ...
2
votes
1answer
142 views

What is the best way to use serverside validation in PHP PDO?

I have a form on my page. I am using jQuery validation for client-side and PHP for server-side validation. I am using PDO. I don't have any issues with client-side and server-side validation. My form ...
3
votes
1answer
120 views

Secure/Bulletproof Image Upload Using PHP

Here is my code that check and upload an image to my website. Is this code really secure against uploading of malicious codes? Anything I have to add to this code to make it more secure? I have also ...
13
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/...
1
vote
1answer
252 views

Entry Validation in Xamarin.Forms

I have an Entry that I want to give a red outline when the entry is empty. I'm using SyncFusion's SFTextInputLayout for my Entry and it has a property ...
3
votes
0answers
226 views

WPF: An implementation of INotifyDataErrorInfo

An abstract base class which derives from the ObservableObject (MvvmLight), implementing the INotifyDataErrorInfo interface. ...
8
votes
1answer
266 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
43 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
112 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
237 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
1k 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
2k 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
1k 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
797 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
55 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
91 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
82 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
217 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
85 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
1k 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
67 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
88 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', ...

1
2 3 4 5
15