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. ...
0
votes
0answers
3 views
In gurobi7.0 java, how to write a constraint to get the larger value one of other two variable objects
like this:
GRBVar x
GRBVar y
GRBVar c
c = max(x, y)
how to write the c constraint?
thanks.
0
votes
0answers
6 views
How is Principal injected in method: SpringBoot
I was reading on social login in the Spring.io tutorials and I couldn't understand how the Principal is being injected in the public method user
@RequestMapping("/user")
public Principal user(...
0
votes
0answers
6 views
Discovering a region with no mines on minesweeper
I am new in this page, it hope get to some help, basically I am doing a minesweeper game on Java but it have a problem with a function: discover the region with no mines and no numbers like in the ...
-1
votes
0answers
18 views
How to make a final not change
I want to make a String that gets the current value of an int and draws it on the screen. I do not want this to change but it is.
clock:
public int clock = 0;
public void prepare() {
Timer t = ...
0
votes
0answers
7 views
Minimizing overhead for large trees in java
I need to implement a large octree in Java. The tree will be very large so I will need to use a paging mechanism and split the tree into many small files for long-term storage.
My concern is that ...
0
votes
1answer
7 views
Rock paper scissor loop game
Hi i just started learning java in my university, and I am currently struggling to implement the while loop in my game as it always gives me an infinity loop. The idea is to continue the game except ...
0
votes
0answers
7 views
Tomcat Server not shutting down normally
The Apache Tomcat Server in eclipse says server is not responding. Do u want to close it. Press okay to close it or cancel to continue waiting. I am unable to shut down the eclipse server normally ...
0
votes
1answer
6 views
How to update data in the linked list using Java in GUI?
I am currently doing a book inventory system, so the user has an option to update the number of copies of the book after they input it into the list. I have the user search the item that they want to ...
0
votes
1answer
9 views
Getting the file used by a FileInputStream
Is it possible to obtain the File being used by a FileInputStream? FileInputStream does not appear to have any methods for retrieving it.
0
votes
0answers
4 views
How to get the anchor tag value and href value inside a header tag using selenium
My html page code consists alot of anchor tags, but i need to get all the href value inside the anchor tag and anchor tag value which are present inside a header tag of a div element, i'm using ...
0
votes
0answers
8 views
Getting Error when running WAR on Virtual Box for Spring Boot Application
I am trying to run my Spring Boot application comprise of MongoDB & Redis Server on Virtual Box but getting errors related to redis and hence unable to complete the process..I am getting these ...
0
votes
0answers
5 views
Java fasterxml jackson annotation of map attribute in Pojo/ unmarshaling JSON attribute in POJO map attribute
I'm having a hard time finding the correct way of unmarshaling JSON object into objects graph with maps as attributes instead of lists. And I need to use maps.
POJO:
@JsonIgnoreProperties(...
0
votes
0answers
13 views
Sorting firebase objects based on double values on android
I am currently working on an android app that shows times/dates for rides to and from certain locations. I want to sort my firebase objects so that objects are sorted based on date. I tried searching ...
0
votes
1answer
22 views
Sorting string occurrences from text file
I have stored strings from a file into an ArrayList, and used a HashSet to count the number of occurrences of each string.
I am looking to list the top 5 words and their number of occurrences. I ...
0
votes
1answer
12 views
Convert Firebae data to Java Object using reserved variables
The data in my Firebase Realtime Database is
user-id
new: true
nickname: "John"
And I try to build a model for the User structure so I can retrieve data by
User user = dataSnapshot.getValue(...
0
votes
0answers
10 views
How could I get the output results in the resources folder?
I have a Java project with structure as following:
I can read the hotels.csv file using the code;
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader....
0
votes
0answers
12 views
Print PDF client side using javascript/jquery/java
I am trying to print the pdf using following code:
$('#print').click(function() {
var data = $(this).data('loc-subject');
alert(data);
var myWindow=window.open(data,'','width=500,...
0
votes
2answers
15 views
Error: cannot find symbol of Parser
So I have a class parser that goes something like this
public class Parser implements Serializable {
//parse Programfile with name=filename
public Program parseProgramFile(String filename){...
0
votes
1answer
16 views
Abstract Syntax Tree for this case?
I am trying to create an abstract syntax Tree for the following 2 C/C++/Java code pieces:
1) return j++-200*20-++A*7
2) return j++-200*20-A++*7
Can someone please explain their difference when it ...
-2
votes
0answers
16 views
Registration data not being sent to my database
My login is working properly, but my registration seems to not add the data to my database. I have tried to solve the problem for a long time with no luck. Maybe some of you "bright" people can help ...
0
votes
0answers
6 views
Reading Doxygen Documentation In Eclipse
I was wondering if there is any way to use a doxygen documentation in eclipse. Basically I want to see the documentation when I hover over stuff in eclipse. I do not want to make documentation.
This ...
0
votes
0answers
4 views
It's always showing “Cannot Validate Javadoc Location”
I'm trying to add Javadoc in my eclipsed, for offline access. But It's always showing "Cannot Validate Javadoc Location".
My java version is 1.8.0_111
I have downloaded the API Documentation from ...
-1
votes
0answers
20 views
How to rotate 2D matrix image in Java?
I want to implement image rotation and came across below:
public void rotate(int[][] matrix) {
int n = matrix.length;
for (int i = 0; i < n / 2; i++) {
for (int j = 0; j < Math....
-1
votes
1answer
18 views
How would I calculate the wall space and floor space because it depends on the number of doors, windows, bookshelves that the user inputs
I am having some trouble calculating the wall space and floor space as it depends on the amount of doors, windows, bookshelves and the measurements of each based on user input. Here is the code that I ...
-1
votes
0answers
4 views
Decrypt using the rsa algorithm
I have this operation x ^ t ≡ y mod N, where do I find Y, and how can I implement in java? Thank you. I hope you can help me. It is occupying in the RSA to decrypt.
0
votes
2answers
17 views
Waiting for a button press within a for loop?
I'm not sure how to get around this, but the purpose of my code is to iterate through a csv file and the user searches for a certain item. I have my items read through a string array of type list with ...
0
votes
1answer
15 views
Unable to execute a particular shell command command using Java - permissions working correctly
I am having trouble executing a shell command using Java. I am calling 4 commands which are supposed to run the sourceanalyzer executable from within the runFortifyScan method, and populate the fpr ...
0
votes
1answer
20 views
game of cards in java array and arraylist
So basically I'm making a game of cards and I'm trying to remove a certainAmount of cards off from the top of my deck and then return that certainAmount as an array of size certainAmount and I can't ...
0
votes
3answers
24 views
Why should I define a method as another variable for integers but not for array in java?
The following code:
public static void main(String[] args) {
int first = 1;
int second = 2;
sum(first,second);
System.out.println(sum);
}
public static int sum(int a, int b){
int ...
0
votes
0answers
10 views
Update listview with Firebase database?
I've a listview which will have 10 list item. Each row has a imageview, textview and a button. I want to achieve this functionality where I can change imageview, textview and link in the button ...
0
votes
0answers
6 views
Netbeans adding image dynamically
How can we change the image background wrt the user.
Like in a application form,where image changes as we change the applicant details.
I googled but didnt get anything helpful for this.
0
votes
0answers
11 views
Errors when passing value between pages in GUI using Java.
I am doing a bookstore inventory system using my own linked list and all the other code functions well. I want to generate some kind of summary in the last function, like showing how many entries is ...
0
votes
1answer
13 views
How do i block user access to a directory using java?
Is it possible with java to modify directory permission so that no one can access the content inside that directory.
0
votes
2answers
20 views
The execute order of the static method(JAVA) [duplicate]
I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this?why the result is not to print the "int main"in the first? What I want to know is why the ...
0
votes
0answers
8 views
Fragment to Fragment Communications
I'm new to Android Fragment and I am trying to communicate two fragment. I want to send text with from one FramentA to FragmentB and vise versa. how can I make the two fragment communicate with each ...
-1
votes
0answers
6 views
RxJava: Give output of an event to the next event in an observable flatmap
I need to give the output of an event to the next event in an observable flatmap. Is there anyway to do it using flatmap or if there is any other way?
0
votes
0answers
7 views
Android RTA for Voice through microphone
I need to process audio recorded in real-time through microphone of Android device. Then detect if a particular frequency is present or not. How much precision can we have? And are there any resources ...
0
votes
2answers
29 views
Editing and saving an ArrayList<> that has been passed to another activity
I am making a frisbee logger and have an ArrayList of Team objects. Each Team has an ArrayList of Player objects. Everything is using Serializable properly to be sent using Intent.
In my main ...
1
vote
3answers
40 views
What's the time complexity of sorting a list of objects with two properties?
Suppose I have a class:
`
public class Interval {
int start;
int end;
Interval() { start = 0; end = 0; }
Interval(int s, int e) { start = s; end = e; }
}
`
I would like to sort a ...
0
votes
1answer
14 views
JAVA android Studio method does not overridefrom its superclass
I am a beginner in Java development.
I would like to know why I have the error
"method does not overridefrom its superclass" on the @override declaration.
Here is my code
package fr.cif.cif_app;
...
-3
votes
0answers
18 views
System.arraycopy Source Array Length as Dest ? (Java 8)
I have a problem to understand a part of the java code (for a own List class) our professor gave to us. It seems to violate the specification of System.arraycopy but it still works and I have no idea ...
0
votes
1answer
15 views
Trying to figure out Class and method declaration in Util classes java
I've been having some issues trying to solve this code that my professor sent to me for studying purposes. I usually can solve the isPrime and getPrime no problem but my issue lies with the gcd class. ...
0
votes
1answer
16 views
How can FileInputStream.read change my byte array?
In the program I am writing for homework I have a FileInputStream which I am reading bytes from into an array using the read() method of the stream. I am not using the return value at all in my ...
0
votes
2answers
13 views
Passing data from MainActivity to Fragment
I'm trying to pass list of custom object from onDataLoaded function (which is in MainActivity) to fragment, using Parcelable. But I get this error...
This is a MainActivity funkcion, onDataLoaded
@...
0
votes
0answers
4 views
Unable to get Access Token from third-party server using SpringBoot-Oauth2
No matter what configuration I tried, I always get:
I am using the example from oauth2-vanilla: oauth2-vanilla example
but I alwas get the following exception when trying to login:
2016-11-19 ...
0
votes
1answer
25 views
Java generics with exceptions producing compile time errors
I have these two methods:
private static <T extends Throwable> void methodWithExceptionGeneric(final T t) throws T {
throw t;
}
private static void methodWithExceptionNonGeneric(final ...
0
votes
1answer
15 views
Converting “time ago” to seconds in android
I have my server returning a time ago string format like this 2 minutes ago which is fine but I now need to convert it to seconds. I thought of just splitting the string using a space delimiter and ...
0
votes
0answers
18 views
Java arrays outside of main method [duplicate]
So I am preparing for my exam and I have fell well quite behind and what i don't understand is why can't I make an array outside of a my main method?
public class Garasje{
//int to count the amount ...
-1
votes
0answers
16 views
Composite pattern - Arraylist of an Arraylist of shapes
I am supposed to draw squares using composite pattern. I have a method like this:
public class CompositeIcon{
private List<Icon> icons = new ArrayList<Icon>();
public int ...
0
votes
0answers
12 views
Issue with getting a tcp C# server communicate to a java client
I have been working on trying to get my C# server communicate to my java client program. The problem is that the C# server can not send info through the stream to the java client. The thing is I am ...