Thread.sleep inside infinite while loop in lambda doesn’t require ‘catch (InterruptedException)’ – why not?

The reason for this, is that these invocations are in fact, invocations to two different overloaded methods available in ExecutorService; each of these methods taking a single argument of different types: <T> Future<T> submit(Callable<T> task); 2. Future<?> submit(Runnable task); Then what happens is that the compiler is converting the lambda in the first case of … Read more

error: supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath

In my case I had a library module with an abstract application class implementing Dagger’s HasActivityInjector and an application module with a dependency to the library and its own (non-abstract) application class extending the base app class. My Gradle dependencies were implementations, and therefore not accessible to the application module’s application class (even though there … Read more

Why do you have to link the math library in C?

The functions in stdlib.h and stdio.h have implementations in libc.so (or libc.a for static linking), which is linked into your executable by default (as if -lc were specified). GCC can be instructed to avoid this automatic link with the -nostdlib or -nodefaultlibs options. The math functions in math.h have implementations in libm.so (or libm.a for … Read more

Undefined Symbols for architecture x86_64: Compiling problems

There’s no mystery here, the linker is telling you that you haven’t defined the missing symbols, and you haven’t. Similarity::Similarity() or Similarity::~Similarity() are just missing and you have defined the others incorrectly, void Similarity::readData(Scanner& inStream){ } not void readData(Scanner& inStream){ } etc. etc. The second one is a function called readData, only the first is … Read more

what is cross compilation?

Cross-compilation is the act of compiling code for one computer system (often known as the target) on a different system, called the host. It’s a very useful technique, for instance when the target system is too small to host the compiler and all relevant files. Common examples include many embedded systems, but also typical game … Read more

How do I define a compile-time *only* classpath in Gradle?

There has been a lot of discussion regarding this topic, mainly here, but not clear conclusion. You are on the right track: currently the best solution is to declare your own provided configuration, that will included compile-only dependencies and add to to your compile classpath: configurations{ provided } dependencies{ //Add libraries like lombok, findbugs etc … Read more

Grails BuildConfig.groovy, difference between build, compile, and runtime?

build – dependency that is only needed by the build process runtime – dependency that is needed to run the application, but not compile it e.g. JDBC implementation for specific database vendor. This would not typically be needed at compile-time because code depends only the JDBC API, rather than a specific implementation thereof compile – … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)