Brian Jones Jr.

Ranch Hand
+ Follow
since Sep 26, 2016
Brian likes ...
Mac Java Ubuntu
Merit badge: grant badges
pokemon trainer
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Brian Jones Jr.

Bear Bibeault wrote:A 3rd edition is being planned, but there's no announced availability date.

Everything in the 2nd edition is still very relevant for today's JS.

Thanks Bear!
Hi, I was thinking about reading this book after reading a beginners book on JS. Is this book outdated, or is it still a good read in 2022? Is a 3rd edition coming out soon? I'm going to use JS for front end web development. I did a quick google search and I didn't see any recent reviews from the last year on code ranch or reddit. Thanks.

Tim Moores wrote:For additional ideas you could also study the source code of a mature Java blog platform such as It supports multiple blogs as well as multiple contributors per blog.

Thanks! That's super helpful.

Stephan van Hulst wrote:I believe Wildfly just uses the standard Java EE security mechanisms. You can read more about those here:

I believe chapter 47 will explain how to add users, groups and roles to your application, and chapter 49 will explain how to authorize certain users, groups or roles to access methods in your application.

Thanks! I heard of this, but I wasn't sure exactly what it did.

Stephan van Hulst wrote:Typically this is done by middleware in the request processing pipeline of your web application framework. Most web application frameworks have already implemented this middleware. For instance, Spring has the Spring Security project which includes in-memory authentication.

What framework are you using to develop your web application?

Thanks. I don't think I have a framework equivalent to Spring. This is some of my tech stack:

Wildfly 10
Hibernate 5
Postgres 9
AngularJS 1
Java 8

Can I add only Spring Security to my project?
I also don't have the database setup. So, I also need a temporary way to do this. Thanks.
I am building a java web app. It will be a blog. I need to add login functionality so that an authorized user can create a blog, and it will prevent an unauthorized user from accessing the blog creation features. How would this be implemented on an Enterprise app? Thanks.

Rob Spoor wrote:Ignore any JBoss/WildFly specific configuration. You're trying to run a unit test, and that has (more or less) the same rules as a standalone JSE application.

Last time I had to unit test my database code, I simply used a second persistence.xml (in src/test/resources/META-INF) with its own persistence unit name, and used that. This one was mostly identical, except:
1) the transaction-type was RESOURCE_LOCAL instead of JTA.
2) there was no data source, but properties for connecting instead (you already have those).
3) classes were included instead of relying on automatic discovery.

Thanks! I'll give this a try.
My stack:
JBoss Wildfly 10 server
Ubuntu 16.04
Java 8
Postgres 9.5.6
Hibernate 5

I am having problems trying to get my JUnit test to work. The unit tests were created by JBoss and they are used to test if Hibernate is working properly. I got their hibernate5 quickstart tutorial to work, and it was using an H2 database. Now I'm trying to using some of their code (datasource.xml and persistence.xml) for my personal project, and I'm using a Postgres database with Hibernate JPA. I got the following exception when I tried to run the unit test:

Here's the unit test method that corresponds with the exception. The exception is thrown in the try block:

I tried to configure my standalone.xml using this StackOverflow post webpage. Here's what my standalone.xml datasource looks like:

Here's what my module.xml looks like. It's in directory

Here's what my datasource in the WEB-INF folder looks like:

Here's what my persistence.xml looks like from the META-INF folder:

Does anyone know what I need to do in order to fix this exception? Thanks.
I tested the following code in in JSFiddle, and it returned 0.  Why is this not returning false?

I'm trying to work through the AngularJS v1.2 tutorial. The task is to:

Add a method to GalleryController called setCurrent that accepts a value and assigns it to current. If no value is passed in, set current to 0.

The pertinent code in app.js

Here's the index.html that uses that GalleryController

I don't understand how || works on line 8. According to the MDN docs for Logical Operators I think this should set this.current to false if nothing is passed into it. I am confused. Can someone help me? Thanks.

Campbell Ritchie wrote:By no means an easy subject. I know that foo(int...) and foo(int[]) are regarded as equivalent to each other, so they are not permissible together. That sounds like a mistake in the Java™ Tutorials, so I shall send you to the Java® Language Specification (=JLS) here. Beware: The JLS is often difficult to read.

Thanks Ritchie!
7 years ago
I was reviewing the nuances of overloading methods, and I came across the paragraph in the Oracle docs:

The Java programming language supports overloading methods, and Java can distinguish between methods with different method signatures. This means that methods within a class can have the same name if they have different parameter lists (there are some qualifications to this that will be discussed in the lesson titled "Interfaces and Inheritance").

Last week I read the entire Oracle lesson on Interfaces and Inheritance Interfaces, and I don't remember reading about this. What are the qualifications?
7 years ago

Campbell Ritchie wrote:
Remove the top three lines, which only appear to be duplicates of lines 4‑6.

OK, I made the changes.

Campbell Ritchie wrote:
I think you shou‍ld restore the PATH in /etc/environment.

I restored the PATH in /etc/environment. Removing the PATH from there ruined my OS. I had to restore from a backup lol.

Campbell Ritchie wrote:
How did you install Java®?

I was trying to learn how to install Java from command line. I think it would be helpful for use with Docker. I think I used this website:
Java CLI installation

Campbell Ritchie wrote:
In a fit of desperation I shall suggest a couple of things, but we really are scraping the bottom of the barrel here:-

  • 1: cd / then sudo grep -R "CLASSPATH=" * which shou‍ld find any files where you have set a CLASSPATH and forgotten.
  • 2: export CLASSPATH=~/Documents:$CLASSPATH:~/Documents then echo $CLASSPATH
    That will really mess up your CLASSPATH, but if you set it at the terminal, it won't affect other terminals. See whether you have somehow got the CLASSPATH set to whitespace only.

  • I did the unset CLASSPATH. Now I don't see a CLASSPATH when I do an echo $CLASSPATH. The CLASSPATH doesn't get set when I close and open a new terminal. My best guess is that reinstalling the old image fixed things. I must have done something funky in the last week when I tried to set the CLASSPATH.

    Thanks Campbell and Dave. I learned a lot!

    7 years ago