ゆるーい備忘録

まいにちべんきょう

2016-01-01から1年間の記事一覧

nkfコマンドで文字コードを判別する

インストール ubuntuの場合 # apt-get install nkf centOSの場合 # yum install nkf ファイルの文字コードを表示 # nkf --guess XXX.php 参考サイト http://equj65.net/tech/charcode/

ENT_NOQUOTESについて

htmlspecialcharsの第二引数にENT_NOQUOTESを指定すると ダブルクオーテーションとシングルクォーテーションがへんかんされない。

正規表現 文字数制限付きの英数字チェック

忘れないようメモ '/\A[a-z0-9]{1,5}\z/ui' 解説 u修飾子 utf8エンコーディングであることを示す i修飾子 大文字小文字を区別しないで判定する \A データの先頭 \z データの末尾 ※ ^は行の先頭、$は行の末尾

php serializeの構造

serializeされている値の一部を変更したかった話 すでにDBにserializeされた状態で格納されたデータの一部を変更したかった。 一部を抜き出すと、 a:2:{s:1:"9"; を a:2:{s:1:"10"; に変更したい。 配列の中に9って文字列があって、10に変更したかったんです…

ubuntu apt-getしようとしたらNot Foundが出た

curlを入れたい # apt-get install cur ってやると、404 Not Found のエラーが返ってきました。。。 参考サイト http://server.etutsplus.com/apt-get-404-not-found/ バージョンの古いUbuntuを使うと出るらしい。 リポジトリのURLを変更したらうまくインス…

FiddlerをMacにインストール

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null ; brew install caskroom/cask/brew-cask 2> /dev/null パスワード入力 brew cask install fiddler 完了。 brewってこんなに便利なの…

composer updateをしようとしたらcommand not foundになった話

vagrantにcomposerをいれてプロジェクトの作成をした。 composer update のコマンドを打ちたかったのだが、 -bash: composer: command not found って返ってきた。 現状 [root@localhost cakephp]# ls -la total 1672 drwxrwxrwx. 1 vagrant apache 136 Aug …

vagrant destroyしようとしたら「tty」エラーが出た話

windows10 babunを使用 Vagrant is attempting to interface with the UI in a way that requires a TTY. Most actions in Vagrant that require a TTY have configuration switches to disable this requirement. Please do that or run Vagrant with TTY. …

Vagrant環境の時刻変更したい

ローカル環境のみ、一時的に時間を変更したい。。 ホストOSとゲストOSの時刻同期を切る $ sudo su - # service vboxadd-service stop 時刻変更 # date -s "2017/08/23 00:00:00" これでOK! 時刻戻す場合 # service vboxadd-service start