Comment On Midaslocator.com Zip Codddde Validation

Recently, Marc came upon a dilemma that all car owners can relate to - his next oil change was due soon. [expand full text]
« PrevPage 1 | Page 2Next »

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 09:10 • by snoofle
\a\w\e\s\o\m\e

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 09:10 • by AH (unregistered)
Did I get first?

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 09:12 • by Chronomium (unregistered)
Not bad, it not only recognizes the Canadian A1A 1A1 format, but it doesn't accept illegal letters for the first digit for it.

Now if only whoever coded the American half did any testing whatsoever. (Or even saw the [0-9]s in the Canadian half, which may be techncially narrower than \d, but what keyboard uses digits outside the 0-9 range?)

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 09:17 • by PZ (unregistered)
385967 in reply to 385965
Chronomium:
..., but what keyboard uses digits outside the 0-9 range?)


My keyboard has A to F for when I want to write hex.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 09:21 • by KattMan
Perfect example of why regular expressions are NOT for everything.

Seriously, you really aren't validating a zip code, that would take a lookup into a zip code list or somethign and matching it against the city entered. What you are really doing is simply limiting input, should be an easy task even with regex.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 09:25 • by pantsman (unregistered)
TRWTF is entering 'ddddd' instead of just disabling JavaScript.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 09:27 • by pantsman (unregistered)
The Other Real WTF is this being a Feature Article instead of a CodeSOD.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 09:32 • by Aaron M. Greenberg (unregistered)
That is what you get for using DotNetNuke for your CMS.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 09:35 • by Severity One
Ah, zip codes. Sometimes I long for those days where you could enter an international address on site from an American company, but you still needed to provide a zip code. And a state.

In fact, the hλlf-wits at Valve insist to this very day that I fill in a state, which I dutifully fill in as 'n/a'. Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 09:57 • by Brent (unregistered)
385974 in reply to 385967
PZ:
Chronomium:
..., but what keyboard uses digits outside the 0-9 range?)


My keyboard has A to F for when I want to write hex.


Those would be xdigits, not digits.


