본문 바로가기

Programming/과거포스팅

(127)
자바 날짜 포멧 변환 (java String date format change) 날짜 포멧 변환rss 기사를 파싱하는중 날짜 포멧 변경할 일이 생겼다. 그래서 메서드를 만든 메서드이다.package test; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class HelloMain { public static void main(String[] args) { String fromDate = "Tue, 23 Dec 2014 12:35:00 +0900"; String fromDateFormat = "EEE, d MMM yyyy HH:mm:ss Z"; String changeFormat = "yyyy-mm-dd HH:..
Tomcat DNS(톰캣 도메인 설정) DNS사이트를 이용해 공식 도메인을 등록후 Tomcat 7.0\conf\server.xml 파일에 다음을 추가해주면 된다.
주소를 좌표로 (google maps api) address to postion 구글 api를 이용하여 주소를 좌표로 변환하는 메서드이다. 우선 메이븐에 json 라이브러리를 추가한다 com.googlecode.json-simple json-simple 1.1.1 json으로 받아서 double 배열에 담아서 리턴한다. public static double [] getAdressToPosition(String korAddress) { String urlStr; HttpURLConnection connection = null; BufferedReader reader = null; StringBuilder stringBuilder; double position[]; try { urlStr = "http://maps.googleapis.com/maps/api/geocode/json?sen..
poi excel geCellValue public static String getExcelCulumValue(Cell cell) { String value = ""; try { switch (cell.getCellType()) { case Cell.CELL_TYPE_FORMULA: value = cell.getCellFormula(); break; case Cell.CELL_TYPE_NUMERIC: value = "" + (int)cell.getNumericCellValue(); break; case Cell.CELL_TYPE_STRING: value = "" + cell.getStringCellValue(); break; case Cell.CELL_TYPE_BLANK: value = ""; break; case Cell.CELL_TYPE_..
jquery tr 아래위로 이동 (jquery tr up down) 코드에 대한 자세한 설명은 생략합니다. 체크가 되어있는 행을 위아래로 움직이는 소스입니다. TR UP DOWN $(document).ready(function() { $('#down').click(function(){ var checkedCount = $("input[name=id]:checked").length; if (checkedCount > 1 ) { alert("이동하려는 행을 하나만 선택해주세요") } else if(checkedCount == 0) { alert("이동 하려는 행을 선택해주세요") } else { var element = $("input[name=id]:checked").parent().parent(); moveRowDown(element) } }); $('#up').clic..
radio 버튼 체크된 값 가져오기 name이 run_yn인 radio 버튼의 선택한 값을 가져온다. var run_yn = $(':radio[name="run_yn"]:checked').val(); alert(run_yn)
디자인패턴 템플릿 메소드 패턴 (template method pattern) : 슈퍼클래스에 기본적인 로직의 흐름을 만들고 그 기능의 일부를 추상메소드나 오버라이딩이 가능한 protected 메소드 등으로 만든위 서브 클래스에서 이런 메소드를 필요에 맞게 구현해서 사용하도록 하는 방법 변하지 않은 기능은 슈퍼클래스에 만들어두고 자주 변경되며 확장할 기능은 서브클래스에서 만들도록 한다. 팩토리 메소드 패턴(factroy method pattern) : 서브 클래스에서 구체적인 오브젝트 생성 방법을 결정하게 하는 것 템플릿 메소드 패턴과 비슷한 구조이다.
자바 정규식과 일치하는 문자열 추출 Pattern pattern = Pattern.compile("(?