<?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:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:xhtml="http://www.w3.org/1999/xhtml" xml:lang="ja-JP">
<channel rdf:about="http://blog.mylab.jp/index.rdf">
<title>PC関係のメモ</title>
<link>http://blog.mylab.jp/</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/" />
<description></description>
<dc:creator>Hajime Miyauchi</dc:creator>
<items><rdf:Seq>
<rdf:li rdf:resource="http://blog.mylab.jp/20120210.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20120209.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20120208.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20120207.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20120206.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20111227.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20120125.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20120117.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20120111.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20120107.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20120106.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20111221.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20111220.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20111219.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20111216.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20110526.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20111109.html"/>
<rdf:li rdf:resource="http://blog.mylab.jp/20111102.html"/>
</rdf:Seq></items>
</channel>
<item rdf:about="http://blog.mylab.jp/20120210.html">
<title>LVMパーティションの作り方</title>
<link>http://blog.mylab.jp/20120210.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20120210.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-02-07T20:32:15+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>300GBの物理ディスク(/dev/sda)に250GBの論理容量を持つext3パーティションを作成する。</p>
<p>50GBはスナップショット用に確保しておく。(多いけど)</p>
<p>という仮定。</p>
<p>LVMパーティションを初期化</p>
<pre># fdisk /dev/sda
※ 以下【キー入力】で示します。
Command (m for help): 【n】
Command action
   e   extended
   p   primary partition (1-4)