Also note that the regex allows for the Canadian postal code of |0|-0|0.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 10:00 • by Cbuttius (unregistered)
But my zip code is 908765

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 10:00 • by A (unregistered)
385976 in reply to 385972
So... you're from the Nation of Brunei, the Abode of Peace?

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 10:14 • by Chronomium (unregistered)
385978 in reply to 385974
Brent:
Also note that the regex allows for the Canadian postal code of |0|-0|0.
Right you are, so it looks like both coders were a bit out to lunch here (presumably two people did this, or we wouldn't have the \d attempt in one half and [0-9] in the other half).

Actually, I keep seeing more errors in the Canadian half the more I look at it. It correctly blocks D, F, I, O, Q, and U out of the first letter (because those letters look too much like other letters), but doesn't do so for the other two letter positions. Yet the first letter can still be "d" - wait, why is lowercase allowed at all?

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 10:18 • by PiisAWheeL
385979 in reply to 385978
Chronomium:
Brent:
Also note that the regex allows for the Canadian postal code of |0|-0|0.
Right you are, so it looks like both coders were a bit out to lunch here (presumably two people did this, or we wouldn't have the \d attempt in one half and [0-9] in the other half).

Actually, I keep seeing more errors in the Canadian half the more I look at it. It correctly blocks D, F, I, O, Q, and U out of the first letter (because those letters look too much like other letters), but doesn't do so for the other two letter positions. Yet the first letter can still be "d" - wait, why is lowercase allowed at all?
I gave up. I'm not that good at regex but this made my eyes bleed.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 10:24 • by FrostCat
385982 in reply to 385974
Brent:
PZ:
Chronomium:
..., but what keyboard uses digits outside the 0-9 range?)


My keyboard has A to F for when I want to write hex.


Those would be xdigits, not digits.


http://en.wikipedia.org/wiki/Thai_numerals (as a representative sample)

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 10:27 • by Dave (unregistered)
385984 in reply to 385976
A:
So... you're from the Nation of Brunei, the Abode of Peace?


I thought that too. Brunei does of course have districts, he could use that instead.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 10:45 • by foo (unregistered)
385985 in reply to 385968
KattMan:
Perfect example of why regular expressions are NOT for everyone.
FTFY
Seriously, you really aren't validating a zip code, that would take a lookup into a zip code list or somethign and matching it against the city entered. What you are really doing is simply limiting input, should be an easy task even with regex.
Which is what you can reasonably do client-side if you want a quick response (no additional server connection). Sure, it's possible without regex, but the corresponding code (esp. for the Canadian case) would fill a page and thus wouldn't be easier to understand (to someone who has bothered to learn regex syntax).

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:00 • by Brad (unregistered)
Pet peeve of mine; over-validation. Who friggin cares what they enter for zip? If you intend to send out spam mail later; clean addresses then.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:01 • by dogmatic (unregistered)
TRWTF is not changing your own oil! They use crap oil sometimes recycled at quickie oil change places. Plus it's good for us nerds to get our hands dirty once in a while.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:05 • by dignissim (unregistered)
385988 in reply to 385976
A:
So... you're from the Nation of Brunei, the Abode of Peace?

My bet would be more on Malta.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:07 • by Techpaul (unregistered)
385989 in reply to 385972
Severity One:
Ah, zip codes. Sometimes I long for those days where you could enter an international address on site from an American company, but you still needed to provide a zip code. And a state.

In fact, the hλlf-wits at Valve insist to this very day that I fill in a state, which I dutifully fill in as 'n/a'. Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.


Post code so accurate they even go down to each dog kennel.

Possibly with extension for each flea as well

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:09 • by Nagesh
In my country, if you want oil change, you go to place you have make purchase of car. Once YOU GIVE them your car, all thing are fixed if you want or not.

No zip code bull crap.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:13 • by Chelloveck (unregistered)
385991 in reply to 385986
Brad:
Pet peeve of mine; over-validation. Who friggin cares what they enter for zip? If you intend to send out spam mail later; clean addresses then.


The ones which really grind me are digit-only phone number and credit card fields. Really, can't the programmer figure out how how strip non-digits out of a text string so I can enter '(123)456-7890' or '1234 5678 9012 3456'?

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:20 • by Ross Presser (unregistered)
385993 in reply to 385989
Who needs IPv6? Let's just give every device a post code!

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:21 • by PiisAWheeL
385994 in reply to 385990
Nagesh:
In my country, if you want oil change, you go to place you have make purchase of car. Once YOU GIVE them your car, all thing are fixed if you want or not.

No zip code bull crap.
I know you ride a camel to work. You don't gotta lie to kick it.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:21 • by foo (unregistered)
385995 in reply to 385989
Techpaul:
Severity One:
Ah, zip codes. Sometimes I long for those days where you could enter an international address on site from an American company, but you still needed to provide a zip code. And a state.

In fact, the hλlf-wits at Valve insist to this very day that I fill in a state, which I dutifully fill in as 'n/a'. Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.


Post code so accurate they even go down to each dog kennel.

Possibly with extension for each flea as well
AKA PostCodev6

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:30 • by Chelloveck (unregistered)
385997 in reply to 385995
foo:
Techpaul:

Post code so accurate they even go down to each dog kennel.

Possibly with extension for each flea as well
AKA PostCodev6


I was really impressed to learn that the postal barcode you see on letters (in the USA, anyway) contains a planet code. "Wow, that's some really progressive future-proofing!" I thought. Imagine my disappointment when I learned that it was something quite more mundane than sending postcards to Mars.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:31 • by Some Jerk (unregistered)
WTF 1: the developer didn't test it.
WTF 2: QA didn't test it.
WTF 3: IT IS STILL THERE!

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:35 • by genitus (unregistered)
386000 in reply to 385964
AH:
Did I get first?

No. And you're an arse for trying.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:43 • by OldCoder (unregistered)
386001 in reply to 385988
dignissim:
A:
So... you're from the Nation of Brunei, the Abode of Peace?

My bet would be more on Malta.

Almost certainly Iceland.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:46 • by Kevin (unregistered)
386002 in reply to 385971
It's also what you get for hiring DotNetNuke developers to do your website. *sigh*

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 11:49 • by Some Jerk (unregistered)
386003 in reply to 386002
I still don't even know what DotNetNuke is

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 12:20 • by Cbuttius (unregistered)
I just tried their form. Lol, they got a booking from a Fred Bloggs...

I had to enter a valid phone number. They didn't accept 123 456 7890 or some random digits so I just entered their number.

I tried 12302 as a zip which was their zip and it got rejected. I tried ddddd and it worked.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 12:28 • by themagni
386008 in reply to 385972
Severity One:
Ah, zip codes. Sometimes I long for those days where you could enter an international address on site from an American company, but you still needed to provide a zip code. And a state.

In fact, the hλlf-wits at Valve insist to this very day that I fill in a state, which I dutifully fill in as 'n/a'. Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.


I enter 00000 as the zip code, and if the state is drop-down, I pick CA. Then I put in the street as per normal with the postal code at the end:

1234 Fake Street V8V 8V8
Fake City, BC, Canada
CA 00000

If they give you two lines for the address:
1234 Fake Street (address one)
Fake City, BC (address two)
V8V 8V8 (city)
CA 00000

Of course, it's dumb to do this because the shippers will ream you at the border. I bought a $49 housing for my camera and paid a total of $33 in shipping after FedEx was done with it.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 12:29 • by Nagesh
386009 in reply to 385994
PiisAWheeL:
Nagesh:
In my country, if you want oil change, you go to place you have make purchase of car. Once YOU GIVE them your car, all thing are fixed if you want or not.

No zip code bull crap.
I know you ride a camel to work. You don't gotta lie to kick it.


I bow to your supreme knowledge of geography, Jahanpanah! Tussi great ho! Camels are part of Rajasthan not Andhra Pradesh, you buffoon!

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 12:30 • by Nagesh
386010 in reply to 386001
OldCoder:
dignissim:
A:
So... you're from the Nation of Brunei, the Abode of Peace?

My bet would be more on Malta.

Almost certainly Iceland.

Definitely not India, then.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 12:40 • by Anon (unregistered)
386013 in reply to 385987
dogmatic:
TRWTF is not changing your own oil! They use crap oil sometimes recycled at quickie oil change places. Plus it's good for us nerds to get our hands dirty once in a while.


TRWTF is assholes who think changing their own oil somehow makes them superior.

My time is worth more than the cost of having somebody else do it.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 12:41 • by Cbuttius
just enter a real address, just not yours but theirs.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 12:57 • by herby
386016 in reply to 385993
Ross Presser:
Who needs IPv6? Let's just give every device a post code!

Wrong! Who needs post code? Give every house an IPv6 address.

FTFY

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 13:13 • by null (unregistered)
386017 in reply to 385997
Chelloveck:
foo:
Techpaul:

Post code so accurate they even go down to each dog kennel.

Possibly with extension for each flea as well
AKA PostCodev6


I was really impressed to learn that the postal barcode you see on letters (in the USA, anyway) contains a planet code. "Wow, that's some really progressive future-proofing!" I thought. Imagine my disappointment when I learned that it was something quite more mundane than sending postcards to Mars.


the 'planet' you are referring to is actually an acronym PLANET that stands for: 'Postal Alpha Numeric Encoding Technique' and encodes digits 0-9 much as the now deprecated POSTNET (i.e. also an acronym and not a planet, or a galaxy, or a black hole) did.

CAPTCHA: EARTH is a Planet; PLANET is an acronym

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 13:26 • by jnewton
386018 in reply to 386013
When you consider the time it takes to drive to the Qwiklube and wait for them to get around to changing it, it is probably faster to change your own oil than to have someone else do it. That is assuming you know what you are doing, of course.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 13:46 • by AN AMAZING CODER (unregistered)
386022 in reply to 386018
jnewton:
When you consider the time it takes to drive to the Qwiklube and wait for them to get around to changing it, it is probably faster to change your own oil than to have someone else do it. That is assuming you know what you are doing, of course.


I work on my own cars: swapping engines, adding performance parts, etc.

But I DO NOT change the oil in my daily drivers. (I change it on my car with big mods because I don't trust them enough.)

It's not worth the time and effort. I'll make an appointment, drop it off, work on a project or read a book while they're dealing with it, and then drive back to what I was doing.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 13:52 • by Zecc when not signed on (unregistered)
386023 in reply to 385969
pantsman:
TRWTF is entering 'ddddd' instead of just disabling JavaScript.
Or fixing the code with Firebug, for bonus points.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 14:32 • by Neveralull (unregistered)
The real WTF is taking a car to Midas.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 14:51 • by Anonymous. (unregistered)
Two observations.

1. I don't know if this got fixed since the story went live or the code varies for different browsers, Midas locations, etc, but I've checked appointment booking pages for two locations next to me and they both contained regexp's starting with "(^[0-9]{5}(-[0-9]{4})", not "(^d{5}(-d{4})".

2. I'm not familiar with modern web development tools, but that code did not look to me like it was written by a person. Maybe the regexp was somehow autogenerated too? What would the original human programmer input look like? Any experts here?

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 15:17 • by Jay (unregistered)
386027 in reply to 385972
Severity One:
Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.


What?! So if two people live in the same house, you have to share a postal code?

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 15:27 • by a cursive recronym (unregistered)
386028 in reply to 385972
Severity One:
Please note that the country I live in has just over 420,000 inhabitants, and has no need for states. But on the other hand, our postal codes are so accurate that I suspect that each house has its own postal code.


Go back to your side of the Atlantic, Lëtzebuergian, and take your funny ümlauts with you! ;-)

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 15:39 • by Scrummy
386029 in reply to 385986
Brad:
Pet peeve of mine; over-validation. Who friggin cares what they enter for zip? If you intend to send out spam mail later; clean addresses then.


I agree. This is what's so great about Agile. A minor feature such as zip code validation would probably never even make the product backlog, and if it did, it would receive the proper attention to have it done right.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 15:49 • by OccupyWallStreet (unregistered)
386030 in reply to 386008
themagni:
Of course, it's dumb to do this because the shippers will ream you at the border. I bought a $49 housing for my camera and paid a total of $33 in shipping after FedEx was done with it.


FedEx's reaming is at least $25+tax. UPS' is much worse. That $49 item you bought would've been $50 from UPS, minimum (I've seen it higher).

