パスワードのかかったzipファイルの作成
zip -e -r ファイル名.zip 対象ディレクトリ名Leave the first comment ▶
branches で派生して開発していて、trunkにマージするときtortoiseSVNをつかっていたのだけど、macからいちいちwindowsに行くのが面倒になったので、いいかげんターミナルでできるようになるようメモ。
http://hoge.com/svn/trunk
のチェックアウト、
myDir
myDir/trunk/
に、http://hoge.com/svn/branches/hoge111209/ をマージする
cd myDir svn co http://hoge.com/svn/trunk cd trunk svn merge --dry-run -r 52:HEAD http://hoge.com/svn/branches/hoge111209/
で、変更なしで実行結果を確認
--- Merging (from foreign repository) r53 into '.': U images/1.JPG A images/3.JPG A images/4.JPG U index.html
実行
svn merge -r 52:HEAD http://hoge.com/svn/branches/hoge111209/
確認
svn diff
コミット
svn commit -m "comment"Leave the first comment ▶
よくListのItemRendererで、選択された状態で枠線がでていて、他のItemRendererが押されたら、前回選択されていた枠線は消したい、といった排他でオンオフする処理をしたいときがある。
小一時間なやんだけど、わりと単純だったことが判明。
//itemRenderer内
[Bindable]
private var isMe:Boolean;
//親のListのselectedItemがかわると送出されるのでItemRenderer内で監視
protected function creationCompleteHandler(event:FlexEvent):void
{
List(owner).addEventListener(Event.CHANGE,changeHandler);
}
//this.selectedで自分自身の選択状態を取得
protected function changeHandler(event:IndexChangeEvent):void
{
isMe = this.selected;
}
//itemRenderer内mxml側---------------------
<s:CheckBox selected="{isMe}"/>
Leave the first comment ▶ smartyの中でfor文とif文のやりかたのメモ。
<ul>
{section name=cnt loop=10}
<li>
<input type="radio"
id="select{$smarty.section.cnt.iteration}"
value = "{$array[$smarty.section.cnt.iteration-1]}"
{if $smarty.section.cnt.iteration-1 == 0}checked>{else}>{/if}
</li>
{/section}
</ul>
Leave the first comment ▶ 多態性、継承、アブストラクト、インターフェイス・・・のへんの説明が、あれ?ってなるたびに独習PHPを見て、おお、わかりやすい説明! って思うけど毎度見返すのもアレなのでメモ。
メリット:似たような処理を呼び出すときに共通の手続きで行える。手続きを踏襲していれば同様なものが増えても個別の対応を考えなくてもいい。実装を呼び出し側が知らなくてもいいのでブラックボックス化できる。
Leave the first comment ▶svn diff -r リビジョン番号:リビジョン番号 --summarize リポジトリURL
tortoiseSVNでやればいい、という話ではあるけどMacでそんな高機能なsvnクライアント知らないのでしょうがなくterminal。
・trunkとbranchesを比べたいときなど。
svn diff --summarize リポジトリURL リポジトリURL
・(svnではなく)普通のdiffで改行コードを無視して比較する場合。
diff -rq --strip-trailing-cr ディレクトリ ディレクトリLeave the first comment ▶
PDOでSQLiteを操作していて、ローカルのMAMPで動いているものがhetemlにアップしたら↑のエラーがでた。
$state = $this -> db -> prepare($query); $state -> bindValue($key,$value);
とかやってるところのステートメントがfalseを返してきていてとれてない模様。
ググったら解決してくれてる方がいた。
SQLiteのバージョンとPDOのドライバの対応しているバージョンの違いによる現象らしい。
↑で書かれているように、PDOから直接 CREATE TABLEするphpを作成してDBファイルを作り、それを使用したらうまくいった。
ソートしたら数字の評価順でかえってきていた。
$query = 'SELECT * FROM table WHERE id=:id order by hoge_count desc';
以下のようにキャストしてうまくいった。
$query = 'SELECT * FROM table WHERE id=:id
order by cast(hoge_count as integer) desc';
Leave the first comment ▶ まずindex.phpでルーティングや変数の設定ができる。
ああ・・・ところでシンタックスハイライトのプラグインがHTMLだといろいろ省略しまくってしまうので見苦しいですが普通のpreでいきます・・・。
<?php require dirname(__FILE__)."/rhaco2.php"; app(); ?> <app> <handler> //URLとテンプレートのひも付け <map name="top" url="index.html" template="index.html"> //変数設定 <var name="title">トップページ</var> </map> //リダイレクト <map name="top_redirect" url="" redirect="index.html"/> <map name="products" url="products/index.html" template="index_products.html" /> </handler> </app>
index.htmlの例。bodyの中だけ書いてますが、普通にhtmlタグもheadタグもあるふつうのhtmlです。
<!--テンプレートブロック定義-->
<rt:block name="navi">
<ul id="globalNavigation">
<!--マップnameのマッチの正否でClass名を切り換え-->
<li class="{$t.match_pattern_switch('top','on','off')}">
<!--index.phpのマップからURLをとってくる-->
<a href=""{$t.map_url('top')}"">top</a>
</li>
<li>
<a href=""{$t.map_url('products')}"">products</a>
</li>
</ul>
</rt:block>
<rt:block name="main">
<div id="main">
<h1>{$title}</h1>
本文本文本文
</div>
</rt:block>
products/index.htmlの例。
<!--継承。index.htmlと同じものが出力される--> <rt:extends href="index.html"> <!--mainのブロックだけオーバーライド--> <rt:block name="main"> 別の内容別の内容別の内容 </rt:block>Leave the first comment ▶
rhaco2のhtmlテンプレ機能を使ってみることになったのでまずセットアップしたメモ。
MAMPのドキュメントルートにダウンロードしたrhaco2.phpを配置して、cdで移動。
$ php rhaco2.php -new Create /(yourDirectory)/index.php Create /(yourDirectory)/resources/templates Create /(yourDirectory)/resources/media Create /(yourDirectory)/libs Create /(yourDirectory)/resources/templates/index.html Application URL [http://localhost/(yourDirectory)]: (リターン) Working Directory [/(yourDirectory)/work/]: (リターン) Application Mode [dev]: (リターン) write /(yourDirectory)/__settings__.php Create .htaccess (y / n) [y]: (リターン) rewrite base [(yourDirectory)]: (リターン) create /(yourDirectory)/.htaccess Display Log (on / off) [off]: on log level (none / error / warn / info / debug) [none]: debug update __settings__.php
これで必要なディレクトリが生成されてた。
resources/media が、例えばcommon/cssや/js,/imagesなんかの置き場であらかじめ見にいってるようなので、
media以下をimgタグのパスに直接指定する。
templates以下はテンプレートとして使うhtml。
index.phpはルーティングをする設定類が書かれている。