<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>www.ghoon.net</title>
		<link>http://www.ghoon.net/</link>
		<description></description>
		<language>ko</language>
		<pubDate>Wed, 17 Aug 2011 07:37:56 +0900</pubDate>
		<generator>Tistory 1.1 (http://www.tistory.com/)</generator>
		<item>
			<title>IPhone Explorer 죽는 문제</title>
			<link>http://www.ghoon.net/25</link>
			<description>IPhone Explorer가 뜨자마자 계속 죽는 문제가 발생하는 경우가 많은데,&lt;br /&gt;
해결방법은 아이폰에 등록된 이름에서 한글을 없애는 것입니다.&lt;br /&gt;
&lt;br /&gt;
&quot;&lt;u&gt;강지훈님의 IPhone&lt;/u&gt;&quot; 을&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;&lt;font class=&quot;Apple-style-span&quot; color=&quot;#e31600&quot;&gt;&quot;Jihoon&#039;s IPhone&quot;&lt;/font&gt;&lt;/b&gt;&lt;/u&gt; 처럼 바꿔 주면 문제가 해결 됩니다.&lt;br /&gt;
&lt;br /&gt;
애꿎은 컴퓨터 자꾸 껐다 켜지 맙시다!!&amp;nbsp;</description>
			<author>강지훈</author>
			<guid>http://www.ghoon.net/25</guid>
			<comments>http://www.ghoon.net/25#entry25comment</comments>
			<pubDate>Fri, 03 Jun 2011 22:13:58 +0900</pubDate>
		</item>
		<item>
			<title>Linux shell 용 merge script..</title>
			<link>http://www.ghoon.net/24</link>
			<description>&lt;P&gt;&lt;br /&gt;
python 계속 손 놓구 있다가, 뭐가 하나 필요한데, shell script로 짜다가 좀 후달려서, python으로 만들어 봤다.&lt;br /&gt;
shell script를 잘 못해서 그런지는 모르겠지만, 어쨌뜬 shell로 하다가 python으로 하니 완전 천국.. ㅎㅎ&lt;br /&gt;
&lt;br /&gt;python library들도 거의 아는게 없어서 삽질한 부분이 많을 순 있겠지만, 어쨌든 처음 해보는데도 이리저리 찾아보면서 하니 뚝딱 만들어지니.. 역시 script 언어는 좋다.&lt;br /&gt;
&lt;br /&gt;&lt;STRONG&gt;rmergy.py (&lt;A href=&quot;http://github.com/kghoon/rmerge&quot;&gt;http://github.com/kghoon/rmerge&lt;/A&gt;)&lt;br /&gt;
&lt;/STRONG&gt;&lt;br /&gt;
directory 를 recursive하게 diff하여 merge할 수 있도록 도와 줌..&lt;br /&gt;
linux diff 를 popen해서 결과를 가지고 처리함..&lt;br /&gt;
&lt;br /&gt;- file이 다른 경우 append하거나 merge tool을 띄울 수 있음 (default는 vimdiff)&lt;br /&gt;
- file이 한쪽에만 존재하는 경우, 지워버리거나, 다른 한 쪽으로 복사할 수 있음.&lt;br /&gt;
&lt;br /&gt;버전이 다른 모듈&amp;nbsp;합치기 할 때,&amp;nbsp;linux shell에서는 살짝 귀찮은 감이 있는데, 그럴때 사용하기 위해서 만듬..&lt;br /&gt;
&lt;br /&gt;&lt;/P&gt;</description>
			<author>강지훈</author>
			<guid>http://www.ghoon.net/24</guid>
			<comments>http://www.ghoon.net/24#entry24comment</comments>
			<pubDate>Thu, 06 Jan 2011 16:22:51 +0900</pubDate>
		</item>
		<item>
			<title>Alticast tru2way EPGs</title>
			<link>http://www.ghoon.net/21</link>
			<description>&lt;br /&gt;
&lt;object width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/zyHRQiysZkk&amp;hl=ko&amp;fs=1&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/zyHRQiysZkk&amp;hl=ko&amp;fs=1&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;425&quot; height=&quot;344&quot;&gt;&lt;/embed&gt;&lt;/object&gt;
</description>
			<author>강지훈</author>
			<guid>http://www.ghoon.net/21</guid>
			<comments>http://www.ghoon.net/21#entry21comment</comments>
			<pubDate>Thu, 21 May 2009 13:14:31 +0900</pubDate>
		</item>
		<item>
			<title>간단한 가변인자 샘플코드</title>
			<link>http://www.ghoon.net/17</link>
			<description>&lt;TEXTAREA class=c rows=10 cols=60 name=code&gt;
#include &amp;lt;stdarg.h&amp;gt;

static inline void error_exit(const char* fmt, const char* msg, ...)
{
    va_list args;
    va_start(args, msg);
    vfprintf(stderr, fmt, args);
    va_end(args);

    exit(1);
}
&lt;/TEXTAREA&gt; </description>
			<author>강지훈</author>
			<guid>http://www.ghoon.net/17</guid>
			<comments>http://www.ghoon.net/17#entry17comment</comments>
			<pubDate>Thu, 15 Jan 2009 22:09:01 +0900</pubDate>
		</item>
		<item>
			<title>Eclipse에서 괄호 짝 찾아가기.</title>
			<link>http://www.ghoon.net/15</link>
			<description>VI에서 Ctrl+]와 같은 기능&lt;br /&gt;
&lt;br /&gt;
이클립스에선 ctrl + shift + p&lt;br /&gt;
&lt;br /&gt;
이용규님 땡큐. ㅋㅋ&lt;br /&gt;</description>
			<author>강지훈</author>
			<guid>http://www.ghoon.net/15</guid>
			<comments>http://www.ghoon.net/15#entry15comment</comments>
			<pubDate>Tue, 09 Dec 2008 14:43:49 +0900</pubDate>
		</item>
		<item>
			<title>우분투에서 숫자키 먹통!?!??</title>
			<link>http://www.ghoon.net/14</link>
			<description>&lt;br /&gt;
언젠가부터.. 회사 내 컴퓨터가 오른쪽 숫자키가 먹통이 되어있었는데.. &lt;br /&gt;
&lt;br /&gt;난 거의 한달동안을 이렇게 불편한채로 그냥 써왔다. -_-;; 좀 게으름이 쩐당.;;&lt;br /&gt;
&lt;br /&gt;한영키가 속썩여 오늘 이런저런 셋팅을 해주던 중, 알아본 결과..&lt;br /&gt;
&lt;br /&gt;&lt;span style=&quot;text-decoration: underline; font-weight: bold;&quot;&gt;ctrl + shift + numlock&lt;/span&gt; 이 켜져있었던 것이다. 덜덜;&lt;br /&gt;
&lt;br /&gt;숫자패드로 마우스커서를 움직이는 기능을 제공하는 것이었는데, &lt;br /&gt;
&lt;br /&gt;난 몰르고 있었다. -_-&lt;br /&gt;
&lt;br /&gt;</description>
			<author>강지훈</author>
			<guid>http://www.ghoon.net/14</guid>
			<comments>http://www.ghoon.net/14#entry14comment</comments>
			<pubDate>Tue, 02 Dec 2008 20:06:11 +0900</pubDate>
		</item>
		<item>
			<title>libiconv로 euc-kr문자열 UTF-8으로 변환하는 함수 구현.</title>
			<link>http://www.ghoon.net/13</link>
			<description>&lt;textarea name=&quot;code&quot; class=&quot;cpp&quot; cols=&quot;60&quot; rows=&quot;10&quot;&gt;
/**
 * euckrToUtf8()
 *
 * @author     Ji-hoon Kang(luvflo@gmail.com)
 * @date    2008-11-26
 *
 * @description
 *     iconv를 사용하여 EUC-KR 문자열을 UTF-8으로 변환합니다.
 *
 */
string XpgUtil::euckrToUtf8(const char* szBuff)
{
    string retv;

    char* outbuf = NULL;
    char* out = NULL;

    size_t ileft = strlen(szBuff);
    size_t oleft = ileft * 2; //TODO: 임시로.. 확인 후 수정요망..

    out = outbuf = (char*)calloc(1, oleft + 1);

    iconv_t cd = iconv_open(&quot;UTF-8&quot;, &quot;EUC-KR&quot;);
    if(cd &lt; 0) {
        perror(&quot;:&quot;);
        if(out){
            free(out);
            out=outbuf=NULL;
        }
        return retv;
    }

    int err = iconv(cd, (char**)&amp;szBuff, &amp;ileft, &amp;outbuf, &amp;oleft);
    iconv_close(cd);
    *outbuf = 0;

    if(err &gt;= 0) retv.assign(out);
    if(out){
        free(out);
        out=outbuf=NULL;
    }

    return retv;
}
&lt;/textarea&gt;</description>
			<category>Development</category>
			<author>강지훈</author>
			<guid>http://www.ghoon.net/13</guid>
			<comments>http://www.ghoon.net/13#entry13comment</comments>
			<pubDate>Wed, 26 Nov 2008 09:38:12 +0900</pubDate>
		</item>
		<item>
			<title>curl URL redirection example</title>
			<link>http://www.ghoon.net/10</link>
			<description>&lt;textarea name=&quot;code&quot; class=&quot;c&quot; cols=&quot;60&quot; rows=&quot;10&quot;&gt;
/*
 * curl_redirection example
 *
 * @date 2008.11.10
 * @author Kang, Ji-Hoon (kang@ghoon.net)
 */
#include &lt;stdio.h&gt;
#include &lt;memory.h&gt;
#include &lt;curl/curl.h&gt;

typedef struct FtpFile {
    char filename[FILENAME_MAX];
    FILE* stream;
} FtpFile;


static size_t
header_callback(void* ptr, size_t size, size_t nmemb, void* stream)
{
    char* buff = (char*) ptr;
    const char* content_disposition = &quot;Content-Disposition: attachment;&quot;
        &quot;filename=&quot;;

    if (strstr(buff, content_disposition)) {
        FtpFile* pFileInfo = (FtpFile*) stream;
        memset(pFileInfo-&gt;filename, 0, sizeof(pFileInfo-&gt;filename));
        memcpy(pFileInfo-&gt;filename, buff+strlen(content_disposition),
                strlen(buff) - strlen(content_disposition) - 2);

        printf(&quot;catched filename : %s length : %d\n&quot;, pFileInfo-&gt;filename,
                strlen(pFileInfo-&gt;filename));
    }
    return size * nmemb;
}


static size_t
write_callback(void* buffer, size_t size, size_t nmemb, void* stream)
{
    FtpFile* out = (FtpFile*) stream;
    if ((out &amp;&amp; !out-&gt;stream) &amp;&amp; out-&gt;filename) {
        out-&gt;stream = fopen(out-&gt;filename, &quot;wb&quot;);
        if (!out-&gt;stream) {
            return -1;
        }
    }
    return fwrite(buffer, size, nmemb, out-&gt;stream);
}


/**
 * @param [in] hCurl - curl handle
 * @param [in] sURL -
 * @param [in] sLocalDir -
 * @return &#039;CURLE_OK&#039; ok, otherwise failure.
 */
static CURLcode
download(CURL* hCurl, const char* sURL, const char* sLocalDir)
{
    FtpFile localfile;
    memset(&amp;localfile, 0, sizeof(FtpFile));

    curl_easy_setopt(hCurl, CURLOPT_HEADERFUNCTION, header_callback);
    curl_easy_setopt(hCurl, CURLOPT_HEADERDATA, &amp;localfile);
    curl_easy_setopt(hCurl, CURLOPT_URL, sURL);
    curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, write_callback);
    curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, &amp;localfile);
    curl_easy_setopt(hCurl, CURLOPT_VERBOSE, 1);

    CURLcode res =  curl_easy_perform(hCurl);

    if (localfile.stream) {
        fclose(localfile.stream);
    }

    return res;
}


