<?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/thaladabar/">
    <title>thaladabar 備忘録@ ウィキ</title>
    <link>http://w.atwiki.jp/thaladabar/</link>
    <atom:link href="https://w.atwiki.jp/thaladabar/rss10.xml" rel="self" type="application/rss+xml" />
    <atom:link rel="hub" href="https://pubsubhubbub.appspot.com" />
    <description>thaladabar 備忘録@ ウィキ</description>

    <dc:language>ja</dc:language>
    <dc:date>2013-07-07T02:06:45+09:00</dc:date>
    <utime>1373130405</utime>

    <items>
      <rdf:Seq>
                <rdf:li rdf:resource="https://w.atwiki.jp/thaladabar/pages/27.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/thaladabar/pages/26.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/thaladabar/pages/25.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/thaladabar/pages/24.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/thaladabar/pages/23.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/thaladabar/pages/22.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/thaladabar/pages/21.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/thaladabar/pages/20.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/thaladabar/pages/18.html" />
                <rdf:li rdf:resource="https://w.atwiki.jp/thaladabar/pages/17.html" />
              </rdf:Seq>
    </items>
	
		
    
  </channel>
    <item rdf:about="https://w.atwiki.jp/thaladabar/pages/27.html">
    <title>vim</title>
    <link>https://w.atwiki.jp/thaladabar/pages/27.html</link>
    <description>
      #contents()

**ソースのコメントアウト
[tcomment.vim]を利用

&amp;bold(){ 【&lt;c-_&gt;a】}
コメントタイプで指定したコメントを選択箇所に挿入する

&amp;bold(){【&lt;c-_&gt; &lt;c-_&gt; 】}
&amp;bold(){【gc】}
コメントアウトしたい行を選択してコメントアウトすることができる（複数行可能）
※選択したのが一行の一部のみ選択指定た場合その選択部分のみをコメントアウトする。

&amp;bold(){【&lt;c-_&gt; b 】}
選択行を囲むようにしてコメントアウトをする。

【&lt;c-_&gt; i】
選択範囲のみを囲むようにしてコメントアウトをする。

【&lt;c-_&gt; r】
現在の位置から右側をコメントアウト

【gc}】
現在の位置から改行以外が入力    </description>
    <dc:date>2013-07-07T02:06:45+09:00</dc:date>
    <utime>1373130405</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/thaladabar/pages/26.html">
    <title>pythonの正規表現</title>
    <link>https://w.atwiki.jp/thaladabar/pages/26.html</link>
    <description>
      #contents()


**正規表現のメタ文字

|	メタ文字	|	意味	|
|	│	|	この前後にある正規表現のどちらかと一致する	|
|	*	|	直前の正規表現の 0 回以上の繰り返しに一致する	|
|	+	|	直前の正規表現の 1 回以上の繰り返しに一致する	|
|	?	|	直前の正規表現に 0 回もしくは１回一致する	|
|	{m,n}	|	直前の正規表現の m 回以上 n 回以下の繰り返し	|
|	*?	|	直前の正規表現の 0 回以上の繰り返しに一致する（最短一致）	|
|	+?	|	直前の正規表現の 1 回以上の繰り返しに一致する（最短一致）	|
|	??	|	直前の正規表現に 0 回もしくは１回一致する（最短一致）	|
|	{m,n}?	|	直前の正規表現の m 回以上 n 回以下の繰り返し（最短一致）	|
|	[ ]	|	[ ] 内に指定した文字のどれかと一致する	|
|	[^ ]	|	[ ] 内に指定した文字でない場合に一致する	|
|	.	|	任意の１文字と一致する	|
|	^	|	行頭と一致する	|
|	$	|	行末と一致する	|
|	( )	|	正規表現をグループにまとめる	|
|	\	|	メタ文字を打ち消す	|
|	\A	|	文字列の先頭と一致	|
|	\b	|	単語境界と一致 (\w と \W の間の空文字列と一致)	|
|	\B	|	\B 以外と一致	|
|	\d	|	数字と一致 ([0-9] と同じ)	|
|	\D	|	\d 以外と一致	|
|	\s	|	空白文字と一致 ([ \t\n\r\f] と同じ)	|
|	\S	|	\s 以外と一致	|
|	\w	|	英数字とアンダースコア _ に一致 ([_a-zA-Z0-9] と同じ)	|
|	\W	|	 \w 以外と一致	|
|	\Z	|	 文字列の末尾と一致	|    </description>
    <dc:date>2013-06-29T16:25:14+09:00</dc:date>
    <utime>1372490714</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/thaladabar/pages/25.html">
    <title>pythonのファイルIO</title>
    <link>https://w.atwiki.jp/thaladabar/pages/25.html</link>
    <description>
      #contents()