【p】
Partition number (1-4): 【1】
First cylinder (1-39162, default 1): 【ENTERキー】
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-39162, default 39162): 【ENTERキー】
Using default value 39162
Command (m for help): 【t】
Hex code (type L to list codes): 【8e】
Command (m for help): 【w】
The partition table has been altered!</pre>
<p>パーティションテーブルを反映</p>
<pre># partprobe</pre>
<p>PVを作成</p>
<pre># pvcreate /dev/sda1</pre>
<p>PVを確認</p>
<pre># pvdisplay -C
# pvdisplay /dev/sda1</pre>
<p>VGを作成</p>
<pre># vgcreate -s 32m datavg /dev/sda1</pre>
<p>VGを確認</p>
<pre># vgdisplay -C
# vgdisplay datavg</pre>
<p>LVを作成</p>
<pre># lvcreate -L 250G -n data_lv datavg</pre>
<p>LVを確認</p>
<pre># lvdisplay -C
# lvdisplay /dev/datavg/data_lv</pre>
<p>ファイルシステムを作成</p>
<pre># mkfs.ext3 /dev/datavg/data_lv</pre>
<p>起動時に自動でfsckが走らないよう設定</p>
<pre># tune2fs -c -1 -i 0 /dev/datavg/data_lv</pre>
<p>マウントして確認</p>
<pre># mount /dev/datavg/data_lv /data</pre>
<p>アンマウント</p>
<pre># umount /data</pre>
<p>/etc/fstabに下記を追記</p>
<pre>/dev/datavg/data_lv   /data   ext3   defaults   1 2</pre>
<p>/etc/fstabの設定通りマウント</p>
<pre># mount -a</pre>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20120209.html">
<title>logrotateのテスト</title>
<link>http://blog.mylab.jp/20120209.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20120209.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-02-07T20:20:35+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>強制実行</p>
<pre># logrotate -f /etc/logrotate.d/syslog</pre>
<p>デバッグモード</p>
<pre># logrotate -d /etc/logrotate.d/syslog</pre>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20120208.html">
<title>IaaSの読み方</title>
<link>http://blog.mylab.jp/20120208.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20120208.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-02-07T10:09:25+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>native speakerの方々は略さないらしい。これからはそうしよっと。</p>
<blockquote><p>nativeの方々に聞いてみましたが、彼らに共通の答えは「アイ・エィ・エィ・エス」で略さないぜ（キリッ という回答でした。</p>
</blockquote>
<p>via <a href="http://giolog.iij.ad.jp/2012/01/12/5334/">http://giolog.iij.ad.jp/2012/01/12/5334/</a></p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20120207.html">
<title>dddav 1.1リリース</title>
<link>http://blog.mylab.jp/20120207.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20120207.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-02-06T23:56:24+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>クライアント証明書に対応した1.1をリリースしました。</p>
<p>また1.0リリース記念ということで公式ページをリニューアルするとともに、Facebookページも作ってみました。</p>
<p>「いいね！」してもらえるとモチベーションが上がります。</p>
<p><a href="http://www.mylab.jp/program/dddav/">http://www.mylab.jp/program/dddav/</a></p>
<p><a href="https://www.facebook.com/dddav">https://www.facebook.com/dddav</a></p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20120206.html">
<title>dddav 1.0 リリース</title>
<link>http://blog.mylab.jp/20120206.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20120206.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-02-06T12:41:00+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>NTLM認証対応とか、SSL証明書の検証対応とか。</p>
<p><a href="http://www.mylab.jp/program/dddav/">http://www.mylab.jp/program/dddav/</a></p>
<p>次のリリースはクライアント証明書対応の予定。</p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20111227.html">
<title>気になる格言、名言、慣用句</title>
<link>http://blog.mylab.jp/20111227.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20111227.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-01-31T15:27:34+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>メモ。</p>
<blockquote><p>推測するな、計測せよ</p>
<p>by 書籍 24時間365日　サーバ/インフラを支える技術</p>
</blockquote>
<blockquote><p>KISS(Keep it simple, stupid)の原則</p>
<p>by Kelly Johnson</p>
</blockquote>
<blockquote><p>テストコードにはWhat, 
ソースコードにはHow, 
そして，ドキュメントにはWhyを書くんだよ！</p>
<p>by 角谷信太郎氏</p>
</blockquote>
<blockquote><p>顧客は1/4インチのドリルが欲しいわけではない。
1/4インチの穴が欲しいのだ</p>
<p>by Theodore Levitt</p>
</blockquote>
<blockquote><p>ポケット１つの原則</p>
<p>by 野口 悠紀雄氏</p>
</blockquote>
<blockquote><p>やってみせ，
言ってきかせて，
させてみせ，
ほめてやらねば，
人は動かじ。</p>
<p>by 山本五十六</p>
</blockquote>
<blockquote><p>学ばない者は人のせいにする。
学びつつある者は自分のせいにする。
学ぶということを知っている者は誰のせいにもしない。</p>
<p>by キング・カズ</p>
</blockquote>
<blockquote><p>自分の願望は、あらゆる犠牲を払い、
自分の力で実現させるものだ。
他人から与えられるものではない。</p>
<p>by 碇ゲンドウ - エヴァンゲリオンより</p>
</blockquote>
<blockquote><p>陽子自身が人を信じることと、
人が陽子を裏切ることはなんの関係もないはずだ。
陽子自身が優しいことと他者が陽子に優しいことは、
なんの関係もないはずなのに。</p>
<p>by 小野不由美氏 - 十二国記より</p>
</blockquote>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20120125.html">
<title>dddav 0.9 リリース</title>
<link>http://blog.mylab.jp/20120125.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20120125.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-01-25T20:23:04+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p><a href="http://www.mylab.jp/program/dddav/">http://www.mylab.jp/program/dddav/</a></p>
<p>1件の不具合修正といくつかの改善を含むリリース。</p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20120117.html">
<title>dddav 0.8 リリース</title>
<link>http://blog.mylab.jp/20120117.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20120117.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-01-18T00:21:36+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>今回は不具合修正と仕様変更のリリース。</p>
<p><a href="http://www.mylab.jp/program/dddav/">http://www.mylab.jp/program/dddav/</a></p>
<p>日本語フォルダ名に関する不具合の修正。</p>
<ul>
<li>ホスト設定の「リモートの初期フォルダ」に日本語フォルダ名が含まれる場合にパスが文字化けする</li>
<li>ホスト設定の「現在のフォルダ」押下時に日本語フォルダ名が含まれた場合に文字化けする</li>
</ul>
<p>加えてバージョンチェックのHTTPアクセス時にインターネットオプションのプロキシ設定を参照するように仕様変更。</p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20120111.html">
<title>OLE Drag&amp;Dropで画面をロックさせない実装</title>
<link>http://blog.mylab.jp/20120111.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20120111.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-01-11T10:58:31+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>OLE ドラッグ＆ドロップ(以下D&amp;D)の実装を見直し中。</p>
<p>VC++(MFC)で何も考えずにD&amp;Dを実装すると、D&amp;D中はアプリケーションがロックされる。</p>
<p>普通のアプリケーションならロックされる時間は短いので気にならない。</p>
<p>但し、dddavのようなドロップ後に時間のかかる処理(ファイル転送)をしている場合にはそれが気になるのでロックされないように考える必要がある。</p>
<p>具体的には次の点をdddavでは実装していた。</p>
<ul>
<li>時間のかかる処理(ファイル転送等)はスレッド処理する。</li>
<li>ドロップ後は自前でメッセージループを回す。</li>
</ul>
<p>但し、これだけだとD&amp;Dを開始したコントロール(リストビュー)がロックされる。</p>
<p>これはWM_NOTIFYメッセージで受け取ったドラッグ開始の処理中の中でドロップ後の処理を行うため、コントロールに次のメッセージが送られてこないせいであるためと考えられる。</p>
<p>よって、この対策として次の点も現在実装中である。</p>
<ul>
<li>ドラッグの開始と同時に非表示のダミーウインドウにメッセージを投げ、そちらでドラッグを開始させる。</li>
</ul>
<p>この他に、オートメーションのスレッドを立ててそちらでドラッグを開始する試みもしてみたが失敗した。</p>
<p>MFCのコード中で、メインスレッドかどうかのチェック判定をしているため別スレッドではドラッグが開始できないためである。</p>
<p>具体的にはmfc\oledrop1.cppのCOleDropSource::OnBeginDrag()の中に書いてある下記コードで判定していた。</p>
<pre>// some applications steal capture away at random times
if (CWnd::GetCapture() != pWnd)</pre>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20120107.html">
<title>ワイド文字列からマルチバイト文字列への変換</title>
<link>http://blog.mylab.jp/20120107.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20120107.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-01-06T19:15:09+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>MFC/ATLであればCStringW/CStringAを使うのがお手軽。コンストラクタで変換してくれる。</p>
<p>Win32APIならMultiByteToWideChar/WideCharToMultiByteを使うんだけど面倒。</p>
<p>標準Cライブラリならmbtowc/wcstombs。</p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20120106.html">
<title>dddav 0.7をリリース</title>
<link>http://blog.mylab.jp/20120106.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20120106.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2012-01-06T19:08:00+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>起動時のソフトの更新チェックと、転送しながらのリモートフォルダ移動に対応。</p>
<p><a href="http://www.mylab.jp/program/dddav/">http://www.mylab.jp/program/dddav/</a></p>
<p>起動時の最新バージョン確認についてはプロキシを見ていないので通知されない可能性あり。</p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20111221.html">
<title>dddav 0.6 をリリース</title>
<link>http://blog.mylab.jp/20111221.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20111221.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2011-12-21T15:30:33+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>2ペイン間のドラッグ＆ドロップに対応。</p>
<p>他、2件の不具合対策。</p>
<p><a href="http://www.mylab.jp/program/dddav/">http://www.mylab.jp/program/dddav/</a></p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20111220.html">
<title>OLE D&amp;Dではまる</title>
<link>http://blog.mylab.jp/20111220.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20111220.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2011-12-19T23:23:39+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>VC++で作ったプログラムでOLEドラッグ＆ドロップした後に自動整列されてしまう現象に悩まされてたが原因がわかった。</p>
<p>正規化されていないパスを渡すとエクスプローラに遅延レンダリングでドロップした後になぜか自動整列されてしまう。</p>
<p>よって、GetFullPathNameで正規化することで解決した。</p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20111219.html">
<title>dddav 0.5をリリース</title>
<link>http://blog.mylab.jp/20111219.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20111219.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2011-12-19T11:05:23+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>リモートファイルの複数削除に対応。</p>
<p><a href="http://www.mylab.jp/program/dddav/">http://www.mylab.jp/program/dddav/</a></p>
<p>今さら感満載である。</p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20111216.html">
<title>NECの水冷サーバ(Express5800/110Ga-C)にWindows 7をインストールした</title>
<link>http://blog.mylab.jp/20111216.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20111216.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2011-12-16T11:55:01+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>特に問題なくインストールできた。各種ドライバも正常に動いている。</p>
<p>サウンドカードがないので音がでないため、別途サウンドカードを購入することにする。</p>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20110526.html">
<title>tDiaryの日記データをGitに登録するプラグイン</title>
<link>http://blog.mylab.jp/20110526.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20110526.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2011-11-19T05:05:04+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>tDiaryのデータを日別でGitに登録するプラグインを作った。</p>
<p>使い方</p>
<ol>
<li>プラグインディレクトリ(例: plugin)にgit-register.rbを設置。</li>
<li>プラグインディレクトリにja/git-register.rb、en/git-register.rbを設置。</li>
<li>tdiary.confにリポジトリを指定(リポジトリの場所を/var/git-respoと仮定)<ol>
<li>@options["git.repository_dir"] = "/var/git-repos"</li>
</ol></li>
<li>リポジトリを作成(Apacheの起動ユーザをapacheと仮定)<ol>
<li>mkdir /var/git-repos</li>
<li>cd /var/git-repos</li>
<li>git init</li>
<li>git config user.name "自分の名前"</li>
<li>git config user.email "メールアドレス"</li>
<li>chown apache.apache -R /var/git-repos</li>
</ol></li>
<li>リポジトリに一括commit(tDiaryのインストールディレクトリを/var/www/tdiaryと仮定)<ol>
<li>cd /var/www/tdiary</li>
<li>ruby --encoding=UTF-8 git-register.rb</li>
</ol></li>
</ol>
<p>できること</p>
<ul>
<li>今までの日記データを一括commit</li>
<li>日記更新毎にgitにcommit</li>
</ul>
<p>残念ながら今のところ履歴表示機能はない。誰か作って下さい。</p>
<p>後、BlogKitでしかテストしてません。</p>
<p>git-register.rbの中身は下記。</p>
<pre>#!/usr/bin/env ruby
# git-register.rb
#
# Copyright (C) 2011 hajime miyauchi &lt;hajime.miyauchi@gmail.com&gt;
# You can redistribute it and/or modify it under GPL2.
#

