Lew said:
Adam said:
However, you can write a method that has what we call 'varargs':
void myMethod(int... args) {
// in here, args is an int[]
String arguments = "All arguments: " + args;
System.out.println(arguments);
}
You can call that with any number of arguments:
myMethod();
myMethod(1);
myMethod(1, 2, 3, 4, 5);
That might be a way of getting what you want.
Yep, your hint works perfectly, but "only" for methods, where all
parameters (args) have the same type. I guess that I would be able to
"enhance" your hint and write something like this:
void myMethod(Object... args) {
^^^^^^
... but I cannot (well: I absolutely don't want) to lose information
about parameter types (for obvious reasons).
Do you think you might restrict yourself to a single reply to a post at
a time?
He's using Google Groups. I don't know, but suspect from seeing many
cases like this all of which were posted from Google Groups, that Google
Groups sometimes spits out an error message after posting successfully.
In fact it's almost certain that it does, and that any other Web based
news gateway does: these will be based on a web form interaction, where
the user types in a post, clicks some "submit" button, and the browser
loads a page from the site that either says it was posted successfully
or says it wasn't. But if it hiccups and times out loading the success
page, they'll get "the page cannot be displayed" yadda yadda yadda in
their browser, and the natural response will be to hit "back" and then
"submit" again until they see the success page. And then we get two or
three copies of the same message.
Just one more reason why everyone should be using real news programs and
not web sites to post to usenet.
Anyone somehow stuck using a web gateway to news should at least open
another tab and reload the group in it if they get such an error
message, and see if their post has actually appeared. (In theory, it
should be there nearly instantly if it did succeed, since they're
looking for it on the same server they posted through.) Only if, say,
after five minutes it hasn't shown up should they hit "back" and
"submit" again in the other tab to retry the post; in that case, it's
likely the form submit is what timed out, not the success response, or
the response that timed out was an error rather than success response.
(An error response might be because of a problem with their submission,
in which case an unedited retry will fail again, but the route to
success in this case is still such a retry -- until the error response
is successfully received and displayed by their browser, whereupon
they'll know how to alter their submission to make it work. Though one
might guess and trim either quoted material or crossposts, the two usual
reasons for post rejection by a server.)
The above doesn't work so well for moderated groups though: there's no
way to check whether a submission actually succeeded short of waiting
hours or even days before giving it up as lost. Even then it might have
been rejected by the moderator rather than failed to even reach the
moderator. The only advice that makes sense then, besides "don't use a
web gateway if at all possible", would be "just resubmit until apparent
success" on the part of posters and "if it gets annoying enough, set up
a filter in your email program that causes you to only see the first
copy of duplicate messages" on the part of moderators.
I wonder how this problem is handled elsewhere? It can happen any time
there's a gateway between two protocols that a submission is made using
protocol A, the gateway successfully submits it using protocol B with
the protocol B server indicating this success to the gateway, but then
the gateway fails to deliver the success message to the client using
protocol A, and the client gets a timeout or other error message. Many
users won't be able to distinguish protocol A errors from protocol B
errors, and those that can still won't know if a protocol A error
happened on the outbound or the inbound leg. It's probably a pretty
thorny problem in general. Thankfully, in the future the need for
gatewaying might go away. There are a few free newsservers, and
increasingly both unfiltered broadband and mobile devices that can
access it are becoming widespread, diminishing much of the need for web
gateways to other kinds of network services.