<?xml version="1.0" encoding="UTF-8" ?>
<feed xmlns="http://www.w3.org/2005/Atom">
   <title type="text">달의 한조각이 머무는곳</title>
      <updated>2012-05-19T23:37:12+09:00</updated>
   <id>http://www.lunapiece.net/index.php?module=rss&amp;act=atom</id>
   <link rel="alternate" type="text/html" hreflang="en" href="http://www.lunapiece.net/"/>
   <link rel="self" type="application/atom+xml" href="http://www.lunapiece.net/index.php?module=rss&amp;act=atom"/>
   <generator uri="http://www.xpressengine.com/">XpressEngine</generator>
   <entry>
      <title>WPF XAML Resource Loading In Code</title>
      <id>http://www.lunapiece.net/503005</id>
      <published>2012-05-14T15:26:49+09:00</published>
      <updated>2012-05-14T15:26:49+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/503005"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/503005#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;pre style=&quot;font-family: NanumGothicCoding; background-color: white; background-position: initial initial; background-repeat: initial initial; &quot;&gt;&lt;span style=&quot;color:#2b91af;&quot;&gt;App&lt;/span&gt;.Current.Resources[&lt;span style=&quot;color:#a31515;&quot;&gt;&quot;ResourceName&quot;&lt;/span&gt;]&amp;nbsp;&lt;span style=&quot;color:blue;&quot;&gt;as&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:#2b91af;&quot;&gt;ResoruceType&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>리눅스 포트 Listen 상태/데몬 확인</title>
      <id>http://www.lunapiece.net/461208</id>
      <published>2012-05-09T09:40:58+09:00</published>
      <updated>2012-05-09T09:40:58+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/461208"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/461208#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;p&gt;netstat -nap | grep LISTEN&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;으로 확인 가능&lt;/p&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>웹서비스 Forbidden 에러 필요 권한</title>
      <id>http://www.lunapiece.net/461133</id>
      <published>2012-05-09T09:33:33+09:00</published>
      <updated>2012-05-09T09:42:46+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/461133"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/461133#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;div&gt;아파치로 웹서비스를 하려면 폴더는 711, 파일은 644 권한이 필요하다&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;아래와 같이 하면 한큐에 바뀜&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;find [경로명] -type d -exec chmod 711 {} \;&lt;/div&gt;&lt;div&gt;find [경로명] -type f -exec chmod 644 {} \;&lt;/div&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>XE IIS + PHP WinCache(Windows Cache Extension) 세팅</title>
      <id>http://www.lunapiece.net/346133</id>
      <published>2012-04-27T15:06:06+09:00</published>
      <updated>2012-04-27T15:21:33+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/346133"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/346133#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;div&gt;IIS의 Web Platform Installer에서 Windows Cache Extension 1.1 for PHP 로 검색해서 설치 후&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;[XE루트]\files\config\db.config.php 아래 두줄을 추가한다&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;$db_info-&amp;gt;use_object_cache = &apos;wincache&apos;;&amp;nbsp;&lt;/div&gt;&lt;div&gt;$db_info-&amp;gt;use_template_cache = &apos;wincache&apos;;&lt;/div&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>[작성중] C++ 에서 Fiber 를 이용한 Coroutine 사용하기</title>
      <id>http://www.lunapiece.net/101670</id>
      <published>2012-04-02T16:32:19+09:00</published>
      <updated>2012-04-02T16:32:19+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/101670"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/101670#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;pre style=&quot;font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; &quot;&gt;&lt;pre style=&quot;font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; &quot;&gt;&amp;lt;작성중&amp;gt;&lt;/pre&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; &quot;&gt;소스는 첨부파일에. &lt;/pre&gt;&lt;pre style=&quot;font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; &quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:#a31515;&quot;&gt;&amp;lt;cstdio&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:#a31515;&quot;&gt;&amp;lt;windows.h&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:#a31515;&quot;&gt;&quot;Coroutine.h&quot;&lt;/span&gt;
 
