Java Community | Help. Code. Learn.

JCH

Java Community | Help. Code. Learn.

With more than 20,000 members, join one of the biggest and most active Java Communities on Discord! ☕

Join

java-help

❓︱qotw-answers

CNN for 1x8x8 Matrix outputs weird values?

I'm currently trying to create a CNN network with deeplearning4j which is supposed to evaluate chess games, it has a double[][] with one channel as Input and a single double value as output. My training input data consists of double[][] onjects which are filled with the numbers -6.0 to 6.0 for the chess figures (-6.0 mean black king, 6.0 mean white king, 0.0 is an empty field) and the output data are centipawns, usually between -1000 and 1000 (negative numbers stand for an advantage for black, positive for white). Tho there are some centipawns beyond that like -20000 if someone has a really extreme advantage and even the maximum integer valua if there's a checkmate. Now I try to train my CNN to calculate a centipawn for a Chess board, tho it only outputs positive insanly high numbers like 1.0E9... Anybody knows how to fix that or what I could try?...

Explain the flow of google auth in spring boot

``` @Bean public SecurityFilterChain googleOAuth2SecurityFilterChain(HttpSecurity httpSecurity) throws Exception { return httpSecurity .securityMatcher(new AntPathRequestMatcher("/oauth2/**"))...

Help with ArrayIndexOutOfBoundsException but no ArrayList allowed

Can smb help out. I'm not allowed to use arrayLists or .split() so this has been a pain. Caused by: java.lang.ArrayIndexOutOfBoundsException: arraycopy: last source index 30 out of bounds for object array[10] at java.base/java.lang.System.arraycopy(Native Method) at ChessElo.calcTournamentResults(ChessElo.java:108)...

help with detailinfo

hi, i have to include this proto in gameentity.java so it notifies the client where healing comes from, but no idea how

Creating a javadoc

Hey I have all my classes public and i have added comments but i am trying to generate javadoc i get this error ``` [parsing started DirectoryFileObject[/Users/martinlejko/Desktop/keysmash/src/main/java:com/keysmash/gui/HelpScreen.java]] [parsing completed 0ms]...

Deleting Error

i am tryna delete a book from a list of books but end up with this error

Ping Controller is not accessible

I am trying to implement oauth2 in my spring boot application, So far I have successfully implemented it but there is oene problem I am not able to access the ping controller without the JWT token. Here is my SecurityConfig file. Please help me in finding the issue here

Am I supposed to making a Java class or interface file type?

I have to make a specific class but I am confused with the directions as this part doesn't give you the first steps on how to make it.
Scheduler class This is the user interface class to process the command lines entered on the terminal. An instance of this class can process a single command line or multiple command lines at a time, including the empty lines. You will lose 10 points if it cannot process multiple command lines. When your software starts running, it shall display "Scheduler is running.”. Next, it will continuously read and process the command lines until the “Q” command is entered. If the Q command is entered, display "Scheduler terminated", then the software stops normally. -2 points for each violation....

Exception CNN neural network with java

I am trying to create a neural network in java using deeplearning4j, but I keep getting an error when trying to create the network. ``` [main] INFO org.deeplearning4j.nn.multilayer.MultiLayerNetwork - Starting MultiLayerNetwork with WorkspaceModes set to [training: ENABLED; inference: ENABLED], cacheMode set to [NONE] Exception in thread "main" org.deeplearning4j.exception.DL4JInvalidInputException: Input that is not a matrix; expected matrix (rank 2), got rank 4 array with shape [3, 16, 3, 3]. Missing preprocessor or wrong input type? (layer name: layer2, layer index: 2, layer type: DenseLayer) at org.deeplearning4j.nn.layers.BaseLayer.preOutputWithPreNorm(BaseLayer.java:312)...

Cannot host Spring web app war on Tomcat using Jenkins plugin

Can you help me to deploy my project to Tomcat container using Jenkins? In build step I use script file buildscript-no-launch.bash: ``` #!/bin/sh ...
No description

WebSecurityConfig in java spring app doesnt work

hey guys. can smb help me out? i have java spring app runing on my server dev2. on the server i also have nginx basic auth and proxy configured. now when i do the request to http://dev2.mysite.lt/bgw/perlas i get asked for my nginx basic auth credentials. i enter them, and later im prompted with another login page thats comming from my app. my WebSecurityConfig looks like this: ```java @Configuration @EnableWebSecurity public class WebSecurityConfig extends WebSecurityConfigurerAdapter {...

I am getting an error when on my workspace in eclipse

I just finished setting up my workspace and was about to launch the game and then it shows me this
No description

Weird issue that gets solved by wrapping it in a try/catch but it never gets caught

I'm coming from C# and learning Java and I stumbled across a bit of a weird issue with String.startsWith and String.equals in foreach loops. I have a method to which I pass a String array, in this method I have a foreach loop that checks each string to a specific value using String.startsWith. If I DON'T wrap the loop in a try/catch I get an error that says the current array item is null when it doesn't match, but if I DO wrap it and put a breakpoint or println in the catch block, it's perfectly fine and I don't get any errors and the exception is never caught. ...

Spring Security and OAuth 2 learning difficulties

so i was going through Spring Security in Action by Laurentiu Spilca and read it till ch 11 so i understand the architecture and flow of spring security but when i came to oauth 2 part it confused me a lot and even made me doubt if i understood the previous part can yall recommend me a oauth 2 tutorial article/video or wtv that can clear it up for me the book just isnt doing it for me and his playlist too couldnt clear it up...

Jetty base resource help

Hey, I have a java app and I'm using jetty server I used to have this code context.setBaseResource( Resource.newResource( WebConfigurationProvider.class.getResource( "webapp" ) ) ); But after upgrading to jetty 12, Resource.newResource isn't available anymore I replaced it with ```...

How do I use the results of an action?

I'm trying to pass some information from user inputs back into my code but I don't really know how to go about it. Basically, I'm making a Swing application that builds an XML file with a lot of repetitive lines and the idea is that the user will be able to input the unique values for each line, and the program will fill in the rest. I have a dialog open with several text fields for the user to input information, once the user is done, I store the contents of these fields in a List and then (after checking for bad input) use the List to create an object with the user data in the fields. I then need to add the toString of that object to the next line of my final output. ...

Im trying to create an ArrayList of LinkedLists.

I want to create an ArrayList of n elements. N is a number the user inputs. Each element of the ArrayList will have a LinkedList of size n. Once the linked lists are created I'm suppose to input data. Can someone please guide me through the process? I have provided what I have coded so far, please take a look and if something is wrong, I'd appreciate the feedback.
No description

Practice on an off day

Hi! I'm currently learning java through my college and I'm trying to figure out how i can practice all the things I've learned on my off day, as there aren't any ongoing projects for the class. If anyone has recommendations on what I can do to further practice the things I've learned and develop a deeper understanding of the different concepts, I'd love everyone's input!

What do the modifiers of classes do?

public, private I have understood But what do abstract, static and final do? I have searched a lot, and the definitions are inconsistent over different sites...

Regex on `finalName`

Currently my pom's finalName is ProjectName-${project.version}-${git.branch.caps}-${git.commit.id.abbrev} I want to run a regex replacement on the resolved version of that string before the project builds. Is this possible?...