일레인 모건 - 인간은 수생유인원에서 진화했다

|
http://www.ted.com/talks/lang/kor/elaine_morgan_says_we_evolved_from_aquatic_apes.html
And

[ORACLE] 숫자가 포함된 row 찾고자 할때

|
with tabs
as
(
select 'aaa1234' col_nm from dual
union all
select 'bbbbbbb' col_nm from dual
union all
select 'ccc6754' col_nm from dual
union all
select 'ddd09574' col_nm from dual
)
select col_nm, translate(col_nm,'0123456789'||col_nm,'0123456789') get_num from tabs
And

[ORACLE] ORA-01841 발생 케이스 - Cause 이외

|
SQL> select to_char(to_date(' '),'YYYYMMDD') from dual;
select to_char(to_date(' '),'YYYYMMDD') from dual
                       *
ERROR at line 1:
ORA-01841: (full) year must be between -4713 and +9999, and not be 0
Elapsed: 00:00:00.01

에러 메시지에서 보여주는 Cause 외의 사유도 존재할 수 있다는 예일까?
And

WOW 셋팅시 참고사항

|
And

[펌] 남대문 주류 리스트 VER 1.0

|
And

[펌] 백성호 기자의 현문우답 <76> 김연아의 마음 다스리기

|
스포츠

백성호 기자의 현문우답 <76> 김연아의 마음 다스리기 [중앙일보]

2010.03.04 00:45 입력 / 2010.03.04 11:29 수정



“왜 하필 저 아이가 나랑 같은 시대에 태어났을까?”



누구의 말일까요. 동계 올림픽에서 분패한 아사다 마오의 한탄일까요? 아닙니다. 6년 전 아사다 마오를 처음 만난 김연아 선수가 던졌던 말입니다. 2004년 핀란드 헬싱키에서 주니어 그랑프리 파이널이 열릴 때였죠. 김연아는 공식연습 때 너무나 가볍게 점프를 성공시키는, 트리플 악셀도 실패하지 않는 마오를 보며 그렇게 푸념했죠. 그리고 6년이 흘렀습니다. 그 동안 김연아는 더 빠르고, 더 유연한 나무로 훌쩍 성장했죠. 이번 올림픽에선 그런 성장의 차원을 단적으로 엿보게 하는 ‘짤막한 풍경 둘’이 있었습니다.

# 풍경1 : 여자 싱글 피겨스케이팅 쇼트 프로그램에서 김연아는 세계신기록을 세웠죠. 경기 직후 인터뷰를 하더군요. “첫 시작이 좋으니 프리 프로그램에선 부담을 덜지 않겠나?”라는 물음에 대한 답이 예사롭지 않더군요. “부담을 덜 수도 있고, (성적을) 유지해야 한다는 마음에 어려울 수도 있다. 하지만 아직 시간이 있다. 다시 원래대로 돌아가서 새로운 시합을 시작한다는 마음을 갖겠다.” ‘현문우답’은 그 말을 듣고 적잖이 놀랐습니다. “세계신기록 경신이 부담스럽지 않나?”를 묻는 우회적인 물음에 대한 답은 수백 가지가 나올 수 있죠. 그런데 김연아 선수가 꺼내서 답한 카드는 ‘정답’이었습니다. 왜 그럴까요?

#풍경 2 : 쇼트 프로그램에서 뒤진 아사다 마오는 프리 프로그램에서 반격을 꾀했습니다. 마오는 첫 트리플 악셀을 성공시켰죠. 그러나 스케이트를 타는 내내 ‘첫 점프의 성공’을 놓지 못했습니다. 경기 직후 가진 인터뷰에서 마오는 “(첫 점프의 성공) 그 다음부터 긴장하기 시작했다”고 털어놓았습니다. 왜 그럴까요?

