[PHP] 文字處理速查指南 – String Function Handling
Introduction 基本上查看String Functions(字符串 函数)就可以找到文字處理函數表,本篇僅列常用的範例作速查。 情境 strpos 返回第一次出現位置 substr 返回字串選取部分 取最後一個字符 substr($string, -1); 取去掉最後一個字符 substr($string, 0, -1);
網頁開發知識 | Web-Dev Blog
Introduction 基本上查看String Functions(字符串 函数)就可以找到文字處理函數表,本篇僅列常用的範例作速查。 情境 strpos 返回第一次出現位置 substr 返回字串選取部分 取最後一個字符 substr($string, -1); 取去掉最後一個字符 substr($string, 0, -1);
HTML HTML Meta Refresh 效果同於 JS location.replace(),Browser 不會產生新的 history.state: <meta http-equiv="refresh" content="0;url=http://code.yidas.com" /> Example HTML page: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="refresh" content="0;url=http://code.yidas.com" /> <title>Redirection</title> </head> <body></body> </html> Front-End Javascript Replace – 轉導取代 history.state (Moved Permanently) <script>location.replace("http://code.yidas.com");</script> […]
Windwos cmd command: netsh wlan show drivers Result Example: Interface name: Wi-Fi Driver : Intel(R) Dual Band Wireless-AC 3168 Vendor : Intel Corporation Provider : Intel Date : 10/2/2017 Version : 19.51.7.2 INF file : oem4.inf Type : Native Wi-Fi […]
基本指令 nslookup(1) – Linux man page nslookup [-option] [name | -] [server] nslookup -type=any domain.com nslookup -type=any domain.com 8.8.8.8 type參數: any a: A Record (IPv4 Address) aaaa: Record with IPv6 Address mx: 郵件伺服器 ns: 名稱伺服器 cname: 查別名 ptr: 由 IP […]
Intro PHP 5.3以後Closure / Anonymous Function是一個重大突破,其中callback、closure、anonymous function,與 callable都是指同一設計模式。 Guide PHP.net上已有不錯的文獻: PHP Anonymous functions PHP Closure sample code PHP Callbacks / Callables PHP Callables hint sample code 另外點燈坊有一篇蠻完整的文章:如何使用 Closure? Example 來些Sample Cdoe: Closure function myClosure($hi) { return function($name) use ($hi) { […]
Intro Windows 10 Home可沒有gpedit.msc,需要另外手動安裝。 安裝啟用 下載GPEdit.Msc啟用BAT檔: GPEdit Enabler for Windows 10 Home Edition 使用管理員權限(使用到DISM)執行安裝並重開機後,Windows Run即可支援gpedit.msc BAT原理 怕載點失效嗎? 原理就只是執行已安裝OS內的Package,所以自己生成的BAT Commands為: @echo off pushd “%~dp0” dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt dir /b %SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt for /f %%i in (‘findstr /i . List.txt 2^>nul’) […]
修改密碼指令 MySQL 5.7.5 and earlier: SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘MyNewPass’); MySQL 5.7.6 and later: ALTER USER ‘root’@’localhost’ IDENTIFIED BY ‘MyNewPass’; MariaDB設定使用者失效Bug MariaDB版本與PHPMyAdmin版本存在使用者密碼操作問題,如有遇到則以語法自行對照操作即可修復。 Ex. 5.5.46 SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘MyNewPass’); 另外如果設定完成但登入後又失效,可以確認mysql->users該用戶的plugin欄位是否有mysql_native_password值,將其刪除再設定密碼即可。 重設密碼 – Root密碼遺失強制修改 How to Reset the Root […]
方法 可以直接以Windows打開ISO檔,ISO將會被自動掛載至新磁碟區 承上,掛載後即有絕對路徑如: H:\sources\install.esd 以磁碟H為範例 使用管理者權限執行dism確認檔案(cmd模式執行): Info with OS Build Version: dism /Get-WimInfo /WimFile:H:\sources\install.wim /index:1 If not found, use install.esd dism /Get-WimInfo /WimFile:H:\sources\boot.wim /index:1 Combo ISO: dism /Get-WimInfo /WimFile:H:\x86\sources\install.esd /index:1 dism /Get-WimInfo /WimFile:H:\x64\sources\install.esd /index:1 dism /Get-WimInfo /WimFile:H:\x86\sources\boot.wim /index:1 dism /Get-WimInfo […]
Introduction CentOS & Ubuntu iptables guide. 其中CentOS我認為較方便設定。 指令與參數 快速阻擋一組IP(1.2.3.4/32)的所有連線: $ iptables -A INPUT -s 1.2.3.4/32 -j DROP 常用參數: –append -A :新增至Chain (預設`INPUT`, `FORWARD`, `OUTPUT`) –source -s :IP soruce –protocol -p :protocal –dport :目的Port,指服務Port (`–destination-port`) –jump -j :目標規則 (`ACCEPT`, `DROP`) 設定檔 […]
引言 MySQL Replica 相關指令及指南 安裝 MySQL官方文件:Chapter 16 Replication 安裝筆記可以參考:https://blog.longwin.com.tw/2008/03/mysql_replication_master_slave_set_2008/ Slave 狀態檢查 狀態查詢SQL SHOW slave STATUS; 建議使用command直式較好查看:SHOW slave STATUS \G; 忽略錯誤 SET GLOBAL SQL_SLAVE_SKIP_COUNTER =1; 可一次略過大量SQL數,建議逐筆Error Skip才不會漏 重新跟Master (錯誤後會停止) START SLAVE; 狀態識別 Key Description Master_Log_File IO Thread正在讀取Master的binlog Slave_IO_Running 是否在同步,正常為Yes Slave_SQL_Running 是否在同步,正常為Yes […]