제갈장비
dojeun.egloos.com
이글루스 | 로그인

라면 한그릇 드세요.. ㅋㅋ
by 제갈장비
카테고리
전체
제갈장비-Linux
제갈장비-TOMCAT
제갈장비-JAVA
--------------------
문서-Linux
문서-Powerbuilder
문서-JAVA
문서-ASP
문서-하드웨어
문서-EDPS
문서-MSSQL
--------------------
TIP-JAVA
TIP-Perl
TIP-ASP
TIP-Powerbuilder 01
TIP-Javascript
TIP-Excel
TIP-XML
TIP-MSAccess
TIP-PostgreSql
TIP-Windows
TIP-Linux
TIP-HTML
TIP-TOMCAT
--------------------
ETC
Secret
Util-Japan
미분류
최근 등록된 덧글
좋은글 퍼가겠습니다.
by 정의진 at 09/29
이제야 봤습니다. iText..
by 제갈장비 at 08/09
정말 캄솨 합니다. 이렇..
by 윤상봉 at 07/21
내 라이브러리에 150편의..
by 서광열 at 05/01
올려주신 iTextAsian.ja..
by 김병건 at 04/01
소중한글 잘 보았습니다...
by datadirect at 03/12
많은 도움이 되었습니다,..
by 서영아빠 at 02/21
좋은 정보 참고 하고자,..
by 雨中傘步 at 11/30
좋은 정보 감사합니다.
by 최환석 at 11/07
좋은 정보 감사드립니다...
by yru at 11/02
이글루 파인더
Powered by egloos
rss

skin by 이글루스
2008년 08월 08일
일본어 운영체제에서 Opera와 Firefox를 사용할 때 한글입력에서...
지금 일본어 버전 Windows2000 에서
Firefox 3.0.1로 이 글을 작성하고 있는데
Opera 9.51에선 한글입력에 문제가 있다.
Opera에선 한글입력 후 띄어쓰기를 하려고 스페이스바를 누르면
직전에 입력했던 한글이 다시 나타나는 문제가 있다.

한글버전에선 문제가 없는지....
# by 제갈장비 | 2008/08/08 00:07 | TIP-Windows | 트랙백 | 덧글(0)
2006년 11월 10일
ASP참고 페이지 모으기
ASP, VBScript에서 자신만의 클래스(Class) 만드는 방법
http://korea.internet.com/channel/content.asp?nid=14820&cid=185#start

ASP,ASP.NET & Script
http://www.egocube.pe.kr/asp_main.asp

ASP 공부하지 않으련
http://ven.kangnam.ac.kr/software/asp/

http://www.superuser.co.kr/asp/index.htm
# by 제갈장비 | 2006/11/10 10:37 | TIP-ASP | 트랙백 | 덧글(0)
2006년 10월 27일
Log4J

http://kwon37xi.egloos.com/2176487

http://www.50001.com/language/javaside/eyjin/2-2/8-1.html

http://www.php.pe.kr/java_main/tnt/etc/log4j_config.html

여러파일에 로그를 남기는 방법에 대하여

log4j 에서 struts 관련 로그 끄기

http://blog.naver.com/loverobin/60026805373

# by 제갈장비 | 2006/10/27 11:01 | TIP-JAVA | 트랙백 | 덧글(0)
2006년 10월 23일
[펌]톰캣에서 log4j 실행시 에러 바로 잡기
출처 : http://cafe.naver.com/devmaster.cafe?iframe_url=/ArticleRead.nhn%3Farticleid=30


일반적으로 웹 문서를 찾아보면 log4j-1.2.13.jar를 클래스 패스에 추가 시킨 후

/WEB-INF/classes아래 log4j.properties파일을 넣으면 간단하게 실행이 된다고 써 있다.

 

그러나 톰캣을 실행 시킬 경우 아래와 같은 문구가 뜨면서 로깅이 안되는 경우가 자주 발생한다.

 

log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester).
log4j:WARN Please initialize the log4j system properly.

 

 

이것은 log4j.properties를 찾지 못해서 초기화가 안되어 나는 메시지이다.

물론 아래와 같이 콘솔에만 출력하는 경우에는 별로 문제 될 것이 없다.

 

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

import org.apache.log4j.Logger; 
import org.apache.log4j.BasicConfigurator; 
public class SimpleLog { 
// Logger 클래스의 인스턴스를 받아온다. 
 static Logger logger = Logger.getLogger(SimpleLog.class); 
 public SimpleLog() {} 
 public static void main(String[] args) { 
 /* 콘솔로 로그 출력 위한 간단한 설정, 이 설정이 없다면 경고 메세지가 출력되면서 실행이 중단된다.*/ 
 BasicConfigurator.configure(); 
 logger.debug("Hello log4j."); 
 logger.info("Hello log4j."); 
 logger.warn("Hello log4j."); 
 logger.error("Hello log4j."); 
 logger.fatal("Hello log4j."); 
 //loger.log( Level.DEBUG , "debug") 와 동일하다. 
 } 
} 

 

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

그러나 파일에 출력하면 서 콘솔에 출력하려면 문제가 발생한다.

간단하게 해결하는 방법은 properties파일을 톰캣이 실행되는 /bin 아래 두는 것이다.

 

그러나 좀더 우아하게 해결하려면 초기화 서블릿을 만들면 된다.

 

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

 

package com.foo;

 

import org.apache.log4j.PropertyConfigurator;


import javax.servlet.http.HttpServlet;


import javax.servlet.http.HttpServletRequest;


import javax.servlet.http.HttpServletResponse;


import java.io.PrintWriter;


import java.io.IOException;

 

 

public class Log4jInit extends HttpServlet {

 

  public  void init() {


     String prefix =  getServletContext().getRealPath("/");


     String file = getInitParameter("log4j-init-file");


     // if the log4j-init-file is not set, then no point in trying


      if(file != null) {


       PropertyConfigurator.configure(prefix+file);


      }


  }

 

  public  void doGet(HttpServletRequest req, HttpServletResponse res) {


  }


}

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

그리고 아래 내용을 web.xml에 추가 시킨다.

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

 

 <servlet>
     <servlet-name>log4j-init</servlet-name>
     <servlet-class>com.foo.Log4jInit</servlet-class>

     <init-param>
       <param-name>log4j-init-file</param-name>
       <param-value>WEB-INF/classes/log4j.properties</param-value>
     </init-param>

     <load-on-startup>1</load-on-startup>
 </servlet>


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

 

 

 

 

그리고 다음과 같이 간단하 해 주면 파일과 콘솔에 떨어지는 로그를 볼 수 있다.

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

 

import org.apache.log4j.Logger;

public class CBselectordertot {

 

    private static Logger logger = Logger.getLogger(ip001Impl.class);

 

    public ipcdOut[] getSelectIpcd(String kind,String wherecond){

        ......

        ......

        logger.info("getSelect_ipcd  query = "+query);

        ........

 

        ...........

    }

}

 

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

 

 

 

또 하나의 경우...

코바 서버 같은 것을 구동 시킬경우 로깅을 하기 위해서는 다음과 같이 JVM args를 넣어줘야 한다.(톰캣과는 별개로)

 

**vizibroker에서 코바 서버구동 예제

vbj -Dlog4j.configuration=file:d:\ipams\WEB-INF\classes\log4j.properties ip002Server

 

 

properties예제는 파일에 첨부 했다.

