Category: Tech

IT Technology, 3C, AI

  • 老而彌堅的好用指令: copy /b

    從古早的Windows 2000 到現在的 Windows 10,再命令提示字元中有一個非常好用的檔案合併指令:

    copy /b “SourceFile1.xxx”+” SourceFile2.xxx”+” SourceFilen.xxx” “Output.xxx”

    這個指令最好用的用途有二,一是可以將上百個檔案超快速合併成一個檔案,二是檔案偽裝的資料保護。

    最近碰到的應用就是要將上百的mp3音檔合併成一個檔案。而不管是格式工廠還是幾個線上音檔合併的服務,通通都失敗,最後還是靠這個指定搞定。

  • 升級windows 11 的必要條件: UEFI 和 TPM 2.0

    升級windows 11 的必要條件:主機板需支援UEFI和TPM 2.0(信賴平台模組)

    前者絕大部分的電腦都有,後者可能4、5年前的電腦有很大的概率是沒有的。
    可透過以下方式確認是否支援TPM 2.0 ,或直接下載安裝微軟提供的PC Health Check確認能否升級Windows 11:

    按下鍵盤[Win] + [R]鍵叫出執行視窗,輸入 tpm.msc 後[Enter],即可查閱TPM版本以確認是否為2.0以上。

    另外,若想規避檢查強制安裝Windows 11,也可根據網友提供的方式,將Windows 11安裝檔appraiserres.dll置換成 Windows 10版本,即可規避安裝檢查程式以達到強制安裝的目的。

    Reference by: www.techbang.com/posts/87932

  • Windows 11正式發表!介面大革新、全新軟體商店、更好的性能以及遊戲功能 | T客邦

    關於Windows 11,你會注意到的第一件事是它包括一個新的開始功能表和更新的開始按鈕,它們都在工作列的中心。
    — Read on www.techbang.com/posts/87934-windows-11-is-officially-released-in-addition-to-the-interface

  • Aras Innovator – 透過外部程式實現排程Scheduler自動化執行作業

    排程(Scheduler)為付費訂閱(Subscription)才能啟用的功能,但也可透過自行開發簡易程式的方式實現。

    作法為透過引用 IOM.dll、Aras.Net.dll 來呼叫 Aras Innovator Server 上要定時執行的Method,並透過 Windows 內建的工作排程器來實現排程。

    以下為外部程式呼叫 Method 的 C# 程式:

    using System;
    using Aras.IOM;
    
    class ArasAdapter
    {
        HttpServerConnection _serverConn;
    
        public ArasAdapter(string url, string db, string user, string password)
        {
            _serverConn = IomFactory.CreateHttpServerConnection(url, db, user, password);
        }
    
        public void ApplyMethod(string method)
        {
            //Login
            Item login_result = _serverConn.Login();
            if (login_result.isError())
                throw new Exception($"Login failed");
    
            //Initial
            Innovator inno = IomFactory.CreateInnovator(conn);
    
            //ApplyMethod
            Item applyMethod_result = inno.applyMethod(method, "");
            if (applyMethod_result.isError())
                throw new Exception($"Apply [{method}] method failed");
    
            //Logout
            _serverConn.Logout();
        }
    }

  • FortiGate 140D-POE-T1 HA (Cluster) 設定 Tips

    • Disable T1/E1 interface
    • Disable switch controller. Type following command in console:
      config system global
      set switch-controller disable
      end
    • Make sure WAN interface is using STATIC IP not DHCP or PPPOE. (In Ver.5.2.14, It can not change to PPPOE even after HA setup done)
    • It need least 2 heartbeat lines. Use HA port and the other ports.
  • 解決Chrome/Edge的錯誤: STATUS_INVALID_IMAGE_HASH

    包含Chrome、Edge(新版)等所有基於 Chromium 核心的瀏覽器,在 Windows 10 會啟用 Renderer Code Integrity Protection(渲染器代碼完整性保護)功能。正常情況下並無異常,但會與部分防毒、資安管控(如舊版IP Gaurd)等資安軟體不相容,並導致出現 STATUS_INVALID_IMAGE_HASH 錯誤。

    另外,如果Windows update沒有更新到最新版本(Windows 10請升級到21H1版以上),也很有可能遭遇到此問題。甚至,也會讓相依此瀏覽器的軟體如Teams等無法正常運作。

    解決方式就是更新windows和資安軟體以解決此問題

    其他處理方式( Chrome 118 )

    Chrome 118開始會驗證程式啟動參數的數位簽章。關閉該機制方式有二。一種是使用相容模式,一種是停用沙盒功能。

    使用相容模式

    在瀏覽器的「捷徑」按滑鼠右鍵–> 內容(或屬性)–> 在「相容性」頁籤中,勾選windows 8相容模式

    停用沙盒功能

    在瀏覽器的「捷徑」按滑鼠右鍵–> 內容 –> 在「目標」欄位的字串最後方增加「-no-sandbox」

    其他處理方式( 舊版 )

    若無法更新則可以透過關閉 Renderer Code Integrity Protection 功能來避開(需承擔風險)。

    關閉的方式有二。一種是在瀏覽器執行時加入關閉該功能的參數,一種是直接透過登錄檔設定來停用該功能。

    透過在瀏覽器執行時加入關閉該功能參數

    在瀏覽器的「捷徑」按滑鼠右鍵–> 內容(或屬性) –> 在「目標」欄位的字串最後方增加「-disable-features=RendererCodeIntegrity」

    透過登錄檔設定關閉該功能

    Chrome

    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Chrome]
    “RendererCodeIntegrityEnabled”=dword:00000000

    Edge

    [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge]
    “RendererCodeIntegrityEnabled”=dword:00000000

    Advertisements
  • LibreOffice – 解決(中文)文字顯示不清楚的問題

    LibreOffice預設會啟用Skia算繪和邊緣圓滑的功能來處理文字,但這會讓常見的”標楷體”、”新細明體”等襯線體(Serif)字型,變得不清楚。如一、二、三等字的橫槓部分,會變得又細又透明。

    解決方案有二:

    方案一:文件直接改用非襯線體(sans serif)字型,如常見的微軟正黑體。

    方案二:設定 LibreOffice 、關閉 Skia算繪和邊緣圓滑 。

  • C# – CRC64

    public class CRC64
    {
        private readonly ulong[] _table;
        private readonly ulong _polynomial = 0x42F0E1EBA9EA3693;
        private readonly ulong _initialValue = 0x0000000000000000;
        private readonly ulong _finalXorValue = 0x0000000000000000;
    
        public CRC64()
        {
            _table = CreateLookupTable(_polynomial);
        }
        public CRC64(ulong polynomial, ulong initialValue, ulong finalXorValue)
        {
            _polynomial = polynomial;
            _initialValue = initialValue;
            _finalXorValue = finalXorValue;
    
            _table = CreateLookupTable(_polynomial);
        }
    
        public ulong Compute(byte[] bytes)
        {
            ulong current = _initialValue;
            for (var i = 0; i < bytes.Length; i++)
                current = TableValue(_table, bytes[i], current);
    
            return current ^ _finalXorValue;
        }
    
        private ulong PolynomialCaculate(int index, ulong polynomial)
        {
            ulong returnValue = (ulong)index;
            ulong topBit = (ulong)1L << (64 - 1);
            ulong mask = 0xffffffffffffffffUL;
    
            returnValue <<= (64 - 8);
            for (int i = 0; i < 8; i++)
            {
                if ((returnValue & topBit) != 0)
                    returnValue = (returnValue << 1) ^ polynomial;
                else
                    returnValue <<= 1;
            }
            return returnValue & mask;
        }
    
        private ulong[] CreateLookupTable(ulong polynomial)
        {
            ulong[] table = new ulong[256];
            for (var i = 0; i < 256; i++)
                table[i] = PolynomialCaculate(i, polynomial);
    
            return table;
        }
    
        private ulong TableValue(ulong[] table, byte b, ulong crc)
        {
            return table[((crc >> 56) ^ b) & 0xffUL] ^ (crc << 8);
        }
    }