October 21, 2024
Chicago 12, Melborne City, USA
java

Random calculating anomalies in Java program

I have a java program game that I am making that is having some random calculation anomalies. The way that the program works, the player can spend money on stocks and then it 10 game turns the money is returned to the player with either an increase in stock value or a decrease (increase or

Read More
java

How to get an operating system's internal/keyboard charset, related to alt-key character input

Preface I’m currently working on a small app that literally types the input from the system Clipboard (using Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);), by simulating the keystrokes of the keyboard (using java.awt.Robot.keyPress(keyCode)). This is for some instances where UI elements do not support copy-paste (neither ctrl+v nor shift+ins), or deadkey control is blocked in the app or on the

Read More
java

Disambiguate XStreamAlias elements through xpath

I’m trying to convert a FIX XML dictionary to an object model using Xstream. The @XStreamAlias mechanism works, however, is there a way to use a different Java class for XML elements with the same name but at a different position in the tree (a different xpath). For example ‘field’ elements exists at /fix/header/field and

Read More
java

How do I resolve ClassNotFoundException?

I am trying to generate a print preview with jasper reports 7.0 in Netbeans, and i am using JDK 19. I have some records in database and i am trying to generate a print preview when a user clicks on a record. But so far i encounter this error anytime i click on the button

Read More
java

Not able to run very simple method

I am trying to set SQLQuery and trying to get its result via bean but unable to fix it. Here is my code: public static int countTotalNumberOfRecords(String countQuery) throws SQLException { CountQueryDAO db = new CountQueryDAO(); PagingBeanProcessor bean = new PagingBeanProcessor(); bean.setCountQuery(countQuery); bean = db.selectAll(); int totalRecords = bean.getTotalRecords(); return totalRecords; } This is how

Read More
java

Calculating variance in Java with arrays

I’m very new to programming and I’m having troubles calculating variance. First of all, I have file that is full of data. The exercise is: there are shops and each shop sells same brands of apples. We are looking at the sourness of apples (measures on 0-5 scale). So the my problem is, that I

Read More
java

How to access the top level/enclosing class instance having the instance of the inner class

NOTE: I’m not talking about the way of accessing the enclosing class FROM the inner class, that is not the problem at all. What I’m talking about is the following: class TopLevel { class InnerClass { } } // in some other class A.java public void execute(InnerClass ic) { } Here, in the execute() method,

Read More
java

Confused about eureka server functionality

when I started eureka server in spring cloud ,in the dashboard, I saw that the renew threshold is 1. Why is this at all? I did not register an instance in it that wants to take a value. Also when I registered a client microservice in it, as it is clear in the second picture,

Read More
java

java bytecode exception catch block's boundary

I got a class which generated by dex2jar, the bytecode like this public boolean a(com.google.android.exoplayer2.metadata.Metadata); descriptor: (Lcom/google/android/exoplayer2/metadata/Metadata;)Z flags: (0x0001) ACC_PUBLIC Code: stack=2, locals=6, args_size=2 0: iconst_0 1: istore_2 2: aload_1 3: getfield #38 // Field com/google/android/exoplayer2/metadata/Metadata.d:[Lcom/google/android/exoplayer2/metadata/Metadata$Entry; 6: astore 5 8: iload_2 9: aload 5 11: arraylength 12: if_icmpge 134 15: aload 5 17: iload_2 18:

Read More
java

Request for Library or API for Nearby Cellphone Number Detection || Spring Boot || Java

I’m looking for a library or API that can help me develop a Java or Python application to detect nearby cellphone numbers. Ideally, the application should be able to: Identify nearby cellphone devices: Detect the presence of cellphones within a specified range. Retrieve cellphone numbers: Obtain the numbers of detected devices. Estimate distance: Approximate the

Read More