Category "java"

How to set the user object to Sentry in Spring Boot?

In a Spring Boot project I have a SentryConfig.java file package example.services.bo.config; import org.springframework.context.annotation.Bean; i

Turkish Identity Number Verification

How can I make sure that the given text is Turkish Identity Number? I have seen js version here and phthon version here Also, posted a question couple of days

Google foobar challenge (Prepare the bunnies escape)

I recently received an invitation to a google foobar challenge I am currently on level 3. I've written a code which passes 3/5 test cases and I can't seem to fi

Native module in React Native: function returns "undefined"

So, I am practicing making native modules in Java that can have functions exposed to the JavaScript code of React Native. For that, I decided to go for a simple

Spring @Valid Message Not Coming Through in Response

I have a CQRS Rest API using Spring and Axon. Validation is setup for inputs using the javax.validation library. The validation is working properly, and catchin

How to maintain accordionPanels in the same order?

I'm using accordionPanel in Primefaces. When I refresh the page the order changes! For example: I have 1,2,3 then they become 2,3,1 or 3,2,1 ! The order of the

Java Date.getTime() returns an incorrect response for 2022 April

Using Date.getTime() to calculate the number of milliseconds in a day. Google shows 86400 seconds or 86400000 milliseconds in a day. I measure every day in Apri

Spring - is it possible to give same url (path) in request mapping for two different post methods?

Is it possible to map same path (uri) in request mapping for two different post methods, only difference is request body. Example @RequestMapping(value = "/he

GET REQUEST does not return faculty data properly causes 500 Internal Server Error

I'm trying to return the faculty data with it's corresponding students, professors, subjects and grade, I get this Error 500: I want postman to return this: to

How to make React Native Component background transparent?

I am using Tab Navigation which contains two screen, I need to make the background of each screen transparent so the app background is visible. This is how it l

Build android error at stage app:mergeDebugResources, ParseError AttributeNSNotUnique

I've been trying to build my Android Application on Android Studio 4.2 with Gradle 4.2.1, but I am faced with the following error of which I was only able to fi

"java.lang.ExceptionInInitializerError" error in RestAssured post request with body

I'm using restassured library and at the below line i'm getting "java.lang.ExceptionInInitializerError" error caused by "Caused by: java.lang.reflect.Inaccessib

Using 0 as Primary Key

I use lookup tables commonly and sometimes I have some default record in the Lookup table and I think for this record I can use 0 as Primary Key a as shown belo

In the postman I am getting proper json response but when I hit the service through restTemplate I am getting chinese characters

Code: RestTemplate template=new RestTemplate(); HttpHeaders headers=new HttpHeaders();

java.lang.VerifyError: class com.intellij.junit4.JUnit4TestRunnerUtil$5 overrides final method getRunner.()Lorg/junit/runner/Runner;

While running test cases from IntelliJ - facing this issue. mvn clean install works fine though. Anyone faced this issue before ?

How do I avoid NaN?

I understand it's because the program thinks I'm dividing by O, but I'm not sure how to fix it in the program. The program works fine, though. It outputs the av

handling back button android

I have a problem while hitting the back button on an activity, in particular, the back button on the activity closes the application and destroys all the activi

What's the difference between calling super.onCreate() and calling through to the superclass? [closed]

The following screenshot is from official Android documentation of android.app.Application#onCreate() which says If you override this method,

Java 8 Streams - How to get an equivalent of partitioningBy() with Integer keys?

In the code shown below, p is a predicate of type Predicate<String>. Map<Boolean, List<String>> partitioned = numbers.stream() .collect(Co

How do I return the final discounted price instead of the discounted amount off?

I am creating a method that takes a percent as a parameter and decreases the price by that percent. public void lowerPriceBy(double percent){ price = price/