Tim Holloway

Bartender
+ Follow
since Jun 25, 2001
Tim likes ...
Android Eclipse IDE Linux
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.
Jacksonville, Florida USA
Cows and Likes
Cows
Total received
95
In last 30 days
2
Total given
15
Likes
Total received
1445
Received in last 30 days
25
Total given
59
Given in last 30 days
3
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tim Holloway

You can access resultset values by column number, not just by column name. NOTE THAT column numbers start with 1, and not 0!

Also, you can obtain the resultset's metadata which will allow you to determine how many columns are in each row and their names. In the event that the query has a computed value, the database will have synthesized a column name. Or you can make your SQL query return alias column names using the "AS" option like so:

SELECT acctno AS account_number, amt_paid / avg(amg_paid) AS average_amount_paid_ratio ...

5 hours ago
No, you should see a full-fledged control panel, complete with status of each managed container and a sidebar.

Like this
5 hours ago
I don't have one running in front of me right now, but the dashboard webapp has always supplied me with information about what's causing my problems.

The dashboard's URL should be displayed as part of the startup messages when you run kubectl from a command line.
7 hours ago
Well, "call" is a DOS command, and I'm not sure that there's any need to use it just to run Maven. But "mvn test" does not require you to build an executable jar because maven itself is executing the tests.

I have no clue as to what you mean by "user set the values as literals". If you mean test data, tests generally work best if they're repeatable, so you'd normally include test data files in the project under the /src/test/resources directory subtree. Unless they're really big files, in which case your shop would hopefully have some server or other where such assets are kept.
9 hours ago
What, actually, are you trying to produce and what Maven goal are you using to try to produce it?

Because it looks like you are attempting to create an executable jar whose sole purpose in life is to run a Java test application. And that's bizarre, since if you're using Junit with Maven, normally the Maven Surefire plugin would be the test application and the actual Maven product would be a stand-alone JAR (executable or library) or a WAR or EAR or something like that.

Unit tests are UNIT tests. They are run against the compiled classes, not against the final product. So Surefire doesn't even need the jar:jar or war:war goals or any of their downstreams like the assembly goal in order to run, only the compile goal, which is an automatic upstream goal of the maven test goal. And complex goals like the assembly goal run the test goal as an automatic part of their upstream goal chain. An executable test jar just doesn't make sense.

As I said before, it really looks like you're making this too complicated. The best practices are already embedded in Maven and require relatively little POM configuration.
14 hours ago
That's your choice. The best way to use printf is if you make each row a string, though.
2 days ago
I estimate that each square on the sample board is about 10 x 10. There are (if I counted right) 6 distinct shapes, plus blank as possible square values.

You have 2 choices here. One is to use the same definitions for both black and white pieces and adjust the colours as you draw them, the other is simply to hard-code the colours and have double the number of templates (12 instead of 6). You could also draw empty squares from templates, but if not, it's hardly the world's most complex computation.

So for a template, you need a 10x10 element array for each template, and that array would hold the values to be drawn.
2 days ago

Daniel Demesmaecker wrote:I could be wrong, since I have no experience with sql servers, but you say you managed to connect with mysql workbench.
Couldn't be the problem that in your app you're trying to connect to a sql server while you actually using mysql?
It seems weird to me that you could use mysql workbench to connect to a sql server



It's a good question, but actually MySQL Workbench also advertises itself as a DBMS porting tool. Since it's using JDBC, which works on not only MySQL, but SQL Server, PostgreSQL, Oracle, etc., etc., etc. it's possible to work with just about any JDBC-compatible database.

A "gotcha" for SQL server is that the JDBC port isn't turned on by default (not since the SQL Slammer disaster, anyway).

But one VERY good point is that SQL Server's standard port is 1433. It's MySQL that prefers 3306.
2 days ago
This is not a JPA issue. everything you talked about has to do with the Eclipse IDE. I think that the connection is being attempted by the Eclipse Database Explorer plugin, but I don't let Eclipse do all my thinking for me, so I haven't used those options.

You need to make sure that you are attempting to connect to the correct database host, whether that's localhost or some other machine on the network. You need the exact same parameters that you were using for the MySQL Workbench, which is hostname, database userid, password, and port number. The JDBC URL contains most of that information, although userid and password can also be set as external parameters (and should be, actually).

You need to do this in two places. One is for the developer functions in the Eclipse IDE, such as the Database Explorer. The other place it has to be set correctly is in the application, because when the application is installed on a production server, Eclipse will not be available there. For a webapp server, in fact, the recommended procedure is to use a database connection pool, which is part of the webapp server configuration. JPA can then use that pool. For standalone apps, you can obtain a connection via the DriverManager, among other possibilities.

In any event, the necessary connection data is the same regardless of whether you're talking to the IDE, a webapp server, or a standalone application.
2 days ago
I'm going to qualify my previous statement.


It's true that JEE Container-managed security does the actual login, but a major change between J2EE and JEE was that addition of an API method that permits program logic to internally invoke the container login instead of always depending on a URL request to invoke login. That makes it convenient if you're the type that likes to put an explicit Login button on application web pages.