김연아 선수의 코치인 브라이언 오서는 이렇게 말했죠. “처음 만났을 때부터 김연아는 바위 속의 다이아몬드였다. 나는 바위를 부수고 다이아몬드를 찾아냈을 뿐이다.” 다이아몬드가 뭔가요? 끝없는 가능성이자 무한한 에너지죠. 피겨 선수들은 피나는 훈련을 통해 그 다이아몬드를 갈고 닦죠. 그리고 대회에 출전하는 겁니다. 김연아도, 아사다 마오도 그렇게 갈고 닦은 ‘내 안의 다이아몬드’를 올림픽에서 원 없이 끄집어내고자 기대를 하고, 기도를 하는 겁니다.

그런데 다이아몬드를 통째로 끄집어내기는 쉽지 않죠. 거기에는 조건이 있습니다. ‘내 안의 다이아몬드’를 끄집어내는 통로가 뚫려 있어야죠. 쇼트 프로그램에서 세계신기록을 경신한 김연아는 얼마나 뿌듯했을까요. 4년간 기다린 금메달의 꿈에 얼마나 설렜을까요. 그날 밤에 잠은 제대로 잤을까요.

그런데 그 ‘뿌듯함’과 ‘설렘’이야말로 다이아몬드의 통로를 막는 적입니다. 왜냐고요? 마음은 접착제이기 때문이죠. 기쁨이 크고, 기대가 크고, 슬픔이 크고, 고통이 클수록 마음은 순식간에 달려가 ‘촤~악!’하고 거기에 달라붙죠. 그냥 접착제가 아니라 초강력 접착제죠. 좀체 떨어지지도 않습니다. 이렇게 달라붙은 마음은 순식간에 장애물이 되고 말죠. 내 안의 다이아몬드를 끄집어내는 에너지의 통로를 막으니까요.

김연아 선수는 그걸 간파하고 있더군요. “다시 원래의 마음으로 돌아가 새로운 시합을 하겠다.” 아무렇지도 않게 내뱉은 한마디에 이미 해법이 들어있었죠. 세상을 삼킬듯한 영예라도 포맷을 시켜야만 새로운 에너지가 샘솟는 법이죠. 반면 아사다 마오는 달랐습니다. 첫 점프를 트리플 악셀로 성공시키고도 거기에 묶이고 말더군요. ‘첫 점프의 성공’에 그의 마음이 ‘촤~악!’하고 달라붙은 거죠. 그리고 떨어지지 않았겠죠. ‘이 성공을 끝까지 이어가야 할 텐데….’ 그래서 마오의 긴장이 시작된 겁니다.

결국 김연아는 기술점수, 예술점수에서만 마오를 앞선 게 아니죠. 마음 굴리는 법, 내 안의 다이아몬드를 끄집어내는 법에서도 마오를 앞섰던 겁니다. 얼음판은 삶의 축소판이죠. 그래서 얼음판의 이치가 세상의 이치, 우주의 이치와 통합니다. 그럼 다음 세계선수권대회의 우승자는 누가 될까요. 금메달의 영예도 ‘툭!’ 내려놓고 달리는 이, 은메달의 분함도 ‘툭!’ 내려놓고 달리는 이가 되지 않을까요. 그때 또 누군가 말하겠죠. “왜 하필 저 아이가 나랑 같은 시대에 태어났을까?”

백성호 기자

And

[김연아 올림픽 챔피언 기념] [HD] Yu-Na Kim El Tango de Roxanne : German Commentary - YouTube

|



[펌] YouTube
And

[김현진 바텐더의 칵테일 이야기]

|
And

[펌] 오라클 Clob 타입 다루기

|
제목 : Re: Clob은 empty_clob()함수를 이용해 초기화 해야 합니다.
글쓴이: 이승배(telarin) 2004/06/21 06:49:20 조회수:376 줄수:8
CLOB형의 데이터들은 별도의 저장공간에 저장되기 때문에..
핸들이 좀 특이합니다.

