發表文章

目前顯示的是 2018的文章

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">     ...

XPS Printing

1 129810 2 86534 3 69567 4 68592 5 67887 6 63032 7 63322 8 61738 9 65949 10 78690 自已整左個program仔去試concurreny send xps job..上面係不同concurrency的結果.. class XPSPrintTest     {         static Stopwatch completeStopWatch = new Stopwatch();         static bool Done = false;         static object jj = new object();         static object intLock = new object();         const int targetCounter = 100;         static int _completeCounter = 0;         static int CompleteCounter { get             {                 lock(intLock)                 {           ...

IIS/ WCF throttling

圖片
https://docs.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/web/applicationpool-element-web-settings C:\Windows\Microsoft.NET\ Framework64 \ v4.0.30319 \aspnet.config ^自已執生 The 64-bit runtime uses a different machine.config. The basic rules are this: ASP.NET 1.x uses  %WINDIR%\Microsoft.NET\Framework\v1.1.4322 ASP.NET 2.0 / 3.5 x86 uses  %WINDIR%\Microsoft.NET\Framework\v2.0.50727 ASP.NET 2.0 / 3.5 x64 uses  %WINDIR%\Microsoft.NET\Framework64\v2.0.50727 ASP.NET 4.0 / 4.5.x x86 uses  %WINDIR%\Microsoft.NET\Framework\v4.0.30319 ASP.NET 4.0 / 4.5.x x64 uses  %WINDIR%\Microsoft.NET\Framework64\v4.0.30319 For ASP.NET 5.0 using the Full CLR, this will be the same as the ASP.NET 4.0 locations since the .NET Framework 4.6 is a drop in replacement for 4.5. If ASP.NET 5.0 is running on the CoreCLR, there is no concept of a machine.config file. Which version of ASP.NET you use depends on your ASP.NET Tab (IIS 6) or AppPool (IIS 7+) x64 ...

Closing over the loop variable considered harmful

要小心用closure 同forloop, 都幾特別 https://blogs.msdn.microsoft.com/ericlippert/2009/11/12/closing-over-the-loop-variable-considered-harmful/

Fixing reading XPS memory leak issue

class Program { static int intCounter = 0; static object _intLock = new object(); static int getInt() { lock (_intLock) { return intCounter++; } } static void Main(string[] args) { Console.ReadLine(); while (true) { while (!Console.KeyAvailable) { for (int i = 0; i { var ogXps = File.ReadAllBytes(@"C:\Users\nathan\Desktop\hahaha.xps"); var returnedDoc = Test(ogXps); string id = getInt().ToString(); // File.WriteAllBytes(@".\output\" + id + ".xps", returnedDoc); Console.WriteLine(id); }); t.SetApartmentState(ApartmentState.STA...

Adding line number on <ol> <li> with alignment and width adjustment by CSS and Javascript

圖片
話說今日 (21/7/2018) 想係個logger度加 line number 個structure大約係咁: <ol>    <li>      <pre> blah blah blah </pre>    </li> </ol> 咁出黎就係有數字, 不過就多左粒點, 變成咁樣: 上stackoverflow d人就教用css :before selector 整個假狗counter 黎取代佢原本個數字, 出黎效果: https://stackoverflow.com/questions/11946098/how-to-remove-dot-after-number-in-ordered-list-items-in-ol-li ol { counter-reset : item; list-style-type : none ; padding-left : 10px } li { display : -webkit-box; } li:before { content : counter ( item ) " " ; counter-increment : item ; color : gray ; display : block ; text-align : right ; font-size : 14px ; } (用黎收埋最尾果行用) li:last-child:before { content : "" ; } 出黎見到另一個問題, 就係佢每個li:before 既width都唔一樣.. 本來好天真地以為可以就咁計返最長數字既width, 再用jquery $("li:before").each(function(e){$(this).css('width','123');}); 類似咁一野apply落去, 點知!!!! :before係pseudo-element 所以無法直接用jquery/DOM方式去改!!!>_< 因...

Hangfire web.config template

<?xml version="1.0" encoding="utf-8"?> <configuration>   <system.web>     <compilation targetFramework="4.0" />   </system.web>   <system.serviceModel>        <bindings>             <wsHttpBinding>                 <binding name="TransportSecurity" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">                     <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"             maxNameTableCharCount="2147483647"/>                     <security mode="Transport">  ...

IIS application initialization setup srcipt

cd C:/windows/system32/inetsrv set Arr[0]=NathanTesting set "x=0" :SymLoop if defined Arr[%x%] ( call    appcmd set apppool "%%Arr[%x%]%%" /autoStart:true /startMode:AlwaysRunning /processModel.idleTimeout:00:00:00 call    appcmd set site "%%Arr[%x%]%%" /serverAutoStart:true call    appcmd list apps /site.name:"%%Arr[%x%]%%" /xml |appcmd set app /in /preloadEnabled:true call    appcmd set config -section:system.applicationHost/sites "/[name='%%Arr[%x%]%%'].applicationDefaults.preLoadEnabled:true" /commit:apphost     set /a "x+=1"     GOTO :SymLoop ) 上面會做: Set Application Pool autoStart = true, startMode = AlwaysRunning, IdleTimeout = 0 Set Site serverAutoStart = true Set EVERY application within the site to preloadEnabled = true Set applicationDefaults.preLoadEnabled of site to true

Electron

-裝npm -用electron-packager 打包 eg:  cd (project dir) npm start 打包: electron-packager . outputname --overwrite

IIS remote server management

Windows 7 原生個IIS要裝呢個:  https://www.iis.net/downloads/microsoft/iis-manager 參考:  http://registerboy.pixnet.net/blog/post/31620284-iis-%E9%81%A0%E7%A8%8B%E7%AE%A1%E7%90%86 記得開server port, 改完setting 除左要enable仲要start~~~

Fix jquery dialog content size issue when resize

https://stackoverflow.com/questions/31584544/jquery-ui-dialog-on-resizing-shrinks-the-content-of-the-dialog Fix: resize : function () { var heightPadding = parseInt ( $ ( this ). css ( 'padding-top' ), 10 ) + parseInt ( $ ( this ). css ( 'padding-bottom' ), 10 ), widthPadding = parseInt ( $ ( this ). css ( 'padding-left' ), 10 ) + parseInt ( $ ( this ). css ( 'padding-right' ), 10 ), titlebarMargin = parseInt ( $ ( this ). prev ( '.ui-dialog-titlebar' ). css ( 'margin-bottom' ), 10 ); $ ( this ). height ( $ ( this ). parent (). height () - $ ( this ). prev ( '.ui-dialog-titlebar' ). outerHeight ( true ) - heightPadding - titlebarMargin ); $ ( this ). width ( $ ( this ). prev ( '.ui-dialog-titlebar' ). outerWidth ( true ) - widthPadding ); },