<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SukmoonLee Blog &#187; Sukmoon Lee</title>
	<atom:link href="http://blog.sukmoonlee.com/wordpress/archives/author/smlee/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.sukmoonlee.com/wordpress</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Thu, 20 Sep 2012 00:01:14 +0000</lastBuildDate>
	<language>ko-KR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>jWhois</title>
		<link>http://blog.sukmoonlee.com/wordpress/archives/305</link>
		<comments>http://blog.sukmoonlee.com/wordpress/archives/305#comments</comments>
		<pubDate>Wed, 19 Sep 2012 23:58:48 +0000</pubDate>
		<dc:creator>Sukmoon Lee</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Program]]></category>
		<category><![CDATA[jwhois]]></category>
		<category><![CDATA[whois]]></category>

		<guid isPermaLink="false">http://blog.sukmoonlee.com/wordpress/?p=305</guid>
		<description><![CDATA[java로 whois 클라이언트를 하나 만들었습니다. 기존의 UNIX 환경에서 사용하던 whois와 유사한 기능으로 구현을 했습니다. http://blog.sukmoonlee.com/jWhois/jWhois.jar 자바의 문자열이 유니코드로 처리되는 특징을 이용해서, 로컬문자로 제공되는 WHOIS 서비스를 자바의 유니코드로 변환해서 읽은 다음에 사용자의 환경에 따라서 결과를 출력하도록 되어 있습니다. 그래서 UTF-8 환경에서 다양한 WHOIS 서버의 문자를 처리해서 결과를 아래와 같이 얻을수 있습니다. (일단 현재 버전에서는 kr과 jp만 <a href='http://blog.sukmoonlee.com/wordpress/archives/305' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>java로 whois 클라이언트를 하나 만들었습니다.<br />
기존의 UNIX 환경에서 사용하던 whois와 유사한 기능으로 구현을 했습니다.</p>
<blockquote><p>
<a href="http://blog.sukmoonlee.com/jWhois/jWhois.jar">http://blog.sukmoonlee.com/jWhois/jWhois.jar</a>
</p></blockquote>
<p>자바의 문자열이 유니코드로 처리되는 특징을 이용해서, 로컬문자로 제공되는 WHOIS 서비스를 자바의 유니코드로 변환해서 읽은 다음에 사용자의 환경에 따라서 결과를 출력하도록 되어 있습니다.<br />
그래서 UTF-8 환경에서 다양한 WHOIS 서버의 문자를 처리해서 결과를 아래와 같이 얻을수 있습니다.<br />
(일단 현재 버전에서는 kr과 jp만 지원합니다. 나머지 서버들은 대부분 영문으로 제공을 하더군요.)</p>
<pre>
[smlee@localhost jWhois]$ java -jar jWhois.jar --help
jWhois version 0.9.1-20120918, Copyright (C) 2012 SukmoonLee.

Usage: java -jar jWhois.jar  [OPTIONS] [QUERY]
          --version                  display version number and patch level
          --help                     display this help
          -h HOST, --host=HOST       explicitly query HOST
          -n, --no-redirect          disable content redirection
          -i, --display-redirections display all redirects instead of hiding them
          -p PORT                    use port number PORT (in conjunction with HOST)


        Report bugs to smlee@sukmoonlee.com


[smlee@localhost jWhois]$ java -jar jWhois.jar netpia.com
[Querying netpia.com]
[Redirected to whois.verisign-grs.com] - 330 msec
[Querying netpia.com]
[Redirected to whois.ibi.net] - 621 msec
[Querying netpia.com]
[whois.ibi.net] - 2177 msec
Welcome to NETPIA.COM's WHOIS Server


# ENGLISH

Registrant:
    Netpia
    Gangseo-gu 16F, WoolimBlue9 Bldg. A, 240-21, Yeomchang-dong, Seoul

    Domain Name: netpia.com
    Registrar: NETPIA.COM, INC.(http://www.ibi.net)

    Administrative Contact:
        Netpia     webmaster@ibi.net
        Gangseo-gu 16F, WoolimBlue9 Bldg. A, 240-21, Yeomchang-dong, Seoul,  KR
        +82.0236651233

    Technical Contact:
        Netpia     webmaster@ibi.net
        Gangseo-gu 16F, WoolimBlue9 Bldg. A, 240-21, Yeomchang-dong, Seoul,  KR
        +82.0236651233

     Billing Contact:
        Netpia     webmaster@ibi.net
        Gangseo-gu 16F, WoolimBlue9 Bldg. A, 240-21, Yeomchang-dong, Seoul,  KR
        +82.0236651233

     Record created on........: 31-Mar-1998 EDT.
     Record expires on........: 31-Mar-2013 EDT.
     Record last updated on...: 10-Mar-2012 EDT.

     Domain Name Servers in listed order:
     NS.NETPIA.COM      61.82.71.230
     NS2.NETPIA.COM

# KOREAN(UTF-8)

등록인:
    Netpia
    Gangseo-gu 16F, WoolimBlue9 Bldg. A, 240-21, Yeomchang-dong, Seoul

    도메인이름: netpia.com
    등록대행자: NETPIA.COM, INC.(http://www.ibi.net)

    관리담당자:
        Netpia     webmaster@ibi.net
        Gangseo-gu 16F, WoolimBlue9 Bldg. A, 240-21, Yeomchang-dong, Seoul,  KR
        +82.0236651233

    기술담당자:
        Netpia     webmaster@ibi.net
        Gangseo-gu 16F, WoolimBlue9 Bldg. A, 240-21, Yeomchang-dong, Seoul,  KR
        +82.0236651233

    과금담당자:
        Netpia     webmaster@ibi.net
        Gangseo-gu 16F, WoolimBlue9 Bldg. A, 240-21, Yeomchang-dong, Seoul,  KR
        +82.0236651233

     등록일........: 31-Mar-1998 EDT.
     사용 종료일...: 31-Mar-2013 EDT.
     최근 변경일...: 10-Mar-2012 EDT.

     네임서버 정보:
     NS.NETPIA.COM      61.82.71.230
     NS2.NETPIA.COM


<a href='http://www.ibi.net/' target='_blank'><img src='http://www.ibi.net/images/r_domain_01.gif'></a><br />
 Please register domain name at www.ibi.net


[smlee@localhost jWhois]$ java -jar jWhois.jar netpia.kr
[Querying netpia.kr]
[Redirected to whois.kr] - 364 msec
[Querying netpia.kr]
[whois.kr] - 126 msec
query: netpia.kr

# KOREAN


도메인이름                  : netpia.kr
등록인                      : 김태영
책임자                      : 김태영
책임자 전자우편             : tim@solf.co.kr
등록일                      : 2007. 02. 28.
최근 정보 변경일            : 2008. 04. 12.
사용 종료일                 : 2013. 02. 28.
정보공개여부                : N
등록대행자                  : (주)아이네임즈(http://www.inames.co.kr)

1차 네임서버 정보
   호스트이름               : ns1.uhost.co.kr
   IP 주소                  : 202.31.186.220

2차 네임서버 정보
   호스트이름               : ns2.uhost.co.kr
   IP 주소                  : 118.129.168.68

네임서버 이름이 .kr이 아닌 경우는 IP주소가 보이지 않습니다.

# ENGLISH


Domain Name                 : netpia.kr
Registrant                  : TAE YEONG KIM
Administrative Contact(AC)  : TAE YEONG KIM
AC E-Mail                   : tim@solf.co.kr
Registered Date             : 2007. 02. 28.
Last updated Date           : 2008. 04. 12.
Expiration Date             : 2013. 02. 28.
Publishes                   : N
Authorized Agency           : Inames Co., Ltd.(http://www.inames.co.kr)

Primary Name Server
   Host Name                : ns1.uhost.co.kr
   IP Address               : 202.31.186.220

Secondary Name Server
   Host Name                : ns2.uhost.co.kr
   IP Address               : 118.129.168.68


- KISA/KRNIC Whois Service -



[smlee@localhost jWhois]$ java -jar jWhois.jar netpia.jp
[Querying netpia.jp]
[Redirected to whois.jprs.jp] - 365 msec
[Querying netpia.jp]
[whois.jprs.jp] - 178 msec
[ JPRS database provides information on network administration. Its use is    ]
[ restricted to network administration purposes. For further information,     ]
[ use 'whois -h whois.jprs.jp help'. To suppress Japanese output, add'/e'     ]
[ at the end of command, e.g. 'whois -h whois.jprs.jp xxx/e'.                 ]

Domain Information: [ドメイン情報]
[Domain Name]                   NETPIA.JP

[登録者名]                      （有）ハンドインハンド
[Registrant]                    Hand in Hand Inc.

[Name Server]                   m1.stage21.net
[Name Server]                   y2.netpia.ne.jp
[Signing Key]

[登録年月日]                    2001/03/26
[有効期限]                      2013/03/31
[状態]                          Active
[最終更新]                      2012/04/01 01:05:00 (JST)

Contact Information: [公開連絡窓口]
[名前]                          （有）ハンドインハンド
[Name]                          Hand in Hand Inc.
[Email]                         kanri-domain@netpia.jp
[Web Page]
[郵便番号]                      242-0018
[住所]                          神奈川県大和市深見西2-1-1
[Postal Address]                2-1-1, Fukami-Nishi,
                                Yamato-City, Kanagawa
[電話番号]                      046-265-1700
[FAX番号]                       020-4622-6502

</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sukmoonlee.com/wordpress/archives/305/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>whois protocol</title>
		<link>http://blog.sukmoonlee.com/wordpress/archives/296</link>
		<comments>http://blog.sukmoonlee.com/wordpress/archives/296#comments</comments>
		<pubDate>Wed, 19 Sep 2012 10:23:00 +0000</pubDate>
		<dc:creator>Sukmoon Lee</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[iana]]></category>
		<category><![CDATA[protocol]]></category>
		<category><![CDATA[whois]]></category>

		<guid isPermaLink="false">http://blog.sukmoonlee.com/wordpress/?p=296</guid>
		<description><![CDATA[DNS 관련일을 하게 되면 자연적으로 도메인과 많은 관련성이 있습니다. 특히 도메인을 이해하기 위해서는 Registry-Registrar 개념과 DNS 위임구조를 알아야 합니다. 도메인의 위임정보를 알기 위해서 WHOIS라는 서비스를 제공하고 있습니다. 아주 오래된 프로토콜로 TCP 43번 포트로 제공하고 있는 프로토콜입니다. (DNS가 53번이므로 외우기도 쉽습니다.) 해당 프로토콜에 대해서는 영문위키를 보면 금방 이해를 할수 있으며, 간단히 telnet 으로도 확인이 가능합니다. Socket에서 <a href='http://blog.sukmoonlee.com/wordpress/archives/296' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>DNS 관련일을 하게 되면 자연적으로 도메인과 많은 관련성이 있습니다.</p>
<p>특히 도메인을 이해하기 위해서는 Registry-Registrar 개념과 DNS 위임구조를 알아야 합니다.<br />
도메인의 위임정보를 알기 위해서 WHOIS라는 서비스를 제공하고 있습니다.</p>
<p>아주 오래된 프로토콜로 TCP 43번 포트로 제공하고 있는 프로토콜입니다.<br />
(DNS가 53번이므로 외우기도 쉽습니다.)</p>
<p>해당 프로토콜에 대해서는 영문위키를 보면 금방 이해를 할수 있으며, 간단히 telnet 으로도 확인이 가능합니다.<br />
Socket에서 TCP Client 정도만 제작가능하시면 바로 제작이 가능합니다.</p>
<blockquote><p><a href="http://en.wikipedia.org/wiki/Whois" title="http://en.wikipedia.org/wiki/Whois">http://en.wikipedia.org/wiki/Whois</a></p></blockquote>
<p>이러한 WHOIS 정보는 TLD별로 제공이 되고 있으며, 아래와 같은 규칙을 가지고 있습니다.</p>
<blockquote><p>whois-servers.net provides DNS alias records (CNAME) for TLD WHOIS servers of the form <tld>.whois-servers.net.</p>
<pre>
[stone@localhost ~]$ <strong><em>telnet com.whois-servers.net 43</em></strong>
Trying 199.7.49.74...
Connected to com.whois-servers.net (199.7.49.74).
Escape character is '^]'.
<strong><em>netpia.com</em></strong>

Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

   Domain Name: NETPIA.COM
   Registrar: NETPIA.COM, INC.
   Whois Server: whois.ibi.net
   Referral URL: http://www.ibi.net
   Name Server: NS.NETPIA.COM
   Name Server: NS2.NETPIA.COM
   Status: clientDeleteProhibited
   Status: clientTransferProhibited
   Updated Date: 10-mar-2012
   Creation Date: 01-apr-1998
   Expiration Date: 31-mar-2013

>>> Last update of whois database: Mon, 17 Sep 2012 15:01:00 UTC <<<

NOTICE: The expiration date displayed in this record is the date the
registrar's sponsorship of the domain name registration in the registry is
currently set to expire. This date does not necessarily reflect the expiration
date of the domain name registrant's agreement with the sponsoring
registrar.  Users may consult the sponsoring registrar's Whois database to
view the registrar's reported date of expiration for this registration.

TERMS OF USE: You are not authorized to access or query our Whois
database through the use of electronic processes that are high-volume and
automated except as reasonably necessary to register domain names or
modify existing registrations; the Data in VeriSign Global Registry
Services' ("VeriSign") Whois database is provided by VeriSign for
information purposes only, and to assist persons in obtaining information
about or related to a domain name registration record. VeriSign does not
guarantee its accuracy. By submitting a Whois query, you agree to abide
by the following terms of use: You agree that you may use this Data only
for lawful purposes and that under no circumstances will you use this Data
to: (1) allow, enable, or otherwise support the transmission of mass
unsolicited, commercial advertising or solicitations via e-mail, telephone,
or facsimile; or (2) enable high volume, automated, electronic processes
that apply to VeriSign (or its computer systems). The compilation,
repackaging, dissemination or other use of this Data is expressly
prohibited without the prior written consent of VeriSign. You agree not to
use electronic processes that are automated and high-volume to access or
query the Whois database except as reasonably necessary to register
domain names or modify existing registrations. VeriSign reserves the right
to restrict your access to the Whois database in its sole discretion to ensure
operational stability.  VeriSign may restrict or terminate your access to the
Whois database for failure to abide by these terms of use. VeriSign
reserves the right to modify these terms at any time.

The Registry database contains ONLY .COM, .NET, .EDU domains and
Registrars.Connection closed by foreign host.
[stone@localhost ~]$
</pre>
</blockquote>
<p>보다 확실한 방법은 IP와 주소 정보를 관할하는 IANA의 WHOIS 서버를 통해서 확인을 하면 보다 확실합니다.</p>
<blockquote><p>
The IANA whois server at whois.iana.org provides information on each TLD including the whois server.</p>
<pre>
[stone@localhost~]$ <strong><em>telnet whois.iana.org 43</em></strong>
Trying 192.0.47.59...
Connected to whois.iana.org (192.0.47.59).
Escape character is '^]'.
<strong><em>kr</em></strong>
% IANA WHOIS server
% for more information on IANA, visit http://www.iana.org
% This query returned 1 object

domain:       KR

organisation: Korea Internet &#038; Security Agency (KISA)
address:      12F, Daedong Bldg, 109 Jungdae-ro, Songpa-gu
address:      Seoul  138-950
address:      Korea, Republic Of

contact:      administrative
name:         Kilnam Chon
organisation: Korea Network Information Center (KRNIC)
address:      12F, Daedong Bldg, 109 Jungdae-ro, Songpa-gu
address:      Seoul  138-950
address:      Korea, Republic Of
phone:        +82 10 8581 3514
fax-no:       +82 2 405 5419
e-mail:       chonkn@gmail.com

contact:      technical
name:         Director of Internet Technology Team
organisation: Korea Internet &#038; Security Agency (KISA)
address:      12F, Daedong Bldg
address:      109 Jungdae-ro, Songpa-gu
address:      Seoul 138-950
address:      Korea, Republic Of
phone:        +82 2 405 6470
fax-no:       +82 2 405 5119
e-mail:       techc@kisa.or.kr

nserver:      B.DNS.KR 61.74.75.1
nserver:      C.DNS.KR 203.248.246.220
nserver:      D.DNS.KR 203.83.159.1
nserver:      E.DNS.KR 2001:dcc:5:0:0:0:0:100 202.30.124.100
nserver:      F.DNS.KR 218.38.181.90
nserver:      G.DNS.KR 2001:dc5:a:0:0:0:0:1 202.31.190.1
ds-rdata:     17625 7 2 FB939059F4B67BBA1E8AC37E35811E506488B2D8CFF807AF873B2116B5676B5C

whois:        whois.kr

status:       ACTIVE
remarks:      Registration information: http://www.nic.or.kr/

created:      1986-09-29
changed:      2011-11-23
source:       IANA

Connection closed by foreign host.
[stone@localhost ~]$
</pre>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.sukmoonlee.com/wordpress/archives/296/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNS &#8211; Message compression</title>
		<link>http://blog.sukmoonlee.com/wordpress/archives/281</link>
		<comments>http://blog.sukmoonlee.com/wordpress/archives/281#comments</comments>
		<pubDate>Mon, 17 Sep 2012 12:51:35 +0000</pubDate>
		<dc:creator>Sukmoon Lee</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[message compression]]></category>
		<category><![CDATA[protocol]]></category>

		<guid isPermaLink="false">http://blog.sukmoonlee.com/wordpress/?p=281</guid>
		<description><![CDATA[DNS는 HTML과 달리 정해진 형식으로 구성된 프로토콜입니다. 워낙 작은 데이타로 값을 요청하고, 응답해야 하기 때문에 나름대로의 규칙이 있습니다. 특히 응답값을 패킷 캡쳐를 해서 보면 재미있는 현상이 있습니다. 실제 결과를 nslookup이나 dig를 통해서 결과를 보면 데이타의 양이 많습니다. 하지만 많은 양에 비해서 패킷의 수치는 그리 많지 않습니다. 이를 처리하는 부분이 도메인 데이타에 대해서 압축(?)을 하는 방법을 <a href='http://blog.sukmoonlee.com/wordpress/archives/281' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>DNS는 HTML과 달리 정해진 형식으로 구성된 프로토콜입니다.</p>
<p>워낙 작은 데이타로 값을 요청하고, 응답해야 하기 때문에 나름대로의 규칙이 있습니다.</p>
<p>특히 응답값을 패킷 캡쳐를 해서 보면 재미있는 현상이 있습니다.<br />
실제 결과를 nslookup이나 dig를 통해서 결과를 보면 데이타의 양이 많습니다. 하지만 많은 양에 비해서 패킷의 수치는 그리 많지 않습니다.</p>
<p>이를 처리하는 부분이 도메인 데이타에 대해서 압축(?)을 하는 방법을 사용합니다. 우리가 일반적으로 알고 있는 압축이 아니고, 이미 사용했던 패킷의 데이타를 재사용함으로써 데이타 압축을 한 효과를 내고 있습니다.</p>
<p>RFC에서 DNS 프로토콜에서 데이타 압축 기법에 대한 설명 자료</p>
<p>    <a href="http://tools.ietf.org/html/rfc1035#section-4.1.4">http://tools.ietf.org/html/rfc1035#section-4.1.4</a></p>
<p>이러한 기법에 대해서 설명한 자료를 찾지 못해서 RFC와 패킷 캡쳐한 결과로만 알고 있다가 예전에 인터넷으로 검색해서 찾은 자료입니다. 예전같으면 원서라도 구입해서 보겠지만, 요새는 인터넷에서 원서를 공개하고 있어서 원하는 부분만 쉽게 볼수 있어서 좋은것 같습니다.</p>
<p>    <a href="http://www.tcpipguide.com/free/t_DNSNameNotationandMessageCompressionTechnique.htm">http://www.tcpipguide.com/free/t_DNSNameNotationandMessageCompressionTechnique.htm</a></p>
<p>위의 TCP/IP Guide 책을 보면 RFC보다 쉽게 이해가 가능합니다.</p>
<p>하지만 이러한 사실을 눈으로는 쉽게 이해가 되지만, 이를 구현을 하다 보면 여러가지 문제점이 있다는 것을 알수 있습니다.<br />
구현에 대해서는 다음에 다시 한번 정리를 해보도록 하겠습니다.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sukmoonlee.com/wordpress/archives/281/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>html parser</title>
		<link>http://blog.sukmoonlee.com/wordpress/archives/288</link>
		<comments>http://blog.sukmoonlee.com/wordpress/archives/288#comments</comments>
		<pubDate>Mon, 17 Sep 2012 12:38:34 +0000</pubDate>
		<dc:creator>Sukmoon Lee</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[simple html dom]]></category>

		<guid isPermaLink="false">http://blog.sukmoonlee.com/wordpress/?p=288</guid>
		<description><![CDATA[대부분 개발자들은 개발을 하면서 HTML 파서를 각자 만들어서 사용을 하고 있습니다. 특히 검색 로봇을 만들어서 사용할 경우에는 HTML을 읽어서 파서를 만들어서 사용하는 경우가 많습니다. 그래서 저는 HTML 문법을 기반으로 하는 라인단위로 분리를 해서 사용하는 방법을 많이 사용했습니다. (대부분 로봇을 Perl을 사용해서 만들었기 때문에 10라인 정도 되는 함수로 만들어서 잘 사용했으며, 대규모 분석시 적은 메모리로 빠른 <a href='http://blog.sukmoonlee.com/wordpress/archives/288' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>대부분 개발자들은 개발을 하면서 HTML 파서를 각자 만들어서 사용을 하고 있습니다.<br />
특히 검색 로봇을 만들어서 사용할 경우에는 HTML을 읽어서 파서를 만들어서 사용하는 경우가 많습니다.<br />
그래서 저는 HTML 문법을 기반으로 하는 라인단위로 분리를 해서 사용하는 방법을 많이 사용했습니다.<br />
(대부분 로봇을 Perl을 사용해서 만들었기 때문에 10라인 정도 되는 함수로 만들어서 잘 사용했으며, 대규모 분석시 적은 메모리로 빠른 처리가 가능합니다.)</p>
<p>하지만 최근 HTML 구조가 CSS 기반으로 이루어지다 보니 좀 더 복잡하게 구성되는 경우가 많습니다.<br />
대신 HTML5의 경우에는 문서가 구조적으로 되어 있기 때문에 라인단위로 분석보다는 html을 parser해서 DOM과 같은 객체에 넣어 두고 분석을 하면 훨씬 편리하다.</p>
<p>물론 라인단위로 처리하거나, SAX로 처리하는 것보다 메모리나, 속도 측면에서는 문제가 많겠지만, 변경된 HTML구조에 빠르게 대응을 하고, 간단하게 개발할때에는 효과적인것 같아서 HTML parser 프로그램을 하나 소개합니다.</p>
<p>PHP로 되어 있으며, 간단히 라이브러리 파일만 include를 하고, 아래와 같이 사용하면 된다.<br />
(PHP 기본 함수가 아니므로 아래 참고 URL에 있는 소스를 다운받아서 PHP 프로그램을 사용할때 추가해야 합니다.)</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #b1b100;">include_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'simple_html_dom.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$html</span> <span style="color: #339933;">=</span> file_get_html<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://blog.sukmoonlee.com&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$html</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ul'</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$element</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$element</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'a'</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$e</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$e</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">href</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>        
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009900;">&#91;</span>smlee<span style="color: #339933;">@</span>localhost ~<span style="color: #009900;">&#93;</span>$ php test<span style="color: #339933;">.</span>php
<span style="color: #339933;">/</span>wordpress<span style="color: #339933;">/</span>
<span style="color: #339933;">/</span>env<span style="color: #339933;">.</span>php
<span style="color: #339933;">/</span>geshi<span style="color: #339933;">/</span>contrib<span style="color: #339933;">/</span>example<span style="color: #339933;">.</span>php</pre></td></tr></table></div>

<p>참고URL: <a href="http://simplehtmldom.sourceforge.net/">http://simplehtmldom.sourceforge.net/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sukmoonlee.com/wordpress/archives/288/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Java Data Types</title>
		<link>http://blog.sukmoonlee.com/wordpress/archives/276</link>
		<comments>http://blog.sukmoonlee.com/wordpress/archives/276#comments</comments>
		<pubDate>Thu, 13 Sep 2012 12:23:03 +0000</pubDate>
		<dc:creator>Sukmoon Lee</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[char]]></category>
		<category><![CDATA[data type]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[short]]></category>

		<guid isPermaLink="false">http://blog.sukmoonlee.com/wordpress/?p=276</guid>
		<description><![CDATA[자바를 이용해서 네트워크 프로그램을 작성하면서 자바의 데이타 형태 때문에 고생을 했다. 그래서 한번 확인을 하고 정리를 해봤습니다. 네트워크에서 받은 데이타들을 대부분 byte[]로 처리를 하고 있는데, 이를 숫자로 변환하기 위해서는 byte 2개 혹은 4개를 조합해서 사용하면 된다. 여기서 문제가 발생이 되는데, java의 대부분의 data type은 signed type으로 되어 있다. (제가 사용하는 네트워크 데이타는 비트 단위로 연산을 <a href='http://blog.sukmoonlee.com/wordpress/archives/276' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>자바를 이용해서 네트워크 프로그램을 작성하면서 자바의 데이타 형태 때문에 고생을 했다.<br />
그래서 한번 확인을 하고 정리를 해봤습니다.</p>
<p>네트워크에서 받은 데이타들을 대부분 byte[]로 처리를 하고 있는데, 이를 숫자로 변환하기 위해서는 byte 2개 혹은 4개를 조합해서 사용하면 된다. </p>
<p>여기서 문제가 발생이 되는데, java의 대부분의 data type은 signed type으로 되어 있다.<br />
(제가 사용하는 네트워크 데이타는 비트 단위로 연산을 하기 때문에 binary type으로 데이타를 조작을 해야 하는 경우가 대부분입니다.)</p>
<p> byte는 signed type으로 되어 있으며, 이를 short로 casting을 하고, << 8과 같이 연산을 하더라도 음수가 발생이 될수 있다. 이런 경우에는 (short)(byte[] &#038; 0xFF) 형태로 먼저 &#038; 연산을 처리후에 casting을 해서 연산을 처리하면 해결이 가능하다.<br />
하지만 2 byte 데이타를 숫자로 변환을 하면, short type에 담을수가 없다. short type도 signed data 이기 때문에 char type 혹은 int type에 데이타를 저장해야 한다.</p>
<p>그래서 여러번의 테스트를 해보면서 data type을 이해를 하면서 만든 코드가 아래 1줄이다. -_-</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="java" style="font-family:monospace;">&nbsp;
<span style="color: #000066; font-weight: bold;">int</span> id<span style="color: #339933;">=</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span> 0xFF<span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;&lt;</span> <span style="color: #cc66cc;">8</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">short</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span>data<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;</span> 0xFF<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>* byte (1 byte, -128~127)<br />
* char (2 byte, 0~65535)<br />
* short (2 byte, -32768~32767)<br />
* int (4 byte, -2147483648~2147483647)<br />
* long (8 byte, -9223372036854775808 ~ 9223372036854775807)</p>
<p>* float (4 byte)<br />
* double (8 byte)</p>
<p>참고URL : http://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sukmoonlee.com/wordpress/archives/276/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IE에서 Console.log 출력하기</title>
		<link>http://blog.sukmoonlee.com/wordpress/archives/220</link>
		<comments>http://blog.sukmoonlee.com/wordpress/archives/220#comments</comments>
		<pubDate>Mon, 10 Sep 2012 05:34:07 +0000</pubDate>
		<dc:creator>Sukmoon Lee</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[console.log]]></category>
		<category><![CDATA[IE]]></category>

		<guid isPermaLink="false">http://blog.sukmoonlee.com/wordpress/?p=220</guid>
		<description><![CDATA[예전에는 HTML 작업이 단순했지만, jQuery, Ajax등을 사용하면서 복잡한 Javascript을 많이 사용하게 되었습니다. 개발을 하게 되면 무엇보다 개발환경을 잘 파악해서 활용하는 것이 중요합니다. 대부분 작업을 Chrome에서 작업을 하면서 debug를 하지만, 브라우저 호환성을 위해서 IE에서 확인을 해야 합니다. 하지만 IE에서 debug 를 사용하게 되면 자주 응답없음 이라는 문구를 만나면서 debug를 하기 힘든 상황이 많이 발생합니다. 이런 경우에는 <a href='http://blog.sukmoonlee.com/wordpress/archives/220' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>예전에는 HTML 작업이 단순했지만, jQuery, Ajax등을 사용하면서 복잡한 Javascript을 많이 사용하게 되었습니다. 개발을 하게 되면 무엇보다 개발환경을 잘 파악해서 활용하는 것이 중요합니다.</p>
<p>대부분 작업을 Chrome에서 작업을 하면서 debug를 하지만, 브라우저 호환성을 위해서 IE에서 확인을 해야 합니다. 하지만 IE에서 debug 를 사용하게 되면 자주 응답없음 이라는 문구를 만나면서 debug를 하기 힘든 상황이 많이 발생합니다.<br />
이런 경우에는 어쩔수 없이 원시적으로 alert() 혹은 log를 출력해서 확인을 해야 합니다.</p>
<p>하지만 IE에서 console.log를 사용하게 되면 오류가 발생하기 때문에 아래와 같은 방법을 사용하면 됩니다.</p>
<p>확인을 하고자 하는 페이지에서 F12을 눌러서 개발자 도구를 실행합니다. 그리고 스크립트 탭을 선택을 한 다음에 페이지를 재로딩을 하게 되면 console.log 를 사용할수 있으며, 해당 로그가 콘솔에 출력되는 것을 확인할 수 있습니다.</p>
<p>그리고 오류를 방지하기 위해서 아래와 같은 코드로 출력을 하게 되면 개발자도구가 비활성화 되었을때에도 오류를 발생시키지 않게 된다.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> console <span style="color: #339933;">!=</span> <span style="color: #3366CC;">'undefined'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> console.<span style="color: #660066;">log</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;debug message&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>참고 URL : <a href="http://stackoverflow.com/questions/690251/what-happened-to-console-log-in-ie8">http://stackoverflow.com/questions/690251/what-happened-to-console-log-in-ie8</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sukmoonlee.com/wordpress/archives/220/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jsonp 를 활용한 반복 호출에 대한 빠른 처리 방안</title>
		<link>http://blog.sukmoonlee.com/wordpress/archives/225</link>
		<comments>http://blog.sukmoonlee.com/wordpress/archives/225#comments</comments>
		<pubDate>Thu, 06 Sep 2012 11:53:41 +0000</pubDate>
		<dc:creator>Sukmoon Lee</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[callback]]></category>
		<category><![CDATA[jsonp]]></category>
		<category><![CDATA[sencha]]></category>

		<guid isPermaLink="false">http://blog.sukmoonlee.com/wordpress/?p=225</guid>
		<description><![CDATA[웹 페이지에서 서버로 부터 빠른 데이타를 수신하기 위해서 AJAX(Asynchronous JavaScript and XML)가 아닌 JSON(JavaScript Object Notation)을 많이 사용하게 된다. 보안에 문제가 발생할수도 있지만, 동일 도메인이 아닌 다른 서버로 부터 JSON 데이타를 빠르게 수신해서 처리하는 경우에 JSONP(JSON with padding)를 사용하면, 1개의 데이타를 다양한 웹서비스에서 활용이 가능하다. 원리는 아래와 같이 HTML에서 head에 JavaScript를 append 해서 해당 배열을 <a href='http://blog.sukmoonlee.com/wordpress/archives/225' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>웹 페이지에서 서버로 부터 빠른 데이타를 수신하기 위해서 AJAX(Asynchronous JavaScript and XML)가 아닌 JSON(JavaScript Object Notation)을 많이 사용하게 된다.<br />
보안에 문제가 발생할수도 있지만, 동일 도메인이 아닌 다른 서버로 부터 JSON 데이타를 빠르게 수신해서 처리하는 경우에 JSONP(JSON with padding)를 사용하면, 1개의 데이타를 다양한 웹서비스에서 활용이 가능하다.</p>
<p>원리는 아래와 같이 HTML에서 head에 JavaScript를 append 해서 해당 배열을 가져와서 처리하는 방식으로 처리를 한다.</p>
<p>이렇게 하면 문제는 동기화 방식으로 동작을 하기 때문에 순차적으로 데이타를 전달받게 되므로, 아래의 소스와 같이 재요청시 기존에 동작중인 쿼리를 모두 취소를 해버리면 비동기 방식의 데이타 수신이 가능하다.</p>
<p>데이타는 queue를 만들어서 데이타를 순차적으로 처리를 하면 하지만, 간혹 queue에 빠졌지만, callback이 여러번 발생될 경우도 있다. 이런 경우만 callback 함수에서 추가 처리만 해주면 다양한 브라우저에서 사용이 가능한 JSONP 라이브러리가 완성이 된다.</p>
<p>Sencha 로 프로젝트를 진행하다가 처음에 그냥 웹에 있는 소스를 참고해서 사용하다가 원하는 대로 동작을 하지 않아서 소스를 파악하고, 처리 방식을 나름대로 제정리를 해봤습니다.</p>
<p>참조URL: <a href="http://www.tomdupont.net/2010/12/extuxjsonp-v20.html">http://www.tomdupont.net/2010/12/extuxjsonp-v20.html</a></p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="javascript" style="font-family:monospace;">&nbsp;
Ext.<span style="color: #660066;">ns</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'Ext.ux'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
Ext.<span style="color: #660066;">ux</span>.<span style="color: #660066;">JSONP</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">var</span> _queue <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">var</span> _clearQueue <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>_queue.<span style="color: #660066;">length</span><span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
                while<span style="color: #009900;">&#40;</span>_queue.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000066; font-weight: bold;">var</span> _current <span style="color: #339933;">=</span> _queue.<span style="color: #660066;">shift</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                        <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                                document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'head'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>_current.<span style="color: #660066;">script</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span>err<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
        <span style="color: #000066; font-weight: bold;">var</span> _lastCallback<span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #009900;">&#123;</span>
                request<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>url<span style="color: #339933;">,</span> o<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
                        o.<span style="color: #660066;">params</span> <span style="color: #339933;">=</span> o.<span style="color: #660066;">params</span> <span style="color: #339933;">||</span> <span style="color: #009900;">&#123;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
                        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>o.<span style="color: #660066;">callbackKey</span><span style="color: #009900;">&#41;</span>
                                o.<span style="color: #660066;">params</span><span style="color: #009900;">&#91;</span>o.<span style="color: #660066;">callbackKey</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'Ext.ux.JSONP.callback'</span><span style="color: #339933;">;</span>
&nbsp;
                        <span style="color: #000066; font-weight: bold;">var</span> params <span style="color: #339933;">=</span> Ext.<span style="color: #660066;">urlEncode</span><span style="color: #009900;">&#40;</span>o.<span style="color: #660066;">params</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000066; font-weight: bold;">var</span> script <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'script'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        script.<span style="color: #660066;">type</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'text/javascript'</span><span style="color: #339933;">;</span>
                        script.<span style="color: #660066;">charset</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'utf-8'</span><span style="color: #339933;">;</span>
                        script.<span style="color: #660066;">src</span> <span style="color: #339933;">=</span> url <span style="color: #339933;">+</span> <span style="color: #3366CC;">'?'</span> <span style="color: #339933;">+</span> params<span style="color: #339933;">;</span>
&nbsp;
                        _lastCallback <span style="color: #339933;">=</span> o.<span style="color: #660066;">callback</span><span style="color: #339933;">;</span>
&nbsp;
                        _clearQueue<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        _queue.<span style="color: #660066;">push</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
                                url<span style="color: #339933;">:</span> url<span style="color: #339933;">,</span>
                                script<span style="color: #339933;">:</span> script<span style="color: #339933;">,</span>
                                callback<span style="color: #339933;">:</span> o.<span style="color: #660066;">callback</span> <span style="color: #339933;">||</span> <span style="color: #000066; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
                                scope<span style="color: #339933;">:</span> o.<span style="color: #660066;">scope</span> <span style="color: #339933;">||</span> window<span style="color: #339933;">,</span>
                                params<span style="color: #339933;">:</span> params <span style="color: #339933;">||</span> <span style="color: #003366; font-weight: bold;">null</span>
                        <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                        document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'head'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>script<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
                callback<span style="color: #339933;">:</span> <span style="color: #000066; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span>json<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        <span style="color: #000066; font-weight: bold;">var</span> _current <span style="color: #339933;">=</span> _queue.<span style="color: #660066;">shift</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>_current <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                                _lastCallback.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span>window<span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>json<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                                <span style="color: #000066; font-weight: bold;">return</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span>
&nbsp;
                        <span style="color: #000066; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
                                document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'head'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>_current.<span style="color: #660066;">script</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span>err<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
&nbsp;
                        _current.<span style="color: #660066;">callback</span>.<span style="color: #660066;">apply</span><span style="color: #009900;">&#40;</span>_current.<span style="color: #660066;">scope</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span>json<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>팁으로 한글 Internet Explorer 9 에서 가끔 JavaScript를 로딩할때 배열에 있는 한글이 깨지는 경우가 발생한다.<br />
이러한 문제를 해결하기 위해서 charset 을 꼭 선언하여 사용하는 것이 효과적이다.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sukmoonlee.com/wordpress/archives/225/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql password</title>
		<link>http://blog.sukmoonlee.com/wordpress/archives/237</link>
		<comments>http://blog.sukmoonlee.com/wordpress/archives/237#comments</comments>
		<pubDate>Tue, 04 Sep 2012 13:09:32 +0000</pubDate>
		<dc:creator>Sukmoon Lee</dc:creator>
				<category><![CDATA[System]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[sha1]]></category>

		<guid isPermaLink="false">http://blog.sukmoonlee.com/wordpress/?p=237</guid>
		<description><![CDATA[MySQL에서 사용하는 패스워드로 사용할 수 있는 함수를 버전별로 테스트한 결과입니다. 프로그램을 시작할때 참고를 해서 테스트를 해보시면 좋습니다. 비밀번호를 md5()를 한 다음에 sha1()을 처리하고, 나머지 데이타는 encode() 혹은 des_encrypt()를 내부 암호키를 이용해서 저장하고 관리하는 방법을 사용하면 효과적입니다. [smlee@A ~]$ mysql -p -u root Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. <a href='http://blog.sukmoonlee.com/wordpress/archives/237' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>MySQL에서 사용하는 패스워드로 사용할 수 있는 함수를 버전별로 테스트한 결과입니다.</p>
<p>프로그램을 시작할때 참고를 해서 테스트를 해보시면 좋습니다.</p>
<p>비밀번호를 md5()를 한 다음에 sha1()을 처리하고, 나머지 데이타는 encode() 혹은 des_encrypt()를 내부 암호키를 이용해서 저장하고 관리하는 방법을 사용하면 효과적입니다.</p>
<pre>
[smlee@A ~]$ mysql -p -u root
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 644167
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select password('dltjrans');
+----------------------+
| password('dltjrans') |
+----------------------+
| 337c52a05f635196     |
+----------------------+
1 row in set (0.03 sec)

mysql> select sha1('dltjrans');
+------------------------------------------+
| sha1('dltjrans')                         |
+------------------------------------------+
| 2734580af3645aae53a80ce3a60841636e4f5f16 |
+------------------------------------------+
1 row in set (0.02 sec)

mysql> select sha2('dltjrans');
ERROR 1305 (42000): FUNCTION sha2 does not exist

mysql> select encrypt('dltjrans');
+---------------------+
| encrypt('dltjrans') |
+---------------------+
| iBlePNVyWUPF2       |
+---------------------+
1 row in set (0.00 sec)

mysql> select md5('dltjrans');
+----------------------------------+
| md5('dltjrans')                  |
+----------------------------------+
| 44022b75cd0626a239a1c0ec42e0b902 |
+----------------------------------+
1 row in set (0.00 sec)

mysql> select old_password('dltjrans');
+--------------------------+
| old_password('dltjrans') |
+--------------------------+
| 337c52a05f635196         |
+--------------------------+
1 row in set (0.00 sec)

mysql> show variables;
+---------------------------------+------------------------------------------------------------+
| Variable_name                   | Value                                                      |
+---------------------------------+------------------------------------------------------------+
......
| old_passwords                   | ON                                                         |
......
+---------------------------------+------------------------------------------------------------+
239 rows in set (0.01 sec)
</pre>
<pre>

[smlee@B ~]$ /usr/local/mysql/bin/mysql --character-sets-dir=utf8  -p -u root
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 326943
Server version: 5.1.58-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select password('dltjrans');
+-------------------------------------------+
| password('dltjrans')                      |
+-------------------------------------------+
| *8FE4DE9DB3E99B3D33C46101724499112B4E08C0 |
+-------------------------------------------+
1 row in set (0.00 sec)

mysql> select sha('dltjrans');
+------------------------------------------+
| sha('dltjrans')                          |
+------------------------------------------+
| 2734580af3645aae53a80ce3a60841636e4f5f16 |
+------------------------------------------+
1 row in set (0.00 sec)

mysql> select sha1('dltjrans');
+------------------------------------------+
| sha1('dltjrans')                         |
+------------------------------------------+
| 2734580af3645aae53a80ce3a60841636e4f5f16 |
+------------------------------------------+
1 row in set (0.00 sec)

mysql> select encrypt('dltjrans');
+---------------------+
| encrypt('dltjrans') |
+---------------------+
| dZew2kBw.Cajg       |
+---------------------+
1 row in set (0.00 sec)

mysql> select old_password('dltjrans');
+--------------------------+
| old_password('dltjrans') |
+--------------------------+
| 337c52a05f635196         |
+--------------------------+
1 row in set (0.00 sec)
</pre>
<pre>

[smlee@C ~]$ mysql -p -u root
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 33751
Server version: 5.5.21 MySQL Community Server (GPL)

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select password('dltjrans');
+-------------------------------------------+
| password('dltjrans')                      |
+-------------------------------------------+
| *8FE4DE9DB3E99B3D33C46101724499112B4E08C0 |
+-------------------------------------------+
1 row in set (0.00 sec)

mysql> select sha('dltjrans');
+------------------------------------------+
| sha('dltjrans')                          |
+------------------------------------------+
| 2734580af3645aae53a80ce3a60841636e4f5f16 |
+------------------------------------------+
1 row in set (0.03 sec)

mysql> select sha1('dltjrans');
+------------------------------------------+
| sha1('dltjrans')                         |
+------------------------------------------+
| 2734580af3645aae53a80ce3a60841636e4f5f16 |
+------------------------------------------+
1 row in set (0.00 sec)

mysql> select encrypt('dltjrans');
+---------------------+
| encrypt('dltjrans') |
+---------------------+
| yb/DPswDxmSnk       |
+---------------------+
1 row in set (0.00 sec)

mysql> select old_password('dltjrans');
+--------------------------+
| old_password('dltjrans') |
+--------------------------+
| 337c52a05f635196         |
+--------------------------+
1 row in set (0.00 sec)

mysql>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.sukmoonlee.com/wordpress/archives/237/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql에서 left outer join에서 없는 항목 찾기</title>
		<link>http://blog.sukmoonlee.com/wordpress/archives/243</link>
		<comments>http://blog.sukmoonlee.com/wordpress/archives/243#comments</comments>
		<pubDate>Tue, 04 Sep 2012 12:01:45 +0000</pubDate>
		<dc:creator>Sukmoon Lee</dc:creator>
				<category><![CDATA[System]]></category>
		<category><![CDATA[left outer join]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.sukmoonlee.com/wordpress/?p=243</guid>
		<description><![CDATA[DB에서 가능하면 join을 사용하지 않도록 설계를 하면 성능에 많은 도움이 된다. 하지만 어쩔수 없는 경우에는 outer join을 사용하면 빠른 속도로 join이 가능하다. 그래서 left outer join을 자주 사용하게 되는데. 이런 경우 join이 되는 테이블의 데이타가 없는 경우에도 결과값은 생성이 되게 된다. 이런 경우에 join이 되는 테이블의 데이타가 없는 경우에는 아래와 같이 판별이 가능한다. (MySQL 메뉴얼에서 <a href='http://blog.sukmoonlee.com/wordpress/archives/243' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>DB에서 가능하면 join을 사용하지 않도록 설계를 하면 성능에 많은 도움이 된다.</p>
<p>하지만 어쩔수 없는 경우에는 outer join을 사용하면 빠른 속도로 join이 가능하다.</p>
<p>그래서 left outer join을 자주 사용하게 되는데. 이런 경우 join이 되는 테이블의 데이타가 없는 경우에도 결과값은 생성이 되게 된다.</p>
<p>이런 경우에 join이 되는 테이블의 데이타가 없는 경우에는 아래와 같이 판별이 가능한다.<br />
(MySQL 메뉴얼에서 참고한 내용)</p>
<blockquote><p>If there is a row in A that matches the WHERE clause, but there is no row in B that matches the ON condition, an extra B row is generated with all columns set to NULL.</p></blockquote>
<p>실제로 2개의 테이블이 느슨한 연결 상태라서 foreign key가 없는 row가 존재할 수 있다.<br />
아래와 같은 쿼리를 통해서 확인하고, delete 처리가 가능하다.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #66cc66;">*</span>
<span style="color: #993333; font-weight: bold;">FROM</span> tb_abc a
<span style="color: #993333; font-weight: bold;">LEFT</span> <span style="color: #993333; font-weight: bold;">JOIN</span> tb_123 b <span style="color: #993333; font-weight: bold;">ON</span> a<span style="color: #66cc66;">.</span>title <span style="color: #66cc66;">=</span> b<span style="color: #66cc66;">.</span>title
<span style="color: #993333; font-weight: bold;">WHERE</span> a<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">TYPE</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'ok'</span>
<span style="color: #993333; font-weight: bold;">AND</span> b<span style="color: #66cc66;">.</span><span style="color: #993333; font-weight: bold;">STATUS</span> <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NULL</span></pre></td></tr></table></div>

<p>참고 URL : <a href="http://dev.mysql.com/doc/refman/5.5/en/left-join-optimization.html">http://dev.mysql.com/doc/refman/5.5/en/left-join-optimization.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sukmoonlee.com/wordpress/archives/243/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php에서 time 처리</title>
		<link>http://blog.sukmoonlee.com/wordpress/archives/250</link>
		<comments>http://blog.sukmoonlee.com/wordpress/archives/250#comments</comments>
		<pubDate>Tue, 04 Sep 2012 11:55:35 +0000</pubDate>
		<dc:creator>Sukmoon Lee</dc:creator>
				<category><![CDATA[Program]]></category>
		<category><![CDATA[strtotime]]></category>
		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://blog.sukmoonlee.com/wordpress/?p=250</guid>
		<description><![CDATA[php에서 time() 을 호출하게 되면 unix timestamp를 반환하게 된다. 해당 값은 단위가 초이기 때문에 간단한 수칙연산으로 날짜를 변경이 가능하다. 하지만, 현재 시간에서 1달을 더하거나 할때에는 생각할 부분이 많다. 30 혹은 31일인 경우까지 고려를 해야 하며, 1년을 더 할 경우에는 윤년 계산까지 해야 한다. 이럴때 아래의 strtotime() 를 사용하면 보다 간편하게 계산이 가능하다. &#160; &#60;?php echo <a href='http://blog.sukmoonlee.com/wordpress/archives/250' class='excerpt-more'>[...]</a>]]></description>
				<content:encoded><![CDATA[<p>php에서 time() 을 호출하게 되면 unix timestamp를 반환하게 된다. 해당 값은 단위가 초이기 때문에 간단한 수칙연산으로 날짜를 변경이 가능하다.</p>
<p>하지만, 현재 시간에서 1달을 더하거나 할때에는 생각할 부분이 많다. 30 혹은 31일인 경우까지 고려를 해야 하며, 1년을 더 할 경우에는 윤년 계산까지 해야 한다.</p>
<p>이럴때 아래의 strtotime() 를 사용하면 보다 간편하게 계산이 가능하다.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="php" style="font-family:monospace;">&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;now&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;10 September 2000&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;+1 day&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;+1 week&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;+1 week 2 days 4 hours 2 seconds&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;next Thursday&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;last Monday&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>참고 URL: <a href="http://www.php.net/manual/en/function.strtotime.php">http://www.php.net/manual/en/function.strtotime.php</a><br />
참고 URL: <a href="http://www.php.net/manual/en/function.time.php">http://www.php.net/manual/en/function.time.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.sukmoonlee.com/wordpress/archives/250/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
