Tim Holloway

Saloon Keeper
+ Follow
since Jun 25, 2001
Tim likes ...
Android Eclipse IDE Tomcat Server Redhat Java Linux
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
196
In last 30 days
0
Total given
40
Likes
Total received
3148
Received in last 30 days
16
Total given
375
Given in last 30 days
2
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tim Holloway

Campbell Ritchie wrote:Please avoid abbreviations like, “w.r.t.,” which may confuse non‑native‑English speakers, and certainly confuses Google Translate.


I don't even think it's that obvious to Americans. More of a British/South Asia phrase.

A better usage here would be to use the simple word "regarding".
Welcome to the Ranch, Sai!

You can start your own message thread if you prefer. This one's nearly 16 years old and things have changed. For example, Class.forName() is no longer required.

Java operates on classpaths. To find a class, you have to place it in your Java app's classpath. You can do that using the -classpath option on the java runtime command.

Classpath  elements are directory trees and/or JARs. So, for example, to run a Java app named "Foo" that uses Derby, your command line might look something similar to this:

There are two elements in the classpath of this command: ".", which refers to your current directory, and "C:\Java\XXXXX\org\apache\derby.jar", which refers to your JAR. Note that you don't have to use such an elaborate location scheme for the JAR, though, as its package structure is contained within the JAR itself. You could have simply said

And put the Derby JAR in C:\usr\me\javalibs.
If you have a webapp, then a Connection Pool should definitely be used and the best way to use one is to define it to the webapp server as part of the webapp's Deployment Descriptor. Then you can use JNDI to obtain a reference to the Connection Pool and that reference can be safely stored globally in the webapp so you don't have to look it up each time you need access to the pool. While the webapp server will come with a standard Connection Pool implementation built in, it's usually plug-replaceable if you find a different Connection Pool implementation that's more suited for your needs.

Similar options may be available for other frameworks, but you can also write stand-alone Java apps that create and use their own Connection Pools. Please note that DriverManager.getConnection() is NOT connection pool-based, though. It's what connection pools invoke to build their pools and it has a LOT more overhead itself than simply getting a Connection from a Connection Pool does.

Some other important things to note is that in order to use a Connection Pool most efficiently, you should not obtain the Connection until you actually need it and to close() the Connection as soon as you are done with it. And absolutely never cache and hold a Connection between requests in a webapp!
What you're dealing with is a type of Packing Problem. Packing is mathematically a sub-species of Topology.

I did a similar project a while back, but in my case, I was trying to take a set of backup files and figure out how to pack them into the smallest number of 4.3GB DVDs I could in order to be able to better manage disaster recovery. Ny solution turned out as a surprisingly small Python program.

This is also the sort of thing that was meat-and-potatoes to the ACM back in its heyday when sorting, searching and optimal list processing were still being explored at their most basic levels.

So expect to find quite a bit of existing literature on the subject.

Without looking, though, I'd probably break the geometry down to the point where every rectangle was an integral collection of atomically-sized squares, if I could. You could then know if a problem was solvable at all if the sums of the number of squares in each rectangle was less than or equal to the squares in the bounding box. If so, then the fun begins, testing if there was at least one packing that would cram them all in.
1 week ago
Welcome to the Ranch, Palak!

The first thing to realize is that JSPs are not like time-sharing terminal displays. The only way to get a JSP to update is if the client sends a new request to the server so that the server can send back a new JSP (or whatever).

You can get around that by putting an auto-refresh option in the HTML that your JSP generates. In ancient times, it was common to use a special META tag to do that. These days we often use AJAX, since that allows updating only part of a page instead of replacing the whole page on the client side.

HTTP servers likewise don't run "programs". Instead they provide services that are run when a request comes in and those services must then provide the response back to the client. So there's nothing to sit around and get updated from the database. Instead the request processor has to read from the database on each request.

