본문 바로가기

IT

[java] datetime형태의 String을 패턴 검사 YYMMDDHHMMSS형식의 string을 확인 및 14자리에 맞게 입력 // 자바public static String getDateTimeString(String str) throws Exception { try { if(null != str && !"".equals(str)){ if(!"".equals(str.trim())){ str = str.trim().replaceAll("[^0-9]", ""); if(str.length() < 14){ str = StringUtils.rightPad(str, 14, '0'); } } } } catch (Exception e) { e.printStackTrace(); } return str; } // javascriptStringUtils = {/** * dat.. 더보기
[X][docker] CentOS gitlab docker로 설치 gitlab Docker 설치작성자 : Kei환경 : CentOS 7.X이미지 경로 및 참조 : https://github.com/sameersbn/docker-gitlab gitlab은 docker-compose를 사용해서 설치gitlab:9.1.2gitlab-postgresql:9.6-2gitlab-redis:latest Prerequisitesdocker (설치 생략) 와 docker-compose를 설치한다docker-compose 설치Now that you have Docker installed, let's go ahead and install Docker Compose. First, install python-pipas prerequisite:sudo yum install epel-releas.. 더보기
[ubuntu] Ubuntu에 docker 설치 Ubuntu 에 docker 설치 설치 환경 : Ubuntu 16.04 Prerequisites64-bit Ubuntu 16.04 DropletNon-root user with sudo privileges Initial Setup Guide for Ubuntu 16.04 explains how to set this up.Note: Docker requires a 64-bit version of Ubuntu as well as a kernel version equal to or greater than 3.10. The default 64-bit Ubuntu 16.04 Droplet meets these requirements. // 1. Docker repository 설정1. But first, let'.. 더보기
[java] opencsv 예제 // maven 추가 com.opencsv opencsv 3.9 @RequestMapping("/downCsv")public void downCsv(@ModelAttribute("param") AppVo param, HttpServletResponse response) throws Exception { String fileName = "my.csv";if(null != rtnVo){List csvDatas = new ArrayList();csvDatas.add(new String[] { "1"+ "aa" });csvDatas.add(new String[] { "2"+ "b" }); // 다운로드 response.setContentType("text/csv;charset=UTF-8"); response.s.. 더보기
[java] httpClient 샘플 /** * HTTP Client (POST 방식) 모듈 * @param String url, Map params, String encoding * @throws * @return */private void postHttpClient(String url, Map params, String encoding) { CloseableHttpClient httpClient = HttpClients.createDefault();BufferedReader reader = null; try {HttpPost httpPost = new HttpPost(url); httpPost.addHeader("Content-Type", "application/json");String jsonMsg = this.convertMapToJ.. 더보기
[java] ip 범위에 해당하는지 확인 // CIDR에 해당되는 범위있는 체크 (commons-net 사용) commons-net commons-net 3.6 See this URL: http://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/util/SubnetUtils.html String subnet = "192.168.0.3/31";SubnetUtils utils = new SubnetUtils(subnet);utils.getInfo().isInRange(address) Note: For use w/ /32 CIDR subnets, for exemple, one needs to add the following declaration :utils.setInclus.. 더보기
[X][linux] crontab 수정 # crontab 수정, 추가 방법#write out current crontab crontab -l > mycron #echo new cron into cron file echo "00 09 * * 1-5 echo hello" >> mycron #install new cron file crontab mycron rm mycron crontab 설명* * * * * "command to be executed" - - - - - | | | | | | | | | ----- Day of week (0 - 7) (Sunday=0 or 7) | | | ------- Month (1 - 12) | | --------- Day of month (1 - 31) | ----------- Hour (0 - 23) ----.. 더보기
[spring] JSP 페이지 리턴 - JSP 페이지를 템플릿 형태로 리턴받아 사용할 경우가 생길 경우 // JAVA 파일@RequestMapping("getJsp")public ModelAndView getJsp(HttpServletRequest request) throws Exception { String page = request.getParameter("path"); ModelAndView view = new ModelAndView(page); return view;} // javascript //jsp templatefunction fnGetJsp(id){ var path = "templates/" + id; $.ajax({ type:"GET", url : '${pageContext.request.contextPath}/getJs.. 더보기
[java] split 예제 // StringTokenizer 예제 (구분자 사이에 데이터 존재하지 않으면 해당 데이터 무시함) String ttext = "dadf,e,g,ege,g";StringTokenizer tokens = new StringTokenizer(ttext , ",");for(int i = 1; tokens.hasMoreElements(); i++){System.out.println( i + " : " + tokens.nextToken().trim());} // split 예제" | " 로 split 할 경우 " \\| " 로 해야함 String temp = "a|b|c||dd";String[] values = temp.split(\\|); for(int i ; i < value.length; i++ ) {Sys.. 더보기
[macOS] rootless 기능 disable하기 OS X El Capital 10.11 + rootless disable 하기1. Recovery Mode 로 macOS 부팅 (Command + R 키를 누리고 Reboot)2. Utilities 메뉴에서 Terminal 선택3. 아래 커맨드 입력# csrutil disable# reboot4. 정상 부팅 후에 rootless 확인$ csrutil statusSystem Integrity Protection status disabled rootless enable 하는 방법은csrutil enable 더보기
[css] 단어 넘어감 방지 word-break: keep-all; 추가예: ) li { word-break: keep-all;} 더보기
[java] ToStringBuilder // pom.xml org.apache.commonscommons-lang33.3.2 // java 예제 import org.apache.commons.lang3.builder.ToStringBuilder; System.out.println(ToStringBuilder.reflectionToString(cloudMeshTask)); 더보기
[java] 패턴 예제 // Map 타입 출력Map map = new HashMap(); String rtnString = "";int rtnNum = 0; for(String key : map.keySet()) {if(null != map.get(key)){if(map.get(key).getClass().equals(Integer.class)) {rtnNum = (int)map.get(key);} else if(map.get(key).getClass().equals(Boolean.class)) {if((boolean)map.get(key)) {rtnNum = 1;} else {rtnNum = 0;}} else {rtnString = map.get(key).toString();}} } // Map 출력 Map map = new.. 더보기
[python] python, Pydev 설치 eclipse용 Pydev(Python plugin) 설치작성자 : Kei환경 : Windows 10 64bit // Python 설치URL : https://www.python.org/downloads // 환경설정 // eclipse 에 Pydev 설치-- eclipse에 플러그인 추가 혹은 marketplace에서 검색Pydev 추가http://pydev.org/updatesPyDev, PyDev Mylyn Integration 모두 설치 -- preferences에 경로 설정Python Interpreter에서Python interpreters의 New버튼선택 Python 설치 경로에 python.exe 선택하면 화면 하단에 PYTHONPATH가 자동으로 설정됨 더보기
[go] Go, GoClipse 설치 eclipse용 GoClipse(go plugin) 설치작성자 : Kei환경 : Windows 10 64bit // Go 설치URL : https://golang.org // 환경설정GOROOT : D:\GoPATH : C:\Go\bin사용자변수에 GOPATH 설정GOPATH : D:\dev\gocode // git 설치URL : https://git-scm.com/git 다운로드 후 설치 // gocode 받기 (GOPATH 경로에 다운받아짐)go get -u github.com/nsf/gocode // eclipse 에 GoClipse 설치-- eclipse에 플러그인 추가GoClipse 추가http://goclipse.github.io/releases/GoClipse 만 체크해서 설치 -- pref.. 더보기
[X][ubuntu] Ubuntu 설치 ubuntu server 설치 작성자 : Kei환경 : ubuntu 16.04.2 LTS 설치시 선택 : GRUB 설치 선택 // 0. 기본 명령어// 종료# shutdown -h now // 재부팅# reboot // 1. ubuntu server minimal 설치시 해야할 작업 // root 패스워드 설정$ sudo passwd root // package update하기# apt-get update // ssh 설치# apt-get install openssh-server // root계정으로 ssh 접속을 위한 설정파일 수정, 우회접속시 수정 불필요# vi /etc/ssh/sshd_config # Authentication:LoginGraceTime 120# PermitRootLogin with.. 더보기
[백업] [OpenStack] OpenStack Kilo OpenStack Kilo 설치작성자 : Kei설치 환경 : VMware ESXi 6.0 / Ubuntu 14버전 : OpenStack Kilo 정식 설치 매뉴얼 (Ubuntu)http://docs.openstack.org/kilo/install-guide/install/apt/content/neutron-compute-node.htmlOpenStack CentOS 와 Ubuntu의 설정등이 조금씩 다름. 매뉴얼 외적 내용과 유의사항만 기록. // 네트워크 설정 (network node 경우, ubuntu일 경우)# vim /etc/network/interfaces# The loopback network interface auto lo iface lo inet loopback # The primary n.. 더보기
[VMware] VMware vSphere 6.0 VMware vSphere ESXi작성자 : Kei설치 환경 : OSX에 VMware Fusion 8 사용 // 0. vSphere 6.0 의 두 핵심 구성 요소 1. ESXi2. vCenter Server // 1. ESXi // 2. vCenter Server0.vCenter Server Appliance는 ESXi 호스트 6.0 또는 vCenter Server 인스턴스에 배포할 수 있음vCenter Server는 가상 시스템 및 호스트의 관리, 운영 리소스 프로비저닝 및 성능 평가를 위한 중앙 집중식 플랫폼을 제공 // VMware Platform Services Controller -- 구성요소1. vCenter Single Sign-On2. vSpjere License service3. VMwa.. 더보기
[JetBrains] intelliJ JetBrains의 intelliJ[정리 중] // Plugin 등록방안) plugins -> Browse repositories -> Manage repositories -> Custom Plugin Repositories에 plugin의 url 등록 후 // 단축키 https://resources.jetbrains.com/assets/products/intellij-idea/IntelliJIDEA_ReferenceCard.pdf // 포트 크기 변경방안) Settings -> Editor -> Colors & Fonts -> Font에서 Scheme를 다른이름으로 저장 후에 Primary font의 Size 변경 // trouble shooting-- SVN checkout 시 에러Cannot loa.. 더보기
[Spring] Springframework 강의 Springframework 강의http://www.tutorialspoint.com/spring/spring_bean_scopes.htm 더보기