[Java] List 중복 제거.

ITWeb/개발일반 2021. 9. 14. 12:34

DictionaryModel 은 String, List<String> 맴버 변수를 가집니다.

이 맴버 변수 중 List<String> 을 모두 펼쳐서 distinct word 목록을 만들려고 합니다.

 

List<String> flats = new ArrayList<>();
List<String> words = new ArrayList<>();

for (DictionaryModel d : dictionarys ) {
	words.addAll(d.getAnalyzed());
}

flats = words.stream().distinct().collect(Collectors.toList());

기억력을 돕기 위해 기록해 봅니다.

 

:

[강의] Elasticsearch 동영상 강의 - 유료

Elastic 2021. 9. 9. 20:53

안녕하세요.

그 동안 제가 커뮤니티에 작게나마 질문에 댓글도 달고 일부 정보도 공유 하고 했었는데요.

좋은 기회가 생겨서 Elasticsearch에 대한 동영상 강의 컨텐츠 제작을 하게 되었습니다.

(유료 강의 입니다. ^^;)

 

제가 그 동안 Elasticsearch 를 어떻게 익혀 왔고 실 서비스에 적용은 또 어떻게 했는지 그리고 문제가 발생 했을 때 어떻게 문제를 해결해 나갔는지 본 강의를 통해서 모두 알려 드리려고 합니다.

 

기본 이론과 이론에 기반한 실습 그리고 최종 배운 것을 토대로 분석, 설계, 구축, 구현 까지 마무리 하는 과정으로 이루어져 있습니다.

처음 시작해 보시는 분이나 시작은 했으나 좀 더 동작 원리나 Elasticsearch 를 잘 다뤄 보고 싶으신 분들께 도움이 될거라고 생각 합니다.

강의를 들으시는 분들께 도움을 드릴 수 있도록 계속 노력 하겠습니다.

(문제가 된다면 삭제 처리 하겠습니다.)

 

P.S. Elasticsearch 레퍼런스 문서를 모두 정독 하신 분, 소스 코드를 정독 하신 분은 본 강의가 도움이 되지 않을 수 있습니다.

 

 

https://bit.ly/3ttacof

 

The RED : 검색엔진 구축을 위한 Elasticsearch 마스터 클래스 | 패스트캠퍼스

국내 1티어 검색 엔지니어 정호욱에게 엘라스틱서치 설치부터 기본구조, 핵심기능까지 배워보세요. 500페이지에 달하는 방대한 가이드를 효율적으로 활용하는 방법을 얻어가실 수 있습니다.

fastcampus.co.kr

 

:

[Elasticsearch] Shard Awareness Allocation 사용 시 주의점.

Elastic/Elasticsearch 2021. 9. 7. 23:30

로컬에서 테스트 할 때 주의 해야 하는 점이 있습니다. 

같은 shard 가 같은 host 장비에 할당 되게 하려고 아래와 같은 설정을 합니다.

 

cluster.routing.allocation.same_shard.host: true

 

그런데 이 설정으로 인해서 shard allocation 적용 시 동작 하지 않게 됩니다.

사용 시 위 설정에 대해서 반드시 확인 하고 사용 하세요.

(같은 실수를 몇 번 하는 지 ㅡ.ㅡ;;)

:

[ZSH] oh-my-zsh 설정 on Macbook.

ITWeb/개발일반 2021. 9. 7. 10:47

또 뭔가 찾기 귀찮아서 기록해 봅니다.

 

[oh-my-zsh 설치]
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"

 

[iTerm2 Color Schemes]
https://github.com/mbadolato/iTerm2-Color-Schemes/tree/master/schemes

 

[d2font 설치] (서체관리자 추가 및 iTerm 추가)
https://github.com/naver/d2codingfont

 

[highlighting]
$ brew install zsh-syntax-highlighting

$ vi .zshrc 하단에 추가
source /usr/local/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

 

[Insecure Directory Skip]

$ vi .zshrc 제일 윗줄에 추가

 ZSH_DISABLE_COMPFIX=true

 

[Theme 수정]

$ vi .zshrc 수정 및 추가

ZSH_THEME="agnoster"
...중략...
prompt_context() {
  if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]];
  then
  	prompt_segment black default "%(!.%{%F{yellow}%}.)$USER"
  fi
}

 

[newline 추가]

$ vi ~/.oh-my-zsh/themes/agnoster.zsh-theme

build_prompt() {
  RETVAL=$?
  prompt_status
  prompt_virtualenv
  prompt_aws
  prompt_context
  prompt_dir
  prompt_git
  prompt_bzr
  prompt_hg
  prompt_newline # <-- 추가
  prompt_end
}

 

[newline & multiline 적용]

PROMPT='%{%f%b%k%}$(build_prompt) '

# 아래 6, 7번 라인은 아래와 같이 작성을 하셔야 정상적으로 나옵니다.
prompt_newline() {
  if [[ -n $CURRENT_BG ]]; then
    echo -n "%{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR
%{%k%F{blue}%}$SEGMENT_SEPARATOR"
  else
    echo -n "%{%k%}"
  fi

  echo -n "%{%f%}"
  CURRENT_BG=''
}

 

[plugin 적용]

- zsh-syntax-highlighting

$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

 

- zsh-autosuggestions

$ git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

 

$ vi .zshrc

plugins=(
  git
  zsh-syntax-highlighting
  zsh-autosuggestions
  web-search
  jsontools
  macports
  node
  osx
  sudo
  docker
  iterm2
)
:

[wget] proxy 설정 사용.

ITWeb/개발일반 2021. 9. 6. 20:11

Proxy 사용 시 wget 에서도 설정을 해 줄 수 있습니다.

아래와 같이 사용 하시면 됩니다.

 

[general]

$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.14.1-darwin-x86_64.tar.gz

 

[http]

$ wget -e use_proxy=yes -e http_proxy=proxy.abcdefg.com:8080 http://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.14.1-darwin-x86_64.tar.gz

 

[https]

$ wget -e use_proxy=yes -e https_proxy=proxy.abcdefg.com:8080 https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.14.1-darwin-x86_64.tar.gz

: