<?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/"
	>

<channel>
	<title>akky's log</title>
	<atom:link href="http://www.akky.org/feed" rel="self" type="application/rss+xml" />
	<link>http://www.akky.org</link>
	<description>akky's dayly log</description>
	<pubDate>Sat, 09 May 2009 02:20:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iGoogleっぽいことをやるには その2</title>
		<link>http://www.akky.org/archives/94</link>
		<comments>http://www.akky.org/archives/94#comments</comments>
		<pubDate>Mon, 30 Mar 2009 11:24:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.akky.org/?p=94</guid>
		<description><![CDATA[前回の続きです。

ウィジェットを識別

Xilinus.Portalのserialize()メソッドでウィジェットの並びを得ることができるのが判ったが、ウィジェットを識別するために、どうやって識別するための情報を付与する方法をです。すばり、書いてしまうとXilinus.Widgetのコンストラクタの第2引数にdivタグのid属性を指定できます。例えば下の例だとwidget-1_0としています。ちなみに、第1引数はdivタグのclass属性です。

PLAIN TEXT
PHP:




portal.add&#40;new Xilinus.Widget&#40;null,'widget-1_0'&#41;.setTitle&#40;"Widget #1.0"&#41;.setContent&#40;latin1&#41;, 0&#41;; 






コンストラクタの引数を省略した場合の振る舞いについては、portal.jsを見るとclass属性は一律widget、id属性はwidget_連番でした。これを使って、DBなどにある情報と画面にでているウィジェットを対応付けることができますね。
]]></description>
			<content:encoded><![CDATA[<p>前回の続きです。
</p>
<h4>ウィジェットを識別</h4>
<p>
Xilinus.Portalのserialize()メソッドでウィジェットの並びを得ることができるのが判ったが、ウィジェットを識別するために、どうやって識別するための情報を付与する方法をです。すばり、書いてしまうと<em>Xilinus.Widget</em>のコンストラクタの第2引数にdivタグのid属性を指定できます。例えば下の例だと<strong>widget-1_0</strong>としています。ちなみに、第1引数はdivタグのclass属性です。
</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showCodeTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">portal.add<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">new</span> Xilinus.Widget<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000000; font-weight:bold;">null</span>,<span style="color:#FF0000;">'widget-1_0'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.setTitle<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"Widget #1.0"</span><span style="color:#006600; font-weight:bold;">&#41;</span>.setContent<span style="color:#006600; font-weight:bold;">&#40;</span>latin1<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#CC66CC;color:#800000;">0</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>コンストラクタの引数を省略した場合の振る舞いについては、portal.jsを見るとclass属性は一律<strong>widget</strong>、id属性は<strong>widget_連番</strong>でした。これを使って、DBなどにある情報と画面にでているウィジェットを対応付けることができますね。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.akky.org/archives/94/feed</wfw:commentRss>
		</item>
		<item>
		<title>iGoogleっぽいことをやるには</title>
		<link>http://www.akky.org/archives/88</link>
		<comments>http://www.akky.org/archives/88#comments</comments>
		<pubDate>Wed, 25 Mar 2009 14:08:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.akky.org/?p=88</guid>
		<description><![CDATA[
ユーザーが再配置可能なWedgetを実装するJavaScript （Prototype Portal Class）やPrototype.jsでiGoogleっぽいポータルな仕組みを作れるJSライブラリ「Xilinus」で紹介されているPrototype Portal Classなるものを使うことで、簡単にできそうな雰囲気を見せているのだが、実際にどうやってつくっていけばいいのか（たとえば、移動した状態の取得や設定らしきボタンの振る舞い）を読み取れないので、svnにあったtest/index.html(現物は本家のlive exampleです)を元にもう少し具体的な使い方に踏み込んでみたいと思います。

移動した結果を知るには

Xilinus.Portalのserialize()メソッドを実行すると、
widget_col_0[]=widget-1_0&#038;widget_col_0[]=widget-2_0&#038;widget_col_0[]=widget-1_1&#038;widget_col_0[]=widget-1_2&#038;widget_col_1[]=widget-2_1&#038;widget_col_2[]=widget-1_4&#038;
という結果を得られます。widget_col_xはウィジェットを置いている（？）横に３つ並んだdivのidです。そして、wiget-x_xは個々のウィジェットとなるdivのidです。これの解釈はwidget_col_0には上からwidget-1_0,widget-2_0,widget-1_1、widget-1_2があり、widget_col_1にはwidget-2_1だけが、widget_col_2にはwidget-1_4だけがあるというのがわかります。PHPなら$_POSTから見るとうまい具合に配列になっているはず。
それをサーバに通知するには 【ajax編】
コンストラクタでurl パラメータを用いてpost先を指定します。そうすることで、ウィジェットを移動後にAjax.UpdateでサーバにPOSTされます。
PLAIN TEXT
PHP:




portal = new Xilinus.Portal&#40;"#page div.col", &#123;onOverWidget: onOverWidget, onOutWidget: onOutWidget, onChange: onChange, onUpdate: onUpdate, url : "http://www.akky.org/xilinux/test/index.php"&#125;&#41;; 






それをサーバに通知するには【ボタン編】
グローバル変数で　portal変数を宣言しているので、onlickイベントでportal.serialzie()を実行すると値を得られます。あとは、適宜Formを用意してsubmitすることになります。
PLAIN TEXT
HTML:




　&#60;input type="button" value="serialize" onclick="alert(portal.serialize())"&#62;


&#160;


&#160; &#60;script type="text/javascript"&#62;


&#160; &#160; &#160;var portal;


/* 途中省略 */


&#160; &#160; &#160;function init() {&#160; &#160; &#160; &#160; &#160; &#160; &#160;


&#160; &#160; &#160; &#160;portal = new Xilinus.Portal(&#34;#page div.col&#34;, {onOverWidget: [...]]]></description>
			<content:encoded><![CDATA[<p>
<a href="http://youmos.com/news/prototype_portal_class">ユーザーが再配置可能なWedgetを実装するJavaScript （Prototype Portal Class）</a>や<a href="http://phpspot.org/blog/archives/2007/08/prototypejsigoo.html">Prototype.jsでiGoogleっぽいポータルな仕組みを作れるJSライブラリ「Xilinus」</a>で紹介されている<a href="http://blog.xilinus.com/2007/8/26/prototype-portal-class">Prototype Portal Class</a>なるものを使うことで、簡単にできそうな雰囲気を見せているのだが、実際にどうやってつくっていけばいいのか（たとえば、移動した状態の取得や設定らしきボタンの振る舞い）を読み取れないので、svnにあったtest/index.html(現物は本家の<a href="http://blog.xilinus.com/prototype-portal/test/index.html">live example</a>です)を元にもう少し具体的な使い方に踏み込んでみたいと思います。
</p>
<h4>移動した結果を知るには</h4>
<p>
Xilinus.Portalのserialize()メソッドを実行すると、</p>
<blockquote><p>widget_col_0[]=widget-1_0&#038;widget_col_0[]=widget-2_0&#038;widget_col_0[]=widget-1_1&#038;widget_col_0[]=widget-1_2&#038;widget_col_1[]=widget-2_1&#038;widget_col_2[]=widget-1_4&#038;</p></blockquote>
<p>という結果を得られます。<em>widget_col_x</em>はウィジェットを置いている（？）横に３つ並んだdivのidです。そして、<em>wiget-x_x</em>は個々のウィジェットとなるdivのidです。これの解釈はwidget_col_0には上からwidget-1_0,widget-2_0,widget-1_1、widget-1_2があり、widget_col_1にはwidget-2_1だけが、widget_col_2にはwidget-1_4だけがあるというのがわかります。PHPなら$_POSTから見るとうまい具合に配列になっているはず。</p>
<h4>それをサーバに通知するには 【ajax編】</h4>
<p>コンストラクタでurl パラメータを用いてpost先を指定します。そうすることで、ウィジェットを移動後にAjax.UpdateでサーバにPOSTされます。</p>
<div class="igBar"><span id="lphp-5"><a href="#" onclick="javascript:showCodeTxt('php-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-5">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">portal = <span style="color:#000000; font-weight:bold;">new</span> Xilinus.Portal<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">"#page div.col"</span>, <span style="color:#006600; font-weight:bold;">&#123;</span>onOverWidget: onOverWidget, onOutWidget: onOutWidget, onChange: onChange, onUpdate: onUpdate, url : <span style="color:#FF0000;">"http://www.akky.org/xilinux/test/index.php"</span><span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h4>それをサーバに通知するには【ボタン編】</h4>
<p>グローバル変数で　portal変数を宣言しているので、onlickイベントでportal.serialzie()を実行すると値を得られます。あとは、適宜Formを用意してsubmitすることになります。</p>
<div class="igBar"><span id="lhtml-6"><a href="#" onclick="javascript:showCodeTxt('html-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-6">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">　<span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"button"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"serialize"</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">"alert(portal.serialize())"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"text/javascript"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;var portal;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/* 途中省略 */</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;function init() {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;portal = new Xilinus.Portal(&quot;#page div.col&quot;, {onOverWidget: onOverWidget, onOutWidget: onOutWidget, onChange: onChange, onUpdate: onUpdate, url : &quot;http://www.akky.org/xilinux/test/index.php&quot;}); </div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;// Fake widgets</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;portal.add(new Xilinus.Widget(null,'widget-1_0').setTitle(&quot;Widget #1.0&quot;).setContent(latin1), 0);</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;portal.add(new Xilinus.Widget(null,'widget-1_1').setTitle(&quot;Widget #1.1&quot;).setContent(latin2), 0);</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;portal.add(new Xilinus.Widget(null,'widget-1_2').setTitle(&quot;Widget #1.2&quot;).setContent(latin3), 0);</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;portal.add(new Xilinus.Widget(null,'widget-2_0').setTitle(&quot;Widget #2.0&quot;).setContent(latin2 + latin3), 1);</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;portal.add(new Xilinus.Widget(null,'widget-2_1').setTitle(&quot;Widget #2.1&quot;).setContent(latin3), 1);&nbsp; &nbsp; &nbsp; </div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;portal.add(new Xilinus.Widget(null,'widget-1_4').setTitle(&quot;Widget #1.4&quot;).setContent(latin1+latin2+latin3), 2);</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;// Add controls buttons</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp;portal.addWidgetControls(&quot;control_buttons&quot;);</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;}</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp;Event.observe(window, &quot;load&quot;, init);</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
</p>
<h4>実際に動くもの</h4>
<p>
これを試してみてください<br /> <a href="http://www.akky.org/xilinux/test/index.html">http://www.akky.org/xilinux/test/index.html</a><br />
移動した後には、画面下部にserialize()結果を表示しています。他にも手を加えているので、、、続きます。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.akky.org/archives/88/feed</wfw:commentRss>
		</item>
		<item>
		<title>hiernate ハマリ道　@Table書き忘れ。</title>
		<link>http://www.akky.org/archives/81</link>
		<comments>http://www.akky.org/archives/81#comments</comments>
		<pubDate>Wed, 23 Apr 2008 07:24:43 +0000</pubDate>
		<dc:creator>akky</dc:creator>
		
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.akky.org/archives/91</guid>
		<description><![CDATA[
Criteria.list()のタイミングで結果を取得できない。第２弾


hibernate.cfg.xmlにmappingのエンティティクラスの名前を書いたけど、エンティティのソースに

@Entity
@Table(name = "テーブル名")

を書いていなかった。


log4jを使っている場合に、hibernateのログをやったら出して、下のログが出ていればマッピング情報が作られている。

Bind entity エンティティクラス名 on table テーブル名

マッピングの状態を
]]></description>
			<content:encoded><![CDATA[<p>
Criteria.list()のタイミングで結果を取得できない。第２弾
</p>
<p>
hibernate.cfg.xmlにmappingのエンティティクラスの名前を書いたけど、エンティティのソースに</p>
<blockquote><p>
@Entity<br />
@Table(name = "テーブル名")
</p></blockquote>
<p>を書いていなかった。
</p>
<p>
log4jを使っている場合に、hibernateのログをやったら出して、下のログが出ていればマッピング情報が作られている。</p>
<blockquote><p>
Bind entity エンティティクラス名 on table テーブル名
</p></blockquote>
<p>マッピングの状態を</p>
]]></content:encoded>
			<wfw:commentRss>http://www.akky.org/archives/81/feed</wfw:commentRss>
		</item>
		<item>
		<title>hiernate ハマリ道　hibernate.xfg.xmlを入れ忘れ</title>
		<link>http://www.akky.org/archives/80</link>
		<comments>http://www.akky.org/archives/80#comments</comments>
		<pubDate>Wed, 23 Apr 2008 02:22:58 +0000</pubDate>
		<dc:creator>akky</dc:creator>
		
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.akky.org/archives/90</guid>
		<description><![CDATA[
hibernate3でannotationを使ってコーディングを実施。org.hibernate.Criteria#list()を何度実行しても、空のリストが帰ってくる。DB側のログを見ると接続してはいるが、SQLを実行している形跡がない。テーブルを変えてみても駄目。


それで、別プロジェクトで作られた同じやり方をしているソースコード見ても特段の違いを感じられない。もう、こうなったらということで、一通りのソースを見ていると、hibernate.xfg.xmlを発見。これが無いからだorz。半日無駄にしてしまった。
]]></description>
			<content:encoded><![CDATA[<p>
hibernate3でannotationを使ってコーディングを実施。org.hibernate.Criteria#list()を何度実行しても、空のリストが帰ってくる。DB側のログを見ると接続してはいるが、SQLを実行している形跡がない。テーブルを変えてみても駄目。
</p>
<p>
それで、別プロジェクトで作られた同じやり方をしているソースコード見ても特段の違いを感じられない。もう、こうなったらということで、一通りのソースを見ていると、hibernate.xfg.xmlを発見。これが無いからだorz。半日無駄にしてしまった。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.akky.org/archives/80/feed</wfw:commentRss>
		</item>
		<item>
		<title>php.iniの設定を.htaccessで上書きできない</title>
		<link>http://www.akky.org/archives/79</link>
		<comments>http://www.akky.org/archives/79#comments</comments>
		<pubDate>Mon, 14 Apr 2008 08:18:30 +0000</pubDate>
		<dc:creator>akky</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.akky.org/archives/89</guid>
		<description><![CDATA[
レンタルサーバーを使っていてphp.iniの上書きをしたいときに、レンタルサーバのマニュアルに従って.htaccessを編集しても、phpinfo()で見ると設置値が反映されていない場合の対応。


display_errorsのマニュアルを見ていて知った。ini_set関数を使うことで、解決できる場合もある。
注意: display_errors は実行時にも設定可能（ini_set()  関数を用いて）ですが、スクリプトが致命的（fatal）なエラーを発生した場合は その設定は反映されません。なぜなら、要求されたアクションは 実行されなかったからです。 
ということで、文法エラー系には効かないと解釈したのだが、requireしているファイルの文法エラーはメッセージを出してくれた。set_ini()を記述しているファイルでなければ問題ないということなのだろうか。


例えばdisplay_errors を有効にしたい場合の記述はこれ。

ini_set("display_errors","On");



エラーの原因がわからないために、1日つぶしてしまった。ちなみに、PEAR.phpが無いのが原因だった。
]]></description>
			<content:encoded><![CDATA[<p>
レンタルサーバーを使っていてphp.iniの上書きをしたいときに、レンタルサーバのマニュアルに従って.htaccessを編集しても、phpinfo()で見ると設置値が反映されていない場合の対応。
</p>
<p>
<a href="http://www.php.net/manual/ja/errorfunc.configuration.php#ini.display-errors">display_errors</a>のマニュアルを見ていて知った。<a href="http://www.php.net/manual/ja/function.ini-set.php">ini_set</a>関数を使うことで、解決できる場合もある。</p>
<blockquote><p>注意: display_errors は実行時にも設定可能（ini_set()  関数を用いて）ですが、スクリプトが致命的（fatal）なエラーを発生した場合は その設定は反映されません。なぜなら、要求されたアクションは 実行されなかったからです。 </p></blockquote>
<p>ということで、文法エラー系には効かないと解釈したのだが、requireしているファイルの文法エラーはメッセージを出してくれた。set_ini()を記述しているファイルでなければ問題ないということなのだろうか。
</p>
<p>
例えばdisplay_errors を有効にしたい場合の記述はこれ。</p>
<pre class="sourceCode">
ini_set("display_errors","On");
</pre>
</p>
<p>
エラーの原因がわからないために、1日つぶしてしまった。ちなみに、PEAR.phpが無いのが原因だった。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.akky.org/archives/79/feed</wfw:commentRss>
		</item>
		<item>
		<title>webalizer-2.01-10をインストール</title>
		<link>http://www.akky.org/archives/78</link>
		<comments>http://www.akky.org/archives/78#comments</comments>
		<pubDate>Thu, 03 Apr 2008 08:32:49 +0000</pubDate>
		<dc:creator>akky</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.akky.org/archives/88</guid>
		<description><![CDATA[Fedra6にwebalizer-2.01-10をインストールした顛末です。
You must have a V1.85 compatable DB libraryっていわれる
ホスト名を逆引きしたいので
PLAIN TEXT
CODE:




./configure&#160; --with-language=japanese --enable-dns


とすると


&#91;code&#93;


&#91;root@vesalius webalizer-2.01-10&#93;# ./configure&#160; --with-language=japanese --e


nable-dns


loading cache ./config.cache


checking for gcc... &#40;cached&#41; gcc


checking whether the C compiler &#40;gcc&#160; &#41; works... yes


checking whether the C compiler &#40;gcc&#160; &#41; is a cross-compiler... no


checking whether we are using GNU C... &#40;cached&#41; yes


checking whether gcc accepts -g... &#40;cached&#41; yes


checking whether ln [...]]]></description>
			<content:encoded><![CDATA[<p>Fedra6にwebalizer-2.01-10をインストールした顛末です。</p>
<h4>You must have a V1.85 compatable DB libraryっていわれる</h4>
<p>ホスト名を逆引きしたいので</p>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showCodeTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">./configure&nbsp; --with-language=japanese --enable-dns</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">とすると</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>code<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@vesalius webalizer-<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">01</span>-<span style="color:#800000;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#93;</span># ./configure&nbsp; --with-language=japanese --e</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">nable-dns</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">loading cache ./config.<span style="">cache</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for gcc... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> gcc</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking whether the C compiler <span style="color:#006600; font-weight:bold;">&#40;</span>gcc&nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span> works... <span style="">yes</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking whether the C compiler <span style="color:#006600; font-weight:bold;">&#40;</span>gcc&nbsp; <span style="color:#006600; font-weight:bold;">&#41;</span> is a cross-compiler... <span style="">no</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking whether we are using GNU C... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking whether gcc accepts -g... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking whether ln -s works... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for a BSD compatible install... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> /usr/bin/install -c</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking how to run the C preprocessor... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> gcc -E</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking whether char is unsigned... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> no</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for dbopen... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> no</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for library containing dbopen... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> no</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">configure: warning: You must have a V1.<span style="color:#800000;color:#800000;">85</span> compatable DB library!</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">configure: warning: DNS lookup code will be disabled...</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">checking</span> for socket... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for sys/socket.<span style="">h</span>... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for main in -lnsl... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for main in -l44bsd... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> no</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for main in -lm... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for main in -lz... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for gzrewind in -lz... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for main in -lpng... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for gdImagePng in -lgd... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for gd.<span style="">h</span>... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> /usr/include</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for getopt.<span style="">h</span>... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for math.<span style="">h</span>... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> yes</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking default config dir... <span style="color:#006600; font-weight:bold;">&#40;</span>cached<span style="color:#006600; font-weight:bold;">&#41;</span> /etc</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">checking for language file... <span style="">yes</span> - japanese</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">creating ./config.<span style="">status</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">creating Makefile</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">linking ./lang/webalizer_lang.<span style="">japanese</span> to webalizer_lang.<span style="">h</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>root@vesalius webalizer-<span style="color:#800000;color:#800000;">2</span>.<span style="color:#800000;color:#800000;">01</span>-<span style="color:#800000;color:#800000;">10</span><span style="color:#006600; font-weight:bold;">&#93;</span># </div>
</li>
</ol>
</div>
</div>
</div>
<p>
ってなる。コンパイルもでき、実行もできるのだけど、<strong>DNSCache</strong>と<strong>DNSChildren</strong>の設定をしてあると</p>
<pre class="sourceCode">Warning: Invalid keyword 'DNSCache' (/etc/webalizer.conf)
Warning: Invalid keyword 'DNSChildren' (/etc/webalizer.conf)</pre>
<p>っていわれてしまい、逆引きもできていない。configure時の</p>
<pre class="sourceCode">configure: warning: You must have a V1.85 compatable DB library!
configure: warning: DNS lookup code will be disabled...</pre>
<p>の警告に起因しているみたいだ。Berkeley DBの1.85を用意せよとおっしゃる。なので、rpmから</p>
<ul>
<li>db4-devel-4.3.29-9.fc6</li>
<li>db4-4.3.29-9.fc6</li>
</ul>
<p>を入れておく</p>
<h4>Berkeley DBを使ってコンパイル</h4>
<p>rpmから入れたBerkeleyDBを使うように</p>
<pre class="sourceCode">./configure  --with-language=japanese --enable-dns --with-dblib=/usr/lib -with-db=/usr/include</pre>
<p>とすると、configure時の警告は消えるが、今後は、コンパイルが通らない</p>
<pre class="sourceCode">dns_resolv.c: In function `resolve_dns':
dns_resolv.c:149: warning: passing arg 2 of pointer to function from incompatible pointer type
dns_resolv.c:149: error: too few arguments to function
dns_resolv.c: In function `dns_resolver':
dns_resolv.c:218: warning: implicit declaration of function `dbopen'
dns_resolv.c:218: warning: assignment makes pointer from integer without a cast
dns_resolv.c:228: error: too few arguments to function
dns_resolv.c:235: error: too few arguments to function
dns_resolv.c:275: warning: passing arg 2 of pointer to function from incompatible pointer type
dns_resolv.c:275: error: too few arguments to function
dns_resolv.c:329: error: too few arguments to function
dns_resolv.c:359: error: too few arguments to function
dns_resolv.c: In function `db_put':
dns_resolv.c:745: warning: passing arg 2 of pointer to function from incompatible pointer type
dns_resolv.c:745: error: too few arguments to function
dns_resolv.c: In function `open_cache':
dns_resolv.c:793: warning: assignment makes pointer from integer without a cast
dns_resolv.c:801: error: too few arguments to function
dns_resolv.c:807: error: too few arguments to function
dns_resolv.c: In function `close_cache':
dns_resolv.c:829: error: too few arguments to function
make: *** [dns_resolv.o] Error 1</pre>
<p>引数の数が違うとな。<em>/usr/include/db.h</em>と<em>dns_resolv.c</em>を見比べるとやっぱり、引数数が合わない。むむむと、<em>dns_resolv.c</em>と睨めっこしていると</p>
<div class="igBar"><span id="lc-11"><a href="#" onclick="javascript:showCodeTxt('c-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C:</span>
<div id="c-11">
<div class="c">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ifdef HAVE_DB_185_H</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &amp;lt;db_185.h&amp;gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /* on my RH6.0 system ?!?&nbsp; &nbsp;*/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#else</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#include &amp;lt;db.h&amp;gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; /* DB header ****************/</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #339933;">#endif /* HAVE_DB_185_H */ </span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
という記述を発見。db_185.hがあるとな。最初の警告にあるV1.85と符合する。db_185.hを探すと/usr/include/db4/にヘッダファイルを発見。これを読ませればいいんだな。ということで、</p>
<div class="igBar"><span id="lc-12"><a href="#" onclick="javascript:showCodeTxt('c-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C:</span>
<div id="c-12">
<div class="c">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CFLAGS=<span style="color: #ff0000;">'-DHAVE_DB_185_H'</span> ./configure&nbsp; --with-language=japanese --enable-dns --with-dblib=/usr/lib --with-db=/usr/include </div>
</li>
</ol>
</div>
</div>
</div>
<p>
としてコンパイル。これでコンパイル時の問題と実行時の問題が無事解決です。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.akky.org/archives/78/feed</wfw:commentRss>
		</item>
		<item>
		<title>Services_HyperEstraierを使ってPHPでノードから検索</title>
		<link>http://www.akky.org/archives/77</link>
		<comments>http://www.akky.org/archives/77#comments</comments>
		<pubDate>Sat, 08 Mar 2008 11:50:24 +0000</pubDate>
		<dc:creator>akky</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.akky.org/archives/87</guid>
		<description><![CDATA[
HyperestraylerのPHPバインディングは標準では配布されてないので、移植されたものを http://page2.xrea.jp/ からダウンロード。今回使うのは、PHP5 専用のServices_HyperEstraier の方。


ファイルの構成は下の通り。ServiesはServices_HyperEstraierから取得したものです。

common.php
index.php
Services/HyperEstraier.php
Services/HyperEstraier/Error.php
Services/HyperEstraier/Condition.php
Services/HyperEstraier/ResultDocument.php
Services/HyperEstraier/Node.php
Services/HyperEstraier/Document.php
Services/HyperEstraier/Utility.php
Services/HyperEstraier/HttpResponse.php
Services/HyperEstraier/.ResultDocument.php.swp
Services/HyperEstraier/NodeResult.php
Services/HyperEstraier.php


common.php

&#60;?php
define('SERVICES_HYPERESTRAIER_DEBUG', 1);
error_reporting(E_ALL &#038; ~E_STRICT);

require_once 'Services/HyperEstraier/Node.php';

$uri = 'http://localhost:1978/node/main';
$user = 'admin';
$pass = 'admin';

index.php

&#60;!DOCTYPE html PUBLIC &#34;-//W3C//DTD XHTML 1.0 Strict//EN&#34; &#34;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&#34;&#62;
&#60;html&#62;
&#60;head&#62;
&#60;meta http-equiv=&#34;Cache-Control&#34; content=&#34;no-cache, must-revalidate, no-transform&#34; /&#62;
&#60;meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=UTF-8&#34; /&#62;
&#60;meta http-equiv=&#34;Content-Style-Type&#34; content=&#34;text/css&#34; /&#62;
&#60;meta http-equiv=&#34;Content-Script-Type&#34; content=&#34;text/javascript&#34; /&#62;
&#60;/head&#62;
&#60;body&#62;
&#60;?php
$phrase = isset($_GET[&#34;phrase&#34;]) ? $_GET[&#34;phrase&#34;] : null;
?&#62;
&#60;form action=&#34;&#60;?php echo $_SERVER[&#34;PHP_SELF&#34;] ?&#62;&#34; method=&#34;get&#34;&#62;
検索:
&#60;input type=&#34;text&#34; name=&#34;phrase&#34; value=&#34;&#60;?php echo $phrase ?&#62;&#34; size=&#34;32&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>
HyperestraylerのPHPバインディングは標準では配布されてないので、移植されたものを http://page2.xrea.jp/ からダウンロード。今回使うのは、PHP5 専用のServices_HyperEstraier の方。
</p>
<p>
ファイルの構成は下の通り。ServiesはServices_HyperEstraierから取得したものです。</p>
<blockquote><p>
common.php<br />
index.php<br />
Services/HyperEstraier.php<br />
Services/HyperEstraier/Error.php<br />
Services/HyperEstraier/Condition.php<br />
Services/HyperEstraier/ResultDocument.php<br />
Services/HyperEstraier/Node.php<br />
Services/HyperEstraier/Document.php<br />
Services/HyperEstraier/Utility.php<br />
Services/HyperEstraier/HttpResponse.php<br />
Services/HyperEstraier/.ResultDocument.php.swp<br />
Services/HyperEstraier/NodeResult.php<br />
Services/HyperEstraier.php
</p></blockquote>
<p>
common.php</p>
<pre class="sourceCode">
&lt;?php
define('SERVICES_HYPERESTRAIER_DEBUG', 1);
error_reporting(E_ALL &#038; ~E_STRICT);

require_once 'Services/HyperEstraier/Node.php';

$uri = 'http://localhost:1978/node/main';
$user = 'admin';
$pass = 'admin';
</pre>
<p>index.php</p>
<pre class="sourceCode">
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Cache-Control&quot; content=&quot;no-cache, must-revalidate, no-transform&quot; /&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;
&lt;meta http-equiv=&quot;Content-Style-Type&quot; content=&quot;text/css&quot; /&gt;
&lt;meta http-equiv=&quot;Content-Script-Type&quot; content=&quot;text/javascript&quot; /&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php
$phrase = isset($_GET[&quot;phrase&quot;]) ? $_GET[&quot;phrase&quot;] : null;
?&gt;
&lt;form action=&quot;&lt;?php echo $_SERVER[&quot;PHP_SELF&quot;] ?&gt;&quot; method=&quot;get&quot;&gt;
検索:
&lt;input type=&quot;text&quot; name=&quot;phrase&quot; value=&quot;&lt;?php echo $phrase ?&gt;&quot; size=&quot;32&quot; id=&quot;phrase&quot; class=&quot;text&quot; tabindex=&quot;1&quot; accesskey=&quot;0&quot; /&gt;
&lt;!--
並び替え
&lt;select name=&quot;sort&quot;&gt;
  &lt;option value=&quot;score&quot;&gt;候補&lt;/option&gt;
  &lt;option value=&quot;updateDate&quot;&gt;更新日付&lt;/option&gt;
  &lt;option value=&quot;url&quot;&gt;URL(ディレクトリ)&lt;/option&gt;
  &lt;option value=&quot;size&quot;&gt;サイズ&lt;/option&gt;
&lt;/select&gt;
--&gt;
&lt;input type=&quot;submit&quot; value=&quot;検索&quot;/&gt;
&lt;/form&gt;

&lt;?php
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'common.php';
// create and configure the node connecton object

if  ($phrase != null ) {

  $node = new Services_HyperEstraier_Node;
  $node-&gt;setUrl($uri);

  // create a search condition object
  $cond = new Services_HyperEstraier_Condition;
  $cond-&gt;setPhrase($phrase);
  $cond-&gt;setMax(10);
  $cond-&gt;setSkip(0);

  // get the result of search
  $nres = $node-&gt;search($cond, 1);
  if ($nres) {
      if ($nres-&gt;docNum() == 0) {
          printf( &quot;%s: not found.\n&quot;, $cond-&gt;getPhrase());
      } else {
          foreach ($nres as $rdoc) {
              printf(&quot;&lt;h2&gt;&lt;a href='%s'&gt;%s&lt;a/&gt;&lt;/h2&gt;\n&quot;
                ,$rdoc-&gt;getAttribute('@uri')
                ,$rdoc-&gt;getAttribute('@title')) ;
              printf(&quot;%s&lt;br/&gt;\n&quot;,$rdoc-&gt;getAttribute('@uri'));
              print(&quot;&lt;BLOCKQUOTE&gt;&quot;);
              foreach( split(&quot;\n&quot;,$rdoc-&gt;getSnippet()) as $line ){
                if ( mbereg('   ',$line) ){
                  printf(&quot;&lt;strong&gt;%s&lt;/strong&gt;&quot;,mbereg_replace(' .*$','',$line));
                }else{
                  printf(&quot;%s&quot;,$line);
                }
              }
              print(&quot;&lt;/BLOCKQUOTE&gt;\n&quot;);
          }
      }
  } else {
      printf(&quot;error: %d\n&quot;, $node-&gt;status);
      if (Services_HyperEstraier_Error::hasErrors()) {
          printf( print_r(Services_HyperEstraier_Error::getErrors(), true));
      }
  }
}
?&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.akky.org/archives/77/feed</wfw:commentRss>
		</item>
		<item>
		<title>最寄り駅Webサービス</title>
		<link>http://www.akky.org/archives/76</link>
		<comments>http://www.akky.org/archives/76#comments</comments>
		<pubDate>Tue, 04 Mar 2008 14:46:57 +0000</pubDate>
		<dc:creator>akky</dc:creator>
		
		<category><![CDATA[googlemap]]></category>

		<guid isPermaLink="false">http://www.akky.org/archives/86</guid>
		<description><![CDATA[緯度経度や住所から最寄駅を教えてくれるAPIサービス
http://map.simpleapi.net/
指定した位置からの直線距離も教えてくれる。
目的とする位置の緯度/経度はわからないので、これは駅名から緯度経度に変換すればいいのかな。
駅の緯度/経度がわかればマーカーなりは表示できるし。
]]></description>
			<content:encoded><![CDATA[<p>緯度経度や住所から最寄駅を教えてくれるAPIサービス<br />
http://map.simpleapi.net/</p>
<p>指定した位置からの直線距離も教えてくれる。<br />
目的とする位置の緯度/経度はわからないので、これは<a href="/archives/35">駅名から緯度経度に変換</a>すればいいのかな。<br />
駅の緯度/経度がわかればマーカーなりは表示できるし。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.akky.org/archives/76/feed</wfw:commentRss>
		</item>
		<item>
		<title>ExcelVBAでUTF-8のcsvファイルを書き出す</title>
		<link>http://www.akky.org/archives/75</link>
		<comments>http://www.akky.org/archives/75#comments</comments>
		<pubDate>Mon, 03 Mar 2008 12:56:06 +0000</pubDate>
		<dc:creator>akky</dc:creator>
		
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.akky.org/archives/85</guid>
		<description><![CDATA[
表題の通り。
ADODB.Streamdでは、クローズするときにファイル名を指定するのはしっくりこないな。名前の通りにストリームだから「ファイル名なんて飾りですよ」ののりなのかな。
http://msdn.microsoft.com/library/ja/default.asp?url=/library/ja/jpado260/htm/mdobjstream.aspにあるマニュアルを探し出せるまで満足に実行することもできなかった。

Const SHEETNAME As String = "Sheet1" ' 対象とするシート名
Const STARTROW = 2 ' 開始行
Const LASTCOL = 13 ' 最終列

Private Sub cmdCSVoutput_Click()
    Dim excelFiles As Variant
    Dim exceiFile As String
    Dim csvFile As String
    Dim i As Integer

    ' 複数指定で対象とするファイルを指定
   [...]]]></description>
			<content:encoded><![CDATA[<p>
表題の通り。</p>
<p>ADODB.Streamdでは、クローズするときにファイル名を指定するのはしっくりこないな。名前の通りにストリームだから「ファイル名なんて飾りですよ」ののりなのかな。<br />
<a href="http://msdn.microsoft.com/library/ja/default.asp?url=/library/ja/jpado260/htm/mdobjstream.asp">http://msdn.microsoft.com/library/ja/default.asp?url=/library/ja/jpado260/htm/mdobjstream.asp</a>にあるマニュアルを探し出せるまで満足に実行することもできなかった。</p>
<pre class="sourceCode">
Const SHEETNAME As String = "Sheet1" ' 対象とするシート名
Const STARTROW = 2 ' 開始行
Const LASTCOL = 13 ' 最終列

Private Sub cmdCSVoutput_Click()
    Dim excelFiles As Variant
    Dim exceiFile As String
    Dim csvFile As String
    Dim i As Integer

    ' 複数指定で対象とするファイルを指定
    exelfiles = Application.GetOpenFilename(FileFilter:="Microsoft Excelブック,*.xls", MultiSelect:=True)
    ' キャンセル
    If Not IsArray(exelfiles) Then
        Exit Sub
    End If

    For i = 1 To UBound(exelfiles)
    ' 同じパスで拡張子をcsvへ変更してCSVファイルを書き出す
        exceiFile = exelfiles(i)
        csvFile = Mid(exceiFile, 1, Len(exceiFile) - 3) + "csv"
        csvputput exceiFile, csvFile
    Next i

End Sub

'
' 指定されたExcelファイル
'
Private Sub csvputput(ByVal excelFile As String, ByVal csvFile As String)
    Dim wb As Workbook

    Dim ws As Worksheet ' データがあるシート
    Dim lastRow As Long ' 最終行
    Dim col As Long ' 現在の対象列
    Dim row As Long ' 現在の対象行

    Dim buf As String
    Dim v As Variant

    ' 文字コードにUTF-8を指定して書き出すCSVファイルをオープン
    Set outStream = CreateObject("ADODB.Stream")
    outStream.Open
    outStream.Charset = "UTF-8" ' ファイルの文字コード
    outStream.LineSeparator = -1 ' CRLF
    outStream.Type = 2    ' テキスト

    ' 指定されたシートを開く
    Set wb = Workbooks.Open(excelFile)
    Set ws = wb.Worksheets(SHEETNAME)
    ' 出力するCSVファイルを開く

    ' ヘッダを飛ばして２行目からを書き出す
    lastRow = getLastRow(ws)
    For row = STARTROW To lastRow
        ' １行分のデータを作成
        buf = ""
        For col = 1 To LASTCOL

            buf = buf &#038; ",""" &#038; ws.Cells(row, col) &#038; """"
        Next
        buf = Mid(buf, 2)

        ' ファイルへ書き出し 文字コード変換は ADODB.Stream がやってくれる
        outStream.WriteText buf, 1

    Next
    ' ファイル名を指定してクローズ
    outStream.SaveToFile csvFile, 2
    outStream.Close

    ' Excelを閉じる
    wb.Close

End Sub

'
' 指定されたシートの最終行を取得する
'
' 行の各セルに値がなければ無効行と判断する
'
Private Function getLastRow(ws As Worksheet)
    Dim i As Long

    ' シートの末尾から先頭方向へ向かって有効な行がある位置を探す
    For i = ws.Cells(65535, 1).End(xlUp).row To 1 Step -1
        If isValidRow(ws, i) Then
            Exit For
        End If
    Next

    ' 最終行を戻り値に設定
    getLastRow = i
End Function

'
' 指定された行の値を検査して、一つでも値が入っていれば有効な行と判断する
'
Private Function isValidRow(ws As Worksheet, row As Long)
    Dim i As Long
    Dim b As Boolean

    b = False

    For i = 1 To LASTCOL
        If ws.Cells(row, i) <> "" Then
            b = True
            Exit For
        End If
    Next

    isValidRow = b
End Function
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.akky.org/archives/75/feed</wfw:commentRss>
		</item>
		<item>
		<title>Centos4.6でapache1.3がコンパイルエラー</title>
		<link>http://www.akky.org/archives/74</link>
		<comments>http://www.akky.org/archives/74#comments</comments>
		<pubDate>Thu, 28 Feb 2008 14:01:35 +0000</pubDate>
		<dc:creator>akky</dc:creator>
		
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.akky.org/archives/84</guid>
		<description><![CDATA[
コンパイルしようとすると、

 ndbm.h No suche file or directory

とおっしゃられる。ぐぐってみるとgdbmのヘッダらしいけど、それ自体も見つからず。そもそも、gdbm-develのパッケージから入れないといけないらしい。というわけで、さくっとyumでインストール。


最近はgccすら明示的に入れないといけないんだよな・・・


ヘッダファイルは/usr/include/gdbmにあるので、

 CLFAG=/usr/include/gdbm ./configure ～

とやって解決。シンボリックリンクを張っている記事もあるけど、コンパイルの王道はこうだよな。
]]></description>
			<content:encoded><![CDATA[<p>
コンパイルしようとすると、</p>
<pre>
 ndbm.h No suche file or directory
</pre>
<p>とおっしゃられる。ぐぐってみるとgdbmのヘッダらしいけど、それ自体も見つからず。そもそも、gdbm-develのパッケージから入れないといけないらしい。というわけで、さくっとyumでインストール。
</p>
<p>
最近はgccすら明示的に入れないといけないんだよな・・・
</p>
<p>
ヘッダファイルは/usr/include/gdbmにあるので、</p>
<pre>
 CLFAG=/usr/include/gdbm ./configure ～
</pre>
<p>とやって解決。シンボリックリンクを張っている記事もあるけど、コンパイルの王道はこうだよな。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.akky.org/archives/74/feed</wfw:commentRss>
		</item>
	</channel>
</rss>
