Willy Leung

Greenhorn
+ Follow
since May 02, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Willy Leung

Hi Hanna,

I tried to do what you described and couldn't duplicate your problem. Below is the piece of code I wrote. It assumed the properties file already exists. The code reads what's in the file, add one new key-value pair, and writes the file in each iteration.



And this is what's in the properties file after running the program.



Notice the colons and file separators were all handled automatically.
I am a bit confused. There's no read and write methods in the Properties class. According to the API doc, load and store should take care of all the escape characters for you.
Hi Andrew,
Thanks for the warm welcome and your reply.
After looking at the data in the database file, I do think it is logical to assume that name and location together make up a unique key. I plan to document this in my choices.txt and to go with the caching approach.
Thanks again.
Willy
Hi,
I am also debating whether to cache all records. Here're my thoughts.
I am making the assumption that two specific fields (name + location) in a record make up a primary key. However, the DB interface deals solely with record numbers. So I need to keep a mapping between record numbers and primary keys. If I am cahcing names and locations already, why not the rest of the record and the location of the record in the database? IMO, the cache would make implementing all the methods a lot simpler.
Any comments?
Willy