int main(int argc, char** argv)
{
    const char* sURL = &quot;http://fmov.pann.com/mmediaDownload.jsp?&quot;
        &quot;FileID=12992569&quot;;
    const char* sLocalDir = &quot;/home/david/Download&quot;;
    CURL* hCurl = NULL;

    curl_global_init(CURL_GLOBAL_ALL);
    hCurl = curl_easy_init();

    download(hCurl, sURL, sLocalDir);

    curl_easy_cleanup(hCurl);
    curl_global_cleanup();

    return 0;
}
&lt;/textarea&gt;</description>
			<category>cURL</category>
			<author>강지훈</author>
			<guid>http://www.ghoon.net/10</guid>
			<comments>http://www.ghoon.net/10#entry10comment</comments>
			<pubDate>Tue, 11 Nov 2008 10:27:19 +0900</pubDate>
		</item>
		<item>
			<title>[Linux C API]mac address가져오기.</title>
			<link>http://www.ghoon.net/9</link>
			<description>&lt;textarea name=&quot;code&quot; class=&quot;cpp&quot;&gt;
#include &lt;stdio.h&gt;
#include &lt;sys/ioctl.h&gt;
#include &lt;unistd.h&gt;
#include &lt;memory.h&gt;
#include &lt;netinet/ether.h&gt;
#include &lt;net/if.h&gt;

