'2009/03'에 해당되는 글 11건

한 주의 시작 요일은? :: 2009/03/31 13:50

ISO 8601은 날짜와 시간의 표기에 대한 국제 표준이다. 우리나라를 비롯해 중국, 일본 등에서 달력을 보면 한 주가 일요일부터 시작이지만, 대부분의 서유럽 국가들에서는 한 주가 월요일부터 시작하고 이것이 현재 국제 표준이다.
 
MS 아웃룩을 보면 월 일정 화면의 달력을 보면 한글버전은 일요일부터 한 주가 시작하나 영문 버전은 월요일부터 시작한다. 구글 캘린더는 디폴트로 월요일부터 한 주가 시작하고, 환경설정에서 한 주 시작요일을 지정할 수 있다.

한 해의 첫 주는 1월 1일을 포함 주가 되며, 마지막 주는 12월의 마지막 일요일을 포함한 주이다. 끝에 남은 잔여일은 다음 해의 첫 주에 해당한다. 그래서 통상 한 해에 52주가 있으며 마지막 일요일이 꽉 찰 경우 53주가 되겠다.

글로벌 웹싸이트를 만들 경우 지역별로 선호하는 달력을 제공하면 좋겠지만, 적어도 날짜/시간에도 표준을 지원하는 것이 바람직 할 것이다.

참조:
    http://en.wikipedia.org/wiki/ISO_8601
    http://en.wikipedia.org/wiki/ISO_week_date

What is the Trend in Browser Usage? :: 2009/03/26 18:49

웹브라우저 사용 통계를 살펴볼 수 있는 곳이다. IE에 전적으로 의존적으로 ActiveX 수렁에 빠져 헤어나오지 못하는 우리나라 웹싸이트들은 반성하고 또 반성해야 한다. 특히 금융권.. 인터넷 뱅킹을 하려면 ActiveX를 적어도 4개 이상을 줄창 깔아야 하는데 여간 번거롭지 않다. 다른 은행 싸이트를 가면 또 줄창 깔아야 한다. IE는 업그레이드 될 때마다 호환성 문제도 만만찮다.
  • W3CSchool's Browser Statistics
    - W3CSchool 로그 파일을 기반으로 분석한 데이터임.
    - Internet Explorer와 Firefox가 대세이고, Chrome과 IE8 등장이 흥미롭다.
2009 IE7 IE6 IE8 Fx Chrome S O
February 25.4% 17.4% 0.8% 46.4% 4.0% 3.0% 2.2%
January 25.7% 18.5% 0.6% 45.5% 3.9% 3.0% 2.3%
2008 IE7 IE6 IE5 Fx Chrome S O
December 26.1% 19.6%   44.4% 3.6% 2.7% 2.4%
November 26.6% 20.0%   44.2% 3.1% 2.7% 2.3%
October 26.9% 20.2%   44.0% 3.0% 2.8% 2.2%
September 26.3% 22.3%   42.6% 3.1% 2.7% 2.0%
August 26.0% 24.5%   43.7%   2.6% 2.1%

Web Browsers
1 Internet Explorer 7.0 31.61%
2 Internet Explorer 6.0 25.95%
3 Firefox 3.0 15.75%
4 Firefox 2.0 13.53%
5 Firefox 1.5 1.64%
6 Safari 3.1 1.14%
7 Safari 3.0 0.77%
8 Opera 9.2 0.65%
9 Mozilla 1.9 0.60%
10 Opera 9.6 9.6 0.51%
Operating Systems
1 Windows XP 71.14%
2 Windows Vista 14.24%
3 Mac OS X 5.09%
4 Linux 2.13%
5 Windows 2000 2.00%
6 Windows 2003 0.68%
7 Windows 98 0.50%
8 Windows ME 0.21%
9 SymbianOS 0.13%
10 WAP 0.05%

XHTML/CSS Validation :: 2009/03/26 10:24