INSERT INTO test(testcode, content) VALUES('test1', empty_clob());
또는
UPDATE test SET content = test_clob() WHERE testcode = 'test1';

이런식으로요..
제목 : Re: 오라클 Clob 타입 selec시에 데이터가 없을때는 수행되지 않게끔 하시면 됩니다.
글쓴이: 송원만(nitto182) 2004/06/22 13:02:56 조회수:1256 줄수:318
select시에 데이터가 없을때를 대비하여 아래와 같이 if문에서 Reader가 null인지 체크
하여 주시면 될것입니다.

참고로 아래소스는 ClobUtil이라는 별도의 유틸리티 클래스를 이용하고 있는 모습니다.
(특별히 이렇게 분리 시키지 않아도 되지만 많이 사용되는만큼 분리시키시는게 편리
할것입니다.)

또한 아래 참조 소스는 clob data가 여러컬럼일때 작업하는 방법도 함께 예제로 넣었습니다.
많은 참고가 되었으면 합니다.




[ClobUtil클래스 (※전체소스는 첨부파일 참조)]

public class ClobUtil{

...
    public static String getClobOutput(Reader input) throws IOException,Exception{
        return getClobOutput(input, 4096);
    }

    public static String getClobOutput(Reader input, int buffer_size) throws IOException,Exception{

        if(input != null){  // 이부분이 Reader가 null인지 체크하는 부분
            try{
                StringBuffer output = new StringBuffer();
                char[] buffer = new char[buffer_size];
                int byteRead;

                while((byteRead=input.read(buffer, 0, buffer_size)) != -1){
                    output.append(buffer, 0, byteRead);
                }
                input.close();
                return output.toString();
            }catch(Exception e){// Trap SQL and IO errors
                throw new Exception("getClobOutput() Fail !!");    // runtime 에러시 화면에 찍힘.
            }
        }else{
            return "";
        }
    }
/*
            다른방법1 (oracle 권장 (sample sorce중에서))
            // Open a stream to read Clob data
            Reader src = p_clob.getCharacterStream();

            // Holds the Clob data when the Clob stream is being read
            StringBuffer l_suggestions = new StringBuffer();

            // Read from the Clob stream and write to the stringbuffer
            int l_nchars = 0; // Number of characters read
            char[] l_buffer = new char[10];  //  Buffer holding characters being transferred

            while ((l_nchars = l_clobStream.read(l_buffer)) != -1) // Read from Clob
                l_suggestions.append(l_buffer,0,l_nchars); // Write to StringBuffer

            l_clobStream.close();  // Close the Clob input stream

*/

...

}


[특정클래스에서]

import java.sql.*;
import java.io.*;
import java.util.*;
import oracle.sql.*;                // CLOB 때문
import oracle.jdbc.driver.*;        // OracleResultSet...때문
import common.db.DBConnHandler;
import common.utils.ClobUtil;       // CLOB 때문

public class EntpDB {


