Comment On Odd or Even... or Both?

Part of the fun in Waldo W.'s job is working with third-party data providers and figuring out how to integrate the data into his company's applications. One of Waldo's favorite data providers is a Certain Address Data Service. [expand full text]
« PrevPage 1 | Page 2Next »

Re: Odd or Even... or Both?

2007-06-15 09:30 • by blunden (unregistered)
Nice one.

Re: Odd or Even... or Both?

2007-06-15 09:35 • by NiceWTF (unregistered)
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 ;)

Re: Odd or Even... or Both?

2007-06-15 09:37 • by JC (unregistered)
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.

Re: Odd or Even... or Both?

2007-06-15 09:37 • by pitchingchris
I guess we have to go to both partitions to access the data then ?

Re: Odd or Even... or Both?

2007-06-15 09:37 • by NiceWTF (unregistered)
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.

Re: Odd or Even... or Both?

2007-06-15 09:44 • by Tidus (unregistered)
141326 in reply to 141322
JC:
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.


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

Re: Odd or Even... or Both?

2007-06-15 09:45 • by SuperousOxide
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.

Re: Odd or Even... or Both?

2007-06-15 09:48 • by sol (unregistered)
Sub foo(ByVal db As IUnknown, ByVal streetNumber As Double)
Dim inserted As Boolean = False
If Math.IEEERemainder(streetNumber, 2) = 0 Then
db.Insert("even")
inserted = True
Else
db.Insert("odd")
inserted = True
End If

If Not inserted = True Then 'code will never run
db.Insert("both")
inserted = True
End If
End Sub

Re: Odd or Even... or Both?

2007-06-15 09:51 • by Someone You Know
Please provide a description of the physical location of the submitter.

Re: Odd or Even... or Both?

2007-06-15 09:54 • by Fred (unregistered)
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.

Re: Odd or Even... or Both?

2007-06-15 09:56 • by RandyD (unregistered)
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.

Re: Odd or Even... or Both?

2007-06-15 09:56 • by Gsquared
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.

Re: Odd or Even... or Both?

2007-06-15 10:00 • by sir_flexalot
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!

Re: Odd or Even... or Both?

2007-06-15 10:03 • by barfoo
141334 in reply to 141331
sorta - i agree should be NONE or NON-NUMERIC or something other than BOTH.


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.

Re: Odd or Even... or Both?

2007-06-15 10:04 • by Duston (unregistered)
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.

Re: Odd or Even... or Both?

2007-06-15 10:17 • by nobody (unregistered)
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

Re: Odd or Even... or Both?

2007-06-15 10:17 • by different (unregistered)
141337 in reply to 141335
I live on a block that has a few fractional addresses (really!).

How would their algorithm handle: "38 1/2 xyz street" ?

Re: Odd or Even... or Both?

2007-06-15 10:30 • by Therac-25 (unregistered)
141339 in reply to 141337

How would their algorithm handle: "38 1/2 xyz street" ?


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.

Re: Odd or Even... or Both?

2007-06-15 10:39 • by Mike Dimmick (unregistered)
141341 in reply to 141322
JC:
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.


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.

Re: Odd or Even... or Both?

2007-06-15 11:18 • by Steve Boyko (unregistered)
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? ;)

Re: Odd or Even... or Both?

2007-06-15 11:37 • by KattMan
141344 in reply to 141343
Steve Boyko:
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? ;)


I will quote:

"Our house, in the middle of the street."

Re: Odd or Even... or Both?

2007-06-15 11:41 • by SuperousOxide
141345 in reply to 141343
Steve Boyko:
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? ;)


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.

Re: Odd or Even... or Both?

2007-06-15 11:44 • by Roy (unregistered)
141346 in reply to 141343
> 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? ;)

The John Lewis department store in Kingston upon Thames in England straddles a major road.

Re: Odd or Even... or Both?

2007-06-15 11:46 • by BitTwiddler (unregistered)
141347 in reply to 141343
Steve Boyko:
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? ;)

I've seen a driveway that goes right thru the middle of the house! Really - it's a two-story house with a large top floor and two smaller first-floors, one on either side of the driveway (I have no idea how the inside is layed out)

Re: Odd or Even... or Both?

2007-06-15 11:53 • by Cheetah (unregistered)
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.

Re: Odd or Even... or Both?

2007-06-15 11:53 • by Jim (unregistered)
141349 in reply to 141343
Steve Boyko:
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? ;)


Or maybe you could be living at 7 Möbius Strip?

Re: Odd or Even... or Both?

2007-06-15 12:04 • by JC (unregistered)
141350 in reply to 141346
Roy:
> 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? ;)

The John Lewis department store in Kingston upon Thames in England straddles a major road.

Indeed.
http://maps.google.co.uk/maps?ie=UTF8&oe=UTF-8&hl=en&q=&ll=51.411661,-0.306673&spn=0.002583,0.006491&t=k&z=17&om=1

Obviously this program was designed to handle situations just like this.

Re: Odd or Even... or Both?

2007-06-15 12:06 • by henke37
wasn't there a sidebar post recently that showed how people like to name streets

Re: Odd or Even... or Both?

2007-06-15 12:10 • by Robert Hanson (unregistered)
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.

Re: Odd or Even... or Both?

2007-06-15 12:15 • by Maciej (unregistered)
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

Re: Odd or Even... or Both?

2007-06-15 12:39 • by Dustin_00
141357 in reply to 141320
blunden:
Nice one.


Odd comment.

Re: Odd or Even... or Both?