In JEE, reqest processors are servlets. For JSPs, the JSP compiler generates a servlet by turning the JSP source into Java code, then compiling the Java code into a class. That's all automatically done for you,
1 week ago
JSP
Just because I'm chatty online or even one-on-one doesn't mean that I enjoy going out randomly and meeting people. And, alas, the last time I encountered someone from my own town on the CodeRanch, it was an old office-mate who'd retired and was trying to learn Java for the fun of it. I used to be somewhat of a presence in other forums, such as LinuxQuestions and StackExchange, but I gave them up years ago, as well as the more generally social places such as Slashdot and reddit.

In fact, it worries me that unless external demands require it, I can spend the entire day no more than 10 feet from my house. Even the back garden is more unvisited than not now.

It's not that I'm especially unpleasant like I was when I was much younger and didn't have much optimism, hadn't been introduced to appropriate medications and hadn't yet learned that my daily dosage of tea was what was making me 1 short step from diving under the furniture at the slightest noise. I'm just a very solid embodiment of the stereotypical software person, but with better spelling abilities (most of what I mis-type is sloppy fingers).

While in the past, I was always treated for depression, in actuality, what really seems to have ruled me was more a mix of obsession over minor hurts and generalized anxiety disorder (which wasn't a Thing until fairly recently). The mental health sciences have progressed considerably over the decades, and I'm glad to have missed out on the icepick-lobotomy fads and most of the drug-them-until-they're-comatose ones, but we're a long way still from precision diagnosis and treatment.

The first effective treatment I encountered was a tri-cyclic anti-depressant and it's what clued me into the obsessive component of my affliction because it messed with my short-term memory and you can't properly obsess if you keep forgetting what you're obsessing about. It was fairly brutal, and it caused major tooth decay, but I still got messed up when I had to move to get a new job and couldn't carry the prescription over.

Ironically, I get a lot of benefits these days from a blood-pressure medication that works by slowing heartbeat. Since one of the symptons of "fight-or-flight" is accelerated heart rate, applying the principle in reverse makes me feel less on the edge of panic all the time.

But in the end, I still don't like to socialize. It's like the "you can make yourself be happy!" approach to depression. You can fake it, but you cannot make it, because it's like treading water. No matter how long you tread, it's an effort that someone more buoyant wouldn't have to make and eventually the effort will exhaust you and you go under. You simply are not going to be able to build up the level of muscle tone required to go indefinitely no matter how much you exercise. Quite a few people have tried to become software developers and ended up abandoning it. Some skills can be learned, but that doesn't mean that they can be enjoyed by everyone.

OK. The Twitter reference was a dig at people who are naturally sociable, and can end up being worshipped even as they take a $75 million company and turn it into a $30 million one. Or whatever it's worth these days. Failing upwards because they were brought up to be connected and had the ability to use those connections. I have had neither. In fact, to paraphrase Terry Pratchett, when I die, the sum total of persuadeability of the population of Earth will fractionally increase.

But, as to seniority, I basically started my career in senior positions. I was the system administrator for the minicomputer in college, did yeoman-level assignments on my first actual job, and shortly moved up into OS support. It's one reason why generic recruiting doesn't work for me. When you need me, a grunt-level person won't do, and grunt-level screening will cut me out of the process.

Not to worry. As I said, I'm essentially retired now. After all, I'm "too old to learn new technologies". And I'm tired of meeting my boss in the hall and learning that he was just laid off and my exit interview comes next. No more. I quit.

1 week ago
The principal reason why Java isn't suited for system-level tasks is its "write-once/run-anywhere" design. For example, Windows security attributes cannot be accessed by Java, because Windows security is totally different to the various security systems on Linux (standard file ownership rights. selinux rules, and so forth). So there's simply no Java API to hook into. You'd have to create a native-code glue module for that. In the end, it's simply not worth the trouble. Just write the whole app in native code.
Also, Docker doesn't run under Systemd like that. A Docker container must be controlled by a "docker" command. You cannot simply put a "java jar" command in a systemd file to run a Docker container.

A Docker container for a systemd base image such as CentOS, is even more problematic. Systemd and Docker don't naturally fit together, so various contortions need to be performed to get systemd working inside a docker container.
1 week ago
Well, the error message indicates a missing URL, but not much more. You have 3 datasources, so 3 URLs. However, only one datasource is configured in a way that Spring Boot's connection pool constructor can use it. The root of each datasource must be "spring/datasource", not "app/datasource".

Your environment file is also problematic, as it's in Windows ".ini" form, when it should be unix shell "source" form. Actually, it's not even truly valid for INI format. It seems to be a weird hybrid.

Also it's VERY bad to put the config file in /etc/systemd/system. Better locations would be "/etc/sysconfig/namex", "/var/lib/namex/" or "opt/something/namex", where the reasonable value of "namex" would be the name of the service that uses it, and "something" is your choice, although I like something like "/opt/com/coderanch" to point out that it's an app specific to my domain. In Ubuntu/Debian, instead of /etc/sysconfig/namex, I think the standard location is something like "/etc/default" and I have no idea what MacOS uses.
1 week ago

Anil Philip wrote:

Mike Simmons wrote:I think we all agree that the underlying physics of the universe are unaffected by this, as are all the animals - it's just the humans and the way we represent our dates and times that are affected.



I was thinking along the lines of whether there are programs (business, scientific...) that need to step backwards in time.
a) I wondered whether they handle the missed hour and extra hour every year, correctly. Just like most people can walk forwards correctly but walking backwards will cause most to stumble and fall.
b) if and when DST becomes permanent, I wonder whether the bump in history when we last lost an hour, will be taken into account by such programs. I wonder if there is a Y2K-like moment here.



