Skip to content
Recent Posts
- Obtain global IP in bash - In current Internet environment, every PC is assigned a private IP. If global IP is necessary, the router the PC is connecting has the IP. But accessing the router typically needs the password to access that should not appear on a bash script. If you access http://checkip.dydns.com/, it returns the global IP, then the bash… Continue reading Obtain global IP in bash
- Create log file in the directory of the script in Python - __file__ is the script file itself. From python3.9 above, it is an absolute path, otherwise the path passed by command line. os.path.join joins two paths. realpath returns a absolute path, it also resolves symbolic links. You can also call abspath or normpath. dirname returns the directory. splitext returns list of strings split by extension.
- RichTextBox’s font changes automatically in C# - You need to clear these two flags IMF_DUALFONT and IMF_AUTOFONT to keep font unchanged.
- Test post to check image URL - This is an image inserted by wordpress ‘Add Media’
- msbuild says ‘target does not exist’ - I don’t know what is going wrong but… How to fix it Open the solution in Visual Studio Remove every targets except the target you want to build with ‘msbuild’ save the solution Add all the targets just removed before save the solution This makes the order of projects in the solution. Does msbuild fails… Continue reading msbuild says ‘target does not exist’
- Creating a break point that hits on calling win32 api - Create a break point that hits when CreateProcess was called Enter a Function Breakpoint Enter {,,kernel32.dll}CreateProcessW in the textbox labelled as ‘Function Name’. Showing call stack First, the break point might not hit in the main thread, in that case choose the main thread or other thread that you expect to call CreateProcess. For example,… Continue reading Creating a break point that hits on calling win32 api
- Basic usage of unique_ptr and custom free of it - #include <Windows.h> #include <iostream> #include <memory> #pragma comment(lib, "Shell32.lib") using namespace std; class MyClass { public: MyClass() { cout << "ctor" << endl; } ~MyClass() { cout << "dtor" << endl; } }; int main() { { // basic unique_ptr<MyClass> p1(new MyClass); unique_ptr<MyClass> p2 = make_unique<MyClass>(); } { int* pI… Continue reading Basic usage of unique_ptr and custom free of it
- “new.h” or “ctype.h” is missing in Visual Studio 2017 - Visual Studio has some bugs to not find install component properly. If you encounter this error, take a following step. 1, Launch Visual Studio Installer. If it starts to update itself. The problem may be fixed. Just update it (not install any components). 2, Launch your Solution. If Visual Studio failed to load projects properly,… Continue reading “new.h” or “ctype.h” is missing in Visual Studio 2017
- Welcome to the Gutenberg Editor - The goal of this new editor is to make adding rich content to WordPress simple and enjoyable. This whole post is composed of pieces of content—somewhat similar to LEGO bricks—that you can move around and interact with. Move your cursor around and you’ll notice the different blocks light up with outlines and arrows. Press the… Continue reading Welcome to the Gutenberg Editor
- C2678: binary ‘=’: no operator found which takes a left-hand operand of type ‘const XXX’ (or there is no acceptable conversion) - If it lacks a ‘const’, this error occurs.
- qmake fails after lrelease failed - Project ERROR: Failed to run: 'lrelease.exe' In 64bit Windows environment, 64bit and 32bit application have some different properties like the environment variables. You should use 64bit Command Prompt or Explorer to build a project with qmake in 64bit Windows.
- Visual Studio’s resource editor fails to open a Form because the class is not the first class in the header file (C++/CLI) - Suppose you have a following header file and tries to open it in the resource editor of Visual Studio. namespace Ambiesoft { using namespace System; ref class EncComboItem; ref class CSearchURL; ref class AddHttpDicDialog : public System::Windows::Forms::Form { ... } }namespace Ambiesoft { using namespace System; ref class EncComboItem; ref class CSearchURL; ref… Continue reading Visual Studio’s resource editor fails to open a Form because the class is not the first class in the header file (C++/CLI)
- Ruby does not run with missing _wfreopen_s - I do not know what causes this. But I upload my own build of ruby built with VC9. This must be run in Windows XP. https://onedrive.live.com/?id=F0D9DDC561F5CF32%212276&cid=F0D9DDC561F5CF32
- Firefox keeps asking to set it as a default browser - Run the following command as normal user and as administrator. firefox.exe -silent -setDefaultBrowser uninstall\helper.exe /SetAsDefaultAppGlobal uninstall\helper.exe /SetAsDefaultAppUser
- warning LNK4075: ignoring ‘/EDITANDCONTINUE’ due to ‘/SAFESEH’ specification - When you upgraded your VC++ project to Visual Studio 2013 or later(?), this warning appears. It looks like VS failed to upgrade projects properly. <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='UnicodeDebug|Win32'" Label="Configuration"> <ConfigurationType>Application</ConfigurationType> <PlatformToolset>v120</PlatformToolset> <UseOfMfc>Dynamic</UseOfMfc> <CharacterSet>Unicode</CharacterSet> </PropertyGroup> It needs to add “<UseDebugLibraries>true</UseDebugLibraries>” to your *.vcxproj file. See the following fixed file. In a Release configuration, it needs to set false… Continue reading warning LNK4075: ignoring ‘/EDITANDCONTINUE’ due to ‘/SAFESEH’ specification
- BadImageFormatException not handled - This exception occurs when AnyCpu-C# app tries to load X86 assembly in 64bit environment. Change the app configuration to X86 or prepare X64 assembly to load.
- Install of VS2017 broke VC#2008 coloader80.dll configuration - Open command prompt with Admin priviledge and do followings. regsvr32 "%CommonProgramFiles%\Microsoft Shared\VS7Debug\coloader80.dll"regsvr32 "%CommonProgramFiles%\Microsoft Shared\VS7Debug\coloader80.dll" if it fails, do this. regsvr32 "%CommonProgramFiles(x86)%\Microsoft Shared\VS7Debug\coloader80.dll"regsvr32 "%CommonProgramFiles(x86)%\Microsoft Shared\VS7Debug\coloader80.dll"
- CMake could not find boost - Create a new CMakeFiles.txt below in a new folder. cmake_minimum_required(VERSION 3.7) set(Boost_DEBUG 1) set(Boost_DETAILED_FAILURE_MSG 1) set(Boost_INCLUDE_DIR Y:/L/boost_1_53_0) set(Boost_LIBRARY_DIR Y:/L/boost_1_53_0/lib) set(Boost_USE_STATIC_LIBS ON) set(Boost_USE_MULTITHREADED ON) find_package(Boost 1.53 REQUIRED COMPONENTS date_time filesystem iostreams) include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIR}) Adjust Boost_INCLUDE_DIR and Boost_LIBRARY_DIR to your environment and try to switch ON and OFF for Boost_USE_STATIC_LIBS and Boost_USE_MULTITHREADED.
- How to check Windows or process is 64bit - typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); bool Is64BitWindows() { #if defined(_WIN64) return true; // 64-bit programs run only on Win64 #elif defined(_WIN32) // 32-bit programs run on both 32-bit and 64-bit Windows // so must sniff BOOL f64 = FALSE; LPFN_ISWOW64PROCESS fnIsWow64Process; fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "IsWow64Process"); if (NULL != fnIsWow64Process) { return !!(fnIsWow64Process(GetCurrentProcess(),… Continue reading How to check Windows or process is 64bit
- Visual Studio 2017 add a context menu item “Open With Visual Studio” on the shell extension of directory - Remove HKEY_CLASSES_ROOT\Directory\Background\shell\AnyCode and HKEY_CLASSES_ROOT\Directory\shell\AnyCode from Registry to delete it.