關於網路那些事...

Marketing, SEO, Web trends, Programming tutorial, Web design, and Life event...

Laravel 性能檢核清單

這裏參考 The 2018 Mighty Laravel Application 20 Optimization Ideas Checklist 列出提升 laravel 應用程式性能的 20 項目

Continue Reading

Voyager - 複寫 View blade

改寫 Voyager BREAD Views 的方法,可區分改寫指定的 BREAD 或者全部的 BREAD

指定 BREAD

首先,在 resources/views/vendor/voyager/ 位置,建立 slug 資料夾

資料夾名稱等同於當初你建立 BREAD 所設定的 slug-name

Continue Reading

Voyager 入門

根據官方描述,大致整理以下介紹重點:

Voyager 是什麼?

Voyager 是一個 admin interface,可以很輕易的為你的 app 建構 CRUD 功能,建構 Menu 選單,以及管理 media 檔案 ,此外,在管理介面的 Database Manager 可以直接用來管理資料庫及資料表,BREAD (Browse, Read, Edit, Add, & Delete) 功能則是可以很簡便的就直接設定資料表欄位在哪些時候要出現,以及他的功能屬性是什麼(文字欄位,選單,圖片..),該欄位的驗證規則…(詳細請參考 BREAD說明)

Voyager 不是什麼?

不是傳統的內容管理系統(CMS),部落格平台,當然也不是 wordpress 😜

雖然如此,你仍可以把 voyager 用來作為 CMS或 blog,一切都是可以由你自行決定

只要透過 Laravel+Voyager,你就能建立多種組合後台,並且是非常簡易的就能夠達成這些目的。

接下來,說明基本的安裝流程:

安裝

composer require tcg/voyager

Continue Reading

前端 vue 開發準則

前端 vue 開發準則

為了讓其他開發者也能理解你每一行程式碼的涵義及作用 在建構程式時,盡力打造清晰直觀的架構,讓程式更容易維護及重構 有關傳遞相關的參數,應該避免過度複雜,避免我們無法直覺看出它的功能

Continue Reading

fx - 在命令列檢視 json (command line json viewer) 的開發者工具

在前後端分離架構中,需要頻繁的測試及查看 json ,通常都會透過 postman, insomnia 來輔助開發

這裡要介紹的是在 Command-Line 可直接檢視 json 的套件 fx

Continue Reading

How to download all files from Google Cloud Storage.

How to back up GCP Storage file and folder to local?

Here I’m using gsutil tool command line tool to download all file to local.

Continue Reading

解決,Laravel - getMimeType 取得檔案類型遇到 The file "" does not exist

在開發上傳檔案套件過程,原本測試圖片上傳功能都正常

但是當上傳 pdf, video 時,卻遇到 getMimeType 發生 The file "" does not exist 的錯誤

查詢原因,原來是在 php 原始設定的最大上傳限制設定太低

因此,開啟 php.ini 設定 upload_max_filesize 調整為 10Mb 即可正常上傳

Continue Reading

資料搬遷,從GCP Storage 遷移到阿里雲儲存(OSS)

通常在建構系統中,擴充新服務,在遷移過程,有時會需要將雲端資料進行搬移

最近剛好一個系統需要將GCP上面的Storage資料遷移到阿里雲OSS

在這裡做一個紀錄

Continue Reading

Laravel - 上傳檔案至阿里雲 OSS 空間

這裡記錄如何使用 Laravel 的 storage 上傳檔案到 ali-oss

這裡所使用的 Laravel 版本:5.7.12

Continue Reading

Git 的好幫手 - Tig 讓你在cli將版控可視化

Tig 其實就是將 Git 到過來念的單字,這個工具

他將許多Git的功能,處理成更加直觀及快捷的交互操作

透過 Tig 可以很方便的讓我們直接在 cli 查看 git log, diff, blame…等

這裡將從安裝到一步步介紹用法

Continue Reading