mode = ""
if $0 == __FILE__
        require 'cgi'
        ARGV &lt;&lt; '' # dummy argument against cgi.rb offline mode.
        @cgi = CGI::new
        mode = "CMD"
else
        mode = "PLUGIN"
end

if mode == "PLUGIN"
add_body_leave_proc do |date|
end
end

unless $tdiary_git_register_loaded
$tdiary_git_register_loaded ||= true

if mode == "CMD"
tdiary_path = "."
tdiary_conf = "."
$stdout.sync = true

def usage
puts "git-register.rb"
puts " register to git index files from tDiary's database."
puts " usage: ruby --encoding=UTF-8 git-register.rb [-p &lt;tDiary directory&gt;] [-c &lt;tdiary.conf directory&gt;]"
exit
end

require 'getoptlong'
parser = GetoptLong::new
parser.set_options(['--path', '-p', GetoptLong::REQUIRED_ARGUMENT], ['--conf', '-c', GetoptLong::REQUIRED_ARGUMENT])
begin
parser.each do |opt, arg|
case opt
when '--path'
tdiary_path = arg
when '--conf'
tdiary_conf = arg
end
end
rescue
usage
exit( 1 )
end

tdiary_conf = tdiary_path unless tdiary_conf
Dir::chdir( tdiary_conf )

