<?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>きぬろぐ &#187; プログラム</title>
	<atom:link href="http://www.kinusati.net/category/computer/%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kinusati.net</link>
	<description>だめでつれづれな日記</description>
	<lastBuildDate>Sun, 15 Jan 2012 23:42:13 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/category/computer/%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%a0/feed/" />
		<item>
		<title>CakePHPでのキャッシュコントロール</title>
		<link>http://www.kinusati.net/2012/01/04/cakephp%e3%81%a7%e3%81%ae%e3%82%ad%e3%83%a3%e3%83%83%e3%82%b7%e3%83%a5%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab/</link>
		<comments>http://www.kinusati.net/2012/01/04/cakephp%e3%81%a7%e3%81%ae%e3%82%ad%e3%83%a3%e3%83%83%e3%82%b7%e3%83%a5%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 09:18:57 +0000</pubDate>
		<dc:creator>kinusati</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.kinusati.net/?p=1107</guid>
		<description><![CDATA[Webアプリケーションではキャッシュさせない実装が割と多いと思います。 CakePHP 1.3の場合、boforeFilter()に$this-&#62;disableCache()を追加するだけでキャッシュを無効化できる &#8230; <a href="http://www.kinusati.net/2012/01/04/cakephp%e3%81%a7%e3%81%ae%e3%82%ad%e3%83%a3%e3%83%83%e3%82%b7%e3%83%a5%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Webアプリケーションではキャッシュさせない実装が割と多いと思います。</p>
<p>CakePHP 1.3の場合、boforeFilter()に$this-&gt;disableCache()を追加するだけでキャッシュを無効化できるから楽ちんですね。ちなみにソースは以下。cake/libs/controller/controller.phpに書いてます。</p>
<pre>
function disableCache() {
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
}
</pre>
<p>Cache-Control: post-check/pre-checkの意味は<a href="http://msdn.microsoft.com/en-us/library/ms533020(v=vs.85).aspx">MSDN</a>参照。</p>
<p>Cache-Control: no-store, no-cache, must-revalidate/Pragma: no-cacheは<a href="http://www.ipa.go.jp/security/awareness/vendor/programmingv2/contents/405.html">IPA</a>参照。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kinusati.net/2012/01/04/cakephp%e3%81%a7%e3%81%ae%e3%82%ad%e3%83%a3%e3%83%83%e3%82%b7%e3%83%a5%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/2012/01/04/cakephp%e3%81%a7%e3%81%ae%e3%82%ad%e3%83%a3%e3%83%83%e3%82%b7%e3%83%a5%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab/" />
	</item>
		<item>
		<title>WordPressでのpngリサイズって対応していないの?</title>
		<link>http://www.kinusati.net/2011/09/24/wordpress%e3%81%a7%e3%81%aepng%e3%83%aa%e3%82%b5%e3%82%a4%e3%82%ba%e3%81%a3%e3%81%a6%e5%af%be%e5%bf%9c%e3%81%97%e3%81%a6%e3%81%84%e3%81%aa%e3%81%84%e3%81%ae/</link>
		<comments>http://www.kinusati.net/2011/09/24/wordpress%e3%81%a7%e3%81%aepng%e3%83%aa%e3%82%b5%e3%82%a4%e3%82%ba%e3%81%a3%e3%81%a6%e5%af%be%e5%bf%9c%e3%81%97%e3%81%a6%e3%81%84%e3%81%aa%e3%81%84%e3%81%ae/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 14:36:40 +0000</pubDate>
		<dc:creator>kinusati</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[未分類]]></category>

		<guid isPermaLink="false">http://www.kinusati.net/?p=1060</guid>
		<description><![CDATA[pngのスクリーンショットをWindows Live Writerから(XMLRPC経由)WordPress 3.2.1-jaに登録しようとしたら、XML-RPCで登録できないというエラーが・・・試しにpngをgifに変 &#8230; <a href="http://www.kinusati.net/2011/09/24/wordpress%e3%81%a7%e3%81%aepng%e3%83%aa%e3%82%b5%e3%82%a4%e3%82%ba%e3%81%a3%e3%81%a6%e5%af%be%e5%bf%9c%e3%81%97%e3%81%a6%e3%81%84%e3%81%aa%e3%81%84%e3%81%ae/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>pngのスクリーンショットをWindows Live Writerから(XMLRPC経由)WordPress 3.2.1-jaに登録しようとしたら、XML-RPCで登録できないというエラーが・・・試しにpngをgifに変更して登録するとうまくいく・・・</p>
<p>なぜだ？と思って調査。</p>
<p>- ./wp-includes/media.php</p>
<p>254行目のimagecreatefromstring()でApacheがabortしてた。</p>
<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:812469c5-0cb0-4c63-8c15-c81123a09de7:3e63277f-2c0d-4146-abb2-4bbcd9c7deae" class="wlWriterEditableSmartContent">
<pre name="code" class="php">    function wp_load_image( $file ) {
            if ( is_numeric( $file ) )
                    $file = get_attached_file( $file );

            if ( ! file_exists( $file ) )
                    return sprintf(__('File &amp;#8220;%s&amp;#8221; doesn&amp;#8217;t exist?'), $file);

            if ( ! function_exists('imagecreatefromstring') )
                    return __('The GD image library is not installed.');

            // Set artificially high because GD uses uncompressed images in memory
            @ini_set( 'memory_limit', apply_filters( 'image_memory_limit', WP_MAX_MEMORY_LIMIT ) );
            $image = imagecreatefromstring( file_get_contents( $file ) );

            if ( !is_resource( $image ) )
                    return sprintf(__('File &amp;#8220;%s&amp;#8221; is not an image.'), $file);

            return $image;
    }
</pre>
</div>
<p>GD/libpng経由でのリサイズ用png画像生成時に失敗するようだ。 こまりましたな。とりあえずgifで運用します。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kinusati.net/2011/09/24/wordpress%e3%81%a7%e3%81%aepng%e3%83%aa%e3%82%b5%e3%82%a4%e3%82%ba%e3%81%a3%e3%81%a6%e5%af%be%e5%bf%9c%e3%81%97%e3%81%a6%e3%81%84%e3%81%aa%e3%81%84%e3%81%ae/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/2011/09/24/wordpress%e3%81%a7%e3%81%aepng%e3%83%aa%e3%82%b5%e3%82%a4%e3%82%ba%e3%81%a3%e3%81%a6%e5%af%be%e5%bf%9c%e3%81%97%e3%81%a6%e3%81%84%e3%81%aa%e3%81%84%e3%81%ae/" />
	</item>
		<item>
		<title>CakePHP のquery()メソッドの動き</title>
		<link>http://www.kinusati.net/2011/09/20/cakephp-%e3%81%aequery%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e5%8b%95%e3%81%8d/</link>
		<comments>http://www.kinusati.net/2011/09/20/cakephp-%e3%81%aequery%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e5%8b%95%e3%81%8d/#comments</comments>
		<pubDate>Tue, 20 Sep 2011 08:42:43 +0000</pubDate>
		<dc:creator>kinusati</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.kinusati.net/?p=974</guid>
		<description><![CDATA[CakePHP 1.3を使っていますが、query()メソッドの動きが気になったのでメモ。 query()メソッドは、select for update等CakePHPのモデルでは提供できないSQLを発行する際によく使い &#8230; <a href="http://www.kinusati.net/2011/09/20/cakephp-%e3%81%aequery%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e5%8b%95%e3%81%8d/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>CakePHP 1.3を使っていますが、query()メソッドの動きが気になったのでメモ。</p>
<p>query()メソッドは、select for update等CakePHPのモデルでは提供できないSQLを発行する際によく使いますが、引数の渡し方によってクエリキャッシュが効く・効かないの違いがありました。</p>
<h3>クエリキャッシュ有り</h3>
<p>BIND変数を引き渡す場合で第3引数がないとクエリキャッシュが有効になってしまいます。これに気がつか無い人、結構いるのでは?</p>
<pre>$this-&gt;query('select id from user where id = ? for update', array(1));</pre>
<h3>クエリキャッシュ無し</h3>
<p>第3引数がキャッシュ利用有無になるので、falseを渡せばクエリキャッシュは効きません。</p>
<pre>$this-&gt;query('select id from user where id = ? for update', array(1), false);</pre>
<p>これ、はまりました。。</p>
<p>ちなみにdbo_source.php(CakePHP 1.3.11)だと以下の用になっています。</p>
<pre>
    351                 } else {
    352                         if (isset($args[1]) &amp;&amp; $args[1] === true) {
    353                                 return $this-&gt;fetchAll($args[0], true);
    354                         } else if (isset($args[1]) &amp;&amp; !is_array($args[1]) ) {
    355                                 return $this-&gt;fetchAll($args[0], false);
    356                         } else if (isset($args[1]) &amp;&amp; is_array($args[1])) {
    357                                 $offset = 0;
    358                                 if (isset($args[2])) {
    359                                         $cache = $args[2];
    360                                 } else {
    361                                         $cache = true;
    362                                 }
    363                                 $args[1] = array_map(array(&amp;$this, 'value'), $args[1]);
    364                                 return $this-&gt;fetchAll(String::insert($args[0], $args[1]), $cache);
    365                         }
    366                 }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kinusati.net/2011/09/20/cakephp-%e3%81%aequery%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e5%8b%95%e3%81%8d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/2011/09/20/cakephp-%e3%81%aequery%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89%e3%81%ae%e5%8b%95%e3%81%8d/" />
	</item>
		<item>
		<title>Pythonの整形ツール</title>
		<link>http://www.kinusati.net/2011/02/14/python%e3%81%ae%e6%95%b4%e5%bd%a2%e3%83%84%e3%83%bc%e3%83%ab/</link>
		<comments>http://www.kinusati.net/2011/02/14/python%e3%81%ae%e6%95%b4%e5%bd%a2%e3%83%84%e3%83%bc%e3%83%ab/#comments</comments>
		<pubDate>Mon, 14 Feb 2011 12:38:33 +0000</pubDate>
		<dc:creator>kinusati</dc:creator>
				<category><![CDATA[プログラム]]></category>

		<guid isPermaLink="false">http://www.kinusati.net/?p=946</guid>
		<description><![CDATA[PythonにPerltidyと同じような整形ツールがないかと探してみましたが、ありました。 Pythontidy 試しに使ってみましたが、きれいになりました。便利なツールですね。]]></description>
			<content:encoded><![CDATA[<p>PythonにPerltidyと同じような整形ツールがないかと探してみましたが、ありました。</p>
<p><a href="http://pypi.python.org/pypi/PythonTidy/">Pythontidy</a></p>
<p>試しに使ってみましたが、きれいになりました。便利なツールですね。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kinusati.net/2011/02/14/python%e3%81%ae%e6%95%b4%e5%bd%a2%e3%83%84%e3%83%bc%e3%83%ab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/2011/02/14/python%e3%81%ae%e6%95%b4%e5%bd%a2%e3%83%84%e3%83%bc%e3%83%ab/" />
	</item>
		<item>
		<title>JAVAの逆コンパイラ「JD」</title>
		<link>http://www.kinusati.net/2011/02/05/java%e3%81%ae%e9%80%86%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%a9%e3%80%8cjd%e3%80%8d/</link>
		<comments>http://www.kinusati.net/2011/02/05/java%e3%81%ae%e9%80%86%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%a9%e3%80%8cjd%e3%80%8d/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 02:57:15 +0000</pubDate>
		<dc:creator>kinusati</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.kinusati.net/?p=934</guid>
		<description><![CDATA[JAVAの逆コンパイラに「JD」というものがあります。 JDにはJD-GUIというものと、JD-ECLISPEという二つが存在しており、JD-IDEは逆コンパイラのGUI版、JD-ECLIPSEはECLIPSE上で動作す &#8230; <a href="http://www.kinusati.net/2011/02/05/java%e3%81%ae%e9%80%86%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%a9%e3%80%8cjd%e3%80%8d/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>JAVAの逆コンパイラに「<a href="http://java.decompiler.free.fr/">JD</a>」というものがあります。</p>
<p>JDには<a href="http://java.decompiler.free.fr/?q=jdgui">JD-GUI</a>というものと、<a href="http://java.decompiler.free.fr/?q=jdeclipse">JD-ECLISPE</a>という二つが存在しており、JD-IDEは逆コンパイラのGUI版、JD-ECLIPSEはECLIPSE上で動作するJDということになります。</p>
<p>ついこの間、ソースファイルの所在が不明となったJARファイルがあったので、JD-GUIを使って逆コンパイルしてみましたが、びっくりしました！JARファイルを与えたらあっという間に逆コンパイルが完了し、その結果をjavaファイルで出力できるという優れもので・・・</p>
<p><a href="http://www.kinusati.net/wp-content/uploads/2011/02/jdide-1.png"><img src="http://www.kinusati.net/wp-content/uploads/2011/02/jdide-1.png" title="jdide-1" width="344" height="251" class="alignnone size-full wp-image-935" /></a></p>
<p><a href="http://www.kinusati.net/wp-content/uploads/2011/02/vim-1.png"><img src="http://www.kinusati.net/wp-content/uploads/2011/02/vim-1.png" title="vim-1" width="509" height="217" class="alignnone size-full wp-image-936" /></a></p>
<p>できあがったjavaファイルは、コメントアウトされて出力されますが、このコメントアウト部分をsed等で切り抜けばソースに早変わりします。</p>
<p>便利ですな。</p>
<p>なおライセンスで逆コンパイルが禁止されている場合もあるので、ご利用時はご注意ください。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kinusati.net/2011/02/05/java%e3%81%ae%e9%80%86%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%a9%e3%80%8cjd%e3%80%8d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/2011/02/05/java%e3%81%ae%e9%80%86%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%a9%e3%80%8cjd%e3%80%8d/" />
	</item>
		<item>
		<title>antでのProxy設定メモ</title>
		<link>http://www.kinusati.net/2010/09/07/ant%e3%81%a7%e3%81%aeproxy%e8%a8%ad%e5%ae%9a%e3%83%a1%e3%83%a2/</link>
		<comments>http://www.kinusati.net/2010/09/07/ant%e3%81%a7%e3%81%aeproxy%e8%a8%ad%e5%ae%9a%e3%83%a1%e3%83%a2/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 00:14:00 +0000</pubDate>
		<dc:creator>kinusati</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.kinusati.net/?p=821</guid>
		<description><![CDATA[Proxy配下で直接外部に接続できない環境下でantを利用してjarのダウンロードを行うためのメモ。 http://ant.apache.org/manual/proxy.html jmeterのソースファイルをビルドす &#8230; <a href="http://www.kinusati.net/2010/09/07/ant%e3%81%a7%e3%81%aeproxy%e8%a8%ad%e5%ae%9a%e3%83%a1%e3%83%a2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Proxy配下で直接外部に接続できない環境下でantを利用してjarのダウンロードを行うためのメモ。</p>
<blockquote><p><a href="http://ant.apache.org/manual/proxy.html">http://ant.apache.org/manual/proxy.html</a></p></blockquote>
<p>jmeterのソースファイルをビルドする際にant download_jarsが通るようになりました。楽ちん楽ちん。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kinusati.net/2010/09/07/ant%e3%81%a7%e3%81%aeproxy%e8%a8%ad%e5%ae%9a%e3%83%a1%e3%83%a2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/2010/09/07/ant%e3%81%a7%e3%81%aeproxy%e8%a8%ad%e5%ae%9a%e3%83%a1%e3%83%a2/" />
	</item>
		<item>
		<title>Javaの逆コンパイラ &#8220;jad&#8221;</title>
		<link>http://www.kinusati.net/2010/08/19/java%e3%81%ae%e9%80%86%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%a9-jad/</link>
		<comments>http://www.kinusati.net/2010/08/19/java%e3%81%ae%e9%80%86%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%a9-jad/#comments</comments>
		<pubDate>Wed, 18 Aug 2010 21:41:22 +0000</pubDate>
		<dc:creator>kinusati</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.kinusati.net/?p=810</guid>
		<description><![CDATA[以前作成したJARファイルの中身が待ったくわからなかったのでjadを利用してclassファイルから逆コンパイルしたのですが、あまりの簡単さ、およびソースコードのきれいさにびっくりしました。こんな便利なツールが普通に使える &#8230; <a href="http://www.kinusati.net/2010/08/19/java%e3%81%ae%e9%80%86%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%a9-jad/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>以前作成したJARファイルの中身が待ったくわからなかったのでjadを利用してclassファイルから逆コンパイルしたのですが、あまりの簡単さ、およびソースコードのきれいさにびっくりしました。こんな便利なツールが普通に使えるって感動ですな。と今更ですが。。。</p>
<p>JADについては以下のページがよくまとまっています。</p>
<ul>
<li><a href="http://d.hatena.ne.jp/tanamon/20090613/1244907632">tanamonの日記</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.kinusati.net/2010/08/19/java%e3%81%ae%e9%80%86%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%a9-jad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/2010/08/19/java%e3%81%ae%e9%80%86%e3%82%b3%e3%83%b3%e3%83%91%e3%82%a4%e3%83%a9-jad/" />
	</item>
		<item>
		<title>jmap/jhatについて</title>
		<link>http://www.kinusati.net/2010/08/08/jmapjhat%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/</link>
		<comments>http://www.kinusati.net/2010/08/08/jmapjhat%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/#comments</comments>
		<pubDate>Sun, 08 Aug 2010 03:02:14 +0000</pubDate>
		<dc:creator>kinusati</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.kinusati.net/?p=793</guid>
		<description><![CDATA[Javaでメモリリークを調査するため、hprofを利用してメモリプロファイルを行うことがある。 「Java SE 6完全攻略」 第5回　プロファイラ hprofとよき相棒 jhat hprofはJVMの起動オプションを指 &#8230; <a href="http://www.kinusati.net/2010/08/08/jmapjhat%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Javaでメモリリークを調査するため、hprofを利用してメモリプロファイルを行うことがある。</p>
<ul>
<li><a href="http://itpro.nikkeibp.co.jp/article/COLUMN/20061102/252525/">「Java SE 6完全攻略」 第5回　プロファイラ hprofとよき相棒 jhat</a></li>
</ul>
<p>hprofはJVMの起動オプションを指定してプロファイルをとる代物であるが、若干もさっとするし、何よりよく落ちる・・・Tomcatを起動していたらTomcatもろとも道連れになり実用に耐えません・・・</p>
<pre>
HPROF ERROR: Cannot allocate malloc memory [hprof_util.c:160]
HPROF TERMINATED PROCESS
</pre>
<p>これでは使い物にならんと思って調べていたら、jmapというツールが存在することを発見。jmapはJVMのPIDを指定することでヒープデータを取得することが可能なツール。これを使えば↑の用にhprofが落ちて困ることは回避可能となる。jmapはJDKに付属している(JREには付属していない)。以下使い方。</p>
<pre>
# jmap -dump:format=b,file=&lt;ダンプファイル&gt; &lt;pid&gt;
</pre>
<p>heapダンプを取得後は、jhatで解析。jhatについては<a href="http://itpro.nikkeibp.co.jp/article/COLUMN/20061102/252525/">「Java SE 6完全攻略」 第5回　プロファイラ hprofとよき相棒 jhat</a>の説明が詳しいので割愛するが、heapダンプサイズが大きい場合、java.lang.OutOfMemoryError: Java heap spaceが出ます。。heapサイズを調整して起動すればいいんですけどね。</p>
<pre>
# jhat -J-Xmx1024m &lt;ダンプファイル&gt;
</pre>
<p>なれてくるとJavaって便利ですね。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kinusati.net/2010/08/08/jmapjhat%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/2010/08/08/jmapjhat%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6/" />
	</item>
		<item>
		<title>Struts2でcodebehindからConventionに変更</title>
		<link>http://www.kinusati.net/2010/07/25/struts2%e3%81%a7codebehind%e3%81%8b%e3%82%89convention%e3%81%ab%e5%a4%89%e6%9b%b4/</link>
		<comments>http://www.kinusati.net/2010/07/25/struts2%e3%81%a7codebehind%e3%81%8b%e3%82%89convention%e3%81%ab%e5%a4%89%e6%9b%b4/#comments</comments>
		<pubDate>Sun, 25 Jul 2010 10:57:59 +0000</pubDate>
		<dc:creator>kinusati</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.kinusati.net/?p=781</guid>
		<description><![CDATA[Struts 2.1.8でcodebehindを利用してコードを書いていたのだが、Action評価後にリダイレクトさせるやり方がわからなかった。 どのページを見ても出来るようなことは書いてますが、どうやってもうまくいかな &#8230; <a href="http://www.kinusati.net/2010/07/25/struts2%e3%81%a7codebehind%e3%81%8b%e3%82%89convention%e3%81%ab%e5%a4%89%e6%9b%b4/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Struts 2.1.8でcodebehindを利用してコードを書いていたのだが、Action評価後にリダイレクトさせるやり方がわからなかった。</p>
<p>どのページを見ても出来るようなことは書いてますが、どうやってもうまくいかない・・。</p>
<p>理由は結局わからなかったのですが、調査していて気がついたのは「Struts 2.1系からcodebehindプラグインはdeprecate」ですという事実。</p>
<p>これはまずいと思って、Conventionプラグインを利用する用に変更しました。変更方法は<a href="http://struts.apache.org/2.x/docs/converting-application-from-codebehind-to-convention-plugin.html">このページ</a>によくまとまっています。</p>
<p>一番注意が必要な点は「Action名からリクエストに変換するルールが異なる」と言うこと。結局JSP側も修正しましたよ。ふぅ。</p>
<pre>
<pre>
Previously in Codebehind:
Given an action named AnExampleAction, a request to /anExample -&gt; AnExampleAction.execute() -&gt; &gt; anExample-index.ftl
Now in Convention:
Given an action named AnExampleAction, a request to /an-example -&gt; AnExampleAction.execute() -&gt; an-example-index.ftl
</pre>
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kinusati.net/2010/07/25/struts2%e3%81%a7codebehind%e3%81%8b%e3%82%89convention%e3%81%ab%e5%a4%89%e6%9b%b4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/2010/07/25/struts2%e3%81%a7codebehind%e3%81%8b%e3%82%89convention%e3%81%ab%e5%a4%89%e6%9b%b4/" />
	</item>
		<item>
		<title>Javaのheap設定&amp;調査コマンドメモ</title>
		<link>http://www.kinusati.net/2010/07/22/java%e3%81%aeheap%e8%a8%ad%e5%ae%9a%e8%aa%bf%e6%9f%bb%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a1%e3%83%a2/</link>
		<comments>http://www.kinusati.net/2010/07/22/java%e3%81%aeheap%e8%a8%ad%e5%ae%9a%e8%aa%bf%e6%9f%bb%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a1%e3%83%a2/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 21:23:34 +0000</pubDate>
		<dc:creator>kinusati</dc:creator>
				<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.kinusati.net/?p=776</guid>
		<description><![CDATA[コマンドメモです。 -Xrunhprof:heap=sites -verbose:gc -XX:+PrintGCDetails -XX:-PrintTenuringDistribution -XX:+PrintHeapA &#8230; <a href="http://www.kinusati.net/2010/07/22/java%e3%81%aeheap%e8%a8%ad%e5%ae%9a%e8%aa%bf%e6%9f%bb%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a1%e3%83%a2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>コマンドメモです。</p>
<pre>
-Xrunhprof:heap=sites -verbose:gc -XX:+PrintGCDetails -XX:-PrintTenuringDistribution -XX:+PrintHeapAtGC -Xms1024m -Xmx1024m  -XX:PermSize=128m -XX:MaxPermSize=128m
</pre>
<p><span id="more-776"></span></p>
<p>2010/08/08追記)</p>
<p>上記のオプションだと動きが遅いので以下オプション+必要時にjmapでheapダンプをとる方向に変更。</p>
<pre>
-verbose:gc -XX:+PrintGCDetails -XX:-PrintTenuringDistribution -XX:+PrintHeapAtGC -Xms1024m -Xmx1024m  -XX:PermSize=128m -XX:MaxPermSize=128m
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kinusati.net/2010/07/22/java%e3%81%aeheap%e8%a8%ad%e5%ae%9a%e8%aa%bf%e6%9f%bb%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a1%e3%83%a2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://www.kinusati.net/2010/07/22/java%e3%81%aeheap%e8%a8%ad%e5%ae%9a%e8%aa%bf%e6%9f%bb%e3%82%b3%e3%83%9e%e3%83%b3%e3%83%89%e3%83%a1%e3%83%a2/" />
	</item>
	</channel>
</rss>