You can put a mini-form on a page that way with a login button and userid/password fields. Although if you must allow credentials on that mini-form, I highly recommend you keep them in a separate backing bean. Because credentials SHOULD be wiped between attempts, you MIGHT even be able to do that in Request Scope.

But assuming that that's what this particular example is all about, it's annoying to me for 3 reasons.

o First and most fatally, it's combining authentication AND user identity maintenance in the same bean. That raises your security exposure and complicates the bean. Better to have a separate bean for identity maintenance.

o Secondly, it has database logic in the View Model (backing bean). I realize that having more components can offend, but it's really better if the backing bean concentrates ONLY on the view and delegates the business logic and persistency to a business bean. In fact, I generally go one further and have the persistency in a separate bean from the business logic as well, but that depends on how complex things are.

o Thirdly, the bean is far too knowledgeable about HTTP and JSF internals. I prefer to include a bean called JSFUtils in my JSF webapps. Its exact makeup tends to vary, but basically, it's an abstraction where I put stuff like direct access to the scoped objects (which should mostly be avoided in favor of JSF injection), security role checking, cookies, and posting of JSF error messages. The advantage here is that since it's plug-replaceable, I can switch it for a mock bean and do offline unit testing of my backing beans. And, of course, it insulates them from potential future changes in JSF itself.
2 days ago
C and C++ are not that much different, and both are so close to the hardware that it's mostly a matter of brute force.

I believe that there's a compiler switch to force the primitive type "char" to be either traditional (8 bits) or wide (16 bits). You need 16-bit characters to hold the extended Unicode characters. Or you could just plow through with UTF-8, but since all the characters in the chess subset of Unicode are 16 bits anyway, why bother?

Of course, none of this does any good at all unless the output system is set up to display Unicode. So make sure you are outputting to a terminal device (or whatever) that can handle it. And that has been instructed to handle it.
3 days ago
It's not a matter of whether you're using an ORM. The @Transactional annotation invokes Spring functionality. You should be able to use it with raw JDBC (I think), but only if you're doing so via the Spring JDBC Data Manager.

Although truthfully, once you get something complex enough to require Spring, an ORM is a good investment. Hibernate can manage all but the lightest database interactions much more efficiently than you can using raw JDBC.
3 days ago
Item #1: If you're using a J2EE security Realm, you don't write your own login/logout logic. The J2EE and JEE standards consider the login process to be the server's job, not the application's job, and the login code is already written, secured, and debugged as part of the original server software installation. All you do is provide the forms that the server will present when a need for login is detected. These forms should be basic JSPs or HTML forms, NOT JSF, Struts, or some other page that requires routing through a dispatching servlet, since the server does logins external to the webapp and its servlets.

On a related note, you do not log in a user by using the login form as a URL. The login form is automatically presented by the server whenever an attempt is made by a non-logged user to attempt a secured URL (as defined in the security URL patterns in web.xml). If you invoke the login form directly, it will not work, because the j_security context hasn't been set up properly. Only the server can do that and it will only do so when it's actually trying to authenticate someone.

Item #2: One of the two fundamental axioms of JavaServer Faces is that Request Scope in JSF is almost 100% useless. Most of the time it will just get you into trouble, so it's better to avoid it altogether.

3 days ago
Yes, that looks like what you'd get if someone zipped up an Eclipse project and shipped it. The ".project" file is the giveaway.

For Eclipse to see a project, you have to import it. The actual project directory can exist external to Eclipse, or you can copy it as a sub-directory of the Eclipse workspace directory. Eclipse doesn't care, the workspace is just a convenient way to keep multiple projects together.

The main thing is that you have to use the Eclipse project import menu to permit Eclipse to read the .project file and register it in the workspace (even projects that are located outside the workspace directory have entries in the workspace metadata). You do that by pointing Eclipse project import at the new project's directory.
3 days ago
What, you're not doing massive wire-wraps and manual point-to-point wiring?

Good times. Space electronics tends to be behind the times, I don't expect ICs (although I do have a flip-flop in a can labelled "Nasa" from about 1970), and PCBs back then were as likely as not to be a brittle phenolic susceptible to cracking when subjected to launch stresses.

Nowadays, you could pack a half-dozen Raspberry Pis and save enough launch weight for an extra bag of Oreos, And each Pi would have more power than the GC and the mainframes backing it up on the ground. You could even play Lunar Lander on them!

What technology has become over the last century scares me. My grandfather was born in the horse-and-buggy age, saw airplanes invented, grew up to be an automobile mechanic, saw jets replace most prop-driven planes, and saw the wide-spread adoption of telephones and mainframe computers. He hadn't been dead a decade when the first personal computers came out, and in two decades, practically everyone either owned or had access to one. Now we carry them in our pockets and have the Internet and I can buy enough computing power to defeat the Kaiser for under $1.

And that's just some of the high spots. I can imagine what he would have thought if he'd seen a 3D printer.
3 days ago