변경 (7)

 

JQuery provides methods to manipulate DOM in efficient way. You do not need to write big code to modify the value of any element's attribute or to extract HTML code from a paragraph or division.

JQuery provides methods such as .attr(), .html(), and .val() which act as getters, retrieving information from DOM elements for later use.

컨텐츠 조작:

The html( ) method gets the html contents (innerHTML) of the first matched element.

Here is the syntax for the method:

selector.html( )

예제:

Following is an example which makes use of .html() and .text(val) methods. Here .html() retrieves HTML content from the object and then .text( val ) method sets value of the object using passed parameter:

<html>
<head>
<title>the title</title>
   <script type="text/javascript" 
   src="/jquery/jquery-1.3.2.min.js"></script>
   <script type="text/javascript" language="javascript">
   
   $(document).ready(function() {

     $("div").click(function () {
      var content = $(this).html();
      $("#result").text( content );
    });

   });

   </script>
   <style>
      #division{ margin:10px;padding:12px;
                 border:2px solid #666;
                 width:60px;
               }
  </style>
</head>
<body>
   <p>Click on the square below:</p>
   <span id="result"> </span>
   <div id="division" style="background-color:blue;">
     This is Blue Square!!
   </div>
</body>
</html>

 

 

DOM 요소 변경

You can replace a complete DOM element with the specified HTML or DOM elements. The replaceWith( content ) method serves this purpose very well.

Here is the syntax for the method:

selector.replaceWith( content )

Here content is what you want to have instead of original element. This could be HTML or simple text.

예제:

Following is an example which would replace division element with "<h1>JQuery is Great</h1>":

<html>
<head>
<title>the title</title>
   <script type="text/javascript" 
   src="/jquery/jquery-1.3.2.min.js"></script>
   <script type="text/javascript" language="javascript">
   
   $(document).ready(function() {

     $("div").click(function () {
       $(this).replaceWith("<h1>JQuery is Great</h1>");
    });

   });

   </script>
   <style>
      #division{ margin:10px;padding:12px;
                 border:2px solid #666;
                 width:60px;
               }
  </style>
</head>
<body>
   <p>Click on the square below:</p>
   <span id="result"> </span>
   <div id="division" style="background-color:blue;">
     This is Blue Square!!
   </div>
</body>
</html>

 

 

DOM 요소 삭제

There may be a situation when you would like to remove one or more DOM elements from the document. JQuery provides two methods to handle the situation.

The empty( ) method remove all child nodes from the set of matched elements where as the method remove( expr ) method removes all matched elements from the DOM.

Here is the syntax for the method:

selector.remove( [ expr ])

or 

selector.empty( )

You can pass optional paramter expr to filter the set of elements to be removed.

예제:

Following is an example where elements are being removed as soon as they are clicked:

<html>
<head>
<title>the title</title>
   <script type="text/javascript" 
   src="/jquery/jquery-1.3.2.min.js"></script>
   <script type="text/javascript" language="javascript">
   
   $(document).ready(function() {

     $("div").click(function () {
       $(this).remove( );
    });

   });

   </script>
   <style>
      .div{ margin:10px;padding:12px;
             border:2px solid #666;
             width:60px;
           }
  </style>
</head>
<body>
   <p>Click on any square below:</p>
   <span id="result"> </span>
   <div class="div" style="background-color:blue;"></div>
   <div class="div" style="background-color:green;"></div>
   <div class="div" style="background-color:red;"></div>
</body>
</html>

 

 

DOM 요소 추가

There may be a situation when you would like to insert new one or more DOM elements in your existing document. JQuery provides various methods to insert elements at various locations.

The after( content ) method insert content after each of the matched elements where as the method before( content ) method inserts content before each of the matched elements.

Here is the syntax for the method:

selector.after( content )

or

selector.before( content )

Here content is what you want to insert. This could be HTML or simple text.

예제:

Following is an example where <div> elements are being inserted just before the clicked element:

