Vimeo / 403 Forbidden 解決方式
Vimeo / 403 Forbidden 解決方式
在過去學習系統的影片為了避免被濫用,緊急情況下採用了 Vimeo 上架我們的線上學習影片,好處是可以直接針對影片設定允許IP及網域。
但最近前線反應在 Vimeo 上傳影片後,無法從後台同步回來。
後台檢查發現有 403 的錯誤,描述如下:
Continue ReadingMarketing, SEO, Web trends, Programming tutorial, Web design, and Life event...
在過去學習系統的影片為了避免被濫用,緊急情況下採用了 Vimeo 上架我們的線上學習影片,好處是可以直接針對影片設定允許IP及網域。
但最近前線反應在 Vimeo 上傳影片後,無法從後台同步回來。
後台檢查發現有 403 的錯誤,描述如下:
Continue ReadingGo 是現代化、速度相當快且擁有豐富的標準庫 透過 goroutine 併發非常有效率,單一線程可以執行多個 goroutine。 在設計併發架構最困難的部分在於如何確保多個併發進程、線程及groutine 不會同時針對同一資料進行操作。透過 Go 可以簡單地實現併發過程數據一致性。 Go 提倡組合(composition),而不是傳統繼承方式;因此,可直接多個類型組合成類型,並且引用這個類型就能使用整個組合的功能。 Go 在內存管理也處理得相當好,使用現代化的回收機制。
Continue Reading這裡指令皆使用 root 身分執行,若其他身分請使用 sudo
安裝環境為 CentOS 7 以上版本
這裡會介紹兩種安裝方式,第一種較為簡單,是直接透過 yum 安裝,另一種方式是直接下載安裝(推薦)
yum 安裝方式
# yum install golang
以下指令都是以 root 身分執行,其他用戶請加上 sudo
在Linux 設定用戶,並且開放 ssh 連線後,有時為了系統安全,需限制用戶僅能訪問指定目錄及指令
可以透過 chrooted 來進行設定
Continue Reading以下指令都是在 root 身分下執行,其他用戶身分請加上 sudo
在 CentOS 的 root email 可以直接查看 /var/sppl/mail/root 方式了解郵件內容
cat /var/spool/mail/root
Continue Reading
Linux 的用戶權限可以透過 usermod 設定,常用的命令包括
-aG 將用戶加入附屬群組
-c, --comment COMMENT new value of the GECOS field
-d, --home HOME_DIR 預設登入目錄 (new home directory for the user account)
-e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE
-f, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-g, --gid GROUP 修改用戶群組 (force use GROUP as new primary group)
-G, --groups GROUPS 修改用戶附屬群組 (new list of supplementary GROUPS)
-a, --append append the user to the supplemental GROUPS
mentioned by the -G option without removing
him/her from other groups
-h, --help display this help message and exit
-l, --login NEW_LOGIN new value of the login name
-L, --lock lock the user account
-m, --move-home move contents of the home directory to the
new location (use only with -d)
-o, --non-unique allow using duplicate (non-unique) UID
-p, --password PASSWORD use encrypted password for the new password
-R, --root CHROOT_DIR directory to chroot into
-s, --shell SHELL 設定用戶登入後的shell 版本 (new login shell for the user account)
-u, --uid UID new UID for the user account
-U, --unlock unlock the user account
-Z, --selinux-user SEUSER new SELinux user mapping for the user account
Continue Reading
Composer Git Hooks 可以讓你直接在 composer 設定進行管理 git hooks,透過這樣管理的好處在於,能避免每個開發者都有各自的git hooks 設定,透過 composer git hooks 能將所有開發者的 git hooks 統一納入版控。
Continue Reading這裡說明如何在 CentOS, Ubuntu 系統安裝 pecl
Continue Reading啟用 EPEL 以及 Remi Repository
$ yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
$ yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm -y
安裝 YUM-UTILS
Continue ReadingIn this article will showing how excute a phpunit for SQLite in laravel.
In here should prepare mysql and setting .env for database info.
First, create a hello model and use the -m options for generate a migration file
php artisan make:model Hello --m
Just need add name column in hello_table migration file:
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateHellosTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('hellos', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('hellos');
}
}
Excute artisan migrate command for generate table:
Continue ReadingMySql 主要的鎖可以分為幾種類型:
MyISAM與 InnoDB 都支援表級別與行級別鎖: X 鎖、 S 鎖
InnoDB的表級別鎖:IX鎖、IS 鎖
Continue ReadingMySQL 在操作資料庫的部署方式,其中一種是採取主從式讀寫分離的方式處理。
主(master) 主要用於寫入資料,從(Slave)主要進行讀取。在一般情況,資料庫採取這樣的方式與傳統單一部署方式並不會有太大的差異,但是在百萬等級的操作時,就可以明顯的分擔資料庫的處理程序。
原因在於資料庫在寫入相關操作速度會有 X鎖及 S 鎖的競爭關係,速度較慢。
Continue ReadingIn laravel we usually use IoC to build our application, when we call one Class, all dependency in this class will involed.
For testing this class, we can defined depencency in service container as singleton.
Create a service provider:
php artisan make:provider WeatherServiceProvider
In here, using service container register a singleton for decoupling Prepare a singleton
WeatherServiceProvider.php
<?php
namespace App\Providers;
use App\Http\Services\WeatherServices;
use Illuminate\Support\ServiceProvider;
class WeatherServiceProvider extends ServiceProvider
{
/**
* Register services.
*
* @return void
*/
public function register()
{
$this->app->singleton(WeatherServices::class, function($app) : weatherservices {
return new WeatherServices('defalt from singleton');
});
}
/**
* Bootstrap services.
*
* @return void
*/
public function boot()
{
//
}
}
Register your provider on config/app.php
In this article, we will show an example of PHP Unittest in Laravel framework, include unit test and exception test.
Continue ReadingThis article will introduce how to write a unit test. IDE is using Visual Studio Code.
Continue Reading正式網站使用 phpMyAdmin 建議一定要限制允許IP來源,避免目錄被訪問
這裡說明如何透過 Web Server 端來設置允許白名單
(建議!盡可能的不要使用 phpmyadmin)
Continue Reading這裏分別針對 Laravel 5.8 (至今年五月)所發佈的一些功能項目進行說明,關於完整的發布紀錄可以參考這裡:
[v5.8.18](https://laravel-news.com/laravel-5-8-18?utm_medium=email&utm_campaign=Laravel v5818 Laracon Australia 2019 PHP Array Redactor and more - 258&utm_content=Laravel v5818 Laracon Australia 2019 PHP Array Redactor and more - 258+CID_a921ac9032531484d27f82e90d45f469&utm_source=email marketing&utm_term=Read More)
或者參閱完整的 v5.8 更新歷程
Continue ReadingPHP Insights 可以用來分析PHP專案的程式品質,可以很簡單的方式從 terminal 直接進行分析。
支援 PHP 7.2+ 以上版本。 並且適用於 Laravel, Symfony, Yii, WordPress, Magento2, 等架構。
這裏主要針對 安裝及 Laravel 使用方式進行說明。
Continue Reading