Lucas Franceschi

Ranch Hand
+ Follow
since Nov 10, 2008
Lucas likes ...
Mac Mac OS X Ruby
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 Lucas Franceschi

hey there fellows,

it's been a while since my last visit to you guys, but you know we always remember the ranch when we need some help...
well, you guys are awesome, I can always count on you, right?

first, I posted this on servlets only because my app is a servlet, I dont even know where's the problem.

okay, done with introductions, I need some information (and maybe the possible solution) from you guys, as I am getting mad with this exception




annybody know this? right, by googling java.lang.verifyerror: Incompatible object argument for function call, i noted that this might be only a feature in java, that i dont know, that kind of, verifies the code (am I right?) and throws this exception if the code is insecure... the thing is that, if you look to the stacktrace, the code that is getting the exception is from an engine I use, jasperReports, and there's no way for me to edit its code.

what I need to know is: i use tomcat, from commandLine, we know that we can set the -noverify option, but when using tomcat, there's anyway for me to set this option??
also, this app runs on many servers, is there anyway that i can disable code verifying through the code? it would be an incovenient if i need to set this option on all the servers that run this.

Cheers!

APTS,
Lucas Franceschi

13 years ago
well, this class is dealing with database, so i am using java.sql.datetime... any changes?
14 years ago
hello fellows.
I hope you are all in good mood today!
because I need some help from you guys.

thats the problem:
I have (coming from an XML file) this String "2008-06-06 10:23:27.14" and this string: "2008-06-06" right?

so, I need to create Datatime and Data objects from this string.

I tryed to split the string, having 6 Strings, representing year, month, day, hour, minutes, seconds and nanos, and then use the constructor for timestamp using all this parameters.
beside, this constructor got deprecated, and I haven't got correct results (confused date and time).

Same happened with the date string.

So, what do you fellows say?
14 years ago
in this case, I believe practic ignores theory, we know you cant have an perfect software, JVM is not perfect, and by practice, i can say that jvm fails in saving memory, one time that when i call gc manually it saves me from an "OutOf MemoryError"...

anyone with me?
14 years ago
hmm... you have a good point.
but what if java itself runs out of memory whithout the calls??
it would be recommended for me to slow down the performance a little, and save the memory, so that i wont need to do desperate things, such as increasing java heap space.

am i wrong?
14 years ago
yeah, that explais also what iteration means.

so, calling system.gc() would be a good idea...

can anyone wonder why?
14 years ago

but then the code you are talking about has nothing to do with the code you posted


ok, sorry for that, lack of attention.

the test i ran was about running the program with and without the manual calling of GC, i'm sorry i can't give you a better example, so i'll try to do something really simple:



ok I think this time the code is better.

looking at the code:

1.for every loop, i'll create a new hashmap, put values to it, and pass it to another method as a parameter.
2.so, imagine the first lap, i created the first object, did the rest with it.
3.on the second lap, i'll create a new object, so the one i created on the first loop, will be classificated as garbage, right?

-in this case, if i dont call System.gc(), it holds a lot of memory, because of the hashmaps that was created on each loop.
-it seems that JVM dont collect garbage while i still loop, so that this garbage will be there using memory.
-if i collect the garbage on the beginning of each loop, pratically it saves a lot of memory.

right?
14 years ago
ok, thank you for the reply, but its kinda not explained yet.
well, I haven't payed attention to the fact that i'm not creating objects, but that's another case,
in other topic maybe we talk about the trim() method, it is, as well, another case.
it is important, but lets pay attention to the real problem.
assume that i'm creating three objects, and repeat the question.

I've just run a test, and the thing is:
-I had a full class without the System.gc() method being called.
-It held 800M of memory (yes, 800M)
-i used System.gc() on the beginning of every loop
-it held 200M of memory (yes, 600M less than before)

so i'm thinking that garbage collector does not work that well everytime. You said that it runs when really needed, what if java is weak on knowing when to GC? because in the class i had (the one that hel 800M of memory), i had OutOfMemoryError, as soon as garbage got excessive, and calling GC manually resulted in 600M of memory saved.

i dont want to be 'not-cool' with you guys, but we need to look at the real problem.

14 years ago
Its been a long time since my last question here guys, but always that I need, you help me, so I'm back...
the question now is not that complex or anything (if you see i've posted in begginners forum), its just about logic...

What is the logic of garbage collection, when dealing with loops?
Lets consider the following:

In this case, for each key i will loop again, and create three variables.
The question is: when one lap of this loop is finished, what happened to the variables created? My understanding is that the objects created in one lap, are, on the end of this lap, classificated as garbage, and so it should be collected. If its correct, when i loop a hundred thousand times something, i should have a lot of garbage, so it would take a lot of memory? would it be recommended for me to call the System.gc() method on the beginning of this loop?

please consider that i'm working with many hundred thousand laps.

help me guys?
14 years ago
well, i dont like to give the answer this way, but it would be evil to let the guy have all the suffering because of a typo.

hehe

I would help you with your problem, but it seems you already got an answer.




gracias.
14 years ago
well, but you wouldn't like to put all the cirectory for your classes in the classpath will you?

i'll assume no.

so its interesting for you to put a "." entry in classpath

try puttin' the string "." in your classpath.

if you're in windows, you can do this:
go to "my computer" properties>advanced>environment variables
then look for the CLASSPATH variable you setted before, and put ".;" before any ohther directory.

doing so will tell java to look always in the directory from where java.exe was called, so that instead of putting every directory on the classpath, you can simply make the java call for your program from the directory where are you're classes.
14 years ago
well, i dont want to give you the answer.
but this is really a typo, or lack of attention when typing.

when you type the line



you're using an semicolon that shouldn't be there, this will generate the infinite loop.

i'm sorry if I shouldn't give you the answer like that, but thats only lack of attention.
14 years ago
Oh yeah! almost forgot! welcome to the ranch fellows!
14 years ago
Well, as i'm a young programmer, regarding that I haven't studied that much java from books, I dont know if i can tell you how to start.

But I have a point: I think that considering that you have no background in programming, consider this:
Try some beginner's books (Java programming for dummies is a start, according to Mr. Westland), and dont try to learn it faster, try to really understand how does it works and why you need to do some procedures when programming.
You'll see, if you continue to programming, that it is much more important for you to know why you do something than only knowing how to do it right.
I would suggest for you to take a study on the programming process, you see, here in Brazil, last thing we learn on software development graduation is the java language.
I'm not trying to tell you that you'll need to know a lot of things before learning java, but you cant expect to make big softwares in few time...
Take your time for your study, if possible study the OOP before going into java, you'll understand it more clearly.

I can't tell you much, Because i'm only 16, and learned java by myself only on looking to codes and trying to do it (of course I had an base on programming before that).

So, i miss a deep study only in java theory, because in the practice i've learned how to use java to supply the needs of the software, and no book will learn you how to logically use the language, you can be a master at java's theory, but if you want to develop good software (not only on java), you need to have a bigger capacity to think logically, and to learn new things every day.

That's my point.

I pretty much think that I haven't helped you in nothing, but worth the try!
14 years ago