티스토리 툴바


RSS 표준 날짜 포맷인 "Tue, 27 Dec 2011 12:45:17 +0900" 를 다음("2011-12-27 12:45:17")과 같이 변환한다. 

rss.setPubDate("Tue, 27 Dec 2011 12:45:17 +0900");
 
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat ( "EEE, dd MMM yyyy hh:mm:ss +0900",Locale.ENGLISH );
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat ( "yyyy-MM-dd hh:mm:ss" );
ParsePosition parsePosition = new ParsePosition ( 0 );
Date date = simpleDateFormat1.parse (rss.getPubDate(), parsePosition );
String rssDateTime = simpleDateFormat2.format ( date );

System.out.println(rssDateTime);  //  2011-12-27 12:45:17



 
저작자 표시

'개발팁' 카테고리의 다른 글

RSS 표준 포맷 날짜 변환  (0) 2011/12/27
[자바] 엑셀 xlsx 파일 만들기  (0) 2011/12/12
아파치 logrotate  (0) 2011/12/08
하둡의 기본 Word count 예  (0) 2011/12/07
cluster간 hdfs 복사 방법  (0) 2011/12/05
MYSQL TEXT형의 크기  (0) 2011/12/04
Posted by 엔큐

// 엑셀 생성
XSSFWorkbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet();

// 엑셀에 쓸 데이터 생성
for (int rownum=0; rownum<10; rownum++) {
Row r = sheet.createRow(rownum);
for(int colnum = 0; colnum < 2; colnum++) {
Cell c = r.createCell(colnum);
c.setCellValue("test");
}
}

// 파일로 쓰기
FileOutputStream stream = null;
try {
stream = new FileOutputStream("./test.xlsx");
wb.write(stream);
stream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}catch (IOException e) {
e.printStackTrace();
}



 
저작자 표시

'개발팁' 카테고리의 다른 글

RSS 표준 포맷 날짜 변환  (0) 2011/12/27
[자바] 엑셀 xlsx 파일 만들기  (0) 2011/12/12
아파치 logrotate  (0) 2011/12/08
하둡의 기본 Word count 예  (0) 2011/12/07
cluster간 hdfs 복사 방법  (0) 2011/12/05
MYSQL TEXT형의 크기  (0) 2011/12/04
Posted by 엔큐

아파치 logrotate

개발팁 2011/12/08 12:56
# vi /etc/logrotate.d/apache

# rotate는 1일, size는 300M씩...
/usr/local/apache/logs/access_log* /usr/local/apache/logs/error_log* {
        rotate 1                                   # 1일
        create 0664 root root
        size=300M
        sharedscripts
        postrotate
                /usr/bin/killall -HUP httpd
        endscript
}

$ /etc/init.d/syslog restart
저작자 표시

'개발팁' 카테고리의 다른 글

RSS 표준 포맷 날짜 변환  (0) 2011/12/27
[자바] 엑셀 xlsx 파일 만들기  (0) 2011/12/12
아파치 logrotate  (0) 2011/12/08
하둡의 기본 Word count 예  (0) 2011/12/07
cluster간 hdfs 복사 방법  (0) 2011/12/05
MYSQL TEXT형의 크기  (0) 2011/12/04
Posted by 엔큐