<html>
<head>
<title>the title</title>
   <script type="text/javascript" 
   src="/jquery/jquery-1.3.2.min.js"></script>
   <script type="text/javascript" language="javascript">
   
   $(document).ready(function() {

     $("div").click(function () {
       $(this).before('<div class="div"></div>' );
    });

   });

   </script>
   <style>
      .div{ margin:10px;padding:12px;
             border:2px solid #666;
             width:60px;
           }
  </style>
</head>
<body>
   <p>Click on any square below:</p>
   <span id="result"> </span>
   <div class="div" style="background-color:blue;"></div>
   <div class="div" style="background-color:green;"></div>
   <div class="div" style="background-color:red;"></div>
</body>
</html>

 

 

DOM 조작 관련 메소드 목록

 

MethodDescription
after( content )Insert content after each of the matched elements.
append( content )Append content to the inside of every matched element.
appendTo( selector )Append all of the matched elements to another, specified, set of elements.
before( content )Insert content before each of the matched elements.
clone( bool )Clone matched DOM Elements, and all their event handlers, and select the clones.
clone( )Clone matched DOM Elements and select the clones.
empty( )Remove all child nodes from the set of matched elements.
html( val )Set the html contents of every matched element.
html( )Get the html contents (innerHTML) of the first matched element.
insertAfter( selector )Insert all of the matched elements after another, specified, set of elements.
insertBefore( selector )Insert all of the matched elements before another, specified, set of elements.
prepend( content )Prepend content to the inside of every matched element.
prependTo( selector )Prepend all of the matched elements to another, specified, set of elements.
remove( expr )Removes all matched elements from the DOM.
replaceAll( selector )Replaces the elements matched by the specified selector with the matched elements.
replaceWith( content )Replaces all matched elements with the specified HTML or DOM elements.
text( val )Set the text contents of all matched elements.
text( )Get the combined text contents of all matched elements.
wrap( elem )Wrap each matched element with the specified element.
wrap( html )Wrap each matched element with the specified HTML content.
wrapAll( elem )Wrap all the elements in the matched set into a single wrapper element.
wrapAll( html )Wrap all the elements in the matched set into a single wrapper element.
wrapInner( elem )Wrap the inner child contents of each matched element (including text nodes) with a DOM element.
wrapInner( html )Wrap the inner child contents of each matched element (including text nodes) with an HTML structure.

 

 

 

 

Reference : http://www.tutorialspoint.com/jquery/jquery-dom.htm

 

 

 

 

💻 Programming/WAS

[Jeus 6] baseport 수정 방법

아래 두 개 파일에서 포트를 변경해주면 됩니다.


$JEUS_HOME/config/vhost.properties

$JEUS_HOME/bin/jeus.properties


[jeus@mycom config]$ cat vhost.properties
jeus.vhost.enabled=true
myhost=myhost:19736
example=myhost:21000


[bxtap4wje@Emerald bin]$ vi jeus.properties

.

.

# set up JEUS_BASEPORT.
 #JEUS_BASEPORT=9736
 JEUS_BASEPORT=19736
.

.


JEUS는 기본적으로 webadmin 포트를 baseport + 8 로 사용하므로 웹어드민 포트도 변경됨에 유의하셔야 합니다.

위 예에서는 19744로 접속을 하셔야 겠죠

💻 Programming/WAS

[Jeus 6] 관리자 비밀번호를 잊어버렸을 때

파일: accounts.xml
해당 파일에서 아래 <password> 부분을 copy & paste 하면 됨

 vi  $JEUS_HOME/config/$SERVERNAME/security/SYSTEM_DOMAIN/accounts.xml
----------------------------------------------------------------------------------------------------------
 <?xml version="1.0"?>
<accounts xmlns="http://www.tmaxsoft.com/xml/ns/jeus" version="6.0">
      <users>
        <user>
            <name>administrator</name>
            <password>{base64}amV1c2FkbWlu</password>
            <group>Administrators</group>
        </user>
    </users>
    <groups>
        <group>
            <description>A group for administrators</description>
            <name>Administrators</name>
        </group>
    </groups>
