[Mac] 修改環境變數下的路徑 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 6月 10, 2019 列出環境變數 printenv 列出環境變數下的 Path echo $PATH 打開 bash profile vi ~/.bash_profile 新增路徑到 PATH export PATH=$PATH:路徑名稱 存擋 :wq 執行 bash profile source ~/.bash_profile 取得連結 Facebook X Pinterest 以電子郵件傳送 其他應用程式 留言
Chrome native messaging host with C# app in windows 4月 16, 2020 由於工作需要使用到chrome擴充功能跟C#寫的app做資料傳輸,所以學了一下 以下開始來看,先看chrome extension的部分: chrome的manifest.json: { "name": "Native Messaging Windows", "version": "1.0", "manifest_version": 2, "description": "Communicate with a native application.", "icons": { "16": "icons/icon_windows.png", "48": "icons/icon_windows.png", "128": "icons/icon_windows.png" }, "app": { "launch": { "local_path": "main.html" } }, "permissions": [ "nativeMessaging" ] } main.html: <!DOCTYPE html> <html> <head> <script src='./main.js'></script> </head> <body> <button id='connect-button'>Connect</button> <input id='input-text' type='text' /> <button id='send... 閱讀完整內容
Little Endian VS Big Endian 10月 16, 2019 Endianness, 當一個資料要儲存到記憶體時 有兩種儲存方式, 如上圖其一為 Little Endian, 另一為 Big Endian 通常而言不需要考慮此排列方式的問題, 但是當要將資料傳遞到別的硬體平台上,或是網路上時 這問題就變得需要在意了, 在網路傳輸上使用的是 Big Endian, Kernel 中也有提供 htonl, htons, ntohs, ntohl 等 function 幫助將資料在 Big Endian 及 機器的 Endian 之間作轉換 ~ 目前也有平台是支援多種 Endianness 的 ex: ARM, PowerPC, MIPS … 透過硬體上的一個 Register 來設定要使用那種方式 當拿到一個新的硬體時,要如何得知此硬體目前使用的是哪一種 Endianness 呢? 1. 翻閱 Spec, 一般而言 CPU Spec 上都會標明是哪一種,不過在可以並存的硬體上 就需要別的方式來幫助判斷了。 2. 寫小程式來判別,在此提供兩種程式寫法 2-1 先宣告 integer 0x12345678 再使用一個 char pointer 檢查第一個 byte 存 0x12 or 0x78 #include int main() { int a = 0x12345678; char *ptr = (char *)&a; if (*ptr == 0x12) printf("Big Endian\n"); else printf("Little Endian\n"); return 0; } 2-2 使用 htonl 來幫忙 剛剛有提到 htonl 會將資料轉成 Big Endian,若轉換前後一致那就是 Big endian 啦 #include int main() { int a = 0x12345678; int b = htonl(a); if (b == a) printf("Big Endian\n"); el... 閱讀完整內容
electron打包:electron-packager及electron-builder兩種方式實現(for Windows) 3月 25, 2020 前言 本文主要介紹如何通過electron-packager及electron-builder兩種方式,將已有的electron應用打包成msi格式和exe可執行檔案。打包是一個成熟的應用程式一個重要的環節,希望這篇文章可以給大家一些參考,最後會講到打包時遇到的一些坑,與大家分享。 electron-packager 使用命令 npm install electron-packager --save-dev 安裝好之後會在package.json中的devDependencies生成程式碼: "devDependencies": { "electron-packager": "^9.1.0" } 打包時要分清devDependencies與dependencies的區別,文章後會講。 package.json 的額外欄位 —— productName、author 和 description,雖然這幾個欄位並不是打包必備的,但它們會在 Windows 的 Squirrel 安裝包(用於自動更新)中使用到,所以請讀者根據實際情況新增。 安裝好模組之後,就可以對應用進行打包, 為了方便起見,在 package.json 中新增程式碼: { "scripts": { "start": "electron .", "build": "electron-packager . AlarmClock --out AlarmClock --overwrite --platform=win32 --arch=x64 --icon=clock.ico --prune=true --squirrel-install --ignore=node_modules/electron-* --electron-version=1.7.9 --ignore=AlarmClock-win32-x64 --version-string.CompanyName=Robby --version-string.ProductName=AlarmClock", }, } 引數說明: elec... 閱讀完整內容
留言
張貼留言