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

Jason Marshall

+ Follow
since Jul 17, 2006
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jason Marshall

aghh Thanks mate I appreciate that.


Hello guys,

The Oracle Web site states

Exam Number: CX-310-252A
Associated Certifications: Sun Certified Java Developer (SCJD)
Assignment Price: TBD
Assignment Registration: This item is currently unavailable while we update the process. If you previously purchased this assignment, the files will be sent to you via email.

Duration: 12 months from assignment download
Number of Questions: NA
Passing Score: 320 points out of 400 possible points*
* Passing score is subject to the evaluation of the Step 2 essay exam and validation of the authenticity of the assignment

I was under the impression we can take as long as possible. I downloaded this about 4 years ago now, and although I have just about finished, I can't seem to finsih it off.

Can somebody confirm if I am to late now?


No matter what I do I cannot change the stupid flag ( )

I have used writeShort(00), writeShort(0X00), writeChar(00)


why oh why...

Roel De Nijs wrote:Jason,

How big is your delete flag according to your instructions? What's the declaration for your Room.VALID_RECORD ?

[edit] I guess your delete flag is 2 bytes, so you would use writeShort and readUnsignedShort for the reading/writing of your deleted flag. More info about this in this thread.

Kind regards,

Thanks Roel,

Yes my flag is 2 bytes. I originally did have it as wrtiteShort.

I'll check out the thread now thanks

Roel De Nijs wrote:Hi Jason,

I guess it all depends on how big the delete flag is. In my assignment the flag was 1 byte.

So i was able to successfully write my delete flag with the following code:

Kind regards,

Hey bud,

Thanks for the fast reply. I just tried that and still no Joy, it seemed to put everything out by 1 place. I then added offest + 1 and it still did not change

Hello all,

Are there cases when methods to not fire on RandomAccessFile?

What I am trying to do is add a new Room to my database with the create method!

The below code writes to the database.

I can confirm that I have found the first deleted record. I then proceed to change the deleted char from 0X0000 to 0X00 (Valid).

I can confirm that database.write(out.toString().getBytes()); gets written to the database but database.writeChar(Room.VALID_RECORD); never does.

This is really really weired! Are there known cases why this does not happen?

The problem is that since the Value never changes from deleted, no new Room is ever added.

Please let me know if I can provide more information, I'm so frustrated with this bl0$dy assignment.



K. Tsang wrote:Hi Jason,

For your questions, ideally you just need to enter the customer ID (owner field) which is 8-digit string, not the customer name like you said. All other fields don't need to change, but if you want you can change the date to the check-in date (ie 2 days from today satisfying that 48 hour rule).

Don't worry if you worked on the assignment more than one year, I think the one-year period applies to new candidates.

Also when you do submit, you need to submit the original database file that came with your assignment (no new records, no deleted records, no changed fields).

Thanks K. Tsang and Roel,

You two have helped me out a lot. I'll let you know how I go with my marks in a few months time.



Roel De Nijs wrote:Hi Jason,

I have implemented all methods from DBAccess (and even some own methods I needed) in my Data class: so I have in my Data class a create- (reusing deleted entries), update-, delete-, read-, find-, isLocked-, lock- and unlock-method.

I only used these methods in my program: find (look for rooms), read (read the rooms), update + isLocked + lock + unlock (book a room). So create- and delete-method are unused.

