console-application

TaskKill for killing .NET console application

ぃ、小莉子 提交于 2019-12-13 06:44:50
问题 I have a bunch of console host applications hosting WCF services. I'm calling a .bat file as a pre build step to kill any running host instances so that I don't get WCF channel registrations errors(manually killing the console hosts each time before a build is a royal pain). The .bat file I've created contains the following. taskkill /T /F /FI "imagename eq Host.vshost.exe" taskkill /T /F /FI "imagename eq Host.exe" exit /B 0 This kills both processes. I can see in taskmanager that Host.exe

Displaying datarows underneath each other

北慕城南 提交于 2019-12-13 06:43:26
问题 How can I loop through a datatable so that the rows display neatly underneath one another,row by row. what I have tried is the following but like this all the data displays in one column. foreach (DataRow row in myTopTenData.Rows) { foreach (DataColumn col in myTopTenData.Columns) { Console.Write(row[col].ToString() + " "); Console.WriteLine(); } } 回答1: foreach (DataRow row in myTopTenData.Rows) { foreach (DataColumn col in myTopTenData.Columns) Console.Write(string.Format("{0, -10}", row[col

Date Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM OverFlow error SqlBulkCopy [duplicate]

本秂侑毒 提交于 2019-12-13 06:40:35
问题 This question already has answers here : Error - SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM (12 answers) Closed 4 years ago . I am reading data from an access db and storing it in a temporary sql table then truncate the main sql table and insert the fresh data set and i am accomplishing that task using the code below but the datetime is giving me issues: Console.WriteLine("NetWeightTracking-Abilene Started"); var du = new System.Data.DataTable();

Checking if website is working and login

大兔子大兔子 提交于 2019-12-13 05:48:35
问题 I am on a project and part of it should do the following; 1) it should check the website if it is working or not. If it is working,its okey.If not it should send a e-mail. 2)With username and password it should login the website and again if it is not logged in it should send a e-mail. It is a console application so i want to enter website,username,password on console and let the program do the above. I am using these codes to send e-mail and it is okey but for the rest,i saw so many codes

View Output in a Batch (.bat) file from C# code

我是研究僧i 提交于 2019-12-13 05:29:40
问题 I have an c# code to execute the batch file. I want to show the information in the bat file in the command prompt. Here is my new edited c# code: namespace CheckTime { class Program { static void Main(string[] args) { Program Obj = new Program(); int greetingId; int hourNow = System.DateTime.Now.Hour; if (hourNow < 12) greetingId = 0; else if (hourNow < 18) greetingId = 1; else greetingId = 2; System.Environment.ExitCode = greetingId; Obj.StartBatchFile(greetingId); } void StartBatchFile(int

Executable isn't compatible with 64 bits processor

倖福魔咒の 提交于 2019-12-13 04:36:10
问题 My problem is that this: When I try to execute an .exe assembled in NASM and Windows 8 64 bits tells me that this .exe isn't compatible with 64 bits. So, how should I assemble this code (I obtained it from the Web)? Used code STD_OUTPUT_HANDLE equ -11 STD_INPUT_HANDLE equ -10 NULL equ 0 global start extern ExitProcess, GetStdHandle, WriteConsoleA, ReadConsoleInputA section .data ;message we want to display on console msg db "Press a key to continue...", 13, 10, 0 msg.len equ $ - msg

Collect stdout output from a console app with C++

杀马特。学长 韩版系。学妹 提交于 2019-12-13 04:28:03
问题 I have a console application written with C++. Is there any way to collect all stdout output from it to string/pipe/memory array? PS. I need to do this from within the console app that I'm needing to collect stdout from. Or, in other words, it is collecting from itself. 回答1: Yes. To redirect it to a string , you can use a std::stringstream std::stringstream buffer; std::streambuf * old = std::cout.rdbuf(buffer.rdbuf()); Then, if you do: std::cout << "Example output" << std::endl; std::string

Console application not starting processes when scheduled in Windows

て烟熏妆下的殇ゞ 提交于 2019-12-13 03:48:01
问题 I have a simple .NET console app in C#, that runs an external process "pscp" (putty secure copy). This works great when I just run the .exe. However, when I schedule the application in windows scheduled tasks, the application does not seem to open the external process pscp.exe. Normally it should pop up an extra console screen and open pscp.exe there. This works, just not when scheduled. I start the process like this: pscp.FileName = "pscp.exe"; Process p = Process.Start(pscp); p.WaitForExit(

Convert CSV file from any type to UTF-8

放肆的年华 提交于 2019-12-13 03:18:14
问题 Hello I am creating a simple console application in vb.net in order to convert a file from any type to utf8 but i can't figure out how this thing works with the encoding. I know that the source file is in Unicode, but when i convert it to a new format i get junk. Any suggestions? i am not sure if my code is correct this is my code. Imports System.IO Imports System.Text Module Module1 Sub Main() Console.Write("Please give the filepath (example:c:/tesfile.csv):") Dim filepath As String =

main function call fails in python

ぃ、小莉子 提交于 2019-12-13 01:27:51
问题 I wrote the following code that creates a layout and displays some text in the layout. Next the layout is displayed on the console screen using raw display module from urwid library. However running the code fails as it doesn't find the function main that I wrote separately in a class. Error code on running is : Traceback (most recent call last): File "./yamlUrwidUIPhase5.py", line 89, in <module> main() File "./yamlUrwidUIPhase5.py", line 83, in main FormDisplay().main() AttributeError: