2012/1/13 金曜日

MAMPでPHPUnitが動かなくなったのでしらべてみた。

Filed under: PHP — NEKOGET @ 19:39:17

備忘録がてらメモっておきます。
まさにこの症状がでてました。

 


PHP Fatal error: Class 'File_Iterator' not found in /usr/share/php/File/Iterator/Factory.php on line 105

http://www.mediawiki.org/wiki/Manual:PHP_unit_testing

Edit /usr/share/pear/File/Iterator/Factory.php and on line 44 add require_once ‘File/Iterator.php’;.
と書かれていたので、/Applications/MAMP/bin/php5.3/share/pear/File/Iterator.phpを直したら治りました。

2012/1/9 月曜日

[読書] 俺のコードのどこが悪い

Filed under: 雑記 — NEKOGET @ 18:33:26

本屋で見かけて、衝動買いしました。
コードレビュー時にどのように説明するか?とか見るべきポイント等を知りたいなと思っていたので、ついつい…..

積ん読にならないように早めに読んでしまいたいと思います。

2012/1/2 月曜日

OSX MAMPにStagehand_TestRunner のインストール

Filed under: 雑記 — NEKOGET @ 17:36:37

環境
OSX Lion 10.7.2
MAMP 1.9.2

$ /Applications/MAMP/bin/php5.3/bin/pear channel-discover pear.piece-framework.com

nekoget-no-MacBook-Pro:php5.3 neko$ /Applications/MAMP/bin/php5.3/bin/pear channel-discover pear.piece-framework.com
Adding Channel "pear.piece-framework.com" succeeded
Discovery of channel "pear.piece-framework.com" succeeded

$ /Applications/MAMP/bin/php5.3/bin/pear install piece/stagehand_testrunner

nekoget-no-MacBook-Pro:php5.3 neko$ /Applications/MAMP/bin/php5.3/bin/pear install piece/stagehand_testrunner
WARNING: "pear/Console_Color" is deprecated in favor of "pear/Console_Color2"
Did not download optional dependencies: pear/Console_Color, use --alldeps to download automatically
piece/Stagehand_TestRunner can optionally use package "pear/Console_Color" (version >= 1.0.2)
downloading Stagehand_TestRunner-2.20.0.tgz ...
Starting to download Stagehand_TestRunner-2.20.0.tgz (46,892 bytes)
.............done: 46,892 bytes
downloading Stagehand_AlterationMonitor-1.1.0.tgz ...
Starting to download Stagehand_AlterationMonitor-1.1.0.tgz (3,817 bytes)
...done: 3,817 bytes
downloading Stagehand_Autoload-1.1.0.tgz ...
Starting to download Stagehand_Autoload-1.1.0.tgz (4,530 bytes)
...done: 4,530 bytes
downloading Stagehand_CLIController-1.0.1.tgz ...
Starting to download Stagehand_CLIController-1.0.1.tgz (3,500 bytes)
...done: 3,500 bytes
downloading Stagehand_DirectoryScanner-1.1.0.tgz ...
Starting to download Stagehand_DirectoryScanner-1.1.0.tgz (3,290 bytes)
...done: 3,290 bytes
downloading Stagehand_LegacyError-1.0.2.tgz ...
Starting to download Stagehand_LegacyError-1.0.2.tgz (4,582 bytes)
...done: 4,582 bytes
downloading Stagehand_AccessControl-1.0.0.tgz ...
Starting to download Stagehand_AccessControl-1.0.0.tgz (3,975 bytes)
...done: 3,975 bytes
install ok: channel://pear.piece-framework.com/Stagehand_Autoload-1.1.0
install ok: channel://pear.piece-framework.com/Stagehand_LegacyError-1.0.2
install ok: channel://pear.piece-framework.com/Stagehand_CLIController-1.0.1
install ok: channel://pear.piece-framework.com/Stagehand_AccessControl-1.0.0
install ok: channel://pear.piece-framework.com/Stagehand_DirectoryScanner-1.1.0
install ok: channel://pear.piece-framework.com/Stagehand_AlterationMonitor-1.1.0
install ok: channel://pear.piece-framework.com/Stagehand_TestRunner-2.20.0

$ /Applications/MAMP/bin/php5.3/bin/pear install Console_Color

nekoget-no-MacBook-Pro:php5.3 neko$ /Applications/MAMP/bin/php5.3/bin/pear install Console_Color
WARNING: "pear/Console_Color" is deprecated in favor of "pear/Console_Color2"
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
downloading Console_Color-1.0.3.tgz ...
Starting to download Console_Color-1.0.3.tgz (4,933 bytes)
.....done: 4,933 bytes
install ok: channel://pear.php.net/Console_Color-1.0.3

結局uninstallしました… orz