    // 여러개의 clob data를 insert하는 예제
    public boolean insert(EntpRec entity) throws SQLException,IOException,Exception{

        Connection conn = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer sb = new StringBuffer(300);
        boolean rtn = false;

        try{
            db = new DBConnHandler();
            conn = db.getConnection();
            conn.setAutoCommit(false);
            sb.append(" INSERT INTO TEST_TABLE ");
            sb.append(" (id,class_code,content_1,content_2,content_3,cre_user_id,cre_dt) ");
            sb.append(" VALUES((Select NVL(MAX(id), 0)+1 id FROM TEST_TABLE),?,empty_clob(),empty_clob(),?,sysdate) ");
            pstmt = conn.prepareStatement(sb.toString());
            pstmt.setInt(1, entity.class_code);
            pstmt.setString(2, entity.cre_user_id);

            if(pstmt.executeUpdate()>0){
                pstmt.close();
                sb.setLength(0);
                sb.append(" SELECT content_1,content_2,content_3 FROM TEST_TABLE ");
                sb.append(" WHERE (id=(SELECT NVL(MAX(id), 0) id FROM TEST_TABLE)) ");
                sb.append(" FOR UPDATE");
                pstmt = conn.prepareStatement(sb.toString());
                rs = pstmt.executeQuery();

                while(rs.next()){
                    CLOB clob = ((OracleResultSet)rs).getCLOB(1);
                    Writer writer = clob.getCharacterOutputStream();
                    ClobUtil.writeClob(writer, entity.content_1);

                    clob = null;
                    writer = null;
                    clob = ((OracleResultSet)rs).getCLOB(2);
                    writer = clob.getCharacterOutputStream();
                    ClobUtil.writeClob(writer, entity.content_2);

                    clob = null;
                    writer = null;
                    clob = ((OracleResultSet)rs).getCLOB(3);
                    writer = clob.getCharacterOutputStream();
                    ClobUtil.writeClob(writer, entity.content_3);
                }
/*
                (예전에 직접처리하던방식-불편함)
                ...
                pstmt.close();
                sb.setLength(0);
                sb.append("select bd_body_1,bd_body_2 from board_table where id=? for update");
                pstmt = conn.prepareStatement(sb.toString());
                pstmt.setInt(1, boardRec.getBd_seq);
                rs = pstmt.executeQuery();

                while(rs.next()){
                    CLOB clob = ((OracleResultSet)rs).getCLOB(1);
                    Writer writer = clob.getCharacterOutputStream();
                    Reader src = new CharArrayReader((boardRec.getBd_body_1()).toCharArray());
                    char[] buffer = new char[1024];
                    int read = 0;
                    while( (read = src.read(buffer,0,1024)) != -1){
                        writer.write(buffer, 0, read); // write clob.
                    }
                    src.close();
                    writer.close();

                    clob = null;
                    writer = null;
                    clob = ((OracleResultSet)rs).getCLOB(2);
                    writer = clob.getCharacterOutputStream();
                    Reader src = new CharArrayReader((boardRec.getBd_body_2()).toCharArray());
                    char[] buffer = new char[1024];
                    int read = 0;
                    while( (read = src.read(buffer,0,1024)) != -1){
                        writer.write(buffer, 0, read); // write clob.
                    }
                    src.close();
                    writer.close();
                    ...
                }
*/

                conn.commit();
                rtn = true;

            }else{
                logs.logIt("error","insert 처리(CLOB의 내용 제외)를 하지 못하고 db 에러남.\n"+
                                   " > entity : "+entity.toString()+"\n"+
                                   " > query : "+sb.toString()+"\n");
            }
        }catch(SQLException e){
            logs.logIt("error","insert 처리를 하지 못하고 에러남.\n"+
                               " > entity : "+entity.toString()+"\n"+
                               " > query : "+sb.toString()+"\n", e);
            if(conn != null)	conn.rollback();
            throw e;
        }finally{
            conn.setAutoCommit(true);
            if(rs != null)		rs.close();
            if(pstmt != null)	pstmt.close();
            db.release();
        }
        return rtn;
    }