&lt;span style=&quot;color:blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;NumberCount&amp;nbsp;:&amp;nbsp;&lt;span style=&quot;color:blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;Coroutine&amp;lt;&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;gt;
{
&lt;span style=&quot;color:blue;&quot;&gt;protected&lt;/span&gt;:
	&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt;&amp;nbsp;Execute()&amp;nbsp;&lt;span style=&quot;color:blue;&quot;&gt;override&lt;/span&gt;
	{
		&lt;span style=&quot;color:blue;&quot;&gt;for&lt;/span&gt;&amp;nbsp;(&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;i&amp;nbsp;=&amp;nbsp;0;&amp;nbsp;i&amp;nbsp;&amp;lt;&amp;nbsp;100;&amp;nbsp;++i)
		{			
			yield_return(i);
		}
	}
};
 
&lt;span style=&quot;color:blue;&quot;&gt;class&lt;/span&gt;&amp;nbsp;NumberPrint&amp;nbsp;:&amp;nbsp;&lt;span style=&quot;color:blue;&quot;&gt;public&lt;/span&gt;&amp;nbsp;Coroutine&amp;lt;&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt;&amp;gt;
{
&lt;span style=&quot;color:blue;&quot;&gt;protected&lt;/span&gt;:
	&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt;&amp;nbsp;Execute()&amp;nbsp;&lt;span style=&quot;color:blue;&quot;&gt;override&lt;/span&gt;
	{
		&lt;span style=&quot;color:blue;&quot;&gt;for&lt;/span&gt;&amp;nbsp;(&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;i&amp;nbsp;=&amp;nbsp;0;&amp;nbsp;i&amp;nbsp;&amp;lt;&amp;nbsp;100;&amp;nbsp;++i)
		{		
			printf(&lt;span style=&quot;color:#a31515;&quot;&gt;&quot;NumberPrint&amp;nbsp;:&amp;nbsp;%d\n&quot;&lt;/span&gt;,&amp;nbsp;i);
			yield;
		}
	}
};
 
&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt;&amp;nbsp;wmain()
{	
	ConvertThreadToFiber((LPVOID)GetCurrentThreadId());
	
	NumberCount&amp;nbsp;Co1;
	NumberPrint&amp;nbsp;Co2;
 
	&lt;span style=&quot;color:blue;&quot;&gt;for&lt;/span&gt;&amp;nbsp;(&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;i&amp;nbsp;=&amp;nbsp;0;&amp;nbsp;i&amp;nbsp;&amp;lt;&amp;nbsp;100;&amp;nbsp;++i)
	{
		printf(&lt;span style=&quot;color:#a31515;&quot;&gt;&quot;NumberCount&amp;nbsp;:&amp;nbsp;%d\n&quot;&lt;/span&gt;,&amp;nbsp;Co1.Resume());
		Co2.Resume();
		Sleep(1000);
	}	
}
 
&lt;/pre&gt;&lt;pre style=&quot;font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; &quot;&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>WPF 테마 쓰기</title>
      <id>http://www.lunapiece.net/72691</id>
      <published>2012-03-29T20:12:35+09:00</published>
      <updated>2012-03-29T23:55:17+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/72691"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/72691#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;pre style=&quot;font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; &quot;&gt;&lt;font color=&quot;#0000ff&quot;&gt;&lt;span style=&quot;color: rgb(0, 0, 0); &quot;&gt;App.xaml에 아래처럼 한 줄을 추가한다&lt;/span&gt;&lt;/font&gt;&lt;/pre&gt;&lt;pre style=&quot;font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; &quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#a31515;&quot;&gt;Application.Resources&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:#a31515;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color:#a31515;&quot;&gt;ResourceDictionary&lt;/span&gt;&lt;span style=&quot;color:red;&quot;&gt;&amp;nbsp;Source&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&quot;테마파일.xaml&quot;&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&amp;nbsp;/&amp;gt; &lt;b&gt;&lt;span style=&quot;color: rgb(255, 0, 0); &quot;&gt;&amp;lt;--여기를 추가한다&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;
&lt;span style=&quot;color:blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color:#a31515;&quot;&gt;Application.Resources&lt;/span&gt;&lt;span style=&quot;color:blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>윈도우8 커널디버깅이 가능한 NIC 리스트</title>
      <id>http://www.lunapiece.net/27661</id>
      <published>2012-03-23T13:20:48+09:00</published>
      <updated>2012-05-17T17:57:13+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/27661"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/27661#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/hardware/hh830880&quot;&gt;http://msdn.microsoft.com/en-us/library/windows/hardware/hh830880&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;그냥 평이한것들이면 그럭저럭 되는 듯 하다&lt;/p&gt;
&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/hardware/hh830880&quot;&gt;&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/windows/hardware/hh830880&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/a&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>[작성중] v8 스크립트 연동</title>
      <id>http://www.lunapiece.net/27620</id>
      <published>2012-03-09T15:52:05+09:00</published>
      <updated>2012-03-09T15:52:05+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/27620"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/27620#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;p&gt;1. v8 빌드&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;2. 사용법&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>VS2010 임시파일(sdf, ipch) 위치 옮기기</title>
      <id>http://www.lunapiece.net/27583</id>
      <published>2012-03-04T13:33:08+09:00</published>
      <updated>2012-03-29T11:19:17+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/27583"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/27583#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;p&gt;여기에 적어두면 된다.&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;http://lunapiece.net/files/attach/images/101/583/027/44e8c0ae0e48f35cb691846a7f38e92b.png&quot; alt=&quot;Untitled.png&quot; class=&quot;iePngFix&quot; width=&quot;757&quot; height=&quot;440&quot; style=&quot;&quot; /&gt;&lt;/p&gt;&lt;p&gt;SSD라서 저 임시파일 용량도 상당히 신경쓰인다.&lt;/p&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>json 문법 검사 사이트</title>
      <id>http://www.lunapiece.net/27499</id>
      <published>2012-02-28T16:03:40+09:00</published>
      <updated>2012-03-31T17:38:51+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/27499"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/27499#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;p&gt;&lt;a href=&quot;http://jsonlint.com/&quot;&gt;http://jsonlint.com/&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;파싱 에러난 위치까지 알려줘서 편리하다&lt;/p&gt;&lt;a href=&quot;http://jsonlint.com/&quot;&gt;&lt;p&gt;&lt;a href=&quot;http://jsonlint.com/&quot;&gt;&lt;/a&gt;


&lt;/p&gt;&lt;/a&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>[작성중] 알려진 포트</title>
      <id>http://www.lunapiece.net/27492</id>
      <published>2012-02-19T22:45:14+09:00</published>
      <updated>2012-02-22T15:32:13+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/27492"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/27492#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;p&gt;TCP&lt;/p&gt;&lt;p&gt;80 : Http&lt;/p&gt;&lt;p&gt;21 : Ftp&lt;/p&gt;&lt;p&gt;3389 : RDP (Windows 원격 데스크탑)&lt;/p&gt;&lt;p&gt;22 : SSH&lt;/p&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>ReadFileEx, WriteFileEx</title>
      <id>http://www.lunapiece.net/27479</id>
      <published>2012-02-14T15:12:47+09:00</published>
      <updated>2012-02-14T15:12:47+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/27479"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/27479#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;p&gt;윈도우즈는 하위호환성을 극히 중시하는 OS이다.&lt;/p&gt;&lt;p&gt;물론 부정할 사람도 있긴 하겠지만.....&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;CPU갈아엎고(!) OS갈아엎고(!!), 과거 호환성따위는 개나먹으라고 주장하는 MacOS나, 심하면 몇개월마다 새 버전이 나오고(Ubuntu) 길어봐야 5년인 유지보수기간(2002년에 나온 Windows XP는 아직도 지원하고있다!) 을 가지는 리눅스에 비하면 하위호환성에선 따라올자가 없는 최고의 OS이다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그런 윈도우즈인 만큼 OS에 기능추가를 할 경우 기존의 API의 동작을 변경하는것이 아니라 API를 추가하는 식으로 개선하게 되는데, 그럴경우 함수 뒤에 Ex를 붙이는 경우가 많다.&lt;/p&gt;&lt;p&gt;실제 Ex가 붙지 않은 함수를 호출하면 내부적으로 Ex함수를 호출하는경우가 거의 대부분이다. 이말은 Ex함수는 구식함수의 기능을 모두 포함하고 있다는 말이 된다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그런데 여기 예외가 2개 있는데... ReadFileEx, WriteFileEx는 각각 ReadFile, WriteFile 의 가장 일반적인 기능인 &quot;동기IO&quot; 를 불가능하게 빼버렷다 (...) 간단히 말해서 무조건 비동기모드로만 동작한단 소리다. 비동기 아니면 쓰지도 말자(사실 비동기라 해도 쓸데없는 동작완료된 Byte수 알려주는 변수 하나 빠진것 외엔 편하지도 않다)&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;결론 : &lt;b&gt;ReadFileEx, WriteFileEx는 비동기 전용!&lt;/b&gt;&lt;/p&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>Redmine 1.3.1 의존성</title>
      <id>http://www.lunapiece.net/27460</id>
      <published>2012-02-12T23:55:27+09:00</published>
      <updated>2012-03-31T17:38:51+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/27460"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/27460#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;p&gt;Ruby : 1.8.7&lt;/p&gt;&lt;p&gt;Rails : 2.3.14&lt;/p&gt;&lt;p&gt;Rack : 1.1.1&lt;/p&gt;&lt;p&gt;Gem : 1.6.4 (이거 특히 중요하다. 윈도우즈 배포판을 사용할경우 Gem 의 다운그레이드가필요)&lt;/p&gt;&lt;p&gt;Mysql DLL : 최신버전은 안된다.&amp;nbsp;&lt;a href=&quot;http://lunapiece.net/?module=file&amp;amp;act=procFileDownload&amp;amp;file_srl=27461&amp;amp;sid=496050531227831b53dc2a29fc3e5f60&quot;&gt;libmysql.dll&lt;/a&gt;&amp;nbsp;를 사용해라.&lt;/p&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>C++11 lambda 간단사용법과 성능비교.</title>
      <id>http://www.lunapiece.net/27419</id>
      <published>2012-01-29T16:46:38+09:00</published>
      <updated>2012-01-29T16:46:38+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/27419"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/27419#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;p&gt;C++의 STL 에서는 여러가지 알고리즘을 제공한다.&lt;br /&gt;그중 &quot;임의의&quot; 동작을 할 수 있는 알고리즘들은 그 &quot;동작&quot; 의 대상이 되는 인자를 받도록 되어 있는데,&amp;nbsp;&lt;br /&gt;그 &quot;동작&quot;의 조건은&lt;span style=&quot;color: rgb(255, 0, 0); font-size: 18px; &quot;&gt; &lt;/span&gt;&lt;b&gt;&lt;span style=&quot;color: rgb(255, 0, 0); font-size: 18px; &quot;&gt;()연산자로 호출이 가능할것&lt;/span&gt;&lt;/b&gt;! 이다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;그 동작을 만족시키는것은 C에서는 함수가 있다.&lt;br /&gt;또 C++에서는 STL 과 함께 소개된 함수객체(Functor)가 있으며, STL 초기부터 제공된 bind1st, bind2nd가 있고, boost에서 제공되는 mem_fn 도 있으며, 이 모든것을 통합한 범용 bind(C++11 or boost에 포함)도 존재한다.&lt;/p&gt;&lt;p&gt;그리고 최신의 C++11 표준에 포함된 lambda도 있고, boost의 lambda도 있지만, 이쪽은 C++11 표준에 lambda가 포함 된 이상 더이상 쓸 일은 없을테니 이번 실험에선 제외한다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;실험순서는 전역함수, bind된 전역함수, 함수객체, 람다, bind된 람다, auto를 이용해 bind된 람다 의 순이다.&lt;/p&gt;&lt;p&gt;실험은 Visual C++ 2010 Sp1, x86 Debug Build에서 테스트 하엿다. Release Mode 도 특성은 동일하다.&lt;/p&gt;&lt;p&gt;궂이 Debug Build로 테스트 한 이유는 Release모드에서 자꾸 전역함수를 inline화 시키는 바람에 =_=;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;코드 나간다.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;table style=&quot;background:#CCCCCC&quot; cellspacing=&quot;1&quot;&gt;&lt;tbody&gt;&lt;tr style=&quot;background:#FFFFFF&quot;&gt;&lt;td&gt;&lt;pre style=&quot;font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; &quot;&gt;&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;&amp;lt;cstdlib&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;&amp;lt;cstdio&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;&amp;lt;vector&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;&amp;lt;random&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;&amp;lt;cstdint&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;&amp;lt;algorithm&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;&amp;lt;functional&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color:blue;&quot;&gt;#include&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;&amp;lt;windows.h&amp;gt;&lt;/span&gt;
 
&lt;span style=&quot;color:blue;&quot;&gt;using&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:blue;&quot;&gt;namespace&lt;/span&gt;&amp;nbsp;std;
 
&lt;span style=&quot;color:blue;&quot;&gt;__int64&lt;/span&gt;&amp;nbsp;g_NumberSum;
 
&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt;&amp;nbsp;GetSumFunction(&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;Num)
{
	g_NumberSum&amp;nbsp;=&amp;nbsp;g_NumberSum&amp;nbsp;+&amp;nbsp;Num;
}
 
&lt;span style=&quot;color:blue;&quot;&gt;struct&lt;/span&gt;&amp;nbsp;GetSumFunctor
{
	&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:blue;&quot;&gt;operator&lt;/span&gt;()(&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;Num)
	{
		g_NumberSum&amp;nbsp;=&amp;nbsp;g_NumberSum&amp;nbsp;+&amp;nbsp;Num;
	}
};
 
&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt;&amp;nbsp;wmain()
{
	&lt;span style=&quot;color:blue;&quot;&gt;const&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;NUMBER_COUNT&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;100000000&lt;/span&gt;;
 
	mt19937_64&amp;nbsp;RandomEngine;
	uniform_int&amp;nbsp;&amp;lt;&amp;gt;&amp;nbsp;RandomRange(&lt;span style=&quot;color:red;&quot;&gt;0&lt;/span&gt;,&amp;nbsp;INT32_MAX);
	RandomEngine.seed(GetTickCount());
 
	vector&amp;lt;&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;gt;&amp;nbsp;RandumNumbers;
	RandumNumbers.reserve(NUMBER_COUNT);
	&lt;span style=&quot;color:blue;&quot;&gt;for&lt;/span&gt;&amp;nbsp;(&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;i&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;0&lt;/span&gt;;&amp;nbsp;i&amp;nbsp;&amp;lt;&amp;nbsp;NUMBER_COUNT;&amp;nbsp;++i)
	{
		RandumNumbers.push_back(RandomRange(RandomEngine));
	}
 
	DWORD&amp;nbsp;Tick;
&lt;span style=&quot;color:green;&quot;&gt;//function&lt;/span&gt;
	g_NumberSum&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;0&lt;/span&gt;;
	Tick&amp;nbsp;=&amp;nbsp;GetTickCount();
	for_each(RandumNumbers.begin(),&amp;nbsp;RandumNumbers.end(),&amp;nbsp;GetSumFunction);
	printf(&lt;span style=&quot;color:red;&quot;&gt;&quot;Global&amp;nbsp;Function&amp;nbsp;::&amp;nbsp;Sum&amp;nbsp;:&amp;nbsp;%I64d,&amp;nbsp;Time&amp;nbsp;:&amp;nbsp;%dms\n&quot;&lt;/span&gt;,&amp;nbsp;g_NumberSum,&amp;nbsp;GetTickCount()&amp;nbsp;-&amp;nbsp;Tick);
&lt;span style=&quot;color:green;&quot;&gt;//bind&amp;nbsp;function&lt;/span&gt;
	g_NumberSum&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;0&lt;/span&gt;;
	function&amp;lt;&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt;(&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;)&amp;gt;&amp;nbsp;FunctionObject&amp;nbsp;=&amp;nbsp;bind(&amp;amp;GetSumFunction,&amp;nbsp;tr1::placeholders::_1);
	Tick&amp;nbsp;=&amp;nbsp;GetTickCount();
	for_each(RandumNumbers.begin(),&amp;nbsp;RandumNumbers.end(),&amp;nbsp;FunctionObject);
	printf(&lt;span style=&quot;color:red;&quot;&gt;&quot;Bind&amp;nbsp;Function&amp;nbsp;&amp;nbsp;&amp;nbsp;::&amp;nbsp;Sum&amp;nbsp;:&amp;nbsp;%I64d,&amp;nbsp;Time&amp;nbsp;:&amp;nbsp;%dms\n&quot;&lt;/span&gt;,&amp;nbsp;g_NumberSum,&amp;nbsp;GetTickCount()&amp;nbsp;-&amp;nbsp;Tick);
&lt;span style=&quot;color:green;&quot;&gt;//functor&lt;/span&gt;
	g_NumberSum&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;0&lt;/span&gt;;
	Tick&amp;nbsp;=&amp;nbsp;GetTickCount();	
	for_each(RandumNumbers.begin(),&amp;nbsp;RandumNumbers.end(),&amp;nbsp;GetSumFunctor());
	printf(&lt;span style=&quot;color:red;&quot;&gt;&quot;Functor&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;::&amp;nbsp;Sum&amp;nbsp;:&amp;nbsp;%I64d,&amp;nbsp;Time&amp;nbsp;:&amp;nbsp;%dms\n&quot;&lt;/span&gt;,&amp;nbsp;g_NumberSum,&amp;nbsp;GetTickCount()&amp;nbsp;-&amp;nbsp;Tick);
&lt;span style=&quot;color:green;&quot;&gt;//C++&amp;nbsp;11&amp;nbsp;Lambda&lt;/span&gt;
	g_NumberSum&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;0&lt;/span&gt;;
	Tick&amp;nbsp;=&amp;nbsp;GetTickCount();
	for_each(RandumNumbers.begin(),&amp;nbsp;RandumNumbers.end(),&amp;nbsp;
		[](&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;Num)
		{
			g_NumberSum&amp;nbsp;=&amp;nbsp;g_NumberSum&amp;nbsp;+&amp;nbsp;Num;
		});
	printf(&lt;span style=&quot;color:red;&quot;&gt;&quot;C++11&amp;nbsp;Lambda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;::&amp;nbsp;Sum&amp;nbsp;:&amp;nbsp;%I64d,&amp;nbsp;Time&amp;nbsp;:&amp;nbsp;%dms\n&quot;&lt;/span&gt;,&amp;nbsp;g_NumberSum,&amp;nbsp;GetTickCount()&amp;nbsp;-&amp;nbsp;Tick);
&lt;span style=&quot;color:green;&quot;&gt;//C++11&amp;nbsp;Bind&amp;nbsp;Lambda&lt;/span&gt;
	g_NumberSum&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;0&lt;/span&gt;;
	Tick&amp;nbsp;=&amp;nbsp;GetTickCount();
	function&amp;lt;&lt;span style=&quot;color:blue;&quot;&gt;void&lt;/span&gt;(&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;)&amp;gt;&amp;nbsp;BindLambda&amp;nbsp;=&amp;nbsp;
		[](&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;Num)
		{
			g_NumberSum&amp;nbsp;=&amp;nbsp;g_NumberSum&amp;nbsp;+&amp;nbsp;Num;
		};
	for_each(RandumNumbers.begin(),&amp;nbsp;RandumNumbers.end(),&amp;nbsp;BindLambda);
	printf(&lt;span style=&quot;color:red;&quot;&gt;&quot;Bind&amp;nbsp;Lambda&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;::&amp;nbsp;Sum&amp;nbsp;:&amp;nbsp;%I64d,&amp;nbsp;Time&amp;nbsp;:&amp;nbsp;%dms\n&quot;&lt;/span&gt;,&amp;nbsp;g_NumberSum,&amp;nbsp;GetTickCount()&amp;nbsp;-&amp;nbsp;Tick);
&lt;span style=&quot;color:green;&quot;&gt;//C++11&amp;nbsp;Auto&amp;nbsp;bind&amp;nbsp;Lambda&lt;/span&gt;
	g_NumberSum&amp;nbsp;=&amp;nbsp;&lt;span style=&quot;color:red;&quot;&gt;0&lt;/span&gt;;
	Tick&amp;nbsp;=&amp;nbsp;GetTickCount();
	&lt;span style=&quot;color:blue;&quot;&gt;auto&lt;/span&gt;&amp;nbsp;AutoBindLambda&amp;nbsp;=&amp;nbsp;
		[](&lt;span style=&quot;color:blue;&quot;&gt;int&lt;/span&gt;&amp;nbsp;Num)
		{
			g_NumberSum&amp;nbsp;=&amp;nbsp;g_NumberSum&amp;nbsp;+&amp;nbsp;Num;
		};
	for_each(RandumNumbers.begin(),&amp;nbsp;RandumNumbers.end(),&amp;nbsp;AutoBindLambda);
	printf(&lt;span style=&quot;color:red;&quot;&gt;&quot;Auto&amp;nbsp;Bind&amp;nbsp;Lambda::&amp;nbsp;Sum&amp;nbsp;:&amp;nbsp;%I64d,&amp;nbsp;Time&amp;nbsp;:&amp;nbsp;%dms\n&quot;&lt;/span&gt;,&amp;nbsp;g_NumberSum,&amp;nbsp;GetTickCount()&amp;nbsp;-&amp;nbsp;Tick);&amp;nbsp;&lt;/pre&gt;&lt;pre style=&quot;font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: white; background-position: initial initial; background-repeat: initial initial; &quot;&gt;&lt;span style=&quot;background-color: white; &quot;&gt;}&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;아래는 결과이다.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;img src=&quot;http://lunapiece.net/files/attach/images/434/419/027/be84973e4db0a1e5be5b28a08f4dec80.png&quot; alt=&quot;lambda.png&quot; class=&quot;iePngFix&quot; width=&quot;677&quot; height=&quot;442&quot; style=&quot;&quot; /&gt;
&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;결과를 보면 lambda 가 가장 빠른 것을 볼 수 있다. 길게 나불대지 않고 성능 이슈와 원인을 아래 간략히 적어본다.&lt;br /&gt;1. 전역함수의 경우 함수 Call 오버헤드에 의해 속도가 조금 감소하엿다.&lt;/p&gt;&lt;p&gt;2. lambda, functor 는 사실상 오차범위 내의 차이라고 보인다.&lt;/p&gt;&lt;p&gt;3. bind lambda 의 경우는 std::fuction 객체가 함수호출 정보를 RTTI에 의존하는 특징때문에 속도를 왕창 까먹게 된다.&lt;/p&gt;&lt;p&gt;4. bind 된 전역함수의 경우는 RTTI의 오버헤드 + 함수호출로 인해 가장 느려진다.&lt;/p&gt;&lt;p&gt;5. auto를 사용해 변수에 저장한 lambda 는 std::fuction객체에 저장 하는 것이 아니라 일종의 inline 함수처럼 구현해준다. 그래서 오버헤드가 전혀 없이 빠른 속도를 보여준다. 즉 같은 함수객체를 2번이상 이용 할 경우 코드를 Copy&amp;amp;Paste 하지 않아도 auto를 이용하면 성능과 중복방지 두마리 코드를 다 잡을 수 있다.&lt;/p&gt;&lt;/div&gt;</content>
                  
   </entry>
   <entry>
      <title>BeginInvoke 호출시 Parameter 넘기기</title>
      <id>http://www.lunapiece.net/27367</id>
      <published>2012-01-16T09:26:25+09:00</published>
      <updated>2012-01-16T09:26:25+09:00</updated>
      <link rel="alternate" type="text/html" href="http://www.lunapiece.net/27367"/>
      <link rel="replies" type="text/html" href="http://www.lunapiece.net/27367#comment"/>
      <author>
         <name>Lyn</name>
               </author>
            <content type="html">&lt;div class=&quot;xe_content&quot;&gt;&lt;pre style=&quot;color: rgb(51, 51, 51); background-color: white; font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; &quot;&gt;
&lt;a href=&quot;http://www.devpia.com/Maeul/Contents/Detail.aspx?BoardID=17&amp;amp;MAEULNo=8&amp;amp;no=142680&amp;amp;ref=142680&quot;&gt;http://www.devpia.com/Maeul/Contents/Detail.aspx?BoardID=17&amp;amp;MAEULNo=8&amp;amp;no=142680&amp;amp;ref=142680&lt;/a&gt;

&lt;/pre&gt;&lt;pre style=&quot;color: rgb(51, 51, 51); background-color: white; font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; &quot;&gt;Devpia 질문으로 올라왔다.&lt;/pre&gt;&lt;pre style=&quot;color: rgb(51, 51, 51); background-color: white; font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; &quot;&gt;&lt;span style=&quot;color: blue; &quot;&gt;    public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue; &quot;&gt;delegate&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue; &quot;&gt;int&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: rgb(43, 145, 175); &quot;&gt;deleg&lt;/span&gt;(&lt;span style=&quot;color: blue; &quot;&gt;int&lt;/span&gt;&amp;nbsp;a);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue; &quot;&gt;public&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue; &quot;&gt;int&lt;/span&gt;&amp;nbsp;helloworld(&lt;span style=&quot;color: blue; &quot;&gt;int&lt;/span&gt;&amp;nbsp;a)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: rgb(43, 145, 175); &quot;&gt;MessageBox&lt;/span&gt;.Show(a.ToString());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue; &quot;&gt;return&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: red; &quot;&gt;0&lt;/span&gt;;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue; &quot;&gt;private&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue; &quot;&gt;void&lt;/span&gt;&amp;nbsp;Form1_Load(&lt;span style=&quot;color: blue; &quot;&gt;object&lt;/span&gt;&amp;nbsp;sender,&amp;nbsp;&lt;span style=&quot;color: rgb(43, 145, 175); &quot;&gt;EventArgs&lt;/span&gt;&amp;nbsp;e)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;color: blue; &quot;&gt;this&lt;/span&gt;.BeginInvoke(&lt;span style=&quot;color: blue; &quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: rgb(43, 145, 175); &quot;&gt;deleg&lt;/span&gt;(helloworld),&amp;nbsp;&lt;span style=&quot;color: blue; &quot;&gt;new&lt;/span&gt;&amp;nbsp;&lt;span style=&quot;color: blue; &quot;&gt;object&lt;/span&gt;[]&amp;nbsp;{&lt;span style=&quot;color: red; &quot;&gt;3&lt;/span&gt;});
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/pre&gt;&lt;pre style=&quot;color: rgb(51, 51, 51); background-color: white; font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; &quot;&gt;코드 보면 알 수 있을만큼 간단한다.&lt;/pre&gt;&lt;pre style=&quot;color: rgb(51, 51, 51); background-color: white; font-family: NanumGothicCoding; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; &quot;&gt;BeginInvoke 를 호출 하면서 delegate 외에 파라메터를 object 배열로 생성해서 넘겨주면 된다.
파라메터 갯수 안맞으면 바로 익셉션이니 주의!&lt;/pre&gt;&lt;/div&gt;</content>
                  
   </entry>
</feed> 