OSX Lion XAMPP環境にPHPUnitをインストールする

Filed under: Mac,PHP — NEKOGET @ 13:55:30

備忘録…
XAMPPはめんどくさい…..
phpunitのパスどこだろう?
後でもう一度やりなおそうorz

$ cd /Applications/xampp/xamppfiles/lib/php/pear

sudo php pearcmd.php channel-update pear.php.net

$ sudo php pearcmd.php channel-update pear.php.net
No log handling enabled - using stderr logging
Created directory: /var/db/net-snmp
Created directory: /var/db/net-snmp/mib_indexes

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /Applications/XAMPP/xamppfiles/lib/php/pear/PEAR/Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /Applications/XAMPP/xamppfiles/lib/php/pear/PEAR/Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /Applications/XAMPP/xamppfiles/lib/php/pear/PEAR/Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in Registry.php on line 1012

Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in /Applications/XAMPP/xamppfiles/lib/php/pear/PEAR/Registry.php on line 1012
Updating channel "pear.php.net"
Update of Channel "pear.php.net" succeeded

sudo php pearcmd.php install PEAR

$ sudo php pearcmd.php install PEAR
downloading PEAR-1.9.4.tgz ...
Starting to download PEAR-1.9.4.tgz (296,332 bytes)
.............................................................done: 296,332 bytes
downloading Archive_Tar-1.3.8.tgz ...
Starting to download Archive_Tar-1.3.8.tgz (17,995 bytes)
...done: 17,995 bytes
downloading Structures_Graph-1.0.4.tgz ...
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
...done: 30,318 bytes
downloading Console_Getopt-1.3.1.tgz ...
Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes)
...done: 4,471 bytes
downloading XML_Util-1.2.1.tgz ...
Starting to download XML_Util-1.2.1.tgz (17,729 bytes)
...done: 17,729 bytes
install ok: channel://pear.php.net/Archive_Tar-1.3.8
install ok: channel://pear.php.net/Structures_Graph-1.0.4
install ok: channel://pear.php.net/Console_Getopt-1.3.1
install ok: channel://pear.php.net/XML_Util-1.2.1
install ok: channel://pear.php.net/PEAR-1.9.4
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

sudo php pearcmd.php config-set auto_discover 1
config-set succeeded

$ sudo php pearcmd.php config-set auto_discover 1
config-set succeeded

sudo php pearcmd.php install phpunit

$ sudo php pearcmd.php install phpunit

WARNING: "pear/PHPUnit" is deprecated in favor of "channel://pear.phpunit.de/PHPUnit"
Did not download dependencies: pear/PHP_Compat, use --alldeps or --onlyreqdeps to download automatically
pear/PHPUnit can optionally use package "pear/PHP_Compat"
downloading PHPUnit-1.3.2.tgz ...
Starting to download PHPUnit-1.3.2.tgz (20,913 bytes)
........done: 20,913 bytes
install ok: channel://pear.php.net/PHPUnit-1.3.2
$ php pearcmd.php list
Installed packages, channel pear.php.net:
=========================================
Package          Version State
Archive_Tar      1.3.8   stable
Console_Getopt   1.3.1   stable
Log              1.12.7  stable
PEAR             1.9.4   stable
PHPUnit          1.3.2   stable
Structures_Graph 1.0.4   stable
XML_Util         1.2.1   stable

なんだかPEARが古い…. 順番間違ってるけど、upgrade
sudo /Applications/XAMPP/xamppfiles/bin/pear upgrade PEAR

$ sudo /Applications/XAMPP/xamppfiles/bin/pear upgrade PEAR
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
downloading PEAR-1.9.4.tgz ...
Starting to download PEAR-1.9.4.tgz (296,332 bytes)
.............................................................done: 296,332 bytes
downloading Archive_Tar-1.3.8.tgz ...
Starting to download Archive_Tar-1.3.8.tgz (17,995 bytes)
...done: 17,995 bytes
downloading Structures_Graph-1.0.4.tgz ...
Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes)
...done: 30,318 bytes
downloading Console_Getopt-1.3.1.tgz ...
Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes)
...done: 4,471 bytes
upgrade ok: channel://pear.php.net/Archive_Tar-1.3.8
upgrade ok: channel://pear.php.net/Structures_Graph-1.0.4
upgrade ok: channel://pear.php.net/Console_Getopt-1.3.1
upgrade ok: channel://pear.php.net/PEAR-1.9.4
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"

あけまして、おめでとうございます

Filed under: 雑記 — NEKOGET @ 13:35:31

あけまして、おめでとうございます。
2012年もがんばります!

2011/12/18 日曜日

FuelPHPの呼び方。

Filed under: FuelPHP,PHP — NEKOGET @ 13:39:43