If you want to test your methods (see if implementation is ok and they act like they should) I would create a test-case (or test-program, something like Junit, TestNG). I even suggest this for all your methods, certainly for your Data class (it's the most important class you will create). I created a Data class test with 100% coverage (so each situation is tested, also those when you pass a wrong/illegal parameter). I have a 68 different tests (for just 11 methods ). The benefit of this approach: if you make some changes after a week to your Data class, you just run your test-case and you see immediately of those changes broke your existing code. And of course running just this test-case is a lot easier and faster than starting whole your application to see if an update was successful

But you don't have to use all methods from Data. I created a second find-method (returning record numbers + record data instead of just record numbers). And in my program I use that one instead of the one defined in Sun's interface.

[edit] don't forget to make a backup of your original database file (if you start updating, deleting,...) because you have to submit an original (unchanged) database file)

Kind regards,


Thank you very much Roel. I think I have saved my original database File on gmail so I will retrieve it this way. I new that chances are one day that I would probably corrupt it. Here's me getting my Delete method perfect to find out that it's not used in the GUI along with the Add new record. Anyway at least I was learning.

I think I got your test classes about 6 months ago so your right it is a good idea to go over my data class again to check that I have not broken anything whilst building my Gui classes. Why did I think it was necessary to have this functionality in? I probably was not reading the doc file correctly.

If you could answer three quick questions for me?

1. When reserving a room the user/operator only needs to have an edit field on the rooms row where they can add in the owners name to reserve the room?
2. Do I need to edit the other fields in the row such as Date and Smoking?
3. A little bit ff topic, I heard that Java where setting a year's time limit to do the assignment, I downloaded mine about 3 years ago opps will this affect me?

Thanks for your help, much appreciated.


K. Tsang wrote:

Jason Marshall wrote:How do I open a new JPanel that exists within the same JFrame?

Hi Jason, how are you doing book or search? Are you using internal frame (like you are currently) or popup frame/dialog?

The idea should be the same. Creating or delete records is the least worry of the GUI. Searching and booking (updating) are the key requirements you must implement.

Thanks for your reply,

I'm using everything internally, once the JFrame Class is called all of the Panels, Menu's etc are instantiated.

I'm just not to sure how to open a new Panel to replace the existing panel so that I can add the new Room in.

I'm quite surprised that adding a new room is not a requirement as it is in the DBAccess Interface?

If this is not the case I suppose I'm just about home then

Thanks Roel,

But what is the point of this method in the DBAccess?

// 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.
public long createRecord(String [] data)
throws DuplicateKeyException;

I'm confused, why would they put it in there if it wasn't meant to be used.


Hello All,

I am up to the stage in my project where I need to add a new record.

I have built the GUI now that displays all the records that exist in a JTable.

So my question is.

When the user clicks on the Add New Button. This fires an Event.

How do I open a new JPanel that exists within the same JFrame?

My problem is because the Frames, Tables, Menus etc have already been created in it's main method. How do I create other Frame objects on a call to Action Service.

I am an URLyBird 1.2.2



Thanks for your comments guys,

I'll check now for memory leaks..

Hi Partners,

If I run Roberto Perillo Test case more than say 70 times as shown below.

I get the below error message.. Is this normal, I am doing calls to System.gc() and I know we cannot control this, I have tried to null all variables inside of my functions. Is this happening due to the share number of threads being created? I am working on a Dell Inspiron, XP3, 1GB Memory.

Exception in thread "Thread-264" java.lang.OutOfMemoryError: Java heap space
at suncertify.db.RoomFileAccess.updateRoomList(
at suncertify.db.RoomFileAccess.deleteRecord(
at suncertify.db.Data.deleteRecord(
at suncertify.db.DataClassTest$
BUILD STOPPED (total time: 1 minute 2 seconds)

Thanks Jason
Hi Roel,

Thanks very much for your time to explain to me how your assignment is going. I am the same as you and probably most of us here trying to develop whilst working full time jobs and trying to enjoy life as well.

Can I ask a few questions to you, I have run Roberto Perillo's test-case class and I find I do not ever get a deadlock, but if I increase the loop to about 1000+ I start getting JVM Thread out of memory exceptions, is this to be encountered? Also what does wip-package mean.

Once again thanks for your detailed explanation earlier.

Regards Jason
Thank you for your help K. Tsang,

I made the the ArrayList static and global and I don't know why this error was happening. I think that we are expected to know why our system behaves like it does and I cannot answer that one yet hmm.

Thanks for the link to data testing this will be very helpful..

Is the server classes the hardest part of this assignment or is there more curlers to come?