Dario Stepanos

Greenhorn
+ Follow
since May 21, 2006
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 Dario Stepanos

If you are developing using the Eclipse IDE, you might want to look at TPTP (http://www.eclipse.org/tptp/). Similarly to Joachim, it is the only profiler I've used, so I don't know if it is the most popular one in the industry.

Bear Bibeault wrote:Look at the code that started this thread. You find all the unnecessary try and catching in it acceptable?



I agree the catch( Exception e ) is bad design. We should catch explicit exceptions or declared them in a throws clause. That is being explicit. Why shouldn't we be explicit by nulling out values?
15 years ago

Bear Bibeault wrote:I disagree. It adds to code bloat and makes the code unnecessarily complex and confusing. Especially to those that don't know any better. Look at the code that started this thread. You find all the unnecessary try and catching in it acceptable?



My question is, if we always have to explicitely initialize variables, why is it bad to explicitely null out variables when we are done with them?
15 years ago

Ernest Friedman-Hill wrote:

Returning from the method in which the local variable is declared has the same effect, without running any extra code. This kind of thing is a terrible anti-pattern; it's pretty much cargo-cult programming.

Here, the variables will disappear immediately after the nulling code, and so that's just silly.



I agree with you here. I just prefer to be explicit. There is no harm in always nulling variables out. It takes two seconds to write a line of code that will null out a variable. Plus, it is an easy way and straightforward way to explain the concept of garbage collection and nulling out values to a beginner.

I agree with your programming style, I am just expressing my point of view. Different people have different programming styles.

Correct me if I'm wrong.
15 years ago
When you set a variable to null, you are telling the garbage collector that you don't need that variable anymore. When the garbage collector notices that you don't need that variable, it will consider the memory taken by the variable as free and it will allocate it for something else when it is needed.

Let me know if you have more questions,

Jeremie
15 years ago
Hi Jigar,

The finally clause is usually used to "clean" resources, as you mentioned. Cleaning means setting your variables to null and closing resources. In your example, I would add documentBuilder.close() to the finally clause. It will affect performance, as the garbage collector will be able to detect unreferenced variables more quickly if you always assign null to your variables once you are done using them. It is essential to close all resources when you are done using them.



Regards,

Jeremie
15 years ago
Oh... ORing as in a verb. It was too simple for me. Thanks for the really complete and accurate answer. I've got to say that was a post of very high-quality. Keep up the good work!
17 years ago
I was reading a Java book and it mentionned about 'ORing'. From my search on the internet, it looks to be a flag, but could someone explain (or give a link) me what is ORing? Thanks a lot to all!

17 years ago
Hi,

I've just installed the latest version of J2SE 1.6.0 from the Java site, and it works well except that when I enter javac Test.java in the Command prompt, nothing shows up. When I enter simply javac, you would normally see all the options of the compiler but I get a message that

'javac' is not recognized as an internal or external command,
operable program or batch file.

which means it doesn't run it. Would you know how to get to run it?

Thanks Ranchers!

J�r�mie
17 years ago
Here's is what I've found about it:

Unit of least precision. It is used to discuss the accuracy of floating-point data. It represents the minimum step between representable values near a desired number: the true result to infinite precision, assuming the argument is exact. For instance, the ulp of 1.977436582E+22 is 1.0E+13, since the least significant (leftmost) digit of the mantissa is in the 10 13 place. Within 0.5 ulp is the best approximation representable.

My questions are, what is a minimum step and how do we get to 0.5 ulp (what is the calculation)?

Many thanks for your time,

SKiNZ
17 years ago
Thanks Ernest, very complete and accurate post! I can't wait for the day that I'll become a great programmer just like some ppl around here(hopefully I'll get there someday ).
17 years ago
Hi,

I understand what the IEEEremainder method does, but could anyone give me a real-life application of why would I prefer using the IEEEremainder method rather than the modulo operation? (I don't need the code, it's just I can figure out what it would be useful for, and my search on the subject was inconclusive.)

Secondly, there are many articles related to IEEE 754 floating-point standard. Is it really important as a programmer to know those things? It's just because there's a 79 page document to read, and before reading it I'd like to know it is as much important as they say.

Thanks a lot to all of you ranchers!
17 years ago
Hi,

This looks like a silly question but I'd like to know how should I read a book? Let me explain my situation: I'm a really slow reader but when I read I try to understand everything and I ask myself a hundred questions that help me understand what the book is not telling me. The pros of it is that I finish the book and I understand every aspect of it. The cons of it is that it takes me forever. So am I doing right or should I faster or any other suggestions?

Thanks!
[ May 21, 2006: Message edited by: Jeremie Blais ]
17 years ago
Here's is what I've found about it:

Unit of least precision. It is used to discuss the accuracy of floating-point data. It represents the minimum step between representable values near a desired number: the true result to infinite precision, assuming the argument is exact. For instance, the ulp of 1.977436582E+22 is 1.0E+13, since the least significant (leftmost) digit of the mantissa is in the 10 13 place. Within 0.5 ulp is the best approximation representable.

My questions are, what is a minimum step and how do we get to 0.5 ulp (what is the calculation)?

Many thanks for your time,

SKiNZ
17 years ago