How to calculate a FedEx Smartpost tracking number' check digit - fedex

FedEx Ground's tracking numbers have different digits: 12, 15, 20, 22.
12-digits tracking numbers use mod 11 algorithm.
Others use mod 10 algorithm.
But recently I got some 20-digits FedEx Smartpost tracking numbers which can't identified by both algorithms.
So, how can I identify these tracking numbers?
Sample tracking numbers:
7489999873402038xxxx
6129270107532465xxxx
I figured this out.
see:
http://images.fedex.com/us/software/pdf/FedEx_SmartPost_Job_Aid_v2600_06222012.pdf
https://www.pdffiller.com/en/project/10655396.htm
22 digits tracking numbers remove 2 digits application identifiers (91 or 92).
We need add application identifiers to the tracking numbers before mod 10 algorithm.

The 20 digit codes need either 91 (old) or 92 (new) before the code. Pre-pend those and apply a standard mod-10 algorithm used by the IMpb standard.

Related

What is the function to just identify outliers in Google Sheets?

I know of the TRIMMEAN function to help automatically exclude outliers from means, but is there one that will just identify which data points are true outliers? I am working under the classical definition of outliers being 3 SD away from the mean and in the bottom 25% and top 25% of data.
I need to do this in order to verify that my R code is indeed removing true outliers as we are defining them in my lab for our research purposes. R can be weird with the work arounds of identifying and removing outliers and since our data is mixed (we have numerical data grouped by factor classes) it gets to tricky to ensure that we are for sure identifying and removing outliers within those class groups. This is why we are turning to a spreadsheet program to do a double-check instead of assuming that the code is doing it correctly automatically.
Is there a specific outlier identification function in Google Sheets?
Data looks like this:
group VariableOne VariableTwo VariableThree VariableFour
NAC 21 17 0.9 6.48
GAD 21 17 -5.9 0.17
UG 40 20 -0.4 6.8
SP 20 18 -6 -3
NAC 19 4 -8 8.48
UG 18 10 0.1 -1.07
NAC 23 24 -0.2 3.5
SP 21 17 1 3.1
UG 21 17 -5 5.19
As stated, each data corresponds to a specific group code. That is to say, their data should be relatively similar within each group. My data as a whole does show this generally, but there are outliers within these groups which we want to exclude and I want to ensure we are excluding the correct data.
If I can get even more specific with the function and see outliers within the groups then great, but as long as I can identify outliers in Google Sheets that could suffice.
To get the outliers, you must
Calculate first quartile (Q1): This can be done in sheets using =Quartile(dataset, 1)
Calculate third quartile (Q3): Same as number 1, but different quartile number =Quartile(dataset, 3)
Calculate interquartile range (IQR): =Q3-Q1
Calculate lower boundary LB: =Q1-(1.5*IQR)
Calculate upper boundary UB: =Q3+(1.5*IQR)
By getting the lower and upper boundary, we can easily determine which data in our datasets are outliers.
Example:
You can use Conditional formatting to highlight the outliers by clicking Format->Conditional Formatting and copy the following:
Click Done and the result should look like this:
Reference:
QUARTILE

How can I get two programs to have the same sequence of random numbers?

Is it possible for 2 applications (a server and a client) to generate the same sequence of random numbers? What I need is this:
On server:
i1:=randomrange(10,50); //i1 will be 15
i2:=randomrange(10,50); //i2 will be 40
i3:=randomrange(10,50); //i3 will be 20
On client:
i1:=randomrange(10,50); //i1 will be 15
i2:=randomrange(10,50); //i2 will be 40
i3:=randomrange(10,50); //i3 will be 20
The sequence needs to be dependent of a value that the server calculates and sends it to the client
Random number generators are typically, in fact, pseudo random. Given the same initial state, the pseudo random number generator (PRNG) will generate the same sequence of numbers.
Typically thia state is provided by means of a seed. If you are using the PRNG provided by the RTL then you set the seed by assigning a value to RandSeed. Use the same seed in each program and you will generate the same values.
If you are using a different PRNG then consult its documentation to find out how to seed it.
If you want to implement a pseudo random sequence yourself you may start from linear congruential generator. Actually it is very easy
and there are only 3 restrictions on the a, c and m values
m and c are relatively prime,
a-1 is divisible by all prime factors of m
a-1 is divisible by 4 if m is divisible by 4
See Linear congruential generator wiki for details.

How to call 2 digit phone number in IOS 6 7 8 using tel links

I wonder why 2 digit phone number won't open phone app after tapping "call"
555 // shows alert, tap on call opens phone app
55 // shows alert, tap on call won't open app
If this isn't possible using the tel scheme, then Apple's implementation doesn't conform to RFC2806 (which they reference in their documentation for Phone Links), which states:
It should also be noted that implementations MUST NOT assume that telephone numbers have a maximum, minimum or fixed length, or that they would always begin with a certain number. Implementors are encouraged to familiarize themselves with the international standards.
I'd file a bug.
I don't think 2 digit phone numbers are functional numbers. Apple does not allow you to call numbers shorter than 3 digits.
According to spec, a valid telephone number should consist of the first digit of the area code being between 2 and 9, followed by at least 2 digits. Therefore, the smallest valid telephone number is at least 3 digits long.
If your attempting to do something like dial a number, and then dial an extension you can define a pause with p like this:
tel:234p55
w can also be used to specify a wait-for-dialtone.
I do not know if this will work or not but you may be able to dial a 2 digit number using phone-context
55

Multiply or divide numbers larger than 38 digits in objective c

I am writing an app that , among other things will be able to multiply or divide very large numbers by number 19 - Those large numbers could possibly span hundreds of digits . Do you know of a library I could use for that? Thanks in advance. I have tried using NSDecimalNumber but its not able to produce results past 38 digits.
If licensing is not an issue GMP is good.

Working on 16 bit unsigned integer (uint16_t)

I want to generate a 16 bit unsigned integer (uint16_t) which could represent following:
First 2 digits representing some version like 1, 2, 3 etc.
Next 3 digits representing another number may be 123, 345, 071 etc.
And last 11 digits representing a number T234, T566 etc.
How can we do this using objective C. I would like to parse this data later on to get these components back. Please advise.
I think you are misunderstanding just what uint16_t means. It doesn't mean a 16 digit decimal number (which would be any number between 0 and 9,999,999,999,999,999). It means an unsigned number that can be expressed using 16 bits. The range of such a value is 0 to 65535 in decimal. If you really wanted to store the numbers you are talking about you would need 52 bits. You would also be making things very difficult for yourself, since you wouldn't easily be able to extract the first two decimal digits from that 52 bit sequence; You'd have to treat the number as a decimal value then modulus 100 it, you couldn't just say it's bits 1 to 8.
There is a scheme called Binary Coded Decimal that could help you. You would take a 64 bit value (uint64_t) and you'd say that within this value the bits 1-7 are the version (which could be a value up to 127), bits 8-17 are the second number (which could be a value up to 1023) and bits 18-63 could be your third number (those 46 bits would be able to store a number up to 70,368,744,177,663.
All this is technically possible, but you are really going to be making things hard for yourself. It looks like you are storing a version, minor version and build number and most people do that using strings, not decimals

Resources