• Ivan Godard (unregistered)

    "Ivan 04627" would get to me when I lived in Deer Isle.

  • Jay (unregistered) in reply to Anketam
    Anketam:
    At least with UK post codes you can use a regex to validate most cases. US zip codes are far more troublesome. I am just glad that the guy was not trying to validate zip+4 and delivery point also.

    Umm, "[0-9]{5}"?

    I had to write a regex for UK postcodes just recently and it was a complicated nightmare. Are you trolling?

    Or do you mean that a regex on zip codes would pass many that meet the format but do not really exist, while all postcodes that pass a relatively-simple regex would be valid? That seems unlikely, but ...

  • Jay (unregistered)

    According to this site -- http://maps.huge.info/blog/2011/04/new_zip_codes_for_2010.html -- the US postal service added 41 new zip codes in 2010. I don't know if that's typical, but if so, that's a fair amount of updating to have to do on a regular basis.

    Sounds like way too much trouble to me. What's the real advantage over just doing a format check, and if the customer types 12345 when they meant 12354, oh well, too bad for them. Plenty of typos would result in valid zip codes anyway.

  • (cs) in reply to Ivan Godard
    Ivan Godard:
    "Ivan 04627" would get to me when I lived in Deer Isle.
    USPS has a huge mailing list (which odds are you are in and it will have your full address), combined with the uniqueness of your name, and that there is less than 600* people in that zipcode (and half that if you are only looking at males), probably was not too difficult for them to figure it out.

    *number from 2010

    Remember that with only Gender, DOB, and Zip code you can uniquely identify 87% of the US population.

  • Jay (unregistered)

    When I was a kid and we were all going off to college, one of my friends told me that his school had its own zip code, and that room numbers in the dorms were all unique within the campus, i.e. if there was a room "123" in one dorm, there wouldn't be a room "123" in any other dorm. So, he said, a sufficient address to get a letter to him was:

    Chris
    209
    91001
    

    I never got around to trying it.

  • Jay (unregistered) in reply to Anketam
    Anketam:
    Ivan Godard:
    "Ivan 04627" would get to me when I lived in Deer Isle.
    USPS has a huge mailing list (which odds are you are in and it will have your full address), combined with the uniqueness of your name, and that there is less than 600* people in that zipcode (and half that if you are only looking at males), probably was not too difficult for them to figure it out.

    *number from 2010

    Remember that with only Gender, DOB, and Zip code you can uniquely identify 87% of the US population.

    Now you've done it. Some idiot will now insist we use this as the primary key for our customer database.

  • (cs) in reply to Jay
    Jay:
    I had to write a regex for UK postcodes just recently and it was a complicated nightmare. Are you trolling?
    If I was I am failing miserably. I too had to create a regex for UK postcodes, yes it was complicated, but it worked.
    Jay:
    Or do you mean that a regex on zip codes would pass many that meet the format but do not really exist, while all postcodes that pass a relatively-simple regex would be valid? That seems unlikely, but ...
    No point in a regex for US zip codes since a typo will likely still validate a regex (as you pointed out in a later post). However, with UK post codes, because of their nightmarish complexity a typo in it will not likely validate a regex. Combined with the fact that getting a complete postal list for the entire UK is neither easy nor complete so having a list of all postcode it is not likely, so you only are left with validation against a pattern.
    Jay:
    Now you've done it. Some idiot will now insist we use this as the primary key for our customer database.
    If that idiot thinks that 87% uniqueness is good enough for a primary key then yes they would be an idiot.
  • Yet Another Steve (unregistered) in reply to Ivan Godard
    Ivan Godard:
    "Ivan 04627" would get to me when I lived in Deer Isle.

    If you have a Post Office Box (a real PO Box, not one at The UPS Store or something), a 9 digit zip by itself will get things to you accurately...

  • (cs)

    Even with the correct ZIP code in the 88xxx range, a neighbor of mine once got a package in Silver City, NM that had been misdelivered to Siler City, NC. Nineteen hundred miles off.

  • wonk (unregistered) in reply to Anketam
    Anketam:
    Jay:
    Now you've done it. Some idiot will now insist we use this as the primary key for our customer database.
    If that idiot thinks that 87% uniqueness is good enough for a primary key then yes they would be an idiot.

    ...And yet, still quite intelligent for a manager.

  • (cs) in reply to D-Coder
    D-Coder:
    KattMan:
    pkmnfrk:
    dkf:
    Validating a ZIP code is one thing, but doing it entirely on the server side? Oh, ow.

    Yeah, he should have done it entirely on the client side, to save the round trip!

    Considering it was hard coded, yes he should have.

    If it was data driven we could argue either way, this is after all, the DAily WTF, where we can argue abotu almost anything.

    ...No we can't.
    That's not arguing, that's just contradiction.

  • Gibbon1 (unregistered) in reply to Captain Enterprise
    Captain Enterprise:
    What, no XML?

    The true WTF is not using regular expressions.

  • (cs) in reply to wonk
    wonk:
    Anketam:
    Jay:
    Now you've done it. Some idiot will now insist we use this as the primary key for our customer database.
    If that idiot thinks that 87% uniqueness is good enough for a primary key then yes they would be an idiot.

    ...And yet, still quite intelligent for a manager.

    Speaking of which, what happened to geoffrey? He should have been here to justify that primary key at least an hour ago.

  • geoffrey, MCP, PMP (unregistered) in reply to PedanticCurmudgeon
    PedanticCurmudgeon:
    wonk:
    Anketam:
    Jay:
    Now you've done it. Some idiot will now insist we use this as the primary key for our customer database.
    If that idiot thinks that 87% uniqueness is good enough for a primary key then yes they would be an idiot.

    ...And yet, still quite intelligent for a manager.

    Speaking of which, what happened to geoffrey? He should have been here to justify that primary key at least an hour ago.

    I cannot justify that. From what I have read, a primary key requires 94% uniqueness, at a minimum.

  • (cs) in reply to Anketam
    Anketam:
    Ivan Godard:
    "Ivan 04627" would get to me when I lived in Deer Isle.
    USPS has a huge mailing list (which odds are you are in and it will have your full address), combined with the uniqueness of your name, and that there is less than 600* people in that zipcode (and half that if you are only looking at males), probably was not too difficult for them to figure it out.

    *number from 2010

    Remember that with only Gender, DOB, and Zip code you can uniquely identify 87% of the US population.

    Not high enough a percentage to be reliable.

  • (cs)
    commentary = commentstr.split("sides laughing");
    

    I see what the real WTF is. It's spelling "ziparray" as "zipary". Outrageous. That should have been caught at code review.

  • neminem (unregistered) in reply to Strolskon
    Strolskon:
    D-Coder:
    KattMan:
    pkmnfrk:
    dkf:
    Validating a ZIP code is one thing, but doing it entirely on the server side? Oh, ow.

    Yeah, he should have done it entirely on the client side, to save the round trip!

    Considering it was hard coded, yes he should have.

    If it was data driven we could argue either way, this is after all, the DAily WTF, where we can argue abotu almost anything.

    ...No we can't.
    That's not arguing, that's just contradiction.
    No it isn't!

    And by the way, the parrot is quite dead.

  • Jimmy (unregistered) in reply to Paul
    Paul:
    KattMan:
    Most towns outside of London over there are small enough that even without your ideal case, the mail carrier knows who is who and can still deliver mail even if you just have a name and post code, no house number needed.

    I remember once time we received a postcard mailed from a friend who was holidaying in Spain. They couldn't recall our address and so it was addressed to "name, town, UK". No house number, street name, or even a postcode. IIRC they didn't even include a full name, just the surname. "Town" at that time was a medium sized town of maybe 30,000 people (and another 80,000 or so in the wide area around it). But a lot of the people who had lived there a generation or more knew each other, from when the town was a good deal smaller.

    "Town, UK" got it from Spain to the local sorting office. Someone there figured out which "name" it was for (probably because they knew or at least recognized the person who sent it, and knew they were a family friend) and put it in the load for that mail route. The postman knew which house on the route belonged to "surname" and delivered it successfully.

    It probably helps that this was back when customer service was still considered worth bothering with and we had a couple of relatives who worked in the post office.

    Can't comment on other countries, but the Postal Service in Australia often surprises me with the effort they go to try to deliver mail - from retrying similar names in the area to realising that (I have no idea why, but I used to have the same confusion when I delivered Pizza's) somehow mail to "Gulf Point Drive" often ends up on "One and All Drive"

    <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com.au/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=North+Haven,+South+Australia&amp;aq=0&amp;oq=North+Haven+South+A&amp;sll=41.390914,-72.859545&amp;sspn=0.09942,0.243244&amp;g=North+Haven&amp;ie=UTF8&amp;hq=&amp;hnear=North+Haven+South+Australia&amp;t=m&amp;ll=-34.790792,138.486314&amp;spn=0.006168,0.00912&amp;z=16&amp;output=embed"></iframe>
    View Larger Map
  • Jimmy (unregistered) in reply to Jimmy
    Jimmy:
    Paul:
    KattMan:
    Most towns outside of London over there are small enough that even without your ideal case, the mail carrier knows who is who and can still deliver mail even if you just have a name and post code, no house number needed.

    I remember once time we received a postcard mailed from a friend who was holidaying in Spain. They couldn't recall our address and so it was addressed to "name, town, UK". No house number, street name, or even a postcode. IIRC they didn't even include a full name, just the surname. "Town" at that time was a medium sized town of maybe 30,000 people (and another 80,000 or so in the wide area around it). But a lot of the people who had lived there a generation or more knew each other, from when the town was a good deal smaller.

    "Town, UK" got it from Spain to the local sorting office. Someone there figured out which "name" it was for (probably because they knew or at least recognized the person who sent it, and knew they were a family friend) and put it in the load for that mail route. The postman knew which house on the route belonged to "surname" and delivered it successfully.

    It probably helps that this was back when customer service was still considered worth bothering with and we had a couple of relatives who worked in the post office.

    Can't comment on other countries, but the Postal Service in Australia often surprises me with the effort they go to try to deliver mail - from retrying similar names in the area to realising that (I have no idea why, but I used to have the same confusion when I delivered Pizza's) somehow mail to "Gulf Point Drive" often ends up on "One and All Drive"

    OOPS...that was meant to be preview.....

    http://maps.google.com.au/maps?q=One+And+All+Drive,+North+Haven,+South+Australia+to+Gulf+Point+Drive,+North+Haven,+South+Australia&saddr=One+And+All+Drive,+North+Haven,+South+Australia&daddr=Gulf+Point+Drive,+North+Haven,+South+Australia&hl=en&sll=-34.791563,138.486357&sspn=0.003401,0.007601&geocode=FTsa7f0dYChBCCkDvL2zqLiwajE2PoJr0wxTDw%3BFTIv7f0dgRpBCCm1dl8ErriwajEe7jSkuZaq3A&oq=One+And+All+Drive,+North+Haven,+South+Australia+to+Gulf+&t=m&z=16

    An akismet can go and blow a dead goat

  • Jimmy (unregistered) in reply to PiisAWheeL
    PiisAWheeL:
    Herr Otto Flick:
    KattMan:
    Telepathy doesn't exist, we communicate purely through homeopathy. Yes I can smell my twin half way across the world.

    OK, which one of you has been diluted until the presence of you cannot be detected?

    Yes but things like diet and lifestyle can change ones' smell.

    I think Nagesh misquoted:

    Nagesh:
    KattMan:
    Doesn't live in a city:
    dkf:
    (Wouldn't work for UK post codes, where the list is much longer as the form commonly used identifies at the street/sub-street level. They have to be server-validated. OTOH, postcode and house number sort-of, almost identifies a mail drop exactly, in the ideal case.)

    FTFY

    Most towns outside of London over there are small enough that even without your ideal case, the mail carrier knows who is who and can still deliver mail even if you just have a name and post code, no house number needed.

    My other half has family living near each other just one street apart in a town over there and if someone is out of town and a package shows up, the mail carrir knows to just leave it at another family members house. Works out well there.

    This sound exactly like Village in India.

  • Arthur Dent (unregistered) in reply to Dotan Cohen
    Dotan Cohen:
    I was once lived on a Kibbutz for about two years. I had received mail there from across the Atlantic addressed to: Dotan Cohen Sarid, Israel

    I thought that must be a record for shortest addressLength:kilometersSent in history. No street, house number, ZIP code, and it still got to where it should be after 5000+ KM. I didn't even know the postwoman at the time.

    I once received some mail addressed:

    Human,NowWhat

    This from the famed Sevorbeupstry of the planet Preliumtarn of the sun Zarss of Galactic Sector QQ7 Active J Gamma.

    It turned out to be some ancient fruit cake, which the locals interpreted as some sort of biological threat. When I tried to acquiesce them by actually eating a portion of said cake, quite tasty actually if a bit dry, they recoiled in horror and assumed I was some sort of God. At which point, they would test that theory regularly, but more often irregularly, by sticking me with their most pointed of weapons, which happened to be a soup ladle, the bowl part, as opposed to the handle, which actually would have made a better weapon.

    I thought it was a small price to pay for deity.

  • Mitch (unregistered)

    Zipary doo dah, Zipary aye, My oh, My, what a wonderful day,

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    commentary = commentstr.split("sides laughing");
    

    I see what the real WTF is. It's spelling "ziparray" as "zipary". Outrageous. That should have been caught at code review.

    Operator with two arguments: binary. Operator with one argument: unary. Operator with no arguments: zipary.

    Frankly, I don't see the problem.

  • CZeke (unregistered)

    Hardcoding this is ugly, but it could still be done so much better. First make sure the zipcode entered is a five-digit number, then convert it to int and check against a string like this:

    valid_zips = "0010101110 /* ...snip 99980... */ 1010101100"

    Zeroes for invalid zipcodes, ones for valid. If your int is N, just check valid_zips[N]. This string is one-sixth as long as the submitter's zipstr and doesn't need to be split into an array every damn time. You don't have to type out the 0s and 1s by hand; you've got a list of valid zipcodes, and it would be easy to write a quick one-use program to turn that into valid_zips.

    The US has it easy with strictly numerical postal codes. This wouldn't work here in Canada; we have three letters alternating with three digits, e.g. N2L 6G6. With just numbers, it's almost a crime not to take advantage of it.

    Side note: There are apparently about 43000 zipcodes in use, so it doesn't much matter if you check against a positive or negative list. What I can't figure out is which one the submitter's got. Neither 00001 nor 00013 (the first one left out) is a valid zipcode.

  • (cs) in reply to Arthur Dent
    Arthur Dent:
    I once received some mail addressed:

    Human,NowWhat

    This from the famed Sevorbeupstry of the planet Preliumtarn of the sun Zarss of Galactic Sector QQ7 Active J Gamma.

    It turned out to be some ancient fruit cake, which the locals interpreted as some sort of biological threat. When I tried to acquiesce them by actually eating a portion of said cake, quite tasty actually if a bit dry, they recoiled in horror and assumed I was some sort of God. At which point, they would test that theory regularly, but more often irregularly, by sticking me with their most pointed of weapons, which happened to be a soup ladle, the bowl part, as opposed to the handle, which actually would have made a better weapon.

    I thought it was a small price to pay for deity.

    I don't remember this part from the trilogy, it has been years since I last read it, but I was thinking of the guide even before I noticed who posted it.

    I suppose that human, being mostly solid (from the outside) due to our skeletal system and skin, fear the handle more. Whereas a liquid being would fear the bowl end.

  • (cs)

    I think this will do the trick:

    http://www.geonames.org/export/ajax-postalcode-autocomplete.html

    //Don't care enough to test it out

    Addendum (2012-03-26 22:23): I think this will do the trick:

    http://www.geonames.org/export/ajax-postalcode-autocomplete.html

    //Didn't test it out

  • AUS (unregistered) in reply to dkf
    dkf:
    Wouldn't work for UK post codes, where the list is much longer as the form commonly used identifies at the street/sub-street level. They have to be server-validated. OTOH, postcode and house number identifies a mail drop exactly.

    In AUS, you would use a delivery point code to identify a mail drop exactly. Mail which is pre-sorted and pre-identified with a delivery point code (as a bar code) gets a cheaper mail rate. Mail which is not pre-identified is overprinted with a florescent bar code as it goes through the automatic sorting machine.

    ...And then they give it to the delivery contractor, and he delivers it based on the sorting order and marked street number, completely disregarding the marked country/state/suburb/zip/street, and delivering to an adjacent house if he gets ahead of or behind the sequence.

  • Evoex (unregistered) in reply to Jay
    Jay:
    When I was a kid and we were all going off to college, one of my friends told me that his school had its own zip code, and that room numbers in the dorms were all unique within the campus, i.e. if there was a room "123" in one dorm, there wouldn't be a room "123" in any other dorm. So, he said, a sufficient address to get a letter to him was:
    Chris
    209
    91001
    

    I never got around to trying it.

    In the Netherlands a zip code consists out of four digits and two letters. It uniquely identifies any street in the country. So I don't think any post addressed to "1234AB 12, NL" would have any issues arriving at its destination from anywhere in the world.

  • (cs)

    Some other sad part: There are web sites that ask one for BOTH the zip code AND the state, where the zip code is enough to do the job (You only need to look up the first three digits of the zip code to get the state).

    Even MORE infuriating is a survey web site that asks you for BOTH your ARE and Year of birth. Can't they do simple subtraction?

    ARRGGGH

  • (cs) in reply to da Doctah
    da Doctah:
    Matt Westwood:
    commentary = commentstr.split("sides laughing");
    

    I see what the real WTF is. It's spelling "ziparray" as "zipary". Outrageous. That should have been caught at code review.

    Operator with two arguments: binary. Operator with one argument: unary. Operator with no arguments: zipary.

    Frankly, I don't see the problem.

    I agree, that makes sense. A zero-argument operator is a constant. Which is what the "zipary" in this context is.

    Perhaps constants ought to be called ziparies from now on. The word is shorter and should therefore take less time to write.

  • Ivor Surname (unregistered) in reply to Dotan Cohen

    @Dotan,

    RS components in the UK used to be very proud of having received a letter to 'RS, UK', which I think would be hard to beat.

    A family member received a letter at work in the last few years from the USA to the UK, addressed as

    Fred Bloggs Company, UK

    (Name and company changed to protect the postally innocent, wouldn't want him to be deluged with mail to the real address!)

  • Brendan (unregistered) in reply to herby
    herby:
    Even MORE infuriating is a survey web site that asks you for BOTH your AGE and Year of birth. Can't they do simple subtraction?

    Simple subtraction doesn't work. Someone born on the first of January 2000 would be 12 years old, while someone born on the 31st of December 2000 would be 11 years old.

    You could attempt to fix the "off by one" by doing a day of year comparison, but there's some spectacular edge cases (e.g. involving when the Gregorian calendar was adopted in various locations).

    If you actually do get it right (including all the corner cases) it'd be a huge bloated mess; and it'd still fail to take time travellers into account.

  • Matt (unregistered)

    hmm, I wonder how many hours they logged just for writing that bit of code?

  • L. (unregistered) in reply to KattMan
    KattMan:
    pkmnfrk:
    dkf:
    Validating a ZIP code is one thing, but doing it entirely on the server side? Oh, ow.

    Yeah, he should have done it entirely on the client side, to save the round trip!

    Considering it was hard coded, yes he should have.

    If it was data driven we could argue either way, this is after all, the DAily WTF, where we can argue abotu almost anything.

    No you're fired.

    You may check 100% on client side for latency reasons.

    You MUST check 100% on server side for consistency reasons.

    And either way the coder was a moron, client or server side.

    But what some may not have realized is this is probably from an excel -> export to text separated values -> use tab and the guy never typed it in.

  • L. (unregistered) in reply to Dotan Cohen
    Dotan Cohen:
    PiisAWheeL:
    I give him +1 as well for using the "+" to concat the thousands of strings together instead of the usual / to indicate that we are putting more than 1 line into a string.

    How do you use / to get a multi-line string in JavaScript? The only workarounds that I have ever seen for multi-line strings are rather ugly.

    Captcha: decet. Are you deceting me that there exist multi-line strings in Javascript?

    DAGS,nub

  • L. (unregistered) in reply to Gibbon1
    Gibbon1:
    Captain Enterprise:
    What, no XML?

    The true WTF is not using regular expressions.

    The true WTF is ZIP codes.

    R*Tard system . have they ever heard of GPS coordinates ? much easier for orbital mail, @ home nuclear warhead delivery and all that stuff.

  • ¯\(°_o)/¯ I DUNNO LOL (unregistered) in reply to Anketam
    Anketam:
    Remember that with only Gender, DOB, and Zip code you can uniquely identify 87% of the US population.
    I wouldn't think gender would affect it that much, even if you got into nicknames.

    But at one place I worked, one of my co-workers was named Pat, and was married to another Pat.

    At another job, I worked in a four-story office building where there was someone else in the same building, at a different company, with the same first, middle, and last name of my co-worker. The last name wasn't even a common one.

    My street name is 22 characters (with spaces but without abbreviating), so sometimes I just put my name and zip code as the return address on the envelope.

    A bit of zip code trivia: 55555 is Young America, MN, the home of a major rebate fulfillment center.

  • qbolec (unregistered)

    I see nothing wrong with this code, really. Of course, you could optimize it in some ways if you had some knowlege about particular zip codes scheme used in particular country, but I believe that algorithm should not be tightly coupled with data, current law, 3rd party practices, etc.

    Proposed approach separates algorithm from data. Algorithm would be the same for all countries mentioned in this thread.

    If you agree that:

    1. separation of data and code is a good idea
    2. client side validation is a nice idea
    3. data for this problem (without further assumptions) is roughly Theta(N), where N is the number of zipcodes, which is (exponentially) limited by number of characters in zipcode, which in turn is limited by human ability to memoize pseudorandom strings
    4. transmiting, parsing, etc. must take at least Omega(N) time

    Then you must agree, that optimizing further is pointless.

  • Chris (unregistered)

    TRWTF is that this allows for invalid zip codes. The lowest zip code (numerically) is in the 00500's -- Roosevelt Island NY.

  • pez (unregistered)

    [quote]for (z in zipary) { if (Zip == zipary[z])[/quote]

    Correct me if I'm wrong, but z would be values, not keys, right? It should be just

    [quote][quote]for (z in zipary) { if (Zip == z)[/quote]

  • pez (unregistered)

    And how the hell did my [quote] tags not get parsed?

  • Neil (unregistered) in reply to pez
    pez:
    Correct me if I'm wrong, but z would be values, not keys, right?
    No, for/in iterates over keys; ES6's for/of loop gives you values.
  • Jay (unregistered) in reply to Anketam
    Anketam:
    Jay:
    I had to write a regex for UK postcodes just recently and it was a complicated nightmare. Are you trolling?
    If I was I am failing miserably. I too had to create a regex for UK postcodes, yes it was complicated, but it worked.
    Jay:
    Or do you mean that a regex on zip codes would pass many that meet the format but do not really exist, while all postcodes that pass a relatively-simple regex would be valid? That seems unlikely, but ...
    No point in a regex for US zip codes since a typo will likely still validate a regex (as you pointed out in a later post). However, with UK post codes, because of their nightmarish complexity a typo in it will not likely validate a regex. Combined with the fact that getting a complete postal list for the entire UK is neither easy nor complete so having a list of all postcode it is not likely, so you only are left with validation against a pattern.
    Jay:
    Now you've done it. Some idiot will now insist we use this as the primary key for our customer database.
    If that idiot thinks that 87% uniqueness is good enough for a primary key then yes they would be an idiot.

    This isn't an exciting enough question to have a protracted argument about, but ...

    RE regex for US zips: Surely there's plenty of point in doing a [0-9]{5} regex validation. Yes, if someone types "12345" when they meant to type "12354", then yes, such a regex would do nothing to catch it. But if they accidentally typed "1234" and missed on the last digit, or slipped and typed "1234r", or got off by a field and typed their state abbreviation in the zip code field and the zip code in the phone number, or many other possible mistakes, such a regex would catch it. No validation can catch every possible wrong entry; all you can do is play the percentages. (If you could catch every possible wrong entry, then that must mean that you know the one possible correct entry. In which case, why do you need the user to enter it at all? Except for special cases like passwords and quizes, I suppose.)

    RE invalid UK postal codes won't past a regex: Really? In the end a regex is only going to say that a certain position must be a digit and not a letter and that sort of thing. Is it really true that if, say, I meant to type "RG14 1EA" (a valid postcode, I believe), but I accidentally type "RG14 2EA", that a regex would catch that? How? As RG14 2EA is also a valid postcode.

    RE pk: I once worked on a system where the primary key for the customer table was first initial plus first (some number, I forget) characters of last name plus birth date plus zip code, concatenated together. It was explained to me that the chances that this would not be unique were too small to worry about. I pointed out that twins who were both still living in the city where they were born and who happened to have the same first initial would produce a duplicate. Not to mention there could be purely coincidental duplicates. I was told I was being ridiculous, that it would never happen, shut up and go away. We are surrounded by idiots.

  • Decius (unregistered) in reply to Anketam
    Anketam:
    Ivan Godard:
    "Ivan 04627" would get to me when I lived in Deer Isle.
    USPS has a huge mailing list (which odds are you are in and it will have your full address), combined with the uniqueness of your name, and that there is less than 600* people in that zipcode (and half that if you are only looking at males), probably was not too difficult for them to figure it out.

    *number from 2010

    Remember that with only Gender, DOB, and Zip code you can uniquely identify 87% of the US population.

    Maybe with a zip+4 (9 digit zipcode). Gender+5 digits gives you a maximum of 200,000 possibilities excluding DOB. ~300,000,000 us persons, giving 1,500 people of each gender average in each zipcode; for DOB to uniquely identify 1305 of them, only 195 people of each gender can share a DOB in a zipcode. That seems reasonable, until you look at New York City, with 176 zipcodes and ~8m people; roughly 11,000 people of each gender per zipcode; 32 years worth of birthday paradoxes, and roughly 3% of the US population in once city.

  • (cs) in reply to Black Bart
    Black Bart:
    The USPS sends out quarterly updates. The previous programmer clearly subscribed to that, then ran a DB extract to rebuild the very clever Javascript error checking against the allowable zip codes.

    Of course, a really smart programmer would have created a list of NOT allowed zip codes, as obviously there will be less and less of those after each USPS update.

  • Aran (unregistered)

    That's an interesting definition of "upgrade".

  • Joe (unregistered) in reply to Black Bart

    Seems like a bitmap would have been a far better choice.

  • David (unregistered) in reply to Black Bart
    Black Bart:
    The USPS sends out quarterly updates. The previous programmer clearly subscribed to that, then ran a DB extract to rebuild the very clever Javascript error checking against the allowable zip codes.

    If they were 'very clever', then they would not use a linear search on ordered data. Simply keep the codes as numbers and use a better search algorithm.

  • anon (unregistered) in reply to Anketam
    Anketam:
    Paul:
    KattMan:
    Most towns outside of London over there are small enough that even without your ideal case, the mail carrier knows who is who and can still deliver mail even if you just have a name and post code, no house number needed.

    I remember once time we received a postcard mailed from a friend who was holidaying in Spain. They couldn't recall our address and so it was addressed to "name, town, UK". No house number, street name, or even a postcode. IIRC they didn't even include a full name, just the surname. "Town" at that time was a medium sized town of maybe 30,000 people (and another 80,000 or so in the wide area around it). But a lot of the people who had lived there a generation or more knew each other, from when the town was a good deal smaller.

    "Town, UK" got it from Spain to the local sorting office. Someone there figured out which "name" it was for (probably because they knew or at least recognized the person who sent it, and knew they were a family friend) and put it in the load for that mail route. The postman knew which house on the route belonged to "surname" and delivered it successfully.

    It probably helps that this was back when customer service was still considered worth bothering with and we had a couple of relatives who worked in the post office.

    One time my sister sent me a package throught the USPS and put 7714 rather than 7144. The street was only one block long so there was no 7700 block on the street, but the USPS guy recognized my last name (it is rather unique) or spent the time to figure out what the correct address was by looking at other mail and delivered it. I was very impressed, I would have tipped him if my wallet was readily available.

    I have an even more impressive story regarding the UK post office. Google once needed to send me something from the US in the mail, but for various tin-hat reasons, I don't want the big G to know my address. All they had was the first half of a name (not a personal name even, just my trading name) and the name of the nearest big city (which is in another county), plus a totally ficticious postcode. The post office still managed to deliver it!

  • modifiable lvalue (unregistered) in reply to Black Bart

    I'm surprised the programmer didn't construct a regular expression from Zip to match against zipstr!

Leave a comment on “Zip Code Functionalilty”

Log In or post as a guest

Replying to comment #:

« Return to Article