FuelPHP Advent Calendar 2011 ということで、PHP フレームワーク FuelPHP に関するブログをクリスマスまでお届けしています。

FuelPHP動作実験 – oil console & PHP Interactive改を使って マニュアルの例文コピペでいろんなメソッドを試してみよう☆彡 に引き続き、書いてます!

今日までにたくさんのブログが書かれています。
まだまだこれから勉強の私には本当に本当にありがたいです。

さて、FuelPHPですが、その名前であるFuelがなかなかうまく発音できません。
http://ejje.weblio.jp/content/fuel
フィルやフィールとか聞こえます。
先日開催されたPHP Apocalypseで、FuelPHPのことを少しLTで話をしたのですが、緊張すればするほど発音できません….

私はもうきちんと発音する事をあきらめ、ひらがな的に

ふえる ぴーえいちぴー

と呼ぶことにしました。

皆さんはどのように発音してますか?

さてさて、次は
FuelPHPでメールフォーム雑感。です。お楽しみに!!!

github でドキュメント日本語化
FuelPHP のアプリケーションのリポジトリを作成する方法
Model-View-ControllerそしてViewModel
[FuelPHP]Validationの使い方
FuelPHPでFacebookアプリを作ってみよう。準備編。
FuelPHPで作るログイン管理
FuelPHPとCodeIgniterでCMS作ってパフォーマンスを比べてみた
FuelPHP の view に PHPTAL デザインテンプレートを使う
FuelPHPでMongoDBを使う
FuelPHP での Migration の使い方
FuelPHPでFacebookアプリを作ってみよう。実装編。
FuelPHP動作実験 – 実験くんソースをModulesに閉じ込めてモジュール分割してみる。
PHP5.3 の名前空間入門
FuelPHP の URL とコントローラの関係
cent osでのphp5.3環境のセットアップ with “yum”
FuelPHPのcoreクラスを拡張してみる。
FuelPHP動作実験 – oil console & PHP Interactive改を使って マニュアルの例文コピペでいろんなメソッドを試してみよう☆彡

2011/12/3 土曜日

Model-View-ControllerそしてViewModel [FuelPHP]

Filed under: FuelPHP,PHP — NEKOGET @ 11:32:13

FuelPHP Advent Calendar 2011 ということで、PHP フレームワーク FuelPHP に関するブログをクリスマスまでお届けしています。

2日目のKenjiさんの記事につづきまして、3日目を書かせていただきます!

FuelPHPは、MVC構造のPHPフレームワークです。
http://fuelphp.com/ のDownloadをクリックすると、ソースをダウンロードできます。
今日この時点で配布されているのは、V1.1 RC1です。

MVC構造というと
Controller , Model , Viewの3つの役割にわかれていますが、
FuelPHPにはそれにもう一つ、ModelViewという考え方があります。
http://docs.fuelphp.com/general/mvc.htmlより….

ViewModels

Once your application gets more complex you’ll discover that it gets hard to decide if a piece of logic really belongs in the Controller, what if it is very specifically about the View and has little to do with your application logic? This is where ViewModels come in; they are the glue between your controllers and your views.

Controllerファイルを作って、コード書いてると、なんだか複雑な事になってるなぁって思うんだよね。健全じゃないっていうかさ…..
うまく言えないけども、それって本来Controllerの仕事にしたままでいいのかな?…..ってね。

Viewの為だけに、データ調整したりとか、生成したりとか…..
それって本当にControllerの役割だったっけ?
仕事させすぎて、テンパってるのよく見かけるじゃん。わかりやすくしてやらないと、Controllerのかっこよさ半減だよね。

viewとControllerの間に、かわいい奴がいればハッピーな事にならないかな? Controllerもかっこ良くなるし、viewも無理しなくて良くなるしさ….

みんな幸せになれるじゃんね?

よーし、作っちゃえ☆
(訳ではありません…..)

そんな感じで、ViewModelの使い方はここに書かれています。
http://docs.fuelphp.com/general/viewmodels.html
そこにも、ViewModelってどんな奴よ?ということが書かれています。

What is a ViewModel?

A ViewModel is a class that contains the logic that is needed to generate your views. When the controller is done with your user input and is done with whatever actions it needed to take, it turns execution over to the ViewModel to retrieve whatever data is needed for the view. A ViewModel shouldn’t do any data manipulation, but can contain Database calls and any other retrieval or preparation operations needed to generate the View’s data.

ViewModelって奴はさ、Viewが魅力的な姿になるために、いろんな準備をしてくれるかわいい奴なんだよ。

まずはControllerが指示するじゃんね? あれ出しとけ、これ出しとけ、それも見せとけって言うんだよね。
そうしたらviewはそれを魅せる仕事をするんだけど、
その材料になる情報を、viewmodelのやつが確認したり、下準備したりしてさ、viewに渡すんだよ。
viewはそれを受け取って、その魅力を最大限に引き出す努力をするんだよ。

