[AWS] Setup Environment and Build Native Library (OpenCV, C++)

Developing log of Amazon Web Service (AWS).

Objective:

Deploy a JAVA Web Service on AWS.

Local Environment:

Eclipse Java EE, Tomcat 8.0, JNI native library

AWS Development Environment Setup:

AWS Toolkit for Eclipse:    AWS Toolkit for Eclipse Document

Generate a new RSA key and add it to GitHub: Link

Configure a HTTPS listener on load balancer:

http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-https-load-balancers.html

Build OpenCV 3.2.0 (include OpenCV Java)

Prepare necessary build tools:

# install required tools
sudo yum install git cmake gcc-c++

Clone from OpenCV GitHub repository:

 # get opencv GitHub repository git clone git@github.com:opencv/opencv.git # checkout specific version tag git checkout tags/3.2.0 

Use CMake to build opencv (release version, static library)


cd opencv

mkdir build

cd build

cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=NO -DBUILD_opencv_python=OFF ..

make

sudo make install

OpenJDK 1.8:

Amazon Linux contains java-1.8.0-openjdk  but not java-1.8.0-openjdk-devel. In order to build OpenCV Java package, we need to install openjdk-devel. (error message example: Unable to locate tools.jar)


sudo yum install java-1.8.0-openjdk-devel

Ant 1.10.1:

Ant is also required to build OpenCV Java Wrappers. However, the version installed by yum install is no too low (1.8) which doesn’t support java-1.8.0.

Download Ant http://ant.apache.org/bindownload.cgi


wget http://www-eu.apache.org/dist//ant/binaries/apache-ant-1.10.1-bin.zip
unzip apache-ant-1.10.1-bin.zip

Export ANT_HOME as apache-ant folder and add ANT_HOME/bin to PATH

Add the following lines to .bashrc file


export ANT_HOME=~/apache-ant-1.10.1

export PATH=${PATH}:${ANT_HOME}/bin

Advertisements

Ubuntu Dev Log (14.04 LTS)

Open terminal in current folder in right-click menu:


# get nautilus-open-terminal

sudo apt-get install nautilus-open-terminal

# reload files and folders manager

nautilus -q

Environmental Variables

# print all environment variables
printenv
# print specific environment variables
echo ${your environment variable}

 

 

 

MC Bukkit Plugin Dev Log

Following Bukkit Plugin Tutorial (Chinese version: Buikkit插件开发教程)

My GitHub Bukkit plugins repository: click here

1. Install JDK 8 SE.

2. Install Eclipse Neon for Java Developer (with maven).

3. Add reference to Bukkit API using maven.
(Note that due to copyright issue bukkit.org has taken down its repo for Bukkit API and server.  Alternative links are GetBukkit for downloading Bukkit server and Spigot Maven Wiki for add reference to Bukkit API. )

4. Create java package for plugins (io.github..).

5. Add new class file in the package which extends from JavaPlugin.

package {$GroupName}.{$ArtifactName};

import org.bukkit.plugin.java.JavaPlugin;

public final class {$ArtifactName} extends JavaPlugin {

}

(Note that there could be only one class in your plugin package extends from JavaPlugin.)

6. Create plugin.yml file in src/main/resources

name: {plugin name}
main: {package name}.{main class}
version: {version no.}

Detailed instruction of how to configure your plugin.yml file could be found here.

7. Implementing your plugin class

onCommand() method:

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
    if (cmd.getName().equalsIgnoreCase("basic")) { // If the player typed /basic then do the following, note: If you only registered this executor for one command, you don't need this
    // doSomething
        return true;
    } //If this has happened the function will return true.
    // If this hasn't happened the value of false will be returned.
    return false;
}

8. Deploying your Plugin

To do this in Eclipse, right-click the project and click Run as > Maven install.

If your project built successfully, the JAR file is now under the target folder in your project’s folder under your Eclipse workspace. The JAR file you have exported should now be a working plugin!

GitHub

Ubuntu / SSH

Configure GitHub and add a SSH key to your GitHub account:

Connecting to GitHub with SSH

Initialize GitHub folder, add files, commit and push:

Adding a file to a repository using the command line

Visual Studio

Install the extension GitHub in Visual Studio.

Add the current project to source control.

Then the repository could be published to GitHub and all git functions enabled in built-in Visual Studio GUI.

Basic GitHub Workflow

# create a new project, initialize GitHub, and publish to GitHub
$ git init
$ git add .
$ git status
$ git commit -a -m "commit"
$ git push
# Clean untracked files
$ git clean -df
# Abort uncommitted changes
$ git checkout -- .
# Create new branch
$ git branch -b branchname
$ git checkout branchname
# Delete branch
$ git checkout otherbranchname
$ git branch -d branchname

How to insert code in WordPress

GitHub Instruction

Git远程操作详解

麻酱面做法

前两天做了油泼辣子,送了小强晓津夫妇半碗。
今天晓津教了我麻酱面的做法,准备下班回家试试,具体做法如下:

1. 面条煮熟
2. 麻酱逐量加水搅拌均匀, 加少量盐
3. 热锅, 热油, 放一小把花椒. 差不多了拎半碗生抽, 迅速关火, 倒出。
花椒油搞定。
4. 把麻酱和花椒油倒在面条上。根据自己喜好酌情添加醋、香油
5. 菜码自己决定(黄瓜丝,土豆丝之类)
6. 挖一大勺油泼辣子

感觉有点模糊,回家试的时候再总结经验吧。。

Wolven Storm – Priscilla’s Song

wallhaven-156955

《巫师3》这段游戏插曲就是所谓开口跪,也是为整个游戏加分的一段音乐。

作为吟游诗人,普希拉这首歌 Wolven Storm 描绘了主角杰罗特与叶奈法曲折的爱情故事。

杰罗特在这个时代已经变成了传说(毕竟已经是100岁左右的狩魔猎人,这设定让我想起来魔戒里的阿拉贡,不过阿拉贡是自我流放,跟精灵交往密切,基本没人类认得他)。而狩魔猎人爱上女术士的故事也被大家津津乐道(杰罗特这点事儿看来被损友丹德里恩说得全世界人民都知道了)。

此时杰罗特和叶奈法的故事还是一个悲情故事。自从被狂猎抓走,杰罗特又经历了失忆,已经很久没见到叶奈法了,三代故事开始时,就一直在追寻着叶奈法的踪影。

杰罗特用来形容叶奈法的“闻起来像醋栗与丁香”这种羞耻感爆表的描述居然也被丹德里恩说出来,然后被写进了诗歌哈哈,求杰罗特的心理阴影面积。不过看群众演员的反应来看,大家还不知道这首歌唱的就是杰罗特跟叶奈法的事情。

普希拉的故事虽然篇幅短,但是形象很立体,结局也是悲惨中带着一些温暖。在帮助丹德里恩的过程中,被毁容,自豪的歌喉被人毁了。

但是故事到最后,丹德里恩会告诉主角普希拉已经能说话了,而且恢复能力很强,说不定以后还有机会再次登上舞台。期待5月30号发售的DLC《血与酒》或者说以后的续作中会有普希拉的剧情。

来听这段《狼之风暴》,链自youtube。b站的七国语言版 请戳这里

Blog at WordPress.com.

Up ↑