<?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>チラシの裏</title>
	<atom:link href="http://sabakan.org/p/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://sabakan.org/p/blog</link>
	<description>主にコンピュータとOSSに関する覚書</description>
	<lastBuildDate>Sun, 05 Feb 2012 11:13:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>はじめてのCassandra</title>
		<link>http://sabakan.org/p/blog/2012/02/05/%e3%81%af%e3%81%98%e3%82%81%e3%81%a6%e3%81%aecassandra/</link>
		<comments>http://sabakan.org/p/blog/2012/02/05/%e3%81%af%e3%81%98%e3%82%81%e3%81%a6%e3%81%aecassandra/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 11:10:43 +0000</pubDate>
		<dc:creator>root</dc:creator>
				<category><![CDATA[Cassandra]]></category>
		<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://sabakan.org/p/blog/?p=326</guid>
		<description><![CDATA[
			
				
			
		
環境：CentOS5.4(amazon EC2
cassandra:1.0.7
とりあえず、チラ裏程度の情報です。。。
●まず、jdkをインストールします
ここから
http://www.oracle.com/technetwork/java/javase/downloads/index.html
ダウンロードしましょう。
●インストールは普通にrpmコマンドで
[root@epsilon ~] rpm -ivh jdk-7u2-linux-i586.rpm
●ちゃんとインストール出来てるか確認しましょう
[root@epsilon ~] java -version
java version &#8220;1.7.0_02&#8243;
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode, sharing)
●Cassandraのダウンロードをしましょう
[root@epsilon ~] wget http://ftp.jaist.ac.jp/pub/apache//cassandra/1.0.7/apache-cassandra-1.0.7-bin.tar.gz
●適当なディレクトリに解凍しましょう
自分は/usr/local/cassandraにしました。
●Cassandraを起動しましょう
[root@epsilon ~] bin/cassandra -p /var/run/cassandra.pid
pidファイルの場所を指定しておくと、killするときに便利です。
hostnameがなんちゃらってエラーがでる場合はhostnameで表示されるhost名が/etc/hostsに入ってないです。
●もう一つ端末を起動してcassandra-cliからcassandraにアクセスしてみましょう
bin/cassandra-cli -h localhost
●Keyspaceを作成しましょう
[default@unknown]create keyspace Keyspace1 with replication_factor = 1;
●使用するKeyspaceの指定
[default@unknown]use Keyspace1;
●columnを作成します
[default@Keyspace1]  create column family Standard1 with comparator=UTF8Type and default_validation_class=UTF8Type and key_validation_class=UTF8Type;
4b07a490-4fe6-11e1-0000-242d50cf1ff6
Waiting for schema agreement&#8230;
&#8230; schemas [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2012%2F02%2F05%2F%25e3%2581%25af%25e3%2581%2598%25e3%2582%2581%25e3%2581%25a6%25e3%2581%25aecassandra%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2012%2F02%2F05%2F%25e3%2581%25af%25e3%2581%2598%25e3%2582%2581%25e3%2581%25a6%25e3%2581%25aecassandra%2F&amp;source=bokkoware&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>環境：CentOS5.4(amazon EC2<br />
cassandra:1.0.7</p>
<p>とりあえず、チラ裏程度の情報です。。。</p>
<p><strong>●まず、jdkをインストールします</strong><br />
ここから</p>
<p>http://www.oracle.com/technetwork/java/javase/downloads/index.html</p>
<p>ダウンロードしましょう。</p>
<p><strong>●インストールは普通にrpmコマンドで</strong><br />
[root@epsilon ~] rpm -ivh jdk-7u2-linux-i586.rpm</p>
<p><strong>●ちゃんとインストール出来てるか確認しましょう</strong><br />
[root@epsilon ~] java -version<br />
java version &#8220;1.7.0_02&#8243;<br />
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)<br />
Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode, sharing)</p>
<p><strong>●Cassandraのダウンロードをしましょう</strong><br />
[root@epsilon ~] wget http://ftp.jaist.ac.jp/pub/apache//cassandra/1.0.7/apache-cassandra-1.0.7-bin.tar.gz</p>
<p><strong>●適当なディレクトリに解凍しましょう</strong><br />
自分は/usr/local/cassandraにしました。</p>
<p><strong>●Cassandraを起動しましょう</strong><br />
[root@epsilon ~] bin/cassandra -p /var/run/cassandra.pid<br />
pidファイルの場所を指定しておくと、killするときに便利です。<br />
hostnameがなんちゃらってエラーがでる場合はhostnameで表示されるhost名が/etc/hostsに入ってないです。</p>
<p><strong>●もう一つ端末を起動してcassandra-cliからcassandraにアクセスしてみましょう</strong><br />
bin/cassandra-cli -h localhost</p>
<p><strong>●Keyspaceを作成しましょう</strong><br />
[default@unknown]create keyspace Keyspace1 with replication_factor = 1;</p>
<p>●<strong>使用するKeyspaceの指定</strong><br />
[default@unknown]use Keyspace1;</p>
<p><strong>●columnを作成します</strong><br />
[default@Keyspace1]  create column family Standard1 with comparator=UTF8Type and default_validation_class=UTF8Type and key_validation_class=UTF8Type;<br />
4b07a490-4fe6-11e1-0000-242d50cf1ff6<br />
Waiting for schema agreement&#8230;<br />
&#8230; schemas agree across the cluster</p>
<p><strong>●データをsetしてみましょう</strong><br />
[default@Keyspace1] set Standard1[jsmith]['first'] = &#8216;John&#8217;;                                                                    Value inserted.<br />
Elapsed time: 94 msec(s).</p>
<p><strong>●データをgetしてみましょう</strong><br />
[default@Keyspace1] get Standard1['jsmith'];<br />
=&gt; (column=first, value=John, timestamp=1328438642555000)<br />
Returned 1 results.<br />
Elapsed time: 31 msec(s).</p>
<p><strong>●Cassandraの終了は</strong><br />
kill `cat /var/run/cassandra.pid`</p>
]]></content:encoded>
			<wfw:commentRss>http://sabakan.org/p/blog/2012/02/05/%e3%81%af%e3%81%98%e3%82%81%e3%81%a6%e3%81%aecassandra/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DoctrineでJOINしたい場合</title>
		<link>http://sabakan.org/p/blog/2011/09/08/doctrine%e3%81%a7join%e3%81%97%e3%81%9f%e3%81%84%e5%a0%b4%e5%90%88/</link>
		<comments>http://sabakan.org/p/blog/2011/09/08/doctrine%e3%81%a7join%e3%81%97%e3%81%9f%e3%81%84%e5%a0%b4%e5%90%88/#comments</comments>
		<pubDate>Thu, 08 Sep 2011 09:25:59 +0000</pubDate>
		<dc:creator>root</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://sabakan.org/p/blog/?p=322</guid>
		<description><![CDATA[
			
				
			
		
DoctrineでJOINしたい場合、普通にJOINメソッドを使うだけだとエラーになります。（ﾊｧﾊｧ
エラーが出ないようにするためにはテーブルのリレーションの設定をしないとダメっぽいです。
たとえばユーザが所持しているアイテムのIDが記録されているUserItemテーブルと
アイテムのマスターテーブルであるItemをJOINする場合は、
UserItemのクラスでこのように↓

public function setUp()
{
	parent::setUp();
	$this-&#62;hasOne('Item', array(
		'local' =&#62; 'item_id',
		'foreign' =&#62; 'id'
	));
}