/**
 * Gets mac address with specified interface name.
 *
 * @param szInfName [in] interface name.
 * @param szMAC [out] retrieved mac address.
 * @param nLen [out] size of mac address string.
 * @return 0 is success, otherwise failure.
 *
 * @author Kang, Ji-Hoon (kang@ghoon.com)
 * @date 2008-11-07
 */
int getMacAddr(const char* szInfName, char* szMac, int* nLen)
{
    char* mac_addr = NULL;
    struct ifreq  ifrq;
    int fd = socket(AF_INET, SOCK_DGRAM, 0);
    struct sockaddr *sa = NULL;

    memset(&amp;ifrq, 0, sizeof(ifrq));
    strcpy(ifrq.ifr_name , szInfName);

    if (ioctl(fd, SIOCGIFHWADDR, &amp;ifrq) &lt; 0) {
        close(fd);
        fprintf(stderr, &quot;%s:%d&gt; ERROR getMacAddr&quot;, __FILE__, __LINE__);
        return 1;
    }

    sa = &amp;(ifrq.ifr_hwaddr);
    mac_addr = (char*) ether_ntoa((struct ether_addr*) sa-&gt;sa_data );
    if (mac_addr == NULL) {
        return 1;
    }

    memset(szMac, 0, sizeof(szMac));
    sprintf(szMac, &quot;%s&quot;, mac_addr);
    *nLen = strlen(szMac);

    close(fd);
    return 0;

}

