<?xml version="1.0" encoding="UTF-8" ?><rdf:RDF 
  xmlns="http://purl.org/rss/1.0/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:atom="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xml:lang="ja">
  <channel rdf:about="http://w.atwiki.jp/mlnk/">
    <title>備忘録 @ ウィキ</title>
    <link>http://w.atwiki.jp/mlnk/</link>
    <atom:link href="https://w.atwiki.jp/mlnk/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>備忘録 @ ウィキ</description>

    <dc:language>ja</dc:language>
    <dc:date>2009-02-17T19:52:42+09:00</dc:date>
    <utime>1234867962</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/mlnk/pages/38.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mlnk/pages/37.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mlnk/pages/36.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mlnk/pages/35.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mlnk/pages/34.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mlnk/pages/33.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mlnk/pages/32.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mlnk/pages/31.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mlnk/pages/30.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/mlnk/pages/29.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/mlnk/pages/38.html">
    <title>文字コード</title>
    <link>https://w.atwiki.jp/mlnk/pages/38.html</link>
    <description>
      #include_js(http://www39.atwiki.jp/mlnk/?cmd=upload&amp;act=open&amp;page=%E6%96%87%E5%AD%97%E3%82%B3%E3%83%BC%E3%83%89&amp;file=ecl.js)
#include_js(http://www39.atwiki.jp/mlnk/?cmd=upload&amp;act=open&amp;page=%E6%96%87%E5%AD%97%E3%82%B3%E3%83%BC%E3%83%89&amp;file=encoding.js)

** 文字コード

画像の横軸が上位1バイト、縦軸が上位1バイト。

----

** CP932
Microsoft独自のShift_JIS拡張。~
シングルバイトは0x00～0x7Fおよび0xA1～0xDF。(unsigned char)((code^0x3F)-0xE0)&lt;0xBF~
第一バイトは0x81～0x9Fおよび0xE0～0xFC。(unsigned char)((code^0x20)-0xA1)&lt;=0x3B~
第二バイトは0x40～0x7Eおよび0x80～0xFC。((unsigned char)(code-0x40)&lt;=0xBC)&amp;&amp;(code!=0x7F)~


http://unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP932.TXT

***CP932の文字コード分布

#html2(){{{{{{
&lt;a href=&quot;http://www39.atwiki.jp/mlnk/?cmd=upload&amp;act=open&amp;page=%E6%96%87%E5%AD%97%E3%82%B3%E3%83%BC%E3%83%89&amp;file=cp932_map.png&quot;&gt;&lt;img id=&quot;cp932&quot; src=&quot;http://www39.atwiki.jp/mlnk/?cmd=upload&amp;act=open&amp;page=%E6%96%87%E5%AD%97%E3%82%B3%E3%83%BC%E3%83%89&amp;file=cp932_map.png&quot; alt=&quot;CP932の文字コード分布&quot; /&gt;&lt;/a&gt;
}}}}}}

***CP932をUnicodeに変    </description>
    <dc:date>2009-02-17T19:52:42+09:00</dc:date>
    <utime>1234867962</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mlnk/pages/37.html">
    <title>C++/STL/ヘッダファイル</title>
    <link>https://w.atwiki.jp/mlnk/pages/37.html</link>
    <description>
      ** ヘッダファイル表
ヘッダーファイルを自己完結的にしよう。 by C++ Coding Standads

----

*** algorithm
|CENTER:|CENTER:|CENTER:|CENTER:|CENTER:|CENTER:|c
|find|find_if|find_end|find_first_of|for_each|adjacent_find|
|count|count_if|mismatch|equal|search|search_n|
|copy|copy_backward|swap|swap_ranges|iter_swap|transform|
|replace|replace_if|replace_copy|replace_copy_if|fill|fill_n|
|generate|generate_n|remove|remove_if|remove_copy|remove_copy_if|
|unique|unique_copy|reverse|reverse_copy|rotate|rotate_copy|
|random_shuffle|partition|stable_partition|sort|stable_sort|partial_sort|
|partial_sort_copy|nth_element|lower_bound|upper_bound|equal_range|binary_search|
|merge|inplace_merge|includes|set_union|set_intersection|set_difference|
|set_symmetric_difference|push_heap|pop_heap|make_heap|sort_heap|min|
|max|min_element|max_element|lexicographical_compare|next_permutation|prev_permutation|

----    </description>
    <dc:date>2008-12-14T14:24:50+09:00</dc:date>
    <utime>1229232290</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mlnk/pages/36.html">
    <title>c++/ライブラリ/ordered_pair</title>
    <link>https://w.atwiki.jp/mlnk/pages/36.html</link>
    <description>
      ***概要
