辰戌丑未全
八字提要
有火自然有土
有木未必有火
有土未必有金
有金木必有水
有水未必有木
聚陰成陽
ispconfig install Composer
- Using command line and root login
- Confirm which user needs to install composer.
- For example user is ‘web66’
- Modify /etc/passwd, search web66, change /bin/false to /bin/bash
web66:x:1048:1014::/var/www/clients/client26/web66:/bin/false
{change to}
web66:x:1048:1014::/var/www/clients/client26/web66:/bin/bash
- chattr -i <Web Directory>
chattr -i /var/www/clients/client26/web66
- change folder permission
chown web66 /var/www/clients/client26/web66
- login to web66
su - web66 cd web
- Download composer-setup.php and install
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- Check the download file
php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
- Install
php composer-setup.php
- Delete install file
php -r "unlink('composer-setup.php');"
- composer version check
composer -V
- composer package install test
composer require monolog/monolog
- composer update
composer update
- Exit to root user
exit
- chattr +i <Web Directory>
chattr +i /var/www/clients/client26/web66
- Complete
欄江網撮要
己土喜用財官癸,切忌妄用七殺制
update/upgrade PHP 7.2 to latest version
source : https://askubuntu.com/questions/1146109/how-to-update-upgrade-php-7-2-to-latest-version-safely
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.3 # The latest version in this repo for 18.04 is currently php7.4.
apt-cache search php7.3 | grep php7.3
apt install $(apt list --installed | grep php7.2- | cut -d'/' -f1 | sed -e 's/7.2/7.3/g')
js read the URL parameters
edit test.html
<div id="test"></div>
<script>
const p = new URLSearchParams(window.location.search);
if (p.has('y')) {
year = parseInt(p.get('y'), 10);
document.getElementById("test").innerHTML = year;
}
</script>
test.html?y=1000
result:
1000
javascript detect input box PRESS ENTER
<input type="number" id="year" step="1" min="-3500" max="3500" />
<script>
var input = document.getElementById("year");
input.addEventListener("keyup", function(event) {
if (event.keyCode === 13) {
event.preventDefault();
<Do something>
}
});
</script>
自建了 php autoload ,並同時使用 composer 的 autoload,應該注意什麼?
不知道大家有沒有看過下面的 php autoload 教學?
Eric G. Huang 不像樣工程師
PHP系列 – Autoload 自動載入
http://justericgg.logdown.com/posts/196891-php-series-autoload
跟據這個教學,我解決了很多 class include require 檔案引入的困難,而且用了很長時間。
下面提供一些參考資料,讓大家可以分享。
Composer Basic usage: autoloading
https://getcomposer.org/doc/01-basic-usage.md#autoloading
PHP PSR-4 Autoloader 機制
http://blog.tonycube.com/2016/09/php-psr-4-autoloader.html
什麼是 PHP Standards Recommendations(PSR)(PHP標準建議)?
https://www.php-fig.org/psr/
PHP PSR-4 Autoloader 機制
http://blog.tonycube.com/2016/09/php-psr-4-autoloader.html
Composer Basic usage: autoloading
https://getcomposer.org/doc/01-basic-usage.md#autoloading
運用Composer Autoloader
1. 準備自建的 namespace 和 目錄位置
e.g.
namespace1 = application\control\, 目錄位置 = {user_directory}/application/control
namespace2 = application\module\, 目錄位置 = {user_directory}/application/module
namespace3 = application\mouule\sql\, 目錄位置 = {user_directory}/application/module/sql
Class 例子:
<?php
//application/module/config.php
namespace application\module;
class config
{
function __construct() {
...
}
}
2. 在 composer.json 加入自建的 namespace 和 目錄位置
{
"autoload": {
"psr-4": {
"application\\control\\": "application/control/",
"application\\module\\": "application/module/",
"application\\module\\sql\\": "application/module/sql/"
}
}
}
3. 進入 console mode,使用用戶權限及用戶的root目錄,執行下面的程式
composer dump-autoload
4. 在需要的php 程式中,頂部加入(因為我的 composer 是放在 /vendor中,請自行改進)
require __DIR__ . '/vendor/autoload.php';
Δ(Delta) – Y Conversion

把Δ形電路變換成Y形電路
RΔ是Δ形電路的阻抗之和。具體公式如下:
把Y形電路變換成Δ形電路
具體公式如下:
Wheatstone bridge
Wheatstone bridge 中文名稱
惠斯通電橋
惠斯登電橋
惠斯同電橋
