- 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
Nice one.
Admin
OK, this actually makes some sense, at least from the address data vendor point of view.
Where I live, houses on one side of a street are often numbered even, while those on the opposite side have only odd numbers.
But some streets are so short (or whatever other reasons there might be) they don't bother doing this, so they are just numbered sequentially.
Actually, the zipcodes (called 'postcode', where I live) are often different for the odd and even sides of the same street. Except, again, for very small streets.
W.r.t. whether this makes sense, I was not referring to the source code you posted though ;)
Admin
Haven't they used the Mod function incorrectly as well?
2 Mod CType(StreetNumberValue, Integer) = 0 will check to see if 2 divides by the street number when surely they want it the other way round.
Admin
I guess we have to go to both partitions to access the data then ?
Admin
To clarify, my post was to explain the seemingly weird data model used by the address data vendor. It may actually make some sense when they sort the table by zipcode (which is likely).
Each zipcode is for 'odd, even, or both' sides of a street.
Admin
You're definitely right. Also, the semantics of the sy;bols used is wrong ... EVEN and ODD are good. But to be logical, BOTH should have been something more like NONE or UNUSED ...
Admin
It seems simple from the example code, if the "Number" isn't numeric, it's Both Odd and Even. If you live at "J" Generic Street, is your address Even or Odd? It would probably be better to use None, though.
Admin
Admin
Please provide a description of the physical location of the submitter.
Admin
The US Postal Service is the primary source of this silliness. All of their street data products use the OEB coding to assign ZIP9's within a ZIP5.
Admin
Building 2 North University Drive Somewhere, AB
= BOTH.
sorta - i agree should be NONE or NON-NUMERIC or something other than BOTH.
Looks like lots of unrunnable code also.
Admin
Hate to say it, but the end result of the code actually makes sense.
1551 N. Anywhere St = odd 1552 N. Anywhere St = even Building A S. Nowhere Ave = both
"Neither" would be a better word for it, but having it be 3-state is actually necessary.
The purpose of such division is for postal presorting. If you want to run what's called a "walk sequence presort", which gets you the best possible postal rate, you need to have those three states.
It is, as mentioned by a prior post, used to determine which side of the street the address is on. Odd being on one side and even on the other is very much a standard arrangement. Having the mail sorted that way helps the post office deliver it with greater efficiency. Thus, a huge postage discount if you sort it that way before you ever give it to them for delivery.
On the other hand, the Mod operation is backwards. It's dividing 2 by the street number, not the other way around. That may be an error in the submission, since it would result in huge data errors which would be immediately noticeable in any actual production environment. (If, as I suggest, this code is being used for presorting, the very first mailing done with that would be rejected by the post office with instructions on how to fix it.)
If the actual code doesn't have that error, then there's nothing at all wrong with that part of it. At least, not that I see.
Admin
so if it's not numeric, then it's both even and odd? So the string "test" is even and odd. I wonder what the mathematical proof of that looks like!
Admin
Depends on the point of view. If you're asking, "Is this address odd, even, or xxx," xxx should probably be "neither." But if your question is, "What addresses does this postal code cover, odd ones, even ones, or xxx," xxx makes more sense as "both" that as "neither" (since it does cover odd and even addresses). Without knowing the context, we can't say that this doesn't make sense.
Admin
And what about those silly vanity addresses? #1 My Company Thinks a Whole Lot of Itself Avenue, which of course could be on either side of a long street? I guess that would fall under the "FILE_NOT_FOUND" category.
Admin
I once lived in a duplex. Each side had its own address: 8L and 8R I guess this ends up in "both" because it is non-numeric
Admin
I live on a block that has a few fractional addresses (really!).
How would their algorithm handle: "38 1/2 xyz street" ?
Admin
I would (optimistically) assume that the 1/2 is in a different field, and the algorithm in question is only operating on the 38 portion of it.
The "Both" makes sense given the context, I don't see what's so weird about it -- there are "court" streets all over suburbia that are a circle and don't have 2 distinct sides for odd/even. If you're trying to figure out what side of the road the house is on, being told "odd" or "even" when there's only one side of the road is a bigger WTF.
CAPTCHA: alarm, the system call which is involved in a bug (err, sorry, "outdated feature") I'm trying to fix this morning.
Admin
Which, in practice, means that number 1 and 2 are Even but all other numbers are Odd. 2 Mod 1 = 0, 2 Mod 2 = 0, 2 Mod 3 = 2, 2 Mod 4 = 2, 2 Mod 5 = 2, etc.
Odd definition. :P
CAPTCHA: dreadlocks. Like deadlocks, but worse.
Admin
I'd like to see the buildings that are on both sides of the street. Does the street run right through the middle of the building? ;)
Admin
I will quote:
"Our house, in the middle of the street."
Admin
I've seen buildings that are on both sides of the street, the center of the building is a bridge over the street. I'm not sure if is considered 2 buildings for addressing sake or not.
Admin
The John Lewis department store in Kingston upon Thames in England straddles a major road.
Admin
Admin
This reminds me of a related real world WTF. A friend of mine has some warehouse space. The (major) road it is located on, like pretty much any road in the USA, has all the even numbers on one side and the odd numbers on the other side. Except this one warehouse building, which has an odd number on the even side of the street.
Apparently this confuses the shit out of Fedex, UPS, and just about any other person trying to deliver anything.
Admin
Or maybe you could be living at 7 Möbius Strip?
Admin
Obviously this program was designed to handle situations just like this.
Admin
wasn't there a sidebar post recently that showed how people like to name streets
Admin
Reminds me of the French class I took. In French, you modify the verb being used depending on whether the subject is "male", "female" or "plural". Some things are obviously male or female, while others are not (is a book male or female?)
My instructor told us that trying to "reason out" the gender of an object is useless. Just memorize which bucket a thing goes into; one bucket is "male" and the other is "female".
In this example, you're really classifying addresses into three buckets; we call one "even", one "odd" and one "both". They could have been called "North/West; South/East" and "Other", or any other set of names.
We may not understand the business rules for determining which bucket an address goes into; and clearly the code implimenting the business rules is broken (2 mod x); and perhaps the names of the buckets are poorly chosen. But the end result is an address goes into one of the three buckets, in accordance with the business rules.
Admin
Also, the old Post Office in downtown Chicago.
http://maps.google.com/?ie=UTF8&t=k&om=1&ll=41.875585,-87.638251&spn=0.005832,0.010042&z=17
Admin
Odd comment.
Admin
Actually, it is an Even comment. (#141320)
Admin
Especially since "reasoning out" the gender is often wrong. In French, the word for "handbag" is masculine and the word for "mustache" is feminine, for instance.
Admin
if (isNumeric(address) && (address % 2 == 0)) { sideType = "E"; // Even } else { sideType = "O"; //Odd }
See? Simple. Even making the "walk sequence" requires no extra logic, because all "Odd" would have the same sequence as all "Both". Even if you came to realize that "Building A" is in the middle of the "Even" side of a street that otherwise contains numbered addresses, you can just manually change the sideType entry in the database for that one case, and all the logic still works out the same.
Admin
Not quite. "Odd" and "even" would not be as good names for the French genders as "masculine" and "feminine" (note the distinction: "masculine" and "feminine" are grammatical genders; "male" and "female" are biological sexes). The reason: men's names are masculine and women's are feminine.
Admin
I cast my vote for best reply of the day.
Admin
Admin
Actually, some words are both masculine and feminine, such as "amour" (love). So, yeah, there is also a Both bucket for french words.
Admin
What if we just use the mean of the char code? That way we can make it even more useless and still use numeric values...
Really it seems like a case of invalid logic to me.
120 FooBAR St Apt. 107B Impossible, CPU 55555-5555
^------- both?
The way the code looks and what was said about how "usually" odds are on one side and evens on different sides makes sense though. So you would pretty much always want to check a numeric value not the entire address.
Admin
Admin
I saw a möbius stripper once. I thought she was a bit two dimensional.
Admin
how do you spell culdasac?
Admin
A mobius strip, here's how to make one.
Now guess how many sides this strip of paper has. It actually only has one side. To prove it, take a pen and without lifting it draw along the middle of the side until you reach your stating point, then find the side without a line. Interestingly, there is also only one edge. It is a two-dimensional figure in three dimensional space. Now theoretically joining two of them together along their edges will also produce a Kline bottle. Go ahead and Google that one.
Admin
Admin
End of discussion!
Admin
Admin
and vagina is male and penis female
Those frogs
Admin
As for "manually changing the one entry", what do you do if you're mailing 6-million pieces and 300-thousand of them have alpha data in their street address number? Do you pay for a huge number of man-hours of looking up each of those manually? Remember, a lot of online mapping programs use the odd-even rule and figure out where an address is based on that, rather than having actual geographic data in them (my father's house is 3 miles away from where Google maps says it is, because of a numbering convention deviation on that street). So, to "manually correct" those 300-thousand addresses, you would have to pay people to actually go and verify their locations.
Or, you could differentiate them as "both" and pay a slightly higher postal rate on those 300-thousand than what you pay on the rest of the mailing, and let the postal carrier figure those ones out on his/her own. Most likely, if they've worked the route for more than a week, they already know where they want it in their boxes. Postal presorting allows for some of the mailing to be at one rate and the rest at another (or more complex breakdowns).
So, which would you rather do: Pay thousands of man-hours and delay the mailing by up to several months, while you gather data and manually update your database 1 row at a time, or set a flag to "both" and pay an additional 3 cents * 300-thousand pieces ($9000.00)?
Of course, if you merge your "both" and "odd" flags, you'd end up paying a lot more, because every "odd" address would get bumped up to the "both" rate.
Admin
I guess they are named as to who wants more of each.
Admin