WC3에서 제공하는 HTML/XHTML 및 CSS, ATOM/RSS에 대한 문법 유효성을 검사하는 서비스이다.

Three Basic Conditionals :: 2009/03/25 21:53

Three Basic Conditionals

1. First (probable) conditional
  • If it rains, We'll cancel the picnic.
  • We will go on a picnic if it does not rain.

2. Second (improbable) conditional
  • If I were you, I would get more rest.
  • I'd buy you a new car if I were rich.


3. Third (past improbable) conditional

  • If I hadn't gone to that party years ago, I wouldn't have met my future wife.


Common Mistakes:

If I would have went there, I would have drank beer all night.
--> If I had gone there, I would have drunk beer all night.

New Features in EJB 3.1 :: 2009/03/20 19:14

Java EE 6에 포함되는 EJB 3.1의 주요 특징을 살펴볼 수 있는 글이다.

Free Chart API 모음 :: 2009/03/20 09:31

무료로 사용가능한 챠트 이미지 생성 API들이다.

Spring + JUnit 4 + DbUnit 이용한 데이터 검증 :: 2009/03/18 12:52

Spring은 JUnit 4와 함께 어노테이션 기반의 테스트 케이스를 쉽게 작성할 수 있는 환경을 제공한다. Spring은 JUnit4ClassRunner을 확장한 SpringJUit4ClassRunner의 제공으로 어플리케이션 컨텍스트를 통한 테스트 환경 설정을 쉽게 할 수 있다. 그리고 DB 단위테스트에 유용한 프레임워크인 DbUnit을 이들과 함께 사용하면 DB 데이터를 사용하는 다양한 테스트를 효율적으로 작성할 수 있다.

2개의 DB간의 데이터 마이그레이션 이후에 원본 DB와 대상 DB 간의 동일한 테이블에 대해서 데이터 검증을 하는 테스트 케이스를 간단히 만들어 보자.

1. 스프링 설정
- applicationContext-test.xml
- 2개의 DB에 대한 데이터 소스 2개를 정의한다.
<context:property-placeholder location="jdbc.properties" />

<bean id="dataSource1" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close"> <property name="driverClassName" value="${ds1.jdbc.driverClassName}" /> <property name="url" value="${ds1.jdbc.url}" /> <property name="username" value="${ds1.jdbc.username}" /> <property name="password" value="${ds1.jdbc.password}" /> </bean> <bean id="dataSource2" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close"> <property name="driverClassName" value="${ds2.jdbc.driverClassName}" /> <property name="url" value="${ds2.jdbc.url}" /> <property name="username" value="${ds2.jdbc.username}" /> <property name="password" value="${ds2.jdbc.password}" /> </bean>

2. 테스트 케이스
- migration.test.DataVerificationTest
- SpringJUnit4ClassRunner를 이용하여 어플리케이션 컨텍스트를 설정하고, @Autowired를 통해 DI를 수행한다.
- FlatXmlDataSet 클래스를 이용해서 비교 대상 테이블의 데이터를 XML로 저장한다.
- 맨 아래의 getConnection() 메소드에서는 오라클 10g의 데이터 타입 지원을 위한 설정을 추가했다.
package migration.test;

import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.dbunit.Assertion;
import org.dbunit.database.DatabaseConfig;
import org.dbunit.database.DatabaseConnection;
import org.dbunit.database.IDatabaseConnection;
import org.dbunit.database.QueryDataSet;
import org.dbunit.dataset.ITable;
import org.dbunit.dataset.xml.FlatXmlDataSet;
import org.dbunit.ext.oracle.Oracle10DataTypeFactory;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * DataVerificationTest
 * 
 * @author Sehwan Noh (sehwan at java2go.net)
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:applicationContext-test.xml" })
public class DataVerificationTest {

    private final Log logger = LogFactory.getLog(getClass());

    @Autowired
    @Qualifier("dataSource1")
    private DataSource dataSource1;

    @Autowired
    @Qualifier("dataSource2")
    private DataSource dataSource2;

