« 2007年02月 | メイン | 2007年04月 »

2007年03月31日

Smarty 配列のデバッグ

あんまり慣れてないのか未だにうまくいかないこともある
Mapleで使ってたんだけど

{foreach from=$action.dtoList|smarty:nodefaults item=data}
    {$data.id}
{/foreach}

|smarty:nodefaults がないとうまく出ない場合も・・・

こんなメソッドでデバッグ

{action->getDtoList|var_dump}

{action->getDtoList assign=list}
  {$list|var_dump}
{$action.dtoList|var_dump}

{$action.data|@debug_print_var}

2007年03月29日

Maple 動作確認

ここからアーカイブをダウンロード&展開

maple-3.1.0\htdocs の htdocs がApacheのドキュメントルートに来るようにすれば分かりやすい。

maple-3.1.0\htdocs\example1.php が動作サンプルになります。

ここにアクセスしても画面が正常に動かないのでSmarty版に修正します。

1)example1.php をテキストエディタで開いて以下のように書き換えます

45行目あたり
define('DEFAULT_ACTION', 'examples_simple_example1_page1');
//define('DEFAULT_ACTION', 'examples_smarty_example1_page1');
//define('DEFAULT_ACTION', 'examples_flexy_example1_page1');

   ↓

//define('DEFAULT_ACTION', 'examples_simple_example1_page1');
define('DEFAULT_ACTION', 'examples_smarty_example1_page1');
//define('DEFAULT_ACTION', 'examples_flexy_example1_page1');

2)Smarty本家サイトより最新版をダウンロードして解凍する。
 Smarty/libs の中を全部 maple-3.1.0\maple\smarty にコピーする

ブラウザから再度アクセスすれば正常に表示されます。

詳しい設定は maple-3.1.0\webapp\config\maple.inc.php に書いてあります。

2007年03月25日

Hibernate Tools インストール

eclipseにHibernate Toolsをインストール

http://www.hibernate.org/ ここのダウンロードから

こっちへ進んで
http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=72248&release_id=478192
HibernateTools-3.2.0.beta9a.tar.gzをダウンロードして解凍後、
eclipseのフォルダに上書きして再起動。

プロジェクトを選択して「新規」→「その他」でHibernate.cfg.xml編集ツールが選択できればOK



2007年03月24日

Mac OSX でのCPAN

Testing handle creation speed...
9523 NullP sth/s perl 5.008006 darwin-thread-multi-2level (gcc 3.3 -Os) 0.000105s

test.pl done
/usr/bin/make test -- OK
Running make install
Manifying blib/man1/dbiproxy.1
Warning: You do not have permissions to install into /usr/local/man/man1 at /System/Library/Perl/5.8.6/ExtUtils/Install.pm line 114.
mkdir /usr/local/man/man3: Permission denied at /System/Library/Perl/5.8.6/ExtUtils/Install.pm line 112
make: *** [pure_site_install] Error 255
/usr/bin/make install -- NOT OK

一般のユーザーでインストールするとこんな風になるようです。

sudo cpan で行うとうまくいきます。

All tests successful, 1 test skipped.
Files=4, Tests=567, 23 wallclock secs ( 5.62 cusr + 12.00 csys = 17.62 CPU)
/usr/bin/make test -- OK
Running make install
Installing /System/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/DB_File/DB_File.bundle
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Installing /System/Library/Perl/5.8.6/darwin-thread-multi-2level/DB_File.pm
Installing /System/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/DB_File/autosplit.ix
Installing /usr/share/man/man3/DB_File.3pm
Writing //System/Library/Perl/5.8.6/darwin-thread-multi-2level/auto/DB_File/.packlist
Appending installation info to //System/Library/Perl/5.8.6/darwin-thread-multi-2level/perllocal.pod
/usr/bin/make install -- OK

2007年03月22日

Mac OSX Perl 5.8.8 インストール

ftp://ftp.cpan.org/pub/CPAN/src/

ここからperl-5.8.8.tar.gzをダウンロードします

tar xvzf perl-5.8.8.tar.gz
sudo chown -R $User:wheel perl-5.8.8
cd perl-5.8.8
./configure
make
sudo make install

