pedro povoa

Greenhorn
+ Follow
since Jun 17, 2008
Merit badge: grant badges
For More
Brazil
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 pedro povoa

Jonathan Russell wrote:That's great to hear pedro, as I am working my way through that book just now before starting on my URLyBird assignment.

I'm thinking once I've completed the assignment in the book it I will be able to modify it in eight weeks or so so it does all the functionality required by URLyBird. Does this seem like a good idea?



If you just adapt your project to URLyBird, it will take alot of work indeed and might work just fine(start changing the DB interface and .db file, off course). It would be against the rules if they did a equals project even with different subject.
But you risk to make a poor "choices.txt" file and leave some trash in your code if you do.

The intention of this cert is that you code it all by yourself, but you can use the books project for consulting. Why not.

Regards,
Pedro.

Hello guys,

i had a minor cirurgy last week... so i had to take a break from certification.
But meanwhile, i followed Roel's advice and started to read "SCJD Exam with J2SE 5, Second Edition. By Andrew Monkhouse and Terry Camerlengo" and i must say:
If you are , this book will clarify your mind and you will for sure get a better idea of what you have to do. And you get working samples!

Kind regards,
Pedro.


I decided to make what you said, im only using String[] in my Data class. But i added 2 extra fields to it, so it has this format: String[] a = {recNo,...,flagDeleted};
Where recNo is the order from .db file.
This way i can store all my records in a List and use the map<Integer, Long> to track locked records.
----
Ill make a question that maybe will make me look stupid, but... oh well... again, almost everything i have to use is new for me.
My Data class is a singleton, accessed only by "StandAlone" and "Client" implementation of my Service interface.
If i load my List of records at startup, i have to call "loadData();" at Data constructor. But, to loadData and writeData back to the .db file, i need to know the String dbPath!
When and how should i load dbPath(coming from view or suncertify.properties)?
And if i get it right, StandAlone and Client will share the same Data object but they need to specify distinct dbPath. Is that possible?
I'm having trouble figuring it out... Maybe i shouldn't make it singleton and read .db file every request from view...

Thank you,
And Sorry for dumb questions
Thank you Roel,

My initial thoughts are confusing and might be redundant because there's alot of things i only know in theory, so i ended up mixing some concepts.
Plus, javaSE implementation is a whole new world for me.
ill study more about the implementation of Data and worry about the other things i mentioned when i get it done.


Pedro.
Hello,

Like many people, i just bought my OCMJD voucher... trying to accomplish it before august 1st.
So yesterday i downloaded my essay and many questions are in my head... My project is the URLyBird, with "public long lock(int recNo) throws RecordNotFoundException;" interface.
After reading SCJD FAQ, related topics and ocmjd-paper-roberto-perillo.pdf (awesome by the way), i decided to start from DB interface and db-1x1.db file provided by Oracle.

Conclusions and doubts:
I used DBFileReader.java class by Roberto Perillo as kick off and see whats inside my .db file to design my VO(Room.java in my case) class;
Reading the instructions and studying the .db, i realized that there is no "record number" and no "primary key". But there is no record where Name and Location combination equals true, and since no insertion of data is expected i made both my "primary key". To do so, i @override equals method on my VO class to make sure of that(name.equals(this.name) == true && location.equals(this.location) == true), ignoring the other atributes;
I didn't see the need on @override the hashCode method here, since ill CACHE STORE the records on a List and my LOCK CONTROL will be Map<Thread.ID,Room>, so i didn't;
MagicCookie and the long longCookie attributes are not the same thing. MagicCookie will be used only to compare to a static final variable on my Data class to make sure the .db file is valid;

DB Interface:
I will use RandomAccessFile to seek and read/update records. Thats the only way the argument "int recNo" of DB interface make sense to me;
I concluded the arguments "int recNo" is the position of the record on my List object, and when i need to update the .db file i seek to headerBytes+recNo*bytesRecordLength then write;
I also concluded the "long lockCookie" argument is the Thread.ID from my Map<Thread.ID,Room> to identify the thread holding the lock of that Room object;
I need a utilitary class to transform String[] records to VO and vice-versa;

