Size: 4.3 Gb
Download: https://ouo.io/bnZLRu1
Installing Java JDK via Homebrew
Install multiple Java JDK versions using Homebrew. To install Homebrew run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Now install the Java JDK version 11 or above using brew cask:
brew cask install java<version>
# latest version
brew cask install java
# LTS 11
brew cask install java11
Note JDK versions prior 11 ( 8 , 9 and 10 ) are no longer supported.
AdoptOpenJDK provides older Java versions. To install the Java JDKs from AdoptOpenJDK:
# install from third party repository
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk<version>
# Java 8
brew cask install adoptopenjdk8
# Java 9
brew cask install adoptopenjdk9
# Java 10
brew cask install adoptopenjdk10
Setup your JAVA_HOME path in your .zshrc or .bash_profile for your primary Java version and add an export for each installed Java version.
export JAVA_HOME=$(/usr/libexec/java_home -v14)
export JAVA_8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA_11_HOME=$(/usr/libexec/java_home -v11)
export JAVA_14_HOME=$(/usr/libexec/java_home -v14)
To check the default Java version and installation path:
java -version
Add an alias to your .zshrc or .bash_profile for each installed Java version. The alias exports JAVA_HOME with the selected JAVA_VERSION_HOME.
alias java8='export JAVA_HOME=$JAVA_8_HOME'
alias java11='export JAVA_HOME=$JAVA_11_HOME'
alias java14='export JAVA_HOME=$JAVA_14_HOME'
Now, to switch between the Java versions, enter an alias java8 in your terminal. Execute java -version to verify that you are now using the correct Java version.
Note : Alias only changes the Java version in the used terminal instance
Source: https://dev.to/notiz_dev/how-to-manage-multiple-java-jdk-versions-on-macos-x-41mi
Installation Docker with Mac$ docker --version
$ docker-compose version
7.6.0:$ docker pull elasticsearch:7.6.0
$ docker run -d --network:elastic -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --name elasticsearch elasticsearch:7.6.0
$ docker ps
7.6.0:$ docker pull kibana:7.6.0
or
$ docker pull docker.elastic.co/kibana/kibana:7.6.0
$ docker run -d --net:elastic -p 5601:5601 -e ELASTICSEARCH_URL=http://localhost:9200 --name kibana kibana:7.6.0
$ docker ps
docker-compose.yml and type this example configuration into file:version: '2.2'
services:
es01:
image: elasticsearch:7.6.0
container_name: es01
environment:
- node.name=es01
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es02
- cluster.initial_master_nodes=es01,es02
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- elastic
es02:
image: elasticsearch:7.6.0
container_name: es02
environment:
- node.name=es02
- cluster.name=es-docker-cluster
- discovery.seed_hosts=es01
- cluster.initial_master_nodes=es01,es02
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data02:/usr/share/elasticsearch/data
networks:
- elastic
kibana:
image: kibana:7.6.0
container_name: kibana
environment:
SERVER_NAME: kibana.local
ELASTICSEARCH_HOSTS: http://es01:9200
ports:
- 5601:5601
networks:
- elastic
depends_on:
- es01
- es02
volumes:
data01:
driver: local
data02:
driver: local
networks:
elastic:
driver: bridge
$ docker-compose run -d
$ docker ps
Install golang$ go version
$ go mod init
$ go get github.com/elastic/go-elasticsearch/v7
main.go and insert this example code:package main
import (
"crypto/tls"
"log"
"net"
"net/http"
"time"
"github.com/elastic/go-elasticsearch/v7"
)
func main() {
cfg := elasticsearch.Config{
Addresses: []string{
"http://localhost:9200",
},
Username: "foo",
Password: "bar",
Transport: &http.Transport{
MaxIdleConnsPerHost: 10,
ResponseHeaderTimeout: time.Second,
DialContext: (&net.Dialer{Timeout: time.Second}).DialContext,
TLSClientConfig: &tls.Config{
MinVersion: tls.VersionTLS11,
},
},
}
es, _ := elasticsearch.NewClient(cfg)
res, err := es.Info()
if err != nil {
log.Fatalf("Error getting response: %s", err)
}
log.Println(res)
log.Println(es.Indices)
}
$ go run main.go
Documentation of go-elasticsearch$ go get -u -d github.com/golang-migrate/migrate/cmd/migrate github.com/go-sql-driver/mysql
$ go build -tags 'mysql' -o /usr/local/bin/migrate github.com/golang-migrate/migrate/cmd/migrate
migrate -help or you can see in here Migrate CLI Usage$ migrate -database mysql://user:password@/dbname -path ./migrations up N
$ migrate -database mysql://user:passwrod@/dbname -path ./migrations down N
$ migrate -database mysql://user:password@/dbname -path ./migrations force N
migrate expects the filenames of migrations to have the format:{version}_{title}.up.{extension}
{version}_{title}.down.{extension}
1_user.down.sql
1_user.up.sql
2_role.down.sql
2_role.up.sql
...
1500360784_user.down.sql
1500360784_user.up.sql
1500445949_role.down.sql
1500445949_role.up.sql
...
1_user.up.sqlCREATE TABLE IF NOT EXISTS user (
id INTEGER NOT NULL AUTO_INCREMENT KEY,
role_id INTEGER,
user_image_path VARCHAR (250),
first_name VARCHAR (100),
second_name VARCHAR (100),
email VARCHAR (30) UNIQUE,
password VARCHAR (30),
phone_number VARCHAR (20),
address VARCHAR (250),
created_by VARCHAR(100),
created_at DATETIME,
updated_by VARCHAR(100),
updated_at DATETIME
);
1_user.down.sqlDROP TABLE IF EXISTS user;
- import java.util.concurrent.TimeUnit;
- ...
- flowable.window(1, TimeUnit.SECONDS);
| RxJava 2 | Reactor | Purpose |
|---|---|---|
Completable | N/A | Completes successfully or with failure, without emitting any value. Like CompletableFuture<Void> |
Maybe<T> | Mono<T> | Completes successfully or with failure, may or may not emit a single value. Like an asynchronous Optional<T> |
Single<T> | N/A | Either complete successfully emitting exactly one item or fails. |
Observable<T> | N/A | Emits an indefinite number of events (zero to infinite), optionally completes successfully or with failure. Does not support backpressure due to the nature of the source of events it represents. |
Flowable<T> | Flux<T> | Emits an indefinite number of events (zero to infinite), optionally completes successfully or with failure. Support backpressure (the source can be slowed down when the consumer cannot keep up) |
- StepVerifier
- .withVirtualTime(() ->
- Flux
- .never()
- .timeout(ofMillis(100))
- )
- .expectSubscription()
- .expectNoEvent(ofMillis(99))
- .thenAwait(ofMillis(1))
- .expectError(TimeoutException.class)
- .verify(ofSeconds(1));
- Hooks.onOperatorDebug();
- import reactor.core.publisher.Flux;
- import reactor.core.publisher.Hooks;
- import reactor.core.publisher.Mono;
- import java.io.File;
- public class StackTest {
- public static void main(String[] args) {
- Mono<Long> totalTxtSize = Flux
- .just("/tmp", "/home", "/404")
- .map(File::new)
- .concatMap(file -> Flux.just(file.listFiles()))
- .filter(File::isFile)
- .filter(file -> file.getName().endsWith(".txt"))
- .map(File::length)
- .reduce(0L, Math::addExact);
- totalTxtSize.subscribe(System.out::println);
- }
- }
- java.lang.NullPointerException
- at reactor.core.publisher.Flux.fromArray(Flux.java:953)
- at reactor.core.publisher.Flux.just(Flux.java:1161)
- at com.nurkiewicz.StackTest.lambda$main$0(StackTest.java:16)
- at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:368)
- at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onNext(FluxConcatMap.java:244)
- at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
- at reactor.core.publisher.FluxArray$ArraySubscription.slowPath(FluxArray.java:126)
- at reactor.core.publisher.FluxArray$ArraySubscription.request(FluxArray.java:99)
- at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:162)
- at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onSubscribe(FluxConcatMap.java:229)
- at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:90)
- at reactor.core.publisher.FluxArray.subscribe(FluxArray.java:53)
- at reactor.core.publisher.FluxArray.subscribe(FluxArray.java:59)
- at reactor.core.publisher.FluxMapFuseable.subscribe(FluxMapFuseable.java:63)
- at reactor.core.publisher.FluxConcatMap.subscribe(FluxConcatMap.java:121)
- at reactor.core.publisher.FluxFilter.subscribe(FluxFilter.java:49)
- at reactor.core.publisher.FluxFilter.subscribe(FluxFilter.java:53)
- at reactor.core.publisher.FluxMap.subscribe(FluxMap.java:62)
- at reactor.core.publisher.MonoReduceSeed.subscribe(MonoReduceSeed.java:65)
- at reactor.core.publisher.Mono.subscribe(Mono.java:3695)
- at reactor.core.publisher.Mono.subscribeWith(Mono.java:3801)
- at reactor.core.publisher.Mono.subscribe(Mono.java:3689)
- at reactor.core.publisher.Mono.subscribe(Mono.java:3656)
- at reactor.core.publisher.Mono.subscribe(Mono.java:3603)
- at com.nurkiewicz.StackTest.main(StackTest.java:23)
- at ...Flux.fromArray()
- at ...Flux.just()
- at com.nurkiewicz.StackTest.lambda$main$0(StackTest.java:16)
- ...
- at ...FluxArray.subscribe()
- at ...FluxMapFuseable.subscribe()
- at ...FluxConcatMap.subscribe()
- at ...FluxFilter.subscribe()
- at ...FluxFilter.subscribe()
- at ...FluxMap.subscribe()
- at ...MonoReduceSeed.subscribe()
- ...
- at com.nurkiewicz.StackTest.main(StackTest.java:23)
- Assembly trace from producer [reactor.core.publisher.FluxConcatMap] :
- reactor.core.publisher.Flux.concatMap(Flux.java:3425)
- com.nurkiewicz.StackTest.main(StackTest.java:17)
- Error has been observed by the following operator(s):
- |_ Flux.concatMap ⇢ com.nurkiewicz.StackTest.main(StackTest.java:17)
- |_ Flux.filter ⇢ com.nurkiewicz.StackTest.main(StackTest.java:18)
- |_ Flux.filter ⇢ com.nurkiewicz.StackTest.main(StackTest.java:19)
- |_ Flux.map ⇢ com.nurkiewicz.StackTest.main(StackTest.java:20)
- |_ Flux.reduce ⇢ com.nurkiewicz.StackTest.main(StackTest.java:21)