begin
$:.unshift tdiary_path
require "#{tdiary_path}/tdiary"
rescue LoadError
$stderr.puts "git-register.rb: cannot load tdiary.rb. &lt;#{tdiary_path}/tdiary&gt;\n"
$stderr.puts " usage: ruby --encoding=UTF-8 git-register.rb [-p &lt;tDiary directory&gt;] [-c &lt;tdiary.conf directory&gt;]"
exit( 1 )
end
end

module ::TDiary
#
# Register
#
class GitRegister &lt; TDiaryBase
def initialize(repository_dir, diary)
@repository_dir = repository_dir
@diary = diary
@date = diary.date
end

def execute()
dir = @date.strftime("#{@repository_dir}%Y%m/")
Dir::mkdir( dir ) unless FileTest::directory?( dir )

td2_file = @date.strftime("#{dir}%Y%m%d.td2")
fh = File::open(td2_file, 'w')

fh.puts( "Date: #{@date}" )
fh.puts( "Title: #{@diary.title}" )
fh.puts( "Last-Modified: #{@diary.last_modified.to_i}" )
fh.puts( "Visible: #{@diary.visible? ? 'true' : 'false'}" )
fh.puts( "Format: #{@diary.style}" )
fh.puts
fh.puts( @diary.to_src.gsub( /\r/, '' ).gsub( /\n\./, "\n.." ) )

fh.close

# commit
require 'shellwords'

msg = "#{ENV['REMOTE_ADDR']} - #{ENV['REMOTE_HOST']}"

Dir.chdir("#{@repository_dir}") do
td2_file2 = @date.strftime("%Y%m/%Y%m%d.td2")
system("git add -- #{Shellwords.shellescape(td2_file2)}".untaint)
system("git commit -q -m \"#{msg}\" -- #{Shellwords.shellescape(td2_file2)}".untaint)
end
end

protected

def mode; 'day'; end
def cookie_name; ''; end
def cookie_mail; ''; end

def convert(str)
str
end
end

#
# Main
#
class GitRegisterMain &lt; TDiaryBase
def initialize(conf)
super(CGI::new, 'day.rhtml', conf)
end

