Ben Flowers

Greenhorn
+ Follow
since Sep 12, 2011
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 Ben Flowers

Thanks William,
Would that not mean that the client would have to continualy check the chatbuffer rather than simply being informed of when it changes state?
Ben
12 years ago
Thanks Pat,
Tried looking at some examples of REST. I cant really see how REST can perform an RPC on the client side though?
Do you know where there is any tutorials etc... as i cant seem to find any
Cheers,
Ben
12 years ago
I cant see anywhere in the code where you are actually looking up the server from the rmi registry (althoguh i did only havce a quick glance)
In your server code you need to extend UnicastRemoteObject and write the name of the server to the RMIRegistry with Naming.bind() (or use the static methods of UnicastRemoteObject)

Then you need to start the RMIRegistry with either
for linux/mac
or
for windows

Then you can launch your server, which will bind itself to the RMIRegistry.

Once the rmiregistry has been started and your server is online you can run your client.

In your client code you need to use the naming service to lookup your server


if you are doing it over two remote machines then you MUST install a security manager.

Hope that helps
-Ben
12 years ago
Hi,
I am trying to implement a chat server on the amazon EC2 cloud for a university project.I have decided to use callbacks on the client end using the observer pattern
I initially thought of using RMI but it was an absolute pain to get working on EC2 with callbacks, and i would be limited to using java clients.
So i switched to JAX-WS so that i could use SOAP on a given client, but i can only seem to send messages to the server and get data back when the client requests it rather than the sever update observers when data has been changed (e.g. the client sends a message to the chatroom)

So i thought i would ask, does anyone know what would be a good solution to my problem?
I need to be able to make callbacks from the server to the client and not be limited to Java clients.
Is this possible?
Any help would be great, even if it is only to tell me i NEED to use RMI
Thanks,
Ben
12 years ago
Hi, basically i am writing an RMI based java application and ive written some scripts to run and comile it.
The compile scipt is:


and to run the server i run the script:


if i type those exact commands in the same order i get an exception and the server fails.
if i run the scripts from the command line i get the same exception
but if i run them from the GUI the server works perfectly.
THIS IS DRIVING ME INSANE. does anyone have a clue why this is happening and how i can fix it??
Thanks,
Ben


the exception i am getting is:
12 years ago
Hi,
Im writing an RMI based chat program and its working fine when i compile it by the command line with javac and rmic.
However when ive put it into eclipse im getting the followign errors and i cant tell why:


i have tried it in packages and allunder the default package. I have also generated the stubs etc.. int he bin folder to see if that would work...
But nothing.
Do i need to configure something in eclipse?
Thanks,
Ben
12 years ago
Hi Basicaly im trying to save my object to file, but im getting a NotSerializableException
However if i create a new object then it works fine.


the above code fails on the second line but the first runs?
Does anyone knwo why this is happening or how i can fix this?
Thanks,
Ben
12 years ago
Cheers Guys Solved it.
Heres the code incase someone comes accross a similar error in the future:


i also synchronized tillQueue

-Ben
I threw in a dialog box, which comes up when the error occurs so i could see exactly what the program is doing when i run it. When the error occurs, the JPanel stops updating with the drawing of the images untill i resizes the JFrame. So im guessing its something to do with the drawImage and the for each loop with the person....




Line 61 corresponds to: for( Person o: tillQueue)


line 66 corresponds to: switch(o.getType())
Thanks,
Ben
Hi,
Im getting this error when i run my program, Its running 4 instances of the same class, the code where the error is comign from is:
(tillQueue is a Queue of type person ( Queue<Person> tillQueue = new LinkedList<Person>(); )


I tried making the function synchronized but im getting the same error. Does anyone know how to fix this?
ALSO im getting some nullpointer exceptions on the for-each loop. Why is that happening, surely the loop just cycles through the tillQueue?

Thanks,
Ben
Hi Basically in my DB i have a police_officer and appointment table
in the police officer table there may be many ranks, but in the appointment table there can only be sergeants.
I.e. to make an appointment the police officer must be a sergeant.


when i put a constrain of


(rank_id = 2 = sergeant)
This doesnt work as subqueries are not allowed, ive tried to write a trigger but cant seem to get it working. Does know a good way to get around this?
Thanks,
Ben
Its a part of a uni project, so i have to have the class the way it is. I.e. a cloning constructor, with a method which copies itself to another object and the protected variabled (which i totally agree is stupid) and the char gender.
Thanks for the suggestions guys,
Ben
12 years ago
Oh right thats annoying. I've done a work around by just using the setMethods() for the target value. Is there a more elegant way to do it?
Cheers,
Ben
12 years ago
Target is an Object though, Java passes an Object by refernce so it should effect the actual values right?
And i thought the java convention was to use lower case on primitive values and upper case on objects?
Cheers,
Ben
12 years ago