<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>らいふログ</title>
	<atom:link href="http://blog.heartofsword.net/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.heartofsword.net</link>
	<description>VPSにて運用中</description>
	<lastBuildDate>Sat, 10 Dec 2011 09:36:31 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/feed" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>AWSのAPIを叩く(PHP 5)</title>
		<link>http://blog.heartofsword.net/archives/854</link>
		<comments>http://blog.heartofsword.net/archives/854#comments</comments>
		<pubDate>Sat, 10 Dec 2011 09:12:54 +0000</pubDate>
		<dc:creator>タカ</dc:creator>
				<category><![CDATA[AWS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[HMAC]]></category>
		<category><![CDATA[Signature]]></category>

		<guid isPermaLink="false">http://blog.heartofsword.net/?p=854</guid>
		<description><![CDATA[PHPからAWS(EC2)のAPIを叩いてみたので書いてみる。 AWSの公式SDKがあるけど勉強がてらやってみた。 仕様は、 http://docs.amazonwebservices.com/AWSEC2/latest [...]]]></description>
			<content:encoded><![CDATA[<p>PHPからAWS(EC2)のAPIを叩いてみたので書いてみる。</p>
<p>AWSの<a href="http://aws.amazon.com/jp/sdkforphp/" target="_blank">公式SDK</a>があるけど勉強がてらやってみた。</p>
<p>仕様は、</p>
<p><a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/" target="_blank">http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/</a></p>
<p>に書いてある。</p>
<hr />
<!--TOC--></p>
<hr />
<h3 class="entry-section-header">準備</h3>
<div class="section">
まずは、以下の二つを発行する。(AWSの管理コンソールの右上の「Security Credentials」から)</p>
<ol>
<li>アクセスキーID</li>
<li>シークレットアクセスキー</li>
</ol>
<p>すでに発行しているならばそれでもOK</p>
</div>
<h3 class="entry-section-header">Endpointを決める</h3>
<div class="section">
リージョンによって叩く場所が異なる。</p>
<p><a href="http://docs.amazonwebservices.com/general/latest/gr/index.html?rande.html#ec2_region" target="_blank">http://docs.amazonwebservices.com/general/latest/gr/index.html?rande.html#ec2_region</a></p>
<p>東京リージョンの場合は<strong>ec2.ap-northeast-1.amazonaws.com</strong>
</div>
<h3 class="entry-section-header">叩くAPI(Action)を決める</h3>
<div class="section">
次に叩くAPIを決める。<br />
インスタンスを起動したい！とかタグを打ちたい！とか。</p>
<p><a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?OperationList-query.html" target="_blank">http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?OperationList-query.html</a></p>
<p>今回は、インスタンス一覧取得(<strong>DescribeInstances</strong>)を選択したみる。</p>
</div>
<h3 class="entry-section-header">Action固有のパラメータを決める</h3>
<div class="section">
Actionによって色んなパラメータがあるので、それぞれの仕様をみて決める。</p>
<p>DescribeInstancesはパラメータなしでも叩ける。</p>
<p>今回は、マイクロインスタンスで絞ってみる。</p>
<table class="normalTable">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Filter.1.Name</td>
<td>instance-type</td>
</tr>
<tr>
<td>Filter.1.Value.1</td>
<td>t1.micro</td>
</tr>
</table>
</div>
<h3 class="entry-section-header">必須パラメータを追加</h3>
<div class="section">
EC2のAPIの場合、幾つか必須のパラメータがあるのでそれを追加。</p>
<p><a href="http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?Query-Common-Parameters.html" target="_blank">http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/index.html?Query-Common-Parameters.html</a></p>
<table class="normalTable">
<tr>
<th>Key</th>
<th>Value</th>
</tr>
<tr>
<td>Action</td>
<td>アクション名(今回は、DescribeInstances)</td>
</tr>
<tr>
<td>Version</td>
<td>APIのバージョン(今回は、2011-11-01)</td>
</tr>
<tr>
<td>AWSAccessKeyId</td>
<td>アクセスキーID</td>
</tr>
<tr>
<td>Timestamp</td>
<td>YYYY-MM-DDThh:mm:ssZ(date(&#8216;c&#8217;)で取得できる)</td>
</tr>
<tr>
<td>Signature</td>
<td>後述する方法で生成</td>
</tr>
<tr>
<td>SignatureMethod</td>
<td>HmacSHA256 or HMacSHA1</td>
</tr>
<tr>
<td>SignatureVersion</td>
<td>2</td>
</tr>
</table>
<p>これに、Action固有のパラメータを足したものが最終的に送るパラメータ。</p>
<div class="notice">Signatureの生成</div>
<p>オープンソーシャルなAPIも似たような方法で署名してた気がする。</p>
<p>手順は、</p>
<ol>
<li>各Keyを元にソート(ksort)</li>
<li>Key,ValueをURLEncode(RFC 3986)して&#038;で連結</li>
<li>署名に使う文字列を生成(HTTPメソッド名+EndPoint+path+連結したパラメータ)</li>
<li>上記文字列とシークレットアクセスキーを使ってハッシュ生成(HMAC-SHA256 or HMAC-SHA1)</li>
<li>base64エンコード</li>
</ol>
<p>コードにすると以下のような感じ。<br />
(HTTPメソッドとかベタ書きだけど…)</p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
class Signer
{
    function sign($params, $secretAccessKey)
    {
        $params = $this-&gt;sortByKey($params);
        $string = $this-&gt;buildCanonicalString($params);
        $stringToSign = $this-&gt;buildStringToSign($string);
        $signature = base64_encode($this-&gt;hash($stringToSign, $secretAccessKey));
        return $signature;
    }

    private function sortByKey($params)
    {
        ksort($params);
        return $params;
    }

    private function buildCanonicalString($params)
    {
        $strings = array();
        foreach ($params as $key =&gt; $value) {
            $strings[] = $this-&gt;urlencode($key) . '=' . $this-&gt;urlencode($value);
        }
        return implode('&amp;', $strings);
    }

    private function buildStringToSign($string)
    {
        $stringToSign = &quot;GET\n&quot;
                      . &quot;ec2.ap-northeast-1.amazonaws.com\n&quot;
                      . &quot;/\n&quot;
                      . $string;
        return $stringToSign;
    }

    private function hash($stringToSign, $secretAccessKey)
    {
        return hash_hmac('sha256', $stringToSign, $secretAccessKey, true);
    }

    // PHP 5.2.X系はチルダもエンコードするので元に戻す
    private function urlencode($value)
    {
        return str_replace('%7E', '~', rawurlencode($value));
    }
}
</pre>
<p>※PHP5.2系の環境はなかったので、PHP5.3でしか動作確認していない。</p>
</div>
<h3 class="entry-section-header">HTTPリクエスト送信</h3>
<div class="section">
この時点で送信するパラメータはすべて揃ったので、file_get_contentsなりCurlなりお好きなようにどうぞ。</p>
<p>結果はXMLとして帰ってくるので、これもまたお好きなように。
</p></div>
<h3 class="entry-section-header">まとめ</h3>
<div class="section">
Signatureの生成がちょっと面倒だけど、そこ以外は特にハマるところはないと思う。</p>
<p>Signature生成/Httpリクエスト送信/EndPoint/ハッシュアルゴリズム</p>
<p>辺りを分離したクラスを作れば立派な簡易クライアントの出来上がり！</p>
<p>それは、また時間のある時にでも…。
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.heartofsword.net/archives/854/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/archives/854" />
	</item>
		<item>
		<title>Singleton(dispatch_once版)</title>
		<link>http://blog.heartofsword.net/archives/852</link>
		<comments>http://blog.heartofsword.net/archives/852#comments</comments>
		<pubDate>Wed, 30 Nov 2011 15:48:34 +0000</pubDate>
		<dc:creator>タカ</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[デザインパターン]]></category>

		<guid isPermaLink="false">http://blog.heartofsword.net/?p=852</guid>
		<description><![CDATA[Objective-Cのシングルトンは以前書いたけど、 dispatch_onceを使うとより簡単に書けるのでメモ。 Singleton.h Singleton.ｍ]]></description>
			<content:encoded><![CDATA[<p>Objective-Cのシングルトンは<a href="http://blog.heartofsword.net/archives/817">以前</a>書いたけど、</p>
<p>dispatch_onceを使うとより簡単に書けるのでメモ。</p>
<p><!--TOC--></p>
<hr />
<h3 class="entry-section-header">Singleton.h</h3>
<div class="section">
<pre class="brush: objc; title: ; notranslate">
#import &lt;Foundation/Foundation.h&gt;

@interface Singleton : NSObject
+ (Singleton *)instance;
@end
</pre>
</div>
<h3 class="entry-section-header">Singleton.ｍ</h3>
<div class="section">
<pre class="brush: objc; title: ; notranslate">
#import &quot;Singleton.h&quot;

@implementation Singleton

+ (Singleton *)instance {
  static Singleton *instance_ = nil;
  static dispatch_once_t predicate;
  dispatch_once(&amp;predicate, ^{
    instance_ = [[self alloc] init];
  });
  return instance_;
}

@end
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.heartofsword.net/archives/852/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/archives/852" />
	</item>
		<item>
		<title>【iOS5】ALAssetRepresentationクラスのfullScreenImage</title>
		<link>http://blog.heartofsword.net/archives/849</link>
		<comments>http://blog.heartofsword.net/archives/849#comments</comments>
		<pubDate>Thu, 06 Oct 2011 15:27:44 +0000</pubDate>
		<dc:creator>タカ</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iOS 4]]></category>
		<category><![CDATA[iOS 5]]></category>

		<guid isPermaLink="false">http://blog.heartofsword.net/?p=849</guid>
		<description><![CDATA[fullScreenImageメソッドで取得できる画像がちょっとおかしい。 initWithCGImage:scale:orientation: でUIImage作って表示させると右に90度回転してる。 iOS4だとこの [...]]]></description>
			<content:encoded><![CDATA[<p>fullScreenImageメソッドで取得できる画像がちょっとおかしい。</p>
<pre>
initWithCGImage:scale:orientation:
</pre>
<p>でUIImage作って表示させると右に90度回転してる。</p>
<p>iOS4だとこの問題は起きない。</p>
<pre>
initWithCGImage
</pre>
<p>にすると、ちゃんと表示される。</p>
<p>でも、今度はiOS4系だと回転している。</p>
<p>iTunesで同期した画像はiOS5でもこの問題は起きない。</p>
<p>クラスリファレンスみるとiOS5で修正が入ったぽいが…。</p>
<p>まぁ、iOS4とiOS5の時で使い分ければいいんだけど何か釈然としない…。</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.heartofsword.net/archives/849/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/archives/849" />
	</item>
		<item>
		<title>Capistranoの例</title>
		<link>http://blog.heartofsword.net/archives/847</link>
		<comments>http://blog.heartofsword.net/archives/847#comments</comments>
		<pubDate>Sat, 17 Sep 2011 07:08:20 +0000</pubDate>
		<dc:creator>タカ</dc:creator>
				<category><![CDATA[Capistrano]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[レシピ]]></category>

		<guid isPermaLink="false">http://blog.heartofsword.net/?p=847</guid>
		<description><![CDATA[目次 前職ではこんな感じにしていたなぁというネタ。 下書き状態で残っていてもったいなかったので公開。 ディレクトリ構成 以下のようなディレクトリ構成 deploy.rbは以下の通り。 同時20サーバで実行 実行ユーザはc [...]]]></description>
			<content:encoded><![CDATA[<p>目次<br />
<!--TOC--></p>
<hr />
<p>前職ではこんな感じにしていたなぁというネタ。</p>
<p>下書き状態で残っていてもったいなかったので公開。</p>
<h3 class="entry-section-header">ディレクトリ構成</h3>
<div class="section">
以下のようなディレクトリ構成</p>
<pre class="brush: plain; title: ; notranslate">
$CAP_HOME
- Capfile =&gt; config配下のXXX.rbをloadする
- config
  - deploy.rb
  - deploy
    - production.rb =&gt; 本番用環境情報
    - test.rb =&gt; テスト用環境情報
  - XXX.rb =&gt; 各種レシピ
</pre>
<p>deploy.rbは以下の通り。</p>
<pre class="brush: ruby; title: ; notranslate">
require 'capistrano/ext/multistage'

set :default_run_options, :max_hosts =&gt; 20
set :user, 'cap'
ssh_options[:keys] = '/home/user/.ssh/id_rsa'
</pre>
<ul>
<li>同時20サーバで実行</li>
<li>実行ユーザはcap</li>
<li>sshの秘密鍵は /home/user/.ssh/id_rsa </li>
</ul>
</div>
<h3 class="entry-section-header">環境設定</h3>
<div class="section">
$CAP_HOME/config/deploy/XXX.rb に設置。</p>
<pre class="brush: ruby; title: ; notranslate">
server 'srv1.example.com', :web
server 'srv2.example.com', :web
server 'srv3.example.com', :web, :ap
server 'db1.example.com', :db
server 'db2.example.com', :db
</pre>
<p>みたいな形で、1サーバずつロールを設定。
</p></div>
<h3 class="entry-section-header">レシピ</h3>
<div class="section">
namespaceを使ってある程度グルーピングする。</p>
<pre class="brush: ruby; title: ; notranslate">
namespace :group do
  task :task1, :roles =&gt; :web do
    ここでごにょごにょする
  end

  task :task2, :roles =&gt; :db do
    ここでごにょごにょする
  end
end
</pre>
<p>といった形。</p>
<pre class="brush: plain; title: ; notranslate">
$ cap production group:task1
</pre>
<p>とか</p>
<pre class="brush: plain; title: ; notranslate">
$ cap test group:task1
</pre>
<p>のように呼び出す。
</p></div>
<h3 class="entry-section-header">引数を受け取る</h3>
<div class="section">
たまに、外部から引数を受け取りたい時がある。</p>
<p>例えば、Capistrano実行サーバにあるファイルを各サーバへscpしたい時は、</p>
<pre class="brush: ruby; title: ; notranslate">
namespace :fileup do
  task :upload_txt, :roles =&gt; :web do
    upload filename, '/tmp', :via =&gt; :scp
  end
end
</pre>
<p>というレシピを書いて、</p>
<pre class="brush: plain; title: ; notranslate">
$ cap test -S filename=/tmp/text.txt fileup:upload_txt
</pre>
<p>と呼び出す。
</p></div>
<h3 class="entry-section-header">シェルスクリプトからCapistranoを呼ぶ</h3>
<div class="section">
cronなどにシェルを登録して、内部でCapistranoを実行したい。</p>
<p>そんな時の例。</p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/sh
CAP_HOME=&quot;/home/user/cap&quot;
CAP=&quot;/usr/local/bin/ruby /usr/local/bin/cap&quot;

cd $CAP_HOME
$CAP production group:task1
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.heartofsword.net/archives/847/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/archives/847" />
	</item>
		<item>
		<title>Apacheを使ったリバースプロキシ</title>
		<link>http://blog.heartofsword.net/archives/846</link>
		<comments>http://blog.heartofsword.net/archives/846#comments</comments>
		<pubDate>Sat, 17 Sep 2011 07:04:59 +0000</pubDate>
		<dc:creator>タカ</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://blog.heartofsword.net/?p=846</guid>
		<description><![CDATA[目次 構成 以下のような構成の想定。 ドメインはexample.com 同一サーバ内 画像, CSS, JavaScriptはリバースプロキシ側で担当 それ以外はAPサーバ サーバ ポート インストール先 リバースプロキ [...]]]></description>
			<content:encoded><![CDATA[<p>目次<br />
<!--TOC--></p>
<hr />
<h3 class="entry-section-header">構成</h3>
<div class="section">
以下のような構成の想定。</p>
<ul class="index">
<li>ドメインはexample.com</li>
<li>同一サーバ内</li>
<li>画像, CSS, JavaScriptはリバースプロキシ側で担当</li>
<li>それ以外はAPサーバ</li>
</ul>
<table class="style_table" cellspacing="1" border="0">
<tr>
<th class="style_th">サーバ</th>
<th class="style_th">ポート</th>
<th class="style_th">インストール先</th>
</tr>
<tr>
<td class="style_td">リバースプロキシ</td>
<td class="style_td">80</td>
<td class="style_td">/usr/local/apache_proxy</td>
</tr>
<tr>
<td class="style_td">APサーバ</td>
<td class="style_td">20080</td>
<td class="style_td">/usr/local/apache</td>
</tr>
</table>
</div>
<h3 class="entry-section-header">インストール【APサーバ】</h3>
<div class="section">
以下のモジュールが入っていない場合は、追加でインストールする。</p>
<p>アクセスしてきたユーザのIPをAPサーバ側へ渡すモジュール。</p>
<p>IPベースでアクセス制限をかける場合とかに必要になる。</p>
<div class="notice">mod_extract_forwarded</div>
<p>下記のサイトからダウンロードする。<br />
<a href="http://www.openinfo.co.uk/apache/index.html">http://www.openinfo.co.uk/apache/index.html</a></p>
<pre class="brush: plain; title: ; notranslate">
# cd /usr/local/src
# tar -zxvf extract_forwarded-2.0.2.tar.gz
# cd extract_forwarded/
# /usr/local/apache/bin/apxs -c -i -a mod_extract_forwarded.c
</pre>
</div>
<h3 class="entry-section-header">インストール【リバースプロキシ】</h3>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
# cd /usr/local/src
# tar zxf httpd-2.2.14.tar.gz
# cd httpd-2.2.14
# ./configure --prefix=/usr/local/apache_proxy \
 --with-mpm=worker \
 --enable-mods-shared=all \
 --enable-proxy \
 --enable-cache \
 --enable-mem-cache \
 --enable-disk-cache \
 --with-suexec-caller=www \
 --with-expat=builtin
# make
# make install
</pre>
</div>
<h3 class="entry-section-header">設定【リバースプロキシ】</h3>
<div class="section">
リバースプロキシ側の設定をする。</p>
<div class="notice">/usr/local/apache_proxy/conf/httpd.conf</div>
<pre class="brush: plain; title: ; notranslate">
ServerRoot &quot;/usr/local/apache_proxy&quot;
Listen 80

User www
Group www

LoadModule setenvif_module modules/mod_setenvif.so
LoadModule mime_module modules/mod_mime.so
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule vhost_alias_module modules/mod_vhost_alias.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule dir_module modules/mod_dir.so

&lt;IfModule worker.c&gt;
StartServers         2
ServerLimit         16
ThreadLimit         64
MaxClients         512
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     32
MaxRequestsPerChild  0
&lt;/IfModule&gt;

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5

ServerAdmin admin@example.com

DocumentRoot &quot;/usr/local/apache_proxy/htdocs&quot;

ErrorLog &quot;logs/error_log&quot;
LogLevel warn

LogFormat &quot;%h %l %u %t \&quot;%r\&quot; %&gt;s %b \&quot;%{Referer}i\&quot; \&quot;%{User-Agent}i\&quot;&quot; combined
LogFormat &quot;%h %l %u %t \&quot;%r\&quot; %&gt;s %b&quot; common
LogFormat &quot;%{Referer}i -&gt; %U&quot; referer
LogFormat &quot;%{User-agent}i&quot; agent

CustomLog &quot;logs/access_log&quot; common

DirectoryIndex index.html

Include conf/extra/httpd-vhosts.conf
</pre>
<div class="notice">/usr/local/apache_proxy/conf/extra/httpd-vhosts.conf</div>
<pre class="brush: plain; title: ; notranslate">
NameVirtualHost *

&lt;VirtualHost *&gt;
  ServerName example.com

  SetEnvIfNoCase Request_URI &quot;^/(img|css|js)&quot; nolog
  SetEnvIfNoCase Request_URI &quot;^/favicon.ico&quot; nolog

  DocumentRoot /var/www/html

  RewriteEngine On
  RewriteRule ^/(img|css|js)/ - [L]
  RewriteRule ^/(.*) http://localhost:20080/$1 [P,L,QSA]
  ProxyRequests Off
  ProxyPreserveHost On
  ProxyPassReverse / http://localhost:20080/
&lt;/VirtualHost&gt;
</pre>
</div>
<h3 class="entry-section-header">設定【APサーバ】</h3>
<div class="section">
<div class="notice">/usr/local/apache/conf/httpd.conf</div>
<pre class="brush: plain; title: ; notranslate">
#Listen 80
Listen 20080

#KeepAlive On
KeepAlive Off

LoadModule extract_forwarded_module modules/mod_extract_forwarded.so

MEForder refuse,accept
MEFrefuse all
MEFaccept 192.0.2.1
MEFaccept 127.0.0.1
</pre>
<p>192.0.2.1の部分は、リバースプロキシのグローバルIPに置き換える。
</p></div>
<h3 class="entry-section-header">再起動</h3>
<div class="section">
リバースプロキシ・APサーバのApacheを再起動すれば変更完了。
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.heartofsword.net/archives/846/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/archives/846" />
	</item>
		<item>
		<title>転職しました</title>
		<link>http://blog.heartofsword.net/archives/843</link>
		<comments>http://blog.heartofsword.net/archives/843#comments</comments>
		<pubDate>Thu, 30 Jun 2011 16:33:26 +0000</pubDate>
		<dc:creator>タカ</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://blog.heartofsword.net/?p=843</guid>
		<description><![CDATA[本日、7月1日よりミツバチワークスという会社で働く事となりました。 デコログというブログサービスを運営してます。 65億PVという国内のブログではトップレベルの規模のサービスです。 アーキテクチャや負荷との戦いなど得る物 [...]]]></description>
			<content:encoded><![CDATA[<p>本日、7月1日よりミツバチワークスという会社で働く事となりました。</p>
<p>デコログというブログサービスを運営してます。</p>
<p>65億PVという国内のブログではトップレベルの規模のサービスです。</p>
<p>アーキテクチャや負荷との戦いなど得る物が多そうだなぁと感じてます。</p>
<p>とても刺激的な人達と働けそうでワクワクしてます！</p>
<p>でも、俺はそのデコログすら超えるようなサービスをいつか作ってやる！と思ってます！</p>
<p>そんなこんなで、これからもWEBの業界で頑張っていきまーす。</p>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.heartofsword.net/archives/843/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/archives/843" />
	</item>
		<item>
		<title>退職時に頂いた餞別</title>
		<link>http://blog.heartofsword.net/archives/840</link>
		<comments>http://blog.heartofsword.net/archives/840#comments</comments>
		<pubDate>Sun, 12 Jun 2011 06:09:40 +0000</pubDate>
		<dc:creator>タカ</dc:creator>
				<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://blog.heartofsword.net/?p=840</guid>
		<description><![CDATA[色々と頂いたのでご報告とお礼を兼ねてのエントリ。 ScanSnap S1100 FUJITSU ScanSnap S1100 FI-S1100 富士通 2010-11-22 売り上げランキング : 255 Amazonで [...]]]></description>
			<content:encoded><![CDATA[<p>色々と頂いたのでご報告とお礼を兼ねてのエントリ。</p>
<h3 class="entry-section-header">ScanSnap S1100</h3>
<div class="section">
<p><a href="http://www.amazon.co.jp/%E5%AF%8C%E5%A3%AB%E9%80%9A-FI-S1100-FUJITSU-ScanSnap-S1100/dp/B004COKSSE%3FSubscriptionId%3D15SMZCTB9V8NGR2TW082%26tag%3Dotaka0125-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB004COKSSE" target="_blank">FUJITSU ScanSnap S1100 FI-S1100</a><img src="http://www.assoc-amazon.jp/e/ir?t=otaka0125-22&#038;l=ur2&#038;o=9" width="1" height="1" style="border: none;" alt="" /></p>
<p><a href="http://www.amazon.co.jp/%E5%AF%8C%E5%A3%AB%E9%80%9A-FI-S1100-FUJITSU-ScanSnap-S1100/dp/B004COKSSE%3FSubscriptionId%3D15SMZCTB9V8NGR2TW082%26tag%3Dotaka0125-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB004COKSSE" target="_blank"><img src="http://ecx.images-amazon.com/images/I/31JmkRNwXCL._SL160_.jpg" border="0" alt="B004COKSSE" /></a><br />
<font size="-1">富士通  2010-11-22<br />
売り上げランキング : 255</p>
<p><a href="http://www.amazon.co.jp/%E5%AF%8C%E5%A3%AB%E9%80%9A-FI-S1100-FUJITSU-ScanSnap-S1100/dp/B004COKSSE%3FSubscriptionId%3D15SMZCTB9V8NGR2TW082%26tag%3Dotaka0125-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3DB004COKSSE" target="_blank">Amazonで詳しく見る</a></font><font size="-2"> by <a href="http://www.goodpic.com/mt/aws/index.html" >G-Tools</a></font></p>
<p>↑を頂きました。</p>
<p>ひとまず、家にあった</p>
<ul>
<li>名刺</li>
<li>給与明細</li>
<li>源泉徴収票</li>
<li>取説</li>
</ul>
<p>などを、スキャンしてEvernoteへ送りました。</p>
<p>使い心地はとてもいいです！楽しくスイスイスキャンできます。</p>
<p>Windows Vista マシンよりMacBook Proからやった方が早く取り込めました。</p>
<p>Windowsマシンの方がCPUとかHDDいいはずなのに…。</p>
<p>紙の書類をPDF化して保存しておけるのはとても助かります。</p>
<p>文字列をコピー出来ることに今更感動しました(笑)</p>
<div class="notice">今後は</div>
<ol>
<li>ノートはルーズリーフにする</li>
<li>書いたらすぐにスキャンしておく</li>
<li>頂いた名刺もPDFにして取り込む</li>
<li>レシートなどは取り込むか悩み中</li>
<li>本の裁断はまだしない</li>
</ol>
<p>という感じで、運用していくつもりです。</p>
</div>
<h3 class="entry-section-header">図書カード1万円分</h3>
<div class="section">
<p>4冊本を買いました。</p>
<p>うち2冊は子供用なので省略。</p>
<p>残りの2冊は以下の通り。共に今後の仕事に役に立ちそうなものと判断して買いました。</p>
<p><a href="http://www.amazon.co.jp/%E3%82%A6%E3%82%A7%E3%83%96%E3%82%AA%E3%83%9A%E3%83%AC%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3-%E2%80%95%E3%82%B5%E3%82%A4%E3%83%88%E9%81%8B%E7%94%A8%E7%AE%A1%E7%90%86%E3%81%AE%E5%AE%9F%E8%B7%B5%E3%83%86%E3%82%AF%E3%83%8B%E3%83%83%E3%82%AF-John-Allspaw/dp/4873114934%3FSubscriptionId%3D15SMZCTB9V8NGR2TW082%26tag%3Dotaka0125-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4873114934" target="_blank">ウェブオペレーション ―サイト運用管理の実践テクニック</a><br />
John Allspaw<br />
<a href="http://www.amazon.co.jp/%E3%82%A6%E3%82%A7%E3%83%96%E3%82%AA%E3%83%9A%E3%83%AC%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3-%E2%80%95%E3%82%B5%E3%82%A4%E3%83%88%E9%81%8B%E7%94%A8%E7%AE%A1%E7%90%86%E3%81%AE%E5%AE%9F%E8%B7%B5%E3%83%86%E3%82%AF%E3%83%8B%E3%83%83%E3%82%AF-John-Allspaw/dp/4873114934%3FSubscriptionId%3D15SMZCTB9V8NGR2TW082%26tag%3Dotaka0125-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4873114934" target="_blank"><img src="http://ecx.images-amazon.com/images/I/51-ThZ6FRfL._SL160_.jpg" border="0" alt="4873114934" /></a><img src="http://www.assoc-amazon.jp/e/ir?t=otaka0125-22&#038;l=ur2&#038;o=9" width="1" height="1" style="border: none;" alt="" /></p>
<p><a href="http://www.amazon.co.jp/%E3%83%AC%E3%82%AC%E3%82%B7%E3%83%BC%E3%82%B3%E3%83%BC%E3%83%89%E6%94%B9%E5%96%84%E3%82%AC%E3%82%A4%E3%83%89-Object-Oriented-SELECTION-%E3%83%9E%E3%82%A4%E3%82%B1%E3%83%AB%E3%83%BBC%E3%83%BB%E3%83%95%E3%82%A7%E3%82%B6%E3%83%BC%E3%82%BA/dp/4798116831%3FSubscriptionId%3D15SMZCTB9V8NGR2TW082%26tag%3Dotaka0125-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4798116831" target="_blank">レガシーコード改善ガイド (Object Oriented SELECTION)</a><br />
マイケル・C・フェザーズ ウルシステムズ株式会社<br />
<a href="http://www.amazon.co.jp/%E3%83%AC%E3%82%AC%E3%82%B7%E3%83%BC%E3%82%B3%E3%83%BC%E3%83%89%E6%94%B9%E5%96%84%E3%82%AC%E3%82%A4%E3%83%89-Object-Oriented-SELECTION-%E3%83%9E%E3%82%A4%E3%82%B1%E3%83%AB%E3%83%BBC%E3%83%BB%E3%83%95%E3%82%A7%E3%82%B6%E3%83%BC%E3%82%BA/dp/4798116831%3FSubscriptionId%3D15SMZCTB9V8NGR2TW082%26tag%3Dotaka0125-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4798116831" target="_blank"><img src="http://ecx.images-amazon.com/images/I/51MtlVCi45L._SL160_.jpg" border="0" alt="4798116831" /></a><img src="http://www.assoc-amazon.jp/e/ir?t=otaka0125-22&#038;l=ur2&#038;o=9" width="1" height="1" style="border: none;" alt="" /></p>
<div class="notice">ウェブオペレーション ―サイト運用管理の実践テクニック</div>
<p>Webサイトの運用に関して書かれている本。</p>
<p>実は、この辺りは今までの経験でなんとなーくやっていた範囲。<br />
ちょっとモヤモヤした感じではあった。</p>
<p>この分野を体系だてて進められたらいいなぁという期待を込めて購入。</p>
<div class="notice">レガシーコード改善ガイド</div>
<p>これは、色々な方面より鉄板だとお墨付きの本。</p>
<p>「テストのないコード=レガシーコード」</p>
<p>こいつとの戦いは次の会社でも起こると思っている。</p>
<p>それに備えて学びたいなぁと思ったので購入。
</p></div>
<h3 class="entry-section-header">iTunes Card 1500円分</h3>
<div class="section">
これはまだ使い道決めていません。</p>
<p>iPad2とかを買った時に、アプリを買うかもしれないです。
</p></div>
<h3 class="entry-section-header">寄せ書き</h3>
<div class="section">
沢山のメッセージありがとうございます。</p>
<p>みんなの印象が割と一致していたのは面白かったです。</p>
<p>そういう意味ではきっと裏表のない人間なんですよ。俺は(笑)
</p></div>
<h3 class="entry-section-header">まとめ</h3>
<div class="section">
というわけで、退職する人間にこんな素敵な物をありがとうございます。</p>
<p>しっかりと自分に投資してさせて頂きました。
</p></div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.heartofsword.net/archives/840/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/archives/840" />
	</item>
		<item>
		<title>nginx+rvm+rails2+unicornなRedmineをCentOS 5.6上に構築</title>
		<link>http://blog.heartofsword.net/archives/838</link>
		<comments>http://blog.heartofsword.net/archives/838#comments</comments>
		<pubDate>Sun, 05 Jun 2011 03:00:48 +0000</pubDate>
		<dc:creator>タカ</dc:creator>
				<category><![CDATA[nginx]]></category>
		<category><![CDATA[Redmine]]></category>
		<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rvm]]></category>
		<category><![CDATA[unicorn]]></category>

		<guid isPermaLink="false">http://blog.heartofsword.net/?p=838</guid>
		<description><![CDATA[Redmine 1.1.3をインストールした時のまとめ。 色々とバージョン指定が多いので大変だった…。 前提条件 MySQLはすでに構築済み example.comというドメインでアクセス nginxというユーザで実行  [...]]]></description>
			<content:encoded><![CDATA[<p><!--TOC--></p>
<hr />
<p>Redmine 1.1.3をインストールした時のまとめ。</p>
<p>色々とバージョン指定が多いので大変だった…。</p>
<h3 class="entry-section-header">前提条件</h3>
<div class="section">
<ul class="index">
<li>MySQLはすでに構築済み</li>
<li>example.comというドメインでアクセス</li>
<li>nginxというユーザで実行</li>
</ul>
<p>以下、</p>
<pre class="brush: plain; title: ; notranslate">
# は rootユーザ
$ は nginxユーザ
</pre>
<p>として記述。
</p></div>
<h3 class="entry-section-header">nginxのインストール</h3>
<div class="section">
<h4 class="entry-section-header">実行用ユーザ作成</h4>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
# useradd nginx
</pre>
<p>作業が楽なので一旦nginxユーザはログイン可能にしておく。</p>
<p>全部終わったら、nologinに切り替える。
</p></div>
<h4 class="entry-section-header">インストール</h4>
<div class="section">
<div class="notice">必要なライブラリを事前にインストール</div>
<pre class="brush: plain; title: ; notranslate">
# yum install gcc openssl-devel pcre-devel zlib-devel mysql-devel
</pre>
<div class="notice">nginxダウンロード＆インストール</div>
<pre class="brush: plain; title: ; notranslate">
# cd /usr/local/src
# wget http://nginx.org/download/nginx-1.0.4.tar.gz
# tar -zxvf nginx-1.0.4.tar.gz
# cd nginx-1.0.4
# mkdir -p /usr/local/nginx-1.0.4
# ./configure --prefix=/usr/local/nginx-1.0.4 --user=nginx --group=nginx
# make
# make install
# chown -R nginx:nginx /usr/local/nginx-1.0.4
# ln -fns /usr/local/nginx-1.0.4 /usr/local/nginx
</pre>
</div>
<h4 class="entry-section-header">起動テスト</h4>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
</pre>
<p>ブラウザからアクセスしてみて、</p>
<div class="notice">Welcome to nginx!</div>
<p>と出ていればひとまずOK。</p>
<p>nginxを止める。</p>
<pre class="brush: plain; title: ; notranslate">
# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf -s stop
</pre>
</div>
</div>
<h3 class="entry-section-header">rvmのインストール</h3>
<div class="section">
nginxの実行ユーザの環境にrvmを導入する</p>
<h4 class="entry-section-header">gitインストール</h4>
<div class="section">
<p>開発する時に使うし、rvmインストールも楽になるのでgitを入れてしまう。</p>
<pre class="brush: plain; title: ; notranslate">
# cd /usr/local/src
# wget http://kernel.org/pub/software/scm/git/git-1.7.5.4.tar.bz2
# tar -jxvf git-1.7.5.4.tar.bz2
# cd git-1.7.5.4.tar.bz2
# ./configure
# make
# make install
</pre>
</div>
<h4 class="entry-section-header">rvmインストール</h4>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
# su - nginx
$ bash &lt; &lt;(curl -s https://rvm.beginrescueend.com/install/rvm)
$ echo '[[ -s &quot;$HOME/.rvm/scripts/rvm&quot; ]] &amp;&amp; . &quot;$HOME/.rvm/scripts/rvm&quot; # Load RVM function' &gt;&gt; ~/.bash_profile
$ source ~/.bash_profile
$ rvm -v

rvm 1.6.18 by Wayne E. Seguin (wayneeseguin@gmail.com) [https://rvm.beginrescueend.com/]
</pre>
<h3 class="entry-section-header">rails環境構築</h3>
<p>Redmineはrails3では動かないみたいなので、rails2の環境を作る。</p>
<p>色んなサイトを見ると結構バージョンも低めでないといけないみたい。
</p></div>
<h4 class="entry-section-header">ruby 1.8.7のインストール</h4>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
$ rvm install 1.8.7
$ rvm use 1.8.7 --default
</pre>
</div>
<h4 class="entry-section-header">RubyGems 1.4.2のインストール</h4>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
$ rvm rubygems 1.4.2
$ gem -v
1.4.2
</pre>
<p>※Errorという文字が見えたが動いているみたいなので先に進んでしまう。
</p></div>
<h4 class="entry-section-header">rails2のインストール</h4>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
$ gem install rails -v=2.3.11
</pre>
</div>
</div>
<h3 class="entry-section-header">unicornのインストール</h3>
<div class="section">
gem経由で簡単インストール。</p>
<pre class="brush: plain; title: ; notranslate">
$ gem install unicorn
</pre>
</div>
<h3 class="entry-section-header">Redmineの構築</h3>
<div class="section">
<h4 class="entry-section-header">必要なGEMの導入</h4>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
$ gem install rack -v=1.0.1
$ gem uninstall rack
</pre>
<p>1.0.1以外のrackを削除</p>
<pre class="brush: plain; title: ; notranslate">
$ gem install i18n -v=0.4.2
$ gem install mysql
</pre>
</div>
<h4 class="entry-section-header">Redmineの設置</h4>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
$ cd /home/nginx
$ wget http://rubyforge.org/frs/download.php/74722/redmine-1.1.3.tar.gz
$ tar -zxvf redmine-1.1.3.tar.gz
$ ln -fns /home/nginx/redmine-1.1.3 /home/nginx/redmine
</pre>
</div>
<h4 class="entry-section-header">設定</h4>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
$ cd /home/nginx/redmine/config
$ cp -p database.yml.example database.yml
$ cp -p email.yml.example email.yml
</pre>
<p>DB設定やメール設定は環境に合わせて変更。</p>
<p>公式ページに設定例は書いてある。</p>
<p><a href="http://blog.redmine.jp/articles/redmine-1_1-installation_centos/">http://blog.redmine.jp/articles/redmine-1_1-installation_centos/</a></p>
<p>その後、rake</p>
<pre class="brush: plain; title: ; notranslate">
$ rake generate_session_store
$ rake db:migrate RAILS_ENV=production
</pre>
</div>
<h4 class="entry-section-header">unicorn起動</h4>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
$ unicorn_rails -c config/unicorn.rb -E production -D
</pre>
</div>
</div>
<h3 class="entry-section-header">各種設定</h3>
<div class="section">
<h4 class="entry-section-header">nginx設定</h4>
<div class="section">
<div class="notice">/usr/local/nginx/conf/nginx.conf</div>
<pre class="brush: plain; title: ; notranslate">
# vim /usr/local/nginx/conf/nginx.conf
http {
…
  include /usr/local/nginx/conf.d/*.conf;
}
</pre>
<div class="notice">/usr/local/nginx/conf.d/redmine.conf</div>
<pre class="brush: plain; title: ; notranslate">
# mkdir -p /usr/local/nginx/conf.d
# vim /usr/local/nginx/conf.d/redmine.conf

upstream unicorn {
  server unix:/tmp/.unicorn.sock;
}

server {
  listen 80;
  server_name example.com;
  root /home/nginx/redmine/public;
  access_log logs/example.com.access_log;
  error_log logs/example.com.error_log;

  location / {
    if (-f $request_filename) { break; }
    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $http_host;
    proxy_pass http://unicorn;
  }
}

# chown -R nginx:nginx /usr/local/nginx/conf.d
</pre>
</div>
<h4 class="entry-section-header">Redmine向けunicorn設定</h4>
<div class="section">
<div class="notice">/home/nginx/redmine/config/unicorn.rb</div>
<pre class="brush: plain; title: ; notranslate">
worker_processes 2

listen '/tmp/.unicorn.sock'

stderr_path File.expand_path('log/unicorn.log', ENV['RAILS_ROOT'])
stdout_path File.expand_path('log/unicorn.log', ENV['RAILS_ROOT'])

preload_app true

before_fork do |server, worker|
  defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!

  old_pid = &amp;quot;#{ server.config[:pid] }.oldbin&amp;quot;
  unless old_pid == server.pid
    begin
      Process.kill :QUIT, File.read(old_pid).to_i
    rescue Errno::ENOENT, Errno::ESRCH
    end
  end
end

after_fork do |server, worker|
  defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
end
</pre>
<div class="notice">参考</div>
<p><a href="http://d.hatena.ne.jp/milk1000cc/20100804/1280893810">http://d.hatena.ne.jp/milk1000cc/20100804/1280893810</a></p>
<p><a href="http://www.bpsinc.jp/blog/archives/2208">http://www.bpsinc.jp/blog/archives/2208</a>
</div>
</div>
<h3 class="entry-section-header">nginx起動＆確認</h3>
<div class="section">
<pre class="brush: plain; title: ; notranslate">
# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
</pre>
<p>その後、http://example.com にアクセスして動いていれば終わり。</p>
<p>動いていない場合は、</p>
<div class="">/home/nginx/redmine/log</div>
<p>にログファイルができるので確認してみましょう。
</p></div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.heartofsword.net/archives/838/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/archives/838" />
	</item>
		<item>
		<title>退職の意志を伝える前にするべき3つのこと</title>
		<link>http://blog.heartofsword.net/archives/837</link>
		<comments>http://blog.heartofsword.net/archives/837#comments</comments>
		<pubDate>Thu, 02 Jun 2011 11:08:40 +0000</pubDate>
		<dc:creator>タカ</dc:creator>
				<category><![CDATA[仕事]]></category>

		<guid isPermaLink="false">http://blog.heartofsword.net/?p=837</guid>
		<description><![CDATA[辞めようと思った時に自分の気持ちを落ち着かせる為に自分が実践した事の振り返り。 とある人に書いて欲しいと言われたので書くことに。 退職を助長する意味合いは全くありません！ 勘違いすんなよ！！ いいか！絶対だぞ！ では、ス [...]]]></description>
			<content:encoded><![CDATA[<p>辞めようと思った時に自分の気持ちを落ち着かせる為に自分が実践した事の振り返り。</p>
<p>とある人に書いて欲しいと言われたので書くことに。</p>
<p>退職を助長する意味合いは全くありません！</p>
<p>勘違いすんなよ！！<br />
いいか！絶対だぞ！</p>
<p>では、スタート！</p>
<p><!--TOC--></p>
<h3 class="entry-section-header">辞める事で自分に生じるメリットを考える</h3>
<div class="section">
退職の意志を伝えるのは結構、緊張するもの。</p>
<p>ネガティブな気持ちでぶつかっても互いに嫌な気持ちになるだけ。</p>
<p>だから、ポジティブな気持ちで心を満たそう！</p>
<ul class="index">
<li>〇〇ができる！</li>
<li>年収が上がる！</li>
<li><del>嫌いなあの人とお別れできる！</del></li>
</ul>
<p>などなど。</p>
<p>でも、口に出して良い事と悪い事は整理しておこうね！(笑)
</p></div>
<h3 class="entry-section-header">不要な書類をシュレッダーにかける</h3>
<div class="section">
ちょっと早い？？でも、以下の3つのメリットがあります。(超個人的な考え)</p>
<ol class="index">
<li>身辺整理が進むと勇気が出る</li>
<li>退職日当日に慌てないで済む<br />
結構、高い確率でシュレッダーをオーバーヒートさせてます。</li>
<li>あれ！？あの人もしかして辞めるのか…と匂わせる事ができる(笑)</li>
</ol>
<p>行動を変える事で意識を変えようという意味合いで実施しました。</p>
<p>あと、</p>
<div class="notice">名刺</div>
<p>もしっかりとシュレッダーにかけましょうね。</p>
<p>10枚くらいを並べて手動でかけるとサクサク進んで楽しいです(笑)
</p></div>
<h3 class="entry-section-header">誰かに話してみる</h3>
<div class="section">
予行練習です(笑)</p>
<p>もしかしたら、いいアドバイスがもらえるかもしれません。</p>
<p>(このタイミングだと〇〇だと思うよとか)
</p></div>
<h3 class="entry-section-header">まとめ</h3>
<div class="section">
いかがだったでしょうか？</p>
<p>退職は(疎まれていなければ…)会社側に迷惑をかける事になります。</p>
<p>せめてできる事は、</p>
<ul class="index">
<li>しっかりと引継ぎを行なう
<li>残った人達の為にできる事をする
<li>明るく立ち去る
</ul>
<p>だと思いました。</p>
<p>その為にも、自分を奮い立たせて下さいね！
</p></div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.heartofsword.net/archives/837/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/archives/837" />
	</item>
		<item>
		<title>PHPのXXXはRubyのYYYでPythonのZZZ</title>
		<link>http://blog.heartofsword.net/archives/836</link>
		<comments>http://blog.heartofsword.net/archives/836#comments</comments>
		<pubDate>Tue, 31 May 2011 11:00:18 +0000</pubDate>
		<dc:creator>タカ</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.heartofsword.net/?p=836</guid>
		<description><![CDATA[結構前に書いて下書きで眠ってた…。 せっかくなので、公開。 PHP, Ruby, Pythonの比較。 PHPで(個人的に)良く使う関数は他の言語ではどうすればいいんだろう？ という趣旨のエントリー。 ちょこちょこっとグ [...]]]></description>
			<content:encoded><![CDATA[<p>結構前に書いて下書きで眠ってた…。</p>
<p>せっかくなので、公開。</p>
<p>PHP, Ruby, Pythonの比較。</p>
<p>PHPで(個人的に)良く使う関数は他の言語ではどうすればいいんだろう？</p>
<p>という趣旨のエントリー。</p>
<p>ちょこちょこっとググったモノを使っているので、もっといいやり方をご存知の方は教えて下さい。</p>
<p><!--TOC--></p>
<hr />
<h3 class="entry-section-header">GET</h3>
<div class="section">
<div class="notice">PHP</div>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$url = 'http://google.co.jp';
$string = file_get_contents($url);
echo $string;
</pre>
<div class="notice">Ruby</div>
<pre class="brush: ruby; title: ; notranslate">
require 'open-uri'
url = 'http://google.co.jp'
results = ''open(url) {|f| results = f.read}
puts results
</pre>
<div class="notice">Python</div>
<pre class="brush: python; title: ; notranslate">
import urllib
url = 'http://google.co.jp'
d = urllib.urlopen(url)
results = d.read()
d.close()

print results
</pre>
</div>
<h3 class="entry-section-header">URL encode/decode</h3>
<div class="section">
<div class="notice">PHP</div>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$url = 'http://example.com/';
echo urlencode($url).&quot;\n&quot;;
echo urldecode(urlencode($url)).&quot;\n&quot;;
</pre>
<div class="notice">Ruby</div>
<pre class="brush: ruby; title: ; notranslate">
require 'cgi'
url = 'http://example.com/'
puts CGI::escape(url)
puts CGI::unescape(CGI::escape(url))
</pre>
<div class="notice">Python</div>
<pre class="brush: python; title: ; notranslate">
import urllib
url = 'http://example.com/'
print urllib.quote(url, '')
print urllib.unquote(urllib.quote(url, ''))
</pre>
</div>
<h3 class="entry-section-header">HTMLのescape/unescape</h3>
<div class="section">
<div class="notice">PHP</div>
<pre class="brush: php; title: ; notranslate">
&lt;?php
$html = &lt;&lt;&lt;EOD
&lt;html&gt;
&lt;body&gt;
body
&lt;/body&gt;
&lt;/html&gt;
EOD;

echo htmlspecialchars($html);
echo htmlspecialchars_decode(htmlspecialchars($html));
</pre>
<div class="notice">Ruby</div>
<pre class="brush: ruby; title: ; notranslate">
require 'cgi'

html = &lt;&lt;EOD
&lt;html&gt;
&lt;body&gt;
body
&lt;/body&gt;
&lt;/html&gt;
EOD

puts CGI.escapeHTML(html)
puts CGI.unescapeHTML(CGI.escapeHTML(html))
</pre>
<div class="notice">Python</div>
<pre class="brush: python; title: ; notranslate">
from xml.sax.saxutils import *

html = &quot;&quot;&quot;
&lt;html&gt;
&lt;body&gt;
body
&lt;/body&gt;
&lt;/html&gt;
&quot;&quot;&quot;

print escape(html)
print unescape(escape(html))
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://blog.heartofsword.net/archives/836/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://blog.heartofsword.net/archives/836" />
	</item>
	</channel>
</rss>

