2017年4月27日 星期四

[Apache]Apache access log 分析指令

取得前十名 access 最多的 IP 位址

cat access_log|awk '{print $1}'|sort|uniq -c|sort -nr|head -10



 

取得前十名 access 最多的網頁
cat access_log|awk '{print $11}'|sort|uniq -c|sort -nr|head -10

 

2017年3月15日 星期三

[ES6] import時大括弧的使用方式


This is a default import:
// B.js
import A from './A'
It only works if A contains a default export:
// A.js
export default 42
In this case it doesn’t matter what name you assign to it when importing:

2017年1月20日 星期五

[PHP]Laravel 5.4新特性

Laravel 5.3才剛更新到產品上沒多久就出5.4了Orz...要逼死誰啊XD 但是許多的新特性的確不錯,來紀錄一下新特性的內容吧!


1. Includes Two New Middleware

新增兩個Middleware分別是TrimStrings與ConvertEmptyStringsToNull,TrimStrings的功能是把進來的Request裡面的內容自動做trim的動作,避免使用者多塞空格進來,ConvertEmptyStringsToNull則是當Request裡面的內容是""空字串的話,會自動轉成NULL方便內容判斷,例如:
<input type="text" name="vat" value="">
套用前
dd(request('vat')); // ''
套用後
dd(request('vat')); // null

2016年12月22日 星期四

[ES6] Javascript 開發者必須知道的 10 個新功能

1- Default Parameters

當傳入 function 的參數沒有給值時,防止 expection 出現的方法是設定預設值,es6 比起 es5 的使用方法更快:
var link = function(height = 50, color = ‘red’, url = ‘http://azat.co') { … }

2- Template Literals

在字串 (string) 內嵌入變數時,ES5 必須把字串拆散,把變數通過 + 操作加入字串; ES6 容許通過語法 ${val} 嵌入到字串中:
// es5
// var name = ‘Your name is ‘ + first + ‘ ‘ + last + ‘.’
var name = `Your name is ${first} ${last}.`

2016年9月16日 星期五

[php] PHP Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP 錯誤

當執行php程式的時候,error訊息會出現

PHP Deprecated:  Methods with the same name as their class will not be constructors in a future version of PHP

這是因為在PHP之後不允許使用class與function使用一樣的名字,一律統一使用建構子
__construct,將class內的function修正後即可繼續正常執行
__construct

2016年8月17日 星期三

[docker]使用docker建立laravel應用環境

 最近在研究跟測試docker建立產品環境給laravel使用,一開始也是當作一般的vm在用,抓回來之後使用完打包重新commit image,但是官方建議使用建立Dockerfile的方式來做這件事情,所以改成使用Dockerfile來處理,紀錄一下設定檔案


[docker]使用docker建立laravel應用環境

 最近在研究跟測試docker建立產品環境給laravel使用,一開始也是當作一般的vm在用,抓回來之後使用完打包重新commit image,但是官方建議使用建立Dockerfile的方式來做這件事情,所以改成使用Dockerfile來處理,紀錄一下設定檔案


Google Analytics初學者入門簡介