phalcon php startup テンプレを作る
phalcon phpにはテンプレートなスケルトンを作ってくれるコマンドがあるので、これを利用しよう。 CRUDもコマンド打つだけでいける(たぶん)
Controller
いわゆるウェブのコントローラ。 URLとマッチングしたコントローラを生成してくれる。
phalcon.sh create-controller --name login
とか
Model
Modelというかデータベースのスキーマ情報とかを生成
生成する前にデータベース(mysql)の情報をconfigに登録しておく
app/config/config.phpにdatabase adapter mysqlってあるのでそこに接続情報を記載しておく。 あとは・・
phalcon.sh create-model --table-name item
みたいにする
CRUDなscaffold
CRUD create, remove, update, deleteを生成してくれる。
phalcon.sh scaffold --table-name item
phalcon php webtools
phalcon phpにはwebtoolというウェブ上からコントローラやらを作ってくれる機能があるようだ。 で、これを使うには
phalcon webtools --action enable
あるいはプロジェクト作成時に
phalcon.sh create-project myapp --enable-webtools
とする
逆に要らなくなったら
phalcon webtools --action disable
とするとwebtools関連ファイルを削除してくれる。
phpのビルトインサーバで利用するには
.route.phpなどに以下を記述する。
<?php if (!file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])) { list($url, $querys) = explode('?', $_SERVER['REQUEST_URI']); $_GET['_url'] = $url; if ($querys) { $params = explode('&', $querys); foreach ($params as $param) { list($key, $value) = explode('=', $param); $_GET[$key] = $value; } } } return false;
phalcon php
仕事でphalcon php使うことになったのでメモ。
phalcon phpでぐぐると最速!とかでてきてこまるし、インストールとかぐぐるとapache(nginx)の設定からでてきて困る。 それ普通にビルトインサーバでいいやろ・・開発時もapache立ち上げる必要あるのか ってちがうのか?
phalcon project test
phalcon.sh webtools --action=enable
とするとwebtoolsなるものをプロジェクトに追加してくれる
.
├── app
│ ├── cache キャッシュ生成されたファイルとか
│ ├── config 設定フォルダ
│ │ ├── config.php 静的設定
│ │ ├── loader.php ローダー予め読み込みたいやつ
│ │ └── services.php サービスの登録
│ ├── controllers コントローラ
│ │ ├── ControllerBase.php
│ │ └── IndexController.php
│ ├── models モデル
│ └── views ビュー
│ ├── index
│ │ └── index.volt
│ ├── index.volt
│ └── layouts
├── index.html
└── public
ここから下は↑のpublicの下
├── css
│ ├── bootstrap
│ │ ├── bootstrap-responsive.min.css
│ │ ├── bootstrap.min.css
│ │ └── index.html
│ └── codemirror
│ ├── codemirror.css
│ ├── codephalcon.css
│ └── index.html
├── files
├── img
│ └── bootstrap
│ ├── glyphicons-halflings.png
│ └── index.html
├── index.php
├── js
│ ├── bootstrap
│ │ ├── bootstrap.min.js
│ │ └── index.html
│ ├── codemirror
│ │ ├── index.html
│ │ ├── lib
│ │ │ ├── codemirror.js
│ │ │ ├── codephalcon.js
│ │ │ └── index.html
│ │ └── mode
│ │ ├── clike
│ │ │ ├── clike.js
│ │ │ └── index.html
│ │ ├── css
│ │ │ ├── css.js
│ │ │ └── index.html
│ │ ├── index.html
│ │ ├── php
│ │ │ ├── index.html
│ │ │ └── php.js
│ │ └── xml
│ │ ├── index.html
│ │ └── xml.js
│ └── jquery
│ ├── index.html
│ └── jquery.min.js
├── temp
├── webtools.config.php
└── webtools.php
phantomjs を使えるperl モジュールWightをつかおうとしたらエラー
https://github.com/motemen/Wight
include Wight/inc/Module/Install.pm
String found where operator expected at Makefile.PL line 7, near "author_tests 'xt'"
(Do you need to predeclare author_tests?)
String found where operator expected at Makefile.PL line 62, near "readme_markdown_from 'lib/Wight.pm'"
(Do you need to predeclare readme_markdown_from?)
syntax error at Makefile.PL line 7, near "author_tests 'xt'"
syntax error at Makefile.PL line 62, near "readme_markdown_from 'lib/Wight.pm'"
Bareword "auto_set_repository" not allowed while "strict subs" in use at Makefile.PL line 59.
Execution of Makefile.PL aborted due to compilation errors.
Module::Install::AuthorTests
Module::Install::ReadmeMarkdownFromPod
Module::Install::Repository
があればいい話みたいです。
追記 結局うまくいかなかった rakefileがないとかどうとか
追記
https://github.com/jonleighton/poltergeist
こいつが必要
WightのMakefile.PLの
my $poltergeist = Path::Class::dir('../poltergeist');
をpoltergaistのパスに合わせた
で、いけそうなんだけど、結論としてrubyのバージョンが古いのでpoltergeistをインストールできない・・・って事で めんどくせーな < いまここ
phantomjsを直接いじろうとおもったけど、こっちはこっちでjs でテスト各QUnitいれたり結構めんどくさい。
なのでとりあえずrubyいれてみようとおもう
追記
JsTestDriverの存在をしる
phonegap and Android Studio on Mac OSX Mountain Lion
macでAndroidでphongapです。
以前はelipse使っていましたがAndroid studioを使ってみようとおもいました。 Android Studio(略:あんすた)正直どうなのかよくわかってませんがeclipseのあの感じよりはいいのかなと思いまして使ってみました。
Android Studio http://developer.android.com/sdk/installing/studio.html
のダウンロード・インストール
/Applications/Android\ Studio.app/sdk/
にsdkがインストールされる
ls /Applications/Android\ Studio.app/sdk/tools/ Jet ddms emulator-x86 hprof-conv monkeyrunner templates NOTICE.txt dmtracedump emulator64-arm jobb proguard traceview adb_has_moved.txt draw9patch emulator64-mips lib source.properties uiautomatorviewer android emulator emulator64-x86 lint sqlite3 zipalign ant emulator-arm etc1tool mksdcard support apps emulator-mips hierarchyviewer monitor systrace
次にパスを通す。 通さないとあとで困ることになるだ。
export PATH=${PATH}:/Applications/Android\ Studio.app/sdk/tools:/Applications/Android\ Studio.app/sdk/platform-tools
インストール
nodejsのダウンロードインストール
http://nodejs.org/
nstall the cordova utility. In Unix, prefixing the additional sudo command may be necessary to install development utilities in otherwise restricted directories:
>>|
sudo npm install -g cordova
|
所有権を変更
To ensure permissions are correct, run this command on Mac or Linux, changing LOGIN to match your account name:
$ sudo chown -R アカウント名 /usr/local/lib/node_modules/cordova
cordova utilityのアップデート
After installing the cordova utility, you can always update it to the latest version by running the following command:
$ sudo npm update -g cordova
Use this syntax to install a specific version:
$ sudo npm install -g cordova@2.9.0
インストールされたcordova情報を見る
sudo npm info cordova
インストール完了っ
アプリを作る
cordova create HelloWorld com.example.hello "Hello World"
つくったった
cd HelloWorld tree . ├── merges ├── platforms ├── plugins └── www ├── config.xml ├── css │   └── index.css ├── img │   └── logo.png ├── index.html ├── js │   └── index.js ├── res │   ├── icon │   │   ├── android │   │   │   ├── icon-36-ldpi.png │   │   │   ├── icon-48-mdpi.png │   │   │   ├── icon-72-hdpi.png │   │   │   └── icon-96-xhdpi.png │   │   ├── bada │   │   │   └── icon-128.png │   │   ├── bada-wac │   │   │   ├── icon-48-type5.png │   │   │   ├── icon-50-type3.png │   │   │   └── icon-80-type4.png │   │   ├── blackberry │   │   │   └── icon-80.png │   │   ├── ios │   │   │   ├── icon-57-2x.png │   │   │   ├── icon-57.png │   │   │   ├── icon-72-2x.png │   │   │   └── icon-72.png │   │   ├── tizen │   │   │   └── icon-128.png │   │   ├── webos │   │   │   └── icon-64.png │   │   └── windows-phone │   │   ├── icon-173-tile.png │   │   ├── icon-48.png │   │   └── icon-62-tile.png │   └── screen │   ├── android │   │   ├── screen-hdpi-landscape.png │   │   ├── screen-hdpi-portrait.png │   │   ├── screen-ldpi-landscape.png │   │   ├── screen-ldpi-portrait.png │   │   ├── screen-mdpi-landscape.png │   │   ├── screen-mdpi-portrait.png │   │   ├── screen-xhdpi-landscape.png │   │   └── screen-xhdpi-portrait.png │   ├── bada │   │   └── screen-portrait.png │   ├── bada-wac │   │   ├── screen-type3.png │   │   ├── screen-type4.png │   │   └── screen-type5.png │   ├── blackberry │   │   └── screen-225.png │   ├── ios │   │   ├── screen-ipad-landscape-2x.png │   │   ├── screen-ipad-landscape.png │   │   ├── screen-ipad-portrait-2x.png │   │   ├── screen-ipad-portrait.png │   │   ├── screen-iphone-landscape-2x.png │   │   ├── screen-iphone-landscape.png │   │   ├── screen-iphone-portrait-2x.png │   │   ├── screen-iphone-portrait-568h-2x.png │   │   └── screen-iphone-portrait.png │   ├── tizen │   │   └── README.md │   ├── webos │   │   └── screen-64.png │   └── windows-phone │   └── screen-portrait.jpg ├── spec │   ├── helper.js │   ├── index.js │   └── lib │   └── jasmine-1.2.0 │   ├── MIT.LICENSE │   ├── jasmine-html.js │   ├── jasmine.css │   └── jasmine.js └── spec.html 29 directories, 55 files
なにやらテンプレっぽいアプリをつくってくれる。
プラットフォームをどうすんの
$ cordova platform add ios $ cordova platform add android $ cordova platform add blackberry Run any of these from a Windows machine, where wp refers to different versions of the Windows Phone operating system: $ cordova platform add wp7 $ cordova platform add wp8 $ cordova platform add android $ cordova platform add blackberry
cordova platform add android
あとはandroid studioでimport projectでさっきひな形をつくった場所を指定すればいけるぞ!
macでwindows版のMetaTrader4を動かして、mac bookのPerlからDDEでデータをとっていろいろやりたい
FXです。 アベノミクスです。
最近metatrader4っていうFXの自動取引だとかできるソフトであそんでいます。 でMT4はwindowsなのですが、macからvmware fusionでwindowsを立ち上げてそこで、MT4を起動しています。 で、ついでにperlとやりとりしたいとかおもっていろいろぐぐってみたりするとDDEで通信できると。
といろいろ試行錯誤中
vmwareのcentosでcupsつかってネットワークプリンタ HP B110に印刷
わけあってcupsつかってネットワークプリンタで印刷することになった。
以下メモ
cupsをぐぐったり参考にしながらインストール。 /etc/cups/cups.confあたりをいじる
perlから使えそうなNet::CUPSをいれてみようとするもFAIL
[root@localhost]/# cpanm Net::CUPS --> Working on Net::CUPS Fetching http://www.cpan.org/authors/id/D/DH/DHAGEMAN/Net-CUPS-0.61.tar.gz ... OK Configuring Net-CUPS-0.61 ... N/A ! Configure failed for Net-CUPS-0.61. See /root/.cpanm/build.log for details. [root@localhost]/etc/pki/tls/certs# cpanm Net::CUPS -v cpanm (App::cpanminus) 1.5018 on perl 5.010001 built for x86_64-linux-thread-multi Work directory is /root/.cpanm/work/1370494384.16578 You have make /usr/bin/make You have LWP 6.04 You have /bin/tar: tar (GNU tar) 1.23 Copyright (C) 2010 Free Software Foundation, Inc. 使用許諾 GPLv3+: GNU GPL version 3 またはそれ以降 <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. [参考訳] これはフリーソフトウェアです. 変更と再配布は自由です. 法律で認められる範囲で「無保証」です. 作者: John Gilmore, Jay Fenlason. You have /usr/bin/unzip Searching Net::CUPS on cpanmetadb ... --> Working on Net::CUPS Fetching http://www.cpan.org/authors/id/D/DH/DHAGEMAN/Net-CUPS-0.61.tar.gz ... OK Unpacking Net-CUPS-0.61.tar.gz Net-CUPS-0.61/ Net-CUPS-0.61/META.yml Net-CUPS-0.61/typemap Net-CUPS-0.61/t/ Net-CUPS-0.61/t/01_use.t Net-CUPS-0.61/t/02_cups.t Net-CUPS-0.61/const-c.inc Net-CUPS-0.61/Makefile.PL Net-CUPS-0.61/TODO Net-CUPS-0.61/Changes Net-CUPS-0.61/extra_t/ Net-CUPS-0.61/extra_t/03_destination.t Net-CUPS-0.61/MANIFEST Net-CUPS-0.61/README Net-CUPS-0.61/lib/ Net-CUPS-0.61/lib/Net/ Net-CUPS-0.61/lib/Net/CUPS/ Net-CUPS-0.61/lib/Net/CUPS/Destination.pm Net-CUPS-0.61/lib/Net/CUPS/PPD.pm Net-CUPS-0.61/lib/Net/CUPS/IPP.pm Net-CUPS-0.61/lib/Net/CUPS.pm Net-CUPS-0.61/packer.c Net-CUPS-0.61/fallback/ Net-CUPS-0.61/fallback/const-c.inc Net-CUPS-0.61/fallback/const-xs.inc Net-CUPS-0.61/examples/ Net-CUPS-0.61/examples/list_dests.pl Net-CUPS-0.61/examples/print_file.pl Net-CUPS-0.61/const-xs.inc Net-CUPS-0.61/CUPS.xs Net-CUPS-0.61/ppport.h Entering Net-CUPS-0.61 Checking configure dependencies from META.yml Configuring Net-CUPS-0.61 ... Running Makefile.PL Net::CUPS Configuration Running cups-config ... failed. Net::CUPS requires the Common Unix Printing System. Check your system configuration and then attempt the configure process again. N/A ! Configure failed for Net-CUPS-0.61. See /root/.cpanm/build.log for details.
cups-develをインストールすると cups-configが手に入る
>>||
yum install cups-devel
|