Category "java"

The work manader's work is not controlled

I have a wok manager that I run from the Main Activity when the user logs into the application. So, I will tell you in more detail what I do in the manager: in

Why are singleton beans created twice in Spring?

I have a spring-boot project that contains a BookMapper bean: import org.apache.ibatis.annotations.Mapper; @Mapper public interface BookMapper { // some CR

Runnable inside synchronized (this) leads to app crash

My code is: @Override public void loadingDone(int whatIsDone) { if (interrupt) { return; } synchronized (this) { // 1 - loaded with v

How to convert JSON to Parquet in Apache Beam using Java

I am trying to convert Json Data {"col1":"sample-val-1", "col2":1.0} {"col1":"sample-val-2", "col2":2.0} {"col1":"sample-val-3", "col2":3.0} {"col1":"sample-val

Getting android.app.ForegroundServiceStartNotAllowedException in Android 12 (SDK 31)

I upgraded my apps targetSdkVersion and compileSdkVersion to SDK 31, and started receiving the following crash in app in a service that updates widget in backgr

Grayscale PNG writing from BufferedImage using PNGJ - hightest-level approach

I just want to, at first, use PNGJ at the highest possible level to write a grayscale PNG with bit-depth 8. I am working from a BufferedImage. Here's a snippet

How to create a folder and save files in root directory from api 30 android?

note: when I say root, I mean the folder where the download, documents, music, android folders are located, etc… Environment.getExternalStoragePublicDire

Multithreaded EJB client

I would like to parallelize multiple ejb calls from a java client and maintain a single transaction. the ejb is exposed on an websphere application server, and

Is there a way to get the EntityManagerFactory on a project that uses Java Spring JPA but doesn't have a "persistence.xml" file?

I want to use the EMF to do queries constructed at runtime on a String. If there is a way I would appreciate it if someone could tell me how and give a small ex

How to check if a correct character was entered by a user in a string in java?

I'm trying to write a code that would let me check if the item inputted by the user is valid. The item has a format of: NNN-LL-NNNNNN, where N is a number and L

Error when runnning mvn command to deploy dataflow template

Hi I am running the below code to deploy a dataflow template in GCP. mvn compile exec:java \ -Dexec.mainClass=com.google.cloud.teleport.templates.TextIOT

On Selenium WebDriver how to get Text from div with Mark Tag

On Selenium Webdriver, how I can retrieve entire text from div with Mark Tag? I need to verify that the word 'correctly' is present. Example HTML code: <div

Handle back button in android

I am fragment then I click to button I will transfer to another activity by using startActivity, then in activity I have a back button in screen, I want to back

Paint not showing up on JPanel? I want to paint only if if statement conditions are met

I want to paint the walls of the pacman maze for my APCS A final. I am relatively new to graphics, as you can probably tell. The paintComponent() methods don't

Why does my program keep going to the player() method after p1Game() is finished?

Is there any way I'm able to format my code better too? I'm pretty new to programming and want to learn the best optimal way for this program to work. For examp

How to detect cycle using itarative approach

I am trying to learn how to detect cycle. I see many example of using recursion but I want to implement in iterative way. Here is my code public boolean cycleDe

In java map, I want to assign the repository functions as value like Map<key, function(>

I Want to call the JPA repository functions to access the data from the database based on the String value passed. So I want to make the string as the key and t

Spring Data JPA Redis: Query by multiple values for same key? Query by Example using REGEX not supported

Please let me know if this has been asked before. I have a requirement to do some advanced filtering on data that is stored in Redis cache. Imagine there are 2

Java code to Convert JSON into a Map with specific fields as Key and values

I have a JSON as follows [ { "a": "John", "id": "6", "c": "val1" }, { "a": "Jack", "id": "6", "c": "

Extract data from multiple Excel files

I was basically working on automation of an excel report that I share on a daily basis with the employees. The report gives details on whether or not the employ