aspose file tools
The moose likes Sockets and Internet Protocols and the fly likes how to use the .prp file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Reply Bookmark "how to use the .prp file" Watch "how to use the .prp file" New topic
Author

how to use the .prp file

sushant prabhu
Ranch Hand

Joined: Mar 22, 2001
Posts: 66
i have created a program which is something lik this. there is a server program which accepts questions from the client program and provides with answers corresponding to that question back to the client. for this i am loading a .prp file on the serverside where there is the question to answer mapping. the program works fine when the question are one word question but the moment i have a 2 word question say a space between the 2 words my program fails.

say my .prp file is something lik this
what I dont know
here what is the question the client program will have to send in order to mak the program function properly.
say if i have
what is I dont know
my program stops giving me the right answer


Sushant Prabhu<br />SCJP2<br />SCWCD<br />OCA9i
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7231

Hi Sushant -
I was curious about your use of a .prp file, as I was unfamiliar with this format. I looked up a couple of things on the web, and from those I concluded that you're simply building a property. .prp seems to be at least two companies' idea of their proprietary extension.
I think the solution for what you're doing could be easier. If each question maps to a unique answer, what you could do is handle the question as a key, and its answer as a value. Key-value pairs correspond directly to properties in a file, so it's an efficient match.
In this context, a key can be any String. In practice, to avoid misinterpreting extra whitespace as a different question, you'd probably be better off replacing whitespace with some other delimiter, like underscores.
Then you can build a mapping like:
what_is_I_dont_know="what I don't know"
You might also want to consider bleaching out punctuation and capitalization from the user input if it's going to be entered by hand, or restrict the user to choosing questions from a Choice list. That will save you a substantial amount of validation code.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
 
IntelliJ Java IDE
 
subject: how to use the .prp file
 
Threads others viewed
Connection Factory objects RMI
execution and executable Jar question for SCJD
urgent help needed :serverstub not found
Questions about automatic failure
how do download managers work
developer file tools