    // 여러개의 clob data를 select예제
    public EntpRec select(int id) throws SQLException,IOException,Exception{

        Connection conn = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer sb = new StringBuffer(1000);
        EntpRec entity = null;

        try{
            db = new DBConnHandler();
            conn = db.getConnection();
            sb.append(" SELECT id,class_code,cre_user_id,upt_user_id,to_char(cre_dt,'YYYY/MM/DD HH24:MI') cre_dt, ");
            sb.append(" to_char(upt_dt,'YYYY/MM/DD HH24:MI') upt_dt ");
            sb.append(" FROM TEST_TABLE ");
            sb.append(" WHERE (entp_id=? "+where+")");
            pstmt = conn.prepareStatement(sb.toString());
            pstmt.setInt(1, entp_id);
            rs = pstmt.executeQuery();

            if(rs.next()){
                entity = new EntpRec();
                entity.entp_id = rs.getInt("entp_id");
                entity.class_code = rs.getInt("class_code");
                entity.content_1 = ClobUtil.getClobOutput(rs.getCharacterStream("content_1"));
                entity.content_2 = ClobUtil.getClobOutput(rs.getCharacterStream("content_2"));
                entity.content_3 = ClobUtil.getClobOutput(rs.getCharacterStream("content_3"));
                entity.cre_user_id = rs.getString("cre_user_id");
                entity.upt_user_id = rs.getString("upt_user_id");
                entity.cre_dt = rs.getString("cre_dt");
                entity.upt_dt = rs.getString("upt_dt");

                Utility.fixNull(entity);
            }
        }catch(SQLException e){
            logs.logIt("error","[특정 pk에 따른 한 레코드 select하지 못하고 에러남.\n"+
                        " > id : "+id+"\n"+
                        " > query : "+sb.toString()+"\n", e);
        }finally{
            if(rs != null)        rs.close();
            if(pstmt != null)    pstmt.close();
            db.release();
        }
        return entity;
    }



    // 여러개의 clob data를 update하는 예제
    public boolean update(EntpRec entity) throws SQLException,IOException,Exception{

        Connection conn = null;
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        StringBuffer sb = new StringBuffer(1000);
        boolean rtn = false;

        try{
            db = new DBConnHandler();
            conn = db.getConnection();
            conn.setAutoCommit(false);
            sb.append(" UPDATE TEST_TABLE");
            sb.append(" SET class_code=?,content_1=empty_clob(),content_2=empty_clob(),content_3=empty_clob(), ");          
            sb.append(" upt_user_id=?,upt_dt=sysdate ");
            sb.append(" WHERE (id=?)");
            pstmt = conn.prepareStatement(sb.toString());

            pstmt.setInt(1, entity.class_code);
            pstmt.setString(51, entity.upt_user_id);
            pstmt.setInt(52, entity.id);

            if(pstmt.executeUpdate()>0){
                pstmt.close();
                sb.setLength(0);
                sb.append(" SELECT content_1,content_2,content_3 FROM TEST_TABLE ");
                sb.append(" WHERE (id=?)");
                sb.append(" FOR UPDATE");
                pstmt = conn.prepareStatement(sb.toString());
                pstmt.setInt(1, entity.id);
                rs = pstmt.executeQuery();

                while(rs.next()){
                    CLOB clob = ((OracleResultSet)rs).getCLOB(1);
                    Writer writer = clob.getCharacterOutputStream();
                    ClobUtil.writeClob(writer, entity.content_1);

                    clob = null;
                    writer = null;
                    clob = ((OracleResultSet)rs).getCLOB(2);
                    writer = clob.getCharacterOutputStream();
                    ClobUtil.writeClob(writer, entity.content_2);

                    clob = null;
                    writer = null;
                    clob = ((OracleResultSet)rs).getCLOB(3);
                    writer = clob.getCharacterOutputStream();
                    ClobUtil.writeClob(writer, entity.content_3);
                }

                conn.commit();
                rtn = true;

            }else{
                logs.logIt("error","[update 처리(CLOB의 내용 제외)를 하지 못하고 db 에러남.\n"+
                            " > entity : "+entity.toString()+"\n"+
                            " > query : "+sb.toString()+"\n");
            }
        }catch(SQLException e){
            logs.logIt("error","[update 처리를 하지 못하고 에러남.\n"+
                        " > entity : "+entity.toString()+"\n"+
                        " > query : "+sb.toString()+"\n", e);
            if(conn != null)    conn.rollback();
            throw e;
        }finally{
            conn.setAutoCommit(true);
            if(rs != null)       rs.close();
            if(pstmt != null)    pstmt.close();
            db.release();
        }
        return rtn;
    }
원문 발췌 :
http://javaservice.net/~java/bbs/read.cgi?m=qna&b=qna2&c=r_p_p&n=1087876976

[펌] http://www.rainny.pe.kr/27
And

[펌] /dev/null 2>&1 의미

|
http://www.ntech.in/v2/bbs/board.php?bo_table=2_solaris&wr_id=149&page

/dev/null 2>&1

만약...
nohup ${DIR}/bin/scheduler scheduler.ini >scheduler.out 2>&1 &
으로 한다면은... 에러 메시지(stderr)은 scheduler.out 파일에 에러 메시지를 출력하지 않고 바고
콘솔에다가 뿌려 줍니다.
이건 stderr(2)이 버퍼를 이용하지 않고 에러가 생기는 즉시 바로 출력을 해주기
때문입니다.
이렇게 2>&1 리다이렉션을 시켜 줌으로 인해 stderr > stdout 으로 출력이 되고
scheduler.out 파일에 에러 메시지가 저장이 되게 되는 것입니다.

-------------------------------------------------------------------------
2 >&1 의 의미.

n >&m: 표준출력과 표준에러를 서로 바꾸기.
0, 1, 2는 각각 표준입력, 표준출력, 그리고 표준에러를 의미합니다.

2>&1의 의미는 표준 출력의 전달되는 곳으로 표준에러를 전달하라라는
의미입니다.
이것은 Bourne쉘 연산자이기 때문에 csh에서는 사용할 수 없답니다.

-------------------------------------------------------------------------