</accounts>
----------------------------------------------------------------------------------------------------------
다른 패스워드를 사용하고 싶다면 직접 base64 인코딩을 한 후, 그 값을 입력하면 된다.
단, base64로 인코딩 된 것을 알리기 위해 {base64}는 반드시 추가한다.
 
윈도우
 C:\Users\Administrator>java -classpath C:\TmaxSoft\JEUS6.0\lib\system\jeus.jar jeus.security.admin.Base64Coder encode jeusadmin
amV1c2FkbWlu

유닉스
java -classpath $JEUS_HOME/lib/system/jeus.jar jeus.security.admin.Base64Coder encode jeusadmin

amV1c2FkbWlu

java -classpath $JEUS_HOME/lib/system/jeus.jar jeus.security.admin.Base64Coder decode amV1c2FkbWlu

jeusadmin

팁 패스워드를 새로 넣을 경우
/$JEUS_HOME/bin/encryption base64 passwd
[base64] : [passwd] --> [encode:cGFzc3dk]
[base64] : [cGFzc3dk] --> [decode:passwd]

이렇게 결과 값을 얻어서 accounts.xml 파일에 빨간색 부분과 교체 후 저장하면 로그인이 가능합니다.


출처 : http://existence.tistory.com/60


💻 Programming/WAS

웹로직 default 어드민 서버 포트(7001) 변경

웹로직 default 어드민 서버 포트(7001) 변경

 

<Aug 16, 2011 5:03:50 PM GMT+09:00> <Emergency> <Security> <BEA-090087> <Server failed to bind to the configured Admin port. The port may already be used by another process.>
<Aug 16, 2011 5:03:50 PM GMT+09:00> <Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason: Server failed to bind to any usable port. See preceeding log message for details.>
<Aug 16, 2011 5:03:50 PM GMT+09:00> <Error> <Server> <BEA-002606> <Unable to create a server socket for listening on channel "Default[2]". The address 127.0.0.1 might be incorrect or another process is using port 7001: java.net.BindException: Address already in use.>
<Aug 16, 2011 5:03:50 PM GMT+09:00> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED>
<Aug 16, 2011 5:03:50 PM GMT+09:00> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down>
<Aug 16, 2011 5:03:50 PM GMT+09:00> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>
<Aug 16, 2011 5:03:50 PM GMT+09:00> <Error> <Server> <BEA-002606> <Unable to create a server socket for listening on channel "Default". The address 192.168.213.132 might be incorrect or another process is using port 7001: java.net.BindException: Address already in use.>
<Aug 16, 2011 5:03:50 PM GMT+09:00> <Error> <Server> <BEA-002606> <Unable to create a server socket for listening on channel "Default[3]". The address 0:0:0:0:0:0:0:1 might be incorrect or another process is using port 7001: java.net.BindException: Address already in use.>
<Aug 16, 2011 5:03:50 PM GMT+09:00> <Error> <Server> <BEA-002606> <Unable to create a server socket for listening on channel "Default[1]". The address fe80:0:0:0:20c:29ff:fee0:753c might be incorrect or another process is using port 7001: java.net.BindException: Address already in use.>

 

하나의 웹로직 머신에 업무상 다수의 도메인을 사용할 경우,
기본 포트가 7001인 웹로직 서버 도메인의 어드민 서버 구동시 포트 충돌 에러가 발생합니다.
이럴 경우 대처 방법은 간단합니다.

웹로직 도메인 설정 파일을 수정후 재기동 하면됩니다.

1. DOMAIN_HOME/config/config.xml
   

    <name>AdminServer</name>
    <listen-address/>


이러한 부분이 존재하는데요, 여기서 <name>태그 아래 부분에 <listen-port>태그를 추가후 재기동을 하면 됩니다.

    <name>AdminServer</name>
    <listen-port>7000</listen-port>
    <listen-address/>


이렇게 하면 되겠습니다.

 

즉, 웹로직 서버에는 다수의 도메인을 생성할 수 있으며 하나의 도메인은 각각의 콘솔이 존재한다는 것을 알 수 있습니다.

 