firstのみで順序付けするpair。~
(std::pairはfirst、second両方で順序付けする)~
std::pairは非仮想デストラクタなんでポリモルフィックには扱えない。

***使い方
#codehighlight(C++){{

void ordered_pair_func()
{
	{
		std::pair&lt;int, int&gt; p1(10, 10), p2(20, 20), p3(10, 20);

		std::cout &lt;&lt; &quot;(10,10)&lt;(10,10)=&quot; &lt;&lt; (p1&lt;p1) &lt;&lt; std::endl;	// 0
		std::cout &lt;&lt; &quot;(10,10)&gt;(10,10)=&quot; &lt;&lt; (p1&gt;p1) &lt;&lt; std::endl;	// 0
		std::cout &lt;&lt; &quot;(10,10)&lt;(20,20)=&quot; &lt;&lt; (p1&lt;p2) &lt;&lt; std::endl;	// 1
		std::cout &lt;&lt; &quot;(10,10)&gt;(20,20)=&quot; &lt;&lt; (p1&gt;p2) &lt;&lt; std::endl;	// 0
		std::cout &lt;&lt; &quot;(10,10)&lt;(10,20)=&quot; &lt;&lt; (p1&lt;p3) &lt;&lt; std::endl;	// 1
		std::cout &lt;&lt; &quot;(10,10)&gt;(10,20)=&quot; &lt;&lt; (p1&gt;p3) &lt;&lt; std::endl;	// 0
	}
	std::cout &lt;&lt; std::endl;
	{
		ordered_pair&lt;int, int&gt; p1(10, 10), p2(20, 20), p3(10, 20);

		std::cout &lt;&lt; &quot;(10,10)&lt;(10,10)=&quot; &lt;&lt; (p1&lt;p1) &lt;&lt; std::endl;	// 0
		std::cout &lt;&lt; &quot;(10,10)&gt;(10,10)=&quot; &lt;&lt; (p1&gt;p1) &lt;&lt; std::endl;	// 0
		std::cout &lt;&lt; &quot;(10,10)&lt;(20,20)=&quot; &lt;&lt; (p1&lt;p2) &lt;&lt; std::endl;	// 1
		std::cout &lt;&lt; &quot;(10,10)&gt;(20,20)=&quot; &lt;&lt; (p1&gt;p2) &lt;&lt; std::endl;	// 0
		std::cout &lt;&lt; &quot;(10    </description>
    <dc:date>2008-12-12T23:58:14+09:00</dc:date>
    <utime>1229093894</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mlnk/pages/35.html">
    <title>C++/tips</title>
    <link>https://w.atwiki.jp/mlnk/pages/35.html</link>
    <description>
      #contents

----
** 暗黙の型変換を引数に使う
暗黙の型変換を引数に使うためには引数は値渡しでないといけない。
#codehighlight(C++){{
struct A{
	A(){}
	A(int){}
};

void f(A, A) {}
void g(A&amp;, A&amp;) {}

int main()
{
	f(1, 2); // OK
	//g(1, 2); // エラー

	return 0;
}
}}

----

** 目的別探索方法

|~何を知りたいか|&gt;|~使用するアルゴリズム|&gt;|~使用するメンバ関数|h
|~|~未ソートの範囲|~ソート済み範囲|~set または map|~multiset または multimap|h
||CENTER:|CENTER:|CENTER:|CENTER:|c
|必要な値が存在するか?|find|binary_search|count|find|
|必要な値が存在するか? 存在するなら、その値を持つ最初のオブジェクトはどこにあるか?|find|equal_range|find|find または lower_bound((findは特定の値を持つ要素のうち「1つ」を見つけるだけ。「最初」の要素が必要ならlower_boundを使う必要がある。))|
|必要な値より前にない値を持つ最初のオブジェクトはどこにあるか?|find_if|lower_bound|lower_bound|lower_bound|
|必要な値の次にある値を持つ最初のオブジェクトはどこにあるか?|find_if|upper_bound|upper_bound|upper_bound|
|必要な値を持つオブジェクトはいくつあるか?|count|equal_range|count|count|
|必要な値を持つすべてのオブジェクトはどこにあるか|find (繰り返し処理)|equal_range|equal_range|equal_range|

----

** lower_bound、uppder_bound、equal_range の返すイテレータの場所
- lower_bound は同値の最初の要素を返す。同値の要素がない場合はそれ未満で最大の要素    </description>
    <dc:date>2009-08-11T15:44:45+09:00</dc:date>
    <utime>1249973085</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mlnk/pages/34.html">
    <title>C++/ライブラリ/multi_stream</title>
    <link>https://w.atwiki.jp/mlnk/pages/34.html</link>
    <description>
      ***概要
複数のostreamへ出力するストリームラッパクラス。~
コンストラクタの引数の展開にBoostを使ってるので要Boost。~
手書きすればBoostなしでも可。

***使い方
#codehighlight(C++){{

void func()
{
	std::ofstream of;
	of.open(&quot;somefile&quot;)
	util::multi_ostream(std::cout, of);
	mt &lt;&lt; &quot;foobar&quot; &lt;&lt; std::endl; // 標準出力とファイルに&quot;foobar&quot;が出力される
}
}}

