發表文章

Invoke generic method

 abstract class A     { }     class A1 : A { }     class A2 : A { }     abstract class B { }     class B1 : B { }     class B2 : B { }     class TestClass     {         void TestMethod<T>() where T : A         {             Type val = null;             if (typeof(T) == typeof(A1))             {                 val = typeof(B1);             }             else if (typeof(T) == typeof(A2))             {                 val = typeof(B2);             }             var mi = this.GetType().GetMethod("TestMethod2", System.Reflect...

2016 Failover cluster 備忘

圖片
環境配置: Host(真機) i7 9700K 16GB Ram Total 3部機: Node01: Role: failover cluster Hyper-V Private Switch(192.168.1.0/24), 192.168.1.100 Public Switch(192.168.86.0/24),192.168.86.134 Node02: Role: failover cluster Hyper-V Private Switch(192.168.1.0/24), 192.168.1.101 Public Switch(192.168.86.0/24), 192.168.86.135 Node03: Role: AD DC DNS Iscsi Target Server Private Switch(192.168.1.0/24), 192.168.1.200 Steps: Host環境起以上3部VM, 版本為Windows Server 2016 Standard, 先setup Node03: 1. 裝AD DC,升為domain controller及建立domain 2. 裝Iscsi Server, 起兩隻Iscsi 碟, 一隻~40GB, 另一隻500MB 作為Quorum碟, 開返個Permission 比Node1, node2 access; 再來setup Node01: 1. 設定好IP及Firewall settings 確定Private network 及Public Network(可以連出去真機)後, 先Join Node03所建立的Domain 2. Join 完Domain, 以administrator 登入, 再到Server Manager安裝Failover cluster manager以及Hyper - V 3. 打開Iscsi initiator, map返Node03所建立的兩隻Iscsi碟, 並於disk management中Bring Online-> format to NTFS 4. 到Hyper-V 建立網卡, 選Public, Ethernet adapter選Public Switch, 作...

Mark Six

markSixBallClick(n46) AddMarkSixToBetSlip()

Will updating Web.config for WCF service on IIS interrupt current request ?

圖片
I've created a simple web service to simulate the above scenario: (Details omitted):         [OperationContract]         int TestCutWebService();         public int TestCutWebService()         {             Thread.Sleep(1000 * 10);             return 1;         } The above code is a web service call that took 10 seconds to handle and return 1. Testing Client program: Just a very simple program call will continuously call that 10 sec web service call and print it The web service return 1 every 10 seconds Then i update the web service to return 1234 with just overwriting everything in the webservice folder including binaries and webconfig in around 115. The web service is still returning 1 for that service call, then return 1234 seamlessly. Explain: According to this Stackoverflow post:  ht...

WakeOnLan with google home

https://www.reddit.com/r/googlehome/comments/8j6hon/using_google_home_to_turn_on_my_pc_with_wakeonlan/

Design time DataBinding

https://www.codeproject.com/Tips/879109/Using-Design-time-Databinding-While-Developing-a-W

Xamarin iOS tableview issue

圖片
1. Cell height not correct: Call ForceUpdateSize() to update it, however if ListViewCachingStrategy is RecycleElement, height will still be clipped @_@, currently use RetainElement as a work around.. ^上面果個唔WORK, FourceUpdateSize應該盡量避免 另外發現拎走ControlTemplate,改用一大塊 StackLayout裝住返果2種template, 再係個stackLayout做datatrigger 轉IsVisible做. 估計係因為ControlTemplate比較大食, 佢計高度果陣計錯左? 最後係用原生IOS + ObservableCollection 既UPDATE做到 https://github.com/xamarin/xamarin-forms-samples/issues/390#issuecomment-439651364 At the beginning I use DataTrigger to represent different state of the cell: ` Cell      <Grid>       <ContentView ControlTemplate = "NormalMessage">                  <DataTrigger Binding={Binding IsMasked}>                             <Setter Property="ControlTemplate" Value="MaskedMessage">     ...