2007-06-15 12:47 • by SomebodyElse
141358 in reply to 141357
Dustin_00:
blunden:
Nice one.


Odd comment.


Actually, it is an Even comment. (#141320)

Re: Odd or Even... or Both?

2007-06-15 12:52 • by Someone You Know
141359 in reply to 141352
Robert Hanson:
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".


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.

Re: Odd or Even... or Both?

2007-06-15 13:18 • by Michael (unregistered)
141361 in reply to 141332
Gsquared:
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.

Wouldn't it be easier to just say that if a street doesn't allow for the distinction, that all addresses on that street will be arbitrarily label as being on the "odd" side? That way you don't need to complicate what should be simple logic:

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.

Re: Odd or Even... or Both?

2007-06-15 13:18 • by Taejo
141362 in reply to 141352
Robert Hanson:
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".


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.

Re: Odd or Even... or Both?

2007-06-15 13:23 • by Coincoin
141363 in reply to 141349
Jim:
Steve Boyko:
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? ;)


Or maybe you could be living at 7 Möbius Strip?


I cast my vote for best reply of the day.

Re: Odd or Even... or Both?

2007-06-15 13:33 • by RobbieAreBest
141364 in reply to 141363
Coincoin:
Jim:
Steve Boyko:
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? ;)


Or maybe you could be living at 7 Möbius Strip?


I cast my vote for best reply of the day.

i concur

Re: Odd or Even... or Both?

2007-06-15 13:33 • by Coincoin
141365 in reply to 141359
Someone You Know:
Robert Hanson:
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".


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.


Actually, some words are both masculine and feminine, such as "amour" (love). So, yeah, there is also a Both bucket for french words.

Re: Odd or Even... or Both?

2007-06-15 13:33 • by sol (unregistered)
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.

Re: Odd or Even... or Both?

2007-06-15 13:33 • by freelancer
141367 in reply to 141364
RobbieAreBest:
Coincoin:
Jim:
Steve Boyko:
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? ;)


Or maybe you could be living at 7 Möbius Strip?


I cast my vote for best reply of the day.

i concur

I don't get it. Anyone care to explain?

Re: Odd or Even... or Both?

2007-06-15 13:36 • by KattMan
141369 in reply to 141349
Jim:
Steve Boyko:
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? ;)


Or maybe you could be living at 7 Möbius Strip?


I saw a möbius stripper once. I thought she was a bit two dimensional.

Re: Odd or Even... or Both?

2007-06-15 13:37 • by sol (unregistered)
141370 in reply to 141367
freelancer:
RobbieAreBest:
Coincoin:
Jim:
Steve Boyko:
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? ;)


Or maybe you could be living at 7 Möbius Strip?


I cast my vote for best reply of the day.

i concur

I don't get it. Anyone care to explain?


how do you spell culdasac?

Re: Odd or Even... or Both?

2007-06-15 13:39 • by KattMan
141371 in reply to 141367
freelancer:
RobbieAreBest:
Coincoin:
Jim:
Steve Boyko:
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? ;)


Or maybe you could be living at 7 Möbius Strip?


I cast my vote for best reply of the day.

i concur

I don't get it. Anyone care to explain?


A mobius strip, here's how to make one.

1. Cut a strip of paper.
2. Give the paper a half twist.
3. Join the two ends together to form a "ring".

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.

Re: Odd or Even... or Both?

2007-06-15 13:42 • by Kyle Söze (unregistered)
141372 in reply to 141326
Tidus:
JC:
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.


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

Kyle Söze says:
Kyle Söze:
MY WAY OR THE HIGHWAY!

Re: Odd or Even... or Both?

2007-06-15 13:49 • by ParkinT
141373 in reply to 141334
barfoo:
sorta - i agree should be NONE or NON-NUMERIC or something other than BOTH.


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.

How about:
ODD
EVEN
FILENOTFOUND

End of discussion!

Re: Odd or Even... or Both?

2007-06-15 13:55 • by ParkinT
141374 in reply to 141363
Coincoin:
Jim:
Steve Boyko:
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? ;)


Or maybe you could be living at 7 Möbius Strip?


I cast my vote for best reply of the day.

And He Built a Crooked House is about a man who built a house that is a (four-dimensional) HyperCube. In the story, you walk from room to room but never find your way out.

Re: Odd or Even... or Both?

2007-06-15 14:00 • by TheReligion2000 (unregistered)
141375 in reply to 141359
Someone You Know:
Robert Hanson:
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".


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.


and vagina is male and penis female

Those frogs

Re: Odd or Even... or Both?

2007-06-15 14:03 • by Gsquared
141377 in reply to 141361
Michael:
Gsquared:
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.

Wouldn't it be easier to just say that if a street doesn't allow for the distinction, that all addresses on that street will be arbitrarily label as being on the "odd" side? That way you don't need to complicate what should be simple logic:

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.

Actually, if you want the full data on it, you just have to read thoroughly about 8,000 pages of postal regulations on presorting requirements.

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.

Re: Odd or Even... or Both?

2007-06-15 14:06 • by KattMan
141380 in reply to 141375
TheReligion2000:
Someone You Know:
Robert Hanson:
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".


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.


and vagina is male and penis female

Those frogs


I guess they are named as to who wants more of each.

Re: Odd or Even... or Both?

2007-06-15 14:12 • by Call Me Joe (unregistered)
141382 in reply to 141369
KattMan:
I saw a möbius stripper once. I thought she was a bit two dimensional.
Weird... when I saw her she just seemed to be going over the same routine she'd gone over a thousand times before...
« PrevPage 1 | Page 2Next »

Add Comment