Questions tagged [java]

621745 questions
1

votes
2

answer
179

Views

how to expand child on particular Button click in Expandable List View [duplicate]

This question already has an answer here: ExpandableListView expand only on a specific Button? 3 answers How to expand child on particular Button click in Expandable List View rather than Group click
Kavya
1

votes
1

answer
264

Views

Not able access multiple data sources in Spring boot

I am new to Spring & Spring boot and I am trying to access two data sources but am I able to connect to only one data source. when I try to call a function accessing 2nd data source the call goes to the first data source and I get the below error, com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorExce...
Arigato Manga
1

votes
0

answer
37

Views

How to run a timer on multiple selenium windows? (Selenium Java)

The goal of my program is it to open two firefoxdriver windows and have them both click a button at a certain time (11am for example) How can I achieve this? This is what I have so far, but it doesnt work and I'm not sure how to fix it. public class Timetest { public static void main(String[] args)...
hypecode
1

votes
0

answer
432

Views

Jacoco code coverage report is wrong?

I configured jacoco in maven pom.xml for code coverage and excluded some classes in pom.xml. When i excluded particular package code, coverage percentage is increased from 64% to 88% (because of exclusion). But overall project code coverage percentage is same before and after exclusion. Please sugge...
Nag-Raj
1

votes
1

answer
59

Views

Spring Roo example on main page does not work

I installed Spring Roo. But when I try the script at the bottom of the Roo's main page, project setup --topLevelPackage com.fooI have this error: You cannot specify option 'topLevelPackage' when you have also specified '' in the same command What can I do to make it work?
Pierre Thibault
1

votes
0

answer
41

Views

Performance optimizations of LineBreakMeasurer

I am currently writing a text block with syntax highlighting in OpenGL and to layout my lines correctly with line wrapping I am using AWTs LineBreakMeasurer. The visual results are perfect, the performance is OK, however I was wondering if there are possibilities to make it a bit faster. Currently i...
Cromon
1

votes
1

answer
314

Views

Google Cloud Storage Client API fails in Certificate validation if we pass javax ssl params

I have successfully builded and ran a code snippet to upload the document to google cloud storage using the Java API. While integration of Google Sql to our project we have introduced the keystore and truststore params. After the introduction of the store params the upload document API's are failing...
ted
1

votes
1

answer
275

Views

How to setup standalone Controller only once before all test cases in Spring Boot?