としてやればエラーがでなくなります。
他のテーブルもJOINしたい場合は
$this->hasOneを追加していけば大丈夫っぽいです。
ちなみに、このやりかたが正しいかどうかは分かりません（ｷﾘｯ
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F09%2F08%2Fdoctrine%25e3%2581%25a7join%25e3%2581%2597%25e3%2581%259f%25e3%2581%2584%25e5%25a0%25b4%25e5%2590%2588%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F09%2F08%2Fdoctrine%25e3%2581%25a7join%25e3%2581%2597%25e3%2581%259f%25e3%2581%2584%25e5%25a0%25b4%25e5%2590%2588%2F&amp;source=bokkoware&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>DoctrineでJOINしたい場合、普通にJOINメソッドを使うだけだとエラーになります。（ﾊｧﾊｧ</p>
<p>エラーが出ないようにするためにはテーブルのリレーションの設定をしないとダメっぽいです。<br />
たとえばユーザが所持しているアイテムのIDが記録されているUserItemテーブルと<br />
アイテムのマスターテーブルであるItemをJOINする場合は、</p>
<p>UserItemのクラスでこのように↓</p>
<pre class="brush: plain;">
public function setUp()
{
	parent::setUp();
	$this-&gt;hasOne('Item', array(
		'local' =&gt; 'item_id',
		'foreign' =&gt; 'id'
	));
}
</pre>
<p>としてやればエラーがでなくなります。</p>
<p>他のテーブルもJOINしたい場合は<br />
$this->hasOneを追加していけば大丈夫っぽいです。</p>
<p>ちなみに、このやりかたが正しいかどうかは分かりません（ｷﾘｯ</p>
]]></content:encoded>
			<wfw:commentRss>http://sabakan.org/p/blog/2011/09/08/doctrine%e3%81%a7join%e3%81%97%e3%81%9f%e3%81%84%e5%a0%b4%e5%90%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>はじめてのDoctrine</title>
		<link>http://sabakan.org/p/blog/2011/06/27/%e3%81%af%e3%81%98%e3%82%81%e3%81%a6%e3%81%aedoctrine/</link>
		<comments>http://sabakan.org/p/blog/2011/06/27/%e3%81%af%e3%81%98%e3%82%81%e3%81%a6%e3%81%aedoctrine/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 02:59:27 +0000</pubDate>
		<dc:creator>root</dc:creator>
				<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://sabakan.org/p/blog/?p=314</guid>
		<description><![CDATA[
			
				
			
		
Doctrineのお勉強をしたのでメモしておく。
環境：Symfony1.4、Doctrine1.2

●SELECT

$q = Doctrine_Query::create()
-&#62;from('Appcourses')
-&#62;where('service_id = ?', $serviceId);

$result = $q-&#62;fetchOne();
$q-&#62;free();

●JOIN(テーブルに外部キーが設定されてないとエラーになります

$q = Doctrine_Query::create()
-&#62;select('t1.service_id, t1.name, t1.description, t1.image_url, t1.price, COALESCE(t2.user_id,0) AS user_id')
-&#62;from('Appcourses t1')
-&#62;leftJoin('t1.AppcourseUsers t2 ON t1.service_id = t2.service_id AND t2.user_id = ?', $userId)
-&#62;orderBy('t1.price ASC');

$result = $q-&#62;execute();
$q-&#62;free();

//どのようなSQLになっているのか見たい場合
//echo $q-&#62;getSqlQuery();

●INSERT（セーブっていうの？

$appCourseLog = new AppcourseLogs();
$appCourseLog-&#62;setUserId($userId);
$appCourseLog-&#62;setTransactionId($transactionId);
$appCourseLog-&#62;setServiceId($serviceId);
$appCourseLog-&#62;setStatus($status);
$appCourseLog-&#62;setCreatedAt(date('Y-m-d H:i:s'));
$appCourseLog-&#62;setUpdatedAt(date('Y-m-d H:i:s'));
$appCourseLog-&#62;save();

●トランザクション

$conn = Doctrine_Manager::connection();

$conn-&#62;beginTransaction();
try {
  $q = Doctrine_Query::create()
  -&#62;from('AppcourseLogs')
  -&#62;where('transaction_id = ?', $transactionId);

  $result = $q-&#62;fetchArray();

 [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F06%2F27%2F%25e3%2581%25af%25e3%2581%2598%25e3%2582%2581%25e3%2581%25a6%25e3%2581%25aedoctrine%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F06%2F27%2F%25e3%2581%25af%25e3%2581%2598%25e3%2582%2581%25e3%2581%25a6%25e3%2581%25aedoctrine%2F&amp;source=bokkoware&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Doctrineのお勉強をしたのでメモしておく。<br />
環境：Symfony1.4、Doctrine1.2<br />
<span id="more-314"></span><br />
●SELECT</p>
<pre class="brush: plain;">
$q = Doctrine_Query::create()
-&gt;from('Appcourses')
-&gt;where('service_id = ?', $serviceId);

$result = $q-&gt;fetchOne();
$q-&gt;free();
</pre>
<p>●JOIN(テーブルに外部キーが設定されてないとエラーになります</p>
<pre class="brush: plain;">
$q = Doctrine_Query::create()
-&gt;select('t1.service_id, t1.name, t1.description, t1.image_url, t1.price, COALESCE(t2.user_id,0) AS user_id')
-&gt;from('Appcourses t1')
-&gt;leftJoin('t1.AppcourseUsers t2 ON t1.service_id = t2.service_id AND t2.user_id = ?', $userId)
-&gt;orderBy('t1.price ASC');

$result = $q-&gt;execute();
$q-&gt;free();

//どのようなSQLになっているのか見たい場合
//echo $q-&gt;getSqlQuery();
</pre>
<p>●INSERT（セーブっていうの？</p>
<pre class="brush: plain;">
$appCourseLog = new AppcourseLogs();
$appCourseLog-&gt;setUserId($userId);
$appCourseLog-&gt;setTransactionId($transactionId);
$appCourseLog-&gt;setServiceId($serviceId);
$appCourseLog-&gt;setStatus($status);
$appCourseLog-&gt;setCreatedAt(date('Y-m-d H:i:s'));
$appCourseLog-&gt;setUpdatedAt(date('Y-m-d H:i:s'));
$appCourseLog-&gt;save();
</pre>
<p>●トランザクション</p>
<pre class="brush: plain;">
$conn = Doctrine_Manager::connection();

$conn-&gt;beginTransaction();
try {
  $q = Doctrine_Query::create()
  -&gt;from('AppcourseLogs')
  -&gt;where('transaction_id = ?', $transactionId);

  $result = $q-&gt;fetchArray();

  $serviceId = $result[0]['service_id'];
  $userId = $result[0]['user_id'];

  $q-&gt;free();

  $appCourseUser = new AppcourseUser();
  $appCourseUser-&gt;setUserId($userId);
  $appCourseUser-&gt;setServiceId($serviceId);
  $appCourseUser-&gt;save();
  unset($appCourseUser);

  $conn-&gt;commit();

} catch(Exception $e) {
  $conn-&gt;rollback();
}
</pre>
<p>●DELETE</p>
<pre class="brush: plain;">
$q = Doctrine_Query::create()
-&gt;delete()-&gt;from('AppcourseUsers')
-&gt;where('user_id = ?', $userId)
-&gt;addWhere('service_id = ?', $serviceId);
$q-&gt;execute();
$q-&gt;free();
</pre>
<p>●コネクションのクローズ（どのタイミングで使っていいか知らんけど</p>
<pre class="brush: plain;">
    $dm = Doctrine_Manager::getInstance();
    $conn = $dm-&gt;connection();
    $dm-&gt;closeConnection($conn);
</pre>
<p>遅い外部API呼び出しの前にクローズしておきたいな・・・・・</p>
]]></content:encoded>
			<wfw:commentRss>http://sabakan.org/p/blog/2011/06/27/%e3%81%af%e3%81%98%e3%82%81%e3%81%a6%e3%81%aedoctrine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>はじめてのSymfony1.4</title>
		<link>http://sabakan.org/p/blog/2011/06/06/%e3%81%af%e3%81%98%e3%82%81%e3%81%a6%e3%81%aesymfony1-4/</link>
		<comments>http://sabakan.org/p/blog/2011/06/06/%e3%81%af%e3%81%98%e3%82%81%e3%81%a6%e3%81%aesymfony1-4/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 12:51:58 +0000</pubDate>
		<dc:creator>root</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Symfony]]></category>

		<guid isPermaLink="false">http://sabakan.org/p/blog/?p=309</guid>
		<description><![CDATA[
			
				
			
		
新規ソーシャルアプリ開発でSymfony1.4を使うことになったので
お勉強しました。
環境：CentOS5.5
PHP:5.3.3

インストール先は

cd /var/www/html

とします。
Apacheの設定は

&#60;VirtualHost *:80&#62;
DocumentRoot &#34;/var/www/html/hoge/web&#34;
ServerName hoge.com

としました。
●今回はアプリケーション名をhogeとしましたのでhogeというディレクトリを作ります

mkdir -p hoge/lib/vendor

cd hoge/lib/vendor

svn co http://svn.symfony-project.com/branches/1.4 symfony

少し時間がかかります。。。。。
●バージョンを確認してみましょう
cd ../../

php lib/vendor/symfony/data/bin/symfony -V

●symfonyコマンドでプロジェクトを作ります

php lib/vendor/symfony/data/bin/symfony generate:project hoge

●フロントエンドを作成します。（通常、管理画面はbackendになるようです

php lib/vendor/symfony/data/bin/symfony generate:app frontend

●シンボリックリンクを作成します

ln -s /var/www/html/hoge/lib/vendor/symfony/data/web/sf /var/www/html/hoge/web

●それではブラウザからアクセスしてみましょう


http://hoge.com/frontend_dev.php

You are not allowed to access this file. Check frontend_dev.php for more information.
というエラーが表示されましたね？
frontend_dev.phpを少し編集しましょう。

vi web/frontend_dev.php

//if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))
//{
//  die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
//}

これでエラーが消えましたね？
●お待ちかね、コントローラーの作成です。

php lib/vendor/symfony/data/bin/symfony generate:module [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F06%2F06%2F%25e3%2581%25af%25e3%2581%2598%25e3%2582%2581%25e3%2581%25a6%25e3%2581%25aesymfony1-4%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F06%2F06%2F%25e3%2581%25af%25e3%2581%2598%25e3%2582%2581%25e3%2581%25a6%25e3%2581%25aesymfony1-4%2F&amp;source=bokkoware&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>新規ソーシャルアプリ開発でSymfony1.4を使うことになったので<br />
お勉強しました。</p>
<p>環境：CentOS5.5<br />
PHP:5.3.3</p>
<p><span id="more-309"></span><br />
インストール先は</p>
<pre class="brush: plain;">
cd /var/www/html
</pre>
<p>とします。</p>
<p>Apacheの設定は</p>
<pre class="brush: plain;">
&lt;VirtualHost *:80&gt;
DocumentRoot &quot;/var/www/html/hoge/web&quot;
ServerName hoge.com
</pre>
<p>としました。</p>
<p>●今回はアプリケーション名をhogeとしましたのでhogeというディレクトリを作ります</p>
<pre class="brush: plain;">
mkdir -p hoge/lib/vendor

cd hoge/lib/vendor

svn co http://svn.symfony-project.com/branches/1.4 symfony
</pre>
<p>少し時間がかかります。。。。。</p>
<p>●バージョンを確認してみましょう<br />
cd ../../</p>
<pre class="brush: plain;">
php lib/vendor/symfony/data/bin/symfony -V
</pre>
<p>●symfonyコマンドでプロジェクトを作ります</p>
<pre class="brush: plain;">
php lib/vendor/symfony/data/bin/symfony generate:project hoge
</pre>
<p>●フロントエンドを作成します。（通常、管理画面はbackendになるようです</p>
<pre class="brush: plain;">
php lib/vendor/symfony/data/bin/symfony generate:app frontend
</pre>
<p>●シンボリックリンクを作成します</p>
<pre class="brush: plain;">
ln -s /var/www/html/hoge/lib/vendor/symfony/data/web/sf /var/www/html/hoge/web
</pre>
<p>●それではブラウザからアクセスしてみましょう</p>
<pre class="brush: plain;">

http://hoge.com/frontend_dev.php
</pre>
<p>You are not allowed to access this file. Check frontend_dev.php for more information.<br />
というエラーが表示されましたね？</p>
<p>frontend_dev.phpを少し編集しましょう。</p>
<pre class="brush: plain;">
vi web/frontend_dev.php

//if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1')))
//{
//  die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
//}
</pre>
<p>これでエラーが消えましたね？</p>
<p>●お待ちかね、コントローラーの作成です。</p>
<pre class="brush: plain;">
php lib/vendor/symfony/data/bin/symfony generate:module frontend Hello
&gt;&gt; dir+      /var/www/html/hoge/apps/frontend/modules/Hello/actions
&gt;&gt; file+     /var/www/html/hoge/apps/frontend/modules/Hello/actions/actions.class.php
&gt;&gt; dir+      /var/www/html/hoge/apps/frontend/modules/Hello/templates
&gt;&gt; file+     /var/www/html/hoge/apps/frontend/modules/Hello/templates/indexSuccess.php
&gt;&gt; file+     /var/www/html/hoge/test/functional/frontend/HelloActionsTest.php
&gt;&gt; tokens    /var/www/html/hoge/test/functional/frontend/HelloActionsTest.php
&gt;&gt; tokens    /var/www/html/hoge/apps/frontend/modules/Hello/actions/actions.class.php
&gt;&gt; tokens    /var/www/html/hoge/apps/frontend/modules/Hello/templates/indexSuccess.php
</pre>
<p>●ブラウザからアクセスしてましょう</p>
<pre class="brush: plain;">

http://hoge.com/frontend_dev.php/Hello/index

ちゃんと、デフォルトの画面が表示されましたか？
</pre>
<p>●次はactionsを追加してみましょう</p>
<pre class="brush: plain;">
vi apps/frontend/modules/Hello/actions/actions.class.php
public function executeWorld()
{
}

vi apps/frontend/modules/Hello/templates/WorldSuccess.php
&lt;h2&gt;Hello, World! &lt;?php echo date('Y/m/d') ?&gt;&lt;/h2&gt;
</pre>
<p>●ブラウザからアクセスしてみましょう</p>
<pre class="brush: plain;">

http://hoge.com/frontend_dev.php/Hello/World
</pre>
<p>おめでとうございます！<br />
ちゃんとHello Worldと表示されましたね？</p>
<p>続きはまた後で。。。</p>
]]></content:encoded>
			<wfw:commentRss>http://sabakan.org/p/blog/2011/06/06/%e3%81%af%e3%81%98%e3%82%81%e3%81%a6%e3%81%aesymfony1-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FTPのモード</title>
		<link>http://sabakan.org/p/blog/2011/06/04/ftp%e3%81%ae%e3%83%a2%e3%83%bc%e3%83%89/</link>
		<comments>http://sabakan.org/p/blog/2011/06/04/ftp%e3%81%ae%e3%83%a2%e3%83%bc%e3%83%89/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 04:03:32 +0000</pubDate>
		<dc:creator>root</dc:creator>
				<category><![CDATA[NW]]></category>

		<guid isPermaLink="false">http://sabakan.org/p/blog/?p=305</guid>
		<description><![CDATA[
			
				
			
		
たまに聞かれるので書いとく。
アクティブモード：
制御用コネクションはクライアントから開始。
データ転送用コネクションはFTPサーバから開始。
パッシブモード：
制御用コネクションはクライアントから開始。
データ転送用コネクションもクライアントから開始し、ポート番号はランダムポートになる。
パッシブモードで動作しているFTPサーバーに
パッシブモード設定されてないクライアントで繋いでも
制御ようコネクションは開始できるけど、データ転送は行えないってことです。
]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F06%2F04%2Fftp%25e3%2581%25ae%25e3%2583%25a2%25e3%2583%25bc%25e3%2583%2589%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F06%2F04%2Fftp%25e3%2581%25ae%25e3%2583%25a2%25e3%2583%25bc%25e3%2583%2589%2F&amp;source=bokkoware&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>たまに聞かれるので書いとく。</p>
<p>アクティブモード：<br />
制御用コネクションはクライアントから開始。<br />
データ転送用コネクションはFTPサーバから開始。</p>
<p>パッシブモード：<br />
制御用コネクションはクライアントから開始。<br />
データ転送用コネクションもクライアントから開始し、ポート番号はランダムポートになる。</p>
<p>パッシブモードで動作しているFTPサーバーに<br />
パッシブモード設定されてないクライアントで繋いでも<br />
制御ようコネクションは開始できるけど、データ転送は行えないってことです。</p>
]]></content:encoded>
			<wfw:commentRss>http://sabakan.org/p/blog/2011/06/04/ftp%e3%81%ae%e3%83%a2%e3%83%bc%e3%83%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS5.5にAPCをインストールする</title>
		<link>http://sabakan.org/p/blog/2011/02/26/centos5-5%e3%81%abapc%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/</link>
		<comments>http://sabakan.org/p/blog/2011/02/26/centos5-5%e3%81%abapc%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 08:48:04 +0000</pubDate>
		<dc:creator>root</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://sabakan.org/p/blog/?p=303</guid>
		<description><![CDATA[
			
				
			
		
#既にremiからPHP5.3をインストール済みです。


[root@epsilon ~] yum --enablerepo=remi install php-pecl-apc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.batblue.com
 * base: mirror.trouble-free.net
 * epel: mirror.umoss.org
 * extras: mirror.batblue.com
 * remi: rpms.famillecollet.com
 * updates: mirror.batblue.com
Setting up Install Process
Resolving Dependencies
--&#62; Running transaction check
---&#62; Package php-pecl-apc.i386 0:3.1.7-1.el5.remi set to be updated
--&#62; Finished Dependency Resolution

Dependencies Resolved

======================================================================================
 Package      [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F02%2F26%2Fcentos5-5%25e3%2581%25abapc%25e3%2582%2592%25e3%2582%25a4%25e3%2583%25b3%25e3%2582%25b9%25e3%2583%2588%25e3%2583%25bc%25e3%2583%25ab%25e3%2581%2599%25e3%2582%258b%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F02%2F26%2Fcentos5-5%25e3%2581%25abapc%25e3%2582%2592%25e3%2582%25a4%25e3%2583%25b3%25e3%2582%25b9%25e3%2583%2588%25e3%2583%25bc%25e3%2583%25ab%25e3%2581%2599%25e3%2582%258b%2F&amp;source=bokkoware&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>#既にremiからPHP5.3をインストール済みです。<br />
<span id="more-303"></span></p>
<pre class="brush: plain;">
[root@epsilon ~] yum --enablerepo=remi install php-pecl-apc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.batblue.com
 * base: mirror.trouble-free.net
 * epel: mirror.umoss.org
 * extras: mirror.batblue.com
 * remi: rpms.famillecollet.com
 * updates: mirror.batblue.com
Setting up Install Process
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package php-pecl-apc.i386 0:3.1.7-1.el5.remi set to be updated
--&gt; Finished Dependency Resolution

Dependencies Resolved

======================================================================================
 Package               Arch          Version                      Repository     Size
======================================================================================
Installing:
 php-pecl-apc          i386          3.1.7-1.el5.remi             remi          104 k

Transaction Summary
======================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 104 k
Is this ok [y/N]: y
Downloading Packages:
php-pecl-apc-3.1.7-1.el5.remi.i386.rpm                         | 104 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : php-pecl-apc                                                   1/1

Installed:
  php-pecl-apc.i386 0:3.1.7-1.el5.remi

Complete!
</pre>
<p>●ちゃんとインストール出来ているか確認しましょう。</p>
<pre class="brush: plain;">
[root@epsilon ~] php -r 'phpinfo();' | grep apc
Additional .ini files parsed =&gt; /etc/php.d/apc.ini,
apc
MMAP File Mask =&gt; /tmp/apc.XXXXXX
apc.cache_by_default =&gt; On =&gt; On
apc.canonicalize =&gt; Off =&gt; Off
apc.coredump_unmap =&gt; Off =&gt; Off
apc.enable_cli =&gt; Off =&gt; Off
apc.enabled =&gt; On =&gt; On
apc.file_md5 =&gt; Off =&gt; Off
apc.file_update_protection =&gt; 2 =&gt; 2
apc.filters =&gt; no value =&gt; no value
apc.gc_ttl =&gt; 3600 =&gt; 3600
apc.include_once_override =&gt; Off =&gt; Off
apc.lazy_classes =&gt; Off =&gt; Off
apc.lazy_functions =&gt; Off =&gt; Off
apc.max_file_size =&gt; 1M =&gt; 1M
apc.mmap_file_mask =&gt; /tmp/apc.XXXXXX =&gt; /tmp/apc.XXXXXX
apc.num_files_hint =&gt; 1024 =&gt; 1024
apc.preload_path =&gt; no value =&gt; no value
apc.report_autofilter =&gt; Off =&gt; Off
apc.rfc1867 =&gt; Off =&gt; Off
apc.rfc1867_freq =&gt; 0 =&gt; 0
apc.rfc1867_name =&gt; APC_UPLOAD_PROGRESS =&gt; APC_UPLOAD_PROGRESS
apc.rfc1867_prefix =&gt; upload_ =&gt; upload_
apc.rfc1867_ttl =&gt; 3600 =&gt; 3600
apc.serializer =&gt; default =&gt; default
apc.shm_segments =&gt; 1 =&gt; 1
apc.shm_size =&gt; 64M =&gt; 64M
apc.slam_defense =&gt; On =&gt; On
apc.stat =&gt; On =&gt; On
apc.stat_ctime =&gt; Off =&gt; Off
apc.ttl =&gt; 7200 =&gt; 7200
apc.use_request_time =&gt; On =&gt; On
apc.user_entries_hint =&gt; 4096 =&gt; 4096
apc.user_ttl =&gt; 7200 =&gt; 7200
apc.write_lock =&gt; On =&gt; On
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sabakan.org/p/blog/2011/02/26/centos5-5%e3%81%abapc%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS5.5にXdebugをインストールする</title>
		<link>http://sabakan.org/p/blog/2011/02/26/centos5-5%e3%81%abxdebug%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/</link>
		<comments>http://sabakan.org/p/blog/2011/02/26/centos5-5%e3%81%abxdebug%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Sat, 26 Feb 2011 08:38:55 +0000</pubDate>
		<dc:creator>root</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://sabakan.org/p/blog/?p=297</guid>
		<description><![CDATA[
			
				
			
		
＃既にremiからPHP5.3をインストール済みです。


[root@epsilon ~] yum --enablerepo=remi install php-pecl-xdebug
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.batblue.com
 * base: mirror.trouble-free.net
 * epel: mirror.umoss.org
 * extras: mirror.batblue.com
 * remi: rpms.famillecollet.com
 * updates: mirror.batblue.com
Setting up Install Process
Resolving Dependencies
--&#62; Running transaction check
---&#62; Package php-pecl-xdebug.i386 0:2.1.0-1.el5.remi set to be updated
--&#62; Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package      [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F02%2F26%2Fcentos5-5%25e3%2581%25abxdebug%25e3%2582%2592%25e3%2582%25a4%25e3%2583%25b3%25e3%2582%25b9%25e3%2583%2588%25e3%2583%25bc%25e3%2583%25ab%25e3%2581%2599%25e3%2582%258b%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F02%2F26%2Fcentos5-5%25e3%2581%25abxdebug%25e3%2582%2592%25e3%2582%25a4%25e3%2583%25b3%25e3%2582%25b9%25e3%2583%2588%25e3%2583%25bc%25e3%2583%25ab%25e3%2581%2599%25e3%2582%258b%2F&amp;source=bokkoware&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>＃既にremiからPHP5.3をインストール済みです。<br />
<span id="more-297"></span></p>
<pre class="brush: plain;">
[root@epsilon ~] yum --enablerepo=remi install php-pecl-xdebug
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: mirror.batblue.com
 * base: mirror.trouble-free.net
 * epel: mirror.umoss.org
 * extras: mirror.batblue.com
 * remi: rpms.famillecollet.com
 * updates: mirror.batblue.com
Setting up Install Process
Resolving Dependencies
--&gt; Running transaction check
---&gt; Package php-pecl-xdebug.i386 0:2.1.0-1.el5.remi set to be updated
--&gt; Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                Arch        Version                   Repository   Size
================================================================================
Installing:
 php-pecl-xdebug        i386        2.1.0-1.el5.remi          remi        165 k

Transaction Summary
================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total download size: 165 k
Is this ok [y/N]: y
Downloading Packages:
php-pecl-xdebug-2.1.0-1.el5.remi.i386.rpm                | 165 kB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : php-pecl-xdebug                                          1/1

Installed:
  php-pecl-xdebug.i386 0:2.1.0-1.el5.remi

Complete!
</pre>
<p>●ちゃんとインストールされているか確認しましょう。</p>
<pre class="brush: plain;">
[root@epsilon ~] php -r 'phpinfo();' | grep -i xdebug
/etc/php.d/xdebug.ini,
    with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans
xdebug
xdebug support =&gt; enabled
xdebug.auto_trace =&gt; Off =&gt; Off
xdebug.collect_assignments =&gt; Off =&gt; Off
xdebug.collect_includes =&gt; On =&gt; On
xdebug.collect_params =&gt; 0 =&gt; 0
xdebug.collect_return =&gt; Off =&gt; Off
xdebug.collect_vars =&gt; Off =&gt; Off
xdebug.default_enable =&gt; On =&gt; On
xdebug.dump.COOKIE =&gt; no value =&gt; no value
xdebug.dump.ENV =&gt; no value =&gt; no value
xdebug.dump.FILES =&gt; no value =&gt; no value
xdebug.dump.GET =&gt; no value =&gt; no value
xdebug.dump.POST =&gt; no value =&gt; no value
xdebug.dump.REQUEST =&gt; no value =&gt; no value
xdebug.dump.SERVER =&gt; no value =&gt; no value
xdebug.dump.SESSION =&gt; no value =&gt; no value
xdebug.dump_globals =&gt; On =&gt; On
xdebug.dump_once =&gt; On =&gt; On
xdebug.dump_undefined =&gt; Off =&gt; Off
xdebug.extended_info =&gt; On =&gt; On
xdebug.file_link_format =&gt; no value =&gt; no value
xdebug.idekey =&gt; root =&gt; no value
xdebug.manual_url =&gt; http://www.php.net =&gt; http://www.php.net
xdebug.max_nesting_level =&gt; 100 =&gt; 100
xdebug.overload_var_dump =&gt; On =&gt; On
xdebug.profiler_aggregate =&gt; Off =&gt; Off
xdebug.profiler_append =&gt; Off =&gt; Off
xdebug.profiler_enable =&gt; Off =&gt; Off
xdebug.profiler_enable_trigger =&gt; Off =&gt; Off
xdebug.profiler_output_dir =&gt; /tmp =&gt; /tmp
xdebug.profiler_output_name =&gt; cachegrind.out.%p =&gt; cachegrind.out.%p
xdebug.remote_autostart =&gt; Off =&gt; Off
xdebug.remote_connect_back =&gt; Off =&gt; Off
xdebug.remote_cookie_expire_time =&gt; 3600 =&gt; 3600
xdebug.remote_enable =&gt; Off =&gt; Off
xdebug.remote_handler =&gt; dbgp =&gt; dbgp
xdebug.remote_host =&gt; localhost =&gt; localhost
xdebug.remote_log =&gt; no value =&gt; no value
xdebug.remote_mode =&gt; req =&gt; req
xdebug.remote_port =&gt; 9000 =&gt; 9000
xdebug.scream =&gt; Off =&gt; Off
xdebug.show_exception_trace =&gt; Off =&gt; Off
xdebug.show_local_vars =&gt; Off =&gt; Off
xdebug.show_mem_delta =&gt; Off =&gt; Off
xdebug.trace_format =&gt; 0 =&gt; 0
xdebug.trace_options =&gt; 0 =&gt; 0
xdebug.trace_output_dir =&gt; /tmp =&gt; /tmp
xdebug.trace_output_name =&gt; trace.%c =&gt; trace.%c
xdebug.var_display_max_children =&gt; 128 =&gt; 128
xdebug.var_display_max_data =&gt; 512 =&gt; 512
xdebug.var_display_max_depth =&gt; 3 =&gt; 3
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sabakan.org/p/blog/2011/02/26/centos5-5%e3%81%abxdebug%e3%82%92%e3%82%a4%e3%83%b3%e3%82%b9%e3%83%88%e3%83%bc%e3%83%ab%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql_secure_installation</title>
		<link>http://sabakan.org/p/blog/2011/01/17/mysql_secure_installation/</link>
		<comments>http://sabakan.org/p/blog/2011/01/17/mysql_secure_installation/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 16:09:36 +0000</pubDate>
		<dc:creator>root</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://sabakan.org/p/blog/?p=291</guid>
		<description><![CDATA[
			
				
			
		
MySQLをセキュアに運用するための基本として、インストール直後に
mysql_secure_installationを使うと良いかもしれない。
rootのパスワードの設定や余分な設定の削除などをやってくれる。
使い方は簡単。


[root@epsilon ~] mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F01%2F17%2Fmysql_secure_installation%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F01%2F17%2Fmysql_secure_installation%2F&amp;source=bokkoware&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>MySQLをセキュアに運用するための基本として、インストール直後に<br />
mysql_secure_installationを使うと良いかもしれない。<br />
rootのパスワードの設定や余分な設定の削除などをやってくれる。</p>
<p>使い方は簡単。<br />
<span id="more-291"></span></p>
<pre class="brush: plain;">
[root@epsilon ~] mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sabakan.org/p/blog/2011/01/17/mysql_secure_installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CREATE TABLE、INSERT時に他のテーブルのレコードを挿入</title>
		<link>http://sabakan.org/p/blog/2011/01/04/create-table%e3%80%81insert%e6%99%82%e3%81%ab%e4%bb%96%e3%81%ae%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e3%81%ae%e3%83%ac%e3%82%b3%e3%83%bc%e3%83%89%e6%8c%bf%e5%85%a5/</link>
		<comments>http://sabakan.org/p/blog/2011/01/04/create-table%e3%80%81insert%e6%99%82%e3%81%ab%e4%bb%96%e3%81%ae%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e3%81%ae%e3%83%ac%e3%82%b3%e3%83%bc%e3%83%89%e6%8c%bf%e5%85%a5/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 16:12:21 +0000</pubDate>
		<dc:creator>root</dc:creator>
				<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://sabakan.org/p/blog/?p=287</guid>
		<description><![CDATA[
			
				
			
		
これは便利。

CREATE TABLE deviceInfo_Tmp ENGINE = MYISAM AS
SELECT * FROM deviceInfo
WHERE width &#62;= 480

INSERT INTO deviceInfo SELECT * FROM deviceInfo_Tmp

]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F01%2F04%2Fcreate-table%25e3%2580%2581insert%25e6%2599%2582%25e3%2581%25ab%25e4%25bb%2596%25e3%2581%25ae%25e3%2583%2586%25e3%2583%25bc%25e3%2583%2596%25e3%2583%25ab%25e3%2581%25ae%25e3%2583%25ac%25e3%2582%25b3%25e3%2583%25bc%25e3%2583%2589%25e6%258c%25bf%25e5%2585%25a5%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2011%2F01%2F04%2Fcreate-table%25e3%2580%2581insert%25e6%2599%2582%25e3%2581%25ab%25e4%25bb%2596%25e3%2581%25ae%25e3%2583%2586%25e3%2583%25bc%25e3%2583%2596%25e3%2583%25ab%25e3%2581%25ae%25e3%2583%25ac%25e3%2582%25b3%25e3%2583%25bc%25e3%2583%2589%25e6%258c%25bf%25e5%2585%25a5%2F&amp;source=bokkoware&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>これは便利。</p>
<pre class="brush: plain;">
CREATE TABLE deviceInfo_Tmp ENGINE = MYISAM AS
SELECT * FROM deviceInfo
WHERE width &gt;= 480

INSERT INTO deviceInfo SELECT * FROM deviceInfo_Tmp
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sabakan.org/p/blog/2011/01/04/create-table%e3%80%81insert%e6%99%82%e3%81%ab%e4%bb%96%e3%81%ae%e3%83%86%e3%83%bc%e3%83%96%e3%83%ab%e3%81%ae%e3%83%ac%e3%82%b3%e3%83%bc%e3%83%89%e6%8c%bf%e5%85%a5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NGINXを使ってみた</title>
		<link>http://sabakan.org/p/blog/2010/09/24/nginx%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f/</link>
		<comments>http://sabakan.org/p/blog/2010/09/24/nginx%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f/#comments</comments>
		<pubDate>Fri, 24 Sep 2010 09:28:12 +0000</pubDate>
		<dc:creator>root</dc:creator>
				<category><![CDATA[NGINX]]></category>

		<guid isPermaLink="false">http://sabakan.org/p/blog/?p=277</guid>
		<description><![CDATA[
			
				
			
		
NGINXを使ってみた。
環境：CentOS5.4
nginx:0.8.50

●インストール
まず、nginxのコンパイルの前にpcre-develをぶち込んでおきましょう。
[root@epsilon /usr/local/src] yum -y install pcre-devel
nginxのソースはwgetでダウンロードすればいいでしょう。
（今回はdevelopmentをダウンロードしました
[taka@epsilon /usr/local/src] wget http://sysoev.ru/nginx/nginx-0.8.50.tar.gz
[taka@epsilon /usr/local/src] tar xzvf nginx-0.8.50.tar.gz
[taka@epsilon /usr/local/src] cd nginx-0.8.50
configureします。
[taka@epsilon /usr/local/src/nginx-0.8.50] ./configure
Configuration summary
  + using system PCRE library
  + OpenSSL library is not used
  + md5: using system crypto library
  + sha1 library is not used
  + using system zlib library
  nginx path [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2010%2F09%2F24%2Fnginx%25e3%2582%2592%25e4%25bd%25bf%25e3%2581%25a3%25e3%2581%25a6%25e3%2581%25bf%25e3%2581%259f%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fsabakan.org%2Fp%2Fblog%2F2010%2F09%2F24%2Fnginx%25e3%2582%2592%25e4%25bd%25bf%25e3%2581%25a3%25e3%2581%25a6%25e3%2581%25bf%25e3%2581%259f%2F&amp;source=bokkoware&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>NGINXを使ってみた。</p>
<p>環境：CentOS5.4<br />
nginx:0.8.50<br />
<span id="more-277"></span><br />
●インストール<br />
まず、nginxのコンパイルの前にpcre-develをぶち込んでおきましょう。<br />
[root@epsilon /usr/local/src] yum -y install pcre-devel</p>
<p>nginxのソースはwgetでダウンロードすればいいでしょう。<br />
（今回はdevelopmentをダウンロードしました<br />
[taka@epsilon /usr/local/src] wget http://sysoev.ru/nginx/nginx-0.8.50.tar.gz</p>
<p>[taka@epsilon /usr/local/src] tar xzvf nginx-0.8.50.tar.gz</p>
<p>[taka@epsilon /usr/local/src] cd nginx-0.8.50</p>
<p>configureします。<br />
[taka@epsilon /usr/local/src/nginx-0.8.50] ./configure<br />
Configuration summary<br />
  + using system PCRE library<br />
  + OpenSSL library is not used<br />
  + md5: using system crypto library<br />
  + sha1 library is not used<br />
  + using system zlib library</p>
<p>  nginx path prefix: &#8220;/usr/local/nginx&#8221;<br />
  nginx binary file: &#8220;/usr/local/nginx/sbin/nginx&#8221;<br />
  nginx configuration prefix: &#8220;/usr/local/nginx/conf&#8221;<br />
  nginx configuration file: &#8220;/usr/local/nginx/conf/nginx.conf&#8221;<br />
  nginx pid file: &#8220;/usr/local/nginx/logs/nginx.pid&#8221;<br />
  nginx error log file: &#8220;/usr/local/nginx/logs/error.log&#8221;<br />
  nginx http access log file: &#8220;/usr/local/nginx/logs/access.log&#8221;<br />
  nginx http client request body temporary files: &#8220;client_body_temp&#8221;<br />
  nginx http proxy temporary files: &#8220;proxy_temp&#8221;<br />
  nginx http fastcgi temporary files: &#8220;fastcgi_temp&#8221;<br />
  nginx http uwsgi temporary files: &#8220;uwsgi_temp&#8221;<br />
  nginx http scgi temporary files: &#8220;scgi_temp&#8221;</p>
<p>make &#038;&#038; make installします。<br />
[taka@epsilon /usr/local/src/nginx-0.8.50] make<br />
[taka@epsilon /usr/local/src/nginx-0.8.50] su -<br />
[root@epsilon /usr/local/src/nginx-0.8.50] make install</p>
<p>今回はnginxのworkerプロセスの実行ユーザはnginxとしました。<br />
[root@epsilon /usr/local/src/nginx-0.8.50] useradd nginx</p>
<p>設定ファイルの書き換えです。<br />
（設定ファイルの内容は記事の最後に<br />
[root@epsilon /usr/local/src/nginx-0.8.50] cd /usr/local/nginx/conf/<br />
[root@epsilon /usr/local/nginx/conf] vi nginx.conf</p>
<p>ログ用のディレクトリを作成しました。<br />
[root@epsilon /usr/local/nginx/conf] mkdir /var/log/nginx</p>
<p>●起動<br />
バイナリのパスを叩いてやるだけです。<br />
[root@epsilon /usr/local/nginx] /usr/local/nginx/sbin/nginx<br />
[root@epsilon /usr/local/nginx] ls /var/run<br />
NetworkManager  cups               haldaemon.pid  netreport  pm         setrans   utmp<br />
avahi-daemon    dbus               mdadm          nginx.pid  ppp        sshd.pid  wpa_supplicant<br />
console         dhclient-eth0.pid  mdmpd          nscd       saslauthd  sudo</p>
<p>ちゃんと、masterプロセスがrootで、workerプロセスがnginxで実行されてます。<br />
[root@epsilon /usr/local/nginx] ps -ef|grep nginx<br />
root      4960     1  0 04:35 ?        00:00:00 nginx: master process /usr/local/nginx/sbin/nginx<br />
nginx     4961  4960  0 04:35 ?        00:00:00 nginx: worker process<br />
root      4971  4645  0 04:35 pts/0    00:00:00 grep &#8211;color=always nginx</p>
<p>●動作チェック<br />
サーバにブラウザでアクセスして・・・・<br />
ちゃんと「Welcome to nginx!」と表示されていれば起動に成功です！</p>
<p>●停止<br />
[root@epsilon /usr/local/nginx] kill `cat /var/run/nginx.pid`</p>
<p>●再起動<br />
[root@epsilon /usr/local/nginx] kill -HUP `cat /var/run/nginx.pid`</p>
<p>●initスクリプトの作成<br />
（スクリプトの内容は記事の最後に<br />
[root@epsilon /usr/local/nginx/conf] vi /etc/init.d/nginx<br />
[root@epsilon /usr/local/nginx/conf] chkconfig &#45;&#45;add nginx</p>
<p>設定ファイルの構文チェック<br />
[root@epsilon /usr/local/nginx/conf] service nginx configtest<br />
the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok<br />
configuration file /usr/local/nginx/conf/nginx.conf test is successful</p>
<p>起動。<br />
[root@epsilon /etc/init.d] service nginx start<br />
Starting nginx:                                            [  OK  ]</p>
<p>ストップ<br />
[root@epsilon /etc/init.d] service nginx stop<br />
Stopping nginx:                                            [  OK  ]</p>
<p>●nginx.conf</p>
<pre class="brush: plain;">

user  nginx nginx;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
error_log  /var/log/nginx/error.log  info;

pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] &quot;$request&quot; '
                      '$status $body_bytes_sent &quot;$http_referer&quot; '
                      '&quot;$http_user_agent&quot; &quot;$http_x_forwarded_for&quot;';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
        }

        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}
</pre>
<p>●initスクリプト</p>
<pre class="brush: plain;">
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig:   - 85 15
# description:  Nginx is an HTTP(S) server, HTTP(S) reverse \
#               proxy and IMAP/POP3 proxy server
# processname: nginx
# config:      /etc/nginx/nginx.conf
# config:      /etc/sysconfig/nginx
# pidfile:     /var/run/nginx.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ &quot;$NETWORKING&quot; = &quot;no&quot; ] &amp;&amp; exit 0

nginx=&quot;/usr/local/nginx/sbin/nginx&quot;
prog=$(basename $nginx)

NGINX_CONF_FILE=&quot;/usr/local/nginx/conf/nginx.conf&quot;

[ -f /etc/sysconfig/nginx ] &amp;&amp; . /etc/sysconfig/nginx

lockfile=/var/lock/subsys/nginx

make_dirs() {
   # make required directories
   user=`nginx -V 2&gt;&amp;1 | grep &quot;configure arguments:&quot; | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -`
   options=`$nginx -V 2&gt;&amp;1 | grep 'configure arguments:'`
   for opt in $options; do
       if [ `echo $opt | grep '.*-temp-path'` ]; then
           value=`echo $opt | cut -d &quot;=&quot; -f 2`
           if [ ! -d &quot;$value&quot; ]; then
               # echo &quot;creating&quot; $value
               mkdir -p $value &amp;&amp; chown -R $user $value
           fi
       fi
   done
}

start() {
    [ -x $nginx ] || exit 5
    [ -f $NGINX_CONF_FILE ] || exit 6
    make_dirs
    echo -n $&quot;Starting $prog: &quot;
    daemon $nginx -c $NGINX_CONF_FILE
    retval=$?
    echo
    [ $retval -eq 0 ] &amp;&amp; touch $lockfile
    return $retval
}

stop() {
    echo -n $&quot;Stopping $prog: &quot;
    killproc $prog -QUIT
    retval=$?
    echo
    [ $retval -eq 0 ] &amp;&amp; rm -f $lockfile
    return $retval
}

restart() {
    configtest || return $?
    stop
    sleep 1
    start
}

reload() {
    configtest || return $?
    echo -n $&quot;Reloading $prog: &quot;
    killproc $nginx -HUP
    RETVAL=$?
    echo
}

force_reload() {
    restart
}

configtest() {
  $nginx -t -c $NGINX_CONF_FILE
}

rh_status() {
    status $prog
}

rh_status_q() {
    rh_status &gt;/dev/null 2&gt;&amp;1
}

case &quot;$1&quot; in
    start)
        rh_status_q &amp;&amp; exit 0
        $1
        ;;
    stop)
        rh_status_q || exit 0
        $1
        ;;
    restart|configtest)
        $1
        ;;
    reload)
        rh_status_q || exit 7
        $1
        ;;
    force-reload)
        force_reload
        ;;
    status)
        rh_status
        ;;
    condrestart|try-restart)
        rh_status_q || exit 0
            ;;
    *)
        echo $&quot;Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}&quot;
        exit 2
esac
</pre>
]]></content:encoded>
			<wfw:commentRss>http://sabakan.org/p/blog/2010/09/24/nginx%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%81%bf%e3%81%9f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