It's ironic. Allegedly, DST was invented to benefit farmers, but of all the professions, farming is one of the least governed by clocks and the most governed by natural light. On the other hand, those Dark Satanic Mills were originally lit by high windows, so if you could hurry in the workers when the sun rose early, it was that much more work you could squeeze out of them.

Astronomers use Julian Days, which are measured in seconds and decimal fractions thereof from the JD Epoch, That means that they don't care about Leap Years, Daylight Savings or even leap seconds. The stars don't have any need for such frivolities. Space missions often count days/hours/minutes to/from launch or some other mission milestone. Businesses historically haven't done much clock-sensitive processing in the wee hours of Sunday morning, so they didn't care, although a completely 24x7 real-time world-wide system has its own considerations.

Putting a bump or hole in timekeeping on a permanent basis would have no more impact than the present crop of semi-annual hiccups we must endure.

I'm pretty sure that the standard TZDATA resources that are kept updated in Unix and Windows OS's also maintain histories of the different changeover dates back to the point where a clock and calendar were more governed by personal preference and the Church/State.

Realize that formal timezones only came about in the early 1800s or so, for the benefit of railroads. Before that, you'd set your clock by the local sun. Or sometimes a cannon or flag at an installation which got their time from the local sun. One of the original essential functions of the Greenwich Observatory. In their case, the master time was used to set ships chronometers for the benefit of determining longitude based on the difference between Greenwich and the local sun.

The fun part is that you can calculate backwards, but not forwards. Because you never know what shenanigans may arise. The Leap Second has been permanently abandoned, for example, if I read the news aright.

Bruno Valdeolmillos wrote:
uh I'm sorry they don't pay you more now. Why don't they pay you more nowadays? (If you can know)



Some people have people skills, and can make major money while wrecking Twitter. Then there are those of us who are anti-social to the core, fail the Human Resources "aptitude tests", think that wanting to be some type of tree is just plain silly and "where do you see yourself in 5 years" is none of their business.* And, incidentally, are total  :censored: at salary and benefit negotiations.