    private Connection conn1;

    private Connection conn2;

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception {
        conn1 = DataSourceUtils.getConnection(dataSource1);
        conn2 = DataSourceUtils.getConnection(dataSource2);
    }

    @After
    public void tearDown() throws Exception {
        DataSourceUtils.releaseConnection(conn1, dataSource1);
        DataSourceUtils.releaseConnection(conn2, dataSource2);
    }

    /**
     * Test to verify TABLE_A
     */
    @Test
    public void testPeDocMain() throws Exception {
        final String tableName = "TABLE_A";
        final String query = "SELECT * FROM " + tableName;
        logger.debug("query=" + query);

        assertTableEquals(conn1, conn2, tableName, query);
    }

    /**
     * Test to verify TABLE_B
     */
    @Test
    public void testPeDocDetail() throws Exception {
        final String columnNames = "COLUMN1, COLUMN2, COLUMN3";
        final String tableName = "TABLE_B";
        final String query = "SELECT " + columnNames + " FROM " + tableName;
        logger.debug("query=" + query);

        assertTableEquals(conn1, conn2, tableName, query);
    }

    private void assertTableEquals(Connection conn1, Connection conn2, 
                String tableName, String query) throws Exception {
        // Table1
        // IDatabaseConnection dbConn1 = new DatabaseConnection(conn1);
        IDatabaseConnection dbConn1 = getConnection(conn1);
        QueryDataSet dataSet1 = new QueryDataSet(dbConn1);
        dataSet1.addTable(tableName, query);
        FlatXmlDataSet.write(dataSet1, new FileOutputStream("./test-output/"
                + tableName + "_1.xml"));
        ITable table1 = dataSet1.getTable(tableName);

        // Table2
        // IDatabaseConnection dbConn2 = new DatabaseConnection(conn2);
        IDatabaseConnection dbConn2 = getConnection(conn2);
        QueryDataSet dataSet2 = new QueryDataSet(dbConn2);
        dataSet2.addTable(tableName, query);
        FlatXmlDataSet.write(dataSet2, new FileOutputStream("./test-output/"
                + tableName + "_2.xml"));
        ITable table2 = dataSet2.getTable(tableName);

        if (logger.isInfoEnabled()) {
            logger.info("==========================================");
            logger.info(tableName);
            logger.info("------------------------------------------");
            logger.info("Table1 Row Count: " + table1.getRowCount());
            logger.info("Table2 Row Count: " + table2.getRowCount());
            logger.info("==========================================");
        }

        // Assertion
        // Assert.assertEquals(table1.getRowCount(), table2.getRowCount());
        Assertion.assertEquals(table1, table2);
    }

    private IDatabaseConnection getConnection(Connection conn) throws Exception {
        // IDatabaseConnection dbConn = new DatabaseConnection(conn);
        DatabaseMetaData databaseMetaData = conn.getMetaData();
        IDatabaseConnection dbConn = new DatabaseConnection(conn, 
                databaseMetaData.getUserName().toUpperCase());
        DatabaseConfig config = dbConn.getConfig(); // Orable 10g
        config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, 
                new Oracle10DataTypeFactory());
        config.setFeature(DatabaseConfig.FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES,
                Boolean.TRUE);
        return dbConn;
    }
}

3. ANT 빌드 파일
- junit 과 junitreport 를 사용하여 테스크를 작성한 예이다.
<target name="test-verify">
    <mkdir dir="${test.output.dir}" />
    <junit fork="yes" printsummary="yes" haltonfailure="false">
        <classpath refid="classpath" />
        <formatter type="plain" usefile="true" />
        <formatter type="xml" usefile="true" />
        <batchtest fork="yes" todir="${test.output.dir}">
            <fileset dir="${src.dir}">
                <include name="**/test/*Test.java" />
            </fileset>
        </batchtest>
    </junit>
</target>

