console-application

Mathematical expression result assigned to a Bash variable

陌路散爱 提交于 2021-02-05 07:57:45
问题 How do I save the result of evaluating a mathematical expression to a variable using bash? My code is the following: W1=$(bpimagelist -U -d 11/01/2013 00:00:00 -e 11/05/2013 00:00:00 -pt FlashBackup-Windows | tail -n +3 | awk '{s+=$5} END {print s/1024/1024/1024}') W2=$(bpimagelist -U -d 11/01/2013 00:00:00 -e 11/05/2013 00:00:00 -pt MS-Windows | tail -n +3 | awk '{s+=$5} END {print s/1024/1024/1024}') echo "$W1+$W2" | bc | awk '{printf "%.02f\n", $1}' Console Output: 96.86 I am looking for a

Masking the user input as asterisks in Windows?

淺唱寂寞╮ 提交于 2021-02-05 06:43:26
问题 I need to create a simple password program where the program asks user to input password and when user inputs, it shows the characters as asterisks. Every tutorial out there uses getch() (in conio.h ). But I don't want to use it. Is there any easy alternative for doing so? I'm using Windows 10. P.S: Please don't confuse this to be a duplicate of this question: Alternative function in iostream.h for getch() of conio.h? Because that question asks for holding screen output whereas I need to mask

Masking the user input as asterisks in Windows?

落花浮王杯 提交于 2021-02-05 06:43:24
问题 I need to create a simple password program where the program asks user to input password and when user inputs, it shows the characters as asterisks. Every tutorial out there uses getch() (in conio.h ). But I don't want to use it. Is there any easy alternative for doing so? I'm using Windows 10. P.S: Please don't confuse this to be a duplicate of this question: Alternative function in iostream.h for getch() of conio.h? Because that question asks for holding screen output whereas I need to mask

Rust println! problem - weird behavior inside the println macro [duplicate]

若如初见. 提交于 2021-01-29 17:50:15
问题 This question already has answers here : Why does my string not match when reading user input from stdin? (3 answers) Closed 1 year ago . I am currently working on a simple "user input" program. The user can enter a number, which I get with std::io::stdin().read_line(&mut let_name_here).ok().expect("Error"); . After getting the user input I want to print it to the console for a review. I have noticed strange behavior within the println! macro. The following code println!("Your input: {}", let

Making a console-app game, how would I randomly generate the positions of Rooms?

泄露秘密 提交于 2021-01-29 15:18:55
问题 Here's what I'm trying to do: I have a class called RandomRoomGenerator, which has a method called GenerateRoom. This GenerateRoom method is called inside my main method based on the grid size(the width or height) multiplied by itself to get the total number of rooms. The method itself creates a new room with parameters chosen randomly from my ItemDB and RandomRoomValues. The problem is, I need a way to generate the room's position without it overlapping previously generated rooms. So far I

How to close an Excel instance if the Python console program gets interrupted and closed?

扶醉桌前 提交于 2021-01-29 08:31:27
问题 I'm trying to figure out how to close an Excel instance properly if the Python console program is interrupted and closed while executing. Below is a minimal reproducible example: # import pythoncom import traceback import win32com.client import win32api def exit_handler(arg): file = open('Log.txt', 'w') file.write(f'{repr(workbook)}\n{repr(excel_application)}\n') try: # pythoncom.CoInitialize() workbook.Close(SaveChanges=False) excel_application.Quit() except Exception: file.write(traceback

Is it possible to set the window title of my console app without setting Console.Title?

我是研究僧i 提交于 2021-01-29 08:08:00
问题 When my console app first runs, I execute Console.Title = "whatever" to change the window's title. What bugs me is that there is that split second where the console window's title is the path to the EXE itself. I'd like to think that there's a way to set the title so that it's stored in the application settings itself so that I don't have to set it with code. 回答1: Perhaps run it as with a batch file called "my_console_app.bat"? start "My display name" my_console_app.exe 来源: https:/

Crop Image with multiple X and Y points c#

人盡茶涼 提交于 2021-01-29 06:46:27
问题 I have images that I need to crop and have multiple X,Y co-ordinates to cut out the business card or paper. What would be the best way to do it. My Co Ordinates is the following. X: 490, y: 0 X: 1442, y: 0 X: 1442, y: 4031 X: 490, y: 4031 回答1: You could check out the KeyStoneCommand from the Leadtools Image Processing Nuget This Nuget package also includes a detect document ip command that you can use if you don't know the bounding box of the business card that will detect and give you back

How to fix Console output when Console.ReadKey receives an Escape key in C#?

ぃ、小莉子 提交于 2021-01-29 06:09:42
问题 I want to read user inputs from a C# console application targeting .NET Core 3.1. In some situations, the user shall have the choice to cancel the input and the related operation by pressing the Escape key at any point of time when the user is prompted for input. The following script works for empty strings (user just hit Enter and nothing else), and normal user input (user enters characters and confirms with Enter ). But there is a issue: When the user cancels the input (hits Escape ), the

How do I enable logging for HttpClient in a .NET Core console app?

夙愿已清 提交于 2021-01-29 03:25:57
问题 .NET Core 2.2 I have a basic CLI created with dotnet new console . It uses HttpClient to make web requests. How can I see trace or logging information about these requests? Data like this: https://www.stevejgordon.co.uk/httpclientfactory-asp-net-core-logging In the .NET Framework, you could turn on System Tracing: https://docs.microsoft.com/en-us/dotnet/framework/network-programming/how-to-configure-network-tracing 回答1: In your appsettings.json file there will be an object which looks similar