**ファイルを開く
 file = open( &quot;ファイル名&quot; )
 
 file.close()   # 最後に必ず閉じること


**ファイルを開く（モード指定）
ファイルを開く際のopen関数にモードを指定することができる
 file = open( &quot;ファイル名&quot;, &#039;r&#039; ) # 読み込みモード
 file = open( &quot;ファイル名&quot;, &#039;w&#039; ) # 書き込みモード
 file = open( &quot;ファイル名&quot;, &#039;r&#039; ) # 追記モード
 file = open( &quot;ファイル名&quot;, &#039;+&#039; ) # 読み書き両方

また上記指定にプラスしてテキストとバイナリモードの指定を行うこともできる
 file = open( &quot;ファイル名&quot;, &#039;rt&#039; ) # テキストモードでの読み込み
 file = open( &quot;ファイル名&quot;, &#039;rb&#039; ) # バイナリモードでの読み込み

それぞれのモードで書き込みを行いたい場合は&#039;r&#039;を&#039;w&#039;に変更すればよい


**ファイルの内容を読み込む
ファイルの中身を一括で取得したい場合
 file.read()
このメソッドを使用すれば良い

ファイルの中身を1行毎に処理したい場合
 for line in file:
     print( line )
for文でファイルオブジェクトをループ処理して終端までを行ごとに処理することができる。    </description>
    <dc:date>2013-06-28T08:56:10+09:00</dc:date>
    <utime>1372377370</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/thaladabar/pages/24.html">
    <title>pythonのデータ型</title>
    <link>https://w.atwiki.jp/thaladabar/pages/24.html</link>
    <description>
      #contents

**タプル
タプルは複数の要素から構成される。
初期化後に内包する値に対して変更することができないimmutableなコレクションとなる

タプル宣言方法 
 [[python]]_tuple = ( &quot;year&quot;, &quot;month&quot;, &quot;day&quot;, 1, 3 )
 print( python_tuple )

タプルで要素に対してアクセスする場合は配列と同じようにindexを指定してアクセスする
 print( python_tuple[0] )
 print( python_tuple[1] )
 print( python_tuple[2] )

タプルの内包要素数はlen関数で調べることが可能
 print( len( python_tuple ) )


**リスト
リストはタプルと同じように複数の要素から構成される。
リストはタプルと違い内包する値に対して変更を行うことが可能なmutableなコレクションとなる
 python_list = [ &quot;year&quot;, &quot;month&quot;, &quot;day&quot;, 1, 3 ]
 print( python_list )

各要素のアクセスや要素数はタプルと同じように行える
 print( python_list[0] )
 print( python_list[1] )
 print( python_list[2] )
 print( len( python_list ) )

リストの末尾に要素を追加する場合list.append関数を使用する
 python_list.append( &quot;time&quot; )
 print( python_list )

リストの末尾に複数の要素を追加する場合list.extend関数を使用する
 python_list.extend( [1, 2, 3, 5] )
 print( python_list )

リストから要素を取り出す場合list.pop関数を使用する
 popValue = python_list.pop( 2 )  #指定したindexの要素の値を取り出す
 print( python_list )
 print( &quot;popValue =&quot; + str( popValue    </description>
    <dc:date>2013-03-31T21:36:32+09:00</dc:date>
    <utime>1364733392</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/thaladabar/pages/23.html">
    <title>計算によるグラフ添付場所</title>
    <link>https://w.atwiki.jp/thaladabar/pages/23.html</link>
    <description>
      *excelで作ったグラフを添付する場所

** log.xlsx log計算のグラフ
徐々に数値の上がり方が緩やかになるグラフ    </description>
    <dc:date>2013-03-31T16:42:21+09:00</dc:date>
    <utime>1364715741</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/thaladabar/pages/22.html">
    <title>pythonの文字列</title>
    <link>https://w.atwiki.jp/thaladabar/pages/22.html</link>
    <description>
      #contents()

**複数行の文字列
 test_str = &quot;&quot;&quot;jfkla;ewj
 fa;weifj
 f&#039;iasjef
 fwa;oiejfl;waejnf
 fwaoief&quot;&quot;&quot;
 print( test_str )


**文字列の置換
文字列の置換をしたい場合はstr.replace関数を使用する
 replaceStr = &quot;[[python]]_str_replace&quot;
 replaceResult = replaceStr.replace( &quot;replace&quot;, &quot;result&quot; )
 print( replaceStr ) 
 print( replaceResult)

** 文字列の分割
文字列の分割はstr.split関数で行うことができる
split関数は分割した文字列をタプルで返す
 splitStr = &quot;python_str_split&quot;
 splitResult = splitStr.split( &quot;_&quot; )
 print( splitResult )

**文字列の埋め
文字列の左に指定した文字を埋め込みたい場合はstr.rjust関数を使用する
第一引数に文字列を埋めたあとの文字数を指定、第二引数が埋め込みたい文字となる
 rjustStr = &quot;1234&quot;
 rjustStr2 = &quot;bcde&quot;
 print( rjustStr.rjust( 10, &quot;0&quot; ) )
 print( rjustStr2.rjust( 20, &quot;a&quot; ) )

埋め込む文字が０限定であればstr.zfill関数を使用する手もある
 print( rjustStr.zfill( 10 ) )


**文字列とバイト列
文字列をバイト列に変換する場合str.encode関数を使用する
 import sys
 encodeStr = &quot;pythonの世界へようこそ&quot;
 print( encodeStr )
#sys.getdefaultencoding関数で端末のデフォルトの文字コードを取得する
 byteStr = encodeStr.encode( sys.getdefaultencoding() ) 
 print( byteStr )

バ    </description>
    <dc:date>2013-03-31T02:17:30+09:00</dc:date>
    <utime>1364663850</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/thaladabar/pages/21.html">
    <title>python</title>
    <link>https://w.atwiki.jp/thaladabar/pages/21.html</link>
    <description>
      #contents()
-[[pythonのデータ型]]
-[[pythonの文字列]]
-[[pythonの正規表現]]
-[[pythonのファイルIO]]    </description>
    <dc:date>2013-06-28T08:44:15+09:00</dc:date>
    <utime>1372376655</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/thaladabar/pages/20.html">
    <title>FSharp</title>
    <link>https://w.atwiki.jp/thaladabar/pages/20.html</link>
    <description>
      #contents()

**クラス宣言
#html2{
&lt;pre&gt;
    type クラス名 = 
        val アクセス修飾子 変数名 : 形名
    
        // 明示的コンストラクタ
        new() =
            {
                変数名 = 0
            }
        member アクセス修飾子 this.関数名() = ()
        static member public print() = ()        // クラスメソッド
&lt;/pre&gt;
}    </description>
    <dc:date>2013-01-20T20:39:38+09:00</dc:date>
    <utime>1358681978</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/thaladabar/pages/18.html">
    <title>C++</title>
    <link>https://w.atwiki.jp/thaladabar/pages/18.html</link>
    <description>
      #contents()

**テンプレートで関数ポインタを利用
メソッドの定義
#html2(){{{{{{
&lt;pre&gt;
template
&lt;
	typename ClassName, 
	void (ClassName::*mem_fun)(args)
&gt;
void method( const TiXmlElement* element, std::vector&lt;String&gt;&amp; tags, ClassName&amp; instance )
{
	(instance.*mem_fun)( child );
}
&lt;/pre&gt;
}}}}}}

利用
#html2(){{{{{{
&lt;pre&gt;
method&lt; classname, &amp;classname::methodname &gt;( args );
&lt;/pre&gt;
}}}}}}


