Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

John O'Donoghue

Greenhorn
+ Follow
since Jan 09, 2013
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
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John O'Donoghue

Hi Maxim

Thank you for the reply. It has given me a lot to think about.

Under the heading JDBC Connection Properties in Eclipse, I chose the option of Derby Embedded JDBC Driver. Is that the same as the "JDBC transaction with a proper transaction isolation level" property that you mention?

At present the database is set to the default setting of autocommit so I need to investigate that further.

John

I have been writing a small banking application just so I could explore SQL and client server programming in java.

Everything went well and the system performs perfectly when I sent one transaction at a time.

However when I wrote a small program to pump transactions at the server from different clients, I started to lose transactions.

I have hunted around for solutions but I am stuck. Any help would be appreciated as when I get over this problem I want to develop
a web interface to the database and then after that a mobile interface from a smart phone.

Anyway I have posted a cut down version of the database handling code called BackEnd.java and the program that pumps a user specified amount of transactions at the back end from the command line ........ e.g. "TestBank3 100" will send 50 transactions of $1 to account numbers 1 and 2.

If I send about 1000 transactions, most of the time none are lost. However send 200000 and then I lose about 10 of them.

I have played around with different values for Thread.sleep() and the ones in the code are the most reliable.



Here is the program that pumps the transactions.

It was a set up problem.

When I was making the runnable jar file, I wasn't setting the "Launch Configuration" settings properly.
7 years ago
I think it is a setup problem as even classes that produced runnable jar files before now produce the same error if I make new jar files from them.

The command I am using is "java -jar ClassName.jar" which worked for the older jar files but not for new ones.
7 years ago
I have posted the code below. As you can see there is no mention of any dates and the input file is just plain text.

Could it be a set-up problem with how my eclipse installation produces jar files.


7 years ago
I am getting the following message when I try to run a program as a runnable jar file:

Parse Successful
Date with native format: Thu Aug 22 00:00:00 BST 2013
Formatted date : 08/22/2013
java.text.ParseException: Unparseable date: "try this to invoke try-catch"

Problem is that in the code I am not dealing with dates. Also it runs perfectly when run from eclipse.

The code does read in a file a line at a time and one of the fields in the line uses a date that has already been converted into a string and modified so it just looks like a string.

Thanks in advance

John

7 years ago
I don't understand why the object reference variable 'a' cannot be recast from a thisA object reference to a thisB object reference.

Is it the case that once a reference variable is linked to a particular object type then it cannot switch object types later on.

I am facing the Java Associate Developer exam soon and I am just clearing up some issues in my head around object reference variable assignment,

John



7 years ago
It never dawned on me to look at the html generated. The problem was obvious in seconds. I had left a out.println(">"); out of the code.

Thanks for the suggestion.

John
9 years ago
JSP
Hi all

I have been trying for a week to solve a strange problem in the BeerSelect problem in Chapter 10 of Head First's Servlets & JSP Book.

I can get the code to run perfectly except that when I call the initial jsp page up in the browser, only Amber, Brown and Dark appear as options. I can't get Light to appear. If I select either amber, brown or dark I always get the right options back in results.jsp so I think everything after the initial BeerSelect.jsp pages must be working correctly.

When I put in various setAttributes and getAttributes I can see that all four beer types are there in the Container and I can get the full list of options to appear on the results.jsp page by calling getAttribute on the optionsList attribute in the code below. Also if I put an empty option in before "Light" in the BeerExpert.java file, all four options appear.

However the initial html selection field (from BeerSelect.jsp) won't show "light" which is the first of the 4 options.

Has anyone else come across this.


9 years ago
JSP