<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Oddwit &#187; HowTo&#8217;s, Tips and Tricks</title>
	<atom:link href="http://oddwit.com/blog/category/howtos/feed" rel="self" type="application/rss+xml" />
	<link>http://oddwit.com/blog</link>
	<description>Web, Dev, Etc</description>
	<lastBuildDate>Thu, 15 Dec 2011 02:02:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Titanium Studioのコンソールの文字化けをなおす</title>
		<link>http://oddwit.com/blog/2011/titanium-studio-console-garbled</link>
		<comments>http://oddwit.com/blog/2011/titanium-studio-console-garbled#comments</comments>
		<pubDate>Wed, 14 Dec 2011 09:20:16 +0000</pubDate>
		<dc:creator>merikonjatta</dc:creator>
				<category><![CDATA[HowTo's, Tips and Tricks]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[titanium]]></category>

		<guid isPermaLink="false">http://oddwit.com/blog/?p=735</guid>
		<description><![CDATA[扱う文字列やらなんやらがすべてUTF-8であるのが前提です。 執筆時のTitanium Studioのバージョンは1.0.6です。 FinderでTitaniumStudio.appを見つける 右クリックしてShow P [...]]]></description>
			<content:encoded><![CDATA[<p>扱う文字列やらなんやらがすべてUTF-8であるのが前提です。<br />
執筆時のTitanium Studioのバージョンは1.0.6です。</p>
<ol>
<li>FinderでTitaniumStudio.appを見つける</li>
<li>右クリックしてShow Package Contentsを選んで中に入る</li>
<li>Contents/MacOS/TitaniumStudio.iniを編集</li>
<li>ファイルの最後に<code>-Dfile.encoding=UTF8</code>と書き加える</li>
<li>TitaniumStudioを再起動</li>
</ol>
<p>見た目からして基本はEclipseなので、Eclipseかのように扱えば治りました。<br />
参照：<a href="http://krakenbeal.blogspot.com/2011/07/eclipseutf-8.html">EclipseのコンソールでUTF-8が文字化けする &#8211; KRAKENBEAL RECORDS</a></p>
<p>関係無いですが、Titanium Studioのデバッグ関連機能（VariablesタブとかExpressionsタブとか）はいまいち思った通りの動きをしてくれない事が多いので僕はもっぱらプリントデバッグをしています。オブジェクトをコンソールにダンプするときはこういう関数を使うと便利です。</p>
<pre class="brush:js">
var console = {
  log: function(msg) {
    Ti.API.debug(JSON.stringify(msg, null, 2));
  }
};

console.log(someObject);
</pre>
<p>JSONというのは<a href="https://github.com/douglascrockford/JSON-js/blob/master/json2.js">Douglas CrockfordのJSON2</a>のことです。stringifyの第三引数に数字を与えると、深さに応じてスペース2個ずつインデントしてくれます（綺麗に改行も入る）。そんな機能があるとは今日まで知りませんでした。</p>

]]></content:encoded>
			<wfw:commentRss>http://oddwit.com/blog/2011/titanium-studio-console-garbled/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GNU Screenのプリセットを作っておく</title>
		<link>http://oddwit.com/blog/2011/gnu-screen-prese</link>
		<comments>http://oddwit.com/blog/2011/gnu-screen-prese#comments</comments>
		<pubDate>Sun, 01 May 2011 09:50:52 +0000</pubDate>
		<dc:creator>merikonjatta</dc:creator>
				<category><![CDATA[HowTo's, Tips and Tricks]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[screen]]></category>

		<guid isPermaLink="false">http://oddwit.com/blog/?p=724</guid>
		<description><![CDATA[新しくScreenセッションを始めるときに特定の窓を開いておければ便利です。もちろん.screenrcにべた書きすればいいのですが、やりたい作業によって開きたい窓の組み合わせは変わりますね。 しからばプリセットを書いてお [...]]]></description>
			<content:encoded><![CDATA[<p>新しくScreenセッションを始めるときに特定の窓を開いておければ便利です。もちろん.screenrcにべた書きすればいいのですが、やりたい作業によって開きたい窓の組み合わせは変わりますね。</p>
<p>しからばプリセットを書いておきましょう。プリセットと言っても別の.screenrcを作るだけですが。</p>
<p>~/.screen/rails など適当なファイルをこんなふうに作ります。</p>
<pre class="brush:shell">
source $HOME/.screenrc
sessionname rails
chdir /Users/marco/projects/railsapp

screen -t 'zsh'
screen -t 'test'
screen -t 'console'
screen -t 'server'
screen -t 'source'

select 0
</pre>
<p>最初にいつもの.screenrcを読み込んで、あとはセッション名や開く窓を指定。</p>
<p>使うときは</p>
<pre class="brush:shell">
$ screen -c ~/.screen/rails
</pre>
<p>ソース：<a href="http://dinomite.net/2009/screen-presets/">Screen Presets &#8211; Drew Stephens</a></p>

]]></content:encoded>
			<wfw:commentRss>http://oddwit.com/blog/2011/gnu-screen-prese/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XHTML互換なHTML5の書き方まとめ</title>
		<link>http://oddwit.com/blog/2011/polyglot-html</link>
		<comments>http://oddwit.com/blog/2011/polyglot-html#comments</comments>
		<pubDate>Mon, 07 Mar 2011 07:42:29 +0000</pubDate>
		<dc:creator>merikonjatta</dc:creator>
				<category><![CDATA[HowTo's, Tips and Tricks]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[webdesign]]></category>

		<guid isPermaLink="false">http://oddwit.com/blog/?p=698</guid>
		<description><![CDATA[HTML5をXHTMLにも準拠するように書く方法がW3Cに掲載されてたので、普段使いそうな部分を軽くまとめてみました（2011年3月現在）。この書き方 (Polyglot) にしておくとXMLパーサもXHTMLパーサもH [...]]]></description>
			<content:encoded><![CDATA[<p>HTML5をXHTMLにも準拠するように書く方法がW3Cに掲載されてたので、普段使いそうな部分を軽くまとめてみました（2011年3月現在）。この書き方 (Polyglot) にしておくとXMLパーサもXHTMLパーサもHTMLパーサも同じように文書を解釈してくれます。無難かつ綺麗な感じもするので、これからはこれに則ってHTMLを書くことにしてみようと思ってます。</p>
<p>MathMLやSVGに関する部分などは省いてますので詳細は以下を参照してください。<br />
<a href="http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html">ソース：Polyglot Markup: HTML-Compatible XHTML Documents</a></p>
<h3>概要</h3>
<p>PolyglotなHTMLは、</p>
<ul>
<li>ValidなHTMLドキュメントである</li>
<li>Well-formedなXMLドキュメントである</li>
<li>HTMLとして処理してもXMLとして処理しても同一のDOMを持つ</li>
</ul>
<p>特定のXML DTDに準拠している必要はありません。</p>
<h3>最小必要構成</h3>
<pre class="brush:html">&lt;!DOCTYPE html&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"&gt;
  &lt;head&gt;
    &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
&lt;/html&gt;</pre>
<p>HTML5のDoctypeを使用し、htmlタグには上記ネームスペースを割り当てます。<br />
langとxml:langは両方同じ値を指定します。<br />
文書自体はUTF-8かUTF-16で作成します。（UTF-8推奨）。</p>
<h3>普段使いそうな構成</h3>
<pre class="brush:html">
&lt;!DOCTYPE html&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8"/&gt;
    &lt;link rel="stylesheet" type="text/css" href="external.css"/&gt;
    &lt;script src="external.js"&gt;&lt;/script&gt;
    &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
<p>meta charset=&#8221;"は必須ではなく推奨。&#8221;utf-8&#8243;の部分はCase-insensitive。</p>
<h3>タグごとの書き方</h3>
<h4>table</h4>
<p>tbody要素が必須です。</p>
<pre class="brush:html">
&lt;pre&gt;
&lt;table&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;...&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/pre&gt;
</pre>
<p>また、colタグを使用するときはcolgroupタグが必須です。</p>
<h4>textareaとpre</h4>
<p>改行から始めてはいけません。</p>
<pre class="brush:html">
&lt;pre&gt;require 'rubygems'
require 'nokogiri'
...&lt;/pre&gt;
</pre>
<h4>void要素</h4>
<p>void要素（閉じタグを使わない要素）の一覧は以下の通りです。</p>
<ul>
<li>area</li>
<li>base</li>
<li>br</li>
<li>col</li>
<li>command</li>
<li>embed</li>
<li>hr</li>
<li>img</li>
<li>input</li>
<li>keygen</li>
<li>link</li>
<li>meta</li>
<li>param</li>
<li>source</li>
</ul>
<p>これらの要素は<code>&lt;br/></code>のように短縮形で書きます。<br />
これら以外の要素は中身が空の時でも短縮形を使わず<code>&lt;p>&lt;/p></code>と書きます。</p>
<h3>文字参照</h3>
<p>以下の場合はかならず文字参照を使います。</p>
<ul>
<li>CDATAセクション外の&amp;と&lt;</li>
<li>属性値の中で改行やタブ文字などを使うとき</li>
</ul>
<p>文字参照で名前を使っていいのは以下のものだけです。</p>
<ul>
<li>amp</li>
<li>lt</li>
<li>gt</li>
<li>apos</li>
<li>quot</li>
</ul>
<p>それ以外のものは数値参照で表します。例えば</p>
<ul>
<li>nbsp &#8211; &amp;#xA0;</li>
<li>copy &#8211; &amp;#xA9;</li>
<li>reg &#8211; &amp;#xAE;</li>
<li>laquo &#8211; &amp;#xAB;</li>
<li>raquo &#8211; &amp;#xBB;</li>
<li>mdash &#8211;  &amp;#x2014;</li>
</ul>
<p>完全な一覧はこの辺りを参照：<br />
<a href="http://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF">http://en.wikibooks.org/wiki/Unicode/Character_reference/0000-0FFF</a><br />
<a href="http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references">http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references</a></p>
<h3>その他のルール</h3>
<ul>
<li>noscriptタグは使えません</li>
<li>document.write()とdocument.writeln()は使えません。innerHTMLはOK</li>
<li>ページ内に&lt;または&amp;を含むjsやcssを書くときはCDATAセクションに入れます
<ul>
<li>&lt; ![CDATA[ここにunsafeなコンテンツ]]&gt;</li>
</ul>
</li>
<li>xml:spaceとxml:base属性は使えません</li>
<li>id属性値にスペースを含めてはいけません</li>
<li>タグ名/要素名はすべて小文字です</li>
<li>属性値は大文字/小文字を統一します（全部小文字にしておけばOK）。</li>
<li>属性値はシングルクオートかダブルクオートで囲います</li>
</ul>
<p>W3Cに<a href="http://dev.w3.org/html5/html-xhtml-author-guide/html-xhtml-authoring-guide.html#example-document">サンプルHTML</a>もありますので参考にどうぞ。</p>

]]></content:encoded>
			<wfw:commentRss>http://oddwit.com/blog/2011/polyglot-html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>エクスプローラのサイドバーにある「ライブラリ」「ホームグループ」などの表示・非表示を簡単に切り替えられるアプリ</title>
		<link>http://oddwit.com/blog/2011/windows-7-navigation-page-customizer</link>
		<comments>http://oddwit.com/blog/2011/windows-7-navigation-page-customizer#comments</comments>
		<pubDate>Thu, 03 Mar 2011 17:14:15 +0000</pubDate>
		<dc:creator>merikonjatta</dc:creator>
				<category><![CDATA[HowTo's, Tips and Tricks]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://oddwit.com/blog/?p=683</guid>
		<description><![CDATA[Windows 7のエクスプローラのサイドバー（ナビゲーションペイン）には「ライブラリ」「ホームグループ」「お気に入り」などが表示されてますが、邪魔です。これらの表示・非表示を簡単に切り替えられるアプリを見つけたので紹介 [...]]]></description>
			<content:encoded><![CDATA[<p>Windows 7のエクスプローラのサイドバー（ナビゲーションペイン）には「ライブラリ」「ホームグループ」「お気に入り」などが表示されてますが、邪魔です。これらの表示・非表示を簡単に切り替えられるアプリを見つけたので紹介します。</p>
<p><a href="http://www.door2windows.com/windows-7-navigation-pane-customizer-show-hide-rename-items-in-windows-explorer-navigation-pane/">Windows 7 Navigation Pane Customizer</a><br />
ダウンロードリンクが下の方にあって分かりにくいので一応：<a href="http://www.door2windows.com/download/?tool=Windows%207%20Navigation%20Pane%20Customizer&amp;ext=zip">ダウンロード</a></p>
<p>起動するとこんな感じなので、要らないものはチェックを外します。ついでに名前も変えられるよう。</p>
<p><img src="http://oddwit.com/blog/wp-content/uploads/2011/03/Windows-7-Navigation-Pane-Customizer.png" alt="" title="Windows 7 Navigation Pane Customizer" width="364" height="230" class="alignnone size-full wp-image-684" /></p>
<p>Apply Settingsを押すとエクスプローラが再起動され、変更が反映されます。</p>
<p><a href="http://oddwit.com/blog/wp-content/uploads/2011/03/result.png" rel="lightbox[683]"><img class="alignnone size-full wp-image-685" title="結果" src="http://oddwit.com/blog/wp-content/uploads/2011/03/result.png" alt="" width="405" height="295" /></a></p>
<p>将来このアプリが消えてなくなると戻し方が分からなくなりそうなので、一応このプログラムは消さずに保存しておいたほうがよさそうですね。<br />
# ライブラリ機能って使ってる人いるんかね…？</p>

]]></content:encoded>
			<wfw:commentRss>http://oddwit.com/blog/2011/windows-7-navigation-page-customizer/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Live MeshにSorryと言われて繋がらない時</title>
		<link>http://oddwit.com/blog/2011/windows-live-mesh-sorry</link>
		<comments>http://oddwit.com/blog/2011/windows-live-mesh-sorry#comments</comments>
		<pubDate>Thu, 03 Mar 2011 16:14:06 +0000</pubDate>
		<dc:creator>merikonjatta</dc:creator>
				<category><![CDATA[HowTo's, Tips and Tricks]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://oddwit.com/blog/?p=680</guid>
		<description><![CDATA[Windows Live Meshを起動してログインしようとすると Sorry, there is a problem with the windows live mesh serversと言われてしまう時の解決法。 C [...]]]></description>
			<content:encoded><![CDATA[<p>Windows Live Meshを起動してログインしようとすると <code>Sorry, there is a problem with the windows live mesh servers</code>と言われてしまう時の解決法。</p>
<ol>
<li>C:\windows\system32\drivers\etc\hostsをメモ帳で開きます（管理者として開かないとだめかも）</li>
<li>0.0.0.0 localhostという行があったら、先頭に#を入れてコメントアウト</li>
<li>保存</li>
</ol>
<p>これで繋がるようになりました。なんじゃそりゃ。</p>
<p><a href="http://windowslivehelp.com/thread.aspx?postid=c444b9da-b010-4ef4-ac97-d763d81ba630#c444b9da-b010-4ef4-ac97-d763d81ba630">http://windowslivehelp.com/thread.aspx?postid=c444b9da-b010-4ef4-ac97-d763d81ba630#c444b9da-b010-4ef4-ac97-d763d81ba630</a></p>

]]></content:encoded>
			<wfw:commentRss>http://oddwit.com/blog/2011/windows-live-mesh-sorry/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Note in Readerブックマークレットが動かない人へ</title>
		<link>http://oddwit.com/blog/2011/note-in-reader-glitch-fix</link>
		<comments>http://oddwit.com/blog/2011/note-in-reader-glitch-fix#comments</comments>
		<pubDate>Thu, 03 Mar 2011 14:27:31 +0000</pubDate>
		<dc:creator>merikonjatta</dc:creator>
				<category><![CDATA[HowTo's, Tips and Tricks]]></category>
		<category><![CDATA[google reader]]></category>

		<guid isPermaLink="false">http://oddwit.com/blog/?p=674</guid>
		<description><![CDATA[WebページをGoogle Reader/BuzzでシェアするNote in Readerブックマークレットが今日あたりからうまく動いてないようです。 ブックマークレットを以下で置き換えれば動くという情報があったので試し [...]]]></description>
			<content:encoded><![CDATA[<p>WebページをGoogle Reader/BuzzでシェアするNote in Readerブックマークレットが今日あたりからうまく動いてないようです。</p>
<p>ブックマークレットを以下で置き換えれば動くという情報があったので試したらちゃんと動きました。</p>
<pre class="brush:js">
javascript:_IS_MULTILOGIN_ENABLED=((typeof(_IS_MULTILOGIN_ENABLED)=="undefined")?false:_IS_MULTILOGIN_ENABLED);var%20b=document.body;var%20GR________bookmarklet_domain='http://www.google.com';if(b&#038;&#038;!document.xmlVersion){void(z=document.createElement('script'));void(z.src='http://www.google.com/reader/ui/link-bookmarklet.js');void(b.appendChild(z));}else{}
</pre>
<p>ただしGoogleの公式な修正ではなくユーザが勝手にやってみたハックらしいので、変なことになっても知らんよということです。ご注意を。</p>
<p><a href="http://www.google.vu/support/forum/p/reader/thread?tid=7eb6f6fc5796f544&amp;hl=en">Note in Reader not working. Cleared cache, third-party cookies are on, still nothing. Help? &#8211; Google Reader Help</a>.</p>

]]></content:encoded>
			<wfw:commentRss>http://oddwit.com/blog/2011/note-in-reader-glitch-fix/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rm -rfをやめてTrashを使おう</title>
		<link>http://oddwit.com/blog/2011/use-trash-instead-of-rm-rf</link>
		<comments>http://oddwit.com/blog/2011/use-trash-instead-of-rm-rf#comments</comments>
		<pubDate>Sat, 26 Feb 2011 02:07:01 +0000</pubDate>
		<dc:creator>merikonjatta</dc:creator>
				<category><![CDATA[HowTo's, Tips and Tricks]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://oddwit.com/blog/?p=633</guid>
		<description><![CDATA[rm -rfはもうしません。怖いです。代わりにTrashを使うことにしました。 TrashはCLIで使えるゴミ箱コマンドです。似たようなものは幾つかありますが、いろいろと普段から使いそうな機能をカバーしているので気に入り [...]]]></description>
			<content:encoded><![CDATA[<p>rm -rfはもうしません。怖いです。代わりにTrashを使うことにしました。</p>
<p>TrashはCLIで使えるゴミ箱コマンドです。似たようなものは幾つかありますが、いろいろと普段から使いそうな機能をカバーしているので気に入りました。</p>
<h3>特徴</h3>
<ul>
<li>rmのオプションをつけても文句を言わない</li>
<li>rmみたいに複数の対象ファイルを列挙して削除できる</li>
<li>ゴミ箱のファイル一覧を簡単に見られて復元もできる</li>
<li>同じ名前のファイルやディレクトリを削除してもよしなにしてくれる</li>
<li>Gnomeのゴミ箱と互換性がある（らしい。試してない）</li>
<li>それでいてシェルスクリプトひとつ</li>
</ul>
<h3>入手</h3>
<p><a href="http://filerenameutils.sourceforge.net/">http://filerenameutils.sourceforge.net/</a>の「Download」</p>
<h3>インストール</h3>
<p>展開するとfile-rename-utilsというフォルダができるので、Trashというファイルをパスの通ったディレクトリに置いて実行権限を与えます。</p>
<pre class="brush:plain">
$ sudo cp file-rename-utils/Trash /usr/local/bin/trash
$ sudo chmod a+x /usr/local/bin/trash
</pre>
<p>あと、manページが一応付属してるので、たまには見るかもという人はしかるべき場所にコピーしておきましょう。Ubuntuの場合は</p>
<pre class="brush:plain">
$ sudo cp file-rename-utils/man/Trash.1 /usr/share/man/man1
</pre>
<h3>使い方</h3>
<p>捨てる</p>
<pre class="brush:plain">
$ trash rubygems-1.5.2.tgz
</pre>
<p>~/.Trashというディレクトリに入ります。あ、このディレクトリは予め作っておいてください。</p>
<p>ゴミ箱を覗く</p>
<pre class="brush:plain">
$ trash
rubygems-1.5.2.tgz
-------------------
286KB       1 file(s)
</pre>
<p>戻す</p>
<pre class="brush:plain">
$ trash -r rubygems-1.5.2.tgz
</pre>
<p>以前あった場所ではなくカレントディレクトリに戻ります。</p>
<p>ゴミ箱を空にする</p>
<pre class="brush:plain">
$ trash -e
</pre>
<p>使い方を見る</p>
<pre class="brush:plain">
$ trash --help
$ man trash
</pre>
<p>あとはtrash -r用にzshの補完関数を用意すれば完璧ですね。誰か作ってないかな。</p>

]]></content:encoded>
			<wfw:commentRss>http://oddwit.com/blog/2011/use-trash-instead-of-rm-rf/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CygwinをPuTTYクローンと一緒に使えば思ったほど悪くない</title>
		<link>http://oddwit.com/blog/2011/cygwin-futty</link>
		<comments>http://oddwit.com/blog/2011/cygwin-futty#comments</comments>
		<pubDate>Mon, 21 Feb 2011 15:55:37 +0000</pubDate>
		<dc:creator>merikonjatta</dc:creator>
				<category><![CDATA[HowTo's, Tips and Tricks]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[screen]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[zsh]]></category>

		<guid isPermaLink="false">http://oddwit.com/blog/?p=607</guid>
		<description><![CDATA[Cygwinは最初に入れたときの見た目の印象があまりにも悪すぎてずっと敬遠してきたんですが、改めて導入してみると意外と使える事に気づきました。 Windows環境でgitを使うのが一番の目的で、他の選択肢としては Tor [...]]]></description>
			<content:encoded><![CDATA[<p>Cygwinは最初に入れたときの見た目の印象があまりにも悪すぎてずっと敬遠してきたんですが、改めて導入してみると意外と使える事に気づきました。</p>
<p>Windows環境でgitを使うのが一番の目的で、他の選択肢としては <a href="http://code.google.com/p/tortoisegit/">TortoiseGit</a>、<br />
<a href="http://code.google.com/p/msysgit/">msysgit</a>のgit bashなどがあるんですが、それぞれにデメリットがあります。</p>
<ul>
<li>TortoiseGit
<ul>
<li>通常使用に堪えるクオリティになってるけど、中で何が起こってるのかよく分からないのでgitを使いこなしてる感がない</li>
</ul>
</li>
<li>msysgitのgit bash
<ul>
<li>ベースがコマンドプロンプトなので使いにくい。</li>
<li>フォント変えられない。横幅広がらない。</li>
</ul>
</li>
<li>VMWare経由
<ul>
<li>さあコミットしようという時にサスペンドされてたりしてちょっと面倒</li>
</ul>
</li>
</ul>
<p>というわけでCygwin再挑戦の記録。実にNot bad at allな環境ができあがりました。さようならコマンドプロンプト。</p>
<h3>成果</h3>
<ul>
<li>FuTTYっていう高機能でポータブルなPuTTYクローンを使えてる</li>
<li>Puttyから256色ターミナルでscreen+zshできてる</li>
<li>screenをマウスでスクロールできてる</li>
<li>screen中にPuttyをいきなり閉じて再接続したらアタッチできてる</li>
<li>vim file.txtってするとWindows側のgvimが起動してくれてる</li>
<li>日本語の読み書きもバッチリ</li>
<li>もちろんgitもバッチリ</li>
</ul>
<h3>導入１：Cygwin</h3>
<p><a href="http://cygwin.com/install.html">http://cygwin.com/install.html</a> からダウンロードしてインストールするだけです。最初にインストールしておくパッケージは好みの問題ですが僕の場合はこんな感じです。</p>
<ul>
<li>zsh</li>
<li>git-core</li>
<li>git-svn</li>
<li>wget</li>
<li>make</li>
<li>gcc</li>
<li>openssh</li>
<li>vim （gvimがあるなら入れなくていい。後述）</li>
</ul>
<h3>導入２：FuTTY</h3>
<p>&#8220;cygwin putty&#8221;でググルと「cygtermとPuTTYごった煮版を使え」という内容ばかり出てきますが、不要です。cygtermのビルドも、ややこしい環境変数設定も不要です。PuTTYもごった煮版ではなく高機能な海外産のPuTTYクローンを使いましょう。最近のCygwinは内部文字コード変換によってUTF-8をサポートしているみたいなので、日本語パッチなしのPuTTYでも問題なく日本語が扱えます。</p>
<p>ちょっと探してみるとPuTTYクローンは色々見つかりましたが、最終的に落ち着いたのは<a href="http://code.google.com/p/futty/">FuTTY</a>です。これの特徴は色んなPuTTYクローンのいいとこ取りで、</p>
<ul>
<li>PuTTY Trayのトレイ収納機能</li>
<li>ファイルに設定を保存するポータブルモード</li>
<li>切断されたホストへの再接続機能</li>
<li><a href="http://code.google.com/p/puttycyg/">PuTTYCyg</a>のCygwin接続機能</li>
<li>フルスクリーン表示</li>
<li>透過</li>
<li>URLを自動リンク</li>
<li>マウス中ボタンで貼りつけ、右クリックでメニュー</li>
</ul>
<p>などなど、素敵な機能が揃ってます。UIは英語ですが。</p>
<p>導入は<a href="http://code.google.com/p/futty/downloads/list">ダウンロード</a>して実行するだけ。Cygwinに接続するためにはcthelper.exeというプログラムが必要ですので同じ場所から落としてFuTTY.exeと同じ場所に置きます。 なおPageantなどは付属してないので必要ならば<a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/">PuTTYの公式サイト</a>からどうぞ。</p>
<h3>導入３：FuTTYからCygwinへ接続</h3>
<p>この状態ですでにFuTTYからCygwinへ接続できるはずです。FuTTYを起動し、</p>
<ul>
<li>Connection TypeはCygtermを選択</li>
<li>普段ホスト名を入れるところに-と入力</li>
<li>Window->Translation->Character Set TranslationでUTF-8</li>
<li>Connection->Data->Terminal-type stringにxterm-256color</li>
</ul>
<p>そしてOpen。</p>
<p><a href="http://oddwit.com/blog/wp-content/uploads/2011/02/futty2.png" rel="lightbox[607]"><img src="http://oddwit.com/blog/wp-content/uploads/2011/02/futty2.png" alt="" title="futty2" width="450" height="289" class="alignnone size-full wp-image-617" /></a></p>
<p>ででーん。</p>
<p>ホスト名の欄にzshなどと書けば最初にzshが起動してくれます。僕はここに<code>screen -R</code>を入れて、.screenrcで<code>shell /bin/zsh</code>と設定してます。</p>
<p>なお、設定を保存するときにSessions from fileを選んでおけばレジストリに書き込まずファイルで設定を管理してくれます。Cygwinと一緒にUSBで持ち歩けてしまう。Dropboxにまるごと入れとくのもいいかも。</p>
<h3>設定１：日本語</h3>
<p>PuTTYの文字セットをUTF-8に設定します。.bashrcなり.zshrcなりで</p>
<pre class="brush:bash">
export LC_LANG=en_US.UTF8
</pre>
<h3>設定２：screen関連</h3>
<p>マウスホイールでスクロールバックできるように。これはFuTTYの接続設定にて<strong>Terminal->Features->Disable switching to alternate terminal screen</strong>をチェック。仕組みはよく分かってません。</p>
<p>ちなみにアタッチ・デタッチは<a href="http://sunsite.ualberta.ca/Documentation/Gnu/screen-3.9.4/html_chapter/screen_8.html">autodetachオプション</a>がデフォルトでオンなので特に何もせずとも利用できます。</p>
<p>256色対応するには.screenrcに</p>
<pre class="brush:plain">
term xterm-256color
defbce "on"
</pre>
<p>を追記すればOKなはず。</p>
<h3>設定３：Windows側のvimを起動させる</h3>
<p>これはめちゃ便利です。すごい。<a href="http://d.hatena.ne.jp/pasela/20100326/cyg_gvim">Cygwin内から外のgvimを使う &#8211; ぱせらんメモ</a>にあるスクリプトを使えば<code>vim file.txt</code>としたときにWindowsのgvimが起動してくれます。 Cygwinの/binなどにvimという名前で置いて実行権限を与えときましょう（<code>chmod a+x vim</code>）。</p>
<p>二個目のファイルを開いたときに同じウィンドウの新タブで開くよう改変したものを貼っておきます。</p>
<pre class="brush:bash">
#!/bin/bash

# gvimのパス
WINDOWS_GVIM=/cygdrive/c/programs/dev/vim/vim73/gvim
# HOMEを削除
unset HOME
# vim起動時のコマンドラインオプション
moreargs=--remote-tab-silent

if [ $# -eq 0 ]; then
  $WINDOWS_GVIM &#038;
else
  args=()
  for arg in "$@"
  do
    # 実在するファイルか"-", "+"で始まらなければcygpathに通す
    if [ -e "$arg" -o \( ${arg:0:1} != "-" -a ${arg:0:1} != "+" \) ]; then
      args=("${args[@]}" "$(cygpath -wa "$arg")")
    else
      args=("${args[@]}" "$arg")
    fi
  done

  $WINDOWS_GVIM $moreargs "${args[@]}" &#038;
fi
</pre>
<p>改行コードをUnix (\n)にしておかないと正しく実行できないかも。</p>
<h3>まとめ</h3>
<ul>
<li>Cygwin意外とやるやん</li>
<li>PuTTYはすごいけどFuTTYはもっとすごい</li>
<li>見た目がきれいだと使いやすい</li>
<li>忘れてたけどgitもちゃんと使えてる</li>
</ul>
<p>普段EUC-JPなホストにつないで作業しないといけない人はFuTTYの導入に躊躇するかもしれませんね。一応、PuTTYjpのパッチをFuTTYに導入してくれないかとお願いのメールを送っておきました。果たして対応してもらえるかな？</p>
<h3>おまけ：その他のPuTTYクローン</h3>
<p>PuTTYCygに対応してるものも多い。</p>
<ul>
<li><a href="http://www.9bis.net/kitty/">KiTTY</a></li>
<li><a href="http://haanstra.eu/putty/">PuTTy Tray</a></li>
<li><a href="http://www.extraputty.com/">ExtraPuTTY</a></li>
<li>名前が一番良かったのはダントツで<a href="http://code.google.com/p/portaputty/">PortaPuTTY</a></li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://oddwit.com/blog/2011/cygwin-futty/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windowsからログオフ時にVMWareをサスペンドする</title>
		<link>http://oddwit.com/blog/2011/windows%e3%81%8b%e3%82%89%e3%83%ad%e3%82%b0%e3%82%aa%e3%83%95%e6%99%82%e3%81%abvmware%e3%82%92%e3%82%b5%e3%82%b9%e3%83%9a%e3%83%b3%e3%83%89%e3%81%99%e3%82%8b</link>
		<comments>http://oddwit.com/blog/2011/windows%e3%81%8b%e3%82%89%e3%83%ad%e3%82%b0%e3%82%aa%e3%83%95%e6%99%82%e3%81%abvmware%e3%82%92%e3%82%b5%e3%82%b9%e3%83%9a%e3%83%b3%e3%83%89%e3%81%99%e3%82%8b#comments</comments>
		<pubDate>Thu, 17 Feb 2011 17:22:57 +0000</pubDate>
		<dc:creator>merikonjatta</dc:creator>
				<category><![CDATA[HowTo's, Tips and Tricks]]></category>
		<category><![CDATA[vmware]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://oddwit.com/blog/?p=599</guid>
		<description><![CDATA[バーチャルマシンが走ってる時にうっかり再起動してしまってVMが強制終了されることがよくあります。でもいちいちサスペンドするのは面倒なので、ログオフ時に自動的にVMをサスペンドしましょう。 やることは二つです。 VMをサス [...]]]></description>
			<content:encoded><![CDATA[<p>バーチャルマシンが走ってる時にうっかり再起動してしまってVMが強制終了されることがよくあります。でもいちいちサスペンドするのは面倒なので、ログオフ時に自動的にVMをサスペンドしましょう。</p>
<p>やることは二つです。</p>
<h3>VMをサスペンドするスクリプトを書く</h3>
<p>バッチファイルを以下のように作成します。</p>
<pre class="brush:bat">"C:\Path\To\VMWare\vmrun.exe" suspend "C:\Path\To\machine.vmx"</pre>
<h3>そのスクリプトをログオフ時に実行させる</h3>
<p>Win+Rで「ファイル名を指定して実行」を開き、<strong>gpedit.msc</strong>を実行します。なにやらMSらしい窓が開くので、ユーザの構成&gt;Windowsの設定&gt;スクリプト&gt;ログオフを開きます。</p>
<p><a href="http://oddwit.com/blog/wp-content/uploads/2011/02/Clipboard01.jpg" rel="lightbox[599]"><img class="alignnone size-full wp-image-600" title="gpedit1" src="http://oddwit.com/blog/wp-content/uploads/2011/02/Clipboard01.jpg" alt="" width="450" height="315" /></a></p>
<p>追加を押して、さっきのバッチファイルを指定すればOK。</p>
<p><a href="http://oddwit.com/blog/wp-content/uploads/2011/02/Clipboard02.jpg" rel="lightbox[599]"><img class="alignnone size-full wp-image-601" title="gpedit2" src="http://oddwit.com/blog/wp-content/uploads/2011/02/Clipboard02.jpg" alt="" width="450" height="389" /></a></p>

]]></content:encoded>
			<wfw:commentRss>http://oddwit.com/blog/2011/windows%e3%81%8b%e3%82%89%e3%83%ad%e3%82%b0%e3%82%aa%e3%83%95%e6%99%82%e3%81%abvmware%e3%82%92%e3%82%b5%e3%82%b9%e3%83%9a%e3%83%b3%e3%83%89%e3%81%99%e3%82%8b/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TortoiseSVNのオーバーレイアイコンが更新されない時</title>
		<link>http://oddwit.com/blog/2010/tortoisesvn-overlay-refresh</link>
		<comments>http://oddwit.com/blog/2010/tortoisesvn-overlay-refresh#comments</comments>
		<pubDate>Tue, 06 Jul 2010 18:09:43 +0000</pubDate>
		<dc:creator>merikonjatta</dc:creator>
				<category><![CDATA[HowTo's, Tips and Tricks]]></category>
		<category><![CDATA[tortoisesvn]]></category>

		<guid isPermaLink="false">http://oddwit.com/blog/?p=553</guid>
		<description><![CDATA[TortoiseSVNで、コミットしたのに赤ビックリが消えなくて気持ち悪い時は F5を押してみる TortoiseSVN\bin\TortoiseProc.exe /command:rebuildcacheを実行 それで [...]]]></description>
			<content:encoded><![CDATA[<p>TortoiseSVNで、コミットしたのに赤ビックリが消えなくて気持ち悪い時は</p>
<ol>
<li>F5を押してみる</li>
<li><code>TortoiseSVN\bin\TortoiseProc.exe /command:rebuildcache</code>を実行</li>
<li>それでも駄目ならワーキングコピーでCleanupを実行</li>
</ol>
<p>それでも治らないことがあるようですが。<br />
3番目はワーキングコピーが大きいとちょっと時間がかかります。</p>
<p>参考：<br />
<a href="http://d.hatena.ne.jp/rx7/20060210/p1">TortoiseSVNのアイコンオーバレイがおかしくなった時 &#8211; RX-7乗りの適当な日々</a><br />
<a href="http://tortoisesvn.net/node/146">The overlays show the wrong status | TortoiseSVN</a></p>

]]></content:encoded>
			<wfw:commentRss>http://oddwit.com/blog/2010/tortoisesvn-overlay-refresh/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

