Compare performances converting 2-D array to string 比較將二維陣列轉為字串速度
In Golang with basic, multithread, string.Join and combinations.
In Golang with basic, multithread, string.Join and combinations.
跟同事C一起弄Twilio 網頁端視訊聊天室,先前都很正常,最近卻開始出現了奇妙的狀況。深究原因是因為async的 api request, 加上 Twilio 會在最後一個聊天室成員離開後就將其關閉造成。
Unity 可以將專案 deploy 到 web 環境中執行,但此時送 http api request 的時候,就會有 CORS 需要處理。
Sometimes, we just want to release a single .exe file without a mass of .dll library files. This makes users easier to copy the file, and does not unveil the information of libraries used in the program.
清爽易閱讀且詳細的說明文件真的很重要
using System.Diagnostics; [STAThread] public static void Main() { StackTrace stackTrace = new StackTrace(); // get call stack StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames) // write call stack method names foreach (StackFrame stackFrame in stackFrames) { Console.WriteLine(stackFrame.GetMethod().Name); // write method name } } Ref: http://www.csharp-examples.net/reflection-callstack/
之前在這一篇有簡短提到過,沒想到事隔四五年又遇到要寫這樣程式的機會,順便整理一下吧。
Using javascript and XMLHTTPRequest to upload file/image.
做個紀錄 socket = dotNetObject “System.Net.Sockets.Socket” (dotnetclass “System.Net.Sockets.AddressFamily”).InterNetwork (dotnetclass “System.Net.Sockets.SocketType”).Stream (dotnetclass “System.Net.Sockets.ProtocolType”).Tcp socket.connect ip_address port buf = DotNetObject “System.Byte[]” 1000 fn doFaceShiftSocket = ( try ( while socket.Connected == true do ( socket.Receive buf ) ) catch ( — do nothing ) ) thread = dotNetObject “system.componentModel.backgroundWorker” dotnet.addEventHandler thread “DoWork” doFaceShiftSocket thread.WorkerSupportsCancellation = true thread.runWorkerAsync() for […]
喵的,以前學的時候都不知道 union 可以在什麼地方用到,原來這樣的用途才是王道… union { float f; uchar b[4]; } u; u.b[3] = b0; u.b[2] = b1; u.b[1] = b2; u.b[0] = b3; return u.f; Ref: http://stackoverflow.com/questions/3991478/building-a-32bit-float-out-of-its-4-composite-bytes-c