This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// HTML原生的 validation | |
/// ref→[Constraint validation interfaces](https://developer.mozilla.org/en-US/docs/Web/API/Constraint_validation#element.setcustomvalidity(message)) | |
/// ref→[HTMLObjectElement.validationMessage](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validationMessage) | |
/// ref→[HTMLObjectElement.validity](https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validity) | |
/// ref→[validityState.badInput](https://developer.mozilla.org/en-US/docs/Web/API/ValidityState/badInput) | |
/// | |
<!DOCTYPE html> | |
<html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// C# switch pattern 語法整理 | |
/// ref→[The evolution of Pattern Matching in C# (from version 6 to 10)](https://www.youtube.com/watch?v=MzNHMJCyU40&ab_channel=NickChapsas) | |
/// ref→[Pattern matching overview](https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/functional/pattern-matching) | |
/// ref→[Patterns (C# reference)](https://docs.microsoft.com/zh-tw/dotnet/csharp/language-reference/operators/patterns) | |
/// | |
using System; | |
using System.Collections.Generic; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scrollToOffset(element, offset /* int */) | |
{ | |
//ref→https://newbedev.com/javascript-scrollintoview-smooth-scroll-and-offset | |
const bodyRect = document.body.getBoundingClientRect().top; | |
const elementRect = element.getBoundingClientRect().top; | |
const elementPosition = elementRect - bodyRect; | |
const offsetPosition = elementPosition - offset; | |
window.scrollTo({ | |
top: offsetPosition, | |
behavior: "smooth" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 取得 jquery 版本 | |
jQuery().jquery | |
/// 或 | |
$.fn.jquery |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel.DataAnnotations; | |
using System.Linq; | |
using System.Linq.Expressions; | |
/// <summary> | |
/// global type handling helper | |
/// </summary> | |
public static class GT<TModel> | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Dapper; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
/// 專門載入基本資料。如:下拉選單 Select 或 AutoComplete 的項目清單。 | |
/// C#9.0 | |
namespace YourProject.DB.BasicData |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using System.ComponentModel.DataAnnotations; | |
public static class DBHelperClassExtensions | |
{ | |
public static string DisplayNameOf(Type ty, string propertyName) | |
{ | |
var field = ty.GetProperty(propertyName); | |
var attr = field.GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault() as DisplayAttribute; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// BenchmarkDotNet v0.13.0 | |
/// ref→[Getting started](https://benchmarkdotnet.org/articles/guides/getting-started.html) | |
/// | |
using BenchmarkDotNet.Attributes; | |
using BenchmarkDotNet.Running; | |
using System; | |
class Program |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Task HandleQuery() => CatchHandling(async () => | |
{ | |
var qryArgs = new TodoQryAgs | |
{ | |
Msg = f_testFail ? "測試邏輯失敗" : "今天天氣真好", | |
Amt = 999 | |
}; | |
dataList = await bizApi.QryDataListAsync(qryArgs); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 查看連線數 | |
USE master | |
SELECT cntr_value AS User_Connections FROM sys.sysperfinfo AS sp | |
WHERE sp.object_name='SQLServer:General Statistics' | |
AND sp.counter_name='User Connections' | |
GO | |
-- 查看連線明細 | |
USE master | |
SELECT c.session_id, c.connect_time, s.login_time, c.client_net_address, s.login_name, s.status |