혹시, <listen-port>를 <listen-address>아랫부분에 추가할 경우 아래와 같은 에러가 발생하는 것을 확인 할 수 있었습니다.
주의하시기 바랍니다.

<Aug 16, 2011 5:32:37 PM GMT+09:00> <Critical> <WebLogicServer> <BEA-000362> <Server failed. Reason: [Management:141245]Schema Validation Error in /home/oracle/Middleware/domains/base_domain/base_domain/config/config.xml see log for details. Schema validation can be disabled by starting the server with the command line option: -Dweblogic.configuration.schemaValidationEnabled=false>
<Aug 16, 2011 5:32:37 PM GMT+09:00> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FAILED>
<Aug 16, 2011 5:32:37 PM GMT+09:00> <Error> <WebLogicServer> <BEA-000383> <A critical service failed. The server will shut itself down>
<Aug 16, 2011 5:32:37 PM GMT+09:00> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to FORCE_SHUTTING_DOWN>

 

 

 

출처 : http://blog.daum.net/_blog/BlogTypeView.do?blogid=0F6LZ&articleno=12283804

 

 

 

 

 

### 캐릭터셋 변경전 확인 사항 :

sqlplus '/as sysdba'

sql>select instance from v$thread;

INSTANCE
----------------
ora9i


oracle\ora92\network\admin\snmp_ro.ora 를 봐도 된다.
=> snmp.SID.Oracle = ORACLE




select parameter, value from nls_database_parameters where parameter like '%CHAR%';

PARAMETERVALUE
NLS_NUMERIC_CHARACTERS.,
NLS_CHARACTERSETKO16KSC5601
NLS_NCHAR_CONV_EXCPFALSE
NLS_NCHAR_CHARACTERSETUTF8


########### 캐릭터셋 변경 ##########################

****  connect sys as sysdba;

NLS CHARACTERSET 변경방법 (DB REBUILD 없이)
Bulletin no : 10016

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

  데이타베이스의  CHARACTER SET은 데이타 딕셔너리 테이블인 sys.props$에
 들어 있다

   SQL>desc sys.props$
   Name                                Null?                  Type
   -------------------------------  -----------------      ---------------
   NAME                               NOT NULL             VARCHAR2(30)
   VALUE$                                                  VARCHAR2(2000)
   COMMENT$                                                VARCHAR2(2000)

   SQL>column c1 format a30
   SQL>select name c1, value$ c1 from sys.props$;

   C1                              C1
   -----------------------------   ------------------------------
   DICT.BASE                        2
   NLS_LANGUAGE                     AMERICAN
   NLS_TERRITORY                    AMERICA
   NLS_CURRENCY                     $
   NLS_ISO_CURRENCY                 AMERICA
   NLS_NUMERIC_CHARACTERS           .,
   NLS_DATE_FORMAT                  DD-MON-YY
   NLS_DATE_LANGUAGE                AMERICAN
   NLS_CHARACTERSET                 US7ASCII
   NLS_SORT                         BINARY
   GLOBAL_DB_NAME                   NLSV7.WORLD
   
  여기서 NLS_CHARACTERSET에 현재 DB의 CHARACTER SET이 들어 있는데 이 값을
 변경하여 DB의 CHARACTER SET을 변경할 수 있다. 여기서는 US7ASCII에서
 KO16KSC5601 로 옮기는 경우를 알아보자.

 우선 바꾸고자 하는 CHRACTER SET이 지원되는 지를 다음 명령으로 확인한다.

         select convert('a','WE8DEC','KO16MSWIN949') from dual; 

  만약 이 Select 문에서 ORA-01482 에러가 발생하면 지정한 CHARACTER SET이
 지원되지 않는  경우이며  에러가 발생하지 않으면 CHARACTER SET을 변경할 수
 있다.
 
  작업을 하기전에는 만약을 위해서 DB 전체를 백업 받아두도록 한다.
  CHARACTER SET 을 잘못 변경하면 DB 를 OPEN 할수가 없기 때문이다.
  ---------------------------------------------------------------

