- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Hey ! I live within the first range of zipcodes !!!
Admin
Someone's read "Loops considered harmful"
Admin
A company I worked for years ago talked about rating programmers by lines of code produced per day. I was quite disappointed that they didn't do this. I had lots of plans like this in mind to really boost my productivity.
Admin
Well, not really a shift. digit = ascii & 0x0F.
Personally, I always use " ascii - '0' " as more readable, though. Surely slightly slower, but more readable.
Admin
The solution I've used on several occassions is to take the sum of the odd-position digits plus 3 times the sum of the even-position digits, then take the mod on that.
So 1234 -> (1 + 3) + 3 * (2 + 4) = 22 22 mod 10 -> check digit 2 (or 8 if you want to take 10 minus).
1243 -> (1 + 4) + 3 * (2 + 3) = 20 20 mod 10 -> check digit 0
i.e. a transposition gives different results.
Admin
That fails to catch certain transpositions like 32 => 23 (Luhn fails to catch 09 => 90, to be fair.)
For an algorithm that catches all transpositions:
http://en.wikipedia.org/wiki/Verhoeff_algorithm
Admin
Holy Mary, mother of Jesus...
Admin
Yes, that is the way a modern addressing system works.
Every single delivery point has a unique code. To get the cheapest rate, you put the correct unique code on every single piece of mail. To do that, you have an enormous database of every single address point, with it's correct unique index. And every single unque code has a "correct" mail address, which the is used for final delivery.
The unique mail point database is provided by the post office. I don't know if the post office in your country has a modern addressing system.
Big mail houses also have mail lists, which match people to address points. This is a separate service.
Admin
Admin
Have you noticed your trackbacks are all spam?
Admin
To think so much of the repetition could have been done away with using one goto.
Admin
Admin
Admin
Wouldnt this work?
int checkDigit(char *zipcode) { int result = 0; for(;*zipcode != '\0';zipcode++) { result+=*zipcode-'0' if(result>10)result-=10; } return 10 - result; }
Admin
It must be JavaScript.
Admin
The raptor? :)
http://xkcd.com/292/
Admin
Woah, deja vu.
Admin
hyperventilating