<target name="test-report">
    <mkdir dir="${test.report.dir}" />
    <junitreport todir="${test.output.dir}">
        <fileset dir="${test.output.dir}">
            <include name="TEST-*.xml" />
        </fileset>
        <report format="frames" todir="${test.report.dir}" />
    </junitreport>
</target>

4. 테스트 결과 리포트
- HTML로 작성된 JUnit 테스트 결과 리포트 예이다.
사용자 삽입 이미지

보안 관련 용어 2 :: 2009/03/12 17:40

Term Definition

Authentication

A process used to confirm the identity of a person or to prove the integrity of specific information.

Asymmetric cryptosystem

An algorithm or series of algorithms that provide a secure key pair.

Certificate

a computer-based record which-

  • identifies the certification authority issuing it;
  • names or identifies its subscriber;
  • contains the subscriber's public key; and
  • is digitally signed by the certification authority issuing it.

Certificate policy

A named set of rules that indicates the applicability of a certificate to a particular community and/or class of application with common security requirements. For example, a particular certificate policy might indicate applicability of a type of certificate to the authentication of electronic data interchange transactions for the trading of goods within a given price range.

Certification Authority (CA)

A person who issues a certificate.

Certification Authority disclosure record

An on-line and publicly accessible record which concerns a licensed certification authority which is kept by the Controller.

Certification path

An ordered sequence of certificates which, together with the public key of the initial object in the path, can be processed to obtain that of the final object in the path.

Certification Practice Statement

A declaration of the practices which a certification authority employs in issuing certificates generally, or employed in issuing a particular certificate.

Certification Revocation List (CRL)

A list of suspended or revoked certificates.

Controller

The Controller of Certification Authorities appointed under Section 3 of the DSA.

Date/time stamp service

A date/time stamp service recognised by the Controller under the DSA.

Digital signature

a transformation of a message using an asymmetric cryptosystem so that a person having the initial message and the signer's public key can accurately determine whether the transformation was created using the private key that corresponds to the signer's public key; and whether the message has been altered since the transformation was made.

Electronic Data Interchange (EDI)

Technology involving computer-to-computer exchange of structured data between two or more companies sent in a form that allows automatic processing, with no manual intervention. It is relevant to any business that regularly exchanges information, for example, client or company records, but is especially relevant if you send and receive orders, invoices, statements and payments.

Issue a certificate

The act of a certification authority in creating a certificate and notifying the subscriber listed in the certificate of the contents of the certificate.

Key pair

A private key and its corresponding public key in an asymmetric cryptosystem, where the public key can verify a digital signature that the private key creates.

Licensed certification authority

A certification authority to whom a licence has been issued by the Controller and whose licence is in effect.

Message

A digital representation of information.

Notify

To communicate a fact to another person in a manner reasonably likely under the circumstances to impart knowledge of the information to the other person.

Object Identifier (OID)

A value comprised of a sequence of integer components, which can be assigned to a registered object and which has the property of being unique among all object identifiers.

Person

A natural person or a body of persons, corporate or unincorporated, capable of signing a document, either legally or as a matter of fact.

Policy qualifier

Policy-dependent information that accompanies a certificate policy identifier in an X.509 certificate.

Private key

The key of a key pair used to create a digital signature.

Public key

The key of a key pair used to verify a digital signature.

Publish

To record or file in a repository.

Provisions

A collection of practice and/or policy statements, spanning a range of standard topics, for use in expressing a certificate policy definition or CPS employing the approach described in this framework.

Recipient

A person who receives or has a digital signature and is in a position to rely on it (see Relying Party).

Recognised repository

A repository recognised by the Controller under Section 68 of the DSA.

Reliance limit

The monetary amount recommended for reliance on a certificate under Section 60 of the DSA.

Registration Authority (RA)

An entity that is responsible for identification and authentication of certificate subjects, but that does not sign or issue certificates (e.g., a RA is delegated certain tasks on behalf of a CA).

Relying party

A recipient of a certificate who acts in reliance on that certificate and/or digital signature verified using that certificate. In this document, the terms "certificate user" and "relying party" are used interchangeably.