Salt that with an obstinate refusal to move to a new city for each new job, and last, but not least, lack of a full college degree, pile on a preference for living in a place where nobody wants to pay anybody and you get me. And, again, I'm extremely anti-social, so I don't have a vast network of people to slide me past HR and into where I'm needed.

That was for starters. Now, I'm "too old to pick up new skills" so HR finds ways to not age-discriminate  :rolling:

Now on the plus side, when I did get hired, it was generally for some essential task that grunt teams weren't skilled to handle. For example, over 6 years as part of the OS support group for one of the largest IBM mainframe shops in town This was before "perma-temping" became a thing), so even being underpaid for the skill was still pretty good overall. Which was good, because whenever my bank account began to get fat, I knew the layoffs were coming and I'd be spending the next 2 years looking for another job. But when I was working I put in enough to pretty much max out my Social Security contributions and stuff some cash into investments.

So these days, I'm in large part supported by Socialism, which is ironic, because I'm a more reliable contributor to the overall economy when I can spend freely without worrying about the next layoff.

Essentially, I went from loyal corporate drone to independent contractor to more or less retired. I do small projects, mostly IoT remote work for clients around the world where I don't have to commute. I've been especially popular in Australia/New Zealand and Romania.

So I might have a bit of an attitude, here. Social? HAH!

---
* The joke in this town is that contractor jobs last 2 years and "permanent" ones last 3. And since I don't get laid off until they're liquidating the entire department, where I'd be in 5 years would be working for some other employer entirely.
1 week ago
I concur that when it's 12:00 noon, the sun should be directly overhead at the meridian, but the business world thinks that you can bend reality by the "power of positive thinking" and make everyone more "productive" by screwing with the clocks. So instead of universal standard time, we get universal daylight time.

It's recorded fact that changes in schedules cause an increase in both medical events and workplace accidents. And one of the most significant problems hereabouts is that schoolchildren are more likely to become accident victims when they find themselves waiting for the bus in the dark.

So we could deal with time based on measured evidence or we could deal with time the way we "know" is right. And of the two, history suggests that the Sun will wander into a black hole before the first option is ever considered for public policy.
A number of states voted this in, but speaking specifically for Florida, the intent is that the entire state should move to DST all year around.

Florida, incidentally, is deliberately off-kilter anyway. Its longitude indicates that it should properly lie in the Central Time Zone, but when timezones were first established, it was common for Damnyankees from Up North to come down for the winter via steamships or railroads and the timezone was established for their convenience (not having to change the times on their clocks and watches).

West of the the Appalachicola River in the Panhandle, they gave up, and put that part of the state in Central Time. Since the tourists of the day were more interested in the St. Johns River, Daytona, and Miami, that was not a problem.

Paul Anilprem wrote:>Daylight saving time always starts on the second Sunday in March and ends on the first Sunday in November for the United States
I think it used to start on first Sunday of April and end on last sunday of Octorber ((a decade or so ago?).



Except when Congress changes it.  And it should be noted that a number of states have voted to make DST permanent and it's just waiting for Congress to approve it. If they can ever spare the time from pointless political stunts.

Of course, DST is also locale-specific. Different rules apply to parts of Indiana, the state of Arizona, the Navaho Nation, and the Hopi Nation within the Navaho Nation, and so forth.

So keep that timezone file/tzdata package up to date!

As a side note, all my servers have their hardware clocks set on UTC, though at the user level what I normally see is local time.
Truthfully, I've only heard of Undertow as an alternative web container in Spring Boot. The others being Tomcat and jetty. Tomcat and Jetty are not suitable as reverse proxy servers, but they are popular as lightweight JEE containers for case where you don't need the full stack of services that servers like Wildfly provide. That is, no built-in JPA, JSF, JMS, and so forth.

So my take on it is that while it couldn't hurt to become proficient with Undertow, it's likely not to be a make-or-break skill in most IT shops.
1 week ago