console-application

How to align output to center of screen - C++?

こ雲淡風輕ζ 提交于 2019-12-06 05:20:55
问题 I am working on a C++ console app. I want to execute and print all the stuffs at the center of app window screen ( horizontally + vertically) as shown below. -------------------------------- | | | | | User : xyz | | Pass : **** | | | | | -------------------------------- I want to run my whole program as how above. Is there any way to do so? Any help or suggestion would be appreciated. 回答1: If you want to keep your application in a console, but want to do some layouts I'd recommend using

How to pass HostControl instance to custom host service in TopShelf?

懵懂的女人 提交于 2019-12-06 05:07:57
This question has been asked elsewhere on SO , but there is no indication of how I get an instance of a HostControl as the post suggests. My TopShelf main program looks like this: public static void Main() { HostFactory.Run(CreateHost); } private static void CreateHost(HostConfigurator x) { x.UseLog4Net(); x.Service<EventBroker>(s => { s.ConstructUsing(name => new EventBroker()); s.WhenStarted(tc => tc.Start()); s.WhenStopped(tc => tc.Stop()); }); x.StartAutomatically(); x.RunAsNetworkService(); } Any suggestions? Change WhenStarted to have HostControl passed to it like this s.WhenStarted((tc,

ADAL user consent triggered even when admin has already consented

随声附和 提交于 2019-12-06 04:15:39
I've created a Web API which uses Azure Active Directory for its authentication. It uses a multi-tenant AAD. To test it, I also created a console app which uses the ADAL library to authenticate against AAD so I can access my API. In the main AAD tenant all is working well, because I don't need to grant anything. But when accessing the app from a second tenant, I first trigger the admin consent flow (adding a prompt=admin_consent ). But when I exit and open the app again, if I try to login with a user with no admin rights on the AAD, it tries to open the user consent and it fails (because the

Clearing a line in the console

本秂侑毒 提交于 2019-12-06 03:18:01
问题 How can a line in the console be cleared in C#? I know how to place the cursor at the beginning of a line: Console.SetCursorPosition(0, Console.CursorTop); 回答1: Simplest method would be to move to the start of the line, as you have done, and then write out a string of spaces the same length as the length of the line. Console.Write(new String(' ', Console.BufferWidth)); 回答2: Once the last space of a console buffer row is used, the console cursor automatically jumps to the next line. Reset

Unkillable console windows

和自甴很熟 提交于 2019-12-06 02:38:37
I'm developing an OpenGL based 2d simulation with GLUT under Visual C++ 2008, sometimes when I have an assert() or unhandled exception and break into the debugger, the GLUT display window closes, but the console window remains open.They just cant be killed!!! They do not show up with Task manager, Process Explorer or any other tool, I cannot find the window handle using the Spy++ tool either. Worst thing is they prevent my system (Windows XP) from shutting down, I have to manually poweroff (and of course I have to run chkdsk on my drives and invariably it finds and fixes minor errors after bad

Log SOAP messages from a console application

那年仲夏 提交于 2019-12-06 02:30:37
问题 I'm trying to log the requests and responses (the raw XML SOAP envelope) between a console application developed by me and a specific third party remote SOAP web service to database for audit purposes, and I can't find a way to do it. Ideally what I'd like to do is getting the request <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"> <soapenv:Header/> <soapenv:Body> <tem:SayHello> <tem:name>Albireo</tem:name> </tem:SayHello> </soapenv

convert xls to xlsm using excelcnv.exe

蓝咒 提交于 2019-12-06 01:04:33
i had create one console application. and use the microsoft ppcnvcom.exe, excelcnv.exe, wordconv.exe to convert the doc to docx, xls to xlsx and ppt to pptx. but can anyone know this how to convert xls to xlsm? OFC.exe is the one choice but when i called it from sharepoint it not converted successfully.some security issu is block the converter. OFC.exe automatically identify if xls have a macro in it then it convert to xlsm file. but i want this using excelcnv.exe ? have any idea? Unfortunately, no, you can't do this with excelcnv.exe as it requires a file name. It would be wonky to name all

C# Console Application - How to draw in BMP/JPG file using GDI+?

匆匆过客 提交于 2019-12-06 00:24:34
I want to draw shapes like rectangles, arrows, text, lines in a BMP or JPG file, using a C# Console Application and GDI+. This is what I found on the web: c# save System.Drawing.Graphics to file c# save System.Drawing.Graphics to file GDI+ Tutorial for Beginners http://www.c-sharpcorner.com/UploadFile/mahesh/gdi_plus12092005070041AM/gdi_plus.aspx Professional C# - Graphics with GDI+ codeproject.com/Articles/1355/Professional-C-Graphics-with-GDI But this still doesn't help me. Some of these links explains this only for a Windows Forms Application and other links are only for reference (MSDN

How to include a newline in the python raw_input() function?

*爱你&永不变心* 提交于 2019-12-06 00:15:59
问题 I'm using raw_input() to storing a message inside a variable. So I can't press enter for a carriage return/new line to start a new paragraph. Right now if I press enter it will just proceed to the next portion of my program. I already tried something like this: >>> message = raw_input("Message: ") Message: Hello Sir, \n It's great that.. >>> message "Hello Sir, \\n It's great that.." >>> It didn't worked, and I also tried enclosing it in single and double quotes, which also didn't worked. I

Why is console output so slow?

人盡茶涼 提交于 2019-12-05 21:58:31
问题 So I have noticed this while using a few differnt languages on Windows XP, Vista and 7. If you dump a couple thousand lines a second to the console window it generally has a negative impact on the performance of the system. Computer are fast, and always faster, and the console looks like just some text on a back ground. Where is the bottle neck? 回答1: printf etc has to go from your process with some sort of IPC to the Console window process (csrss or conhost) The console can also be shared