Now some comments about instructions:
"Data section. Repeat to end of file: 1 byte "deleted" flag. 0 implies valid record, 1 implies deleted record "

// 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)

I didn't understand this part, what delete means here? Because all records have this field empty on db-1x1.db(so, all records are valid).
And again, is my conclusions about recNo and lockCookie right?
Do i have to implement this method? Instructions only ask for search and update.

User Interface
• It must allow the user to book a selected record, updating the database file accordingly.
• It must allow the user to search the data for all records, or for records where the name and/or location fields exactly match values specified by the user.
A null value in criteria[n] matches any field value. A non-null value in criteria[n] matches any field value that begins with criteria[n]. (For example, "Fred" matches "Fred" or "Freddy".)

public void update(int recNo, String[] data, long lockCookie)

Here i assume that i must provide a checkbox to allow And/or searchs and filter using .startsWith(String);
Do i have to update the .db file everytime i execute the update() method?
The search of data can be done only on the List i loaded at startup or i must re-read file and re-load List before?


-------------------
About architecture:

Im thinking about making my Data class a SINGLETON with static List for records and static Map<Thread.ID,Room> for locks, to make sure the same object is shared among all clients;
A VO named Room to map records entrys and transit between layers;
Make a Service interface that will be implemented by StandAloneServiceImpl, RemoteServiceImpl and ClientServiceImpl, and make it the only access point the Data.class;
Read .db file to load List at startup without locking and only if my static list is null;
Use Lock only on the record i want to update or delete, leaving .db file available to other threads;
I don't need to control concurrent access to .db file;
I don't need to synchronize methods because of the lock()/unlock() mechanism on Room object;
The Room.java VO implements serializable;


Problems to solve:
How to use and set the startup parameters(server or standalone or client) to instantiate classes;
How to share the Service interface with all running modes, because of different parameters(.bd location, hostname, port);
If is it viable to use the same classes from Service interface to Data.class to db-1x1.db file, since Data class is singleton;
Do i really need to implement serializable on my VO class? Since i write String[] object to the file;

-----------------------


Well, thats what i get so far...
I have to study about the RMI implementation.
Im having trouble to figure out the middle of my application, where i have to combine the 3 different interface implementations(standalone, client and server).

Please tell me if i'm asking/saying anything that is inapropriate, so i can remove it.
Thank you!

Pedro.
Hello Guys,

Due to your support, i've just cleared my first Certificate Exam! I would like to thank you all!

Especial Thanks to Cameron McKenzie, for motivating me and for writing the SCJA book.

My preparation:
-Bought Voucher;
-Bought McKenzie's book;
-Exam Date Set(to keep myself focused)
-Resumed each chapter, defining each important topic(like rmi, jni, jms, ejb, protocols, etc)
-Answered the questions in the end of each chapter, after reading and understanding the whole chapter. I added in the Resume each question that i didn't understand very well.
-Read my resume when i finished the book
-Took the Sample Exam and revised every wrong answer

After getting "pass score" on the sample, i was sure that i was ready!
I only used McKenzie's book and my resumes for my preparation and...
That's it, after a Month of dedication i did it!

@Cameron
If you read this topic, can you please PM me your e-mail address?
scja.com/errata.html is not working!


Going for SCPJ6!
Thank you!
(sorry for my poor english)
15 years ago
thank you guys . it means alot to me!

I've just bought my voucher!


-Pedro.
15 years ago
Omg, because of 1 question i did not get my certification...

At least i learnt, by the expensive way, that i should get time to study harder and make online simulators... And not only read a book and think its ok : (

<cries>
----
Passing Score: 68%
Your Score: 66%

There are 51 questions in this exam. You answered 34 questions correctly.

OO - 75%
UML OO - 50%
Java UML OO - 50%
Project and algoritm implementation - 66%
development in Java - 66%
Java and integration tech - 80%
client tech - 100%
server tech - 57%
15 years ago