發表文章

目前顯示的是 2022的文章

JQuery 筆記

  * JQuery(document).ready(function(){...}; 可以用以下方式表示 JQuery(function(){}); $(function(){}); * 依Class和data-qid值找到對應Element var aa = $("button[data-qid='" + qid + "']").filter(".btnLINK2").data('qname'); var aa = $(".btnLINK2").filter("button[data-qid='" + qid + "']").data('qname'); var aa = $(".btnLINK2").filter("[data-qid='" + qid + "']").data('qname');

Sublime Text 3 好用套件

※ 001  SqlBeautifier 格式化SQL 安裝完成後, 重啟程式 使用方法: Ctrl+K, Ctrl+F

Visual Studio 快捷鍵

  #region ... #endregion 001. Ctrl + K, Ctrl + S 將選取程式碼前後加上 #region ... #endregion 002. Ctrl + M + M 折疊當前 region 003. Ctrl + Shift + ↑ or ↓ 切換當前region至 #region or #endregion 004. Shift + F12 尋找所有參考 005. F12 移至定義 005-2. Ctrl + F12 移至實作 006. Ctrl + (減字號) 返回前一步驟 007. Ctrl + D 複製當前列資料 008. Ctrl + X 刪除當前列資料

[MSSQL]Insert資料後取得identity ID

圖片
  Insert into A_3(Data1) select convert(varchar,Getdate(),120) SELECT @@IDENTITY as PKID

[MSSQL]Insert into 後取得Insert資料

圖片
  SQL: insert into A_3 (FormNo, Data1) OUTPUT Inserted.PKID,Inserted.FormNo select ltrim('20221202') + right('00000'+ltrim(Convert(int, isnull(right(max(FormNo), 5), '0'))+1),5)       ,convert(varchar,Getdate(),120) from A_3 where FormNo like '20221202%'

HTML特殊符號

  &lt; < 小于号或显示标记 &gt; > 大于号或显示标记 &amp; & 可用于显示其它特殊字符 &quot; “ 引号 &reg; ® 已注册 &copy; © 版权 &trade; ™ 商标 &ensp;   半个空白位 &emsp;   一个空白位 &nbsp;   不断行的空白 ref web: https://developer.aliyun.com/article/614020

SoapUI

  <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tip="http://www.dsc.com.tw/tiptop/TIPTOPServiceGateWay">    <soapenv:Header/>    <soapenv:Body>       <tip:UpdateStockInPostRequest>          <tip:request> 轉換後XML放這裡, 要把 < 取代為 &lt;           </tip:request>       </tip:UpdateStockInPostRequest>    </soapenv:Body> </soapenv:Envelope> 另一種方法 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tip="http://www.dsc.com.tw/tiptop/TIPTOPServiceGateWay">    <soapenv:Header/>    <soapenv:Body>       <tip:UpdateStockInPostRequest>          <tip:request> <![CDATA[ 原來XML ]]           </tip:request>       </tip:UpdateStockInPostRequest>    </soapenv:Body> </soapenv:Envelope>

C# 取得IP方式

  /// <summary> /// 取得本機 IP Address /// </summary> /// <returns> </returns> private List< string > GetHostIPAddress ( ) { List< string > lstIPAddress = new List< string >(); IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName()); foreach (IPAddress ipa in IpEntry.AddressList) { if (ipa.AddressFamily == AddressFamily.InterNetwork) lstIPAddress.Add(ipa.ToString()); } return lstIPAddress; // result: 192.168.1.17 ...... } /// <summary> /// 取得外網 IP Address /// </summary> /// <returns> </returns> private string GetExtranetIPAddress ( ) { HttpWebRequest request = HttpWebRequest.Create( " http://www.whatismyip.com.tw " ) as HttpWebRequest; request.Method = "GET" ; request.ContentType = "application/x-www-form-urlencoded" ; request.UserAgent = "Mozilla/5.0" ; string ip = string .Empty;

C# 2個List比較差異 (Linq Excep)

  List<string> strList1 = new List<string>(){"a", "b", "c", "d"}; List<string> strList2 = new List<string>() { "a", "b", "f", "e"}; var strList3 = strList1.Except(strList2).ToList(); strList1排除strList2的資料, 結果為 c, d ref web: https://www.cnblogs.com/xinianxinqix/p/9204534.html

MSSQL 新增資料到自動識別欄位方法

 先執行下面語法, 允許寫入 自動識別欄位, SET IDENTITY_INSERT [ TABLE_NAME] ON ; 再執行要異動的SQL, 最後再執行下面語法, 變更欄位為 不允許寫入   ( 因為自動識別欄位名稱要存在SQL內, 所以不能使用 select * from tableA的語法, 欄位要逐一列出, 並且包含自動識別欄位 ) ※ 只有在自動識別欄位出現在 INSERT INTO 陳述式的資料行清單中時,SET IDENTITY_INSERT 才能設置為 ON。 SET IDENTITY_ INSERT [ TABLE_NAME] OFF ; ref web: https://exfast.me/2016/09/mssql-automatic-identification-field-when-required-insert-when-information-should-be-how-do/

[批次程式][BAT]顯示資料夾檔案結構(適用網路路徑)

  tree /f 目錄名稱 > dirs.txt

[LINQ][DataSet] 依條件加總數量

  decimal total = dt.AsEnumerable() .Sum(r => r.Field< decimal ?>( "Col1" ) ?? 0 ); decimal ? total = dt.AsEnumerable() .Sum(r => r.Field< decimal ?>( "Col1" )); // use total.HasValue and total.Value decimal d = 0 ; decimal total = dt.AsEnumerable() .Where(r => decimal .TryParse(r.Field< string >( "Col1" ), out d)) .Sum(r => d); decimal total = dt.AsEnumerable() .Where(r => !r.IsNull( "Col1" ) && decimal .TryParse(r[ "Col1" ].ToString(), out d)) .Sum(r => d); ref web: https://stackoverflow.com/questions/22294929/using-dt-asenumerable-sum-for-columns-having-string-null-value

MSSQL update joib table語法

 update B set columnsA='N'  from TableB B inner join TableA A on (A.C1=B.B1) where 1=1   and A.C1='123

Visual Studio 好用的延伸模組(vsix)

Codinion 文字顏色管理 Better Comments 註解顏色管理

Git常用指令

* 查看本地端 brach git branch * 查看Remote brach git branch -r * 同時查看本地端及Remote brach git branch -a * rescan file for update ignore git rm -r --cached . git add . * 建立空的branch git checkout --orphan <branch-name>  git rm --cached -r .                #clean all file

Win10 查筆電電池容量

  powercfg /batteryreport 開啟網頁 ref web: https://www.cool3c.com/article/130219

Git/SVN Tortoise 圖示沒有顯示

打開CMD輸入regedit 找到  \HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers  把Tortoise文字前加'空白1', 讓名稱顯示在前面 系統預設只會顯示前15個圖示

Win11右鍵選單變更為Win10版本

Win11預設滑鼠右鍵選單會分為2層, 要變更為Win10的樣式, 可以打cmd輸入下列指令, 重開電腦後生效。 reg add HKCU\Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32 /ve /f ref web: https://adersaytech.com/kb-article/rollback-context-menu-win11.html

C# 匯出Excel套件 EPPlus

 EPPlus //非商業用 ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;                //filePath:檔案路徑                 FileInfo FileInfoXLS = new FileInfo(filePath);                 using (ExcelPackage package = new ExcelPackage(FileInfoXLS))                 {                     ExcelWorksheet ws = package.Workbook.Worksheets.Add("Data");                     // 將DataTable資料塞到sheet中                     ws.Cells["A1"].LoadFromDataTable(dtData, true);                     // 設定Excel Header 樣式                     using (ExcelRange rng = ws.Cells[1, dtData.Columns.Count])                     {                         rng.Style.Font.Bold = true;                         rng.Style.Fill.PatternType = ExcelFillStyle.Solid;                         rng.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(79, 129, 189));                         rng.Style.Font.Color.SetColor(Color.White);                     }                     var stream = new MemoryStream();  

查詢電腦型號

 在執行輸入[dxdiag], 可以查到電腦型號。

怎麼停用Win10縮放比例造成WinForm尺寸跑掉問題

圖片
 因為現在螢幕解析度越來越高, 若在筆電上使用Win10系統時, 字會變很小, 所以通常都會放大125%~150%, 這會導致使用Visual Studio開啟Winform專案時, 物件尺寸會跑掉。 解決方法可以直接接外接螢幕, 調回100%, 就不會影響到Winform物件尺寸, 但也可以透過下面修改, 直接停用Visual Studio的DPI感知設定, 1. 開啟登錄(regedit) 2. 在[HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AppCompatFlags]新增機碼[Layers] 3. 在Layers下新增子機碼 a. 名稱: VS程式路徑 b. 類型: REG_SZ c. 資料(值): DPIUNAWARE 4. 再開啟Winform視窗時, 就會顯示[自動縮放比例已關閉] 各版本VS程式路徑: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\devenv.exe C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\devenv.exe ref web: https://docs.microsoft.com/zh-tw/visualstudio/designers/disable-dpi-awareness?view=vs-2022#add-a-registry-entry

Windows軟體套件管理[Chocolatey]

使用系統管理員打開 Power Shell, 執行下列指令安裝[ Chocolatey ] Set-ExecutionPolicy Bypass -Scope Process -Force ; iex (( New-Object System.Net.WebClient ) .DownloadString ( 'https://chocolatey.org/install.ps1' )) 安裝軟體, 多個軟體可以用空格分開 choco install googlechrome paint.net everything pdfxchangeeditor 7zip -y [常用軟體說明] googlechrome : Google Chrome paint.net : .Net版小畫家 everything : 快速搜尋檔案 pdfxchangeeditor : PDF Reader 7zip : 壓縮軟體 nomacs :  相片瀏覽 notepadplusplus : 安裝Notepad++ xmind : 心智圖 potplayer : 影片播放 winmerge : 文件比較 notepad2  : 文字編輯器 sublimetext4 : 文字編輯器 fiddler :  http協議除錯代理工具,能夠非常方便的檢視HTTP通訊資料 postman : API測試工具 soapui : 測試Webservice 自己常用 choco install googlechrome paint.net everything pdfxchangeeditor 7zip xmind potplayer -y 自己常用(程式開發) choco install git tortoisegit sourcetree winmerge sublimetext4 notepadplusplus -y 官網(可查詢件套及指令) :  https://community.chocolatey.org/packages 參考網頁: *  https://harry-lin.blogspot.com/2018/12/tool-windows-chocolatey.html * https://blog.miniasp.com/post/2017/09/13/Will-20