<?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>Straighten &#187; 技術の話</title>
	<atom:link href="http://straighten.jp/category/%e6%8a%80%e8%a1%93%e3%81%ae%e8%a9%b1/feed/" rel="self" type="application/rss+xml" />
	<link>http://straighten.jp</link>
	<description>サトウマサヒコの記録</description>
	<lastBuildDate>Mon, 26 Jul 2010 21:06:09 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>CakePHPのShellでコマンドラインから引数を受け取る</title>
		<link>http://straighten.jp/2010/04/cakephp%e3%81%aeshell%e3%81%a7%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a9%e3%82%a4%e3%83%b3%e3%81%8b%e3%82%89%e5%bc%95%e6%95%b0%e3%82%92%e5%8f%97%e3%81%91%e5%8f%96%e3%82%8b/</link>
		<comments>http://straighten.jp/2010/04/cakephp%e3%81%aeshell%e3%81%a7%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a9%e3%82%a4%e3%83%b3%e3%81%8b%e3%82%89%e5%bc%95%e6%95%b0%e3%82%92%e5%8f%97%e3%81%91%e5%8f%96%e3%82%8b/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 04:32:07 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[コマンドライン]]></category>
		<category><![CDATA[引数]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=911</guid>
		<description><![CDATA[これも忘れがち。
./cake シェル名 ファンクション名 引数
とかやると、
$this-&#62;args
にコマンドライン引数が入ってくる。dumpしてみると、こんな感じ。
array(1) {
&#160; [0] [...]]]></description>
			<content:encoded><![CDATA[<p>これも忘れがち。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">./cake シェル名 ファンクション名 引数</div></div>
<p>とかやると、</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$this-&gt;args</div></div>
<p>にコマンドライン引数が入ってくる。dumpしてみると、こんな感じ。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">array(1) {<br />
&nbsp; [0]=&gt;<br />
&nbsp; string(11) &quot;引数&quot;<br />
}</div></div>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2010/04/cakephp%e3%81%aeshell%e3%81%a7%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a9%e3%82%a4%e3%83%b3%e3%81%8b%e3%82%89%e5%bc%95%e6%95%b0%e3%82%92%e5%8f%97%e3%81%91%e5%8f%96%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CakePHPのShellでComponentを使う</title>
		<link>http://straighten.jp/2010/04/cakephp%e3%81%aeshell%e3%81%a7component%e3%82%92%e4%bd%bf%e3%81%86/</link>
		<comments>http://straighten.jp/2010/04/cakephp%e3%81%aeshell%e3%81%a7component%e3%82%92%e4%bd%bf%e3%81%86/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 04:27:07 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=909</guid>
		<description><![CDATA[忘れがちなので、備忘録的エントリー
&#60;?php
App::import('Component', 'コンポーネント名');
class TestShell extends Shell { 
&#160; &#038;nbsp [...]]]></description>
			<content:encoded><![CDATA[<p>忘れがちなので、備忘録的エントリー</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;?php<br />
App::import('Component', 'コンポーネント名');<br />
class TestShell extends Shell { <br />
&nbsp; &nbsp; function test () {<br />
&nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;コンポーネント名 = new コンポーネント名Component( $this );<br />
&nbsp; &nbsp; }<br />
}<br />
?&gt;</div></div>
<p>結構、良く忘れる。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2010/04/cakephp%e3%81%aeshell%e3%81%a7component%e3%82%92%e4%bd%bf%e3%81%86/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress + Paypalで簡単ECサイト</title>
		<link>http://straighten.jp/2010/04/wordpress-paypal%e3%81%a7%e7%b0%a1%e5%8d%98ec%e3%82%b5%e3%82%a4%e3%83%88/</link>
		<comments>http://straighten.jp/2010/04/wordpress-paypal%e3%81%a7%e7%b0%a1%e5%8d%98ec%e3%82%b5%e3%82%a4%e3%83%88/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 02:46:59 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[commerce]]></category>
		<category><![CDATA[ec]]></category>
		<category><![CDATA[ecommerce]]></category>
		<category><![CDATA[heteml]]></category>
		<category><![CDATA[plug-in]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=901</guid>
		<description><![CDATA[お仕事で、WordPress+ PaypalなECサイトを作っています。非常に簡単にスタートできそうなイメージでしたので、レシピを紹介。
用意するもの

Hetemlのレンタルサーバー
WordPress（Hetemlを [...]]]></description>
			<content:encoded><![CDATA[<p>お仕事で、<a href="http://ja.wordpress.org/" onclick="pageTracker._trackPageview('/outgoing/ja.wordpress.org/?referer=');">WordPress</a>+ <a href="https://www.paypal.com/jp/cgi-bin/webscr?cmd=_home" onclick="pageTracker._trackPageview('/outgoing/www.paypal.com/jp/cgi-bin/webscr?cmd=_home&amp;referer=');">Paypal</a>なECサイトを作っています。非常に簡単にスタートできそうなイメージでしたので、レシピを紹介。</p>
<p>用意するもの</p>
<ul>
<li><a href="http://heteml.jp/" onclick="pageTracker._trackPageview('/outgoing/heteml.jp/?referer=');">Hetemlのレンタルサーバー</a></li>
<li><a href="http://ja.wordpress.org/" onclick="pageTracker._trackPageview('/outgoing/ja.wordpress.org/?referer=');">WordPress</a>（Hetemlを利用している場合は不要）</li>
<li><a href="http://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" onclick="pageTracker._trackPageview('/outgoing/www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768?referer=');">WP Simple Paypal Shopping cart</a></li>
<li>WordPressテーマ（お好みで）</li>
</ul>
<p>セットアップ手順</p>
<ol>
<li><a href="http://heteml.jp/news/1206.html" onclick="pageTracker._trackPageview('/outgoing/heteml.jp/news/1206.html?referer=');"> Hetemlの簡単インストール機能</a>を使って、<a href="http://ja.wordpress.org/" onclick="pageTracker._trackPageview('/outgoing/ja.wordpress.org/?referer=');">WordPress</a>をワンクリックでインストール</li>
<li>WordPressにログイン後、<a href="http://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" onclick="pageTracker._trackPageview('/outgoing/www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768?referer=');">WP Simple Paypal Shopping cart</a>プラグインを追加</li>
<li><a href="http://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" onclick="pageTracker._trackPageview('/outgoing/www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768?referer=');">WP Simple Paypal Shopping cart</a>の管理ページから、<a href="https://www.paypal.com/jp/cgi-bin/webscr?cmd=_home" onclick="pageTracker._trackPageview('/outgoing/www.paypal.com/jp/cgi-bin/webscr?cmd=_home&amp;referer=');">Paypal</a>の設定を行う</li>
<li>ウィジェット機能を使って、カートをお好みの場所に配置</li>
<li>終わり</li>
</ol>
<p>これだけで、簡単にECサイトの準備が完了しました。笑っちゃう位あっという間です。</p>
<p>後は商品の紹介ページを普通のブログ記事として投稿、「カートに追加」ボタンを<a href="http://www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768" onclick="pageTracker._trackPageview('/outgoing/www.tipsandtricks-hq.com/wordpress-simple-paypal-shopping-cart-plugin-768?referer=');">WP Simple Paypal Shopping cart</a>の記述方法でブログ記事の中に追記するのみです。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[wp_cart:PRODUCT-NAME:price:PRODUCT-PRICE:end]</div></div>
<p>あまりに簡単なので、自分でも何かECやろうかな？と言う気になってしまいました。オンラインのCDショップとか？（儲からないなーww）</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2010/04/wordpress-paypal%e3%81%a7%e7%b0%a1%e5%8d%98ec%e3%82%b5%e3%82%a4%e3%83%88/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CentOS5.2のPHPを5.3にアップデート</title>
		<link>http://straighten.jp/2010/04/centos5-2%e3%81%aephp%e3%82%925-3%e3%81%ab%e3%82%a2%e3%83%83%e3%83%97%e3%83%87%e3%83%bc%e3%83%88/</link>
		<comments>http://straighten.jp/2010/04/centos5-2%e3%81%aephp%e3%82%925-3%e3%81%ab%e3%82%a2%e3%83%83%e3%83%97%e3%83%87%e3%83%bc%e3%83%88/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 10:34:01 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=898</guid>
		<description><![CDATA[CentOS5.2のデフォルトはPHP5.1なので、色々と困る事が多くなってきた。なので、PHP5.3にアップグレードしてやれーと言う事になり、やった作業ログ。
Remiと言うリポジトリを利用しました。RemiはEPEL [...]]]></description>
			<content:encoded><![CDATA[<p>CentOS5.2のデフォルトはPHP5.1なので、色々と困る事が多くなってきた。なので、PHP5.3にアップグレードしてやれーと言う事になり、やった作業ログ。</p>
<p><a href="http://blog.famillecollet.com/" onclick="pageTracker._trackPageview('/outgoing/blog.famillecollet.com/?referer=');">Remi</a>と言うリポジトリを利用しました。Remiは<a onclick="pageTracker._trackPageview('/outgoing/fedoraproject.org/wiki/EPEL?referer=');javascript:pageTracker._trackPageview('/outgoing/fedoraproject.org/wiki/EPEL');" href="http://fedoraproject.org/wiki/EPEL">EPEL</a>リポジトリと依存関係にあるようなのでそちらも追加。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-3.noarch.rpm<br />
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm</div></div>
<p>デフォルトでは、epelリポジトリが有効なので無効化。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sed -i &quot;s/^enabled=1$/enabled=0/&quot; /etc/yum.repos.d/epel.repo</div></div>
<p>PHP, MySQL, Apacheも全てupdateしました。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">yum --enablerepo=remi,epel update php httpd</div></div>
<p>つつがなく完了。バージョンを確認してみると、</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># php -v<br />
PHP 5.3.2 (cli) (built: Mar  4 2010 21:52:46)<br />
Copyright (c) 1997-2010 The PHP Group<br />
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies</div></div>
<p>これでPHP5.1から5.3へのバージョンアップが完了です。ほんと、ここら辺のサーバー周りの事、もっと勉強しなきゃなーと思いました。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2010/04/centos5-2%e3%81%aephp%e3%82%925-3%e3%81%ab%e3%82%a2%e3%83%83%e3%83%97%e3%83%87%e3%83%bc%e3%83%88/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CakePHP Bit.ly Component</title>
		<link>http://straighten.jp/2010/04/cakephp-bit-ly-component/</link>
		<comments>http://straighten.jp/2010/04/cakephp-bit-ly-component/#comments</comments>
		<pubDate>Thu, 22 Apr 2010 04:14:20 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[bit.ly]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[Component]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=894</guid>
		<description><![CDATA[長いURLを短くしてくれて、クリック数を計測してくれるサービス、Bit.lyをCakePHPから簡単に利用する為のComponentを作ったので公開します。
とりあえず実装した機能としては、shorten（長いURLを短 [...]]]></description>
			<content:encoded><![CDATA[<p>長いURLを短くしてくれて、クリック数を計測してくれるサービス、<a href="http://bit.ly/" onclick="pageTracker._trackPageview('/outgoing/bit.ly/?referer=');">Bit.ly</a>をCakePHPから簡単に利用する為のComponentを作ったので公開します。</p>
<p>とりあえず実装した機能としては、shorten（長いURLを短縮）、expand（短いURLやハッシュから元の長いURLを取得）、clicks（クリック数の取得）です。shorten辺りは、いくつかオプションのパラメータを省いてしまっているので、適宜改造してご利用頂ければと思います。</p>
<p><strong>Bit.ly Componentのセットアップ</strong></p>
<ol>
<li><a href="http://bit.ly" onclick="pageTracker._trackPageview('/outgoing/bit.ly?referer=');">Bit.ly</a>にユーザー登録します</li>
<li>APIキーを取得します（APIキーは、<a href="http://bit.ly/account/your_api_key" onclick="pageTracker._trackPageview('/outgoing/bit.ly/account/your_api_key?referer=');">こちらのページ</a>で確認する事ができます）</li>
<li>登録したユーザ名と、APIキーをconfig/core.phpに記載します</li>
<li>controllers/components内にbitly.phpを作成し、下のコードをコピペします。</li>
</ol>
<p>config/core.phpへの記載例</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">define('BITLY_LOGIN', 'ユーザー名' );<br />
define('BITLY_API_KEY', 'APIキー' );</div></div>
<p>controllers/components/bitly.php</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;?php<br />
class BitlyComponent extends Object {<br />
<br />
&nbsp; &nbsp; var $domain = &quot;api.bit.ly&quot;;<br />
&nbsp; &nbsp; var $version = &quot;v3&quot;;<br />
<br />
&nbsp; &nbsp; function shorten ( $longUrl = null ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ( is_null( $longUrl ) ) return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return $this-&gt;__execute ( $this-&gt;__buildUrl( &quot;shorten&quot;, array( 'uri' =&gt; $longUrl ) ) );<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; function expand ( $shortenUrls = array(), $hashs = array() ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ( !is_array( $shortenUrls ) &amp;&amp; !is_array( $hashs ) ) return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ( is_array( $shortenUrls ) ) $params['shortUrl'] = $shortenUrls;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ( is_array( $hashs ) ) $params['hash'] = $hashs;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return $this-&gt;__execute ( $this-&gt;__buildUrl( &quot;expand&quot;, $params ) );<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; function clicks ( $shortenUrls = array(), $hashs = array() ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ( !is_array( $shortenUrls ) &amp;&amp; !is_array( $hashs ) ) return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ( is_array( $shortenUrls ) ) $params['shortUrl'] = $shortenUrls;<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ( is_array( $hashs ) ) $params['hash'] = $hashs;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return $this-&gt;__execute ( $this-&gt;__buildUrl( &quot;clicks&quot;, $params ) );<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; function __buildUrl ( $path = null, $params = array() ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ( !is_array( $params ) ) return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; $return = &quot;http://&quot;.$this-&gt;domain.DS.$this-&gt;version.DS.$path.&quot;?&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; foreach ( array_keys( $params ) as $key ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( is_array( $params[$key] ) ) foreach( $params[$key] as $value ) $return.= $key.&quot;=&quot;.urlencode($value).&quot;&amp;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( !is_array( $params[$key] ) ) $return.= $key.&quot;=&quot;.urlencode($params[$key]).&quot;&amp;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; $return.= &quot;login=&quot;.BITLY_LOGIN.&quot;&amp;apiKey=&quot;.BITLY_API_KEY.&quot;&amp;format=json&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return $return;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; function __execute ( $url = null ) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ( is_null( $url ) ) return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; App::import('HttpSocket');<br />
&nbsp; &nbsp; &nbsp; &nbsp; $http = new HttpSocket();<br />
&nbsp; &nbsp; &nbsp; &nbsp; $result = json_decode( $http-&gt;get( $url ) );<br />
&nbsp; &nbsp; &nbsp; &nbsp; if ( $result-&gt;status_code !== 200 ) return false;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return $result;<br />
&nbsp; &nbsp; }<br />
}<br />
?&gt;</div></div>
<p><strong>Bit.ly Componentの使い方</strong><br />
以下、サンプルコードになります。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/* 長いURLを短縮化 */<br />
$shortenUrl = $this-&gt;Bitly-&gt;shorten( &quot;http://straighte.jp/&quot; );<br />
<br />
/* 短いいURLを元の長いURLに戻す */<br />
$expand = $this-&gt;Bitly-&gt;expand( array( $shortenUrl-&gt;data-&gt;url ) );<br />
<br />
/* 短いいURLのクリック数を取得する */<br />
$click = $this-&gt;Bitly-&gt;clicks( &nbsp;array( $shortenUrl-&gt;data-&gt;url ) );</div></div>
<p>間違いや、アドバイスをお待ちしております！</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2010/04/cakephp-bit-ly-component/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PECLのOAuthでTwitter OAuth</title>
		<link>http://straighten.jp/2010/04/pecl%e3%81%aeoauth%e3%81%a7twitter-oauth/</link>
		<comments>http://straighten.jp/2010/04/pecl%e3%81%aeoauth%e3%81%a7twitter-oauth/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 04:10:01 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[OAuth]]></category>
		<category><![CDATA[PECL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Twitter]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=873</guid>
		<description><![CDATA[少し前の話ですが、PECLのOAuthライブラリを利用して、TwitterにOAuthしてみたので、その過程を思い出しながらメモしておきます。
まずは、PECL OAuthのインストール。（環境はOSXです）
sudo  [...]]]></description>
			<content:encoded><![CDATA[<p>少し前の話ですが、<a href="http://php.net/manual/ja/book.oauth.php" onclick="pageTracker._trackPageview('/outgoing/php.net/manual/ja/book.oauth.php?referer=');">PECLのOAuthライブラリ</a>を利用して、TwitterにOAuthしてみたので、その過程を思い出しながらメモしておきます。</p>
<p>まずは、<a href="http://php.net/manual/ja/book.oauth.php" onclick="pageTracker._trackPageview('/outgoing/php.net/manual/ja/book.oauth.php?referer=');">PECL OAuth</a>のインストール。（環境はOSXです）</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo port install php5-oauth</div></div>
<p>httpdを再起動して終わり。（だったはず。もしかすると、php.iniとかいじらないといけないかも。忘れました。）</p>
<p>で、実際にTwitterにOAuthするには、まずはTwitterでOAuthのConsumer keyと、Consumer secretを取得すべくアプリケーションの登録を<a href="https://twitter.com/oauth/" onclick="pageTracker._trackPageview('/outgoing/twitter.com/oauth/?referer=');">こちら</a>から行います。で、次はいよいよコードです。</p>
<p>OAuthのフローは、<a href="http://dev.twitter.com/" onclick="pageTracker._trackPageview('/outgoing/dev.twitter.com/?referer=');">TwitterのDevサイト</a>にわかりやすい絵がありますので、そちらを拝借してきました。このフローにそって、コードを説明。</p>
<p><a href="http://straighten.jp/wp-content/uploads/2010/04/diagram.png"><img class="alignnone size-medium wp-image-876" title="diagram" src="http://straighten.jp/wp-content/uploads/2010/04/diagram-400x266.png" alt="" width="400" height="266" /></a></p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">// まずは、OAuthオブジェクトを生成します。<br />
$oauth = new OAuth('あなたのConsumer Key','あなたのConsumer secret',OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI);<br />
<br />
// フローのA、戻ってくるのがフローのB<br />
$request_token = $oauth-&gt;getRequestToken('http://api.twitter.com/oauth/request_token');<br />
<br />
// フローのCとDは、ブラウザーでのアクセスになります。Twitterの場合は、こんなフォーマットです。<br />
echo &quot;http://api.twitter.com/oauth/authorize?oauth_token=&quot;.$request_token[&quot;oauth_token&quot;];<br />
<br />
// フローのEとF（アクセストークンの取得）<br />
$oauth-&gt;setToken($request_token['oauth_token'],$request_token['oauth_token_secret']);<br />
$access_token = $oauth-&gt;getAccessToken('http://api.twitter.com/oauth/access_token');<br />
<br />
// フローGの部分ですが、ここでは、Hello! world!!と、つぶやきつつ、レスポンスを出力してみます。<br />
$params = array( 'status' =&gt; 'Hello! world!!' );<br />
$oauth-&gt;setToken($access_token[&quot;oauth_token&quot;],$access_token[&quot;oauth_token_secret&quot;]);<br />
$oauth-&gt;fetch('http://api.twitter.com/1/statuses/update.xml', $params, OAUTH_HTTP_METHOD_POST );<br />
var_dump( json_decode( $oauth-&gt;getLastResponse() ) );</div></div>
<p>と言う流れです。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2010/04/pecl%e3%81%aeoauth%e3%81%a7twitter-oauth/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Snow LeopardにMac PortsでApache2+PHP5+MySQL5をインストールしたメモ</title>
		<link>http://straighten.jp/2010/03/snow-leopard%e3%81%abmac-ports%e3%81%a7apache2php5mysql5%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%97%e3%81%9f%e3%83%a1%e3%83%a2/</link>
		<comments>http://straighten.jp/2010/03/snow-leopard%e3%81%abmac-ports%e3%81%a7apache2php5mysql5%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%97%e3%81%9f%e3%83%a1%e3%83%a2/#comments</comments>
		<pubDate>Tue, 30 Mar 2010 11:03:46 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[mysql5]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[snowleopard]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=859</guid>
		<description><![CDATA[MBPをSnow Leopardにやっとアップデートしたので、その際のメモ。
まずはSnow Leopard用のMac portsをサイトからダウンロードして、インストール。その後、port自身のupdateを行います。 [...]]]></description>
			<content:encoded><![CDATA[<p>MBPをSnow Leopardにやっとアップデートしたので、その際のメモ。</p>
<p>まずはSnow Leopard用の<a href="http://www.macports.org/" onclick="pageTracker._trackPageview('/outgoing/www.macports.org/?referer=');">Mac ports</a>をサイトからダウンロードして、インストール。その後、port自身のupdateを行います。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo port selfupdate</div></div>
<p>はい、準備ここまで。僕の場合、過去の資産はほぼ全てSVNに突っ込んでいるため、/optを惜しみなく削除をしたのちに、portのインストールを行いました。</p>
<p>次はMySQL5のインストールと、起動設定、初期設定。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo port install mysql5-server<br />
sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist<br />
sudo -u _mysql mysql_install_db5<br />
sudo ln /opt/local/bin/mysql5 /opt/local/bin/mysql</div></div>
<p>ああ、簡単。次はApache2へ</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo port install apache2</div></div>
<p>が、エラーが出た。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Error: Checksum (md5) mismatch for httpd-2.2.14.tar.bz2<br />
Error: Checksum (sha1) mismatch for httpd-2.2.14.tar.bz2<br />
Error: Checksum (rmd160) mismatch for httpd-2.2.14.tar.bz2<br />
Error: Target org.macports.checksum returned: Unable to verify file checksums<br />
Error: Status 1 encountered during processing.<br />
Before reporting a bug, first run the command again with the -d flag to get complete output.</div></div>
<p>うーむ、なぜ？と思いながら、一旦、cleanしてみてやり直して見ることに。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo port clean --all apache2<br />
sudo port install apache2</div></div>
<p>お、出来ました。すかさず、Apache2の起動設定を行います。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo launchctl load -w /Library/LaunchDaemons/org.macports.apache2.plist</div></div>
<p>最後は、PHP5をインストール。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo port install php5 +apache2 +mysql5 +sqlite +pear<br />
sudo /opt/local/apache2/bin/apxs -a -e -n &quot;php5&quot; libphp5.so<br />
sudo cp /opt/local/etc/php5/php.ini-development /opt/local/etc/php5/php.ini</div></div>
<p>ApacheにPHPの設定を施す。</p>
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo vi /opt/local/apache2/conf/httpd.conf<br />
AddType application/x-httpd-php .php # この行をhttpd.confに追加<br />
sudo /opt/local/apache2/bin/apachectl restart</div></div>
<p>念の為、info.phpを作成して閲覧してみると、こんな感じに起動します。<br />
<img src="http://straighten.jp/wp-content/uploads/2010/03/phpinfo-400x276.png" alt="" title="phpinfo()" width="400" height="276" class="alignnone size-medium wp-image-871" /><br />
他に必要なものは順次インストールするとして、とりあえずのベースは出来ました。めでたしめでたし。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2010/03/snow-leopard%e3%81%abmac-ports%e3%81%a7apache2php5mysql5%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%97%e3%81%9f%e3%83%a1%e3%83%a2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Microdata</title>
		<link>http://straighten.jp/2010/03/microdata/</link>
		<comments>http://straighten.jp/2010/03/microdata/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 05:53:22 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Microdata]]></category>
		<category><![CDATA[スペック]]></category>
		<category><![CDATA[仕様]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=845</guid>
		<description><![CDATA[HTML5について追いかけていた中で、Microdataと言う仕様に出会いました。
以前、Microformatsと言う類似する仕様も同様に追いかけていたのですが、それに類似するものの様です。また、Microdataは既 [...]]]></description>
			<content:encoded><![CDATA[<p>HTML5について追いかけていた中で、<a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html" onclick="pageTracker._trackPageview('/outgoing/www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html?referer=');">Microdata</a>と言う仕様に出会いました。</p>
<p>以前、<a href="http://microformats.org/wiki/ja" onclick="pageTracker._trackPageview('/outgoing/microformats.org/wiki/ja?referer=');">Microformats</a>と言う類似する仕様も同様に追いかけていたのですが、それに類似するものの様です。また、<a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html" onclick="pageTracker._trackPageview('/outgoing/www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html?referer=');">Microdata</a>は既にGoogleの検索結果に反映されるまで来ている様で、マークアップする際には今後気をつけた方が良いなと思いました。</p>
<p><img class="alignnone size-medium wp-image-850" title="09-5-10 drooling dog snippet metadata circled" src="http://straighten.jp/wp-content/uploads/2010/03/09-5-10-drooling-dog-snippet-metadata-circled-400x62.png" alt="" width="400" height="62" /></p>
<p>特にレビューサイトやECサイト、イベント共有や、会社などの所在地を記述する際など、<a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html" onclick="pageTracker._trackPageview('/outgoing/www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html?referer=');">Microdata</a>を利用する事で、検索サイトにより正しく情報を伝える事ができそうです。また、JavaScriptからDOMでアクセス可能な為、ちょっとしたデータの再利用などでも使えそうです。</p>
<p>参考）<a href="http://www.publickey1.jp/blog/09/html5microdata.html" onclick="pageTracker._trackPageview('/outgoing/www.publickey1.jp/blog/09/html5microdata.html?referer=');">HTML5のMicrodataとは何か？</a></p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2010/03/microdata/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Chrome OS</title>
		<link>http://straighten.jp/2009/11/chrome-os/</link>
		<comments>http://straighten.jp/2009/11/chrome-os/#comments</comments>
		<pubDate>Sat, 21 Nov 2009 13:05:47 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[Chrome]]></category>
		<category><![CDATA[Chrome OS]]></category>
		<category><![CDATA[Goolgle]]></category>
		<category><![CDATA[OS]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=690</guid>
		<description><![CDATA[
金曜日、某ミーティングで盛り上がったChrome OSを早速ダウンロード＆ビルドしてみた。どうやらUbuntuがビルド環境として都合が良さそうだったので、ダウンロードしてそちらのインストールから初めてみた。基本、VMで [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://straighten.jp/wp-content/uploads/2009/11/9dc8829c50c144ac3aeccd689f14d126.jpg"><img class="alignnone size-large wp-image-691" title="Chrome OS" src="http://straighten.jp/wp-content/uploads/2009/11/9dc8829c50c144ac3aeccd689f14d126-749x600.jpg" alt="Chrome OS" width="749" height="600" /></a></p>
<p>金曜日、某ミーティングで盛り上がったChrome OSを早速ダウンロード＆ビルドしてみた。どうやらUbuntuがビルド環境として都合が良さそうだったので、ダウンロードしてそちらのインストールから初めてみた。基本、VMで動かしているのですが。</p>
<p>さて、以下、Chrome OSをVMで動かすまでのログです。環境はUbuntu8です。</p>
<p><span id="more-690"></span></p>
<ol>
<li>sudo apt-get install git-core</li>
<li>mkdir ~/chromiumos</li>
<li>cd ~/chromiumos</li>
<li>gclient config http://src.chromium.org/git/chromiumos.git</li>
<li>gclient sync</li>
<li>cd ~/chromiumos/src/scripts</li>
<li>./make_local_repo.sh</li>
<li>./make_chroot.sh</li>
<li>cd ../</li>
<li>mkdir -p build/x86/local_assets</li>
<li>wget http://build.chromium.org/buildbot/archives/chromium-chromiumos-r32516/chrome-linux.zip</li>
<li>mv chrome-linux.zip build/x86/local_assets/chrome-chromeos.zip</li>
<li>cd scripts</li>
<li>./enter_chroot.sh</li>
<li>./set_shared_user_password.sh</li>
<li>./build_platform_packages.sh</li>
<li>./build_kernel.sh</li>
<li>./build_image.sh</li>
<li>./image_to_vmware.sh &#8211;from=~/chromiumos/chromiumos.git/src/build/images/999.999.32509.091838-a1</li>
</ol>
<p>で、出来上がったVMDKファイルをVirtualBoxで起動してみました。</p>
<p>基本、<a href="http://www.chromium.org/" onclick="pageTracker._trackPageview('/outgoing/www.chromium.org/?referer=');">chromium OS</a>のサイトに書いてある事を実行すれば問題無いです。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2009/11/chrome-os/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SubversionとApache2のインストールと設定</title>
		<link>http://straighten.jp/2009/03/subversion%e3%81%a8apache2%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%a8%e8%a8%ad%e5%ae%9a/</link>
		<comments>http://straighten.jp/2009/03/subversion%e3%81%a8apache2%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%a8%e8%a8%ad%e5%ae%9a/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 20:30:40 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[Subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=424</guid>
		<description><![CDATA[地味に作業しています。以前は、借りたサーバにデフォルトで入っていたApache1.3+yum install subversionと言う非常に手抜きな環境でしたが、事情があってApacheのみを2へ移行。そしたらsubv [...]]]></description>
			<content:encoded><![CDATA[<p>地味に作業しています。以前は、借りたサーバにデフォルトで入っていたApache1.3+yum install subversionと言う非常に手抜きな環境でしたが、事情があってApacheのみを2へ移行。そしたらsubversionのリポジトリへアクセスできない状況に。調べてみたら、mod_dav_svn.soが必要との事で、subversionもapache2同様にソースコンパイルしています。</p>
<p>Apache2のインストールに関しては割愛しますが、Subversionのインストールメモ</p>
<p>[code]<br />
wget http://subversion.tigris.org/downloads/subversion-1.6.0.tar.gz<br />
tar xvzf subversion-1.6.0.tar.gz <br />
cd subversion-1.6.0<br />
./configure --with-apxs=/usr/local/apache2/bin/apxs --with-apr=/usr/local/apache2/bin/apr-1-config --with-apr-util=/usr/local/apache2/bin/apu-1-config<br />
[/code]</p>
<p>と、ここまで来た時に、「お前のSqlite、古いんだよ！」と、怒られたので、エラーメッセージにあったとおり、最新のSqliteをダウンロードして、sqlite3.cを指定されたところへcpしました。</p>
<p>[code]<br />
wget http://www.sqlite.org/sqlite-amalgamation-3.6.11.tar.gz<br />
tar xvzf sqlite-amalgamation-3.6.11.tar.gz<br />
mkdir /home/admin/subversion-1.6.0/sqlite-amalgamation/<br />
cp sqlite-3.6.11/sqlite3.c /home/admin/subversion-1.6.0/sqlite-amalgamation/<br />
[/code]</p>
<p>で、再びconfigureしてmakeしてmake installしたら無事完了の模様です。</p>
<p>SVNのリポジトリを作成しておきます。</p>
<p>[code]<br />
svnadmin create --fs-type fsfs /work/svn/repos/sample<br />
svn mkdir file:///work/svn/repos/sample/trunk file:///work/svn/repos/sample/tags file:///work/svn/repos/sample/branhes -m "make trunk, tags, branches"<br />
[/code]</p>
<p>次に、httpd.confの設定！と思ったら、既にhttpd.confに書き込まれてました。</p>
<p>[code]<br />
LoadModule dav_svn_module     modules/mod_dav_svn.so<br />
LoadModule authz_svn_module   modules/mod_authz_svn.so<br />
[/code]</p>
<p>後は、subversionの設定をごにょごにょやって終了！</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2009/03/subversion%e3%81%a8apache2%e3%81%ae%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%a8%e8%a8%ad%e5%ae%9a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Symfonyを習得してみる</title>
		<link>http://straighten.jp/2009/03/symfony%e3%82%92%e7%bf%92%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/</link>
		<comments>http://straighten.jp/2009/03/symfony%e3%82%92%e7%bf%92%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 04:58:08 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=402</guid>
		<description><![CDATA[仕事で使えるかな？と思うので、Symfonyもかじってみる事にした。
習得までの大まかな流れをメモ。

そもそもSymfonyで出来る事、出来ない事って何？を調べる
まずはチュートリアルをやってみる
ブログツールでも作っ [...]]]></description>
			<content:encoded><![CDATA[<p>仕事で使えるかな？と思うので、Symfonyもかじってみる事にした。</p>
<p>習得までの大まかな流れをメモ。</p>
<ol>
<li>そもそもSymfonyで出来る事、出来ない事って何？を調べる</li>
<li>まずはチュートリアルをやってみる</li>
<li>ブログツールでも作ってみる</li>
<li>簡単なアプリで、パフォーマンスチューニングのコツを見つける</li>
<li>自ずと細かいソースを読む事になる</li>
</ol>
<p>と言う事で、週末からやってみる。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2009/03/symfony%e3%82%92%e7%bf%92%e5%be%97%e3%81%97%e3%81%a6%e3%81%bf%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>データベースについて考えた</title>
		<link>http://straighten.jp/2009/02/%e3%83%87%e3%83%bc%e3%82%bf%e3%83%99%e3%83%bc%e3%82%b9%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e8%80%83%e3%81%88%e3%81%9f/</link>
		<comments>http://straighten.jp/2009/02/%e3%83%87%e3%83%bc%e3%82%bf%e3%83%99%e3%83%bc%e3%82%b9%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e8%80%83%e3%81%88%e3%81%9f/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 03:17:10 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[仕事のこと]]></category>
		<category><![CDATA[技術の話]]></category>
		<category><![CDATA[ウェブシステム]]></category>
		<category><![CDATA[データベース]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=374</guid>
		<description><![CDATA[10年前、きっとシステム化されたウェブサイトって、今と比べるとものすごく少なかったと思います。今では、ブログも含め必ずと言っていい程、何らかのデータベースへアクセスするシステムが裏側にくっついたサイトがほとんど。おかげさ [...]]]></description>
			<content:encoded><![CDATA[<p>10年前、きっとシステム化されたウェブサイトって、今と比べるとものすごく少なかったと思います。今では、ブログも含め必ずと言っていい程、何らかのデータベースへアクセスするシステムが裏側にくっついたサイトがほとんど。おかげさまで、僕の様なダメプログラマーでも市場ニーズがあったりします。</p>
<p>これからどうなって行くんだろう？そんな事を考えてみました。</p>
<p>自分の経験から言えば、サイトに実装される機能的なところは、あまり大きな変化は無い気がします。基本的には何らかのデータに対するCRUDと、Search程度。今も昔も変わりませんし、これは以後も変わらないと思います。</p>
<p>ただ、扱うデータ量に関しては昔の比では無いと言うのが現状でしょう。<a href="http://rephoto.orig.jp/" onclick="pageTracker._trackPageview('/outgoing/rephoto.orig.jp/?referer=');">rePhoto</a>でさえ数万件の画像データを扱っていますし、<a href="http://retext.orig.jp/" onclick="pageTracker._trackPageview('/outgoing/retext.orig.jp/?referer=');">reText</a>も同じく数万件のテキストデータを扱っています。仕事の中では、一日に数百万と言うデータを扱う機会も少なくありません。もちろん、データによっての特性はありますが、その量は年々増えて行っている気がします。</p>
<p>そんな風に考えると、先日書いた<a href="http://straighten.jp/2009/02/hypertable/">Hypertable</a>の様な分散型で且つ大量のデータを扱う事ができるデータベースって、今後需要が増えて行くのではないかと思います。今では思いもつかない（まあ、数字的にはつくけど）、量のデータを高速且つ安定的に、しかも安く回して行く事ができるデータベースが必要になってくるのでは無いかと。</p>
<p>安価で高速、安定的でスケーラブルでハイパフォーマンスなデータベース。しばらくはこれが自分のテーマになりそうです。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2009/02/%e3%83%87%e3%83%bc%e3%82%bf%e3%83%99%e3%83%bc%e3%82%b9%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6%e8%80%83%e3%81%88%e3%81%9f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cakePHPのHttpSocketでHeaderとりたい</title>
		<link>http://straighten.jp/2009/01/cakephp%e3%81%aehttpsocket%e3%81%a7header%e3%81%a8%e3%82%8a%e3%81%9f%e3%81%84/</link>
		<comments>http://straighten.jp/2009/01/cakephp%e3%81%aehttpsocket%e3%81%a7header%e3%81%a8%e3%82%8a%e3%81%9f%e3%81%84/#comments</comments>
		<pubDate>Sat, 24 Jan 2009 02:31:52 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[HttpSocket]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=317</guid>
		<description><![CDATA[cakePHPのHttpSocketは便利です。GetもPostもPutもDeleteもBasic認証も可能です。が、標準ではHTTP headerを取得する事が出来ない風味です。なので、/path/to/cake/li [...]]]></description>
			<content:encoded><![CDATA[<p>cakePHPのHttpSocketは便利です。GetもPostもPutもDeleteもBasic認証も可能です。が、標準ではHTTP headerを取得する事が出来ない風味です。なので、/path/to/cake/libs/http_socket.phpを少しカスタマイズします。</p>
<p>Line:260付近<br />
[PHP]return $this->response['body'];[/PHP]<br />
を<br />
[PHP]return $this->response;[/PHP]<br />
とするとHeaderも取れるはず。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2009/01/cakephp%e3%81%aehttpsocket%e3%81%a7header%e3%81%a8%e3%82%8a%e3%81%9f%e3%81%84/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>顔ラボのAPI制限が謎な件</title>
		<link>http://straighten.jp/2009/01/%e9%a1%94%e3%83%a9%e3%83%9c%e3%81%aeapi%e5%88%b6%e9%99%90%e3%81%8c%e8%ac%8e%e3%81%aa%e4%bb%b6/</link>
		<comments>http://straighten.jp/2009/01/%e9%a1%94%e3%83%a9%e3%83%9c%e3%81%aeapi%e5%88%b6%e9%99%90%e3%81%8c%e8%ac%8e%e3%81%aa%e4%bb%b6/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 09:27:12 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[仕事のこと]]></category>
		<category><![CDATA[技術の話]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[顔ラボ]]></category>

		<guid isPermaLink="false">http://straighten.jp/?p=315</guid>
		<description><![CDATA[先日、職場で顔ラボの中の方とお会いしたので、試しに使ってみました。が、あっと言う間に「利用制限回数を超えました」だとさ。いや、良いんですよ、利用制限がかかっているのはわかっていた事ですし。でもね、その回数が何回で、今、残 [...]]]></description>
			<content:encoded><![CDATA[<p>先日、職場で顔ラボの中の方とお会いしたので、試しに使ってみました。が、あっと言う間に「<strong>利用制限回数を超えました</strong>」だとさ。いや、良いんですよ、利用制限がかかっているのはわかっていた事ですし。でもね、<strong>その回数が何回で、今、残量はどの程度か？</strong>は知りたいよ。</p>
<blockquote><p>制限かけるなら、そのルールとステータスを公開すべき</p></blockquote>
<p>と言うのが今日学んだ事。そうじゃないと、利用者にストレスを与えるだけになってしまう。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2009/01/%e9%a1%94%e3%83%a9%e3%83%9c%e3%81%aeapi%e5%88%b6%e9%99%90%e3%81%8c%e8%ac%8e%e3%81%aa%e4%bb%b6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>cakePHP Tumblr component</title>
		<link>http://straighten.jp/2009/01/cakephp-tumblr-component/</link>
		<comments>http://straighten.jp/2009/01/cakephp-tumblr-component/#comments</comments>
		<pubDate>Tue, 20 Jan 2009 06:42:35 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[cakePHP]]></category>
		<category><![CDATA[Component]]></category>
		<category><![CDATA[Tumlbr]]></category>

		<guid isPermaLink="false">http://www.straighten.jp/?p=288</guid>
		<description><![CDATA[試しに晒してみます。TumblrのAPIを扱うComponentです。まだちゃんとテスト出来てませんが、サンプルと思って頂けると幸いです。
tumblr.php
[PHP]_authenticate();
    }
  [...]]]></description>
			<content:encoded><![CDATA[<p>試しに晒してみます。TumblrのAPIを扱うComponentです。まだちゃんとテスト出来てませんが、サンプルと思って頂けると幸いです。<br />
<span id="more-288"></span>tumblr.php<br />
[PHP]<?php<br />
/**<br />
 * Tumblr Component<br />
 *<br />
 * @author Masahiko Satoh<br />
 * @version 0.1<br />
 * @license http://creativecommons.org/licenses/LGPL/2.1/deed.ja<br />
 * @link http://straighten.jp<br />
 *<br />
*/<br />
App::import('Core', array('Xml'));<br />
class TumblrComponent extends Object {</p>
<p>	var $email = null; //Your account's email address.<br />
	var $password = null; // Your account's password.<br />
	var $tumblelogUrl = null; // Your tumblogs URL ex) http://example.tumblr.com/</p>
<p>    function info () {<br />
    	return $this->_authenticate();<br />
    }</p>
<p>    function read ( $params = null ) {<br />
    	$this->requestUrl = $this->tumblelogUrl.&#8217;api&#8217;.DS.&#8217;read&#8217;;<br />
    	return $this->_execute( $params );<br />
    }</p>
<p>	function write ($params = NULL) {<br />
    	$this->requestUrl = &#8216;http://www.tumblr.com/api/write&#8217;;<br />
    	return $this->_execute( $params );<br />
	}</p>
<p>	function delete ($params = null) {<br />
    	$this->requestUrl = &#8216;http://www.tumblr.com/api/delete&#8217;;<br />
    	return $this->_execute( $params );<br />
	}</p>
<p>	function _authenticate () {<br />
		$this->requestUrl = &#8216;http://www.tumblr.com/api/authenticate&#8217;;<br />
		return $this->_execute();<br />
	}</p>
<p>	function _execute ( $params = null ) {</p>
<p>		$params['email'] = $this->email;<br />
		$params['password'] = $this->password;</p>
<p>		$curl = curl_init($this->requestUrl);<br />
		curl_setopt($curl, CURLOPT_POST, true );<br />
		curl_setopt($curl, CURLOPT_POSTFIELDS, $params );<br />
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, true );<br />
		$result = curl_exec( $curl );<br />
		$status = curl_getinfo( $curl, CURLINFO_HTTP_CODE );<br />
		$content_type = curl_getinfo( $curl, CURLINFO_CONTENT_TYPE );<br />
		curl_close( $curl );</p>
<p>		if ($status == 200 ) {<br />
			if ( strstr( $content_type, &#8216;text/xml&#8217;) ) {<br />
				$xml = new Xml( $result );<br />
				$result = Set::reverse($xml);<br />
			}<br />
		} elseif ($status != 201 &#038;&#038; $status != 200 )  {<br />
			$result = false;<br />
		}<br />
		return $result;<br />
	}<br />
}<br />
?>[/PHP]</p>
<p><strong>インストール方法</strong></p>
<ol>
<li>上記のソースコードを/path/to/controllers/components/tumblr.phpに保存します</li>
<li>利用したいコントローラーでvar $components = array(&#8216;Tumblr&#8217;);します。</li>
</ol>
<p>簡単な使い方<br />
[PHP]/* Tumblelogの情報取得 */<br />
$this->Tumblr->email = &#8216;ログイン用メールアドレス&#8217;;<br />
$this->Tumblr->password = &#8216;ログイン用パスワード&#8217;;<br />
$this->Tumblr->info();</p>
<p>/* 書き込み（例はリンクの場合）*/<br />
$this->Tumblr->email = &#8216;ログイン用メールアドレス&#8217;;<br />
$this->Tumblr->password = &#8216;ログイン用パスワード&#8217;;<br />
$params = array( &#8216;type&#8217; => &#8216;link&#8217;, &#8216;url&#8217; => &#8216;http://straighten.jp/&#8217; );<br />
$post_id = $this->Tumblr->write( $params );</p>
<p>/* 読み込み*/<br />
$this->Tumblr->email = &#8216;ログイン用メールアドレス&#8217;;<br />
$this->Tumblr->password = &#8216;ログイン用パスワード&#8217;;<br />
$this->Tumblr->tumblelogUrl = &#8216;http://retextlog.tumblr.com/&#8217;;<br />
$this->Tumblr->read();</p>
<p>/* 削除 */<br />
$this->Tumblr->email = &#8216;ログイン用メールアドレス&#8217;;<br />
$this->Tumblr->password = &#8216;ログイン用パスワード&#8217;;<br />
$this->Tumblr->delete( array(&#8216;post-id&#8217;=>&#8217;記事ID&#8217;) ) ); //記事IDはreadするか、writeした際に取得できます[/PHP]<br />
その他、詳しいパラメーターに関しては、オフィシャルのAPI仕様を確認して下さい。<br />
<a href="http://www.tumblr.com/api" onclick="pageTracker._trackPageview('/outgoing/www.tumblr.com/api?referer=');">http://www.tumblr.com/api</a></p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2009/01/cakephp-tumblr-component/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>reTextリリースしました</title>
		<link>http://straighten.jp/2009/01/retext%e3%83%aa%e3%83%aa%e3%83%bc%e3%82%b9%e3%81%97%e3%81%be%e3%81%97%e3%81%9f/</link>
		<comments>http://straighten.jp/2009/01/retext%e3%83%aa%e3%83%aa%e3%83%bc%e3%82%b9%e3%81%97%e3%81%be%e3%81%97%e3%81%9f/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 04:36:19 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[自作サイトとか]]></category>
		<category><![CDATA[cakePHP1.2]]></category>
		<category><![CDATA[rePhoto]]></category>
		<category><![CDATA[reText]]></category>

		<guid isPermaLink="false">http://www.straighten.jp/?p=266</guid>
		<description><![CDATA[rePhotoの兄弟サイト、reTextをリリースしました。
reTextは、rePhotoと同じくTumblrで多く引用されているテキストを収集、ランキングや新着、キーワード別に検索する事ができるサービスです。
また、 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://rephoto.orig.jp/" onclick="pageTracker._trackPageview('/outgoing/rephoto.orig.jp/?referer=');">rePhoto</a>の兄弟サイト、<a href="http://retext.orig.jp/" onclick="pageTracker._trackPageview('/outgoing/retext.orig.jp/?referer=');">reText</a>をリリースしました。</p>
<p><a href="http://retext.orig.jp/" onclick="pageTracker._trackPageview('/outgoing/retext.orig.jp/?referer=');">reText</a>は、rePhotoと同じく<strong>Tumblrで多く引用されているテキストを収集、ランキングや新着、キーワード別に検索する事ができるサービス</strong>です。</p>
<p>また、<a href="http://retext.orig.jp/" onclick="pageTracker._trackPageview('/outgoing/retext.orig.jp/?referer=');">reText</a>では、該当テキスト（パーマリンク）に対して、<strong>ブログでのコメント、はてブでのコメント</strong>をあわせてチェックする事が出来る様になっており、暇な時間にダラーっと見るにはまあまあ良いかと思います。</p>
<p>デザインはいまいちですが、今後改善予定と言うことでよろしくお願いします。今回も<a href="http://cakephp.jp" onclick="pageTracker._trackPageview('/outgoing/cakephp.jp?referer=');">cakePHP</a>で開発しています。</p>
<p><a href="http://retext.orig.jp" onclick="pageTracker._trackPageview('/outgoing/retext.orig.jp?referer=');"><img class="alignnone" src="http://img.skitch.com/20090112-jme32e3476hmw98nrqnk52b3hq.jpg" alt="" width="500" height="337" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2009/01/retext%e3%83%aa%e3%83%aa%e3%83%bc%e3%82%b9%e3%81%97%e3%81%be%e3%81%97%e3%81%9f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CakePHP1.2Finalがリリース</title>
		<link>http://straighten.jp/2008/12/cakephp12final%e3%81%8c%e3%83%aa%e3%83%aa%e3%83%bc%e3%82%b9/</link>
		<comments>http://straighten.jp/2008/12/cakephp12final%e3%81%8c%e3%83%aa%e3%83%aa%e3%83%bc%e3%82%b9/#comments</comments>
		<pubDate>Fri, 26 Dec 2008 06:11:05 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[cakePHP]]></category>

		<guid isPermaLink="false">http://www.straighten.jp/?p=243</guid>
		<description><![CDATA[つい先日、RC4がリリースされたばかりのCakePHPが1.2Finalをリリースした模様です。ちょうどRC4のコミットログでも読むかと思っていたところなのに。。。まだどこがどうアップデートされたのかは良くわかっておりま [...]]]></description>
			<content:encoded><![CDATA[<p>つい先日、RC4がリリースされたばかりのCakePHPが1.2Finalをリリースした模様です。ちょうどRC4のコミットログでも読むかと思っていたところなのに。。。まだどこがどうアップデートされたのかは良くわかっておりませんが、ちょうど進めていたrePhotoの書き直し＆最後のリニューアル作業で使ってみようかと思います。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2008/12/cakephp12final%e3%81%8c%e3%83%aa%e3%83%aa%e3%83%bc%e3%82%b9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tokyo Cabinet（Tokyo Tyrant）を使う理由</title>
		<link>http://straighten.jp/2008/12/tokyo-cabinet%ef%bc%88tokyo-tyrant%ef%bc%89%e3%82%92%e4%bd%bf%e3%81%86%e7%90%86%e7%94%b1/</link>
		<comments>http://straighten.jp/2008/12/tokyo-cabinet%ef%bc%88tokyo-tyrant%ef%bc%89%e3%82%92%e4%bd%bf%e3%81%86%e7%90%86%e7%94%b1/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 08:15:15 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[TokyoCabinet]]></category>
		<category><![CDATA[TokyoTyrant]]></category>

		<guid isPermaLink="false">http://www.straighten.jp/?p=181</guid>
		<description><![CDATA[なぜ最近、Tokyo Cabinet、Tokyo Tyrantと言い続けているのか？と言うと、memcacheの代替として使えないかなーと思っているからです。ここ最近、cakePHPもそうなんですが、セッションストレージ [...]]]></description>
			<content:encoded><![CDATA[<p>なぜ最近、<a href="http://tokyocabinet.sourceforge.net/" onclick="pageTracker._trackPageview('/outgoing/tokyocabinet.sourceforge.net/?referer=');">Tokyo Cabinet</a>、<a href="http://tokyocabinet.sourceforge.net/tyrantdoc/" onclick="pageTracker._trackPageview('/outgoing/tokyocabinet.sourceforge.net/tyrantdoc/?referer=');">Tokyo Tyrant</a>と言い続けているのか？と言うと、<a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>の代替として使えないかなーと思っているからです。ここ最近、cakePHPもそうなんですが、セッションストレージとして<a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>を使うケースが多くなってきている気がしています。自分自身、仕事で作るアプリケーションの一部にはセッションストレージでは無いのですが、<a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>をストレージとして利用しているケースがいくつかあります。</p>
<p><span id="more-181"></span>それらの運用をしていく中で、気がついたのは「<strong><a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>　落ちたら消える　さようなら</strong>」と言う事です。いくらレポリケーションしていたとしても、落ちたら消えます。きれいさっぱり。</p>
<p>仮にログインセッションを<a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>にストレージしていた場合、「<strong><a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>　落ちたらログアウト　さようなら</strong>（字余り）」と言う事になりかねない訳です。つまり、<a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>にストレージすべきデータは、落ちても、さようならしても簡単に復旧可能もしくは、痛く無いデータであるべきで、でもそう言うデータって比較的少ない。</p>
<p>であれば、<a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>並みに高速で且つ、落ちてもデータが維持されるストレージが必要になったわけです。その結果が<a href="http://tokyocabinet.sourceforge.net/" onclick="pageTracker._trackPageview('/outgoing/tokyocabinet.sourceforge.net/?referer=');">Tokyo Cabinet</a>（と、Tokyo Tyrant）だったわけです。もちろん、Barkley DBとかSQLiteとかでもよかったのですが、比較的に扱うデータ量が多いため、パフォーマンスの観点で良いと評判が良かった<a href="http://tokyocabinet.sourceforge.net/" onclick="pageTracker._trackPageview('/outgoing/tokyocabinet.sourceforge.net/?referer=');">Tokyo Cabinet</a>（と、<a href="http://tokyocabinet.sourceforge.net/tyrantdoc/" onclick="pageTracker._trackPageview('/outgoing/tokyocabinet.sourceforge.net/tyrantdoc/?referer=');">Tokyo Tyrant</a>）に傾いたと言う結果です。</p>
<p>それに、<a href="http://tokyocabinet.sourceforge.net/tyrantdoc/" onclick="pageTracker._trackPageview('/outgoing/tokyocabinet.sourceforge.net/tyrantdoc/?referer=');">Tokyo Tyrant</a>は<a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>と互換性のあるインターフェスを提供してくれているので、<a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>で作ったアプリケーションであっても簡単に移植できるのではー？と踏んだところもあります。例えばですが、<a href="http://www.danga.com/memcached/" onclick="pageTracker._trackPageview('/outgoing/www.danga.com/memcached/?referer=');">memcache</a>でこんなコードを書いていた場合、<br />
[PHP]<br />
$memcache = new Memcache;<br />
$memcache->connect(&#8216;localhost&#8217;, 11211);<br />
$memcache->set( &#8216;sample&#8217;, &#8216;this is sample recode&#8217; );<br />
echo $memcache->get( &#8216;sample&#8217; );<br />
$memcache->close();<br />
[/PHP]<br />
Tokyo Tyrantの場合、<br />
[PHP]<br />
$memcache = new Memcache;<br />
$memcache->connect(&#8216;localhost&#8217;, 1978); // 起動ポートを変更<br />
$memcache->set( &#8216;sample&#8217;, &#8216;this is sample recode&#8217; );<br />
echo $memcache->get( &#8216;sample&#8217; );<br />
$memcache->close();<br />
[/PHP]<br />
こんな感じになるわけです。</p>
<p>いずれにせよ、<a href="http://alpha.mixi.co.jp/blog/?p=84" onclick="pageTracker._trackPageview('/outgoing/alpha.mixi.co.jp/blog/?p=84&amp;referer=');">mixiみたいに</a>大規模なものではありませんが、今後は<a href="http://tokyocabinet.sourceforge.net/" onclick="pageTracker._trackPageview('/outgoing/tokyocabinet.sourceforge.net/?referer=');">Tokyo Cabinet</a>を（なるべく）利用して、ノウハウを少しでもこちらで共有できるといいなと思います。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2008/12/tokyo-cabinet%ef%bc%88tokyo-tyrant%ef%bc%89%e3%82%92%e4%bd%bf%e3%81%86%e7%90%86%e7%94%b1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPからTokyo Cabinetを使う</title>
		<link>http://straighten.jp/2008/12/php%e3%81%8b%e3%82%89tokyo-cabinet%e3%82%92%e4%bd%bf%e3%81%86/</link>
		<comments>http://straighten.jp/2008/12/php%e3%81%8b%e3%82%89tokyo-cabinet%e3%82%92%e4%bd%bf%e3%81%86/#comments</comments>
		<pubDate>Mon, 08 Dec 2008 05:14:19 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[TokyoCabinet]]></category>
		<category><![CDATA[TokyoTyrant]]></category>

		<guid isPermaLink="false">http://www.straighten.jp/?p=172</guid>
		<description><![CDATA[以前、Tokyo Cabinetについてのインストールログを残しましたが、今回はそれの使い方です。と言うか、既にウノウの方がピュアPHPのライブラリを書いていらっしゃったので、それを利用する方法です。
1, Tokyo  [...]]]></description>
			<content:encoded><![CDATA[<p>以前、<a href="http://www.straighten.jp/2008/11/tokyo-cabinetインストールへの道/" onclick="pageTracker._trackPageview('/outgoing/www.straighten.jp/2008/11/tokyo-cabinet_/?referer=');">Tokyo Cabinetについてのインストールログ</a>を残しましたが、今回はそれの使い方です。と言うか、既に<a href="http://labs.unoh.net/2008/11/php_net_tokyotyrant.html" onclick="pageTracker._trackPageview('/outgoing/labs.unoh.net/2008/11/php_net_tokyotyrant.html?referer=');">ウノウの方がピュアPHPのライブラリを書いていらっしゃった</a>ので、それを利用する方法です。</p>
<p>1, <a href="http://www.straighten.jp/2008/11/tokyo-cabinetインストールへの道/" onclick="pageTracker._trackPageview('/outgoing/www.straighten.jp/2008/11/tokyo-cabinet_/?referer=');">Tokyo Cabinetをインストール</a>（前の記事を参照）</p>
<p>2, <a href="http://tokyocabinet.sourceforge.net/tyrantdoc/" onclick="pageTracker._trackPageview('/outgoing/tokyocabinet.sourceforge.net/tyrantdoc/?referer=');">Tokyo Tyrant</a>をインストール &amp; 起動<br />
[code]<br />
wget http://tokyocabinet.sourceforge.net/tyrantpkg/tokyotyrant-1.1.9.tar.gz<br />
tar xvzf tokyotyrant-1.1.9.tar.gz<br />
cd tokyotyrant-1.1.9<br />
./configure<br />
make<br />
make install<br />
sudo /usr/local/sbin/ttservctl start<br />
[/code]<br />
デフォルトで起動したときは、localhostでポート番号1978で起動します。</p>
<p>3, Net_Tokyo_TyrantをPearでインストール<br />
[code]<br />
pear channel-discover openpear.org<br />
pear install openpear/Net_TokyoTyrant<br />
[/code]<br />
準備完了です。さて、サンプルでも書いてみましょう。<br />
[PHP]<br />
include_once &#8216;Net/TokyoTyrant.php&#8217;;<br />
$tt = new Net_TokyoTyrant();<br />
if ( !$tt-&gt;connect( &#8216;localhost&#8217;, 1978 ) ) exit();<br />
$tt-&gt;put( &#8216;sample&#8217;, &#8216;This is sample record&#8217; ); //”sample”と言う名前のデータを書き込み<br />
echo $tt-&gt;get( &#8216;sample&#8217; ); // ”sample”と言う名前のデータを取得<br />
$tt-&gt;close();<br />
[/PHP]<br />
実行結果は、<br />
[code]This is sample record[/code]<br />
となります。あたりまえですが、Tokyo Cabinetは（オンメモリで起動しない場合）ファイルDBですので、Memcacheの用に再起動でデータが消えたりしません。ですので、<br />
[code]<br />
sudo /usr/local/sbin/ttservctl restart<br />
[/code]<br />
再起動して、<br />
[PHP]<br />
include_once &#8216;Net/TokyoTyrant.php&#8217;;<br />
$tt = new Net_TokyoTyrant();<br />
if ( !$tt-&gt;connect( &#8216;localhost&#8217;, 1978 ) ) exit();<br />
echo $tt-&gt;get( &#8216;sample&#8217; ); // ”sample”と言う名前のデータを取得<br />
$tt-&gt;close();<br />
[/PHP]<br />
しても、前回同様の結果が得られます。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2008/12/php%e3%81%8b%e3%82%89tokyo-cabinet%e3%82%92%e4%bd%bf%e3%81%86/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OSXでSquidを使う際に気をつける事</title>
		<link>http://straighten.jp/2008/12/osx%e3%81%a7squid%e3%82%92%e4%bd%bf%e3%81%86%e9%9a%9b%e3%81%ab%e6%b0%97%e3%82%92%e3%81%a4%e3%81%91%e3%82%8b%e4%ba%8b/</link>
		<comments>http://straighten.jp/2008/12/osx%e3%81%a7squid%e3%82%92%e4%bd%bf%e3%81%86%e9%9a%9b%e3%81%ab%e6%b0%97%e3%82%92%e3%81%a4%e3%81%91%e3%82%8b%e4%ba%8b/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 05:27:09 +0000</pubDate>
		<dc:creator>サトウマサヒコ</dc:creator>
				<category><![CDATA[技術の話]]></category>
		<category><![CDATA[OSX]]></category>
		<category><![CDATA[Squid]]></category>

		<guid isPermaLink="false">http://www.straighten.jp/?p=166</guid>
		<description><![CDATA[ビビりました。Squid立ち上げっぱなしで使っていたら、HDDの残容量が数MBになっていました。
「何？何？」と思っていたところ、HDDの残量を眺めていたらまだまだ減って行く。。。
で、速攻Googleですよ。ネタフルで [...]]]></description>
			<content:encoded><![CDATA[<p>ビビりました。Squid立ち上げっぱなしで使っていたら、HDDの残容量が数MBになっていました。</p>
<p>「何？何？」と思っていたところ、HDDの残量を眺めていたらまだまだ減って行く。。。</p>
<p>で、速攻Googleですよ。ネタフルで紹介されていた<a href="http://www.derlien.com/" onclick="pageTracker._trackPageview('/outgoing/www.derlien.com/?referer=');">Disk Inventory X</a>をインストールして、チェックしてみたところ&#8230;</p>
<p><img class="alignnone" title="Disk Inventory X" src="http://img.skitch.com/20081205-1yjjtask7b5ne3phdp49e5igp2.png" alt="" width="673" height="401" /></p>
<p>何やら妙にでかい、coresなるディレクトリが。で、更にGoogle。</p>
<p><a href="http://blog.e-shell.org/14" onclick="pageTracker._trackPageview('/outgoing/blog.e-shell.org/14?referer=');">OSx, core files and disk space</a></p>
<p>この記事、英語なので正確には内容はわかりませんが、どうやらcoresと言う中に入ってるデータは、メモリダンプのログみたい。。。Squid！！そう、coresの中にあったファイルの作成日を見てみたら、ちょうど昨日からの日付。つまり、Squidを導入してから。。。恐らく、Squidに割り当てた（デフォルトのままなので、割り当たっていた）メモリ容量を利用中にあっさり越えてしまい、結果ダンプをこうして作っていたのではないか？と言う仮説に至りました。。。で、早速実験です。Squidを起動してブラウジングしてみたところ、やっぱりcoresの中にファイルが。。。</p>
<p>結局、/coresの中身のファイルを全部消してしまったのでHDDの空きスペースは復活しましたが、Squidが挙動する中で発生するこの課題は解決出来てません。きっと、squid.confとかだと思うのですが。</p>
<p>取り急ぎ、情報共有まで。</p>
]]></content:encoded>
			<wfw:commentRss>http://straighten.jp/2008/12/osx%e3%81%a7squid%e3%82%92%e4%bd%bf%e3%81%86%e9%9a%9b%e3%81%ab%e6%b0%97%e3%82%92%e3%81%a4%e3%81%91%e3%82%8b%e4%ba%8b/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