/usr/local/bin/perlにインストールされるので現在のperlと置き換えます
/usr/bin/perl -v
/usr/local/bin/perl -v
mv /usr/bin/perl /usr/bin/perl_org
sudo mv /usr/bin/perl /usr/bin/perl_org
sudo ln -snf /usr/local/bin/perl /usr/bin/perl

perl -v
This is perl, v5.8.8 built for darwin-2level

Copyright 1987-2006, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.

2007年03月21日

PHP Eclipse 設定

EclipseでPHPでの開発を行うためのプラグインのインストール方法です。
  *画像はクリックすると大きく表示します。

eclipseの「ヘルプ」→「ソフトウェア更新」→「検索およびインストール」 で設定窓を表示します。

「新規リモートサイト」を作成します。

チェックを入れて終了 あとは画面の指示に従ってインストールします。

2007年03月18日

Eclipse 3.2 への Struts IDE プラグイン追加

EclipseにStrutsの開発をサポートするStrutsIDEを追加します。
少し前までEclipse 3.0 でしか動かなかったのですが 3.2 でも動きました。

http://www.eclipse.org/gef/よりGEF-runtime-3.2.zipをダウンロード解凍後、eclipseフォルダにすべてをコピーします。

https://sourceforge.jp/projects/amateras/files/ より以下のファイルをダウンロードします。
 ・tk.eclipse.plugin.struts_2.0.4.zip
 ・tk.eclipse.plugin.htmleditor_2.0.4.zip

解凍後、eclipseのpluginフォルダにコピーします。

eclipseを再起動します。
新規プロジェクト作成後、[ファイル]→[新規]→[その他]→[Amateras]→[Struts]→[Strutsサポートの追加] でStrust開発環境をプロジェクトに追加できます。
[Amateras]というのが以前と違って間に挟まれているようです。

これでstrutsプロジェクトに必要なjarファイル郡がコピーされ、 struts-config.xmlのグラフィカル編集ができるようになります。
既存プロジェクトの場合はそのままstruts-config.xmlのグラフィカル編集ができるようになります。

2007年03月17日

symfony インストール windows

PHPフレームワークsymfonyのインストールです

pear upgrade PEAR
pear channel-discover pear.symfony-project.com

pear install symfony/symfony-beta
downloading symfony-1.0.0.tgz ...
Starting to download symfony-1.0.0.tgz (1,910,892 bytes)
......................................................................
......................................................................
......................................................................
......................................................................
.........................................done: 1,910,892 bytes
install ok: channel://pear.symfony-project.com/symfony-1.0.0

symfony -V で
symfony version 1.0.0 と表示されればインストール成功

2007年03月16日

Seasar2 S2Dao

eclipse へS2Daoをプロジェクトとしてインポートするときに
「プロジェクトが無効」といわれることがあります。

そういう場合は
.poject ファイルの name タグを書き直します。

s2dao-1.0.x
      ↓
s2dao

2007年03月10日

mb_language設定

PHP Fatal error: Call to undefined function mb_language() in xxxx

こんなエラーがでたら
php.ini の extension=php_mbstring.dll を有効にします

php_mbstring.dll 内に mb_language の設定も含まれているそうです

2007年03月09日

.htaccess によるアクセス制限

Order deny,allow
Deny from ALL
Allow from 123.45.67.89
Allow from xx.xx.xx.xx
Allow from yy.yy.yy.yy

.htaccess ファイルを作って
上記のように書けばIPアドレスによるアクセス制限ができます。
httpd.conf の書式と同じ形式になります。

2007年03月03日

Apache logrotate 続

/usr/sbin/logrotate -f ’設定ファイルへのパス’

【設定ファイル例】
/usr/local/apache2/logs/access_log {
rotate 50
daily
postrotate
/usr/bin/kill -HUP `/bin/cat /usr/local/apache2/logs/httpd.pid`
endscript
}

こんなのを cron で設定する場合には
次にApacheの再起動をしておくほうがいいようです。
access_log が生成されていない場合がありました。