Huan Niu

Greenhorn
+ Follow
since Sep 21, 2007
Merit badge: grant badges
For More
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 Huan Niu

Hi, I have solved the problem.

Thanks
15 years ago
How did you make it working?

I have the same problem.

At beginning I thought it is the problem with JVM. So I un-installed all the JVM on my machine and installed one jdk 1.5.0_16.

However, I am still having this error.
15 years ago
Hi James,

I agree with Herman.

The requirement says "Deletes a record, making the record number and associated disk storage available for reuse", which doesn't mean you will free up disk space, and just reuse the deleted records.

In this case, before every operation (update, delete ...), I always check if records are deleted or not.

I'm working on UrlyBird as well.

Hope this will help.

Huan
[ November 07, 2007: Message edited by: Huan Niu ]
Hello guys,

As you all know, this project doesn't allow you to use database instead of file system.

As far as I know, in java, you can't update only parts of a file without rewriting the whole file content.

So the solution will be read the whole content of the data file into memory, modify it, and then write it back to the file.

Now I am wondering, is there any other solutions to update parts of the file rather than read whole into the memory?

Thanks a lot!
Hi, jesal

That is what I'm exactly expecting.

Thank you very much.
Thanks for reply.

use it like this

String fieldValue = new String(field_name, "US-ASCII");



But the "US-ASCII" is 7-bit not 8-bit.

Does this fulfil the requirement?
[ October 16, 2007: Message edited by: Huan Niu ]
In the assignment description, there is some kind of information:

... All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field. The character encoding is 8 bit US ASCII.

Please notice it is "8 bit US ASCII".

So when I use string.getBytes( charsetName ), I want to put a proper charset to get bytes for the string. I looked up in the Java API 1.5 class Charset, and it says:


US-ASCII Seven-bit ASCII, a.k.a. ISO646-US, a.k.a. the Basic Latin block of the Unicode character set
...
UTF-8 Eight-bit UCS Transformation Format



I am wondering which one I should use? or any other suggestions?

Thanks a lot.
This is my solution:


Hopefully, this is what you want.

By the way, in this example, you will get two identical values...
[ September 24, 2007: Message edited by: Huan Niu ]
16 years ago
At most occasions, we say:

Map<String,List<String>> levelsMap = new HashMap<String,List<String>>();


Using interface gives you more flexible, and it's the OOP way...
16 years ago
Modify your code to:

HashMap<String,List<String>> levelsMap = new HashMap<String,List<String>>();


It will be fine. Did that answer your question?
16 years ago