Dave McCarthy

Greenhorn
+ Follow
since Jun 12, 2001
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 Dave McCarthy


Just noticed some talk of using a gui builder such like the one you would find with IDE's such as Jbuilder. I've been using jbuilder for my programming, but I did not use it to create my gui. I was looking more for clean, easy functionality than something fancy with a lot of bells and whistles. The project specifications say we "may" use and IDE but there musn't be any residual dependencies because of it. I kept my button on the top as to centralize mouse movment/clicking as much as posible.I was also thinking of reducing clicking even more by not even having pop-up windows, instead have just a label with the "status" and the success/failure messages. Anyone who has already passed the project aspect of the certification have any comment on this?

Dave
This is how I did my gui, comments would be great...
I have to combo boxes which are populate with the data from the database, with the "any" word added as the first choice. Upon startup I display all of the database record (which at the moment isn't a problem because there are only 24 records). I made my combo boxes "active" so to speak, in that I don't have to click any search button. If I changed the origin combo box, just the orgins in my jtable change. I then just placed a textfield to take the number of desired seats and "book" button immediately above my jtable, and have a pop-up window displaying the success or failure of booking. I did things this way to reduce the amount of mouse clicking by the user.
Dave

You can go approach the project with client tracking. I've been at this part myself for the past little bit. From what I've gathered though, that is above and beyond the scope of the project. If you are using RMI this gets a little more difficult. An RMI server can't query a client. In order to take an approach with client ids and verifying their existence you would have to create the clients are rmi servers themselves. If you are using serialized sockets I belive tracking clients is not a problem. There's lots of discussion on the forum on this topic.
The way I took care of stale record locks was to when storing a record id as being locked, also store it in another hashmap along with the current time. Then on the server I created a low priority thread that awakens every 5 min, checks the lock times of all locked records and if any have been locked for 5 mins or more remove it. The question of how often to check for stale locks is an issue. 5 mins should be plenty, but is it too much?
Hope this is of some help.
Dave

Like someone mentioned if round-up is the only test you have tried I would think you are not ready. A test engine such as jqplus yeilding those kind of marks would suggest you are ready. When I passed my certification exam I was hitting high 90's (with the odd 100) on round up and high 70's to mid 80's with jqplus.

Cheers
Dave


I'm finally finished the coding of my project. I still have LOADS of commenting to do, a little tidying up, and some testing of my server on a separate machine with multiple clients - that may lead to some very minor code changes but nothing drastic.
I hope to submit within a week, give or take.
Javaranch has been an amazing reference, I probably would not have made it through without.
"Hats off" to the owners, moderators and virutally everyone who has posted, without people to post there would be no forum.

Dave

When I started out with the whole thing I too wanted books to read. I quickly learned that the whole "book thing" wasn't such a good idea as one book will definately not cover all you need to know. I had the "Complete Java 2 Certification Study Guide" which has some usefull reading on the Developer certification in the second half. Other than that most of my reading came from http://java.sun.com/docs/ . I did go to a few books when it came to JTables, coudln't get enough reading on that. I found a few good pdf files online about jtables and design patterns in general as well. I don't have the links for these anymore and there is no reference to them within the files (that I could see). I just went to google.com and did searches on "jtable" and "java design".
Good luck.
Dave

I passed my SCJP in mid June. The first week in September I downloaded and began my project. I too had no "real world" experience. To date the only thing left to do with remote access is to code a thread on the server to check the times at which records were locked in order to remove stale locks. I'm using an adpater pattern to either connect remotely or locally. I have my client fully functional with the server at the moment, and I don't think local mode will pose much of a challenge at this point.
I will say though that along with way I hit lots of bumps, so to speak, but all in all it has been quite a learning and rewarding experience.

cheers,

Dave
Excellent.
I shall attempt to go about seat booking with a client id.

Dave
Interesting point.
Are we not allowed to change the signature of the lock()/unlock() methods?

Dave
Locking is the last thing I have to implement in my project.
Would this be an acceptable approach:
From the server, assign clients an ID, store this ID in something like a TreeSet. When the client goes to make an update to the db (book Seats) store the client id, along with the the record being updated, which will indicate a locked record. Then only that client will be allowed to unlock that record.
Then the issue of what happens if a client dies. During times when the server isn't busy run a lower priority thread to verify the existence of clients, then check the for the existence of any locks by non-existent clients and remove.
Any suggestions/comments welcomed...

Dave
Could someone let me know if this is an acceptable means of event handling for the developer project.
This is what I have proposed:
Whithin a class which houses my jtable, I will also have a search button and combo boxes etc. I will implement ActionListener in this class. From the actionEvent method I will pass the event as a parameter to my controller class (model-view-controller approach on my jtable) which will carry out the action, ie. searching, booking etc. The controller will then make the appropriate changes to the tablemodel and notify of this (using the observer/observable pattern).
Oh, I also am having a slight problem with displaying my JTable. I am currently placing my jtable in a jscrollpane. The problem is that if i set the size of my columns, the size of the jscrollpane remains the same, thus requiring scrolling to view all columns of the table. I've tried all sorts of different things with this but the size of the scrollpane remains the same. I would like to be able to view all colums at the same time. I'm considering just placing the table in a panel alone and then creating a JTableHeader.

Any tips on any of this greatly appreciated.
Dave
Sorry for not being able to give you a reply. I've been on a job for a few days and wasn't near a computer with a net connection.
Nice to be back at this.


Dave
You must purchase a voucher for each exam attempt.
If you fail once you have to wait a minimum of 2 weeks to do the exam again. But there are ways around that too. I know of people who failed by one question and went back 2 days later to do it again. If you fail a second time I believe you have to wait a month.
Dave
With LOTS of tinkering I finally created my server object. I'm now stuck on this error:
Problem with server: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: suncertify.db.RMIServer_Stub
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: suncertify.db.RMIServer_Stub
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: suncertify.db.RMIServer_Stub
java.lang.ClassNotFoundException: suncertify.db.RMIServer_Stub
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:354)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at suncertify.db.RMIServer.main(RMIServer.java:116)
Dave
I have (what i believe is) my server coded. In a nutshell I have my interface with the needed client methods from the data class and implemented them in my server class.
When I try to creat a new server object i get the following runtime error:
Problem with server: java.security.AccessControlException: access denied (java.io.FilePermission db.db write)
java.security.AccessControlException: access denied (java.io.FilePermission db.db write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at java.security.AccessController.checkPermission(AccessController.java:399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkWrite(SecurityManager.java:978)
at java.io.File.canWrite(File.java:516)
at suncertify.db.Data.<init>(Data.java:40)
at suncertify.db.RMIServer.<init>(RMIServer.java:25)
at suncertify.db.RMIServer.main(RMIServer.java:114)
Any light shed on this on this would be immensley appreciated.
Dave