Ed Ward

Ranch Hand
+ Follow
since Jan 30, 2006
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 Ed Ward

Roel De Nijs wrote:But in my opinion avoiding code duplication is always a good thing and if you need a few switch statements it's a very little price you have to pay for it

My sentiment as well.
I just wanted to make sure I wasn't risking loss of points because I had GUI config code shared/mixed between the server config UI and the stand alone client config UI. Will be sure to justify.

Thanks again!
Yea, I have them implemented in my Data class and when I did the stand alone client I only exposed the two methods needed for the UI. When I started the server/client implementation, for some reason I forgot that and made them all available; afterwhich I realized that because the UI only allows search and book, the other biz methods were never going to be called in this version.
Thanks for the sanity check!
Hi again, another question.
I plan to only implement search and update in my UI, but of course the other methods in the provided interface are implemented in the Data class per the spec.
That being the case, I was wondering if other's accomodated for just search and create on the server implementation as well or if at that point the methods in the provided interface were also available.
Seems like, since only search and create are required in the UI, the server should not make them available either and maybe throw an UnsupportedOperationException if a request comes across trying to invoke anything other than search or update

Seem reasonable?

Hi all,

I'm trying to finsih up Urlybird and was wondering what others have done or are doing regarding the server console and client configuration dialog. I was considering having one configuration dialog class that, depending on the run mode, assembles a configuration GUI for a stand-alone client (select local db file), network client (enter server host and port) or the server console (select local db file and enter port).
At first I thought this was a good idea as it would save on duplicated code (in two of these scenarios the user must be able to select a database file and in two they must be able to enter a port number) so I started coding JPanels that could be reused.
However, after getting it working I'm thinking, while it does eliminate duplicated code, it seems to present unecessary complexity because I end up with a number of switch statements which execute different logic based on the run mode.
If the config dialog code was separated into classes based on the run mode, I think the code is a little easier to follow for a junior programmer but some duplication is likely to happen.
I feel this may be the better option and just justify it in choices.txt.

Feeback please. Thanks.
That's what I had in mind, but the wording threw me off a little.
Greetings all!
I've just donwloaded the Urlybird assignment and have read through the instructions just once so far, but was wondering if I'm understanding this correctly.
The interface I must implement has the following method:

Now my question. Given that the method takes a recNo parameter and the first comment states that the method reads a record from the file, it seems that the second comment contradicts that by stateing the method returns an array where each element is a record.
It seems like if the method takes recNo and reads a record than each element in the returned String[] would be a field from that record, as opposed to each element being an entire record.

Am I missing the point?

Thanks, Ed.
Where did "stmt" come from?
You sure you do not want to do prepStmt.executeQuery() since you went through the trouble of prepping it?
stmt.executeQuery(sql) in your code is attempting to execute the raw SQL statement, with the ? which has not yet been set.

Least, looks that way to me.
I think it depends on how you intend to use it.
If you only want a reading device, then I think the Kindle stands far above the rest. Part of the reason is the "no-glare" screen. Keep in mind though, it is a reading only device at the moment and black/white.

However, if you want a more general purpose device, one that you can do more than just read books, magazines, newspapers, etc. on, then you'll want to look at one of the other devices.

So first decide exactly how you intend to use it and then how much you are willing to spend.

Not too helpful I know, but as you stated, this is subjective.
13 years ago
Well, just looking at the little code you've provided I suspect that where you have

you may really mean to have

Also, to compile, just navigate to the classes directory (don't go into mypackage) and drop the -d parameter.
If your source files are in the mypackage dir (they should be) then enter the following:

There are numerous ways to do this but that should get you going I hope.
13 years ago
Without actually seeing the query, one can only speculate.
The other thing I would check is to make sure your proggie is connecting to the correct database.
Sounds odd I know, but stranger things have happened.
You sure about that date format?
Do you gt an error message at all?
Maybe try printing out the value of the "query" String reference just before you execute it in the program so you can see what is actually being executed. From time to time this is very enlightening for me.

BTW, this is probably better suited for the JDBC/SQL forum.
Greetings Louis!

1. You do not need to have %JAVA_HOME%/jre/lib on your class path. Anything there is automatically on the classpath.

2. You do NOT need to be in your project directory to execute your class files which have been declared to be in a package.

3. You DO need to have the root directory that contains the class files you want to execute on your class path, assuming those classes are in a package. So, if the class file you want to execute is in a package named "com.louiskounios" and that is in a directory named "classes" then set your class path to C:/whateverthepathis/classes or include it on the command line like this:

java -cp "C:/Java Programs/classes" com.louiskounios.<ClassName>

Note that to execute the above my current directory could be C:/someotherdir

If the class you want to execute is not in a package, then you should not need to specify a classpath, if you are in the same directory that the class file is in. Assuming my current directory is "C:/Java Programs/classes", the command would look lik this:

java <ClassName>

It sounds like you were previously were not putting them in a package which is why you had no problems. Now that you are putting them in a package you need to tell the JRE where to start looking for the package name.

Extra: If the class files you want to execute are in a jar file, then the full path to the jar itself needs to be included on the classpath and then the fully qualified class name. In that scenario, the above command might look like this:

java -cp "C:/whateverthepathis/jarfile.jar" com.louiskounios.<ClassName>

Hope this gets you have the hurdle!
13 years ago
Sounds like maybe a case for javax.servlet.http.Cookie
When they first visit, or download, set one and store IP address and maybe some other values for identification as well.
Of course, this won't prevent them from simply clearing the browser cookie cache or changing IP's between download attempts, but if they do not require a user id, there is only so much that can be done I think.
13 years ago
Sounds like you have a plan.
Good luck.
13 years ago
You didn't give much info but I can say that

works just fine for me on 1.6.0_22.
Are you sure about the value and format being passed in?
What line number does the stacktrace report the Exception on?
Is it where you call Timestamp.valueOf(String); ?
13 years ago