Spring Framework 5.0とMaven

Springは、Apache Software Foundationが開発するJavaプロジェクト管理ツール「Apache Maven」に対応しています。Mavenは、コマンドラインでプロジェクト管理を行えるツールです。

Maven
https://maven.apache.org/

https://maven.apache.org/download.cgi
「Binary zip archive」のLink「apache-maven-3.5.2-bin.zip」からダウンロードします。

適当な場所に保存して、環境変数のpathに追加します。
C:\apache-maven-3.5.2\bin
※「\bin」を忘れずに

コマンドプロンプトで「mvn -v」でバージョンを確認してみましょう。

>mvn -v
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T16:58:13+09:00)
Maven home: C:\apache-maven-3.5.2\bin\..
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jre1.8.0_121
Default locale: ja_JP, platform encoding: MS932
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

ヴァージョンが表示されれば、正常に動いています。

Spring Framework 5.0とSprint Tool Suiteのダウンロード

Spring5の対応JDKは、JDK8(ver 1.8)で、それ以前のversionは未対応となっています。コマンドラインで確認してください。

>java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

続いて、Spring Tool Suite(STS)をダウンロードします。
https://spring.io/tools/sts

DOWNLOAD STSをクリックしてダウンロードします。


– sts-3.9.2.RELEASE がSTS本体フォルダ
– Pivotal-tc-server-develop-3.2.8…. が開発用のJavaサーバープログラム。STS内から起動して使う
– legalフォルダ ライセンス情報など

STSプログラムは、sts-xxxフォルダ内にあるSTS.exeを起動して利用します。

Supervised Classification

Classification
-> regression, ranking, reinforcement learning, detection

Logistic Classifier
WX + b = y
-> a, b, c
p = 0.7, 0.2, 0.1
p = probability which closed to 1.0 – 0
S(yi) = e^yi / Σi e^yj
Any scores turned to probability

Google Cast

Streaming media

Google Cast
-multi device
-android, ios, web

Android TV
-extended android app
-runs on TV

Platform
android -> android TV

Android TV platform
1.declare the TV activity in the manifest
2.Update UI with the leanback library
-BrowseFragment
-DetailsFragment
-SearchFragment
3.Content discovery
-Apps/Games row
-Recomendations
-Search

https://developers.google.com/cast/docs/developers

Getting started
https://cast.google.com/publish/

Parallel Processing

CPU1 CPU2 CPU3

#include <pthread.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>

void* f1(void* arg){
	int whos_better;
	whos_better = 1;
	while(1)
		printf("Thread 1: thread %d is better.\n", whos_better);

		return NULL;
}

void* f2(void* arg){
	int whos_better;
	whos_better = 2;
	while(1)
		printf("Thread 2: thread %d is better.\n", whos_better);

	return NULL;
}

int main(int argc, char **argv){
	pthread_t th1, th2;

	pthread_create(&th1, NULL, f1, NULL);	
	pthread_create(&th2, NULL, f2, NULL);

	pthread_join(th1, NULL);
	pthread_join(th2, NULL);

	pthread_exit(NULL);
}

File System

Key Abstractions
1. file
2. file name
3. Directory Tree

#include 
#include 
#include 
#include 

int main(int argc, char **argv){
	int fd;
	ssize_t len;
	char *filename;
	int key, srch_key, new_value;

	if(argc < 4){
		fprintf(stderr, "usage: sabotage filename key value\n");
		exit(EXIT_FAILURE);
	}

	filename = argv[1];
	srch_key = strtol(argv[2], NULL, 10);
	new_value = strtol(argv[3], NULL, 10);
}

Naive Memory Model

CPU
Memory: fast, random access, temporary
Disk: slow, sequential access, durable

CPU Register <- cache -> Main Memory
10 cycle latency, 256 bytes / cycle

Memory Hierarchy
CPU
Main Memory

Write Policy
Hit:
– write-through
– write-back

Miss:
– write-allocate
– no-write allocate

Virtual Address Abstraction
Kernel addresses, user stack, heap, uninitialized data, initialized data, code

ggplot2

> library(ggplot2)
> names(faithful)
[1] "eruptions" "waiting" 
> plot(faithful$eruptions, xlab = "sample number", ylab = "eruption times (min)", main = "Old Faithful Eruption Times")

qplot(x = waiting,
	data = faithful,
	binwindth = 3,
	main = "Waiting time to next eruption(min)")
ggplot(faithful, aes(x = waiting)) +
	geom_histogram(bindwidth = 1)

> names(mtcars)
[1] “mpg” “cyl” “disp” “hp” “drat” “wt” “qsec” “vs” “am” “gear”
[11] “carb”