Category "java"

Modbus4J Modbus RTU master

Currently I am working with the Schneider Power Logic electrical device. I want to read the data from the device and show the value in my system. So far, I disc

How to securely store a user password in java for reuse throughout application

At the start of my Java application, I have the user enter his username and password. These credentials are stored in a ConnectionKey object which is used as th

Customize keycloak error page with spring boot

I use keycloak-spring-boot-starter to protect my rest-service from unauthorized access. The authentication works as expected, but if the authentication fails, t

Determine JDK home from Maven toolchain

I have a Maven build configured to use maven-toolchains-plugin, with ~/.m2/toolchains.xml simply configured for multiple JDKs: <?xml version="1.0" encoding=

QueryDSL: convert list of BooleanExpression to Predicate

I'm trying to create a query that would depend on number of boolean parameters. The function that creates the predicate looks like this: Predicate createPredic

Could not connect to http-remoting - Maven-Wildfly plugin

I am attempting to employ the functionality of Deploying to Wildfly 9 in my build process with the Wildfly-Maven plugin. I am unable to deploy the application,

Initialize field before super constructor runs?

In Java, is there any way to initialize a field before the super constructor runs? Even the ugliest hacks I can come up with are rejected by the compiler: cla

Generate all contiguous sequences from an array

There's an array say [1,2,4,5,1]. I need to print all the contiguous sub-arrays from this. Input: [1,2,4,5,1] Output: 1 1,2 1,2,4 1,2,4,5 1,2,4,5,1 2

migrate template from velocity to freemarker

I need to migrate some templates from velocity in liferay 6.2 to freemarker for liferay 7.4 dxp, I tried to use the USCavalry tool, but the result is not comple

Write PNG file with less disk size in Java

I have a BufferedImage: BufferedImage bi = new BufferedImage(14400, 14400, BufferedImage.TYPE_INT_ARGB); I have saved this image to a PNG file using the fol

Java - OAuth 2 using restTemplate to get login with refresh token (StackOverFlowError)

I created an interceptor to get the token before i do other request but i have the error "Method threw 'java.lang.StackOverflowError' exception." when i do the

Android: set just one padding of textview programmatically

I want to set the top padding of a textview programmatically. I know you can do this with the method setPadding(). But the problem is that this method requires

How to export XML format in Jasper Reports

I want to export data in xml format which needs to look like this using jasper, I downloaded the jaspersoft studio but there only pdf and csv formats available

Java Stream: divide into two lists by boolean predicate

I have a list of employees. They have isActive boolean field. I would like to divide employees into two lists: activeEmployees and formerEmployees. Is it possib

Debugging maven tests with IntelliJ

I've read multiple variants of this question (sorry for adding another), but none have offered a working solution. I am trying to debug a failing test in the a

404-not-found-while-running-spring-boot-rest-api

While running springboot restservice application got 404 error. I am using spring boot, jersey rest. I have tried GET requests http://localhost:8080/dunames bu

JDBC Derby driver not found

I've followed the JDBC tutorial at: http://docs.oracle.com/javase/tutorial/jdbc/basics/gettingstarted.html, and managed to build and create my own JDBC database

Port android app from Android Studio to Microsoft Visual Studio

I have an app written in Android Studio, that I want to work on using Visual Studio. Is there a way to import my project into Visual Studio?

java.lang.IllegalArgumentException: input == null! when using ImageIO.read to load image as bufferedImage

This is a question that has been asked like 100 times on this site, but I have looked at all of them and even though they all were solved, none of the solutions

Is tagging a form of data mining?

I am implementing a small CRM system. and the concept of data mining to predict and find opportunities and trends are essential for such systems. One data minin