2020年10月19日 星期一

[JS] 你的 JS 該減肥了!5個提升網頁載入速度的技巧

 

1. 優化網頁載入速度

為什麼要加快載入速度

  • 載入速度=使用者體驗
  • 根據Amazon內部統計,慢100ms=營收減少1%
  • SEO

2019年4月18日 星期四

[Laravel]Laravel JWT實現單一登入功能

最近需要實作一項JWT身份驗證的功能,同時在有他人登入時將其他client登出

這邊我使用了一項開源的套件tymondesigns/jwt-auth來實作JWT的部分,
正常使用下的安裝說明作者都有寫清楚,
但是!!文件超爛啊... 
文件跟實際上的套件功能缺失了70%左右,慢慢爬程式碼才發現文件跟程式差很多

接下來說說單一登入的部分


2019年4月8日 星期一

[Laravel]使用migrate時發生錯誤Specified key was too long解決方式

由於Laravel使用的預設資料庫字集是utf8mb4,如果你使用的MySQL版本為 v5.7.7 以上,就不會有這個錯誤。
錯誤訊息類似:
[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique (email))
[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes

2018年6月25日 星期一

[VirtualBox]在MAC環境下的vm ubuntu裡面掛載共享資料夾

先安裝VirtualBox套件工具包

1. Update system's packages
$ sudo apt-get update 
2. install virtual box guest additions (referenced from here)
$ sudo apt-get install virtualbox-guest-additions-iso
3. Now install guest additional package (Crucial step! People generally miss this which creates an error “Unknown file type “vboxsf”)
$ apt-get install virtualbox-guest-utils
之後在VirtualBox主程式裡面設定掛載的資料夾名稱,設定->共用資料夾->加入新的共用資料夾。

現在就可以進行掛載,掛載語法為:
$ mount -t vboxsf shared /home/shared_folder;

2018年1月10日 星期三

[linux]iTerm2顏色配置

$ vim ~/.bash_profile

輸入以下內容

# enables color in the terminal bash shell
export CLICOLOR=1
# sets up the color scheme for list
export LSCOLORS=ExFxCxDxBxegedabagacad
# enables color for iTerm
export TERM=xterm-color
export TERM="xterm-color"
PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;34m\]\w\[\e[0m\]\$ '
# sets up proper alias commands when called
alias ls='ls -vG'
alias ll='ls -al'
alias la='ls -a'
alias vi='vim'

2017年7月13日 星期四

[Python]自然語言相關套件紀錄

自然語言處理 NLTK

這個庫的名字是 Natural Language Toolkit(自然語言工具)的縮寫。正如其名,它被用於由象徵性與統計性自然語言處理的一般任務。NLTK 旨在用於自然語言處理的教學與研究等的相關領域(語義學,認知人工智能科學,等等)並現在它的使用受到了很大的關注。
NLTK 在功能上允許很多操作,例如文字標籤,歸類,標記解釋,名稱識別;通過建立語料樹(corpus tree)來解釋句子的內外聯繫,詞根提取以及語義推理。所有這些內置模塊都允許為不同的任務建造複雜研究系統。

2017年6月23日 星期五

[Python]使用matplotlib在osx上出現的問題

今天在osx上使用到matplotlib的時候遇到了以下錯誤,
RuntimeError: Python is not installed as a framework. The Mac OS X backend will not be able to function correctly if Python is not installed as a framework. See the Python documentation for more information on installing Python as a framework on Mac OS X. Please either reinstall Python as a framework, or try one of the other backends. If you are using (Ana)Conda please install python.app and replace the use of 'python' with 'pythonw'. See 'Working with Matplotlib on OSX' in the Matplotlib FAQ for more information.

Google Analytics初學者入門簡介