• (cs)

    Frost.. err, first.. umm Frist! but does this mean we need a pass code for zippers?

  • Nagesh (unregistered) in reply to KattMan
    KattMan:
    Frost.. err, first.. umm Frist! but does this mean we need a pass code for zippers?

    Wlhat is zippers or ZIP code? Always have been wordering this when coding for clients.

    [image]
  • (cs)

    Validating a ZIP code is one thing, but doing it entirely on the server side? Oh, ow.

    (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.)

    Addendum (2012-03-26 10:19): D'oh! I meant “client side” there. Too much thinking about OpenID and Shibboleth is melting my brain…

  • Black Bart (unregistered)

    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.

  • taemun (unregistered)
    but I this code
    Catch phrase for the day.
  • Doesn't live in a city (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 sort-of, almost identifies a mail drop exactly, in the ideal case.)

    FTFY

  • (cs) in reply to dkf
    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!

  • (cs) in reply to Doesn't live in a city
    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.

  • (cs) in reply to pkmnfrk
    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.

  • Herr Otto Flick (unregistered) in reply to KattMan
    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.

    Herr Otto says, if you live deep enough in the shires, your postie will most likely leave parcels for you outside the door, even if you aren't there to sign for it, as Herr Otto found out on Friday, when he came home from work to find his newly-ordered-to-be-delivered-on-Saturday-for-ten-pound-extra £300 graphics card sitting in a puddle.

  • (cs)

    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.

  • (cs) in reply to KattMan
    KattMan:
    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.
    Does that postman have a black-and-white cat, by any chance?
  • (cs) 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.

    The joke is that it's clearly client-side Javascript and that the server has nothing to do with it

  • (cs) in reply to pkmnfrk
    pkmnfrk:
    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.

    The joke is that it's clearly client-side Javascript and that the server has nothing to do with it

    Someone went to the trouble to make it so that you can run javascript serverside (node.js). I don't know why you would want to subject yourself to this kind of pain but its always possible this was done serverside. Except of course for the call to document.getElementById("Zip").value and the display change... but just cause its javascript doesn't lock it to the client.

    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.

  • (cs)

    Seen worse. Somebody told him/her to do it, so it was done. Updates become job security and, hopefully, will be script-performed.

    Instead of using split, he/she could have added a space before and after all the codes and done an "indexOf" on space+zip+space.

    As for sending this all down to be done client-side, that doesn't seem too wise a use of bandwidth, although if it's in a .js file it will be cached.

  • (cs) in reply to Severity One
    Severity One:
    KattMan:
    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.
    Does that postman have a black-and-white cat, by any chance?
    Yes, and his name is Pat, though we all call him Paddy.
  • (cs)

    Well duh... we're always carping about the importance of using a whitelist to accept known good entries instead of a blacklist to ban known bad entries. That's obviously what's been done here!

  • Paul (unregistered) in reply to KattMan
    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.

  • hardy (unregistered) in reply to dkf
    dkf:
    Validating a ZIP code is one thing, but doing it entirely on the server side? Oh, ow. Addendum (2012-03-26 10:19): D'oh! I meant “client side” there. Too much thinking about OpenID and Shibboleth is melting my brain…

    TRWTF was you found fault in which side the validation was but not how the validation was performed?

  • Zunesize Me! (unregistered) in reply to KattMan
    KattMan:
    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.
    You have a conjoined twin that you're not related to?

    Do you ever get curious about what your twin might be interested in or can you hear his/her thought telepathically?

  • (cs) in reply to Zunesize Me!
    Zunesize Me!:
    KattMan:
    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.
    You have a conjoined twin that you're not related to?

    Do you ever get curious about what your twin might be interested in or can you hear his/her thought telepathically?

    Telepathy doesn't exist, we communicate purely through homeopathy. Yes I can smell my twin half way across the world.

  • Herr Otto Flick (unregistered) in reply to KattMan
    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?

  • (cs) in reply to Herr Otto Flick
    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.

  • (cs) in reply to KattMan
    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.

  • lesle (unregistered)

    My ZIP Code is for a "Contract Station" at a University. Until not too long ago, this ZIP Code was NOT included in the USPS data base. Before it was included, I never got junk mail; now that it is, I do.

  • corroded (unregistered) in reply to Black Bart

    I suppose very clever is a matter for debate.

  • Robbie McAndrew (unregistered)
    OK, which one of you has been diluted until the presence of you cannot be detected?

    Clearly the other person. If you could not detect KattMan you wouldn't be talking to him

  • mag (unregistered)
         if (Zip == "") {
              hideAllErrors();
              document.getElementById("ZipError").style.display = "inline";
              document.getElementById("Zip").select();
    

    The real wtf. If only we lived in a perfect world.

  • steve (unregistered) in reply to UpNDown

    theres already a space between each, and they're all 5 numbers. so an zipstr.indexOf(Zip) is succificent

  • Dotan Cohen (unregistered) in reply to PiisAWheeL
    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?

  • (cs) 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.

    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.

  • Dotan Cohen (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.

    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.

  • (cs) 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?

    Ok lazy. I will educate you. https://www.google.com/search?q=multi+line+strings+in+javascript

    And perhaps its a \ not a /. I don't usually use multilines in javascript.

  • Sea Sharp, Waves Hurt (unregistered) in reply to taemun
    but I this code

    But I, this code, this place, these people -- our shared experience buoys us in times of strife and shite code.

  • Dotan Cohen (unregistered) in reply to PiisAWheeL
    PiisAWheeL:
    Ok lazy. I will educate you. https://www.google.com/search?q=multi+line+strings+in+javascript

    And perhaps its a \ not a /. I don't usually use multilines in javascript.

    I'm still not educated. In fact, you will notice my name in the top google hit for that query. There are no multi-line strings in JavaScript. The backslash concatenates two lines of programming code into a single-line string.

  • (cs) 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 we can't.

  • (cs) in reply to Dotan Cohen
    Dotan Cohen:
    PiisAWheeL:
    Ok lazy. I will educate you. https://www.google.com/search?q=multi+line+strings+in+javascript

    And perhaps its a \ not a /. I don't usually use multilines in javascript.

    I'm still not educated. In fact, you will notice my name in the top google hit for that query. There are no multi-line strings in JavaScript. The backslash concatenates two lines of programming code into a single-line string.

    Same Difference. It applies to the wtf at hand.

  • (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.
    Oh shut up, evidence from this very site proves that it... Oh I see what you did there.

  • Captain Enterprise (unregistered)

    What, no XML?

  • F (unregistered) in reply to steve
    steve:
    theres already a space between each, and they're all 5 numbers. so an zipstr.indexOf(Zip) is succificent

    No. There has been no check that the code supplied is actually five characters, or that it contains no spaces. Your version would accept "1" or "1 000" as valid.

  • wonk (unregistered) 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.
    Look. KattMan came here looking for an argument. An argument is not just the automatic gainsaying of whatever he says.

  • Joshua (unregistered)

    As someone who has been in a new zip code for almost 5 years, I still run into a lot of sites that still don't work with my zip code.

  • (cs) in reply to Captain Enterprise
    Captain Enterprise:
    What, no XML?
    You should not joke about that. I once had an xml file that went something like this: <ValidCityStateZip City="Princeton" State="NJ">08540</ValidCityStateZip>

    Fortunately it only needed to contain common combinations (and alternate spellings), and was a one time static thing (so did not need to be kept up to date).

  • (cs) in reply to Anketam
    Anketam:
    Captain Enterprise:
    What, no XML?
    You should not joke about that. I once had an xml file that went something like this: <ValidCityStateZip City="Princeton" State="NJ">08540</ValidCityStateZip>

    Fortunately it only needed to contain common combinations (and alternate spellings), and was a one time static thing (so did not need to be kept up to date).

    I'm so glad that wasn't one of those crappy laughing matter jokes.
  • geoffrey, MCP, PMP (unregistered)

    Zip codes are very infrequently added, as they are point-based delivery mechanisms. So I believe it should be OK to maintain a static list of available zip codes.

  • Jultomten (unregistered) in reply to Dotan Cohen

    Nah - no record. That goes to the letters to Santa :)

  • (cs) in reply to geoffrey, MCP, PMP
    geoffrey:
    Zip codes are very infrequently added, as they are point-based delivery mechanisms. So I believe it should be OK to maintain a static list of available zip codes.

    Unless you are in India, in that case, you do not wish to maintain them at all. Post office maintaining them for you.

  • Ken B. (unregistered) in reply to steve
    steve:
    theres already a space between each, and they're all 5 numbers. so an zipstr.indexOf(Zip) is succificent
    "99 12"
  • Born Texas Proud (unregistered) in reply to Jultomten
    Jultomten:
    Nah - no record. That goes to the letters to Santa :)
    That Mexican may have won the battle of the Alamo, but he lost the war.
  • (cs) in reply to Paul
    Paul:
    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".
    This contrasts nicely with the Netherlands, where your mail will typically go to your neighbor's house if the sender mistakenly thinks you live at, say, no. 6 when in fact you live at no. 8, but otherwise got your name and address right …

Leave a comment on “Zip Code Functionalilty”

Log In or post as a guest

Replying to comment #:

« Return to Article