'작업노트'에 해당되는 글 100건

  1. 2009.03.12 [SOLR] CustomClobTransformer
  2. 2009.03.11 NoClassDefFoundError
  3. 2009.03.11 WOA - Web Oriented Architecture 관련 글
  4. 2009.03.02 CSV파일
  5. 2009.02.24 [검색]Solr 관련
  6. 2009.01.15 [펌] 2년차 개발자가 알아야 할 기본 지식
  7. 2009.01.09 cronExpress
  8. 2008.12.26 파이어폭스(firefox)에서의 새로고침 1
  9. 2008.12.15 아파치 1.3 + 톰캣 5.0 연동
  10. 2008.11.19 ActiveX가 있는 페이지에서는 레이어 처리가 불가능하다.

[SOLR] CustomClobTransformer

|
SOLR에서 ClobTransformer를 1.4부터 지원해준다고 한다.
덕분에 오라클의 CLOB타입을 인덱싱하려면 커스텀으로 트랜스포머를 만들어야 한다.
그래서 만들었다.
허접하게 나마.

====================================================================================

import java.io.BufferedReader;
import java.util.List;
import java.util.Map;

import oracle.sql.CLOB;

import org.apache.solr.handler.dataimport.Context;
import org.apache.solr.handler.dataimport.Transformer;

/**
 * CLOB to String 변환을 위한 커스텀 트랜스 포머 
 *
 * @since 2009. 3. 12.
 */
public class CustomClobTransformer extends Transformer {

