cristian zoccarato

Greenhorn
+ Follow
since Nov 15, 2013
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 cristian zoccarato

I solved this issue by copying the external jars that are inside my lib folder into a new lib inside "dist" folder where i create the main app .jar file. I have to do it manually.
Now looking for some Ant command to have it automatically.
8 years ago
goodmorning, I'm facing a problem and, on all the solutions I found online, I still can't understand what I'm doing wrong.
I have a java appplication that connects to a database and can send out email to the user. On eclipse it works perfectly.
I proceeded on build an Ant file in order to compile, create database, make a jar file and clean up.
The build is successful and the jar file executes without troubles but, when I try to do some operation with database (using postgres) it shows this exception:



I understand that it's missing the postgres driver...but on all the solutions I found (and tried) online I'm still facing this issue...
here's my build.xml file



all the external jars are into the lib directory in the main project folder.
What I am doing wrong?
thank you for your help..
8 years ago
Hi, thanks for quick reply.
As far as I understood, every time the user does some operation with database the connection counter add one until 20 is reached, then the app stops working.
So that means that there's nothing I can do by coding, right?

Also, that means that another user (for instance, a player on my game site) has to restart heroku by himself or what's done by me is enough?
First of all, if I wrote on the wrong section or it's somehow off-topic let me apologize myself.

I'm running my application on Heroku and after a certain amount of "use" I get a 500 error on browser. Heroku logs reports this error:

I'm on a hobby tier profile on Heroku so I know that there are limited connections per single user (up to 20). I tried to set the duration of my session at 10 mins but the problem remains.

How can I solve it without manually restarting Heroku every time?
thanks in advance!
I finally solved it.
I followed your suggestion Bear, and checked (with more attention this time) my script on browser's debugging tools. It seems that some syntax error "altered" the data that javascript received.
So instead of getting a



I got something like



The "plus" caused this syntax error. That's because I wanted to have some "proof" that my Game's methods were working correctly (and printing that in the console).
Line 44 in my code was the "guilty" one. I removed it and everything worked fine.


A lesson learned for the future. Less "printing for proofs" and more debugging tools use.
Thanks for your help Bear!
Hi. I tried with browser's tools and yes, the servlet returns the data correctly.
What I meant was, it has to do with Asynchronous calls from javascript to servlet that causes this erratic behaviour?
Hello everybody. I know, this question might have been asked million times and I tried million solutions..but I'm still stuck in my troubles. I'm having a problem with a servlet sending back data (in JSON format) to a javascript function that previously sent it some data inserted by the user (a 4 digit number). In few words, I'm developing a poor man's mastermind game.
My problem is: I, SOMETIMES, get some data, some others I don't get anything displayed on the index.html page!
This thing is confusing me. Is it about the A-part of the AJAX word?

here's my code.



and this is my "check" function in Javascript



I think it doesn't look so "odd" but it still doesn't work. For most of the time it shows the error message up into the "display" <div> I put in my page. JSONObject is correct and correctly printed in the console.
What I am doing wrong? This thing is giving me headaches.
thanks for your help!
Yeah, you're right. I forgot to remove it on the code I posted here but I did on the one I compiled. It seems it works fine now. I tried adding more and more horses (up to 100) as well as for adding "seats" (or whatever kind of word fits for it) in the watertrough and it seems working...but, as you rightly suggested, I need to experiment more and do some checkings!
Thanks for your help!
C.
Thanks Luke!
I think I considered Semaphore but for unknown reasons I never went for it. So, i never used and tried to do something with it. Do you think it is correct?



I added both acquire() and release() into the getDrink() method. It "seems" working but I'm really not sure about...
(I know, the topic's title is not the best but I think that explaining my "problem" will make it clearer..Also, in case there's already a topic about this, please let me point to it)

I'll try to be short.
I found the classic Horse Racing code in which four horses run for 3 laps on a field. This code can provide the time each horse runs a lap and it was added the funny feature of a WaterTrough. It just gives a random time the horse uses to drink water.
This is the WaterTrough class code



So, it seems that just one horse can access this "water trough area". But, what if I would like to let 2, or 3 horses accessing the area at the same time?
Thanks in advance to whomever will help
Thanks Campbell for your precious advices about Listeners. Actually I'm trying to make my code less "fat" and trying to be more familiar with these features..I'm close to find a good solution for my problem..
10 years ago
Thanks for answering..I'm trying to give all the informations you need.
when i run the code it happens this:
nothing happens for a little while..then a big number of these error lines appear on the screen and cannot scroll back to the beginning and tell what happened. A very long list and cannot see even the top of the terminal.
I think I should try-catch an exception but I'm just supposing..

What seems to create troubles is the fact that I put the actions happening when I press a button in the Listener class.
Things such as "setEnable(false)" buttons or setText(). But, whenever I try to compile it rightly says that can't recognize those buttons. So I instantiated a new GUI object in the Listener class
and put it before every button. But that seems not right to me.

[EDIT/UPDATE]
I added

into the GUI constructor and it seems I found the name of the error:
Exception in thread "main" java.lang.NullPointerException
at EsdGUI.<init>(EsdGUI.java:55)
at EsdGUI.main(EsdGUI.java:163)

it points here:


and here



so it seems it points to somewhere null...side question: if it says "<init>, does it means that is that the place where the exception is generated?
10 years ago
Hello! thanks for your advices!
About the IF(s) in Listeners..well I had the same feeling but I didn't know if it was a good idea or not to have one listener for each button. I'll follow you advice...

About my other problem...I passed through several kinds of errors..but, if I compile this code the only one I get is (when compiling EsdActions)
"cammot find symbol"..and this to EVERY button (such as "print", "release" etc).
I tried to instantiate a EsdGUI object in the listener class but that doesn't work..
I know solution is right in front of me but can't see that clearly...

[EDIT]

I followed your suggestion and created an external class RsListener that extends EsdGUI with a single listener for the button SinusalRhythm.

I also put this, into EsdGUI code

but when it comes compiling I get a very long list of this error
at EsdGUI.<init>(EsdGUI.java:49)
at RsListener.<init>(RsListener.java:15)
at EsdGUI.<init>(EsdGUI.java:49)
at RsListener.<init>(RsListener.java:15)
that points at the line 49 I posted above and the introducing line into RsListener class which says

but, if I remove "extends EsdGUI" I know I will get an error since the buttons in there wouldn't be recognized as part of the EsdGUI class...
What I'm doing wrong now?
10 years ago
Hello everybody, I know this problem has been discussed several times and I tried every possible solution but, after hours and hours I'm still in the mud.
My problem: I wrote a small application that should simulate a defibrillator and I would like to split the GUI from the actionListener(s).
I did it and both classes do the compiling...but when it comes to run it..it comes with this error:
at EsdGUI.<init>(EsdGUI.java:39)
at EsdActions.<init>(EsdActions.java:16)

I see there's something wrong with the instantiation of the Listener class (which I called EsdActions) in the main class (EsdGUI) as well for the other class I'm not including here that deals with the ItemListener (called ItemHandler),

Don't really know what's wrong with that. I tried to do some rewriting but, since my skills are not so well-developed, I'm stuck into problems.

My solution was: create an instance of the class of Listeners into the GUI class, then add the actionlisteners to the components. I do that, and still nothing happens.
Is there anyone who can give me some advice? Where i do wrong?

I apologize in advance for the lenght of my code but this, as well as the will of satisfy the Observer Pattern is what's giving me headaches...
So here's the main class


and here's the listeners class...



I hope the topic includes scrollbars....thanks in advance to whoever would like to help me.
10 years ago