Tagged Questions
Java (not to be confused with JavaScript or JScript) is a general-purpose object-oriented programming language designed to be used in conjunction with the Java Virtual Machine (JVM). "Java platform" is the name for a computing system that has installed tools for developing and running Java programs. ...
-1
votes
0answers
7 views
Update elements from json string java
i have following json string response received from the server.
{"entities":[{"Fields":[{"Name":"detection-version","values":[{}]},{"Name":"subject","values":[]},{"Name":"description","values":[{}]},{...
-1
votes
0answers
10 views
What those java class types / .class means? [duplicate]
can someone explain what is the ".class" and (Class) class means in java?
for example:
Class foo1;
Class<? extends IFoo> foo;
Foo.class
what are those mean?
thanks
0
votes
0answers
3 views
How to use cglib to generate a null pattern concrete class like mock
I have serval interface which clain lots of method. While I don't want to have a concrete class which contains lots of methods(not meanningful) to implement a null pattern. I want to do a method like ...
0
votes
0answers
6 views
Can Google protobuf be used for communication between C and Java services in android?
We have a legacy protocol stack written in C with c-protobuf interface and C++ wrapper API that need to be ported to Android and develop java service with AIDL interfaces. So here are the questions,
...
-2
votes
0answers
7 views
JAVA jdbc Eclipse SQLException
I was tring to add deatils to table but it showing some sql error
querry is
t=st1.executeUpdate("insert into stdetails(regno,nam,cid,gender,HouseName,place,guardian,phone,photo,did,Emailid,sem) ...
0
votes
0answers
5 views
Get all chunk items before processing?
I use Spring Batch in a project and I'm looking for a way to pre-process all items of a Chunk before the the ItemProcessor starts processing. I need to process the items of the chunk together.
There ...
-3
votes
0answers
11 views
occur nullpointException, but value is not null on android [duplicate]
I want show package versionName on gradle file
MainActivity onCreate
private TextView versionView; //global variable
PackageManager manager = getPackageManager();
PackageInfo pInfo = null;
try {
...
2
votes
0answers
15 views
JavaScript: Unable to parse json with error unexpected token
I manage to parse a json url with java code previously but need to migrate it to javascript now. When I parse using JavaScript, syntaxerror: Unexpected token I occurred
SyntaxError: Unexpected token ...
0
votes
0answers
15 views
Use lines() stream Lambda but need to close
What I want to do in my application is that let user chooses a series of text files by using filechooser, and then my application will filter some of them if it does't contain specified subString.
It'...
2
votes
2answers
27 views
Javascript object with multidimensional array
I am very new to JavaScript. I have following object in Java and I need to create equivalent in JavaScript but I am unable to achieve this:
Map<String, String[][]> objectName
-2
votes
0answers
8 views
catch block is running multiple times for InputMismatchException
So I was using this code in my program and whenever I give input consisting of multiple words, the compiler executes the catch block that many times. I've also tried it with different methods & ...
0
votes
0answers
6 views
Assembly language in Jasmin - getting syntax error
In putty I am attempting to create a Jasmin program that, when assembled and ran as a Java program, will output the integer "431". When I attempt to assemble the program the console says there is a ...
0
votes
0answers
4 views
Loading dll from relative path to create complete jar Java
I try to make java program by using Apple jdns-sd.jar. Problem is that it requires jdns-sd.dll under the system32 folder.
This is error on computer that dns-sd.dll doesn't exist.
Exception in ...
0
votes
0answers
8 views
opening the gateway setting page (192.168.1.1) in android app
i want to open the gateway setting page (192.168.1.1) in my app. I used web view but the popup window that ask user and pass was not showing so the "401 unauthorized" error occurs.
can anyone help ...
0
votes
0answers
5 views
Message pack in python2.7
I want to know the use of message pack in python2.7
My main aim is to https post a json data which will be formatted into message pack in python2.7 to a java server.
How python module msgpack can be ...
0
votes
0answers
6 views
SPARK: When transfer RDD to DataFrame,the cost of memory increases sharply?
When I transfer a RDD to DataFrame,the cost of memory increases sharply. I want to know why it increase and how to solve it.
my code looks like as below:
val listfile = "....."
sc.textFile(...
-2
votes
0answers
17 views
Can anybody show me how this recursion program runs step by step? [duplicate]
I would enjoy to see how this program runs step by step as I dont understand how it gets its answer
public static void main(String[] args)
{
System.out.print(combine(3,4));
}
public static int ...
0
votes
1answer
25 views
instance variables initialized inside method
I would like to know the difference or impact at any level if we try to initialize a reference declared at class level inside a method. why would we make a reference at class level and initialize it ...
0
votes
2answers
19 views
java.util.ConcurrentModificationException Can someone explain me the logical reason for this
i am creating a class call student and want to store those on the list i am using iterator to fetch the elements from list but i cant do so because an exception is happening and i cant resolve the ...
-1
votes
1answer
8 views
Executors NewFixedThreadPool not working
I am trying to execute multiple threads in scala and for a simple test I run this code:
Executors.newFixedThreadPool(20).execute( new Runnable {
override def run(): Unit = {
...
0
votes
0answers
2 views
How to call a WCF web-service in android?
I am trying to create an application where I need to call a WCF web service. I know how to call http and https .asmx web-services. I never tried to call WCF web-service with the same procedure as that ...
1
vote
4answers
15 views
passing instance method as parameter in java 8
lets say I have
public class Student {
public Integer getGrade() { return 1;}
}
and I want to pass this function as Function in java in other class(not Student)
which syntax will allow me ...
-1
votes
1answer
15 views
Issue with jackson parsing array of json objects
I am trying to convert Json response from rest call to a list of pojo objects using jackson ObjectMapper
Input json :- [{"TraceNo":"1122334455","BnkID":"0175","ProcessCode":"","ResponseCode":"13","...
0
votes
0answers
4 views
Querydsl fetch matching embed object from mongodb
I have a AfpCategory class(Document in mongodb) which has List<AfpServices> (embedded in AfpCategory).
For reference here is the relationship between these two classes
@Document(collection="...
0
votes
1answer
11 views
Convert java to scala code
Converting java to scala code I face a strange Problem
An example can be found here https://gist.github.com/geoHeil/895260a04d3673b9848b345edf388a2d
The error is
[error] src/main/scala/myOrg/...
0
votes
0answers
8 views
Spring REST remplate send multiple files
I am using Spring REST template for sending files over the network to other service. Code looks like this:
public ResponseEntity<String> submit(Long profileId, List<MultipartFile> files) {...
-2
votes
0answers
11 views
Where should we use Apache Jena?
I am little bit confused where need we to use Apache Jena? And Why?
In web-services , Should it be on server side or client side? After looking hydra-java annotation and api-platform docs , where we ...
1
vote
2answers
25 views
Java REGEX - Not able to remove content inside tag
This is my input text:
[QUOTE=SynapseBreak;104047835]Armchio de dragon is satki dragon lai de leh
[URL="https://play.google.com/store/apps/details?id=com.shiportal.hwzreader&referrer=utm_source%...
0
votes
0answers
8 views
How to add multiple feeds into an RSS feed android app?
I'm creating an android app which includes an RSS feed. At the moment, I've programmed the app to fetch the data from one xml feed and to show how I'd like to. However, I'm not sure how I could add ...
0
votes
0answers
14 views
Have to remove duplicate entry from XML file on basis of User ID, using DOM parser in Java
I am using DOM parser to parse xml file to get multiple Tab separated txt file to get CVS file as an output. I am able to get the output file as required in proper format with limited node elements to ...
0
votes
0answers
15 views
Crash when getting user input java.util.NoSuchElementException [duplicate]
For some reason my program is crashing when I am trying to get a user Input for a program I am writing. My class with my main in it looks like this.
package myQuiz;
import java.util.Scanner;
public ...
0
votes
0answers
8 views
How to pass a Dataset as an argument to UDF in Apache Spark Java?
I am trying to implement a simple UDF program. I want the UDF to be manipulated on a Dataset. For that i want to pass Dataset as an argument. So how can i pass a Dataset as an argument to a UDF in ...
-3
votes
0answers
21 views
How to display two or three textviews under list view without using Layout in android?
I want to display some fields under list view but without using View Group such as Linear Layout, Relative Layout.
0
votes
0answers
8 views
Error on non English satisfying sentence DL4J and NLP
I am trying to run the sample program from the Dl4J examples. Here is the program: https://github.com/deeplearning4j/dl4j-examples/blob/master/dl4j-examples/src/main/java/org/deeplearning4j/examples/...
0
votes
0answers
5 views
C# to Java DES encryption
Trying to create java class which will encrypt and decrypt as like C# code in below.
Below is my code for C#, I need to convert it to Java. Can someone help me how to do it?
I've been doing this for ...
-2
votes
1answer
28 views
How to fix 'unchecked call (…)' of a setter?
First of all, I know what raw-type are and how they work in Java.
I'm creating a container with test-data. This container is configured with a String-class property. All the items shall get values ...
0
votes
0answers
17 views
Copying files to another folder throws java.lang.NullPointerException
The program prompts the user for selecting 1 or more files using FileChooser. I save that to a list and then I send that list to this method down here. Then right after selecting the files and ...
0
votes
4answers
20 views
Add & Remove character to text field with one button
I want to make an add & remove ± operator with one button.
So at the beginning - is not available and when I click - will be added in first line of text field, if - already there, when clicked ...
0
votes
4answers
26 views
Pass Variable through addFragment()
I have a Tab layout which has tabs added via adapter in my main activity. I need to pass a variable through the addFrag (as each frag is created per json entries). See below;
Main Activity - ...
0
votes
1answer
40 views
Workaround around needed for string concatenation
Currently, when javac encounters a String concatenation, it converts the code to use a StringBuilder. For example:
String a = String.valueOf(System.currentTimeMillis());
String b = String.valueOf(...
0
votes
0answers
28 views
Convert lambda expression to method reference
In one of the method we used lambda expression (below) nesting streams.
return req.getPerUs().stream()
.map((**cfg) -> {
return rsp.getPerUs().stream()
.filter((result) -> cfg.getUsChId() == ...
0
votes
1answer
12 views
How to link java code with php interface
i have many java functions written in eclipse and i have a php interface developed. Now i would like to invoke my all java functions in php but i dont know how to link php and java any help would be ...
0
votes
1answer
9 views
Elasticsearch Java API migration form TermsFacetBuilder with AggregationBuilders
I am migrating from ES 1.7 to 5.2 and refactoring the following code.
ES 1.7
public void prepare(final SearchRequestBuilder searchRequestBuilder) {
final TermsFacetBuilder labelsFacet = ...
2
votes
0answers
12 views
JMH State classes and shared vs unshared states
I'm new to jmh and to understanding what happens behind threads and so on.
So, I started reading and got stuck on the @State annotation and shared vs unshared states.
I read this example : http://hg....
-1
votes
1answer
49 views
java - use boolean/while loops [duplicate]
After the end of the game, is it possible to add a while loop or a boolean that says "Press "1" to play again?" This way it could allow the user to play again without having to run the class again.
...
-5
votes
0answers
22 views
How to use JAVA to write a program to read data from LDAP;
My English is poor, please Forgive me.
We can use any frame to write this program,and i want know what is LDAP
-1
votes
1answer
19 views
Sum of diagonal elements of an nxn matrix
public static int trace(int[][] a){
int total = 0;
for(int i = 0; i < a.length; i++){
total+= a[i][i];
}
return total;
}
public static void print(int[][] a){
for(int i =...
0
votes
0answers
11 views
Image cropiing with the square graphic
File originalImage = new File("anyImage.jpg");
BufferedImage newImage = null;
try{
newImage = ImageIO.read(originalImage);
//JPanel np = new JPanel();
Graphics2D ...
1
vote
1answer
24 views
JPA+Hibernate force JPA not to use Proxies on Lazy loading
We are using JPA + Hibernate.
I have some Many-to-one mappings which are lazy loaded.
In Service, I Initiallize the Many-to-one objects by calling their getter method. but proxy gets assigned to ...
0
votes
1answer
27 views
Java Android ExpandableListView
I use in activity ExpandableListView in GruopView I have a textview and checkBox . And when I clik a checkBox a list is expand. How can I do this : when I click a checkBox in groupView a list stay in ...