Repository

A system for storing and retrieving certificates and other information relevant to digital signatures.

Revoke certificate

To make a certificate ineffective permanently from a specified time forward.

RSA

The first significant asymmetric cryptographic algorithm; the initials stand for Rivest, Shamir and Adleman, its inventors.

Note that RSA can also refer to a particular commercial entity; see RSA DSI. RSA is protected by US patents held by RSA DSI. It is not protected outside the US.

Subscriber

a person who-

  • is the subject listed in a certificate;
  • accepts the certificate; and
  • holds a private key which corresponds to a public key listed in that certificate

Suspend a certificate

To make a certificate ineffective temporarily for a specified time forward.

Trustworthy system

computer hardware and software which-

  • are reasonably secure from intrusion and misuse;
  • provide a reasonable level of availability, reliability and correct operation; and
  • are reasonably suited to performing their intended functions.

Uniform Resource Locator (URL)

a standardised addressing scheme which identifies a particular Internet resource, such as a Web page, a gopher

server, a library catalogue, an image, or a text file.

Valid certificate

a certificate which-

  • a licensed certification authority has issued;
  • has been accepted by the subscriber listed in it;
  • has not been revoked or suspended; and
  • has not expired:

Provided that a transactional certificate is a valid certificate only in relation to the digital signature incorporated in it by reference.

Verify a digital signature

in relation to a given digital signature, message and public key, to determine accurately that-

  • the digital signature was created by the private key corresponding to the public key; and
  • the message has not been altered since its digital signature was created.

Writing / written

Includes any handwriting, typewriting, printing, electronic storage or transmission, or any other method of recording information or fixing information in a form capable of being preserved.


출처: http://www.digicert.com.my/cps.htm

보안 관련 용어 1 :: 2009/03/12 16:39

Acronyms and Abbreviations

ARL Authority Revocation List
CA Certification Authority
CPS Certification Practice Statement
CRL Certificate Revocation List
DSA Digital Signature Act 1997
DSR Digital Signature Regulations 1998
DN Distinguished Name
FIPS Federal Information Processing Standard
FTP File Transfer Protocol
HTTP Hypertext Transfer Protocol
HTTPS Hypertext Transfer Protocol with SSL
IP Internet Protocol
ISO International Standard Organisation
ITU International Telecommunications Union
PIN Personal Identification Number
PKCS Public Key Cryptography Standard
PKI Public Key Infrastructure
RA Registration Authority
RP Registration Personnel
RSA Rivest, Shamir, Adleman
SSL Secure Socket Layer
URL Uniform Resource Locator
WWW World Wide Web
X.509 ITU-T standard for certificates format

XML Canonicalization :: 2009/03/05 09:54

XML Canonicalization은 XML 문서 또는 XPath 노드 셋에 대한 표준적인 직렬화 표현이다. XML은 전자 상거래를 비롯해 다양한 분야에서 널리 수용하여 사용되고 있으나, XML 문서는 논리적으로 동일하나 물리적으로 여러 다른 형태가 존재할 수 있어, XML 디지털 서명과 같은 물리적 형태로써 유효성을 판단하는 응용 프로그램에서는 문제점이 발생할 수 있다.

따라서 이런 단점을 해결하기 위해 W3C에서는 논리적으로 동일한 XML문서를 물리적으로 동일하게 변환시키도록 XML Canonicalization(C14N) 알고리즘을 제안하여 사용하도록 권고하고 있다. 다음 예시는 물리적으로 모두 다르게 표현되어 있지만, 논리적으로는 동일한 XML이다. 맨 아래의 XML 표현이 Canonical XML이다.

<data a="1" b="2" c="3"/>

<data b="2" c="3" a="1"/>

<data c="3" a="1" b="2"></data>

<data c="3" a="1"
            b="2"></data>

<data a="1" b="2" c="3"></data>

다음은 참고할 만한 싸이트들이다.