**外部ライブラリ
-[[tinyxml2]]    </description>
    <dc:date>2013-09-23T10:38:29+09:00</dc:date>
    <utime>1379900309</utime>
  </item>
    <item rdf:about="https://w.atwiki.jp/thaladabar/pages/17.html">
    <title>雑多</title>
    <link>https://w.atwiki.jp/thaladabar/pages/17.html</link>
    <description>
      &amp;aname(test){ビットシフトの定数でif文を使わない}

*ビットシフトの定数でif文を使わない

#html2(){{{{{{
&lt;pre&gt;
static const int LEFT = 1 &lt;&lt; 0;
static const int RIGHT = 1 &lt;&lt; 1;
static const int HCENTER = 1 &lt;&lt; 2;
&lt;/pre&gt;
}}}}}}

この様な定数を使用する場合if文やswitch文で処理を分岐させているが合によっては使わなくても分岐を行うことが出来る。
ビットシフトで定数を宣言する場合に値は全て2の階乗となるため指数を取り出しindexとして使用することで必要な物を取り出すことができる。
[[プログラム]]で指数を取り出したい場合下記の様な式になる。

#html2()
{
&lt;pre&gt;
指数 = log(乗数を調べたい値) / log(底の値)
&lt;/pre&gt;
}


[[計算によるグラフ添付場所]]    </description>
    <dc:date>2013-03-31T16:37:09+09:00</dc:date>
    <utime>1364715429</utime>
  </item>
  </rdf:RDF>
