Pankaja Bansal

Greenhorn
+ Follow
since Feb 16, 2006
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 Pankaja Bansal

Hey

I received my SCJD exam results today after waiting for around 1 month. I passed scoring 368/400 .

Thank you all for your cooperation, answering my questions and a special mention to the moderators of this forum like Andrew.

This report shows the total number of points awarded for each section. The maximum number of points is 400, to pass you need a score of 320.

Section Max Actual Points Points
General Con: 100 90
Documentation: 70 65
OOD: 30 30
GUI: 40 33
Locking: 80 80
Data Store: 40 40
Network Server: 40 30

Total: 400 368

I was particularly happy to see full in Locking as this was my weak area.
:-D

All those who are yet to give the exam or are awaiting results, I wish you all the very best.

Cheers
17 years ago
Hi everybody

I've finally submitted my application and I am yet to take up a date for the exam. I was thinking of giving the exam asap, but I was just wondering whether any preparation is required for the exam or not. Those who have cleared SCJD, are requested to put some light on this yet untouched, undiscussed area.

Thanks already

Regards
PB
Hi

This might sound like a stupid question, but this is what my specification says


All configuration must be done via a GUI, and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properties which must be located in the current working directory.



Now, when I store the properties file in my runme.jar file, it works fine but when I keep it outside runme.jar it doesn't find the properties file. Could any one please tell me what might be wrong and how can I access a file outside my jar file.

Thanks

PB
Hi Animesh

You dont have to physically delete a record from the file. Just mark the record as deleted. If you read your functional specs carefully again, you'll find a statement


// Creates a new record in the database (possibly reusing a
// deleted entry). Inserts the given data, and returns the record
// number of the new record.



which means that while creating a new record, you can search the first deleted entry and update it with the new record information. This way you can be sure that your database file is not ever increasing in size.

Cheers
PB
Hi everybody.

Thanks a tonne for your prompt and very helpful replies. Andrew, your description was an eye opener. I realized the mistake I was doing. I was thinking that the mode parameters "server" or "alone" indicates whether the clients need to connect to server or run in standalone mode.

This is the part of my specs that mentions the requirement.


The mode flag must be either "server", indicating the server program must run, "alone", indicating standalone mode, or left out entirely, in which case the network client and gui must run.



What I understood now, is "server" indicates starting the server. "alone" means it doesn't matter if server is on or not, but client should start in standalone mode. Where as no parameter expects that server is on and starts the client in network mode connecting to the server. If however in this mode, the server is not on, it should throw an error. Please let me know if I am correct this time.

Once again, thanks all of you for saving me from making a blunder.

Regarding making an executable jar file, I think, I would use ant to do the job as it will be a new learning for me.

Regards
PB
Woof... Finally, I think I've completed my application development part. I am working on the testing and documentation now and one thing I can't figure out now is packaging.


All elements of your submission must be packaged in a single JAR file. The JAR file must have the following layout and contents in its root:
The executable JAR containing the programs. This must be called runme.jar.
The original, unchanged database file that was supplied to you. Note that you must keep a copy of the original database file supplied to you, and this must be the file you submit. The marking process will expect the exact same data without any changes.
A directory called code, containing all the source code and related parts of your project. You must create subdirectories within this to reflect your package structure and distribute your source files within those directories.
A file called version.txt. This must contain pure ASCII (not a word processor format) indicating the exact version of JDK you used, and the host platform you worked on.
A directory called docs, containing the following items at the top level:



The specs say that all executable should be in a jar file. Now I have two executables one for server and one for client, and as far as my knowledge goes, there can be only one main class in one jar file. so how are we supposed to package the two executable programs in one jar. ??

Also, could someone please let me know the command for creating an executable jar file. The way I am doing seems to give me some problems..

Thanks a lot...

Cheers
PB
Hi everybody

I have created an adapter class and I made this class as a remote object by extending UnicastRemoteObject . I am creating an object of this class using the code below in quotes.


DBClient localConnection = new RemoteData() ;



It works just fine but if I remove the stubs and the skeleton files, it gives an error even though I am not using the stubs functionality. My question is, Is it a violation of the below rule :

In either case, the program must allow the user to specify the location of the database, and it must also accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely



Please suggest. I really need some good advice on this.

Regards
PB
Hi everybody

I was just wondering, what all requirements I must code to successfully pass the exam. People who have already passed the exam, can you please answer this for the benefit of all on the forums.

