java

java

  • All Sites

1 answer

How would I have test code to test if an input has characters instead of numbers

public void deposit (double amount){ if (amount >= 0) { balance = balance + amount; } else { System.out.println("Your deposit is a negative number, If you would like to withdraw ...

1 answers | 41 secs ago by Redduckken on Stack Overflow stackoverflow.com
0 answers

Android Studio: Button always appears on top

I have a RelativeLayout to which I add Views. I added a button to it, and the button always appears on top of all the other Views that are added to it, regardless of the order in which things were ...

1 answer

Android: EditText causing memory leak

I want to start by saying that it's the first time that I have to deal with performance, because it's the first time that I develop an android app. The app The app is a source code editor, where you ...

0 answers

Import old app engine logs into BigQuery

I'd like to add old App Engine logs to my current BigQuery database of logs, but they're in an odd format. So I recently started adding (streaming) the app engine logs to BigQuery directly. But I ...

0 answers

OAuth 1.0a access token and RESTful web services

I'm working on a web application based on AngularJS and Java EE, and I would like to implement the integration with an external service that uses OAuth 1.0a (it's the only option available). Now, the ...

1 answer

Two threads finishing at the same time and accessing the same method

I'm learning multithreading in Java, so now I'm creating the classic Tortoise and Hare race application. For those not familiar with this problem, basically, there's two racers: A hare that runs ...

1 answer

How do I print the factorials of 0-30 on a table

public static void main(String[] args) { int n = factorial(30); int x = 0; while (x <= 30) { System.out.println(x + " " + n); x = x + 1; } public static int factorial (int n) { if ...

1 answers | 8 mins ago by panzo on Stack Overflow stackoverflow.com
1 answer

How to resize a canvas on JavaFX to fit the size

I am new to JavaFX and I encountered a problem resizing a canvas. I am trying to get the canvas size to fit exactly the contents I place into it. The output should be the only the fragment 5/7, but I ...

0 answers

Thread interference when calling synchronized queue methods

Running my program, which is multithreaded, seems to lead to thread interference even though I used the keyword synchronized for the methods that have an effect on the part where my problem lies. I ...

1 answer

Validate html tags in json file using java - whats the best way?

Is there a java library, java framework, or java example that I could supply a URL, www.test.com/storage/test.json, and validate that HTML elements, specifically HTML opening and closing tags, so I ...

1 answers | 9 mins ago by user2195411 on Stack Overflow stackoverflow.com
3 answers

Better way to search a list of lists for an item in python

Sometimes I have a list of lists, and I need to search all the lists for a single item. I use this python code: boolean found = false for(hayStack : listOfHayStacks){ found = ...

3 answers | 10 mins ago by Mark on Stack Overflow stackoverflow.com
1 answer

Problemas com new em java

Por que toda vez que eu uso new na minha classe, por exemplo: if(e.getSource() == levelButton) { new PainelNivel().setVisible(true); } o java executa esse comando ou seja, mostra a classe ...

1 answers | 10 mins ago by Dongabi on Stack Overflow em Português pt.stackoverflow.com
1 answer

Difference between a GWT Generator and a Java Annotation Processor?

GWT uses Generator to create code before everything is translated into JavaScript. Java on the other hand has an annotation processor which generates code before everything is translated into byte ...

8 answers

Fibonacci sequence in Java using for statements

I tried making a Java program executing the Fibonacci sequence. Here's my code: import java.io.*; public class Fibonacci{ public static void main(String[]args){ BufferedReader Data=new ...

2 answers

ConnectTimeoutException connecting to HortonWorks VM in Eclipse for MapReduce job?

I am trying to run a MapReduce job in Eclipse. I am trying to connect to a HortonWorks VM and read one of the files in HDFS. here is a display of the files in HDFS: I am using the following code ...

1 answer

Sorting arrays with quickSort (JAVA)

Okay, so I need to sort an array in both ascending and descending order using quick sort. I have code that works properly for the ascending, and properly most of the time for descending, but it will ...

1 answers | 11 mins ago by Meggy Penny on Stack Overflow stackoverflow.com
0 answers

I have WIKI VGI Java based query doubts?

I have a code snippet in Java to query wiki volunteered GIS. This is first time I am using java and finding it difficult to answer some queries. package org.wikibrain.cookbook.MOOC; import ...

0 answers

How to change which “section” a java source file opens up in in Eclipse

I have rearranged and customized the Eclipse layout to exactly how I like it. But whenever I open up a java source file, it opens up in the box with Package Explorer and Outline instead of the big box ...

1 answer

How to unit test Clob conversion to String?

This simple method returns all the content of a Clob retrieved from the database as String. How can I test/mock it properly, guaranteeing it will always return the full content of the Clob argument ...

3 answers

Drawing multiple lines with Java Swing

I'm learning drawing lines with Java Swing in order to draw a labyrinth. I can draw one line at a specified position and it shows just fine. But when I want to draw multiple lines, only the last one ...

3 answers | 13 mins ago by rize on Stack Overflow stackoverflow.com
0 answers

Intellij IDEA equivalent of ArcGIS Eclipse plugin

I'm a beginner in Java and a geomatics student. I work with Intellij. I would like to work with ArcGIS, but without Eclipse. There is a good plugin on Eclipse ...

0 answers

Using s:url in s:a in struts2

I'm trying to generate a link for each string in my List of strings. This link will call an action and pass in a parameter (a getStudentById action passing in the studentId). I've tried a couple of ...

0 answers

The DELETE statement conflicted with the REFERENCE constraint. Even though the correct mapping is used

I have this code in a .net application: public GradeMapper() { ToTable("Grades"); // Primary key HasKey(c => c.GradeId); // Properties ...

0 answers

Using Rest-assured to test Spring's controller with custom validation

I would like to test my JSON responses from Spring's controllers with Rest-assured. Everything works fine, even with @Valid annotation until I add custom annotation (@Unique) Usage of problematic ...

7 answers

Increase heap size in java for weka

I'm trying to increase the heap size in java for weka which keeps crashing. I used the suggested line: > java -Xmx500m -classpath but I get the following error: -classpath requires class path ...

7 answers | 15 mins ago by screechOwl on Stack Overflow stackoverflow.com
1 answer

During serialization, I get an error “The system cannot find the path specified”

I try to serialize an object in my Servlet Employee p1 = new Employee(); p1.setFullName("Tom Jery"); try { FileOutputStream fileOut= new FileOutputStream("/employee.ser"); ObjectOutputStream ...

1 answer

How connect to Hortonworks sandbox Hbase using Java Client API

I have setup fresh Hortonworks sandbox .I'm trying to connect Hbase using Java Client API.This is the code i tried so far.But did not success.I did not change any configuration on Wortonworks ...

0 answers

“Illegal State Exception: Already Connected” when using HttpURLConnection

I get an illegal state exception when i set DoOutput to true. public boolean sendLinksToMaster(String ipport, List<String> links){ boolean sent = false; String[] tokens = ...

4 answers

Ubuntu 14.04,unable to package classes into 'jar' file

I am learing Java from'HeadFirst Java' My current setup is Ubuntu 14.04 Oracle JDK 1.8 is installed and set as defaut ,Oracle Java is also set as default I have Many Tools such as AndroidStudio ...

1 answer

ClassNotFoundException for net.sf.jga.parser.JFXGParser

I am trying to understand what is incorrect about my code and trying to understand the following error: Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: ...

15 30 50 per page
1 2 3