Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!

Jacky Chow

Greenhorn
+ Follow
since Jun 03, 2002
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 Jacky Chow

I want to take the beta exam 5 July, but since Prometric said the voucher was expired, I contact Sun by e-mail "register4beta@central.sun.com", the reply is:

-------------------------------------------------
Thank you for your interest in our Beta Examination of the Sun Certified
Business Component Developer for J2EE. Unfortunately, due to high demand,
there is no longer space available to receive a voucher.
We look forward to your participation in this certification program in the
future and welcome your questions.
Sincerely,
Beta Certification Team
Sun Educational Services
register4beta@central.sun.com
--------------------------------------------------

Oh ! I must wait for non-beta exam!
The good news is that I have more time to prepare !
I called Prometric today, but Prometric said my voucher was expired July 1, but the e-mail I received from sun shows that the expired day is July 7, 2003, what's the problem ?
Does anyone have the same problem ?
copy from the e-mail:
-------------------------------------------------
Expires July 7, 2003
This voucher number is only valid for the 311-090 Sun Certified Business
Component Developer for J2EE beta exam from June 6 through July 7, 2003. If you
do not take the exam by July 7, the voucher will expire and you will have to
purchase a voucher in order to take the exam. This voucher is NOT transferable
and cannot be used by anyone but yourself. Should you not be able to take the
Beta, please contact me and we will arrange to give the voucher number to
another candidate.
--------------------------------------------------
Hi Atif,
I think you should not use FileOutputStream and FileInputStream. The easy way to do this is that use fix-size record, and then use the RandomAccessFile the to access records.
18 years ago
I have problem when I coding a B+ tree.
When use the following code, the B+ tree works correctly:
-------------------------------
// member variables
final int BUFFER = 4096;
RandomAccessFile lnodeAccessF = new RandomAccessFile("lnodeFile, "rw");
byte[] nodeContent= new nodeContent[BUFFER];
...
public int insert(Record rec){
// this method will call saveNode() and loadNode();
}
private void saveNode(int nodePtr, Node node){
...
lnodeAccessF.write(nodeContent);// write new node content to tree.
...

}
private Node loadNode(int nodePtr, int nodeType){
...

lnodeAccessF.close();
lnodeAccessF = new RandomAccessFile(lnodeFile,"rw");
lnodeAccessF.skipBytes(nodePtr * LNode.PAGE_SIZE);
lnodeAccessF.read(nodeContent);

...
}
-------------------------------
but when i use the following code to replace loadNode() for performance(no change in other code), the result of the B+ tree data is wrong,
-------------------------------
Node loadNode(int nodePtr, int nodeType){
...

lnodeAccessF.seek(nodePtr * LNode.PAGE_SIZE);

...
}
-------------------------------
The operation sequence of object lnodeAccessF in the orginal code(in the insert() method):
1.lnodeAccessF = new RandomAccessFile(inodeFile,"rw");
2.lnodeAccessF.write(nodeContent);
3.lnodeAccessF.close();
4.lnodeAccessF = new RandomAccessFile(inodeFile,"rw");
5.lnodeAccessF.skipBytes(nodePtr * LNode.PAGE_SIZE);
6.nodeAccessF.read(nodeContent);

7.if needed, go back step 1 to insert more record to the tree(the nodeContent will chage before write back to file).
The operation sequence of object lnodeAccessF after change the loadNode() method:
1.lnodeAccessF = new RandomAccessFile(inodeFile,"rw");
2.lnodeAccessF.write(nodeContent);[B]
3.lnodeAccessF.seek(nodePtr * LNode.PAGE_SIZE);
4.inodeAccessF.read(nodeContent);[\B]
5.if needed, go back step 1 to insert more record to the tree(the nodeContent will chage before write back to file).
I can't find that while the result of the two operation sequences are not same, could anyone point out any potential error in the new codes.
Thinks
Brian
18 years ago