How to validate a passport? [closed] - validation

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Well I have been asked to validate passport numbers (the documents used on airports to travel to other countries).
My question is: What format are these "numbers"? All I know is that they can have letters but I am not finding any place defining the rules. Any pointers/Links?

I don't think you're going to be able to do this without restricting yourself to certain issuing countries. If you look at the specs of machine readable passports:
http://www.highprogrammer.com/alan/numbers/mrp.html
It says that each country is free to use any format it likes for the actual passport number (including letters or digits). Although in the machine readable schema these seem to be limited to 9 characters (which might cause problems for countries with billions of citizens if they were to just use digits!)

I would expect the format to depend on the issuing country.
UK passport numbers consist of 9 digits but used to consist of 6 digits and a letter.

Related

How to configure a Policy engine and calculate attributes based on risk score Algorithm? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 months ago.
Improve this question
How to configure a policy engine that is suitable to calculate risks based on attributes that have been collected from the user based on given access control. for instance Attribute based access control ?
is there a risk algorithm that can be helpful in this case ?
XACML itself (the spec) and its alternatives (OPA, Oso, ...) do not tell you how to compute a risk score. There are risk score engines for that. For instance take into account user attributes e.g. age, years driving, alcohol level in your bloodstream... Policy engines need to know a risk score but the calculation of that score should be devolved to risk engines.

Which language is best to handle extremely large numbers? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I want to handle extremely large integer values of a few million digits for an experiment I'm conducting.
Which language is best for this? I know some languages such as batch have pre-established limits on how many digits it can handle.
I have a large RAM and 64-bit OS, so my machine isn't a problem.
Regards,
-Master-chip
in python 3.x the int type does not have a limit so if you are just looking for a suggestion I would check out python.
see https://docs.python.org/3.1/whatsnew/3.0.html#integers
What are you looking to do with the numbers? If your number is larger than the maximum value of an unsigned 64 bit long is 18446744073709551615 then you won't be able to use the normal types and will want to look at languages that support bigInts http://docs.oracle.com/javase/6/docs/api/java/math/BigInteger.html
Honestly there are solutions for this in most languages you will just have to pick the one you want to work with and look at its solution
Can you store these values as Strings?
Do you need complete accuracy of the numbers or can you store them as floats

What's the best ruby gem for parsing international phone number? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I need a library to help with parsing international phone number. I tried a couple of them like phone_number, phone, phony, and phoney. After playing with them the whole afternoon, none of them is perfect or as good as Google's libphonenumber (Java though). However, I am forced to choose one for my current project so I go with phoney gem, which seems active and provides more international support. Does anyone know anything better?
There was a similar question below but it's more than a year ago and focused on US phone numbers.
Is there a gem that normalizes and format US phone numbers in ruby?
Check out Phoner. It seems to parse both US and international numbers well.
The most current and supported (as for now) is https://github.com/floere/phony
Also you can have a look on https://github.com/carr/phone and https://github.com/habermann24/phoney/
I wrote a gem called ItuCodes that does basic parsing of country codes, paying special attention to complex cases like North America, Russia & Kazakhstan:
* https://github.com/bowsersenior/itu_codes
ItuCodes does not aim to fully parse area codes for every country code, but such a tool could be built on top of it.

Error recovery algorithms? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
I am doing a software that grabs in the end a numeric string, that string encodes important data, and any error destroy the contents.
Worse: It is VERY prone for errors, because of how data is transmitted (and I can do nothing about it).
So I decided to add a verification digit of sorts... After some research, I have more questions than answers... So, someone can point me to a decent location to study more about that subject?
Also, someone know some popular algorithms that can even fix errors, or at least point where the errors are, so I can retry grabbing the data with error?
Also what I do, if the checksum data itself managed to be wrong in transmission?
Hamming Code
simple pdf explanation of hamming code
Basically for every N bits of your message, you have some check bits.
You can detect and correct errors in the check bits, based on the data, or errors in the data, based on check bits. Too many errors though, and it's just garbage. There may be a utility in your language of choice to already do this.
This can be of use: http://www.eccpage.com/

How much flexibility do you allow users creating uids? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
After having to register at one more website, and hitting stupid restrictions on the Username (no spaces or special characters), I'm wondering why we still have programmers restricting things like that.
Is there a concensus on the methodology of allowable usernames?
Often it's based on technology restrictions. For example, if your UIDs are going into a database, they have to be sanitized. Rather than try to catch all possible exploits or problematic values, many developers choose to restrict their UIDs to alphanumeric characters.
Also, when integrating with legacy systems, sometimes there are limitations already in place - perhaps the "username" field is only 6 or 8 characters long.
Ultimately, there's usually not a good engineering design reason for doing this, since a username should not be used in any meaningful calculations, but there are often good business reasons for doing so.

Resources