每月彙整:七月 2021

mikrotik 多線回流

/ip firewall mangle add action=accept chain=prerouting dst-address=192.168.1.0/24 src-address=192.168.1.0/24 add action=accept chain=prerouting dst-address-type=local src-address=192.168.1.0/24 add action=mark-routing chain=prerouting new-routing-mark=to_Route2 passthrough=yes src-address=192.168.1.0/24

發表於 未分類 | 發表迴響

virtualbox nat 效率慢

Nat 介面打開後 網路傳輸慢 需使用 VBoxManage modifyvm 修改 natdnshostresolver natdnsproxy 2個參數 $ VBoxManage modifyvm "" –natdnshostresolver1 on $ VBoxManage modifyvm "" –natdnsproxy1 on 前後可以使用 比較時間 time curl -s http://tw.yahoo.com

發表於 未分類 | 發表迴響

Delphi as is self

as (operator ) 運算子, 是用來 型態轉換 ,會將 左方運算元型態 轉為 右方運算元型態 語法: object as class 例: procedure TForm1.Button1Click(Sender:TObject); begin showmessage((Sender as TButton)).Name; end; is 運算子,檢驗 左方運算子物件實體 是否屬於 右方運算元類別 或 子類別,回傳值為 Boolen: True or False 語法: object is class 注意: is 回傳 … 繼續閱讀 →

發表於 未分類 | 發表迴響

zfs 陣列故障排除步驟

1. zpool status #查看陣列狀態,如有故障 有硬碟問題會出現 io delay,分區出現 faulted, zfs 陣列狀態為degraded 2. zpool offline zsysvol ata-OLD-HD #故障硬碟設定離線 zpool detach zsysvol ata-OLD-HD #故障硬碟設定離線(不建議此指令) detach與offline的差別: detach: 若沒有其它有效的備份碟的話,執行此指令會被拒絕。若此碟可能還會被加回此儲存池(pool)的話,請用offline來替代。 3. 再次用 zpool status 檢查硬碟是否離線,離線後更換硬碟 4. 用 hdparm -i /dev/sd? 查出新hd 代號 zpool replace -f zsysvol … 繼續閱讀 →

發表於 未分類 | 發表迴響

.vimrc vim 方便編輯

"####################################################### set nocompatible "####################################################### syntax enable set number set noruler set ignorecase set smartcase set incsearch set cindent set expandtab set tabstop=4 set softtabstop=4 set shiftwidth=4 set smarttab set confirm set backspace=indent,eol,start set history=500 set showcmd set showmode set nowrap … 繼續閱讀 →

發表於 未分類 | 發表迴響

Delphi建構函式和解構函式

delphi的建構函式的定義是: constructor create; delphi的解構函式的定義是: destructor destroy; 解構函式是不能過載的,但是建構函式是可以過載的。 建構函式在過載的時候要在後面加“overload”, constructor create;overload; constructor create(i:integer);overload; 注意,只有兩個建構函式以上才叫過載,只有一個就不用“overload;”了。 預設的建構函式是:constructor create; 如果有過載的話,那麼預設的建構函式後面也要加overload,正象上面的例子一樣。 delphi建構函式在類外定義在什麼位置呢?在implementation的後面。下面給出一個例項,可以從這個例項中看出建構函式的定義: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm)    Button1: TButton; procedure Button1Click(Sender: TObject); … 繼續閱讀 →

發表於 未分類 | 發表迴響

Delphi 分割字串函數 Extracestrings

//分割字符串 ExtractStrings var s: String; List: TStringList; begin s := ‘about: #delphi; #pascal, programming’; List := TStringList.Create; ExtractStrings([';',',',':'],['#',' '],PChar(s),List); //第一个参数是分隔符; 第二个参数是开头被忽略的字符 ShowMessage(List.Text); //about //delphi //pascal //programming List.Free; end;

發表於 未分類 | 發表迴響

Delphi常用系統函式總結

Delphi常用系統函式總結 字串處理函式 Unit System 函式原型 function Concat(s1 [, s2,..., sn]: string): string; 說明 與 S := S1 S2 S3 …; 相同. 將字串相加. 函式原型 function Copy(S: string; Index, Count: Integer): string;說明 S : 字串. Indexd : 從第幾位開始拷貝. Count : 總共要拷貝幾位. 從母字串拷貝至另一個字串. … 繼續閱讀 →

發表於 未分類 | 發表迴響

win10 暫停用 printer spooler

power shell stop-service -name spooler -force set-service-name spooler -startuptype disable

發表於 未分類 | 發表迴響

server 2019 smb v1 開放

先打開 powershell 檢查 smbv1 狀態 Get-SmbServerConfiguration | Select EnableSMB1Protocol 先安裝 "SMB 1.0/CIFS File Sharing Support" 在 gpedit.msc 電腦設定-系統管理範本-網路-Lanman 工作站-啟用不安全來賓登入 勾 已啟用 再次打開 powershell 檢查 smbv1 狀態 Get-SmbServerConfiguration | Select EnableSMB1Protocol 正常應該要 EnableSMB1Protocol ———————– True

發表於 未分類 | 發表迴響