windows

Why does the same vsnprintf code output differently on Windows (MSVC) and Unix (Clang)

你说的曾经没有我的故事 提交于 2021-02-16 18:51:15
问题 On Unix (Clang 3.8.1), this code outputs: 6: 32 8: a8e On Windows (MSVC 19.00.24215.1), this code outputs: 6: 12345 6: a12345e #include <iostream> #include <stdarg.h> static std::string getFormattedString(const char* fmt, va_list ap) { int count = vsnprintf(NULL, 0, fmt, ap) + 1; std::cout << count << ": "; if (count <= 0) { return "unable to format message"; } std::string result = std::string(count, '\0'); if (vsnprintf(&result[0], count, fmt, ap) < 0) { return "error";} return result; }

Python multiprocessing module, Windows, spawn new console window with the creation of a new process

你说的曾经没有我的故事 提交于 2021-02-16 16:52:02
问题 I've done some research on this and found somewhat similar questions but none answer what I'm really looking for. I understand how to create and use processes with the multiprocessing module. But when I create a new process, I would like to spawn a new console window just for the use of that process, for printing and so on, so that the child processes don't share the parent process's console window. Is there a way of doing that with the multiprocessing module? 回答1: If you're going to spawn a

Python multiprocessing module, Windows, spawn new console window with the creation of a new process

末鹿安然 提交于 2021-02-16 16:51:10
问题 I've done some research on this and found somewhat similar questions but none answer what I'm really looking for. I understand how to create and use processes with the multiprocessing module. But when I create a new process, I would like to spawn a new console window just for the use of that process, for printing and so on, so that the child processes don't share the parent process's console window. Is there a way of doing that with the multiprocessing module? 回答1: If you're going to spawn a

Set environment variable (PGPASSWORD) before executing a command (pg_dump) on Windows SSH server in Paramiko

妖精的绣舞 提交于 2021-02-16 15:14:28
问题 I want to create a backup of my postgres database via SSH connecting to a Windows Server 2019. I use the Paramiko Python library in order to do this, but unfortunately the sql-file does not contain any data (file size is 0 and files cannot not deleted as they are still opened in cmd). Thus, I suspect the execution of my command hasn't finished ... This is my function: def ssh_server(server, username, password, pg_pass, ps_user, database): client = paramiko.SSHClient() client.load_system_host

Can't build mod_wsgi on Windows 10 - “Cannot open include file: 'ws2tcpip.h'” - Have VS 2019 Build tools

随声附和 提交于 2021-02-16 15:10:14
问题 I have apache 2.4 installed (64 bit), python 3.7 (64 bit) (installed from Anaconda, if that matters) and VS 2019 C++ build tools, with the SDK and everything else required to build this checked. I still cannot build mod_wsgi with pip install. How can I get this to work on Windows 10? I have tried uninstalling and reinstalling, python, visual studio & visual studio build tools, and apache. I have tried all the various visual studio command prompts. I have checked stack overflow, github, and

Can't build mod_wsgi on Windows 10 - “Cannot open include file: 'ws2tcpip.h'” - Have VS 2019 Build tools

跟風遠走 提交于 2021-02-16 15:09:41
问题 I have apache 2.4 installed (64 bit), python 3.7 (64 bit) (installed from Anaconda, if that matters) and VS 2019 C++ build tools, with the SDK and everything else required to build this checked. I still cannot build mod_wsgi with pip install. How can I get this to work on Windows 10? I have tried uninstalling and reinstalling, python, visual studio & visual studio build tools, and apache. I have tried all the various visual studio command prompts. I have checked stack overflow, github, and

In a batch file, how do I get a file name from a file path?

百般思念 提交于 2021-02-16 14:36:09
问题 I have a batch file that requires the user to enter a file path. Later on in the file I want to isolate just the filename and extention from the path, ie anything after the last '\'. set FILEPATH=\\srv-01\My Docs\Templates\My SpreadSheet.xls ... set FILENAME=??? What do i need to set FILENAME to in order for it to equal 'My SpreadSheet.xls'? Hopefully this is fairly simple to do. Thanks! 回答1: @echo off set FILEPATH=\\srv-01\My Docs\Templates\My SpreadSheet.xls for /F "delims=" %%A in ("

'choco' command not recognized when run as administrator on Windows

╄→гoц情女王★ 提交于 2021-02-15 10:45:56
问题 I installed Chocolatey as per the instructions on the website (https://chocolatey.org/install). The 'choco' command works fine when I run it normally on cmd but returns the following error when run as administrator: C:\WINDOWS\system32>choco install -y wget 7zip.commandline 'choco' is not recognized as an internal or external command, operable program or batch file. The install choco install -y wget 7zip.commandline fails if not run as administrator. How do I fix 'not recognized' error in

How to get tensorflow-gpu v2 working on Windows with NVidia GPU

落爺英雄遲暮 提交于 2021-02-15 07:39:45
问题 What are the steps to get tensorflow-gpu 2.x Python package working on Windows with an NVidia GPU? I.e. how can I get rid of Could not find 'cudart64_101.dll' and then Could not find 'cudnn64_7.dll' ? 回答1: Steps Requires specific versions according to the error messages you see, not latest versions! 1. Download and install latest NVidia driver https://www.nvidia.com/Download/index.aspx 2. Install Tensorflow Python package pip uninstall tensorflow pip install tensorflow-gpu 3. Test At first

Could someone explain C++ escape character “ \ ” in relation to Windows file system?

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-15 07:18:32
问题 I'm really confused about the escape character " \ " and its relation to the windows file system. In the following example: char* fwdslash = "c:/myfolder/myfile.txt"; char* backslash = "c:\myfolder\myfile.txt"; char* dblbackslash = "c:\\myfolder\\myfile.txt"; std::ifstream file(fwdslash); // Works std::ifstream file(dblbackslash); // Works std::ifstream file(backslash); // Doesn't work I get what you are doing here is escaping a special character so you can use it in this string. In no way by