Win a copy of Head First Go this week in the Go forum!

Paul Clapham

+ Follow
since Oct 14, 2005
Paul likes ...
Eclipse IDE Firefox Browser MySQL Database
Vancouver, Canada
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 Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Paul Clapham

Sam Ritter wrote:In this case if I use JColorChooser.showDialog, how would I set the location? Eventually I will need to set other customizations before displaying the dialog. I need the instance of JColorChooser to do that, right? Obviously I am still missing something.

When you find yourself asking that kind of question, your Google keywords should be JColorChooser tutorial.

Hopefully the first link you get back from Mr. Google will be an Oracle tutorial. Like this one: How to Use Color Choosers.
5 hours ago

Saikrishnan Srivatsan wrote:

If you're using a Queue for stops, how are you going to insert a stop when it turns out that inserting a stop is more efficient than adding the stop at the end of the queue?

Added a comment and changed the type to a PriorityQueue. Will this work?

I am doubtful about that. If you're going to have strategies which control how the elevators work, wouldn't the PriorityQueue have to know about what strategy the elevator is using?

Or is it that the strategy is used to decide whether or not to add a floor to an elevator's queue?
5 hours ago
That could be the case. In fact it probably is the case. It's active in my Java control panel and I have in the past used applets and JNLP applications.

But I'm not sure what you mean by the "old Web Start settings". There aren't any settings accessed via that "View" button.
1 day ago
Looks to me like it's in

8.8 Constructor Declarations

8.8.7 Constructor Body Explicit Constructor Invocations

The answer to your specific question is near the beginning of section 8.8.7.

By the way I'm looking at the JLS for Java 8 -- other versions may be numbered differently.
1 day ago
If there's a possibility that a String might be empty, and therefore you would have a problem trying to find the first character of the String, then before you try to find the first character you should check to see if the String is empty. If it is, then do something else.
1 day ago

vinoth sathi wrote:What is the issue?

That's a good question. I would suggest you start by finding out. Are there no logs? Are you not examining the output from syserr when you run that command?

There could be all kinds of things wrong. One thing I notice right away is that you're executing a command in the current working directory. Tomcat's current working directory is unlikely to be the place where you stored your daily.bat file. But there could be a lot of other issues to deal with besides that.
3 days ago
Well, first of all you do realize that those calculations in the java.math classes don't actually calculate the logarithms of the numbers they are given? They compute a very good (from the human point of view) approximation to the logarithms, but they can't compute the exact values because almost all logarithms are irrational and Java's double values can only represent rational numbers.

There is no possible calculation which can return the decimal expansion of log(3) because it would take forever to compute the infinite number of unpredictable decimal places.

However mathematicians care nothing for that because it's perfectly possible to do arithmetic with log(3). For example 2 * log(3) = log(9). As long as you don't care about displaying decimal values, it's all fine.

As for what kind of calculations are used in the real world to calculate the approximate value of a logarithm, I would expect that there's some kind of Taylor series (or similar) which is evaluated one step at a time until the steps are too small to make a difference. And no doubt there's a whole lot of optimization involved which makes the actual calculations run a lot faster then the naive version which I just described.

Jim Venolia wrote:Somehow my input (which I get via email) got some odd characters in it.


Sorry... I spent a lot of my working life writing code which parsed data from e-mails and did business-critical things based on the results. It's surprising how many different ways there are to get that wrong.
5 days ago

Campbell Ritchie wrote:I am not convinced that λs are an advanced topic myself.

No, but for rookies who have been raised on a diet of arrays and basic for-loops and data read from the console, it's something completely different.
5 days ago

Ds Sena wrote:line 60

And therefore line 60 was never executed.

I notice there's a constant named TOL which I assume means "Tolerance". When you're doing this kind of calculation with double values, you can get small errors due to rounding. So instead of waiting until you get to zero, you wait until you get within the tolerance value, and then that's good enough.

But your code doesn't do that. Lines 50, 55, and 58 are wrong.
6 days ago

Michael Coster wrote:Is there any way to edit my post if I want to simplify it more, or update with changes, or should I just create a new topic?

My suggestion would be to just carry on with this thread.
6 days ago

Michael Coster wrote:Lol that's what I was trying to do, I already cut out a ton, but I could simplify it some more...

You sure could. An SSCCE would look more like a single JPanel with a key binding which does something trivial like changing the background colour.
6 days ago

Jack Tauson wrote:Here you are saying that I could use something like this for generating 3 files ? YMD-HMS_myfirstfile.csv,YMD-HMS_mysecondfile.csv, YMD-HMS_mythirdfile.csv

Well yeah, but I would probably put the timestamp at the end, like so: myfirstfile-20190318223817.csv. That way if you look at a directory listing sorted alphabetically, you see all of the "myfirstfile" files grouped together in chronological order.
6 days ago
Okay. So now it's time to put that code aside, and write an SSCCE (<-- follow that link) which gets key-binding working. Once you know how to do that, you can then retrofit the working code into the code you posted.
1 week ago
Hi Carlos, welcome to the Ranch!

Carlos Servero wrote:I have this code that functions fine...

I see some code which creates some objects and then terminates without using them in any way. So if "functions fine" means "doesn't do anything" then I don't understand what your problem is.
1 week ago