I am writing unit tests for controller. I am mocking service layer and using standalone setup for rest controller. ProductSupplierControllerUnitTest.java public class ProductSupplierControllerUnitTest { @Mock private ProductSupplierService productSupplierService; @InjectMocks private ProductSupplier...
Harshit
1

votes
1

answer
47

Views

ProGuard modifies (increases size) skipped classes

I'm obfuscating an executable jar using ProGuard version 5.3.3. My jar contains other libraries which I do not want to obfuscate or optimize. This is my ProGuard config: -libraryjars 'C:\Program Files\Java\jre1.8.0_131\lib\rt.jar' -injars myjar-debug.jar -outjars myjar-release.jar -skipnonpubliclibr...
PC.
1

votes
3

answer
309

Views

Android - Singleton Class only updating on second refresh

I have a singleton class called DataManager. I update some data in DataManager when I call onStop() in a class (activity) called userProfile. It takes the values from some text input boxes and updates the User Object in DataManger. I navigate through my app with a BottomNavigationView - so when I pr...
Taylor Barton
1

votes
0

answer
411

Views

Android unloading classloader cause crash

I'm working on an android app and I'm trying to plugin-like feature which would allow loading additional dex files to extend app functionality. I've figured out how to load additional dex files extending PathClassLoader with few small changes to allow other modules to communicate. The issue is that...
Patryk Rogalski
1

votes
0

answer
270

Views

Adding Google recaptcha to Java Swing

I'm doing a swing client to connect on a site, but it have a recaptcha. So I'd like to grab this recaptcha and put on my application, maybe on a webview, so the user can make it. To manage that, I make a GET request to the site where the captcha are and get the data-sitekey, send this key to my serv...
Felpsaps
1

votes
1

answer
82

Views

control a lot of ifs in calculating number value of String in Java like (“-3.1+0.12*0.0023-34.1/2.1”)

I wanna to solve my Homework about calculating number value of String in Java like '-3.1+0.12*0.0023-34.1/2.1' I have limitations to use only Arrays and Strings and not use recursive functions (as first year student) What I try? I am trying to solve it by parsing string char by char. I try this meth...
1

votes
1

answer
98

Views

How to loop a function for a period of time

Trying to loop a function for a specific period of time, bear in mind the function takes about 20 seconds to finish executing. There's obviously the option of using something along the lines of: long startTime = System.currentTimeMillis(); long length = 30000; while(System.currentTimeMillis() - star...
a.khaled
1

votes
1

answer
153

Views

RxJava: How can I wrap a multi-step operation, returning the step complete to observers?

Lets say I have a login and user data method, representing HTTP calls: Single login(); Single userData(); I need to call login() then userData(). If both succeed, the user is logged in. I know how to wrap them up in a e.g. Completable: Completable performLogin() { login().doOnSuccess(this::storeLogi...
Xiao
1

votes
1

answer
307

Views

Eclipse : Can't import class from another project's test folder

I have two projects, lets call them A and B. B is a dependency in A's pom as my.group.id B 0.0.1-SNAPSHOT now i have some unit tests under src/test/java/ in project A. Here is a test class i have src/test/java/packA/testForA.java Also, in project B, I have src/test/java/packB/configForB.java I need...
AbtPst
1

votes
0

answer
240

Views

Spring NamedParameterJdbcTemplate return empty list for oracle db

I had such problem: 'ORA-12705: Cannot access NLS data files or invalid environment' before. After reading different solution of this issue I added string Locale.setDefault(Locale.ENGLISH); to my DAO class method But now it returns empty list. Code of Dao class: public class StudentsDao { private...
AKS
1

votes
1

answer
170

Views

Changing an inspect element with selenium java/JavaScript console?

I'm trying to use the selenium chrome driver on Java and part of my script requires me to edit a google chrome element of a website. How can I modify the value of this element using java? I figured out I'm supposed to use this code: JavascriptExecutor js = (JavascriptExecutor) driver; js.executeScri...
Blake W
1

votes
1

answer
92

Views

Java Spark: com.mongodb.spark.config.writeconfig issue

I am trying to connect with MongoDB via java spark connector and I am getting an error 'com.mongodb.spark.config.writeconfig', when I submit the jar and run the jar in spark shell. Here the error screenshot: Could you please help me to resolve this issue. I have tried this as well, but no success. $...
Tom Swayer
1

votes
1

answer
2k

Views

BuildException: Failed to execute aapt

I am trying to build the project and following error is coming: org.gradle.tooling.BuildException: Failed to execute aapt at com.android.build.gradle.internal.res.LinkApplicationAndroidResourcesTask.invokeAaptForSplit(LinkApplicationAndroidResourcesTask.java:547) at com.android.build.gradle.internal...
Malwinder Singh
1

votes
2

answer
740

Views

How to print A binary tree?

how can i send (node.data) from SortTree Class to TreePrinter then used to print A Tree . import javax.swing.tree.TreeNode; public class SortTree { static Node root; TreePrinter type =new TreePrinter(); class Node{ int data; Node left, right; Node(int d) { data = d; left = null; right = null; } } N...
Adeeb_Alqubati
1

votes
0

answer
53

Views

Scaling images in exact touch position

I am trying to make dialog to show full screen image + scale it like in Instagram. But it is scaling by center, not touch positions. How can I scale it by touch position? I tried this to do it, I found scale types public class DFragment extends DialogFragment { public final static String BITMAP_ARG=...
Ilqar Rasulov
1

votes
3

answer
364

Views

How to wait for a AdMob Rewarded Video to Load properly

I am trying to use the AdMob Rewarded Ad in my Android application. In order to include it in the refered app, I need to wait for the rewarded video to load after the user click the buttom. I am trying it throughout the code bellow, but I get the error: java.lang.IllegalStateException: showAd mus...
Siqueira
1

votes
0

answer
43

Views

Javafx: How to group mouse actions over an image

I am a newbie in Javafx and I am trying to fix a cropping over an image. I found an interesting solution for cropping with rubber band and now I try to modified this in my scenario. I have two controllers. One controller has the crop button (CropController) and another controller which contain an im...
ShrnPrmshr
1

votes
0

answer
155

Views

ManagedExecutorService does not execute tasks

I am trying to execute a task in a different thread using ManagedExecutorService inside Singleton EJB. However, the run method never gets executed. The application is deployed with Glassfish 5. @Singleton @Startup public class MovieInventory{ @Inject Logger logger; @Resource ManagedExecutorService...
sekula87
1

votes
1

answer
724

Views

Hierarchical data manipulation in Apache Spark

I am having a Dataset in Spark (v2.1.1) with 3 columns (as shown below) containing hierarchical data. My target objective is to assign incremental numbering to each row based on the parent-child hierarchy. Graphically it can be said that the hierarchical data is a collection of trees. As per be...
Sridher
1

votes
0

answer
265

Views

Priority Queue that uses a comparator and has decrease key operation

So I have a problem where I have a set of objects with two fields. I need to be able to get the min object of the set at a fast time time (using a custom comparator). The problem is, when I get the min object set, it changes the fields of some objects in my original set. Thus, the ordering of the se...
BoredPerson
1

votes
1

answer
376

Views

How to refresh ACCESS-TOKEN in Retrofit2/rxJava

I make a request (any, authorization, registration, etc.) and only then I find out that I need to update the ACCESS-TOKEN, that is, I get the error 401. Here is the authorization request: BaseApplication.getApiClient() .signIn(accessToken, body) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedu...
No Name
1

votes
1

answer
83

Views

Naming convention for a getter of a boolean with a specific name?

I have the following member in a class: private boolean requireColons; I am aware that the convention is to prefix all boolean getters with is but isRequireColons() doesn't make sense. How should I name this?
Michael Smith
1

votes
1

answer
59

Views

Pass touch event from recycler to its parent LinearLayout

I have something like this : When the layout is scrolled to top, when the user makes a similar to 'swipe to refresh' move with his finger, I need to make a translate animation on Y axes. In other words, I need to follow the move of the finger the whole recycler if the recycler is on top. I tried t...
karvoynistas
1

votes
0

answer
190

Views

EclipseLink - NullPointerException on checkForUnregisteredExistingObject

I got an strange exception on inserting new objects into a database using eclipseLink. I have a class called 'Log' which is the entity class for my database table 'LOG'. @Entity @Cache(isolation = CacheIsolationType.ISOLATED) @Table(name = 'LOG') @XmlRootElement @NamedQueries({ @NamedQuery(name = '...
The Dodo
1

votes
0

answer
388

Views

JADE (Java Agent Development Framework): cannot find agent on Intellij

I'm new to JADE. I'm trying to run an Agent on intellij, i already added the jade.jar file to the modules and checked the export option on the module and created a run configuration with the following characteristics: Main Class: jade.Boot Program Arguments: -gui -agents agent1:newPackage.NewAgent R...
Stefan Postolache
1

votes
2

answer
700

Views

Apache Camel redelivery: how to use the attempt number

I have a Camel Route with the onException clause: at each redelivery I want to increase the redeliveryDelay. How do I get the attemptNumber? The DefaultErrorHandler clearly stores it somewhere because it prints it in the log e.g. 'On delivery attempt: 1 caught' onException(MyException.class) .handle...
Gep
1

votes
1

answer
224

Views

Spring Cloud Config server - Logback error

I am creating a client. I use a remote server. The bootstrap file is: spring.application.name=myApp spring.profiles.active=dev spring.cloud.config.uri=https://url.config.server spring.cloud.config.username=user spring.cloud.config.password=pass logging.config=${spring.cloud.config.uri}/${spring.appl...
Xavier
1

votes
0

answer
215

Views

How to implement custom listview adapter in tabbed activity?

I am trying to implement the custom list view in tabbed activity for youtube video playing app. I could not able to call custom listview adapter in fragment java class. I have tried to pass getActivity() to custom adapter but the app crashes. If any one know the solution please help me. The java cla...
Kishan K
1

votes
0

answer
18

Views

space after using setDistributeEvently

I use these SlidingTabLayout and SlidingTabStrip in my activity. This is before I use setDistributeEvently When I use setDistributeEvently it's add me space between Appbar and Fragment Any solution ?
dz00dz
1

votes
1

answer
35

Views

How to set up Idea under MacOs

I downloaded Idea EAP 2017.3 Ultimate for Mac OS, with a bundled jre. Once I cloned my gradle project, I tried to sync but it was complaining that there was no project SDK. I tried to add the bundled jre under /Applications/IntelliJ IDEA.app/Contents/jdk/Contents/Home but it always complained it was...
elect
1

votes
1

answer
254

Views

How to get item size in Vaadin8 combobox?

I'm trying to show a pop-up if there is no any item in Vaadin8 combobox. But there is no getItems() or size() methods. here is my code, if branch size = 0 I want to push a notification to user. cbxBranch = new ComboBox(); cbxBranch.setPlaceholder('Select a branch'); cbxBranch.setItemCaptionGenerator...
stephan
1

votes
0

answer
186

Views

Keep MQTT Topics Subscribed onResume Activity

I've a MQTT Service Class, MyMqttService.class, runing when I log in in my app: Intent intent = new Intent(getApplicationContext(), MyMqttService.class); startService(intent); Then I have various Activities and in one of them, I have switch buttons to select which channels I want to subscribe. In my...
Nelson Silva
1

votes
0

answer
149

Views

JAVA SSLSocket keyStore and trustStore, bad certificat error

I’m currently writing a JAVA app that receive AJAX requests from a PHP server. I use sockets for this and it works fine with HTTP requests. But now I would like to do the same thing with HTTPs requests. So I created a keyStore using cert and RSA key of the website : openssl pkcs12 -export -in -in...
Florent Guibert

View additional questions