Saturday, March 14, 2015

Gradle: add source dirs vs replace source dirs

http://stackoverflow.com/questions/10570795/can-gradle-handle-builds-for-legacy-projects-without-having-to-restructure-direc?rq=1

Gradle uses convention over configuration which allows you to provide minimal information to build your project if you follow the standard project layout. That said everything is still configurable using a declarative style:
sourceSets {
main {
    java {
        srcDir 'src/java'
    }
    resources {
        srcDir 'src/resources'
    }
}
}
Because you have a real programming language you can do almost anything.


Note that this adds source directories rather than replacing them. The syntax for replacing is srcDirs = ['src/java'] and srcDirs = ['src/resources'].

Saturday, March 7, 2015

Autocomplete JTextField

http://stackabuse.com/article/example-code/example-adding-autocomplete-to-jtextfield

Autocomplete can be very useful in just about any application, but its not trivial to implement. So here is a quick example of how you might do it in Java's Swing framework with JTextField (it should also work with JTextArea with only a few modifications). This example is a modified version of Oracle's example.

Monday, February 23, 2015

Docker Machine

https://vexxhost.com/blog/getting-started-with-docker-in-minutes-using-docker-machine/#.VOjOjXGdvZ4.dzone

Typically, you would have to create a new virtual machine, install multiple Docker components until you’re ready to provision new containers. With Docker Machine, it’s a matter of a single command.

Saturday, November 1, 2014

How to install JDK on Redhat/CentOS usng the alternatives command


http://www.if-not-true-then-false.com/2010/install-sun-oracle-java-jdk-jre-7-on-fedora-centos-red-hat-rhel/

Install Java JDK or JRE package

## JDK 32-bit ##
rpm -Uvh /path/to/binary/jdk-7u67-linux-i586.rpm
 
## JDK 64-bit ##
rpm -Uvh /path/to/binary/jdk-7u67-linux-x64.rpm
 
## JRE 32-bit ##
rpm -Uvh /path/to/binary/jre-7u67-linux-i586.rpm
 
## JRE 64-bit ##
rpm -Uvh /path/to/binary/jre-7u67-linux-x64.rpm
 
 

Install Sun/Oracle JDK java, javaws, libjavaplugin.so (for Firefox/Mozilla) and javac with alternatives –install command

## java ##
alternatives --install /usr/bin/java java /usr/java/latest/jre/bin/java 200000
## javaws ##
alternatives --install /usr/bin/javaws javaws /usr/java/latest/jre/bin/javaws 200000
 
## Java Browser (Mozilla) Plugin 32-bit ##
alternatives --install /usr/lib/mozilla/plugins/libjavaplugin.so libjavaplugin.so /usr/java/latest/jre/lib/i386/libnpjp2.so 200000
 
## Java Browser (Mozilla) Plugin 64-bit ##
alternatives --install /usr/lib64/mozilla/plugins/libjavaplugin.so libjavaplugin.so.x86_64 /usr/java/latest/jre/lib/amd64/libnpjp2.so 200000
 
## Install javac only if you installed JDK (Java Development Kit) package ##
alternatives --install /usr/bin/javac javac /usr/java/latest/bin/javac 200000
alternatives --install /usr/bin/jar jar /usr/java/latest/bin/jar 200000

Saturday, October 25, 2014

Unable to start historyserver service


If you see error as below in your log file while failed to start the history server, then you can use the command sudo su -l hdfs -c "hadoop dfs -chmod -R 755 /" to fix it and then restart the service with sudo service hadoop-mapreduce-historyserver restart 

Permission denied: user=robing, access=WRITE, inode="/":mapred:hadoop:rwxr-xr-x