본문 바로가기

전체 글

apache commons exec 을 이용한 java에서 linux script 실행 보통 linux 쓰면 인터넷 연결된 경우 시간을 알아서 동기화한다.그런데 이 케이스에서는 인터넷 연결이 안 돼서 시간설정을 수동으로밖에 할 수 없는 상황이었다. 일단 시간 설정을 하려면 root 계정으로date -s "2017-01-18 13:00:00"이렇게 입력하면 된다. 내가 생각한건, 1. jsp에서 javascript new Date()로 클라이언트 시간을 가져옴2. 그 시간으로 리눅스 시간 셋팅 요거였고, 여기서 문제가 된건 2번.. java에서 linux 명령어를 입력할 수 가 있나? 하는 것이었다.찾아보니 아파치에서 만든게 있더라. 스프링 기반 웹프로젝트이고, 메이븐을 사용했으므로 일단 pom.xml에 아래와 같이 추가 org.apache.commons commons-exec 1.1 그리고.. 더보기
동기화 처리 javascript는 비동기방식으로 돌아가므로, var arr = ['a','b','c']; for(var i=0; i 더보기
Array.prototype.slice.apply(arguments); function argTest(){console.log(arguments); // {"0":4}Array.prototype.slice.apply(arguments); // 4 Array.prototype.slice.apply({'0':4, '1':5, length:2}) // 4, 5Array.prototype.slice.apply({'0':4, '1':5, length:2}, [1]) // 5Array.prototype.slice.call({'0':4, '1':5, length:2}, 1) // 5} argTest(4); Array.prototype.slice.apply(arguments); arguments는 배열이 아니다. 콘솔로 찍어보면 {"0":4} 이렇게 생긴 오브젝트가 찍힌다.그런데 slic.. 더보기
Github 사용시 The authenticity of host can't be established. 에러 해결.. git으로 clone을 받으려고 했는데 위와 같은 에러가 뜨면서 소스를 받아오지 못했다. ssh-key를 만들어야 가능한 것 같다. 이건 pc마다 하나씩 있어야 하는듯? 확실하진 않은데..;; 아래 링크로 들어가서 차근차근 따라하면 된다. https://help.github.com/articles/generating-an-ssh-key/ 더보기
javascript module에 관한 좋은 글 소개 https://medium.freecodecamp.com/javascript-modules-a-beginner-s-guide-783f7d7a5fcc#.qwnwdnj0s Preethi Kasireddy 라는 사람이 쓴JavaScript Modules: A Beginner’s Guide 이다. 세상은 넓고 고수는 많구나.. javascript 모듈에 관해 이해하는데 큰 도움이 된다. 더보기
티스토리로 컴백 wordpress 너무 불편해서 결국 다시 티스토리로 돌아왔다. 티스토리 문 닫으면.. 내보내기 기능이 잘 되어있으니 뭐! 어떻게든 되겠지. 더보기
poi 사용 엑셀 계산식 사용하기 복잡한 엑셀 수식을 거쳐서 나온 결과값 데이터가 필요한 경우가 있다.이런 경우 그 복잡하고 많은 수식을 로직으로 옮기기 힘들때가 많다.그럴때 수식이 담긴 엑셀 파일을 불러와서 셀 값만 변경하여 결과값을 받아올 수 있게 만든 소스. // 엑셀파일File file = new File(servletContext.getRealPath("/WEB-INF/excel/test.xlsx")); // 엑셀 파일 오픈XSSFWorkbook wb = new XSSFWorkbook(new FileInputStream(file));FormulaEvaluator evaluator = wb.getCreationHelper().createFormulaEvaluator(); List list = loop 돌리면서 계산해야할 데이터 l.. 더보기
jqgrid custom editrules 추가하기 colModel 에 다음과 같이 추가하면 된다. editrules : {custom: true, custom_func:function(value, colname){if(isNaN(value)){return [false, "not a number!"];}else{return [true, ""];}}} 이런 식으로…응용해서 쓰면 되겠다. 더보기