console-application

Invoke a method in a Console application that is currently running.

送分小仙女□ 提交于 2019-12-24 19:31:48
问题 I have a console application I wrote in C# that polls multiple devices, collects some data, and stores the information on a database. The application runs on our web server, and I was wondering how to invoke a method call from the command console (so I can exec a command from php that will be read by the console application, a shell command would work as well). Anyone got any ideas? I've been floating around 'the google' and have found nothing that will supply my current needs. Also, i'm not

How do I convert an inputted string of numbers into an int array?

▼魔方 西西 提交于 2019-12-24 14:43:14
问题 My programming assignment is to perform addition and subtraction operations with large integers up to 20 digits in length by using arrays. The instructions tell us to perform the arithmetic operations when digits are stored starting from the end of the array. For example: string value1 = ""; cin >> value1; //input 1234 test[19] = 4; test[18] = 3; test[17] = 2; test[16] = 1; so it'll be easier to perform sum and difference operations. Any unused digits should be initialized to 0. I started off

ASP.NET slower than Console Application

放肆的年华 提交于 2019-12-24 11:29:55
问题 I have an application that takes a bunch of data and processes it in a series of cycles that are very time consuming. The finished result should be accessible via an HTTP API. I decided to create a core library that does the processing, and an ASP.NET application that starts the processes on new threads. The core library spawns 4 threads which process objects from queues. However, this turns out to be significantly slower than just running the processing in a simple console application. In my

C# Console application: Console.Readkey() has odd initial skipping behaviour on high framerates

谁说胖子不能爱 提交于 2019-12-24 11:28:52
问题 For the challenge and educational gain, i am currently trying to make a simple game in the console window . I use a very primitive "locked" framerate system as such: using System.Threading; // ... static private void Main(string[] args) { AutoResetEvent autoEvent = new AutoResetEvent(false); Timer timer = new Timer(Update); timer.Change(0, GameSpeed); autoEvent.WaitOne(); } So, a timer ticks every GameSpeed miliseconds, and calls the method Update() . The way that i have understood input in

print to screen from c console application overwriting current line

浪子不回头ぞ 提交于 2019-12-24 09:18:57
问题 I want to overwrite the current line in a c console program to achieve output like in the linux shell command "top". If possible the method should work under windows and linux. while (i < 100) { i++; sprintf(cTmp, "%3d", i); puts(cTmp); if ((character = mygetch()) == 'q') { break; } } I would like to overwrite the previous number in each iteration and if possible look if the user entered a character without pausing the loop. If the user presses the key 'q' the loop should stop immediately.

WriteableBitmapEx in console application?

Deadly 提交于 2019-12-24 08:58:50
问题 I was wondering if it's possible to use the WriteableBitmap class / the WriteableBitmapEx framework in an ordinary C# console application? I have tried to add it via nuget and also included a using statement for System.Windows.Media.Imaging, but the type is not being recognized. 回答1: The System.Windows.Media.Imaging namespace resides in the PresentationCore.dll. In your project explorer, right click on References and pick "Add Reference...", then chose PresentationCore. 来源: https:/

How do I get accounts from Azure AD?

99封情书 提交于 2019-12-24 07:39:11
问题 I have a nice Azure Active Directory set up with a dozen users. (All me!) So I have a Tenant ID, client ID and Client Secret. I am also working on a simple console application that will function as a public client for this directory. This client also holds a list of usernames and passwords as this is just meant as a simple experiment. Not secure, I know. But I first need to understand how it works ... I do this: IConfidentialClientApplication client = ConfidentialClientApplicationBuilder

Get count of all commas in a each line from csv file

拟墨画扇 提交于 2019-12-24 05:06:08
问题 What I'm trying to accomplish is to read CSV file and get the count of commas in each row. ALL CSV files are identical. Have 9 columns and they are separated by (,) So I wrote a simple function that reads the files and using foreach loop I read each line in the file. public static void readCSVFile(string path) { string _path = path; string [] text = File.ReadAllLines(_path); foreach (string line in text) { string currentLine = line; Console.WriteLine("\t" + line); } } So typically currentLine

Console application can't connect to sql server instance from server, but can from local machine

一世执手 提交于 2019-12-24 03:13:15
问题 I have a few asp.net web applications running on a dedicated server.. For one of the websites, I am doing a maintenance task of upgrading all user uploaded images to new naming convention. I wrote a small, simple console application to do that job. I put the connection string in my app.config like so: <add key="CS" value="Data Source=1.1.1.1;Initial Catalog=MyDatabase;User ID=usr; Password=pwd" /> Of course, the details here are dummy they are not actually MyDatabase etc... but I do connect

Call a function in a console app from VBScript

风格不统一 提交于 2019-12-24 02:33:25
问题 I have a console app, myapp.exe. Within the app is a function, let's call it: public static int AddIntegers(int a, int b) Is it possible to make this function visible externally so that a VBscript could call it? Do I have to move the function into a DLL or can I leave it in the EXE and make it visible? If so, how? 回答1: Idealistically, you should be making a DLL and set Com Visible on the functions you need to expose. using System; using System.Runtime.InteropServices; namespace MyDLL {