crontab

참조: https://jdm.kr/blog/2 1. 작성 $ crontab -e 2. 보기 $ crontab -l 3. 전체 삭제 $ crontab -r 4. 실행주기 설정(요일: 0,7==일요일) *      *      *      *      *분(0-59)  시간(0-23)  일(1-31)  월(1-12)   요일(0-7) 5. 예제 # 매분 test.sh 실행* * * * * /home/script/test.sh # 매주 금요일 오전 5시 45분에 test.sh 를 실행45 5 * * 5 /home/script/test.sh # 매일 매시간 0분, 20분, 40분에 test.sh … 계속 읽기 crontab

JAVA 나눗셈 소수이하 표기(BigDecimal)

두 개의 인수 중 한개 이상이 double 이면 double로 리턴된다.double c = (double) 100 / 3;  아래는 소수자릿수를 원하는 만큼 보여주는 방식이다. 1. 첫번째 방법(리턴타입 Double) System.out.println(Math.round((c)*100)/(double) 100); //33.33System.out.println(Math.round((c)*1000)/(double) 1000); //33.333System.out.println(Math.round((c)*10000)/(double) 10000); //33.3333 2. 두번째 방법(리턴타입 String) System.out.println(String.format("%.2f", c)); //33.33System.out.println(String.format("%.3f", c)); //33.333System.out.println(String.format("%.4f", c)); //33.3333 3. Double, Float의 계산 오류 >> BigDecimal 사용 double d = … 계속 읽기 JAVA 나눗셈 소수이하 표기(BigDecimal)

JAVA에서 javascript 엔진 사용하기

import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; import javax.script.ScriptException; public static void main(String[] agrgs){ ScriptEngineManager scriptEngineManager = new ScriptEngineManager(); //javascript 엔진 불러오기 ScriptEngine scriptEngine = scriptEngineManager.getEngineByName("js"); try { String value = scriptEngine.eval("(Math.round(1/3*10000)/10000).toFixed(4)").toString(); System.out.println(value); } catch (ScriptException e) { // TODO Auto-generated catch block e.printStackTrace(); } }

Window에서 command에서 curl 사용하기

참고 : https://m.blog.naver.com/javaking75/220776461230 curl 사이트에서 window 비트에 맞추어 zip 파일을 다운로드 받는다.https://curl.haxx.se/download.html curl-7.64.1.zip 1. 사용방법 : 아래위치로 압축푼 파일 이동 C:\curl-7.64.1-win64-mingw 2. 시스템 환경 변수에서 path 편집으로 들어가서 아래 내용 추가 C:\curl-7.64.1-win64-mingw\bin; 3. 사용예시 - Command 창 띄움 Window+R > cmd - 명령어 예시 curl http://test.aaboo.com/batch/merchantEmailAttachMaker?recvdate=20190415

외부 URL 이미지, html을 response

public void responseURLImage(HttpServletResponse res){ res.setStatus(200); res.setContentType("application/octet-stream"); String imageLocation = "https://www.aaboo.co.kr/img/aaboo.gif"; URL imgUrl = new URL(imageLocation); InputStream in = new BufferedInputStream(imgUrl.openStream()); OutputStream out = res.getOutputStream(); byte[] buf = new byte[1024]; int count = 0; while((count = in.read(buf)) >=0){ out.write(buf, 0, count); } out.close(); in.close(); } 위의 경우는 이미지파일이 다운받아진다. 브라우저에서 다운받는 대신, 링크를 이동할 경우 아래처럼 … 계속 읽기 외부 URL 이미지, html을 response

Spring properties 사용하기

1. 프러퍼티 파일 생성 먼저 아래와 같이 properties 파일을 만들어 주자 /WEB-INF/spring/properties/aabooSite-local.properties 다음 문장을 추가해보자 db.url = 127.0.0.1 db.username = aaboo db.password = !@!dsfsdf23432131avalue1 = 12345 value2 = abcdef 2. 환경설정 구성(이클립스에서) 1) servlet-context.xml 에서 아래 내용 추가 <!-- 프로퍼티 파일 설정 --> <beans:bean id="properties" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <beans:property name="locations"> <beans:list> <beans:value>/WEB-INF/spring/properties/aabooSite-${spring.profiles.active}.properties</beans:value> </beans:list> </beans:property> </beans:bean> <!-- 위의 … 계속 읽기 Spring properties 사용하기

엑셀에서 lastIndexOf 와 같은 기능을 찾으려 보니 없드라

엑셀에서 lastIndexOf 와 같은 기능을 찾으려 보니 없드라... 그래서 찾은 자료임 "E2" 자리에 있는 문자가 아래와 같을 경우 \jtnet-backoffice-system\jms\src\main\webapp\index.jsp 여기서 파일명(index.jsp)만 추출하고자 할 경우 아래 함수 적용 =RIGHT(E2,LEN(E2)-FIND("@",SUBSTITUTE(E2,"\","@",LEN(E2)-LEN(SUBSTITUTE(E2,"\",""))),1)) 결과값 : index.jsp 또, 폴더명(index.jsp 이전 텍스트)만 추출하고자 할 경우 아래 함수 적용 =LEFT(E2,LEN(E2)-(LEN(E2)-FIND("@",SUBSTITUTE(E2,"\","@",LEN(E2)-LEN(SUBSTITUTE(E2,"\",""))),1))) 결과값 : \jtnet-backoffice-system\jms\src\main\webapp\