Android Studio Build gradle OutOfMemoryError

One of the methods below should work for you: METHOD 1 : Open gradle.properties file from your project tree add this line at the memory allocation line org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m or org.gradle.jvmargs=-XX\:MaxHeapSize\=512m -Xmx512m or org.gradle.jvmargs=-XX\:MaxHeapSize\=1024m -Xmx1024m Depending on the Memory of your computer. Then Invalidate Caches/Restart project from the File > Invalidate Caches/Restart To clean up … Read more

SLF4J + Logback does not log in WildFly

WildFly adds slf4j as a default logging dependency Have you tried excluding the main implementation in jboss-deployment-structure.xml descriptor (It should go under the META-INF directory). This can be done with below lines: <?xml version=”1.0″ encoding=”UTF-8″?> <jboss-deployment-structure> <deployment> <exclusions> <module name=”org.apache.commons.logging” /> <module name=”org.apache.log4j” /> <module name=”org.jboss.logging” /> <module name=”org.jboss.logging.jul-to-slf4j-stub” /> <module name=”org.jboss.logmanager” /> <module name=”org.jboss.logmanager.log4j” … Read more

Color Logic Algorithm

Here is a theoretical explanation And the algo in C: typedef struct { unsigned char r, g, b; } RGB; double ColourDistance(RGB e1, RGB e2) { long rmean = ( (long)e1.r + (long)e2.r ) / 2; long r = (long)e1.r – (long)e2.r; long g = (long)e1.g – (long)e2.g; long b = (long)e1.b – (long)e2.b; return … Read more

How to implement hashCode and equals method

in Eclipse right mouse click-> source -> generate hashCode() and equals() gives this: /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (code == null ? 0 : code.hashCode()); return result; } /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ … Read more

Problems importing project into Android Studio regarding ActionBarSherlock

Seems there’s a lot of general issues on importing modules to Android Studio, not just ActionBarSherlock, this answer might also address those. (However the last steps relating to junit are particular to abs) The steps below allowed me to get ActionBarSherlock running with no issues. 1) Download latest ABS here: http://actionbarsherlock.com/ 2) Extract ABS you … Read more

Java GC safepoint

The exact definition and implementation of a safepoint changes from one VM implementation to another, but considering Hotspot VM, you can find a nice definition in: Safepoints in HotSpot JVM. HotSpot glossary says: A point during program execution at which all GC roots are known and all heap object contents are consistent. From a global … Read more

How to run Java program in command prompt

javac is the Java compiler. java is the JVM and what you use to execute a Java program. You do not execute .java files, they are just source files. Presumably there is .jar somewhere (or a directory containing .class files) that is the product of building it in Eclipse: java/src/com/mypackage/Main.java java/classes/com/mypackage/Main.class java/lib/mypackage.jar From directory java … Read more