Monthly Archives: November 2018

bash exclamation (!)

在bash處理有帶!的字串要注意他本身有其他功用(history expansion),作為字串夾在double quote時 https://www.gnu.org/software/bash/manual/bashref.html#Double-Quotes Enclosing characters in double quotes (‘”’) preserves the literal value of all characters within the quotes, with the exception of ‘$’, ‘`’, ‘\’, and, when history expansion is enabled, ‘!’. 要注意的是escape !不可用 \ backslash\! 會是 \! … Continue reading

Posted in System Administration | Leave a comment

semaphore整理

In computer science, a semaphore is a variable or abstract data type used to control access to a common resource by multiple processes in a concurrent system such as a multitasking operating system. (In computer science, a semaphore is a … Continue reading

Posted in General | Leave a comment

regex lib

在使用c++11 regex時,需要注意在gcc 4.9.0前 regex的實作是c++0x的特別是CentOS預設的gcc版本是4.8.5,此時可改用boost::regex使用以下 參考: https://stackoverflow.com/questions/12530406/is-gcc-4-8-or-earlier-buggy-about-regular-expressions

Posted in C++ Language | Leave a comment

windows elevate UAC

在windows csharp的程式中,如果要一開始限定執行為administrator系統管理權限,可以在manifest檔註記參考 https://stackoverflow.com/questions/2818179/how-do-i-force-my-net-application-to-run-as-administrator <requestedExecutionLevel level=”requireAdministrator” uiAccess=”false” /> 或是用程式強制重新起始為系統管理權限(放在Main起始處)參考 https://itneverworksfirsttime.wordpress.com/2012/02/27/using-uac-to-request-administrative-privileges-from-c/ 另外實測時,如果是32bit程式,在某些情況會被windows7判定為安裝程式而跳出”This program might not have installed correctly”https://docs.microsoft.com/en-us/windows/desktop/SbsCs/application-manifests可用manifest繞過Program Compatibility Assistant(PCA)https://support.microsoft.com/en-my/help/2545347/excluding-programs-from-the-program-compatibility-assistant-pca

Posted in System Administration | Leave a comment