Laurence Turpin

+ Follow
since May 21, 2012
Merit badge: grant badges
For More
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 Laurence Turpin

Thank you Micheal Joyner for your reply my program now works.
I had to make a few additional changes to the Rpc return types.
I have shown the new code below.

The addToTable method also needed changing too as shown below
11 years ago
Thank you Manesh Godbole for replying to my problem.
If you look at the code for RpcServiceImpl.storeContact method line 39 you will see that I have already printed the array size to the console

Each time I enter a new set of values the array is incremented to a larger size as you can see in the stack trace lines 12, 15, and 19
I have repeated the what I have sent to the console below

Note that in the last name and address I entered is Phil Mitchell 7 Albert Square
He appears to be in the datastore and the array is set for 3 entitys
So why is he not in the result? This is the problem
The following 3 lines give me the array size and display the array size to the console. These three lines appear to be working

Why is Phil Mitchell in the datastore and is counted as in the datastore, but the for loop cannot find him?
11 years ago

I'm using Windows 7 Eclipse Juno with the latest Google App Engine plugin.
I'm trying to write a program to check I understand how to store things in the Google App Engine datastore and also how to use GWT RPC.

The program has 2 text boxes for entering a name and address.
See the following image.

The name and address values are placed in a object called ContactDetails which is kept in the shared directory.
They are passed to to the datastore using GWT RPC and placed in a Entity kind called storedcontact.
The image below shows my directory structure.

The Image below shows the values getting stored in the development datastore.

Once in the datastore the I retrieve all the names and addresses from the datastore
Then I return them back to client side via the GWT RPC and display them in a flex table as shown below

The problem is it works a couple of times and then it fails.
I put in some system.out.println statements in an effort to diagnose the problem.
Below is the console display:

I can't understand why it will work twice and then fail?
below is my code.

11 years ago
At last I have managed to get this to work.
I reinstalled a new version of eclipse Juno release.
and the latest version of the gae plugin 4.2
The latest plugin includes a persistence.xml
The difference between the persistence.xml that I was using and this one
is in the <provider> section.

In the new persistence.xml it is:


Anyway all is working now.
11 years ago

I'm using Windows 7, Eclipse Indigo and GAE 1.6.6
I'm trying to learn how to use Java Persistence API on Google App Engine.
At this moment I'm trying to do the example from the following site vogella

I have the following package structure:

When I run the program it fails with an http error 500 and says javax persistence is a restricted class

Here is the code for the file

Here is the code for

Here is the file:

Here is the web.xml file:

This is the persistence.xml

and finally the error trace
11 years ago
Finally managed to work out how to do the while loop.
Here is the solution shown below.

11 years ago
Thank you Paul Clapham for replying I now have a program that works.
I replaced line 69 with :

Node sessionNode = trainingLogDom.getElementsByTagName("session").item(i);

I replaced item(i) where ever item(0) occurred in my program.

It now works
However I still have one query.
Suppose that the number of sessions were 100s or more.
They would be too many to count.
What I really need to be able to do is parse all the session elements without know how many there are?

The basic structure of the loop needs to be:
While session elements to parse
parse session element
get next session element

Below is the revised program I now have

11 years ago

I'm using GWT 2.4 on Windows 7
I'm trying to parse the following XML file:

The problem is there are 3 session nodes and I need have a loop in my program.
so it is:

While session
parse session
get next session

but I don't know how to do the loop.
I have tried to do it with a for loop but it doesn't work correctly.
I get the first session data 3 times.
When what I want is all of the 3 different session information.

Here is the program I have so far:

The for loop is where the problem is

11 years ago

I resolved my problem.
I found that I had imported the wrong namespace.
I changed the imports for both Text and Element and my program worked.
11 years ago

I'm using GWT 2.4 on Windows 7
I'm trying to learn how to read in an xml file from the tutorial at DevGuideXML
It gives instruction on how to get the information from xml that is in a string.
Unfortunately it does not give any information about how to get the xml file into a string.
I found the answer to the following query at stackflow helpful Stackflow
I'm not sure where I should put the xml file in my project.
If I put the xml file in clients package or the server package I get a warning.
The warning occurs when I run the program, it says that it has not found the xml file.
If I put the xml file in the war package the warning stops but the file still does seem to be getting read

Where should I put the xml file?

Here is the contents of the xml file:

Here is my java code to read the xml file:

What I need to know is which package I put the xml file?
Is this code correct?
11 years ago
Thank you Manesh Godbole for your reply which has solved my problem.
Below is the corrected program.

11 years ago

I'm using GWT 2.4 on Windows 7.
I am writing a program with 3 checkboxes
marked as Red Green and Blue.
Inside the onClick() method I wish to identify which checkbox was clicked.
The program I have at the moment is shown below:

Inside the Window.alert() method I wish to put the checkbox that was clicked, but do not know how to identify it.
It can be done with 3 different handler classes.
One for each checkbox but that does not seem to be an efficient way of doing it.
Has anyone any ideas?
11 years ago
I finally managed to resolve my problem.
Thank you everyone for your help.
Below is the solution:

11 years ago
Thank you for your reply Maneesh Godbole.
I'm still having problems below is my latest attempt at resolving the problem.
I get an error on one line and a warning on the line next to it.
I have marked the error line and the warning line as a comment in the code shown below.
Below my latest coding attempt I have reproduced the error message and warning message from eclipse


Inside Eclipse I get the following error message for the line I have marked as the error line:

Multiple markers at this line
- The type new SelectionHandler<TreeItem>(){} must implement the inherited abstract
method SelectionHandler<TreeItem>.onSelection(SelectionEvent<TreeItem>)
- The type new TreeListener(){} must implement the inherited abstract method

Inside Eclipse I get the following warning message for the line I have marked as the warning line:

The method onTreeItemSelected(TreeItem) from the type new SelectionHandler<TreeItem>(){} is never used locally

I have also tried replacing the error line with the following which also does not work:

categoryTree.addSelectionHandler(new SelectionHandler() {
11 years ago
Thank you Rob Spoor for replying to my problem.
Unfortunately I'm not clever enough or experienced enough to work out how to rewrite the method from the Javadoc
The full method is shown below can you show me how to rewrite it please:

11 years ago