Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / October 2006

Tip: Looking for answers? Try searching our database.

Regional Concept

Thread view: 
morc - 19 Oct 2006 17:19 GMT
Hi, i was wondering if anybody had any idea how to go about writing
code that would take someones adress and determine the names an
adresses of their neighjbours?

Is this possible??

thanks
-morc
Oliver Wong - 19 Oct 2006 17:24 GMT
> Hi, i was wondering if anybody had any idea how to go about writing
> code that would take someones adress and determine the names an
> adresses of their neighjbours?
>
> Is this possible??

   For starters, to do this, you would need access to a database of
everyone's name and address. If you can't get access to this, might as well
scrap the project right now. =P

   - Oliver
Furious George - 20 Oct 2006 04:36 GMT
> > Hi, i was wondering if anybody had any idea how to go about writing
> > code that would take someones adress and determine the names an
[quoted text clipped - 5 lines]
> everyone's name and address. If you can't get access to this, might as well
> scrap the project right now. =P

It's much easier than you are suggesting.  Assuming access to an
appropriately set up database, the proper query would be:

SELECT p.name , p.address FROM people AS p , people AS q WHERE
p.neighborhood=q.neighborhood AND p.address<>q.address AND q.address=?

>     - Oliver
Oliver Wong - 20 Oct 2006 15:19 GMT
>> > Hi, i was wondering if anybody had any idea how to go about writing
>> > code that would take someones adress and determine the names an
[quoted text clipped - 12 lines]
> SELECT p.name , p.address FROM people AS p , people AS q WHERE
> p.neighborhood=q.neighborhood AND p.address<>q.address AND q.address=?

   The hard part isn't constructing the SQL query. The hard part is getting
the database. Where are you going to get a database containing the names and
addresses of everybody?

   - Oliver
Chris Uppal - 20 Oct 2006 16:14 GMT
>     The hard part isn't constructing the SQL query. The hard part is
> getting the database. Where are you going to get a database containing
> the names and addresses of everybody?

Well, given a name and address like

   A Person
   28, Garden Villas
   Entbury-on-the-Wash

it isn't too difficult to come up with addresses of neighbours:  26 Garden
Villas and 30 Garden Villas -- not to mention the people across the road.  Of
course, that isn't totally reliable (I know streets where the opposite side of
the road has a different name, let alone just following a different numbering
convention), but it'll usually work.  Another problem is that it won't give the
the name of the person living at that number.  There are database you can buy
which will provide that information (depending on where you -- or your
victims -- are), but I can't think of a single valid use for the names of the
neighbours so I wouldn't mention them here even if I did happen to know where
they could be bought.

   -- chris
Oliver Wong - 20 Oct 2006 16:37 GMT
>>     The hard part isn't constructing the SQL query. The hard part is
>> getting the database. Where are you going to get a database containing
[quoted text clipped - 14 lines]
> numbering
> convention), but it'll usually work.

   There are also corner cases... literally:

    |
 A  |         |    B
    | Foo St. |
 C  |         |  28 Bar St.   D
-----|         |----------------
                  Bar St.
-----|         |-------
    |         |
 E  |         |   F

What are the address of A, B, C, D, E and F?

> Another problem is that it won't give the
> the name of the person living at that number.  There are database you can
[quoted text clipped - 5 lines]
> where
> they could be bought.

   Right, for the DB, it was primarily the name-address association I was
concerned about. I realize though that I had mis-read the original problem
statement. I had assumed that the input was a name, not an address.

   - Oliver
Furious George - 21 Oct 2006 00:00 GMT
> >>     The hard part isn't constructing the SQL query. The hard part is
> >> getting the database. Where are you going to get a database containing
> >> the names and addresses of everybody?

You are correct.  The OP posed a poorly defined problem.  What is a
"neighbor"? What is an "address"? etc. etc.  I ducked all those
problems by assuming a properly setup database.

> > Well, given a name and address like
> >
[quoted text clipped - 4 lines]
> > it isn't too difficult to come up with addresses of neighbours:  26 Garden
> > Villas and 30 Garden Villas -- not to mention the people across the road.

Since the OP did not define what s/he thinks is a neighbor, your
examples may or may not be right.  Maybe 26 Garden Villa and 30 Garden
Villa are not right and the neighbors are the people who live on the
same floor of the same building as A Person.

> > Of
> > course, that isn't totally reliable (I know streets where the opposite
> > side of
> > the road has a different name, let alone just following a different
> > numbering
> > convention), but it'll usually work.

Tricky.  But since the OP did not define "neighbor" how do you know he
wants them included.

>     There are also corner cases... literally:
>
[quoted text clipped - 9 lines]
>
> What are the address of A, B, C, D, E and F?

Tricky.  But since the OP did not define "neighbor" how do you know he
wants them included.

> > Another problem is that it won't give the
> > the name of the person living at that number.  There are database you can
[quoted text clipped - 11 lines]
>
>     - Oliver
Chris Uppal - 22 Oct 2006 12:43 GMT
> Since the OP did not define what s/he thinks is a neighbor, your
> examples may or may not be right.  Maybe 26 Garden Villa and 30 Garden
> Villa are not right and the neighbors are the people who live on the
> same floor of the same building as A Person.

Yes, if you take vertical relationships into account then that does add
another, um, dimension to the problem ;-)

> Tricky.  But since the OP did not define "neighbor" how do you know he
> wants them included.

I saw it the other way around.  This problem doesn't have a precise solution.
Not even given a good quality GIS database.  E.g. two people who live close to
each other but are separated by a river, a motorway, or even just a busy
street, might not count as neighbours.  OTOH, a farmer in a remote area might
consider the farm on the opposite side of the valley to be his "next-door"
neighbour even though a river ran down the valley.  So, the approach is to
assume a workable approximation; one which is simple to implement (albeit
unreliable).

And if the customer finds that unacceptable, then it's up to /them/ to define
what they mean more precisely -- which, with near 100% certainty, they won't be
able to do.   Not unless they are specialists in the domain, but then they'd be
able to answer all of the OP's question; and indeed the answer would be part of
the functional spec, not something the designer or programmer was allowed or
expected to invent.

   -- chris
Eric Sosman - 21 Oct 2006 02:45 GMT
>>    The hard part isn't constructing the SQL query. The hard part is
>>getting the database. Where are you going to get a database containing
[quoted text clipped - 8 lines]
> it isn't too difficult to come up with addresses of neighbours:  26 Garden
> Villas and 30 Garden Villas -- not to mention the people across the road.  Of

    Sir Henry Baskerville
    Baskerville Hall

Signature

Eric "footprints of a gigantic hound" Sosman
esosman@acm-dot-org.invalid

Charles Hottel - 20 Oct 2006 01:28 GMT
> Hi, i was wondering if anybody had any idea how to go about writing
> code that would take someones adress and determine the names an
[quoted text clipped - 4 lines]
> thanks
> -morc

goggle find neighbors


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.