Database image is malformed

I am working on application in JAVA that gets data from database, makes some calculation and writes data to xml file. Everything is fine with small databases (smaller than 1 GB). However, when I run program with database which is bigger than 1 GB my ...
more »

2017-03-18 23:03 (0) Answers

Java AVL Tree Find Implementation

I am trying to implement a find method that will find if a given input key is within my AVL tree. When I try compiling my code, I get a null pointer exception when I compare the the strings (first if statement within while loop) //Returns the dictio...
more »

2017-03-18 22:03 (0) Answers

Comparing two selection sort methods

This question is similar to (link) but not exactly what I am looking for. Here is a selection sort I wrote below, it's in Java. public void sort() { int smallIndex; for(int i = 0; i < arr.length; i++) { smallIndex = i; ...
more »

2017-03-18 19:03 (2) Answers

Integer.parseInt: 0xff80CBC4 is an invalid int

Can somebody please explain why the second and the third of the following statements fail? Integer myColor = 0xff80CBC4 //works Integer.parseInt("0xff80CBC4".substring(2), 16) //does not work Integer.decode("0xff80CBC4") //does not work When run,...
more »

2017-03-18 16:03 (3) Answers

Displaying toast before app closes in java

I have created a simple dice game in Android. When the user hits an "end game" button, I want to display a toast that says "thanks for playing" and then close the application. Currently, this is what I am doing (note that I have a global timer declar...
more »

2017-03-18 02:03 (2) Answers

Thread locality

I have this statement, which came from Goetz's Java Concurrency In Practice: Runtime overhead of threads due to context switching includes saving and restoring execution context, loss of locality, and CPU time spent scheduling threads instead of ...
more »

2017-03-18 00:03 (2) Answers

Scala Eclipse IDE configuration

Already installed java, scala and SBT followed steps of instructions on Lynda seems work in terminal v1020-wn-206-156:~ zhongyuan$ scala Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_121). Type in expressions for evaluation...
more »

2017-03-18 00:03 (1) Answers

Mandelbrot Set Wrong Shape

I am currently trying to code a program which generates a mandelbrot-set. however even though i did a lot of testing with each single method. The shape of the whole set seems to be wrong .I am looking for help and would be really glad if someone know...
more »

2017-03-17 23:03 (1) Answers

deserialize Json into POJO

I am trying to convert the following JSON structure (part of a larger JSON object) to a POJO but getting the exception copied below (using Java/Jackson). JSON "outputKeys": {"ABC":"gGyIioUr4Jfr5QiCm6Z==", "DEF":"RxHfNyD2JyPOpG5tv3Jaj5g=="} Java...
more »

2017-03-17 21:03 (2) Answers

JUnit test case runs multiple times in eclipse

I have Test classes and covering test suite in the same package. When I right click on package and use "run with junit", eclipse runs my test classes independently and also from my test suite. So basically double execution. Is there any way to preven...
more »

2017-03-17 19:03 (1) Answers

Best way to map JAXB to a database table

I have an inbound xml which I am mapping to JAXB objects using the xjc tool (to build the pojos) I am wondering what the best approach is to map these objects to various tables. An Object / Xml can map to multiple tables which rules hibernate out ...
more »

2017-03-17 17:03 (5) Answers

how to convert name=value pairs to Json

I need to call third party API and consume the response as JSON object, but they return name=value pair format even though they claim that's JSON format: {body={user={first_name="foo",last_name="bar"}} is there any library that can convert the abo...
more »

2017-03-17 17:03 (2) Answers

Spock order tests by packages

He,everyone! My tests are running by jenkins from general package. Can I set test package in spock which will be runnning first and if in this package will not passed any of test the other tests should be skipped. I saw examples like this: import or...
more »

2017-03-17 16:03 (0) Answers

Why doesn't this throw a NullPointerException?

Consider the following code: int[] r = null; r[0] = 1 % 0; I would have expected this to throw a NullPointerException: according to JLS Sec 15.7.1: The left-hand operand of a binary operator appears to be fully evaluated before any part of the...
more »

2017-03-17 11:03 (1) Answers

Play Audio by Decoding Base64

My database has a lot of short audio that formatted base64. I want to play audio when the button is on clicking. Basically, I wrote this code but it doesn't work. (If it possible, The file had better doesn't writing to storage because this process ha...
more »

2017-03-17 10:03 (2) Answers