更新 nodeJS 至最新版

方法一、更新 nodejs 至最新版

更新方式

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

Continue Reading

Git stash 暫存指令,解決Git代碼衝突

有時在 pull 過程,偶爾都會遇到 Git 發生衝突的狀況

commit your changes or stash them before you can merge.

或者,在我們開發某個新feat功能,需要先處理一些修改再返回繼續開發時,

這時,就可以透過 git stash 暫存指令將目前開發內容暫存起來

先將新增的內容 pull 下來,或等我們狀況處理完畢,再將暫存內容取回

用法如下:

Continue Reading

修復,阿里雲 RHSA-2017:3263: curl security update

在阿里雲 ECS 默認的安裝環境,看到 安全警示 RHSA-2017:3263: curl security update

阿里雲的 centOS 7.4 預設的 curl 及 libcurl 不是最新版本,存在漏洞問題

修復該漏洞的方式:

Continue Reading

解決,ssh add 出現 Could not open a connection to your authentication agent.

當執行 ssh-add 時

ssh-add ~/.ssh/<private_key_file>

如果出現錯誤訊息: Could not open a connection to your authentication agent.

執行進入 ssh bash ,就能正執行 ssh-add

ssh-agent bash

ssh-add ~/.ssh/<private_key_file>

Continue Reading

阿里雲設置 ssh key 至 bitbucket 流程簡記

阿里雲設置 ssh key 至 bitbucket 流程簡記

設定 ssh key 到 bitbucket

ssh-keygen -f ~/.ssh/your_custom_name -C "youremail@emailhost.com"

Continue Reading

Git - 在新的 repository 保留過去歷史 commit log 紀錄,及同時連結多個 remote 作法

針對一些需求,要將舊有專案作為基礎來進行重構或者修整,讓新專案可以使用

最簡單的做法就是直接將 .git 刪除,再將所有專案一次加入新的 repository

但是過去專案執行過程所保留的紀錄,在遇到一些問題時,至少還有歷史 commit log 可以參考

保留原本的 git log 在新的 repository 延續使用方式:

查看目前 remote

查詢目前專案的 remote repository

git remote -v

Continue Reading

檔案權限列表

權限

r : 讀取 w : 寫入 x : 執行

權限角色

擁有者(u), 群組(g), 其他使用者(o)

所有使用者(a)

權限與數值關係

權限數字 數值相加 權限表示
0 0+0+0
1 0+0+1 –x
2 0+2+0 -w-
3 0+2+1 -wx
4 4+0+0 r–
5 4+0+1 r-x
6 4+2+0 rw-
7 4+2+1 rwx

檔案型態

檔案型態 說明
d 目錄
- 檔案
l 連結檔
b 儲存的周邊設備
c 序列設備

常見格式

目錄 777 drwx rwx rwx

檔案 755 -rwx r-x r-x

檔案 644 -rw- r– r–

Continue Reading

解決,Docker ERROR: Bad response form Docker engine

在Mac安裝新版本 OS 之後,出現了 docker-compose 無法正常 up 的情況

解決方式:

開啟 docker premerence

點選 Reset > Reset to factory default

接著需要重新登入 Docker

再次啟動之後,再透過 up 重新載入 images ,完成啟動

完成

Continue Reading

MacOS 升級後,出現的 xcrun: error: invalid active developer path (/Library/...), missing xcrun at: /Library/Developer/.../bin/xcrun 錯誤

最近Mac升級了 OS 之後

git 使用時會出現錯誤訊息

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

解決方法:

重裝 xcode

xcode-select --install

問題應該就會解決

如果還是不行,可以試試

sudo xcode-select -switch /

Continue Reading

阿里雲, mac iterm2 ssh 登入

直接透過 ssh 最基本的連線方式,連接到阿里雲

首先,取得阿里雲實例的公網IP

然後透過 ssh 直接進行連線,及輸入密碼

Continue Reading