Tim Holloway

Saloon Keeper
+ Follow
since Jun 25, 2001
Merit badge: grant badges
Biography
Long-time moderator for the Tomcat and JavaServer Faces forums. Designer and manager for the mousetech.com enterprise server farm, which runs VMs, a private cloud and a whole raft of Docker containers.
These days, doing a lot of IoT stuff with Arduinos and Raspberry Pi's.
For More
Jacksonville, Florida USA
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Tim Holloway

If you can ping by IP but not hostname, then your name resolution isn't set up properly.

hostnames are resolved to IP addresses via several mechanisms and the order in which these mechanisms are searched is defined in the /etc/resolv.conf file.

Typically, you'd either map the hostname to an IP address by defining the mapping to a DNS server, although a "quick and dirty" way to map a hostname is to define it in the /etc/hosts file.

The hosts file has to be defined on the remote machine for it to be able to ping the host. DNS, on the other hand, is a global service, so any remote machine can do a DNS lookup for the hostname.
21 hours ago
In general, yes. Int this case, as I said, you can include those properties per the Java spec for classes, but if you do, then the class you defined won't be immutable. Hence "may not" instead of "must not".

More precisely, I think you can consider a class to be immutable if a class has static or instance variables, but they are all final. Unless someone has an objection?
Ah, yes, the modals. Almost as confusing in English as in German.

In a technical spec or legal document, the wording would be "The class must not contain any instance variables." Such documents use "must", should" and "can/may" to precisely define constraints.

However, here, we're talking about designing a class and what we are/are not permitted to include in it. And, notably what we may/can not include in that class if it is to be immutable. As opposed to the spec for classes in general, where we can include instance/static variables, because the spec allows it and no compilation error would be flagged if you violated those constraints. Though that would make the class mutable if you did.

In German, I'd use the verb "darfen".
I wouldn't rely on the bluepet demo. It's for EJB version 1. Completely obsolete. Current-generation EJB's are POJOs, for example.

I don't use Notepad++, so I don't know if it can do that.

But there are websites that do "JSON pretty-printing" that you can paste JSON into, click a button, and copy down the reformatted JSON.
4 days ago
These are not good times for anything to disappear down the "memory hole", even mistakes.

No, the Ranch doesn't provide support for outright deletion.

If a posting is inappropriate or an accidental duplication, we can "ghost" it, making it invisible to the general public, but it remains in the database.

Bur we all make mistakes, as you can easily see if you look at my own posting history, and incomplete or incoherent posts are just a few of my screw-ups. Simply pick up and continue or correct yourself and you'll be fine.

One thing we do NO want people to do is to make wholesale edits to their posts. Spelling corrections, fine, but code changes, or fundamental additions/deletions to an existing post, please don't!

Case in point: what you just did.  Without looking at your edit history your question made no sense at all.

So I'm going to un-delete that question so that we'll have a better idea of what you're talking about. Just add a downstream post to fix what's incorrect/missing in the original.
4 days ago
Yeah. The default package is fine for "quick and dirty" programs.

Java, however, isn't a "quick and dirty" language, though, so most Java needs a package structure.
This really isn't a "Beginning Java" sort of question, though.
4 days ago

Campbell Ritchie wrote:Not only should the import declaration precede all the classes, but it needs to have a package name. It should read import static packageName.ClassName.MemberName;
You are not allowed to import anything from the unnamed package.


That wasn't the default package being referenced. The package name was "Foo" as far as the compiler would read it.

Of course that violates the convention that. a package name should start lower-case anyway, but the compiler wouldn't flag that.

It would be pointless to include importing from the default package though. Aside from the fact that there's no special syntax for it, the default package would be the implicit location for unqualified classes not in the explicit package class path and therefore would need no explicit directive.
Your error message explains it.

You have an "import" in a place where "import" is not permitted.

You can do that kind of stuff in C/C++, but Java has different rules.
Did you note the state diagram in the link I posted?

There is one and only one state transition event where you need to save volatile data, because the other de-activation states can only be entered after that state is entered.

Likewise, there is one and only one state transition event where you need to reload that data upon re-activation.
6 days ago
I invite all to peruse this document: https://docs.oracle.com/javase/tutorial/java/javaOO/enum.html

Note at the bottom an example is given for a complex enumeration mapping.

But I would like to repeat that an enum is a type-safe "handle" for a named value (manifest constant) and it should treated as such. Mappings and internal value accesses are secondary and optional.
1 week ago
A Finite State machine might assign while switching:
1 week ago
enum made its way — belatedly — from C++.

As originally conceived, the C++ enum defined a set of sequential manifest constants from 0 to n, but it was quickly discovered that other variants were useful, including enums whose origins were non-zero and even had "holes" in them. Even bit patterns, on occasion.

Java built on this expanded concept and further extended the enum to be very class-like. The end result is much like what the Ada lamguage does, where you've defined a set of manifest constants which can be used in a type-safe and value-limited manner.

An enum, by definition orders its values in a repeatable enumeration sequence. So there are definite rules about retrieving those values.

Strictly speaking, then, enumeration values are distinct data types of their own. The fact that internally they might be specific integer values or map to strings is secondary.

Consequently, while you can certainly get clever with introspections and the like, the most basic way to map enum values to general values is simply to define a map as part of the enum (which can be an array) to fetch/be searched for those external mappings with corresponding access methods. And, in fact, I have had enums that mapped in multiple ways, so they had more than one set of mapping methods.
1 week ago
Properly speaking of course, it's dobre utro (доброе утро), But I get the joke!
1 week ago