본문 바로가기
반응형

전체 글145

Thread.sleep throw InterruptedException? 출처 http://stackoverflow.com/questions/1087475/when-does-javas-thread-sleep-throw-interruptedexception 종종 스레드를 종료하다 발쌩하는 예외인데 유용하다. If you use it in a single threaded app (and also in some multi-threaded apps), that method will never be triggered. Ignoring it by having an empty catch clause i would not recommend. The throwing of the InterruptedException clears the interrupted state of the Thread,.. 2016. 1. 7.
[Java] 디렉토리내 일정기간 지난 파일 삭제 출처 : http://fruitdev.tistory.com/13 디렉토리내 일정기간이 지난 파일을 삭제해 보자. 아래는 파일의 마지막 수정시간이 현재로부터 3일이 지난 파일을 삭제하는 예제이다.?12345678910111213141516171819202122232425262728293031323334// Calendar 객체 생성Calendar cal = Calendar.getInstance() ;long todayMil = cal.getTimeInMillis() ; // 현재 시간(밀리 세컨드)long oneDayMil = 24*60*60*1000 ; // 일 단위 Calendar fileCal = Calendar.getInstance() ;Date fileDate = null ; File path =.. 2016. 1. 5.
ScheduleExecutorService 와 Timer를 이용한 일정시간 메소드 실행 ScheduleExecutorService 와 Timer를 이용한 일정시간 메소드 실행예제 Timer는 같은 이름으로 객체를 여러개 만들었을 경우 가장 마지막에 생성한객체는 close()로 종료 할 수 있으나, 나머지 실행중인 객체들은 종료할 수 없다. 반면, ScheduleExecutorService의 경우 객체를 여러개 만들어 실행시키더라도 shutdownNow()를 사용하여 일괄종료 할 수 있다. 구글링 결과 Stack Overflow의 내용을 참조한 결과 확장성이나 여러가지로 ScheduleExecutorService가 좋다고 한다. - ScheduleExecutorService public class ScheduleExecutorServiceEx { private static final Sche.. 2016. 1. 4.
안드로이드 Time Sync 맞추는 방법 안드로이드 내부적인 단말의 값을 가져오려면 TimeZone을 활용 하면 될 것 같다. 참고 사이트1. Demohttp://www.theappguruz.com/blog/android-time-zone-demo 서버에서 타임 정보를 가져와서 활용하려면 NTPSync를 활용한다. 참고 사이트1. https://github.com/Free-Software-for-Android/NTPSync/blob/master/NTPSync/src/main/java/com/commonsware/cwac/wakeful/WakefulIntentService.java 2. http://stackoverflow.com/questions/8049912/how-can-i-get-the-network-time-from-the-automat.. 2015. 12. 22.
안드로이드 해쉬맵, 프래그먼트 http://blog.jdm.kr/197 cafe.daum.net/superdroid 2015. 12. 15.
BufferedReader 에 String값 넣기 How to convert String to InputStream in JavaBy mkyong | August 23, 2010 | Updated : August 29, 2012A simple Java program to convert a String to InputStream, and use BufferedReader to read and display the convertedInputStream.package com.mkyong; import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamRea.. 2015. 12. 14.
Timer 클래스를 이용한 작업 스케쥴링 출처 : http://javacan.tistory.com/28 JDK1.3에 새롭게 추가된 java.util.Timer 클래스를 사용하여 이벤트의 실행을 제어하는 것에 대해서 알아본다. java.util.Timer 클래스와 java.util.TimerTask 클래스 유닉스나 리눅스에서 특정 시간에 어떤 프로세스를 실행시키고자 할 경우에 많이 사용되는 것이 cron 명령어와 at 명령어이다. 이 두 명령어는 임시 파일을 주기적으로 삭제하거나 중요 데이터를 일정 주기로 백업하고자 할 때 많이 사용된다. 윈도우 2000 서버 역시 이와 비슷한 기능을 제공하고 있다. 하지만, 아쉽게도 JDK1.2 까지는 유닉스나 리눅스의 cron 이나 at 명령어와 비슷한 기능을 수행하기 위해서는 개발자가 직접 쓰레드를 이용하.. 2015. 12. 12.
NodeJS 유용한 사이트 http://nodeqa.com/ 2015. 12. 11.
HandleBar JS 알아보기 http://handlebarsjs.com/ Handlebars provides the power necessary to let you build semantic templateseffectively with no frustration.Handlebars is largely compatible with Mustache templates. In most cases it is possible to swap out Mustache with Handlebars and continue using your current templates. Complete details can be found here.InstallationGetting StartedHandlebars templates look like regula.. 2015. 12. 2.
반응형