<?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>Hanury.NET &#187; codesnipet</title>
	<atom:link href="http://hanury.net/wp/tag/codesnipet/feed" rel="self" type="application/rss+xml" />
	<link>http://hanury.net/wp</link>
	<description>하늘이, 형거니, 규영이 홈피입니다.</description>
	<lastBuildDate>Thu, 05 Jan 2012 09:58:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Perl One Liner</title>
		<link>http://hanury.net/wp/archives/1143</link>
		<comments>http://hanury.net/wp/archives/1143#comments</comments>
		<pubDate>Wed, 28 Jan 2009 10:30:08 +0000</pubDate>
		<dc:creator>alexken</dc:creator>
				<category><![CDATA[기술]]></category>
		<category><![CDATA[codesnipet]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[팁]]></category>

		<guid isPermaLink="false">http://hanury.net/wp/?p=1143</guid>
		<description><![CDATA[주로 하는 짓거리가 텍스트를 가지고 조물락 거리는 거라, Unix에서 find, sed, awk 조합으로 어지간 한거는 bash/perl/ruby까지 가지 않고 처리하고 있지만, 파일을 열어, 수정하고, 다시 저장하려면, open 한 파일과 save할 파일이 [...]]]></description>
			<content:encoded><![CDATA[<p>주로 하는 짓거리가 텍스트를 가지고 조물락 거리는 거라,<br />
Unix에서 find, sed, awk 조합으로 어지간 한거는<br />
bash/perl/ruby까지 가지 않고 처리하고 있지만, </p>
<p>파일을 열어, 수정하고, 다시 저장하려면, open 한 파일과 save할 파일이 동일해서,<br />
파이프( | ) 를 이용해서 tmp파일을 만들고는 하지만,<br />
find -exec 속에서 파이프를 쓸 수가 없어서 이럴때는 perl one liner가 제격이다.</p>
<p>자주 쓰는 Perl one liner&#8230;</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:680px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">find . -name &quot;file.*&quot; -exec perl -i -pe 's|BEFORE|AFTER|g' {} ;</div></div>
<p>그 밖의 perl one liner<br />
<a href="http://sial.org/howto/perl/one-liner/">링크1</a>, <a href="http://www.unixguide.net/unix/perl_oneliners.shtml">링크2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://hanury.net/wp/archives/1143/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[java] reflect on java</title>
		<link>http://hanury.net/wp/archives/443</link>
		<comments>http://hanury.net/wp/archives/443#comments</comments>
		<pubDate>Tue, 13 Nov 2007 05:14:35 +0000</pubDate>
		<dc:creator>alexken</dc:creator>
				<category><![CDATA[기술]]></category>
		<category><![CDATA[codemonkey]]></category>
		<category><![CDATA[codesnipet]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[프로그래밍]]></category>

		<guid isPermaLink="false">http://hanury.net/wp/archives/443</guid>
		<description><![CDATA[회사서 Class를 조사할 일이 있는데 reflect를 까먹어서 한동안 googling 해서 다시 학습&#8230; java.lang.String의 method를 출력하는 루틴의 골자만 요약하면&#8230;. import java.lang.reflect.*; public class ClassExam&#123; &#160; &#160; public void printClassInfo&#40;String className&#41;&#123; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>회사서 Class를 조사할 일이 있는데 reflect를 까먹어서 한동안 googling 해서 다시 학습&#8230;</p>
<p>java.lang.String의 method를 출력하는 루틴의 골자만 요약하면&#8230;.</p>
<div class="codecolorer-container java vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:680px;"><div class="java codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.lang.reflect.*</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> ClassExam<span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> printClassInfo<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> className<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">try</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">Class</span> a <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">getClass</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">getClassLoader</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">loadClass</span><span style="color: #009900;">&#40;</span>className<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">Method</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> methods <span style="color: #339933;">=</span> a.<span style="color: #006633;">getDeclaredMethods</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>methods.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span>methods<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #000000; font-weight: bold;">catch</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; ClassExam a <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ClassExam<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; a.<span style="color: #006633;">printClassInfo</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;java.lang.String&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://hanury.net/wp/archives/443/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Perl에서 Getopt::Std 사용하기</title>
		<link>http://hanury.net/wp/archives/173</link>
		<comments>http://hanury.net/wp/archives/173#comments</comments>
		<pubDate>Wed, 30 Aug 2006 02:13:58 +0000</pubDate>
		<dc:creator>alexken</dc:creator>
				<category><![CDATA[기술]]></category>
		<category><![CDATA[codesnipet]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[프로그래밍]]></category>

		<guid isPermaLink="false">http://hanury.net/wp/archives/173</guid>
		<description><![CDATA[Unix스타일의 프로그램 파라미터 처리를 해주는 모듈이 Getopt인데 자주 사용하다 보니 codesnipet으로 사용하려고, 내가 사용하는 템플릿을 여기에 등록해 둔다. main::HELP_MESSAGE(), main::VERSION_MESSAGE() 를 구현해 두면 &#8211; -help, &#8211; -version 옵션에 반응하고, getopts(c:hv)에 [...]]]></description>
			<content:encoded><![CDATA[<p>Unix스타일의 프로그램 파라미터 처리를 해주는 모듈이 Getopt인데<br />
자주 사용하다 보니 codesnipet으로 사용하려고, 내가 사용하는 템플릿을 여기에 등록해 둔다.</p>
<div class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:680px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">main::HELP_MESSAGE(), main::VERSION_MESSAGE()</div></div>
<p>를 구현해 두면 &#8211; -help, &#8211; -version 옵션에 반응하고, getopts(c:hv)에 사용할 옵션들을 나열하면 된다.<br />
위 예에서 c뒤에 : 의 의미는 파라미터를 받는 다는 의미이다.<br />
입력된 파라미터는 $Getopt::Std::opt_c로 사용할 수 있다.</p>
<div class="codecolorer-container perl vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:680px;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span><br />
<span style="color: #666666; font-style: italic;"># vim: set sw=4 ts=4 si et nu:</span><br />
<br />
<span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">use</span> Getopt<span style="color: #339933;">::</span><span style="color: #006600;">Std</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">########################################################</span><br />
<span style="color: #666666; font-style: italic;"># Global settings</span><br />
<span style="color: #666666; font-style: italic;">########################################################</span><br />
<span style="color: #0000ff;">$Getopt</span><span style="color: #339933;">::</span><span style="color: #006600;">Std</span><span style="color: #339933;">::</span><span style="color: #006600;">STANDARD_HELP_VERSION</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> main<span style="color: #339933;">::</span><span style="color: #006600;">VERSION_MESSAGE</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;$0 Version 0.5 &nbsp; hyeonkwen@gmail.com&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> main<span style="color: #339933;">::</span><span style="color: #006600;">HELP_MESSAGE</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000066;">print</span> <span style="color: #cc0000; font-style: italic;">&lt;&lt;END;<br />
Description of this program.<br />
Usage: $0 OPTION DIRECTORY<br />
<br />
OPTION<br />
&nbsp; &nbsp; -c &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; description of c option<br />
&nbsp; &nbsp; -h &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view help message<br />
&nbsp; &nbsp; -v &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view version information<br />
END</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">########################################################</span><br />
<span style="color: #666666; font-style: italic;"># main()</span><br />
<span style="color: #666666; font-style: italic;">########################################################</span><br />
<br />
<span style="color: #000000; font-weight: bold;">sub</span> main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>getopts<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;c:hv&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #0000ff;">$Getopt</span><span style="color: #339933;">::</span><span style="color: #006600;">Std</span><span style="color: #339933;">::</span><span style="color: #006600;">opt_h</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; main<span style="color: #339933;">::</span><span style="color: #006600;">HELP_MESSAGE</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">exit</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">elsif</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$Getopt</span><span style="color: #339933;">::</span><span style="color: #006600;">Std</span><span style="color: #339933;">::</span><span style="color: #006600;">opt_v</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; main<span style="color: #339933;">::</span><span style="color: #006600;">VERSION_MESSAGE</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066;">exit</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
main<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://hanury.net/wp/archives/173/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

