7/26/2017

Install Chewing on Ubuntu 16.04

Install ibus-chewing

sudo apt-get purge hime hime-chewing
sudo apt-get install ibus-chewing 
im-config -n ibus 
ibus-setup 
ibus restart


Add Input Method

Go to  System settings -> Text Entry, add 'Chinese(Chewing)'



7/20/2017

[Deep Learning] Batch Normalization note

Batch Normalization (BN)
• Normalizing input (LeCun et al 1998 “Efficient Backprop”)
• BN: normalizing each layer, for each mini-batch
• Greatly accelerate training
• Less sensitive to initialization
• Improve regularization

S. Ioffe & C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. ICML 2015

'Deep Residual Learning for image recognition', presents that do batch normalization before active function will be better.


7/19/2017

Vagrant command lines

Install Vagrant from official website

  If you use apt or yum to download Vagrant, the version might be too old to be compatible to your virtualbox or vmware. Therefore, please download it from the official website .


Download VirtualBox from website

  Please download the suitable version of VirtualBox.


Common and useful commands:

Download and init vagrant box
$ vagrant init <Vargant box>
E.g : Download vagrant box which has Kubernetes.
vagrant init flixtech/kubernetes

Note: The box file will be stored in ~/.vagrant.d/boxes/
Creates and configures guest machines according to your Vagrantfile.
$ vargant up

Bring the machine up with the given provider. By default, this is "virtualbox".
$ vargant up --provider x

E.g : Change the provider to vmware
$ vagrant up --provider vmware

Check the current machine states
$ vagrant status

List all of base boxes for Vagrant
$ vagrant box list

Shut the current machine
$ vagrant halt

Stops the running machine and destroys all resources that were created 
$ vagrant destroy

SSH into a running Vagrant machine
$ vagrant ssh

JFrog setup gradle artifacts

Run JFrog

Create a directory which stores JFrog's persistent data, then run JFrog using Docker. We change the PORT to 8085 instead of using 8081 because 8081 port was occupied by my Jenkins server.
$ mkdir -p jfrog_data 
$ docker run --name jfrogartifactory -d -v jfrog_data:/var/opt/jfrog/artifactory -p 8085:8081 docker.bintray.io/jfrog/artifactory-oss
I created a makefile for running and stopping the container and backup data.
init:
 mkdir -p jfrog_data
run:
 docker run --name jfrogartifactory -d -v `pwd`/jfrog_data:/var/opt/jfrog/artifactory -p 8085:8081 docker.bintray.io/jfrog/artifactory-oss
stop:
 docker stop jfrogartifactory;docker rm jfrogartifactory
clean:
 rm -rf jfrog_data
 docker rmi -f docker.bintray.io/jfrog/artifactory-oss
backup:
 zip -r jfrog_data.zip jfrog_data
After running JFrog, you can check it by entering http://localhost:8085/

Create gradle and generic repositories


Create a group, permission, account




Log out of admin account

Publishing your library using Gradle

Step 1: Add org.jfrog.buildinfo:build-info-extractor-gradle:4.0.1 dependency to the project gradle
buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.2'
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4.0.1"
    }
}
Also, add the variables to gradle.properities to let module use
artifactory_user=XXXX
artifactory_password=YYYY
artifactory_contextUrl=http://10.70.70.40:8085/artifactory

Step 2: Append the below snippet code to then end of your module's gradle file 

apply plugin: 'com.jfrog.artifactory'
apply plugin: 'maven-publish' def libraryGroupId = 'AA.BB.CC' def libraryArtifactId = 'Test' def libraryVersion = '1.0.0' publishing { publications { aar(MavenPublication) { groupId libraryGroupId version libraryVersion artifactId libraryArtifactId artifact("$buildDir/outputs/aar/${artifactId}-release.aar") } } } artifactory { contextUrl = "${artifactory_contextUrl}" publish { repository { repoKey = 'gradle-release-local' username = "${artifactory_user}" password = "${artifactory_password}" } defaults { publications('aar') publishArtifacts = true properties = ['qa.level': 'basic', 'q.os': 'android', 'dev.team': 'core'] publishPom = true } } }

Go to command line to publish your module to your private JFrog artifactory
$ ./gradlew assembleRelease artifactoryPublish
Then, your artifacts will be located at http://localhost:8085/artifactory/webapp/builds/

Import the library in other projects

Step 1: Add repository dependency

    repositories {
        jcenter()
        maven {
            url "http:/[IP]:8085/artifactory/gradle-release-local"
        }
    }
Step 2: Import the library in your module and compile it
compile "com.pakcage:module:version"
It's done!


Upload other artifact using JFrog

Jfrog with free version supports that you can create a generic version and upload anything

Then, you can use curl command to push your artifact to that. Ex:
curl -u<USERNAME>:<PASSWORD> -T <PATH_TO_FILE> "http://10.70.70.44:8085/artifactory/<REPO KEY>/<TARGET_FILE_PATH>


My makefile file : https://github.com/tzutalin/docker/tree/master/JFrog

7/03/2017

Run OpenGrok using docker

  Thanks to Docker. It makes us to use a lot of web service easier.  In the past, we would like to install OpenGrok, we have to install java, tomcat, etc..
  Now, it is easy to run OpenGrok if you know Docker. The steps are quietly simple, please checkout the below steps:

Step1 : Install Docker
$ apt-get update -qq
$ apt-get install -qqy \
  apt-transport-https \
  ca-certificates \
  curl \
  lxc \
  iptables

$ curl -sSL https://get.docker.com/ | sh
$ usermod -a -G docker  $USER

Step2: Pull the image from my Dockerhub .
$  docker pull tzutalin/opengrok
Alternatively, you can check out my Dockerfile on Github, and build the image from scratch.


Step3: Run the OpenGrok using the below commands. Rember to replace <XXXX> with your source directory.

$ docker run -t -d --name=opengrok -v [Absolute path]:/src -p 8080:8080 tzutalin/opengrok
tzutalin/opengrok container will periodically update the index. So you didn't need to update index by yourself.

Open your browser http://0.0.0.0:8080/source/. The result looks like :


Reference: https://github.com/tzutalin/docker/tree/master/OpenGrok