java

java

  • All Sites

2 answers

Should toString be used for a complex operation?

I have a class named CommandHelp. It stores some strings that (obviously) describe what a command does, what are its aliases, the arguments it requires and whatever else I need to register about the ...

0 answers

Database lock acquisition failure with hsqldb

I'm running this as an in-process connection, using this JDBC URL: jdbc:hsqldb:file:C:\Program Files\360Works\SyncData2_MirrorSync\Configurations\3d0c6a29-294b-4a24-b075-70302345fdb5\mirrorsync I am ...

1 answer

Java hint for a beginner's level pseudo-calculator class

Given the following class: public class ArithmeticExpression { static int evaluate(char c[], int l, int r) { // code goes here, l = leftmost array member; r = rightmost array member } public ...

1 answers | 1 min ago by Dick Tucker on Stack Overflow stackoverflow.com
0 answers

Shortcuts in Eclipse work intermittently or don't work at all

In Ubuntu, using Eclipse Luna, very often I experience that shortcuts stop working (for example: Ctrl + C, Ctrl + Z, Ctrl + R). Sometimes I'm able to "get around" by clicking outside the code editor ...

2 answers

ZipOutputStream produces corrupted zip file on Android

I've implemented backup of user data from the app using zip archive, I am copying database and shared preferences files to zip archive and calculating MD5 checksum of input files to prevent user from ...

2 answers | 2 mins ago by nemezis on Stack Overflow stackoverflow.com
1 answer

Do the Apache DefaultHttpClient (Android) and NSURLConnection (iOS) retry failed connections with older protocol versions?

Per the disclosure of the POODLE vulnerability, Google makes the following statement: In order to work around bugs in HTTPS servers, browsers will retry failed connections with older protocol ...

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

Starting of Tomcat failed from Netbeans 7.3

I have problem with starting Apache Tomcat 6 from Netbeans IDE 7.4 (on 7.3 version I had the same troubles). What did I do: remove installed Tomcat 7 (without removing it, I had the same ...

3 answers | 4 mins ago by liquide on Stack Overflow stackoverflow.com
1 answer

Spring MVC Controller testing, and mocking many classes

We have many Controllers in our system, and many Spring Data repositories. I would like to write tests for my controllers that run through my MVC context. However, it seems pretty cumbersome, and ...

1 answers | 5 mins ago by kabal on Stack Overflow stackoverflow.com
2 answers

Spring 3.1 or Later @RequestMapping Consumes/Produces

I have a question in regards to the consumes and produces part of the @RequestMapping annotation. I have an endpoint that I want to accept both JSON and XML and return JSON when JSON is passed in and ...

2 answers

This program keeps on giving me an error: Exception in thread “main” java.lang.StringIndexOutOfBoundsException: String index out of range: 4

When I write a code like this one, I always get this error. It is definitely building the file but is not it just gives me exemption. I am a beginner. Can you guys please help me out and really ...

0 answers

Searching for a sum in an array

I have a method which counts how many sums of 3 elements,which are equal to 0, does the array contains. I need help finding the way to stop counting the same triplets in the loop. For instance, 1 + 3 ...

2 answers

Find a string and display the line number and the line itself?

I'm designing a program that reads the size of a txt file, the number of words, numbers, and characters it contains, and the ability to search the file for a given string. For example. A txt file ...

2 answers | 8 mins ago by user3464969 on Stack Overflow stackoverflow.com
3 answers

How to have a global variable in C++

I'm rewriting someone's code who had a global variable that is useful during initialization when Java makes it's callbacks into C, and just after. It appears they have declared this variable in ...

3 answers | 11 mins ago by John on Stack Overflow stackoverflow.com
1 answer

How do i shake off NullPointerException?

Cant seem to shake off a NullPointerException Error. Been coding for about a year now. Anyway, I have tried every possible combo of !xyz.equals(null) or xyz[0] != null, but can't seem to find a ...

2 answers

Querying/Accessing/Retrieving Header row in Google Spreadsheet

I'm accessing a public Google Docs Spreadsheet using the Google Sheets API. The API says that when you query a list-feed for a worksheet, you get back a list of rows excluding the first row, which is ...

2 answers

Java Game Screen Change Issues [JAVA]

When I set it to I want it to change to another screen when I press space bar, but when I press any key, it automatically closes. If anyone could help that would be great! Screen Class: package ...

0 answers

Bean Creation Exception in Junit Test with Spring

I am encountering the BeanCreation exception when trying to run my test in Junit. It seems Spring is having issues trying to autowire the field. The test class is:- ...

0 answers

How to get this dice code working properly in AndEngine?

So I'm attempting to create a scene in my game like the Mario Party, hit the dice, type thing. But there's a random moving question mark die, and upon touch, should randomly pick a number 1 - 6, and ...

3 answers

How to modify Java Control Panel selections (corresponding to deployment.properties file) from windows command prompt?

How to modify Java Control Panel selections (corresponding to deployment.properties file) from windows command prompt? Specifically, I am looking for command(s) which can effect change in "Action for ...

1 answer

Working with commandName in spring view: IllegalStateException: Neither BindingResult nor plain target object

I was working with spring and read about the use of commandName in view(jsp). I have a little trouble working with it can anyone help me how to effectively use it? i get this error when i use in my ...

1 answers | 20 mins ago by Junaidaj on Stack Overflow stackoverflow.com
1 answer

How to add the values of two “Cards” in Java?

I am working on a project to simulate the first deal in a game of blackjack. So far, the program creates two cards of random rank (such as 2 or 3) with a random suit. I am struggling with creating a ...

1 answers | 22 mins ago by James Curtis on Stack Overflow stackoverflow.com
0 answers

Alarm manager/Notification not setting in app

i have set up an alarm manager to set a notification for the specific day and time the users selects, the only thing is that it is only showing this alarm if EVERY day is selected. Here is my code: ...

2 answers

simple client/server application exchanging msg

my question here is how to exchange msg between clients ? how can i develop method for Text messages should be exchanged between them until the client sends "BYE" or "QUIT". This is the code for the ...

2 answers | 24 mins ago by Ahmed Shaaban on Stack Overflow stackoverflow.com
0 answers

java.lang.NoSuchMethodError: com.google.common.collect.FluentIterable.toList()Lcom/google/common/collect/ImmutableList;

I'm using the Google Guava library for tasks like sorting and filtering of a java.util.List<T> in a Java EE 7 application. Given below an example of filtering a java.util.List<T> based on ...

5 answers

Compiler Understanding - assign in a if statement

I recently came across this syntax int i; String s = "test"; if(!((i=s.length()) == 0)) { System.out.println(i); } If you are wondering what it prints it prints: 4 Now I know this code ...

1 answer

Java: Program not crashing after throwing exception

I have exception handling being done on every iteration of a while loop. For some reason, when the condition for throwing an exception is true, the exception message is displayed but the program keeps ...

0 answers

Vaadin keep added item

I have a 2 screens, page1 and page2 Every page has a table, table1 and table2 Is it possible to add new Item into Table1 and keep this item while going to page2 and return back? Could you help ...

1 answer

Resizing Path2D circle by clicking and dragging its outer edge

So, when I click and drag a Path2D circle on my JPanel, it is resizing. The problem is that when I initially click-and-drag it, the circle jumps to a smaller size, but then resized correctly as you ...

1 answers | 37 mins ago by Harry on Stack Overflow stackoverflow.com
3 answers

Play framework 2 authentication options

I am about to pick an authentication for Play 2 Java application. At the moment it would be simple username/pw and Facebook, backed with MongoDB. It looks like there are two options: securesocial and ...

0 answers

Pronunciation respelling/News Paper Pronunciation Jake Gyllenhaal - Jake-JILL-IN-HALL - Java

I have searched and searched and searched but i am unable to find ANY documentation or algorithms or dictionaries which i can use to find the 'non-phonemic' translation of a word. By that i mean the ...

15 30 50 per page
1 2 3