The best shipment is via DHL (if supported) or USPS - $5+tax, and sometimes Canada Post doesn't even bother charging you!

Unless you really need it, if they only offer UPS, go to a competitor. UPS is popular because they make up for their low-cost service by gouging the recipient with various fees and taxes.

FedEx's is $25 flat, UPS is anywhere from 30-200% from experience (yes, 200%...).

pantsman:
TRWTF is entering 'ddddd' instead of just disabling JavaScript.


That doesn't work if the form requires javascript to submit it. Some onSubmit handlers work that way, annoyingly. Other forms require it or other form things break, horrendously.

It's one of the nicer things with Chrome - you can easily manipulate the stuff live and make changes. I'm sure firefox can do it, but I haven't figured out how.

Re: Midaslocator.com Zip Codddde Validation

2012-07-31 16:04 • by PiisAWheeL
386031 in reply to 386009
Nagesh:
PiisAWheeL:
Nagesh:
In my country, if you want oil change, you go to place you have make purchase of car. Once YOU GIVE them your car, all thing are fixed if you want or not.

No zip code bull crap.
I know you ride a camel to work. You don't gotta lie to kick it.


I bow to your supreme knowledge of geography, Jahanpanah! Tussi great ho! Camels are part of Rajasthan not Andhra Pradesh, you buffoon!
Hey hey hey! My ignorance began the moment I hit the border. Its all India. Camels are used. And you are Nagesh... The shining example of Indian stereotypes. Why are you in such a bad mood? Camel break down?

On a side note, does that mean I have successfully Trolled Nagesh?
« PrevPage 1 | Page 2Next »

Add Comment