I got a AsyncTask that is supposed to check the network access to a host name. But the doInBackground() is never timed out. Anyone have a clue? public class HostAvailabilityTask extends AsyncTask<…
JUnit: @Before only for some test methods?
I have some common set up code that I’ve factored out to a method marked with @Before. However, it is not necessary for all this code to run for every single test. Is there a way to mark it so the @Before method only runs before certain tests? Answer Just move out the tests that don’t need the setup code
is there a equivalent of Java’s labelled break in C# or a workaround
I am converting some Java code to C# and have found a few labelled “break” statements (e.g.) label1: while (somethingA) { … while (somethingB) { if (condition) { …
How is Eclipse Mylyn useful?
In my Eclipse Preferences -> Java -> Editor -> Content Assist -> Advanced settings, I see the following: Java Non-Type Proposals Java Proposals Java Proposals (Task-focused) Java Type Proposals JPA Proposals (is always empty for me) PDE API Tools Proposals (gets skipped when checked in the Content-Assist Cycling settings) SWT Template Proposals (always empty) Template Proposals (always empty) Word Proposals
How to find the index of an element in an array in Java?
I am looking to find the index of a given element, knowing its contents, in Java. I tried the following example, which does not work: class masi { public static void main( String[] args ) { …
Where to store application data (non-user specific) on Linux
In my OSGi-based Java application I am developing a bundle to provide the rest of the system with access to the file system. In addition to providing access to the user home directory, I also wish to provide access to a non-user specific area. Exactly what this area will be used for is as yet undetermined, but it will not
Why is list.size()>0 slower than list.isEmpty() in Java?
Why is list.size()>0 slower than list.isEmpty() in Java? On other words why isEmpty() is preferable over size()>0? When I look at the implementation in ArrayList, then it looks like the speed should be the same: ArrayList.size() ArrayList.isEmpty() If we just write a simple program to get the time take by both the methods, that case size() will take more isEmpty()
How to obtain CURDATE() / NOW() on a JPA named query?
I want to do a select from table where date = TODAY, on mysql that would be where date > CURDATE(), how do I do this on a JPA named query?
Easy way of running the same junit test over and over?
Like the title says, I’m looking for some simple way to run JUnit 4.x tests several times in a row automatically using Eclipse. An example would be running the same test 10 times in a row and …
UTF-16 to ASCII conversion in Java
Having ignored it all this time, I am currently forcing myself to learn more about unicode in Java. There is an exercise I need to do about converting a UTF-16 string to 8-bit ASCII. Can someone …