첨부파일 : log4j.properties

원하는 디렉토리에 떨어뜨리는 것인데 이대로 사용해도 훌륭하다.

# by 제갈장비 | 2006/10/23 18:30 | TIP-TOMCAT | 덧글(0)
2006년 10월 19일
무료 DBMS SQL Server Express

출처 : http://www.zdnet.co.kr/builder/dev/dotnet/0,39031607,39142067,00.htm

무료 DBMS SQL Server Express

노규남(IT 테크라이터)   2005/12/05

지난 회에 이어 VS Express의 구성요소들에 대해서 알아보는 시간을 한주 더 갖도록 하자. 이번 주에 살펴볼 구성요소는 SQL Server Express이다. 이미 잘 알려져 있지만 모르는 사람들을 위해서 부연하자면 이 패키지는 MSDE(Microsoft Desktop Engine)이라고 하는, MS가 이전에 배포한 무료 DBMS의 후신에 해당하는 것이다.

실제 필드에서 프로젝트를 하다보면 Database를 사용하지 않는 경우가 오히려 드물 정도로 DBMS는 개발의 필수요소라 할 수 있는데 최근 DBMS의 기능이 많이 발전한 것은 사실이지만 그 가격이나 덩치 면에서 적잖게 부담되는 면도 없지 않다. 리눅스를 대표로 하는 오픈소스 진영에는 MySQL, PostgreSQL등의 무료 DBMS가 여럿 있었지만 윈도에서만 개발하던 프로그래머라면 이런 DBMS에 접근하기도 쉽지 않았다.

그래서 MSDE가 무료로 배포되기 전에는 비싼 DBMS 대신 Access의 MDB파일을 파일 데이터베이스로 사용했던 적도 있었다. 그러나 MDB는 쓰고 지우기를 반복하다보면 용량이 엄청나게 늘어나는 문제점이 있었고, 파일이 굉장히 잘 깨진다는 단점이 있었기 때문에 관리에 대해 충분한 지식을 갖지 않은 사용자들에게는 어려웠다.

이런 상황을 타개하기 위해 등장한 MSDE는 SQL Server 7과 동일한 엔진을 사용하되 GUI로 구동되는 관리용 애플리케이션과 분석도구들을 빼고 용량에 제한을 둔 버전이었는데 소규모의 사이트나 SI 프로젝트를 중심으로 대단한 인기를 얻었다. 또한 SQL Server와 같은 엔진을 사용한다는 호환성면에서의 잇점과 무료라는 매력 때문에 아직도 많은 사이트에서 널리 사용되고 있는 중이다. 그러나 VS2005와 같이 발표된 SQL Server Express는 이 MSDE보다도 한 수 위라는 것이 필자의 평가이다. 그러면서도 똑같이 무료이다.

설치하기
여타 VS Express의 컴포넌트와 마찬가지로 MS의 VS Express사이트에서 다운로드 후 설치한다. 다른 점이 있다면 VS Express는 향후 1년간 다운로드 받는 사용자에 한해 무료이지만 SQL Server Express는 영구히 무료로 배포하게 되어 있다는 것이다. 그간 무료 DBMS의 대명사처럼 여겨졌던 MySQL도 최근 좀 헛갈리는 라이선스 프로그램을 내놓고 대대적으로 상용화할 속내를 비치고 있는 상황을 고려할 때 이런 MS의 정책은 크게 반길만하다.

본문에서 설명하겠지만 소규모~중규모의 사이트라면 SQL Server Express는 충분히 상용화 가능한 패키지일 뿐만 아니라 설치의 편의성, 가벼움, 무료라는 장점을 생각하면 오라클이나 SQL Server 2005의 정품보다 오히려 나은 선택일 수 있다. 이 패키지가 무료이며 기능제한이 있는 Express 에디션임에도 불구하고 상용패키지와 비교하는 것은 그만큼 강력하고 사용자의 요구를 커버할 수 있는 범위가 넓기 때문이다. 재배포도 가능한데 이때는 MS에서 제안하는 Go-Live 라이센스에 동의해야 한다. Go-Live 라이센스에 대해서는 다음 링크를 참조하자.

http://www.microsoft.com/korea/msdn/vs2005/golive/

SQL Server Express의 패키지 용량은 약 55MB정도 되는데 Windows 2000이상을 요구하며, 닷넷 프레임워크 2.0 과 Windows Installer 3.0이상을 필요로 한다. 물론 이전 버전의 VS 2005 및 VS 2005 Express버전을 모두 깨끗이 삭제한 후 설치해야 한다. VS2005 beta를 지워주는 CleanUp 도구에 대해서는 여러번 소개했으니 다시 언급하지는 않겠다.

설치과정은 몇 번 마우스클릭을 해주면 끝날 정도로 간단하다. 이 작업이 종료되면 SQL Server Express가 정상적으로 작동중인지를 확인하기 위해 코맨드 라인을 하나 띄워서 다음과 같이 입력해보자.


sqlcmd -S localhost\SQLExpress

1>과 같이 숫자가 계속해서 증가하는 프롬프트가 나타나면 성공이다. sqlcmd는 SQL Server Express에 접속하는 코맨드 라인 유틸리티로 -S는 서버를 지정하는 옵션을 준 것이다. 여기서는 localhost의 SQLExpress라는 Instance를 지정했다. SQL Server Express의 Default Instance이름은 항상 'SQLExpress'가 되니 참고하기 바란다. 여기서 여러 가지 명령으로 서버를 조작할 수 있으며, MSDE에도 있던 전통적인 osql을 사용할 수도 있다. osql로 유사한 방식으로 접속한 후 TSQL 명령을 입력해서 원하는 작업을 하면 된다.

그러나 GUI가 대중화된지 10년이 넘은 지금 코맨드 라인 도구를 이용해 조작하는 것은 역시 불편하다. 이것은 대부분의 무료 DBMS가 겪고 있는 문제점으로, 서버의 성능은 만족하나 편의하게 사용할 수 있는 클라이언트단 도구가 항상 부족하다는 것이다. SQL Server Express는 이에 대한 해결책으로 SQL Server Management Studio Express라는 멋진 도구를 같이 제공한다. 이 도구에 대해서는 뒤에 다시 다루도록 하자.

SQL Server Express는 SQL Server 2005이다
SQL Server Express와 MSDE를 구분 짓는 가장 큰 특징은 SQL Server Express는 SQL Server 2005의 한 에디션이라는 것이다. MSDE가 SQL Server 7의 엔진을 사용하기는 했지만 어디까지나 MSDE는 SQL Server와는 달랐고 그렇기 때문에 MSDE를 쓰고자 하는 사용자는 새로운 도구들을 익히지 않으면 안 되었다. 하지만 SQL Server Express는 엄연히 SQL Server 2005의 한가지 버전이므로 기본적인 컨셉, 도구, 관리방법 등을 모두 공유한다. 물론 SQL Server Express는 기능이나 용량등에서 제한을 받기는 하지만 MSDE처럼 SQL Server와 별개로 다루어지는 제품이 아니라는 뜻이다. 그렇기 때문에 SQL Server 2005에 관련된 문서나 책자를 가지고 있다면 기본적인 부분은 SQL Server Express에도 똑같이 적용된다.