 if ( ls -l $0 | grep $LOGNAME >/dev/null )
    여기서 /dev/null로 리다이렉션하는건 무었을 의미하나요?

표준출력을 버리라는 뜻입니다. 이 부분에서 grep 명령을 사용하는 것은
걸리는 것이 어떻게 생겼는지 보려는 것이 아니라 걸리는 것이 있는지
없는지 알아내어 별도의 작업을 하려는 것이고 화면에 뭔가가 "뿌려지는"
것은 막자는 것이죠.

이런 용도로 grep을 사용할 때, -q, -s 등의 옵션을 사용할 수 있습니다.
자세한 내용은 man grep.

 nohup ${DIR}/bin/scheduler scheduler.ini >scheduler.out 2>&1 &

 여기서 2>&1 & 은 무얼 의미하나요?

앞부분의 "2>&1"은 표준오류 스트림을 표준출력으로 돌리라는(?) 뜻입니다.
그냥 ">"를 기준으로 보면 "2"를 "&1"로 보내라는 뜻인데, 여기서 "2"는
표준오류 스트림을 나타내는 번호이고 "1"은 표준출력을 나타내는 번호입니다.
마지막 "&" 는 백그라운드로 실행하라는 뜻이구요. 

>/dev/null 은 출력을 /dev/null로 하겠다는 소리입니다.
즉 출력이 안보이겠죠.

>&1이 의미하는 것은 출력을 표준 출력에다가 하겠다는 소리입니다.
<&0은 당연히 표준 입력이 되겠죠.
-------------------------------------------------------------------------
이렇게 해서 열흘 이상 지난 파일들을 자동으로 삭제하는 셸 스크립트를 완성했습니다.
정확히 말하자면, 최근 열 개 까지의 날짜 디렉토리를 남겨 두고 나머지를 삭제하는 거겠군요.
이제 휴지통에 신경을 덜 써도 될 것 같습니다.
#!/bin/sh

cd ~/.Trash/
mytrash=`date +%F`

mkdir ${mytrash} >/dev/null 2>&1;
mv * ${mytrash} >/dev/null 2>&1;
mv ${mytrash}/20??-??-?? . >/dev/null 2>&1;

for dir in `ls -1d 20??-??-?? | sort -r | tail -n +11`
do
        rm -rf "${dir}"
done

And
prev | 1 | ··· | 4 | 5 | 6 | 7 | 8 | 9 | 10 | ··· | 12 | next