***コード
#codehighlight(C++){{
/** @file multi_stream.h
 *  @breif 複数のostreamへ出力するストリームクラス
 */
#ifndef UTIL_MULTI_STREAM_H
#define UTIL_MULTI_STREAM_H

#include &lt;iostream&gt;
#include &lt;vector&gt;

#include &lt;boost/preprocessor.hpp&gt;

namespace util {

namespace detail {

//! コンストラクタで受け付けるostreamの最大数
#define ARGUMENT_MAX_COUNT 5

#define OSTREAM_ARRAY_ASSIGNMENT(z, n, data) outs_[n]=BOOST_PP_CAT(&amp;os, n);

#define BOOST_PP_LOCAL_MACRO(n) \
basic_multi_streambuf(BOOST_PP_ENUM_PARAMS(n, std::basic_ostream&lt;Ch BOOST_PP_COMMA() Tr&gt;&amp; os)) \
	: outs_(n), buf_(16) \
{ \
	setp(&amp;(buf_[0]), (&amp;(buf_[0])+buf_.size())); \
	BOOST_PP_REPEAT(n, OSTREAM_ARRAY_ASSIGNMENT, ~) \
}

#define BOOST_PP_LOCA    </description>
    <dc:date>2008-12-15T10:46:35+09:00</dc:date>
    <utime>1229305595</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mlnk/pages/33.html">
    <title>C++/ライブラリ/mt_stream</title>
    <link>https://w.atwiki.jp/mlnk/pages/33.html</link>
    <description>
      ***概要
マルチスレッドでも出力の順番を保証する ostream ラッパークラス。~
ロック用にBoostを使ってるので要Boost。~
Boost使わずにロックできるならBoostなしでも可。

***使い方
#codehighlight(C++){{

util::mt_ostream mt(std::cout);

void multithreded_func()
{
	mt &lt;&lt; &quot;foo&quot; &lt;&lt; &quot;bar&quot; &lt;&lt; std::endl; // 出力が&quot;foobar&quot;になることを保証
}
}}

***コード
#codehighlight(C++){{
#ifndef UTIL_MT_STREAM_H
#define UTIL_MT_STREAM_H
 
#include &lt;iostream&gt;
 
#include &lt;boost/thread.hpp&gt;
 