1.  다음의 Update문을 실행하여 CHARACTER SET을 변경한다.

   UPDATE sys.props$
   SET value$ = 'WE8DEC'
   WHERE name = 'NLS_CHARACTERSET';

  Update 시에 NLS_CHARACTERSET을 지원되지 않는 값으로 잘못 설정하거나
 실수로 콘트롤 문자 같은 것이 들어가게 되면 DB가 Shutdown 된 다음에는
 Startup 이 안 되므로 Update 후에 다음 명령으로 확인을 한 다음에  Commit을
 하도록 한다.

        select name, value$
        from sys.props$
        where value$ = 'KO16KSC5601';

 Select   제대로 출력되면 Commit 하고 Shutdown 했다가 Startup 하게 되면
 새로운 CHARACTER SET 값을 갖게 된다. SELECT가 안 되면 ROLLBACK하고 UPDATE
 부터 다시 하도록 한다.

2. 환경 변수 NLS_LANG 을 변경한다.

.profile ( or .cshrc) 에서

NLS_LANG=American_America.KO16KSC5601; export NLS_LANG

or

setenv NLS_LANG American_America.KO16KSC5601






출처 : http://develop.sunshiny.co.kr/201



프로젝트를 진행하다 보면 테이블 모델링을 수정해야 할 때가 있다. 이런 저런 추가요구가 들어오면 말이다.

 

그럴 때는 간단하게 SQL 한문장으로 후딱 해치워 버리면 된다.

 

§ 아래는 테이블에 하나의 컬럼을 추가로 만들어 주기위한 SQL문이다.

 

ALTER TABLE table_name ADD column_name datatype

 

§ 테이블에서 필요없는 컬럼을 삭제하려면 아래와 같은 명령어를 사용하면 된다.

 

ALTER TABLE table_name DROP COLUMN column_name

§ 또한 특정 컬럼의 데이타 타입을 변경하려면 아래와 같은 명령어를 사용하면 된다.

Oracle 10G and later: ALTER TABLE table_name MODIFY column_name datatype




§ 오라클이 아닌 다른 데이타베이스 시스템의 경우 아래와 같이 사용하면 된다.

SQL Server / MS Access:

ALTER TABLE table_name ALTER COLUMN column_name datatype

My SQL / Oracle:

ALTER TABLE table_name MODIFY COLUMN column_name datatype


테이블 백업을 할때에 export / import 를 이용할 수도 있지만 단순하게 rename 명령어를 이용할 수도 있습니다. 또한 create ~ as select ~ 를 이용할 수도 있습니다.

하지만 오늘은 테이블 명을 변경하고 새로 테이블을 생성함으로써 백업을 할 수 있는 방법을 소개하도록 하겠습니다. 참고로 이 방법은 blob데이타가 많은 경우에 상당히 유용합니다.


Step by Step

1) Query table name and index names linked to the table you want to backup

2) Rename table name

3) Rename indexes' name ( if specified explicitly when it is created )

4) Rename constraints' name ( if specified explicitly when it is created )

4) Use the same DDL used to create the renamed table


※ This way is very simple and fast then using "create table ~ as select * from ~" statement when the table has a huge blob data.



1) 변경하고자하는 테이블에 어떤 인덱스들이 있는지 조회합니다.

SQL > select index_name, table_name from user_indexes;


2) 테이블명을 변경합니다.

SQL > rename old_table to new_table;


3) 인덱스명을 변경합니다. ( 인덱스명이 자동생성된 것이 아닌 경우에만 )

SQL > alter index pk_old_table rename to pk_new_table;


4) 제약사항명을 변경합니다. ( 제약사항명이 자동생성된 것이 아닌 경우에만 )

SQL > select * from user_cons_columns where table_name='{table_name};

SQL > alter table {table name} rename constraint {constraint name} to {new constraint name}


5) 기존 테이블을 생성했던 DDL을 사용하여 테이블을 새로 생성합니다.

SQL > create table .........