또한 이런 이유로 인해, 사이트가 확장되어서 더 많은 용량과 기능이 필요해지면 SQL Server Express를 Workgroup -> Standard -> Enterprise버전으로 업그레이드하는데도 큰 비용이나 시간이 들지 않는다. 관리도구나 그 동안 사용했던 애플리케이션도 똑같이 쓰면 된다. 이 부분은 MS의 노림수이기도 할 것으로 보이는데, SQL Server Express는 무료로 배포해서 저변을 늘리고 사이트가 확장될때 정식버전을 판매해서 수익을 올리는 방식이 어느 정도 설득력이 있다. 어쨌거나 사용자 입장에서는 다소의 제한이 걸린 SQL Server 2005를 무료로 쓰게 된 셈이니 나쁠 건 없다.

SQL Server Management Studio Express
MySQL이나 MSDE와 같은 무료 DBMS를 사용하는 사람들의 가장 큰 불만은 데이터베이스를 관리하는 클라이언트단 유틸리티가 빈약하다는 것이다. 그러나 SQL Server Express에서는 SQL Server Management Studio Express(이하 SSMSE)라는 멋진 툴을 사용할 수 있다. 이 도구는 현재 정식버전이 아닌 CTP이지만 SQL Server Express와 함께 매우 안정적으로 잘 작동하며 강력하다. 설치파일은 약 30MB정도인데 닷넷 Framework 2.0과 MSXML Parser 6.0가 미리 설치되어 있어야 하므로 참고하자. 파일은 다음 페이지에서 받을 수 있다.

http://www.microsoft.com/downloads/details.aspx?

설치 후 실행해보면 어떤 식으로 사용하는지 금방 익힐 수 있는 친숙한 인터페이스가 나타나며, 사용자는 이 도구를 이용해 계정, 데이터베이스, 테이블등 DBMS 관련된 모든 객체를 관리하고 조회할 수 있다. SQL Server나 오라클을 써본 사람이라면 배울 필요도 없이 금방 쓸 수 있는 매우 일반적인 인터페이스를 채용하고 있다. 사실 SSMSE를 사용하면 다른 도구가 거의 필요 없을 정도인데 무료로 사용할 수 있는 DBMS에 이 정도의 툴을 지급한다는 것은 다른 무료 DBMS와 확실히 차별화되는 SQL Server Express만의 장점일 것이다.