int main(int argc, char** argv)
{
    char sMacAddr[64] = {0,};
    int nLength = 0;
    if (getMacAddr(sMacAddr, &amp;nLength) != 0) {
        return 1;
    }
    printf(&quot;MacAddr : %s\nString length : %d\n&quot;, sMacAddr, nLength);
    return 0;

}
&lt;/textarea&gt;</description>
			<category>Development</category>
			<author>강지훈</author>
			<guid>http://www.ghoon.net/9</guid>
			<comments>http://www.ghoon.net/9#entry9comment</comments>
			<pubDate>Mon, 10 Nov 2008 09:43:43 +0900</pubDate>
		</item>
		<item>
			<title>클래스의 메소드에 대한 포인터넘기기.</title>
			<link>http://www.ghoon.net/6</link>
			<description>&lt;P&gt;poco library를 살펴보다가, 좋은 아이디어가 있어서, 남긴다.&lt;br /&gt;
&lt;br /&gt;C에서의 함수포인터 처럼, C++객체의 메소드를 포인터로 넘길 수 없을까? 라는 생각을 하고 있었는데,&lt;br /&gt;
그것에 대한 어느정도의 해답이 된 것 같다.&lt;br /&gt;
&lt;br /&gt;객체 내에 static으로 구현된 멤버 메소드는 그냥 함수포인터 처럼 넘기는 것이 가능하다.&lt;br /&gt;
그렇지 않고, static이 아닌 public으로 되어있는 멤버에 대한 포인터를 넘기는 방법을 어떻게 될까?&lt;br /&gt;
&lt;br /&gt;이거.. 나만 모르고 있었던 건가 --;;.......&lt;br /&gt;
&lt;br /&gt;편의상 인라인으로 처리한다.. &lt;br /&gt;

&lt;textarea name=&quot;code&quot; class=&quot;cpp&quot;&gt;
#include &lt;iostream&gt;

using namespace std;

class MyObject
{
public:
    MyObject(){};
    ~MyObject(){};
public:
    void callback() {
        cout &lt;&lt; &quot;call me&quot; &lt;&lt; endl;
    }
};

class JHObject
{
public:
    JHObject(){};
    ~JHObject(){};
public:
    void run(MyObject* obj, void (MyObject::*pMethod)()) {
          (obj-&gt;*pMethod)();
    }
};

int main()
{
    MyObject my;
    JHObject jh;
    jh.run(&amp;my, &amp;MyObject::callback);
    return 0;
}
&lt;/textarea&gt;

간단했다.. 역시 알면 간단, 모르면 -_- 안드로메다..;;&lt;br /&gt;
객체에대한 메서드를 포인터로 넘길때에는 그 메서드를 호출할 객체에 대한 포인터도&lt;br /&gt;
함께 넘겨야 했던 것이다...&lt;br /&gt;
&lt;br /&gt;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
			<category>메소드포인터</category>
			<author>강지훈</author>
			<guid>http://www.ghoon.net/6</guid>
			<comments>http://www.ghoon.net/6#entry6comment</comments>
			<pubDate>Thu, 11 Sep 2008 20:32:12 +0900</pubDate>
		</item>
	</channel>
</rss>