namespace util {
 
namespace detail {
 
/* Boost を使用したロック用クラス */
class boost_lock {
public:
	boost_lock()
	{}
	~boost_lock()
	{}
	void lock()
	{
		mutex_.lock();
	}
	void unlock()
	{
		mutex_.unlock();
	}
private:
	explicit boost_lock(const boost_lock&amp;);
	boost_lock &amp;operator=(const boost_lock&amp;);
	boost::mutex mutex_;
};
 
/* 例外安全ロッククラス */
template&lt;class Lk&gt;
class lock_holder {
public:
	lock_holder(Lk &amp;lock)
		: lock_(lock)
	{
		lock_.lock();
	}
	~lock_holder()
	{
		try {
			lock_.unlock();
		} catch(...) {}
	}
private:
	explicit lock_holde    </description>
    <dc:date>2008-12-15T10:47:51+09:00</dc:date>
    <utime>1229305671</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mlnk/pages/32.html">
    <title>Visual Studio</title>
    <link>https://w.atwiki.jp/mlnk/pages/32.html</link>
    <description>
      ** プリコンパイル済みヘッダの使用方法
+プロジェクトのプロパティ→「構成プロパティ」→「C/C++」→「プリコンパイル済みヘッダー」で~
「プリコンパイル済みヘッダーの作成/使用」を「使用する」にする
+stdafx.cpp を選択して右クリック→プロパティから同じく「プリコンパイル済みヘッダー」を開き、~
「プリコンパイル済みヘッダーの作成/使用」を「作成する」にする
+stdafx.h にプリコンパイルしたいヘッダを追加し、すべての *.cpp、*.c の&quot;先頭&quot;に#include &quot;stdafx.h&quot; を追加する

----
** マクロの展開の確認
+プロジェクトのプロパティ→「構成プロパティ」→「C/C++」→「コマンドライン」で追加のオプションに /P を指定し、~
確認したいソースファイルをコンパイルする。
+コンパイル後に &quot;ファイル名.i&quot; ができてるのでそれを確認する。~
必要のないファイルをコンパイルすると時間がかかるのでビルドを選ばないように。

----    </description>
    <dc:date>2008-11-11T10:25:46+09:00</dc:date>
    <utime>1226366746</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mlnk/pages/31.html">
    <title>C++/初期化用クラス</title>
    <link>https://w.atwiki.jp/mlnk/pages/31.html</link>
    <description>
      ** 初期化用クラス
プログラムの起動時と終了時に&quot;一度だけ&quot;初期化、終了処理をするためのクラス。~
winsockを使うときなどに。

#codehighlight(C++){{
// initializer.h

#ifndef _INITIALIZER_H
#define _INITIALIZER_H

namespace initializer {

class initializer {
private:
  class do_init {
    private:
      do_init() {
        // 初期化処理をここに
      }
      ~do_init() {
        // 終了処理をここに
      }
    public:
      static void instance() {
        static do_init p;
      }
    };

public:
  initializer() {
    do_init::instance();
  }
  ~initializer() {}

};

static initializer initializer_;

} // namespace

#endif
}}

このヘッダファイルを複数のソースファイルからインクルードしても
1回しかdo_init()のコンストラクタ、デストラクタは呼び出されない。~
マルチスレッド環境ではこれは保証できないけどプログラムの起動時は大抵シングルスレッドだろう。~
消費メモリは 1(static do_init) + 1(static initializer) * n(インクルード回数) かな。    </description>
    <dc:date>2008-10-22T15:18:13+09:00</dc:date>
    <utime>1224656293</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mlnk/pages/30.html">
    <title>略語</title>
    <link>https://w.atwiki.jp/mlnk/pages/30.html</link>
    <description>
      #contents

----

** A

*** ACK (ACKnowledgement)
確認応答

*** AODV (Ad hoc On-Demand Distance Vector)
http://dailyblog.justblog.jp/blog/2007/11/aodv_3eff.html#more

----

** B
*** BER (Bet Error Rate)

*** BO (Back-Off)
CSMAでDIFS経過してもチャネルがアイドルだったときに、
実際に送信を開始する前に待つ時間(ランダム) ~
http://www.isc.kyutech.ac.jp/kouhou/kouho16/wireless/2-3.html

----

** C

*** CBR (Constant Bit Rate)

*** CR (Corrective Retrospection)
おそらく造語~
Collective Retrospection(集団回顧)とかけてる?

*** CSMA (Carrier Sensing Multiple Access)
http://www.katayama.nuee.nagoya-u.ac.jp/~okada/works/packet/node5.html ~
http://ja.wikipedia.org/wiki/CSMA/CD ~
http://ja.wikipedia.org/wiki/CSMA/CA

*** CST (Carrier Sensing Threshold)

*** CTS (Clear to Send)
受信準備完

----

** D

*** DIFS (DCF Inter-Frame Space)
送信時にチャネルがアイドル状態とみなすための監視時間~
http://www.isc.kyutech.ac.jp/kouhou/kouho16/wireless/2-3.html

*** DPSK (Differential Phase Shift Keying)
差動位相偏移変調 ~
http://e-words.jp/w/DPSK.html

----
    </description>
    <dc:date>2008-06-21T23:46:08+09:00</dc:date>
    <utime>1214059568</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/mlnk/pages/29.html">
    <title>HTML</title>
    <link>https://w.atwiki.jp/mlnk/pages/29.html</link>
    <description>
      ** id、nameの仕様
-アルファベット([A-Za-z])で開始し、任意の数のアルファベット、数字、([0-9])、ハイフン(-)、アンダースコア(_)、コロン、(:)、ピリオド(.)のみで記述する必要がある。
- 値に大文字小文字の区別がある
- /[A-Za-z][A-Za-z0-9-_:.]*/

----    </description>
    <dc:date>2008-05-31T22:28:13+09:00</dc:date>
    <utime>1212240493</utime>
  </item>
  </rdf:RDF>
