console-application

How do I make a console app always run as an administrator?

此生再无相见时 提交于 2019-12-04 08:31:30
问题 I have a console application that was developed to be called by a erp software. They call my app inside the erp and when they do it, i always get errors related to the insufficient permission to do it. I have checked the "run this program as an administrator" checkbox in the properties of the exe for all users but the result is the same. I have read something about adding a manifest that will make the app prompt for the uac dialog, but thats not what i want because the app will be called from

How can I use System.Web.Caching.Cache in a Console application?

主宰稳场 提交于 2019-12-04 08:04:00
问题 Context: .Net 3.5, C# I'd like to have caching mechanism in my Console application. Instead of re-inventing the wheel, I'd like to use System.Web.Caching.Cache (and that's a final decision, I can't use other caching framework, don't ask why). However, it looks like System.Web.Caching.Cache is supposed to run only in a valid HTTP context. My very simple snippet looks like this: using System; using System.Web.Caching; using System.Web; Cache c = new Cache(); try { c.Insert("a", 123); } catch

Issue using switch case statement [closed]

不羁岁月 提交于 2019-12-04 07:17:35
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 7 years ago . My code is as follows. Basically, I am reading an excel file and storing its contents into an object array. Then, I use a switch case statement to do

Cross platform, Interactive text-based interface with command completion

℡╲_俬逩灬. 提交于 2019-12-04 07:01:44
Does anyone know of a C++ library that will provide a text-based interactive interface? I want to create two versions of an application; a console based program that will perform whatever actions are given on the command line or interactively at the console as well as a GUI based program (Mac Cocoa and Windows MFC). Both versions will share a common C++ backend. For the console based program I would like similar history abilities to readline (which I cannot use as this application will be closed source) with command completion (Tab-activated for example). Perhaps there is something like this

Yii2 - Getting unknown property: yii\\console\\Application::user

坚强是说给别人听的谎言 提交于 2019-12-04 06:49:20
I am trying to run a console controller from the terminal, but i am getting this errors every time Error: Getting unknown property: yii\console\Application::user here is the controller class TestController extends \yii\console\Controller { public function actionIndex() { echo 'this is console action'; } } and this is the concole config return [ 'id' => 'app-console', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'controllerNamespace' => 'console\controllers', 'modules' => [], 'components' => [ 'log' => [ 'targets' => [ [ 'class' => 'yii\log\FileTarget', 'levels' => ['error', 'warning

Spawn processes, but only 5 at a time

我的梦境 提交于 2019-12-04 06:19:00
i'm working off a queue with filenames. Each file has to be processed by a external binary. This works fine, but it only processes one file at a time. Is it possible two spawn a number of processes parallel? Queue<string> queue = new Queue<string>(); queue.Enqueue("1.mp3"); queue.Enqueue("2.mp3"); queue.Enqueue("3.mp3"); ... queue.Enqueue("10000.mp3"); while (queue.Count > 0) { string file = queue.Dequeue(); Process p = new Process(); p.StartInfo.FileName = @"binary.exe"; p.StartInfo.Arguments = file; p.StartInfo.UseShellExecute = false; p.StartInfo.CreateNoWindow = true; p.StartInfo

How can I run a local Windows Application and have the output be piped into the Browser

给你一囗甜甜゛ 提交于 2019-12-04 05:22:36
I have Windows Application (.EXE file is written in C and built with MS-Visual Studio), that outputs ASCII text to stdout. I’m looking to enhance the ASCII text to include limited HTML with a few links. I’d like to invoke this application (.EXE File) and take the output of that application and pipe it into a Browser. This is not a one time thing, each new web page would be another run of the Local Application! The HTML/java-script application below has worked for me to execute the application, but the output has gone into a DOS Box windows and not to pipe it into the Browser. I’d like to

Why is console output so slow?

依然范特西╮ 提交于 2019-12-04 04:50:01
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? 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 with several processes so there is also some synchronization and buffering going on. 来源: https://stackoverflow

Need help with accepting decimals as input in C#

我与影子孤独终老i 提交于 2019-12-04 04:46:45
问题 I have written a program in C# that runs the Pythagorean Theorem. I would love some help on allowing the program to accept decimal points from the user input. This is what I have. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Project_2 { class Program { static void Main(string[] args) { int sideA = 0; int sideB = 0; double sideC = 0; Console.Write("Enter a integer for Side A "); sideA = Convert.ToInt16(Console.ReadLine()); Console.Write("Enter

Running a C# console application as a Windows service

旧巷老猫 提交于 2019-12-04 04:45:32
I have a basic C# console application that I would like to run as a Windows Service. I have created the Windows service using sc create . This worked fine, and I can see my service under services.msc . When I try and start this service I get the following error: Could not start the PROJECT service on Local Computer. Error 1053: The service did not respond to the start or control request in a timely fashion.` I read that this might be due to the service code taking longer than 30000 ms to execute. Therefore I removed the bulk of the code so that hardly anything is being executed.. yet the same