Category "java"

How to check if token expired in java?

I have user which have: id, username,password, tokenExpires which is Date. When i generate token i generate a string, how to check if token is not expired?

Difference between Static methods and Instance methods

I was just reading over the text given to me in my textbook and I'm not really sure I understand what it is saying. It's basically telling me that static method

How can i call cpprofiler in choco-solver for contrainst programming profiling

I found this on choco-solver documentation but i do not know how use it with provided choco-solver sample program in order to profile. NB: I already install cpp

org.hibernate.internal.ExceptionMapperStandardImpl.mapManagedFlushFailure HHH000346: Error during managed flush

I have a server mistake: > ERROR [http-nio-8080-exec-5] > org.hibernate.internal.ExceptionMapperStandardImpl.mapManagedFlushFailure > HHH000346: Error

Spring RequestBody with either List<Object> or Object. Name for both are same "data"

I want to handle json request for List of Object and Object it self in the same Spring controller. Below is the exact example. Json Request for Single Object:

Java get generic type of static method at runtime

So I was reading through the source code of Collections.java, there is a generic method copy(). I simplified it to this: public static <T> void copy(List&

Scanner is skipping nextLine() after using next() or nextFoo()?

I am using the Scanner methods nextInt() and nextLine() for reading input. It looks like this: System.out.println("Enter numerical value"); int option; o

Find the max value of the same length nails after hammered

I'm trying to solve this problem: Given an array of positive integers, and an integer Y, you are allowed to replace at most Y array-elements with lesser val

Bukkit - Change block on click (client side)

What I'm trying to do is to replace a block into a diamond block on client side when a player right clicks it public class setBlock implements Listener { @E

Is it possible to use data.sql without schema.sql

I want to initialise schema using spring.jpa.generate-ddl=true and then populate using data.sql. I tried it but it doesn't seem to work without schema.sql. Any

package javax.servlet does not exist | package jakarta.servlet does not exist

javac -classpath "/opt/tomcat/lib/servlet-api.jar" /opt/tomcat/webapps/ROOT/WEB-INF/classes/NewServlet.java I have tried replacing the javax.servlet with "jaka

Accessing json value using jsonpath?

I'm following the tutorial for using jsonpath (https://www.baeldung.com/guide-to-jayway-jsonpath) and using the endpoint https://api.binance.com/api/v3/exchange

How to export backup of Cloud SQL database in Google Storage?

I have a GAE project and for that to store the data i have used Cloud SQL database. I need to take on demand backup of my Cloud SQL database and the backup sho

Query through all provided schemas

I have kind of 'restaurant app' with multi tenant architecture. Each Tenant in short words have their Order table where I keep all data regarding orders which w

Meaning of Long in JPARepository?

What is Long here and what on basis do we configure this in JpaRepository? public interface FirstRepository extends JpaRepository<First, Long> { }

Coinbase Api Java POST request "Invalid Signature"

I am trying to send a POST request to the coinbase sandbox endpoint. When signing the request I always get an "Invalid Signature" response. It seems that coinba

Java Hibernate Different Behavior between starting jar from console and explorer with double click

In my JavaFx project I use Hibernate to connect to a local Postgresql database. In Intellij the project runs and the connection works. Also when I start the for

Android Studio Failed to resolve: org.junit.jupiter:junit-jupiter:

When i try to sync my project or run a unit test it shows me the following error: Failed to resolve: org.junit.jupiter:junit-jupiter: Affected Modules: app Thes

How to switch to a new window in through Selenium

I have 1 3rd party integration as Paypal. When I will click on Place Order button it will navigate me from Place Order page to paypal page. Can you please let m

Shell script running Openssl command fails with ProcessBuilder

I have the following shell script Script #! /bin/sh set -ex cp /tmp/untouched_input_backup /tmp/untouched_input #sign the digest cp /tmp/untouched_input_back