    /* (non-Javadoc)
     * @see org.apache.solr.handler.dataimport.Transformer#transformRow(java.util.Map, org.apache.solr.handler.dataimport.Context)
     */
    public Map<String, Object> transformRow(Map<String, Object> row, Context context) {
        List<Map<String, String>> fields = context.getAllEntityFields();
        
        for (Map<String, String> field : fields) {
            String clob = field.get("clob");
            if ("true".equals(clob)) {
                String columnName = field.get("column");

                CLOB value = (CLOB)row.get(columnName);
                
                StringBuffer strOut = new StringBuffer();

                String str = "";
                try {
                    BufferedReader br = new BufferedReader(value.getCharacterStream());
    
                    while ((str = br.readLine()) != null) {
                        strOut.append(str);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                
                String stringValue = strOut.toString();
                
                row.put(columnName, stringValue);
            }            
        }
        
        return row;
    }
}
And

NoClassDefFoundError

|
And

WOA - Web Oriented Architecture 관련 글

|
And

CSV파일

|

출처 : http://narrowway.tistory.com/43


CSV파일

Comma Separated Value의 약자로,
데이타를 컴머(,)단위로 잘라서 나열한 파일 형태.

컴머단위로 잘라져 있으므로, 텍스트 파일로도 읽을수 있지만,
엑셀파일로도 바로 읽을수 있다는 장점이 있어서
많은 데이타 관련 소프트웨어에서 사용되고 있다.

1. 자바에서의 구현

    // 파일 다운로드 형식 지정
    res.setContentType("application/octet-stream;charset=Shift_JIS");
    res.setHeader("Content-Disposition","attachment; filename="+selected_Table+"_"+date+".csv");
    PrintWriter out=res.getWriter();

    // 데이타를 DB로 부터 읽어서 CSV로 만드는 과정
      query = "select * from " + selected_Table;
     
      PreparedStatement pstmt = con.prepareStatement(query);
      rs = pstmt.executeQuery();

      String strData = "";
      while(rs.next()){
       
        for(int i=0 ; i < selectedFieldList.length ; i++){
     strData = rs.getString(Integer.parseInt(selectedFieldList[i])+1);
     if(strData==null){strData="";}
      out.print( new String( strData.getBytes("8859_1"),"Shift_JIS") );
            out.print(i<selectedFieldList.length ? "," : "");
        }
        out.print(System.getProperty("line.separator"));
      }

      위와같이 컴마와 System.getProperty("line.separator")를 이용해서 제어가 가능하고,
      문자열처리과정을 일본어의 경우 new String( strData.getBytes("8859_1"),"Shift_JIS")
      처럼 해결해 주면 된다.

2. 주의할 점

     CSV파일의 가장 주의점이라 한다면 데이타 자체에 컴마나 줄바꿈 표시가 들어가 있는 경우로,
     이때는 의도하지 않는 데이타상의 구분이 생겨버리므로,
     향후 엑셀로 읽으려 할때에는 전체 테이블이 깨져버린다.
    
      private String checkDataFormat(String data){

           String returnVal = data;
   
           returnVal = returnVal.replaceAll(","," ");
           returnVal = returnVal.replaceAll("\n"," ");
           returnVal = returnVal.replaceAll("\r"," ");
           returnVal = returnVal.replaceAll("\r\n"," ");
   
           return returnVal;
     }

     와 같은 방법으로 데이타 치환을 해주어야 한다. 

And

[검색]Solr 관련

|
And

[펌] 2년차 개발자가 알아야 할 기본 지식

|


=====================================================================

1. 서버단 기술

- 자바 프로그래밍
. 객체 지향 프로그래밍 기본 이해(추상화, 다형성, 캡슐화)
. 중요한 자바 API 활용 가능(Collection API, Reflection API, generic, annotation)
. 많이 쓰이는 기본 디자인 패턴 이해(VO 패턴, MVC 패턴, FILTER 패턴 및 OBSERVER 패턴)

- Servlet/JSP
. 브라우저와 서버간의 통신에서 HttpServletRequest/Response 객체 생명 주기와 중요 메소드 이해
. 웹 어플리케이션 구조 및 배포 방법의 이해
  (filter, listener, Servlet 배포 방법 및 프로그래밍 이해 --> web.xml의 이해)
. JSTL과 EL 이해(JSP 1.2와 2.0차이점 이해) 및 Custom Tag handler 작성 가능

2. 데이터베이스단 기술

- Database
. 관계형 데이터 베이스 논리/물리 모델링 설계 가능(ERD 작성 가능)
. 적당한 수준의 정규화/역정규화를 통한 기본적 성능 향상 방법의 이해
. 적절한 인덱싱과 인라인 쿼리의 사용을 통한 기본 SQL Tunning 가능(plan 사용)
. Hibernate와 iBatis등의 OR-Mapping 프레임웍의 등장 배경과 사용 이유에 대한 이해

3. 화면단 기술

- Ajax/HTML/CSS/DOM/JavaScript
. JSON을 이용한 기본적 AJAX 프로그래밍 가능
. XHTML과 HTML의 차이점과 등장배경을 이해하고 코딩 가능 
. DOM API를 이용해서 동적인 화면을 표현/제어

4. 광범위하게 쓰이는 프레임워크 사용법 기본 이해

- 오픈 프레임워크 사용 방법의 이해(개발자 수준에서)
  . Struts : 전형적인 MVC패턴으로 구성된 스트럿츠의 구조를 파악하고 간단한 게시판을 코딩할 수 있는 수준
  . Spring : 스프링 혹은 EJB 컨테이너가 빈을 관리함으로써(Ioc) 얻는 잇점과 이를 통해 이루어지는
             다양한 엔터프라이즈급 서비스(AOP 등)등을 이해하고 사용할 수 있는 수준   
  

5. 최소 토익 750 정도 수준의 영어 실력(각종 API의 원활한 참조를 위해)
   - 최소 750점 이상 의 토익 실력(Reading 400점 이상 --> 기본적 독해가 가능한 최소 실력)
   - A4지 한장분량의 (영자신문수준의) 영문을 10분 이내로 읽고 90% 이상 이해 가능


* 하드정리하다가 2년전에 이곳에 올렸던 게시물을 발견해 약간 수정후 다시 올립니다. (이전껀 지워졌더군요)

* 다시 생각해 봐도 2년차 웹 개발자 수준이라면 반드시 알아야 할 내용만 나열했습니다.
  솔직한 심정으로, "실무에 투입할 신입개발자" 스펙으로서 알아야할 지식이라 생각됩니다.


============================================================================

And

cronExpress

|

For those unfamiliar with "cron", this means being able to create a firing schedule such as: "At 8:00am every Monday through Friday" or "At 1:30am every last Friday of the month".

A "Cron-Expression" is a string comprised of 6 or 7 fields separated by white space. The 6 mandatory and 1 optional fields are as follows:

Field Name   Allowed Values   Allowed Special Characters
Seconds   0-59   , - * /
Minutes   0-59   , - * /
Hours   0-23   , - * /
Day-of-month   1-31   , - * ? / L W C
Month   1-12 or JAN-DEC   , - * /
Day-of-Week   1-7 or SUN-SAT   , - * ? / L C #
Year (Optional)   empty, 1970-2099   , - * /

The '*' character is used to specify all values. For example, "*" in the minute field means "every minute".

The '?' character is allowed for the day-of-month and day-of-week fields. It is used to specify 'no specific value'. This is useful when you need to specify something in one of the two fileds, but not the other. See the examples below for clarification.

The '-' character is used to specify ranges For example "10-12" in the hour field means "the hours 10, 11 and 12".

The ',' character is used to specify additional values. For example "MON,WED,FRI" in the day-of-week field means "the days Monday, Wednesday, and Friday".

The '/' character is used to specify increments. For example "0/15" in the seconds field means "the seconds 0, 15, 30, and 45". And "5/15" in the seconds field means "the seconds 5, 20, 35, and 50". You can also specify '/' after the '*' character - in this case '*' is equivalent to having '0' before the '/'.

The 'L' character is allowed for the day-of-month and day-of-week fields. This character is short-hand for "last", but it has different meaning in each of the two fields. For example, the value "L" in the day-of-month field means "the last day of the month" - day 31 for January, day 28 for February on non-leap years. If used in the day-of-week field by itself, it simply means "7" or "SAT". But if used in the day-of-week field after another value, it means "the last xxx day of the month" - for example "6L" means "the last friday of the month". When using the 'L' option, it is important not to specify lists, or ranges of values, as you'll get confusing results.

The 'W' character is allowed for the day-of-month field. This character is used to specify the weekday (Monday-Friday) nearest the given day. As an example, if you were to specify "15W" as the value for the day-of-month field, the meaning is: "the nearest weekday to the 15th of the month". So if the 15th is a Saturday, the trigger will fire on Friday the 14th. If the 15th is a Sunday, the trigger will fire on Monday the 16th. If the 15th is a Tuesday, then it will fire on Tuesday the 15th. However if you specify "1W" as the value for day-of-month, and the 1st is a Saturday, the trigger will fire on Monday the 3rd, as it will not 'jump' over the boundary of a month's days. The 'W' character can only be specified when the day-of-month is a single day, not a range or list of days.

The 'L' and 'W' characters can also be combined for the day-of-month expression to yield 'LW', which translates to "last weekday of the month".

The '#' character is allowed for the day-of-week field. This character is used to specify "the nth" XXX day of the month. For example, the value of "6#3" in the day-of-week field means the third Friday of the month (day 6 = Friday and "#3" = the 3rd one in the month). Other examples: "2#1" = the first Monday of the month and "4#5" = the fifth Wednesday of the month. Note that if you specify "#5" and there is not 5 of the given day-of-week in the month, then no firing will occur that month.

The 'C' character is allowed for the day-of-month and day-of-week fields. This character is short-hand for "calendar". This means values are calculated against the associated calendar, if any. If no calendar is associated, then it is equivalent to having an all-inclusive calendar. A value of "5C" in the day-of-month field means "the first day included by the calendar on or after the 5th". A value of "1C" in the day-of-week field means "the first day included by the calendar on or after sunday".

The legal characters and the names of months and days of the week are not case sensitive.

Here are some full examples:

Expression   Meaning
"0 0 12 * * ?"   Fire at 12pm (noon) every day
"0 15 10 ? * *"   Fire at 10:15am every day
"0 15 10 * * ?"   Fire at 10:15am every day
"0 15 10 * * ? *"   Fire at 10:15am every day
"0 15 10 * * ? 2005"   Fire at 10:15am every day during the year 2005
"0 * 14 * * ?"   Fire every minute starting at 2pm and ending at 2:59pm, every day
"0 0/5 14 * * ?"   Fire every 5 minutes starting at 2pm and ending at 2:55pm, every day
"0 0/5 14,18 * * ?"   Fire every 5 minutes starting at 2pm and ending at 2:55pm, AND fire every 5 minutes starting at 6pm and ending at 6:55pm, every day
"0 0-5 14 * * ?"   Fire every minute starting at 2pm and ending at 2:05pm, every day
"0 10,44 14 ? 3 WED"   Fire at 2:10pm and at 2:44pm every Wednesday in the month of March.
"0 15 10 ? * MON-FRI"   Fire at 10:15am every Monday, Tuesday, Wednesday, Thursday and Friday
"0 15 10 15 * ?"   Fire at 10:15am on the 15th day of every month
"0 15 10 L * ?"   Fire at 10:15am on the last day of every month
"0 15 10 ? * 6L"   Fire at 10:15am on the last Friday of every month
"0 15 10 ? * 6L"   Fire at 10:15am on the last Friday of every month
"0 15 10 ? * 6L 2002-2005"   Fire at 10:15am on every last friday of every month during the years 2002, 2003, 2004 and 2005
"0 15 10 ? * 6#3"   Fire at 10:15am on the third Friday of every month

Pay attention to the effects of '?' and '*' in the day-of-week and day-of-month fields! 

And

파이어폭스(firefox)에서의 새로고침

|
Firefox에서 새로 고침(Reload)을 할 수 있는 방법은 두 가지이다.

하나는 일반적인 새로 고침(단축키: Ctrl+R 또는 F5) 이고,

또 하나는 캐시를 무시한 완전히 새로 고침(단축키: Ctrl+Shift+R 또는 Ctrl+F5) 이다.

파폭으로 개발하다보면,

그냥 새로고침을 해도 수정한 내용이 반영되서 나오질 않아서 

코드에 문제가 있는건가.....라며 여러번 속게 된다 -_-;

새로고침을 Ctrl+F5로 하는 버릇을 들여야겠다.


And

아파치 1.3 + 톰캣 5.0 연동

|
http://wwww.okjsp.pe.kr/seq/29151

유의할점은..
아파치 설치시
# --enable-module=so 를 해줘야 한다.

안그러면, 아파치를 구동할때 에러가 난다.



또한, 톰캣이 깔려있는 
/home/유저명 디렉토리의 퍼미션이 711 이어야 한다는 점
# chmod 711 [디렉토리명] 으로 퍼미션을 수정해야 한다.

안그러면 페이지 접속시에 


요런 메시지가 뜬다.
And

ActiveX가 있는 페이지에서는 레이어 처리가 불가능하다.

|
And
prev | 1 | 2 | 3 | 4 | 5 | 6 | ··· | 10 | next