def execute(out = $stdout)
require 'fileutils'
repository_dir = @conf['git.repository_dir']
calendar
@years.keys.sort.reverse_each do |year|
out &lt;&lt; "(#{year.to_s}/) "
@years[year.to_s].sort.reverse_each do |month|
@io.transaction(Time::local(year.to_i, month.to_i)) do |diaries|
diaries.sort.reverse_each do |day, diary|
out &lt;&lt; diary.date.strftime('%m%d ')
GitRegister.new(repository_dir, diary).execute
end
false
end
end
end
end
end
end

if mode == "CMD"
begin
require 'cgi'
if TDiary::Config.instance_method(:initialize).arity &gt; 0
# for tDiary 2.1 or later
cgi = CGI.new
conf = TDiary::Config::new(cgi)
else
# for tDiary 2.0 or earlier
conf = TDiary::Config::new
end
conf.header = ''
conf.footer = ''
conf.show_comment = true
conf.hide_comment_form = true
conf.show_nyear = false
def conf.bot?; true; end
TDiary::GitRegisterMain.new(conf).execute
rescue
print $!, "\n"
$@.each do |v|
print v, "\n"
end
exit( 1 )
end

puts
else
add_update_proc do
conf = @conf.clone
conf.header = ''
conf.footer = ''
conf.show_comment = true
conf.hide_comment_form = true
conf.show_nyear = false
def conf.bot?; true; end

repository_dir = @conf['git.repository_dir']
diary = @diaries[@date.strftime('%Y%m%d')]

TDiary::GitRegister.new(repository_dir, diary).execute
end

if !@conf['git.hideconf'] &amp;&amp; (@mode == 'conf' || @mode == 'saveconf')
args = ['git_register', @git_register_conf_label]
args &lt;&lt; 'update' if TDIARY_VERSION &gt; '2.1.3'
add_conf_proc(*args) do
str = &lt;&lt;-HTML
&lt;h3 class="subtitle"&gt;#{@git_register_conf_header}&lt;/h3&gt;
&lt;p&gt;
&lt;label for="git_register_rebuild"&gt;&lt;input id="git_register_rebuild" type="checkbox" name="git_register_rebuild" value="1"&gt;
#{@git_register_conf_description}&lt;/label&gt;
&lt;/p&gt;
HTML
if @mode == 'saveconf'
if @cgi.valid?( 'git_register_rebuild' )
str &lt;&lt; '&lt;p&gt;The following diaries were registered.&lt;/p&gt;'
out = ''
TDiary::GitRegisterMain.new(@conf).execute(out)
str &lt;&lt; "&lt;p&gt;#{out}&lt;/p&gt;"
end
end
str
end
end
end

end # $tdiary_git_register_loaded

# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:</pre>
<p>en/git-register.rbの中身</p>
<pre>@estraier_register_conf_label = 'Git'
@estraier_register_conf_header = 'commit all'
@estraier_register_conf_description = 'To commit all, check the box and submit \'OK\'.'</pre>
<p>ja/git-register.rbの中身</p>
<pre>@git_register_conf_label = 'Git'
@git_register_conf_header = 'Gitへ再登録'
@git_register_conf_description = 'Gitへ再登録する場合はOKを押してください'</pre>

</div>
<p>Comments(1)</p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20111109.html">
<title>ThinkPadのファン回転数制御ソフト</title>
<link>http://blog.mylab.jp/20111109.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20111109.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2011-11-09T21:01:33+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>最近ThinkPad X31が熱暴走するようになって困っていたが、このソフトを使ったら直った。素晴らしい。</p>
<ul>
<li><a href="http://tpfancontrol.com/">http://tpfancontrol.com/</a></li>
<li><a href="http://www.staff.uni-marburg.de/~schmitzr/donate.html">http://www.staff.uni-marburg.de/~schmitzr/donate.html</a></li>
</ul>

</div>
<p></p>
]]></content:encoded>
</item>
<item rdf:about="http://blog.mylab.jp/20111102.html">
<title>想定外のクラウド活用ワークショップ</title>
<link>http://blog.mylab.jp/20111102.html</link>
<xhtml:link xhtml:rel="alternate" xhtml:media="handheld" xhtml:type="text/html" xhtml:href="http://blog.mylab.jp/20111102.html" />
<dc:creator>Hajime Miyauchi</dc:creator>
<dc:date>2011-11-02T14:52:39+09:00</dc:date>

<content:encoded><![CDATA[<div class="section">

<p>名古屋開催のクラウド活用ワークショップ。</p>
<p>想定外のクラウド活用ワークショップ</p>
<p><a href="http://atnd.org/events/21387">http://atnd.org/events/21387</a></p>

</div>
<p></p>
]]></content:encoded>
</item>
</rdf:RDF>