기능 제한과 주요 기능
SQL Server Express는 여러 가지 기능적인 제한을 갖는다고 앞서 언급했다. 그 주요제한은 다음과 같다.


  • 리포팅 서비스는 지원되지 않는다.

  • OLAP/Data mining 서비스는 지원되지 않는다.
  • Analsys 서비스는 지원하지 않는다.
  • DTS를 지원하지 않는다.
  • Database Mirroring은 지원하지 않는다.
  • Database의 크기는 4GB로 제한된다.
  • 지원하는 RAM의 크기는 1GB까지이다.
  • SMP시스템이라도 CPU는 1개만 지원한다.

    그러나 SQL Server Express는 SQL Server 2005의 한 에디션이다. 그러므로 다음과 같은 주요기능들을 지원한다.

  • SQL Server Express는 stored procedure를 지원한다.
  • SQL Server Express는 view를 지원한다.
  • SQL Server는 Trigger를 지원한다.
  • SQL Server는 Replication Subscriber가 될 수 있다.
  • SQL Server는 XML을 지원한다.

    여기서 설명되지 않은 제한이나 기능도 있지만 전체적인 모양은 작은 사이트에서 사용할 때 최고의 성능을 발휘하도록 최적화된 그런 형태이다. SQL Server의 정품이 갖는 고급기능도 많이 포함하고 있으므로 개발자 입장에서는 훨씬 편하게 작업할 수 있을 것이다. 다만 데이터베이스의 크기가 4GB로 제한되어 있으므로 대용량 데이터가 지속적으로 발생하는 사이트에서는 쓰기 어렵고, 또 램 1GB와 CPU 1개의 제한이 있기 때문에 고성능을 요하는 사이트에도 역시 맞지 않다. 이런 점을 생각해서 자신이나 자신의 조직에 어떤 에디션이 필요한지 잘 판단해보기 바란다. 하지만 SQL Server Express는 많은 경우 최선의 선택이 될 것이다.

    마치며
    지금까지 설명한 내용들을 보면 알 수 있듯이 SQL Server Express가 SQL Server 정품에 비교해 갖는 제한이라는 것은 사이트가 작으면 거의 문제가 되지 않는 것임에 비해 지원하는 기능들은 너무나 강력하다. 또한 거듭 얘기되지만 SQL Server Express는 SQL Server 2005의 한 에디션이므로 향후 업그레이드가 용이하다는 것도 큰 장점이다.

    SQL Server Express는 이런 장점들을 바탕으로 그간 MySQL 등 오픈소스 쪽의 무료 DBMS들이 차지했던 시장의 상당부분을 차지할 가능성이 있다. MS의 독점이 심화되는 것은 분명 경계할만한 일이지만 이젠 기존의 것보다는 좀더 강력하며 편리한 인터페이스를 갖는 무료 DBMS 하나쯤 나와도 좋지 않을까 한다. 항상 경쟁은 발전을 유도하는 법이므로 MS의 무료배포에 자극받은 오픈소스 측의 DBMS들이 지금보다 더 발전하게 된다면 그것도 역시 좋은 일이다. 시장의 방향이 어느 쪽으로 흘러가든 사용자는 즐겁게 기다릴 뿐이다.
  • # by 제갈장비 | 2006/10/19 16:31 | 문서-MSSQL | 트랙백 | 덧글(0)
    2006년 10월 19일
    vi Editor 명령어 요약

     

    vi Editor's Command Collection

     command line 명령어

    내 용

    vi file

    vi를 시작하여 지정한 파일 편집

    vi -r file

    읽기 전용(read- only) 편집기로서 vi를 시작하여 지정한 파일 편집

    view file

    읽기 전용(read- only) 편집기로서 vi를 시작하여 지정한 파일 편집

    vi -r

    되살릴 수 있는 모든 파일 이름 보여주기

    vi -r file

    vi를 시작하여 지정한 파일 되살리기

    편 집 명 령

    내 용

    i

    입력 모드로 전환, 커서 위치 앞에서 삽입

    a

    입력 모드로 전환, 커서 위치 뒤에서 삽입

    I

    입력 모드로 전환, 현재 줄의 앞에 삽입

    A

    입력 모드로 전환, 현재 줄의 끝에 삽입

    o

    입력 모드로 전환, 현재 줄의 아래에 전개

    O

    입력 모드로 전환, 현재 줄의 위에 전개

    :e file

    지정한 파일의 편집

    :e! file

    지정한 파일의 편집, 자동 점검의 생략

    r

    단지 한 글자만 변경(입력 모드로 바뀌지 않음)

    R

    입력하는 대로 겹쳐 써서 변경

    s

    삽입에 의해 한 단어의 변경

    C

    커서의 위치로부터 줄 끝까지 삽입에 의한 변경

    cc

    전체 줄을 삽입에 의한 변경

    S

    전체 줄을 삽입에 의한 변경

    cmove

    커서부터 move까지 삽입에 의해 변경

    ~

    대,소문자 바꾸기

    u

    편집 버퍼를 수정했던 마지막 명령을 취소

    U

    현재 줄을 저장

    .

    편집 버퍼를 수정했던 마지막 명령 반복

    x

    커서가 있는 문자 삭제

    X

    커서의 왼쪽 문자 삭제

    D

    커서부터 줄의 끝까지 삭제

    dd

    현재 줄의 전체 삭제

    dmove

    커서부터 move까지 삭제

    dG

    커서부터 편집 버퍼의 끝까지 삭제

    d1G

    커서부터 편집 버퍼의 맨 앞까지 삭제

    :<line>d

    지정한 줄의 삭제

    :<line>,<line>d

    지정한 범위의 삭제

    :<line>co<target>

    지정한 줄을 복사하여 target 줄 밑에 삽입

    :<line>, <line>co<target>

    지정한 범위를 복사하여 target 줄 밑에 삽입

    :<line>m<target?

    지정한 줄로 이동하여 target 줄 밑에 삽입

    :<line>, <line>m<target>

    지정한 범위로 이동하여target 줄 밑에 삽입

    <n>!!command

    n번 줄에서 command의 실행

    !move command

    커서부터 move까지 command 실행

    !move fmt

    커서부터 move까지 줄들을 형식 맞추기

    :w

    원래의 파일로 데이터를 저장

    :w file

    지정한 파일로 데이터를 저장

    :w>> file

    지정한 파일에 데이터를 추가

    :wq

    데이터를 저장하고 종료

    :q!

    데이터를 저장하지 않고 종료

    :set number

    내부 줄 번호 디스플레이

    :set nonumber

    내부 줄 번호 디스플레이 않기

    p

    마지막으로 지워진 것을 커서의 뒤/아래에 삽입

    P

    마지막으로 지워진 것을 커서의 앞/위에 삽입

    xp

    두 문자를 바꿈

    deep

    두 단어를 바꿈

    ddp

    두 줄을 바꿈

    /rexp

    지정된 정규 표현식에 대해 앞으로 이동

    /

    이전의 패턴에 대해 앞으로 검색을 반복

    ?rexp

    지정된 정규 표현식에 대해 뒤로 이동

    ?

    이전의 패턴에 대해 뒤로 검색을 반복

    n

    /나 ?명령에 대해 같은 방향으로 반복

    N

    /나 ?명령에 대해 반대 방향으로 반복

    :ab short long

    short를 long에 대한 약어로 변경

    :ab

    현재 약어 목록을 표시

    :una short

    약어 short를 표시

    r<Return>

    문자를 뉴라인으로 변경

    J

    아래 line을 현재 line과 합치기

    :set wm=n

    오른쪽으로 n문자 위치에서 자동적으로 줄 나눔

    h or <Left key>

    커서를 한 칸 왼쪽으로 이동

    j or <Down key>

    커서를 한 줄 아래로 이동

    k or <Up key>

    커서를 한 줄 위로 이동

    l or <Right key>

    커서를 한 칸 오른쪽으로 이동

    <Backspace>

    커서를 한 칸 왼쪽으로 이동

    <Space>

    커서를 한 칸 오른쪽으로 이동

    -

    커서를 이전 줄의 처음으로 이동

    +

    커서를 다음 줄의 처음으로 이동

    <Return>

    커서를 다음 줄의 처음으로 이동

    0

    커서를 현재 줄의 맨 앞으로 이동

    $

    커서를 현재 줄의 맨 끝으로 이동

    ^

    커서를 현재 줄의 첫글자(공백이나 탭이 아닌)로 이동

    w

    커서를 다음 단어의 첫 글자로 이동

    e

    커서를 다음 단어의 끝 글자로 이동

    b

    커서를 이전 단어의 첫 글자로 이동

    W

    w와 같음(문장 부호 무시)

    E

    e와 같음(문장 부호 무시)

    B

    b와 같음(문장 부호 무시)

    (

    다음 문장의 처음으로 이동

    )

    이전 문장의 처음으로 이동

    {

    다음 문단의 처음으로 이동

    }

    이전 문단의 처음으로 이동

    H

    커서를 화면 맨 위로 이동

    M

    커서를 중간으로 이동

    L

    커서를 맨 아래로 이동

    ^f

    한 화면 아래로 이동

    ^b

    화면 위로 이동

    ^d

    반 화면 아래로 이동

    ^u

    반 화면 위로 이동

    n^d

    n줄만큼 아래로 이동

    n^u

    n줄만큼 위로 이동

    :!command

    vi를 중단하고 지정한 셸 명령을 실행

    :!!

    vi를 중단하고 이전의 셸 명령을 실행

    :sh

    vi를 중단하고 셸을 실행

    :!csh

    vi를 중단하고 새로운 C-셸을 실행

    :s/<pattern>/<replace>/

    현재 줄의 치환

    :<line>s/<pattern>/<replace>/

    지정한 줄의 치환

    :<line>,<line>s/<pattern>/<replace>/ 

    정한 범위의 치환

    :%s/<pattern>/<replace>/

    모든 줄의 치환

    :<line>r file

    file의 내용을 지정한 줄 다음에 삽입

    :r file

    file의 내용을 현재의 줄 다음에 삽입

    :<line>r !command

    command의 결과를 지정한 줄 다음에 삽입

    :r !command

    command의 결과를 현재의 줄 다음에 삽입

    :r !look pattern

    지정한 pattern으로 시작된 단어 삽입

    .

    뉴라인을 제외한 모든 단일 문자와 대응

    *

    영 또는 그 이상의 선행 문자와 대응

    ^

    줄의 시작과 대응

    $

    줄의 끝과 대응

    \<

    단어의 시작과 대응

    \>

    단어의 끝과 대응

    [ ]

    묶여진 문자중의 하나와 대응

    [^ ]

    묶여진 문자를 제외한 아무것하고나 대응

    \

    이어지는 기호를 문자 그대로 해석

    <n>G

    줄번호 n으로 건너뛰기

    1G

    편집 버퍼의 첫 줄로 건너뛰기

    G

    편집 버퍼의 마지막 줄로 건너뛰기

    :map g lG

    g가 lG와 같도록 매크로 정의


    # by 제갈장비 | 2006/10/19 11:26 | TIP-Linux | 트랙백 | 핑백(1) | 덧글(0)
    2006년 10월 18일
    자바 문자열 엔코딩 테스트 모음


    정리일자 : 2006.10.18(수)
    정리자 : 제갈장비



    자바 문자열 엔코딩 테스트 모음

      String strTITLE01="";
      String strTITLE02="";
      String strTITLE03="";
      String strTITLE04="";
      String strTITLE05="";
      String strTITLE06="";
      String strTITLE07="";
      String strTITLE08="";
      String strTITLE09="";
      String strTITLE10="";
      String strTITLE11="";
      String strTITLE12="";
      String strTITLE13="";

      try {
       strTITLE01 = new String(title.getBytes("Shift_JIS"),"ISO-8859-1");
       strTITLE02 = new String(title.getBytes("Shift_JIS"),"EUC-JP");
       strTITLE03 = new String(title.getBytes("Shift_JIS"),"EUCJIS");
       strTITLE04 = new String(title.getBytes("Shift_JIS"),"UTF-8");
       strTITLE05 = new String(title.getBytes("ISO-8859-1"),"Shift_JIS");
       strTITLE06 = new String(title.getBytes("ISO-8859-1"),"EUC-JP");
       strTITLE07 = new String(title.getBytes("ISO-8859-1"),"EUCJIS");
       strTITLE08 = new String(title.getBytes("ISO-8859-1"),"UTF-8");
       strTITLE09 = new String(title.getBytes("ISO-8859-1"),"ISO-8859-1");
       strTITLE10= new String(title.getBytes("UTF-8"),"Shift_JIS");
       strTITLE11= new String(title.getBytes("UTF-8"),"EUC-JP");
       strTITLE12= new String(title.getBytes("UTF-8"),"MS932");
       strTITLE13= new String(title.getBytes("UTF-8"),"UTF-8");

       System.out.println(strTITLE01);
       System.out.println(strTITLE02);
       System.out.println(strTITLE03);
       System.out.println(strTITLE04);
       System.out.println(strTITLE05);
       System.out.println(strTITLE06);
       System.out.println(strTITLE07);
       System.out.println(strTITLE08);
       System.out.println(strTITLE09);
       System.out.println(strTITLE10);
       System.out.println(strTITLE11);
       System.out.println(strTITLE12);
       System.out.println(strTITLE13);
      } catch (UnsupportedEncodingException e) {
       e.printStackTrace();
      }

    - 끝 -

    # by 제갈장비 | 2006/10/18 15:00 | 제갈장비-JAVA | 트랙백 | 덧글(0)
    2006년 10월 11일
    PostgreSql - Data Type Formatting Functions

    9.8. Data Type Formatting Functions



    The PostgreSQL formatting functions provide a powerful set of tools for converting various data types (date/time, integer, floating point, numeric) to formatted strings and for converting from formatted strings to specific data types. Table 9.20, “Formatting Functions” lists them. These functions all follow a common calling convention: the first argument is the value to be formatted and the second argument is a template that defines the output or input format.

    The to_timestamp function can also take a single double precision argument to convert from Unix epoch to timestamp with time zone. (Integer Unix epochs are implicitly cast to double precision.)

    Table 9.20. Formatting Functions

    FunctionReturn TypeDescriptionExample
    to_char(timestamp, text)textconvert time stamp to stringto_char(current_timestamp, 'HH12:MI:SS')
    to_char(interval, text)textconvert interval to stringto_char(interval '15h 2m 12s', 'HH24:MI:SS')
    to_char(int, text)textconvert integer to stringto_char(125, '999')
    to_char(double precision, text)textconvert real/double precision to stringto_char(125.8::real, '999D9')
    to_char(numeric, text)textconvert numeric to stringto_char(-125.8, '999D99S')
    to_date(text, text)dateconvert string to dateto_date('05 Dec 2000', 'DD Mon YYYY')
    to_timestamp(text, text)timestamp with time zoneconvert string to time stampto_timestamp('05 Dec 2000', 'DD Mon YYYY')
    to_timestamp(double precision)timestamp with time zoneconvert UNIX epoch to time stampto_timestamp(200120400)
    to_number(text, text)numericconvert string to numericto_number('12,454.8-', '99G999D9S')

    In an output template string (for to_char), there are certain patterns that are recognized and replaced with appropriately-formatted data from the value to be formatted. Any text that is not a template pattern is simply copied verbatim. Similarly, in an input template string (for anything but to_char), template patterns identify the parts of the input data string to be looked at and the values to be found there.

    Table 9.21, “Template Patterns for Date/Time Formatting” shows the template patterns available for formatting date and time values.

    Table 9.21. Template Patterns for Date/Time Formatting

    PatternDescription
    HHhour of day (01-12)
    HH12hour of day (01-12)
    HH24hour of day (00-23)
    MIminute (00-59)
    SSsecond (00-59)
    MSmillisecond (000-999)
    USmicrosecond (000000-999999)
    SSSSseconds past midnight (0-86399)
    AM or A.M. or PM or P.M. meridian indicator (uppercase)
    am or a.m. or pm or p.m. meridian indicator (lowercase)
    Y,YYYyear (4 and more digits) with comma
    YYYYyear (4 and more digits)
    YYYlast 3 digits of year
    YYlast 2 digits of year
    Ylast digit of year
    IYYYISO year (4 and more digits)
    IYYlast 3 digits of ISO year
    IYlast 2 digits of ISO year
    Ilast digits of ISO year
    BC or B.C. or AD or A.D. era indicator (uppercase)
    bc or b.c. or ad or a.d. era indicator (lowercase)
    MONTHfull uppercase month name (blank-padded to 9 chars)
    Monthfull mixed-case month name (blank-padded to 9 chars)
    monthfull lowercase month name (blank-padded to 9 chars)
    MONabbreviated uppercase month name (3 chars)
    Monabbreviated mixed-case month name (3 chars)
    monabbreviated lowercase month name (3 chars)
    MMmonth number (01-12)
    DAYfull uppercase day name (blank-padded to 9 chars)
    Dayfull mixed-case day name (blank-padded to 9 chars)
    dayfull lowercase day name (blank-padded to 9 chars)
    DYabbreviated uppercase day name (3 chars)
    Dyabbreviated mixed-case day name (3 chars)
    dyabbreviated lowercase day name (3 chars)
    DDDday of year (001-366)
    DDday of month (01-31)
    Dday of week (1-7; Sunday is 1)
    Wweek of month (1-5) (The first week starts on the first day of the month.)
    WWweek number of year (1-53) (The first week starts on the first day of the year.)
    IWISO week number of year (The first Thursday of the new year is in week 1.)
    CCcentury (2 digits)
    JJulian Day (days since January 1, 4712 BC)
    Qquarter
    RMmonth in Roman numerals (I-XII; I=January) (uppercase)
    rmmonth in Roman numerals (i-xii; i=January) (lowercase)
    TZtime-zone name (uppercase)
    tztime-zone name (lowercase)

    Certain modifiers may be applied to any template pattern to alter its behavior. For example, FMMonth is the Month pattern with the FM modifier. Table 9.22, “Template Pattern Modifiers for Date/Time Formatting” shows the modifier patterns for date/time formatting.

    Table 9.22. Template Pattern Modifiers for Date/Time Formatting

    ModifierDescriptionExample
    FM prefixfill mode (suppress padding blanks and zeroes)FMMonth
    TH suffixuppercase ordinal number suffixDDTH
    th suffixlowercase ordinal number suffixDDth
    FX prefixfixed format global option (see usage notes)FX Month DD Day
    SP suffixspell mode (not yet implemented)DDSP

    Usage notes for date/time formatting:

    • FM suppresses leading zeroes and trailing blanks that would otherwise be added to make the output of a pattern be fixed-width.

    • to_timestamp and to_date skip multiple blank spaces in the input string if the FX option is not used. FX must be specified as the first item in the template. For example to_timestamp('2000    JUN', 'YYYY MON') is correct, but to_timestamp('2000    JUN', 'FXYYYY MON') returns an error, because to_timestamp expects one space only.

    • Ordinary text is allowed in to_char templates and will be output literally. You can put a substring in double quotes to force it to be interpreted as literal text even if it contains pattern key words. For example, in '"Hello Year "YYYY', the YYYY will be replaced by the year data, but the single Y in Year will not be.

    • If you want to have a double quote in the output you must precede it with a backslash, for example '\\"YYYY Month\\"'. (Two backslashes are necessary because the backslash already has a special meaning in a string constant.)

    • The YYYY conversion from string to timestamp or date has a restriction if you use a year with more than 4 digits. You must use some non-digit character or template after YYYY, otherwise the year is always interpreted as 4 digits. For example (with the year 20000): to_date('200001131', 'YYYYMMDD') will be interpreted as a 4-digit year; instead use a non-digit separator after the year, like to_date('20000-1131', 'YYYY-MMDD') or to_date('20000Nov31', 'YYYYMonDD').

    • In conversions from string to timestamp or date, the CC field is ignored if there is a YYY, YYYY or Y,YYY field. If CC is used with YY or Y then the year is computed as (CC-1)*100+YY.

    • Millisecond (MS) and microsecond (US) values in a conversion from string to timestamp are used as part of the seconds after the decimal point. For example to_timestamp('12:3', 'SS:MS') is not 3 milliseconds, but 300, because the conversion counts it as 12 + 0.3 seconds. This means for the format SS:MS, the input values 12:3, 12:30, and 12:300 specify the same number of milliseconds. To get three milliseconds, one must use 12:003, which the conversion counts as 12 + 0.003 = 12.003 seconds.

      Here is a more complex example: to_timestamp('15:12:02.020.001230', 'HH:MI:SS.MS.US') is 15 hours, 12 minutes, and 2 seconds + 20 milliseconds + 1230 microseconds = 2.021230 seconds.

    • to_char's day of the week numbering (see the 'D' formatting pattern) is different from that of the extract function.

    • to_char(interval) formats HH and HH12 as hours in a single day, while HH24 can output hours exceeding a single day, e.g. >24.

    Table 9.23, “Template Patterns for Numeric Formatting” shows the template patterns available for formatting numeric values.

    Table 9.23. Template Patterns for Numeric Formatting

    PatternDescription
    9value with the specified number of digits
    0value with leading zeros
    . (period)decimal point
    , (comma)group (thousand) separator
    PRnegative value in angle brackets
    Ssign anchored to number (uses locale)
    Lcurrency symbol (uses locale)
    Ddecimal point (uses locale)
    Ggroup separator (uses locale)
    MIminus sign in specified position (if number < 0)
    PLplus sign in specified position (if number > 0)
    SGplus/minus sign in specified position
    RNroman numeral (input between 1 and 3999)
    TH or th ordinal number suffix
    Vshift specified number of digits (see notes)
    EEEEscientific notation (not implemented yet)

    Usage notes for numeric formatting:

    • A sign formatted using SG, PL, or MI is not anchored to the number; for example, to_char(-12, 'S9999') produces '  -12', but to_char(-12, 'MI9999') produces '-  12'. The Oracle implementation does not allow the use of MI ahead of 9, but rather requires that 9 precede MI.

    • 9 results in a value with the same number of digits as there are 9s. If a digit is not available it outputs a space.

    • TH does not convert values less than zero and does not convert fractional numbers.

    • PL, SG, and TH are PostgreSQL extensions.

    • V effectively multiplies the input values by 10^n, where n is the number of digits following V. to_char does not support the use of V combined with a decimal point. (E.g., 99.9V99 is not allowed.)

    Table 9.24, “to_char Examples” shows some examples of the use of the to_char function.

    Table 9.24. to_char Examples

    ExpressionResult
    to_char(current_timestamp, 'Day, DD  HH12:MI:SS')'Tuesday  , 06  05:39:18'
    to_char(current_timestamp, 'FMDay, FMDD  HH12:MI:SS')'Tuesday, 6  05:39:18'
    to_char(-0.1, '99.99')'  -.10'
    to_char(-0.1, 'FM9.99')'-.1'
    to_char(0.1, '0.9')' 0.1'
    to_char(12, '9990999.9')'    0012.0'
    to_char(12, 'FM9990999.9')'0012.'
    to_char(485, '999')' 485'
    to_char(-485, '999')'-485'
    to_char(485, '9 9 9')' 4 8 5'
    to_char(1485, '9,999')' 1,485'
    to_char(1485, '9G999')' 1 485'
    to_char(148.5, '999.999')' 148.500'
    to_char(148.5, 'FM999.999')'148.5'
    to_char(148.5, 'FM999.990')'148.500'
    to_char(148.5, '999D999')' 148,500'
    to_char(3148.5, '9G999D999')' 3 148,500'
    to_char(-485, '999S')'485-'
    to_char(-485, '999MI')'485-'
    to_char(485, '999MI')'485 '
    to_char(485, 'FM999MI')'485'
    to_char(485, 'PL999')'+485'
    to_char(485, 'SG999')'+485'
    to_char(-485, 'SG999')'-485'
    to_char(-485, '9SG99')'4-85'
    to_char(-485, '999PR')'<485>'
    to_char(485, 'L999')'DM 485
    to_char(485, 'RN')'        CDLXXXV'
    to_char(485, 'FMRN')'CDLXXXV'
    to_char(5.2, 'FMRN')'V'
    to_char(482, '999th')' 482nd'
    to_char(485, '"Good number:"999')'Good number: 485'
    to_char(485.8, '"Pre:"999" Post:" .999')'Pre: 485 Post: .800'
    to_char(12, '99V999')' 12000'
    to_char(12.4, '99V999')' 12400'
    to_char(12.45, '99V9')' 125'
    # by 제갈장비 | 2006/10/11 15:16 | TIP-PostgreSql | 트랙백 | 덧글(0)
    2006년 10월 11일
    PostgreSql - 수학 계산 관련
    평균구하고, 소숫점 자리수 지정하기
        Select round(avg(숫자형 필드),2)

    # by 제갈장비 | 2006/10/11 14:38 | TIP-PostgreSql | 트랙백 | 덧글(0)
    2006년 10월 11일
    postgreSQL - 일자관련팁
    문자열을 일자형을 바꾸기
        Select to_timestamp('20060902','yyyymmdd')

    문자열을 일자형을 바꾼다음 10초 더하기
        Select to_timestamp('20060902','yyyymmdd') + '10'
        혹은
        Select to_timestamp('20060902','yyyymmdd') + '10 sec'

    문자열을 일자형을 바꾼다음 10분 더하기
        Select to_timestamp('20060902','yyyymmdd') + '10 minute'

    문자열을 일자형을 바꾼다음 10시간 더하기
        Select to_timestamp('20060902','yyyymmdd') + '10 hour'

    문자열을 일자형을 바꾼다음 10일 더하기
        Select to_timestamp('20060902','yyyymmdd') + '10 day'

    문자열을 일자형을 바꾼다음 10개월 더하기
        Select to_timestamp('20060902','yyyymmdd') + '10 month'

    문자열을 일자형을 바꾼다음 10년 더하기
        Select to_timestamp('20060902','yyyymmdd') + '10 year'



    더 많은 예 참조

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

    일자형 필드를 문자열로 바꾸기(24시간형식으로 표시)
        Select to_char(일자형 필드명,'yyyymmddhh24')

    일자형의 각 요소 표시하기
              Select current_timestamp
                        ,to_char(current_timestamp, 'HH')
                        ,to_char(current_timestamp, 'HH12')
                        ,to_char(current_timestamp, 'HH24')
                        ,to_char(current_timestamp, 'MI')
                        ,to_char(current_timestamp, 'SS')
                        ,to_char(current_timestamp, 'MS')
                        ,to_char(current_timestamp, 'US')
                        ,to_char(current_timestamp, 'SSSS')

     




    - 끝 -
    # by 제갈장비 | 2006/10/11 14:28 | TIP-PostgreSql | 트랙백 | 덧글(0)
    2006년 09월 29일
    Highlighting Selected Text in PowerBuilder DataWindow
    Highlighting Selected Text in PowerBuilder DataWindow


    사용자가 찾고자 하는 문자열을 검색할 수 있는 윈도우가 있고,
    그 윈도우 안에는 사용자가 찾고자 하는 문자와 일치하는 텍스트가 있다고 가정하자.
    검색되어진 문자의 위치는 밝게 처리가 되어야 사용자가 쉽게 확인할 수 있을 것이다.
    예를 들면 이것은 아래 그림1처럼 보여야 할 것이다.



    <그림 1>
    파워빌더는 데이터검색과 정보를 보여주는 강력한 기능을 가지고 있는데 이것이 바로 DataWindow이다.
    그렇다면 Datawindow 컬럼 내에서 이것들을 어떻게 처리해야 할 것인가?
    안타깝게도 DataWindow 오브젝트에는 위와 같은 일을 할 수 있는 방법이 없다.
    이 기사에서는 이것을 확인할 수 있는 기술에 대해 설명하고 있다.
     
     
    A Sample DataWindow
     
    테스트를 위해 Tabular 형태로 Datawindow를 하나 만들고
    String 타입으로 text라는 이름을 가진 컬럼을 생성한다.
    여기서는 데이터를 필터링하는 것이 아니라, 단지 텍스트의 패턴 매칭으로 찾는 방식을 알아볼 것이다.
    예제 데이터윈도우는 External Data Source를 이용하여 만든다.
    그림 2에서 보는 것처럼 간단하게 DataWindow를 생성할 수 있다.
    <그림 2>

    데이터윈도우 페이터에 있는 Data 부분에서 간단하게 데이터를 추가할 수 있다.
    아니면, 스트립트 안에서 External Source로부터 데이터를 읽어들일 수도 있다.
     
    Selecting Part of the Text
     
    이제 데이터윈도우에는 우리가 문자열 패턴 매치로 찾고자 하는 텍스트를 포함 하고 있다.
    그 다음 데이터윈도우에서 우리가 원하는 패턴과 일치하는 문자열이 있으면 글자 색을 빨간색으로 처리할 것이다.
    해당 데이터윈도우에 아래의 세 문장이 있다고 가정하고,
     
         PowerBuilder rules the world.
         It is a rule with us.
         This is the rule of the game.
     
    이들 중 찾고자 하는 단어가 ‘rule’이라고 하더라도, 찾아진 결과는 변함이 없을 것이다.
    데이터윈도우 컬럼의 일부만을 강조할 수 없기 때문이다.
     
    이를 표현하기 위해 다음의 세 부분으로 (선택되기 전, 선택, 선택되어진 후)컬럼을 나누어 생각해 볼 수 있다.
    생성한 데이터윈도우의 Result Set에 컬럼 “search” 를 추가하자.
    기존의 text 컬럼 대신에 세 개의 Computed Filed를 추가한다.
    첫번째 Computed Filed의 Expression에 아래의 표현을 적는다.
        if( isNull(search), text, if( pos(text, search, 1) = 0, text, left(text, pos(text, search, 1) - 1) ))
     
    생성한 Computed Filed를 “prefix”라 부르자. 두 번째 Computed Filed에는 아래의 표현식을 적는다.
     
        if(pos(text, search, 1) = 0, '', search)
     
    두번째로 생성한 Computed Filed는 “Matched”라 명하자. 세 번째 Computed Filed에는 아래의 표현식을 적는다. 
     
        if( isNull(search), '',
        if( pos(text, search, 1) = 0, '', mid(text,
        pos(text, search, 1) + len(search) ) )
        )
     
    세 번째로 생성한 것을 “suffix”라 명하자.
    이 세가지 Computed Filed들을 기존의 text 컬럼의 길이에 맞게 위치시킨다.
    “matched” Computed Filed의 폰트 색은 빨간색으로 설정 후 text 컬럼을 지운다.
    결과적으로 그림 3에서 보이는 것과 같은 결과를 얻을 것이다.
    우리가 원하는 부분이 빨간색으로 바뀌었다.
    하지만 데이터윈도우가 하나의 컬럼처럼 보이지 않고
    Computed Field들 사이에 불필요한 공간이 들어가 있는 것을 볼 수 있다.
    적당한 크기로 조절하기 위해  “matched”와 “suffix” Computed Filed의 Position 프로퍼티 중
    Slide Left를 체크해준다.

    <그림 3>



    이렇게 하여 데이터윈도우 Result Set에 원본 컬럼 대신에
    세 개의 Computed Filed들을 별도로 추가함으로써 데이터윈도우에
    있는 텍스트의 일부를 선택할 수 있다는 것을 보았다(그림 4).


     

    <그림 4>

    Selecting Several Parts

     
    만약 사용자가 하나의 단어를 찾으려 하는 것이 아니라 여러 단어를 찾으려 한다면 어떻게 해야 할까?
    이를 만족시키기 위해선 원본 컬럼을 나누기 위해 더 많은 Computed filed들을 만들어야 할 것이다.
    캐릭터들을 더 작은 단위의 컬럼을 나누어 보자.
    즉 모든 Computed Filed는 해당 컬럼 텍스트에 하나의 케릭터만을 포함하게 만든다.
    첫 번째 Computed Filed는 첫 번째 캐릭터를, 두 번째 Computed Filed는 두 번째 캐릭터를…
    이런 방식으로 하나의 캐릭터를 갖도록 한다.
    각 Computed Filed의 Expression에는 아래의 스크립트로 작성한다.
     
       mid( text, , 1)
     
    그 다음 Computed Filed들에 원하는 문자 색을 설정해줌으로써 각각의 문자들을 선택할 수 있게 된다.
    Computed filed에 폰트 색상을 설정해주는 프로퍼티를 설정하는 방식은 Buck Woolley가 작성한
    “Not Your Father’s DataWindow” (PBDJ volumn 8 issue7)내용을 이용하였다.
    이 기술문서의 기본내용은 String 타입의 컬럼들이 포함되어 있는
    많은 데이터윈도우 오브젝트들의 파라미터를 가져오는 것이다.
    예제 데이터윈도우의 텍스트 컬럼 길이는 50이기 때문에 50개의 Computed Filed를 생성해야 할 것이다.
    DataWindow의 Result Set에서 “select” 이름으로 String 컬럼을 하나 추가하고 이 컬럼 역시 길이를 50으로 정한다.
    다양한 색상의 텍스트를 표현해보기 위해, “select” 컬럼은 아래 값을 입력한다.
     
      "0101010101010010100101001010000000<...>"
     
    50개의 케릭터이기 때문에 Computed Filed들을 50개 생성해야 한다면,
    아니면 그 이상의 Computed Fileld를 손수 생성해야 한다면
    그것은 무척 골치 아픈 일이 될 것이다. 이 방법을 해결하기 위해 코딩을 이용하자.
     
    Selection Service Object
     
    사용자가 직접 작업해야 하는 지루한 일들을 대신 해주는 오브젝트를 만들도록 하자.
    먼저 많은 원본 컬럼의 길이와 같은 Computed Filed들이 생성되어 질 데이터윈도우를 생성해 놓아야 한다.
    그리고 원본 컬럼의 이름을 데이터윈도우가 정확하게 알고 있어야 한다.
    아래 List 1은 of_init() 함수 코드이다.
    생성된 Computed field들을 위해 보이는 모든 파라미터들은 원본 컬럼으로부터 가져오게 된다.
    Instance 변수 함수의 마지막은 스트링값 0 을 가지고 초기화 되어진다.
     
    LISTING 1

    n_select variables protected: datawindow idw_dw string is_notselected
    public function boolean of_init (datawindow adw_dw, string as_col);
    string ls_prop[] int li, li_cnt int li_x int li_w =
    55 string ls_color string ls_name string ls_rest_syn string ls_coltype string ls_syn
    idw_dw = adw_dw
    ls_rest_syn = 'create compute(band=detail alignment="0" border="0" format="[general]" ' &
    + 'width="' + string(li_w) + '" slideleft=yes 'ls_prop = { 'y', 'height', 'font.face',
    'font.height', 'font.family', &
    'font.pitch', 'font.charset',
    'background.mode', 'background.color' }
    for li = 1 to upperBound( ls_prop)

    ls_rest_syn += ls_prop[li] + '="' + idw_dw.describe(as_col + '.' + ls_prop[li]) + '" ' next
    ls_color = idw_dw.describe( as_col + '.color')
    li_x = Integer( idw_dw.describe( as_col + '.x'))
    ls_coltype = idw_dw.describe( as_col +
    '.coltype') // expected char(xx)
    li_cnt = Integer( Mid( ls_coltype, 6,
    pos(ls_coltype, ')', 1) - 6 ) )
    for li = 1 to li_cnt ls_syn = ls_rest_syn & + ' x="' + String(li_x + li_w*(li - 1)) +
    '" ' & + ' expression="mid( ' + as_col + ', ' + String(li) + ', 1)" ' &
    + ' color="' + ls_color + '~tif(mid(select,' + string(li) + ',1)=~'1~',rgb(255,0,0),' + ls_color +')" ' &
    + 'name = c$' + string(li) ')'
    idw_dw.modify(ls_syn) next
    idw_dw.modify('destroy ' + as_col)
    is_notSelected = Fill('0', li_cnt)
    return true
     
    그 다음으로, 선택된 텍스트의 위치를 알려주는 함수가 필요하다.
    이 함수에서 사용되는 아귀먼트는 선택된 문자, 선택된 문자의 길이 그리고 데이터윈도우에 있는 줄의 개수다.
    이 함수를 of_select()라 부르고, 이 함수를 구성하고 있는 스크립트는 아래 List 2나와있다.
    LISTING 2
    public subroutine of_select (integer ai_start,
    integer ai_len, long al_row);
    string ls_data
    ls_data = idw_dw.getItemString(al_row, 'se
    _lect')
    if isNull(ls_data) then ls_data =
    is_notSelected
    idw_dw.setItem(al_row, 'select',
    Replace(ls_data, ai_start, ai_len, Fill('1',
    ai_len) ) )
    마지막으로 우리는 각 줄에서 선택된 내용을 지우는 함수가 필요하다.
    이 함수를 of_clear()라 부르고 이 함수를 구성하는
    스크립트는 아래 List 3에 나와있다.
    LISTING 3
    public subroutine of_clear (long al_row); idw_dw.setItem( al_row, 'select', is_notSelected )
     
    Conclusion
     
    파워빌더에서는 데이터윈도우 컬럼에 있는 text를 직접적으로 찾아낼 수 있는 방법이 없다.
    하지만, 위에서 살펴본 기술을 이용하면
    데이터윈도우 컬럼 안에 있는 텍스트의 일부분을 찾아 매칭을 시킬 수 있었다.
    우리는 글자 색을 변경하거나, 뒷 배경색을 변경하거나,
    글씨를 굵게 아니면 기울리는 등의 우리가 원하는 모든 종류의 텍스트 형태를 이용할 수 있다.
     
    원본자료 : http://pbdj.sys-con.com/read/258397.htm

    첨부문서 : Highlighting Selected Text in PowerBuilder DataWindow.mht

    # by 제갈장비 | 2006/09/29 09:55 | 문서-Powerbuilder | 트랙백 | 덧글(0)
    2006년 09월 29일
    Little Known, But Incredibly Useful, PowerBuilder Tips and Tricks

    Little Known, But Incredibly Useful, PowerBuilder Tips and Tricks

    이 문서는 TechWave 2006에서 발표한 자료 중 Tip & Trick 일부를 정리한 것으로 파워빌더를 사용해본 경험자나

    처음 시작하는 사람들에게 조금이나마 도움이 되었으면 한다.

     

    이하는 첨부문서참조

     

    첨부문서 : Little Know-But Incredibly UseFul-PowerBuilder Tip and Tricks.mht

    # by 제갈장비 | 2006/09/29 09:46 | 문서-Powerbuilder | 트랙백 | 덧글(0)
    2006년 09월 21일
    JFreeChart - 애플릿 봉그래프 그리기, 그리고 예쁘게 다듬기
    JFreeChart - 애플릿 봉그래프 그리기, 그리고 예쁘게 다듬기
     
     
    작성자 : 제갈장비
    작성일 : 2006년 9월 21일(목)
     
    개요 : JFreeChart를 이용하여 웹어플리키에션에서
             애플릿을 이용하여 봉그래프를 나타내고
             좀 더 예쁘장하게 다듬어 보기
     
    참고 : 이 문서는 http://www.thinkit.co.jp/free/tech/4/6/1.html 를 참조하여
              작성한 것입니다.
     
    [ 일러두기 ]
    - . 이 문서에서는 JFreeChart 설치방법은 설명하지 않습니다.
    - . 이 문서에서는 JFreeChart의 문법에 대한 설명은 하지 않습니다.
    - . 그림파일은 마우스로 클릭하면 글자가 잘 보입니다.
     
     
    [ 실행환경 ]
    이 문서를 작성했을 때의 환경입니다.
     
    운영체제 : MS Windows XP Professional
    웹서버    : TOMCAT v5.0.28
    JAVA      : 1.4.2_12
    JfreeChart : 1.0.2
     
     
    [ 봉그래프의 구조 ]

     
    A. 기본적인 봉그래프 나타내기
     
    아래의 소스를 컴파일했을 때 보이는 그래프입니다.
     
    [소스]
    import java.awt.Dimension;
    import javax.swing.JApplet;
    import org.jfree.chart.ChartFactory;
    import org.jfree.chart.ChartPanel;
    import org.jfree.chart.JFreeChart;
    import org.jfree.chart.plot.PlotOrientation;
    import org.jfree.data.category.DefaultCategoryDataset;
    public class BarChartDemo_t01 extends JApplet{
     public BarChartDemo_t01(){
      // row keys...
            final String series1 = "First";
            final String series2 = "Second";
            final String series3 = "Third";
            // column keys...
            final String category1 = "Category 1";
            final String category2 = "Category 2";
            final String category3 = "Category 3";
            final String category4 = "Category 4";
            final String category5 = "Category 5";
            // create the dataset...
            final DefaultCategoryDataset dataset = new DefaultCategoryDataset();
            dataset.addValue(1.0, series1, category1);
            dataset.addValue(4.0, series1, category2);
            dataset.addValue(3.0, series1, category3);
            dataset.addValue(5.0, series1, category4);
            dataset.addValue(5.0, series1, category5);
            dataset.addValue(5.0, series2, category1);
            dataset.addValue(7.0, series2, category2);
            dataset.addValue(6.0, series2, category3);
            dataset.addValue(8.0, series2, category4);
            dataset.addValue(4.0, series2, c