1) Do I need to add functionalities like adding a new record, modifying existing ones, and deleting existing ones.

2) what level of validations should I include ? I have a date field. So should I be validating for a right format ?

3) In my last post, I mentioned a problem I am facing regarding deletion of records. Do I need to make sure that a record, I am deleting or updating has not already been updated/ deleted by another user before I try to do so ?

I would really appreciate if someone could find some time out to answer these questions as I jave no idea as to how far should I go in completing my assignment.

Thanks in advance

regards
PB
Let me reframe my problem

Say at time 0, I read a record and displayed on my client.

At time 5 secs, another client, updated the same record.

At time 10 secs, my client wants to update that record.

Since I cam seeing the status of that record as it was 10 secs before, I am actually updating a record which was already updated 5 secs ago by another client. This should not happen, but I cant figure out how to handle such a situation.

Moreover, I am not using a service layer in between. My client is directly talking to the DB layer as I've adopted a 2 tier framework after going through the long discussion on this forum.

Cheers
PB
My latest confusion is related to the deletion of records from the database. The method provided in the interface takes an integer value pointing to the record tbe deleted


// Deletes a record, making the record number and associated disk
// storage available for reuse.
// Throws SecurityException if the record is locked with a cookie
// other than lockCookie.
public void delete(int recNo, long lockCookie)
throws RecordNotFoundException, SecurityException;



Now the problem is, suppose I receive a list of records from server. And I delete a particular record , say 5th. Now by the time my request is executed on server, Another user has updated or booked the record 5th. How do we deal suuch a situation ?

The same problem may arise during various other cases when the record we are updating has already been updated or deleted by some other person.

Another doubt I was having was related to add/ update/ delete feature. My assignment does not mention explicitly that I should provide any such feature. It only asks me to provide an option for booking. Should I be providing these abilities in my applications or not ?

Thanks in advance ..

Cheers
PB
Hi Zhixiong

I posted a similar question of what is the requirement of cookie when for all updations/ deletions we need to lock the records. But then working further and giving it a little more thought clearified my doubt.

I have created a wrapper class which will be available to client for all database enquiries. This wrapper class locks a record before updation/ deletion and then unlocks it. But imagine what will happen if the Data class is made available to client without this WRAPPER class.

The client would be free to call update/ delete method without first calling the lock method on that record. In such a case it may happen that if a record was locked by someother thread, it might still be allowed to be updated by the other client because all the Data class would check will be whether it is locked or not. Since the requirement doesn't need us to make a wrapper class, we need to make sure by the cookie, that only thread that locked that record gets to modify its contents.

I hope I made myself clear and made some some.

Cheers
PB


Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface:

package suncertify.db;
public interface DB
{.... }




Since the DB interface here contains lock and unlock mechanism, I created a wrapper class around my Data.java class which locks, performs the operation and unlocks the object. Since the connection could be local or remote, my client would require to deal with an interface. My question now is, is it mandatory to use this given interface "DB.java" for clients use or can I create another interface which my wrapper class would implement and this interface would actually be passed to client for all its operations.

I dont want client to be handling lock and unlock processes and all the client should be bothered of is operations on the database. Can my approach fail automatic test because I'll be using another interface apart from DB for the client to access data ?

Please let me know your views.

Pb
If I understand it correctly, can anyone please confirm that in case of local mode, there would be only one single JVM running both Database and Client.
In this case, there would be one and only one user at a time accessing the database. Or do we have to take care of the situation where two users on the same machine but in different JVMs (both in local mode) are accessing the same file. In this case there seems to be no way to synchronize the writing/reading operations on the file and there can be inconsistency. Am I right ? Are we expected to handle this situation ?
Sorry guys, I just found the answer to my query. I request the moderators to please delete this topic.

For the benefit of others though, I would like to post this link which is a very good resource for developing a small database system using RandomAccessFile class .


Use a RandomAccessFile to build a low-level database
http://www.javaworld.com/gomail.cgi?id=658086
Hi everybody

I am caching all the records in my DB file on the start of the application and whenever there is a write operation, I persist the changes on to the file. For memory I am using a flag for deleted or valid record but my confusion is when I am persisting this change on the file, I should actually be removing this record completely from the file. What I am doing right now is marking the record as deleted on the file but this will lead to a lengthy file which is not correct.

Is there any way by which I can reclaim the space on the file system deleting the deleted records permanently. I dont want to write the whole file again and again on any write operation as it will be a less efficient. Any suggestions would be really appreciated.

Cheers
PB