Ray Dawson

Ranch Hand
+ Follow
since Sep 16, 2011
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 Ray Dawson

Why do Oracle wants only rich people to become certified ?

Sean Keane wrote:

Ray Dawson wrote:do I have implement these interfaces

Have you implemented the inferface?

Did all the things that were required, infact better

Now I have to go through changing their names & parameters

Paul Clapham wrote:Well, assuming that the component you were thinking of was a JTabbedPane, you would do what the tutorial suggests:

How to Use Tabbed Panes wrote:To switch to a specific tab programmatically, use the setSelectedIndex or the setSelectedComponent methods.

Couldn't get that to work, could you give me an example ?

Here's my code :

10 years ago
I have a GUI with 3 tabs in JFrame in which I'm doing a small search task for a file.
If file not found then throw exception & show a certain tab on the frame.

So how can I change the view from the first tab to the a different tab on actionevent ?
10 years ago

instructions.html wrote: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 DBAccess {

So it said I must implement these interfaces.
I have done all that was required infact more than what was required

So do I have implement these interfaces or what I have done which does the same work is enough ?
I run the command rmiregistry

Does it generates stubs ??

Roel De Nijs wrote:

Ray Dawson wrote:What does the server check the LockCookie value against ?

You clearly don't understand the locking mechanism you have to implement and what's the purpose of this mechanism. Maybe you should read the part in ScjdFaq about the lock method to have a better understanding (and you'll be able to answer this question yourself)

I didn't read the FAQ, but here's what I did.

When new user creates a record a cookie file saved on his machine & a copy of the lockcookie is also saved on the server.
When the same record is accessed the server matches the cookie value on client's machine with its own stored value for that record, if it matches the record can be updated/ manipulated
What does the server check the LockCookie value against ?
I want to implement an interface with some methods, but all of these methods are static.
The problem now is all of the code which I have is for Client side & all are static i.e. about 300 variables & 50 functions calls are all done as static. But now if I want to change these back to non-static I have to create numerous objects.

Is there anyway I can use static methods in interface ???

BTW, I'm using RMI Remote Interface, how can I use static methods in RMI ???
10 years ago
I'm now building the RMI RemoteInterface where I have to give the methods of the server that the client can use.

But in the server I have many static methods which gives out an error as I add them to the interface.

As I remove the static from them, I get the error

So shall I remove the static variables & methods from the entire server class ?
Or how shall I proceed ?

Roberto Perillo wrote:Do you have a LAN where you can test your server (in your company, for instance)? Or, at least two computers in a LAN (it can be in your house, for instance)? If so, then you can start your server in a computer and try to connect to it from another computer. If it works, then you're fine.

Just did - It works!
Thanks a lot.

Now I have kept the default RMI port (i.e 1099) as the default port no. it will listen to. Now if the port is already taken / blocked its exception will thrown & caught in which we will change the port no. to a free local port while notifying the user.
For the master assignment, the client connects to the server through rmi.
The server runs on a particular port & the client gets the registry for that port & connects to it.

So I would like to get an advise from you guys that shall I randomly generate 4-digit port numbers which the server will use to create its rmiregistry ?
Like say if I use a fixed port for the server & that port is somehow blocked on the server machine then the ppl will have a hardtime fixing it, rather I'm generating a port no. which will get generated iff that port no. is not under use.

Campbell Ritchie wrote:And don't try mixing static and instance methods like that. The compiler won't like it.

Yeah that's one thing which I did try to avoid.

In my main program, I have about 5000 lines of code, with say about 30 functions. All are static & all variables are public & static.
I'm working on multiple threads right now, so you think having public static everywhere can make them thread-unsafe ?
10 years ago