console-application

Get IP address in a console application

和自甴很熟 提交于 2019-12-04 16:07:01
问题 I am looking to figure out what my IP address is from a console application. I am used to a web application by using the Request.ServerVariables collection and/or Request.UserHostAddress . How can this be done in a console app? 回答1: The easiest way to do this is as follows: using System; using System.Net; namespace ConsoleTest { class Program { static void Main() { String strHostName = string.Empty; // Getting Ip address of local machine... // First get the host name of local machine.

Unit Testing a Console Application inside Visual Studio

喜欢而已 提交于 2019-12-04 14:58:39
I have a Test Project in Visual Studio I'd like to use to test my console application with (in the same solution). I'm trying to set up tests which call the console app with specific parameters, and compare the actual output with what I expect, then do my usual Assert statements to appropriately pass/fail the test. The best way to do this, that I can come up with, is to execute the app exe with System.Diagnostics.Process inside the unit test. This works. I can read the output, and all is well. The problem I'm having is when I want to set a breakpoint inside the console app code, so I can do

How to upload file to OneDrive through console app?

你离开我真会死。 提交于 2019-12-04 14:37:35
I am trying to upload a file to OneDrive from within console app. After digging a bit into Google I found Live SDK but I couldn't find any article demonstrating file upload step by step using Live SDK . Is there any good resource explaining how to it? Thanks. The LiveSDK has a number of examples and template code that are hosted on Github, https://github.com/liveservices/LiveSDK-for-Windows . To see an example of how uploading is down you can explore the sample applications located at https://github.com/liveservices/LiveSDK-for-Windows/blob/master/src/Desktop/Samples/ApiExplorer/MainForm.cs

Calling console application from asp.net

≯℡__Kan透↙ 提交于 2019-12-04 13:44:35
问题 I try to call console appliction from asp.net when i put breakpoint in console app why it can't stop there.How can i call console application? var proc = Process.Start("D:\\Edefter\\EFaturaConsoleTxtParser\\bin\\Debug\\EFaturaConsoleTxtParser.exe", "/arg1 /arg2"); proc.WaitForExit(); 回答1: I'm not sure about this but anyway you can try ProcessStartInfo startinfo = new ProcessStartInfo(); startinfo.FileName =@"D:\\Edefter\\EFaturaConsoleTxtParser\\bin\\Debug\\EFaturaConsoleTxtParser.exe";

log4net console app not logging on publish

吃可爱长大的小学妹 提交于 2019-12-04 12:52:41
I have a console app using log4net (via Castle Windsor). Everything logs fine to the console when I debug, but when I publish and run the app, nothing is logged. I have my log4net configuration in a separate file (log4net.config). I'm thinking it's not finding the config file, but that's just a guess. I'm a web dev and haven't deployed many console apps. Am I missing something? Do I need to manually copy the log4net.config file to the exe directory? I'm on VS2010. app.config: <?xml version="1.0"?> <configuration> <configSections> <section name="castle" type="Castle.Windsor.Configuration

How to tell if a Delphi app “owns” its console?

人盡茶涼 提交于 2019-12-04 12:51:12
问题 A Delphi console application can be run from the command line of an existing console window, and it can be run by double-clicking on its icon. In the latter case it will create its own console window, and close it once the application terminates. How can I tell if my console application has created its own window? I want to detect this so that I can display a message like "Press Enter to close the window", to let the user read what's displayed before the window closes. Obviously, it wouldn't

qDebug Qt console application to output to Qt Creator application output

不打扰是莪最后的温柔 提交于 2019-12-04 12:28:31
问题 How do I use qDebug in a Qt console application to output to the Qt Creator "application output" window? Currently qDebug writes to the console window which interferes with the non-debug output. Using qDebug in a Qt GUI app outputs to application output window by default. 回答1: To redirect QDebug to multiple places, you might have to write some code, maybe like this: QList<QtMsgHandler> messageHandlers_; static void messageDispatcher(QtMsgType type, const char *msg) { foreach (QtMsgHandler

Dos based printing using C#.net

只谈情不闲聊 提交于 2019-12-04 12:18:48
i m using Dotmatrix printer EPSON for printing the reports, and i need the of how to print the reports without using crystalReport and print dialog, i.e. i want the code for DOS based printing in C#.net......... I know a very old and dirty way. Just open LPT1 (or the printer port you are using) as a stream and output the characters. Maybe this will help? http://support.microsoft.com/kb/322091/EN-US Does your printer appear in windows? In other words, can your print to it from notepad? Then you can still use the System.Drawing.Printing namespace and send data to your printer that way. This is

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

别等时光非礼了梦想. 提交于 2019-12-04 11:17:28
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. Losiowaty If you want to keep your application in a console, but want to do some layouts I'd recommend using ncurses as it gives you more control on where you print, and also gives you a possibility to create

Batch Script to Automate a DOS Program with Options

守給你的承諾、 提交于 2019-12-04 11:13:33
I have a console program ( a DOS program) that requires interactive input. After typing in the command line, for example commandline.exe /ShowReport The DOS prompt will prompt user to key in some values, and then proceed to the next interactive input. For example, when I typed in the above command, the console will prompt me with the following options: press '1' to show Report A press '2' to Show Report B And I would press '1' if I want to show report A. The issue now is I want to automate all these things by presetting all the input values in a script files. Maybe something like this ( I don