Gary McGath

Ranch Hand
+ Follow
since Mar 15, 2003
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 Gary McGath

I've always assumed that if you call new(Classname) on two separate occasions, you get two distinct objects, which will never be == to each other. In chasing down a recent bug, though, it appears that this isn't always the case.
The class which I created is called Rational. It looks something like this:
public class Rational {
int num;
int denom;
public Rational (int n, int d) {
num = n;
denom = d;
}
/* The obvious accessors .... */
}
If I call
Rational a = new Rational (0, 1);
Rational b = new Rational (0, 1);
Then I find that (a == b) is true!!
If I then call a.setNum (2), (a == b) is no longer true.
It appears that the JVM is doing some very strange optimization. (I'm using the Sun JDK 1.4.2 on Windows; I haven't tested this on other platforms.)
The == test makes a difference because I'm using Rational leaf nodes in a JTree, and using an == test to locate a child relative to its parent.
Could this have something to do with a Rational being a very small object, which can in principle be stored in just 64 bits?
18 years ago
Details on classpath are found at http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html.

The default class path is the current directory. Setting the CLASSPATH variable or using the -classpath command-line option overrides that default, so if you want to include the current directory in the search path, you must include "." in the new settings.

18 years ago
Even if you disable the backspace key, that won't solve your problem. There are too many ways to navigate back to a previous page, and in many browsers hitting backspace isn't even one of them. (The truth is, I didn't know there were any browsers in which backspace does that!)
There are several ways in JSP to prevent earlier information from being shown again. One is to have a session variable that controls which question is being presented, and is incremented each time an answer is submitted. Since all the questions are being presented in the same page, and the URL doesn't change, browser navigation functions won't allow going back to an earlier question.
This won't stop them from starting all over with a clean slate. You'll need to keep some kind of persistent record on each person to monitor that.
18 years ago
JSP
The answer is yes -- if the applet security level has been set to allow it. However, under most browsers, the default applet security settings allow an applet to communicate only with the server from which it was downloaded.
18 years ago
JSP
In the examples you posted, the second one would be a clear waste of memory. You would be creating an instance of List and then immediately overwriting it with the value returned from getVals(). The first List would eventually have to be garbage collected, consuming processing resources.
18 years ago
One other detail may be obvious to some, but this is the beginner forum, so I'll mention it.
When you move the declaration of BufferedReader outside the try block, you have to initialize it, e.g.,
BufferedReader input = null;
Otherwise the compiler will complain that the variable input in the finally block may not have been initialized.
18 years ago
Here's a question from a newbie to Linux administration.
I've installed JDK 1.4 on a Red Hat 7.3 system as root. For doing Java development, I'm logged in as a regular user. A simple application (2 classes) compiles properly. When I run it, though, I get the following message:
[date] java.util.prefs.FileSystemPreferences$3 run
Could not create system preferences directory. System preferences are unusable.
The application then runs anyway. Can someone suggest what I may have done wrong?
18 years ago
Yes, the server should protect the WEB-INF directory from outside access. Don't consider placing a file in there to be high-level security, though; a misconfigured server could conceivably allow web or anonymous FTP access to WEB-INF. If the consequences of exposing the file are just annoying rather than disastrous, you should be OK doing it that way.
18 years ago
JSP
You can also use RMI if you're guaranteed that both the client and the server are in Java. RMI is easier to set up than CORBA.
18 years ago
Please state odds of winning, expiration date, and an address at which the organizers of this alleged contest can be contacted.
18 years ago
I've had very good luck hosting timeczar.com on servlets.net. I'm in the process of moving the site to a less expensive host that doesn't support servlets, but this doesn't reflect on servlets.net in any way except that they're a bit expensive.
Previously, I'd been hosted on hostforweb.com. My results with them weren't very good.
18 years ago
Chapter 7 of Jason Hunter's _Java Servlet Programming_, from O'Reilly, has a good discussion of session tracking. I consider this book essential reading for anyone who wants to write servlets.
18 years ago
One item which hasn't been mentioned:
Increasing purchasing power doesn't boost the economy. Only increasing productive power can do that. If people drain their resources faster, they have less to invest in the future. This can create a temporary boom, but inevitably results in a later bust. This is a large part of why we're in the present situation. Investors poured huge amounts of money into anything which ended in ".com", creating lots of high-paying jobs for a little while. Then the inevitable consequences of foolish spending hit.
A tax cut can help the economy, but not primarily by boosting consumer spending. My spending will stay low for some time in any case, while I try to catch up on my savings. A tax cut will help to the extent that it makes productive efforts profitable which wouldn't have been profitable before. Before complaining about this benefiting "the rich," ask how many jobs "the poor" are going to hire you for. If an employer expects a net gain in hiring you, you may get hired. If it looks to the employer like a net loss, because of taxes or any other reason, you won't.
There are other factors keeping the economy down, with fear of terrorism having been a big one in the past couple of years. A rise in dishonest acts by businesses has been a large factor; distrust puts a heavy brake on economic growth. Widespread dishonesty is a serious problem for which there's no easy fix. So a tax cut won't be a magic cure, but it will help.
18 years ago
There are also organizations specifically for job networking. In New England there's one called WIND, which has generated some possibly worthwhile contacts. It has five meeting groups, four in Massachusetts and one in New Hampshire. You have to pay to attend each session, and they bring in a professional speaker. Other networking groups, particularly those that get free meeting space in public libraries, may have free admission.
18 years ago
Thanks for the clarification. It really sounded to me as if he had somehow gotten the resume behind your back. Dealing with someone who's confused and disorganized is annoying (I've been the C&D party myself at times), but I'm glad to hear nothing dishonest was going on.
18 years ago