본문 바로가기

전체 글

CompletableFuture 사용법 CompletableFuture는 Java8에 등장했다. Future와 CompletionStage를 구현했다. 따라서 비동기 연산들을 구성, 결합 실행하고 에러를 처리하는 메소드를 가지고 있다. 간단히 비동기 코드를 실행하고 싶다면, CompletableFuture의 runAsync, supplyAsync 함수를 사용한다. runAsync 는 return 타입이 없는 Runnable을 매개변수로 받고, supplyAsync는 return 타입이 있는 Supplier를 매개변수로 받는다. CompletableFuture future = CompletableFuture.supplyAsync(() -> { try { Thread.sleep(2000); } catch (Exception e) { e.print.. 더보기
apache HttpClient, javax.net.ssl.SSLHandshakeException 발생시 대처법 HttpClient 를 이용하여 https 페이지를 접속하려 할때 아래와 같은 예외가 발생하기도 한다. javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131) at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:320) at ja.. 더보기
Python - 특정 문자가(정규식이) 문자열에 포함되어 있는지 검사 (java의 String.contains) python에서 정규식 관련 매칭, 검색기능을 제공하는 re 모듈을 사용한다. re.compile(패턴) 함수로 Pattern 오브젝트를 생성 한 후 Pattern.search(문자열) 함수를 이용하여 결과를 확인한다. search 함수는 Pattern 오브젝트의 패턴이 문자열에 존재하면 Match 오브젝트를 그렇지 않으면 None을 리턴하므로 아래와 같이 활용하여 특정 문자나, 정규식을 검색 할 수 있다. import re string_a = 'test ㅋ' string_b = '1test' digit_regexp = re.compile(r'\d') space_regexp = re.compile(r'ㅋ') if digit_regexp.search(string_a): print('{0} has digit.. 더보기
Python - Beautiful Soup 사용법 html 태그 문자열로 BeautifulSoup 객체를 생성한다. from bs4 import BeautifulSoup soup = BeautifulSoup(html_string, 'html.parser') CSS selector 기준으로 tag를 찾아 리스트 형태로 반환한다. (CSS Selector : https://www.w3schools.com/cssref/css_selectors.asp) # soup.select(CSS selector) soup.select('select#observation_select1 option') # HTML Tag - 서울(유) print(location_selector) # 서울(유) - HTML 문자열 print('selected' in location_selec.. 더보기
Python - 이전 달 구하기 python 에서 이전 달을 구하는 방법은 현재 달의 1일 - 1일 하는 형태로 이전 달을 구할 수 있다. from datetime import date, timedelta today = date.today() month_ago = today.replace(day = 1) - timedelta(days = 1) year = str(month_ago.year) month = str(month_ago.month) 더보기
Git 서브트리 (Subtree) 분리되어 있는 별도의 repository를 다른 repository에 물리적으로 합친다. 최초 구성 Server mkdir subtree cd subtree git init --bare Client 프로젝트 생성 git init git remote add origin ssh://user@url:22/git/subtree git add . git commit -m "init proj" git push --set-upstream origin master 다른 repository를 subtree로 합치기 git subtree add --prefix=projectA ssh://user@url:22/git/submodule.projectA master subtree 는 다른 repository를 복사해와서 관리 .. 더보기
Git 서브모듈 (Submodule) 하나의 프로젝트 안에 여러개의 프로젝트가 존재하는경우, 각각의 독립된 Repository로 관리하고, 부모 Repository에서 자식의 참조 HEAD 위치를 저장해서 관리한다.repository는 독립 되어 있어야 하고, git submodule add 로 submodule 을 추가한다.clone 하거나 pull 할때는 ** --recurse-submodules** 옵션을 이용하면 submodule 들을 한번에 clone 하거나 pull 할 수 있다. 구성하는 방법 Server mkdir submodule mkdir submodule.projectA cd submodule git init --bare cd ../submodule.projectA/ git init --bare Client1. 부모 프로젝.. 더보기
Redmine 설치법 출처 : https://www.redmine.org/projects/redmine/wiki/RedmineInstall문서는 redmine 3.0 ~ 4.0 버전에 관련된 문서이며, 타 버전에 대한 문서는 공식 웹사이트를 참조하세요 시스템 요구사항OS Ruby를 사용할 수 있는 Unix, Linux, macOs, MacOs Server, Windows 에 설치 가능 Ruby Iterpreter Ruby, rails 설치 방법 참조 Redmine 버전에 따른 Ruby 버전은 아래와 같다. Redmine versionSupported Ruby versionsRails version used4.0 (upcoming)ruby 2.2 (2.2.2 and later), 2.3, 2.41, 2.5Rails 5.23.4.. 더보기