JavaFX SceneBuilder alternative

I have been facing serious issues with Scene Builder as it seems to freeze my desktop. Are there any alternative drag and drop GUI builders for JavaFX? Something like Android Studio where you can quickly switch between “Design” and “Text” would be really helpful.

How to configure Grails in Netbeans

I am trying to configure Grails in Netbeans.

  • Grails version:3.2
  • Netbeans: 8.2
  • JDK: 1.8
  • OS: Windows 10

I have install and configured environment path and other stuff. I can create and run project from the Command Prompt. But I can not create project from netbeans. And again I could find any way to connect grails with MySQL. I have search through the net. But couldn’t find any complete solution.

Optimal Edge Weights

There is a state (territory) which is a tree rooted at node 1. All the cities (numbered from 1 to N+1)
in this state are connected via bidirectional roads. You have to add toll tax on each road. There are N roads which connect the cities of the state. You have to assign toll taxes on the roads so as to maximize the function Toll described below:

for(i=1;i<=number of cities;i++)
    for(j=i+1;j<=number of cities;j++)
        toll+=(toll required to pay to travel from i to j)

You have to maximize the toll tax. Assign the roads by toll taxes from the given array A(using each value exactly once). Find the maximum toll obtained.

Input Format:

First line contains
N and an integer whose value is always 2.

N roads follow containing 2 integers u and v, denoting the cities between which the road is.

Next line contains N space separated values denoting elements of array A.

Output Format

Print the maximum toll which can be obtained.

Input Constraints



Sample Input

2 2

1 3

2 3

5 7

Sample Output

Assign 5 to edge (1- 3) and 7 to edge (2 – 3). This leads to an maximum toll tax of 24.

App Stops when trying to play Video Ads

My APP has video ads section where users can watch ads from admob when I pressed play button in the morning ads were coming and everything was working great but now when I click that same button app is crashing Below I is the details of what I got from logcat:

        Process: eelam.ellalan.rechargemafia, PID: 8570
        java.lang.RuntimeException: Unable to start activity ComponentInfo{eelam.ellalan.rechargemafia/}: java.lang.IllegalStateException: Only fullscreen activities can request orientation
        at Source:0)
        at android.os.Handler.dispatchMessage(
        at android.os.Looper.loop(
        at java.lang.reflect.Method.invoke(Native Method)
        Caused by: java.lang.IllegalStateException: Only fullscreen activities can request orientation
        at android.os.Parcel.readException(
        at android.os.Parcel.readException(
        at android.os.Binder.transact(
        at Source:7)
        at Source:8)
        at Source:28)
        at Source:0)
        at android.os.Handler.dispatchMessage(
        at android.os.Looper.loop(
        at java.lang.reflect.Method.invoke(Native Method)
        01-06 15:51:34.704 1324-1324/? E/hw-IPCThreadState: binder thread pool (1 threads) starved for 218 ms

Passing an ArrayList from a method to another in the same class?

I am coding a small project for a Clothes Shop.
and in one of my classes 2 variables(item & price) will be passed
each time a user will select a
certain product…

they will be passed into 2 different methods..

one with adding the item and one with adding a price.

and I am trying to take the first array which has all the clothes that have been added to the cart and the other one with all the prices of each and every item

every item and its price has similar indexes because they are being added at the same time…

so now… my problem is that I do want to pass both of these ArrayLists into my method “PrintRecipt()” so I’ll be able to print the items with their prices in-front of them…


package clothesshop;
import java.util.ArrayList;
public class Cart {
void cartAddi(String item){//adding a certain item will be passed here
    ArrayList<String> clothes = new ArrayList<String>(5);
int cartAddp(int price){//along with its price to be added to the cart
    ArrayList<Integer> cost = new ArrayList<Integer>(5);
    cost.add(price); int TotalP=0;
    for (int total : cost) {
       TotalP = TotalP  + total; //total price
    return TotalP;
void PrintRecipt(){ 
    //taking both ArrayLists and printing them here?

Where to place slf4j api and implementation in a multi module Java EE project?

I’m aware of reasons for missing or duplicate slf4j implementations on classpath due to (Maven) dependency management and know how to avoid such through exclusions.

However, if I have a multi-module Java project with a JAR containing EJB interfaces and entities, an EJB implementation and a WAR web frontend which is packaged as EAR I do not find a way to place the slf4j API org.slf4j:slf4j-api:1.7.25, the implementation ch.qos.logback:logback-classic:1.2.3 and the configuration logback.xml so that I have working logging in the JAR, EJB and WEB module and can avoid both

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See for further details.


SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/richter/zpool-tmp/jee-slf4j-logging/jee-slf4j-logging-ear/target/gfdeploy/jee-slf4j-logging-ear/jee-slf4j-logging-web-1.0-SNAPSHOT_war/WEB-INF/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/richter/zpool-tmp/jee-slf4j-logging/jee-slf4j-logging-ear/target/gfdeploy/jee-slf4j-logging-ear/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

I’m providing a MCVE at

simpliest way to get the xml code as string from root node (Dom parsing)

I am parsing and manipulating an xml from a string as follow:

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = factory.newDocumentBuilder();
        InputStream stream = new ByteArrayInputStream(xmlText.getBytes(;
        Document document = builder.parse(stream);
        Element rootElement = document.getDocumentElement();
<Manipulating rootElement>

How can I simply get back the the manipulated xml as a string ?

//    String mynewXml = rootElement.getXMLContent(); 

What is the convention of package deployment?

It seems that Java has no convenient package management/deployment just like pip of python, or npm of nodejs.

I know maven or gradle, but they seems to be developer oriented. We need to configure a proper pom.xml or build.gradle to make it works. And, they only download dependency packages for build, but not for deployment. For example, they download packages to private dirs like .m2 or .gradle, not to some standard dirs like /usr/local/site/packages/ so that they could be referred at global place.

I saw a lot of java projects prefer to deploy as uber-jar or shaded-jar. Although some big framework would specify some rules to share dependencies, e.g. tomcat or spring, they’re still project relevant, not in standard way.

In this perspective, Java deploys projects like Go, because they both include dependencies for deployment.