2015年10月26日月曜日

ipアドレスの正規表現

ipv4にマッチする正規表現は:

/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/

例:angularJsでIPアドレスをチェックする
<input type="text" maxlength="15" name="ip" placeholder="例:111.111.111.111" ng-model="ip" ng-pattern="/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/" required>


2015年10月17日土曜日

MAC OS環境でmysql サーバ起動するコマンド

久しぶりmysqlを使おうと思ったら、mysqlの起動コマンドを忘れてました。

メモとして、mysqlサーバ起動するコマンドは:
kaoru-no-MacBook-Pro:~ kaoru$ mysql.server start
Starting MySQL

. SUCCESS! 

2015年10月15日木曜日

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance の解決方法

今日「npm i」コマンドを実行したら、
こんなエラーが、、
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
完全版のXCodeをインストールが必要だそうです。
解決方法としては、
1、まず、「https://developer.apple.com/xcode/」からXcodeをダウンロード、インストールします。

2、以下のコマンドを実行
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

もう一回実行したら、まだ新たなエラーがでました。
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.

ApplicationsからXcodeを開いて、「同意」を押さなければなります。これでやっと問題解決。