Controllerの奴もViewの奴も無理しなくなった分、綺麗になったし魅力的だよな。
(訳ではありません…..)

過去の自分のコードの姿を見返すと…..
viewがかなり頑張ってる姿が見えました。
viewが直接model呼び出してるし、データの体裁を整えたりと、
viewの中が、データ層、表示層に別れているような感じになっちゃったりとか…. viewの中の人も大変だったよねぇ… (; A ; )ごめんよぅ….. と
今回は紹介までですが、次の機会には、ViewModelを実際に書いて動かしてみる事をまとめてみます。

さて、こんなステキなFuelPHPフレームワークですが、
日本語の情報はまだまだ本当に少なく、英語の苦手な私にはそこがちょっとだけが苦しい….. ということで日本語化作業をgithubはじめています。
https://github.com/NEKOGET/FuelPHP_docs_jp
コミットしている内容を次のURLで見えるようにしています。
http://press.nekoget.com/fuelphp_doc/
(仮設置なので年末時間が出来た時にでも、もう少しわかりやすい場所に移転します)

下手な日本語訳を後悔公開していたところ、協力くださるステキな方々がそっと手を差し伸べてくださり、日本語訳がどんどんと進んでいます。本当に嬉しいです。
また、1日目のmizuno さんが、日本語化参加の方法をわかりやすくまとめてくださいました!
http://ounziw.com/2011/12/01/github-localize/
皆様の訳文をお待ちしています☆

 

次回のブログは@fukataさんです。
お楽しみに!

FuelPHP Advent Calendar 2011は、↓こちらから参加できます。
http://atnd.org/events/22380
まだまだ参加可能です。ぜひどうぞ!

2011/11/18 金曜日

FuelPHPがすばらしい!

Filed under: FuelPHP,PHP,雑記 — NEKOGET @ 23:12:03

http://d.hatena.ne.jp/Kenji_s/20111117/1321519058
もう、kenjiさんが言いたい事をそれ以上の情報を元に書かれているので、ご紹介。

FuelPHPは、CodeIgniterよりは敷居は少し高め。
PHP5.3以上ということで環境も比較的新しい環境が必要です。
しかしその敷居を乗り越えて使うに十分な満足と感動を与えてくれるフレームワークのように思います。
Documentは非常に見やすいです。
ライセンスは安心のMITライセンス!
もうライセンスで悩む必要なし!

余談 : CodeIgniterは敷居が低く、機能が足りないそのバランスが本当にすばらしいフレームワーク。
小回りがよく、足りない物を足したり、入れ替えたりが簡単に出来る仕組み。
チーム戦をする場合、この敷居の低さはものすごい力になります。

■FuelPHP本家 ドキュメント http://docs.fuelphp.com/

現在、日本語でDocsを読みたいがために日本語化をしています。
協力してくださる方も増え、非常にありがたいです。
■GitHubでDocs日本語化 https://github.com/NEKOGET/FuelPHP_docs_jp
■現在日本語化途中のドキュメント http://press.nekoget.com/fuelphp_doc/
(たぶん近日URLは変更します)

お褒めの言葉いただきました!
嬉しいです!!!

2011/11/10 木曜日

FuelPHPのドキュメント

Filed under: FuelPHP,PHP — NEKOGET @ 5:46:51

日本語化はじめてみました。
Github : https://github.com/NEKOGET/FuelPHP_docs_jp

Githubはまだあまり使った事が無く、おっかなびっくりですがとりあえずはじめてみました。
やっぱりドキュメントは日本語で読みたいです。

2011/11/8 火曜日

FuelPHPを調査中

Filed under: FuelPHP,PHP — NEKOGET @ 4:12:54

twitterにて、いいよーという話を聞いたので、早速にinstallしました。

FuelPHPはMITライセンスのphpフレームワークです。
http://fuelphp.com/

軽くDocumentを見ながらコードを追いかけた感じでは、
CodeIgniterほどのシンプルさは感じません(爆)
Query_Builderが、よさげなのと、公式サイトが好み♪
(そういえば、CodeIgniterを勉強しようと考えた一番の理由は、Ellis labのデザインとHTMLが好みだったのが決め手でした。)
公式サイトの右下にNINJAがいます。
CodeIgniter Conの公式サイトで、見かけて気になっていました。
NINJAなら、仕方ない。使わねばだよね?
ってことで、しばらく勉強をしてみようと思います。

■とりあえずメモ的にLINK
Quick web application development with fuelphp tutorial
FuelPHP 001
FuelPHP 002
FuelPHP 003

次ページへ »

HTML convert time: 1.175 sec. Powered by WordPress