console-application

Is it good to have windows service or console application?

徘徊边缘 提交于 2019-12-04 04:38:27
I have a tasks table in my db. I want to read data from this table and run tasks. Which one is better whether to have it as windows service or a console application running. The server on which this will be run will not be shutdown Dave New You most likely want to use a windows service. Benefits: You can control the user (and the rights associated with this user account) which starts the process An automatically started process means the desktop need to be on, not user logged, for the service to run A policy on failure can be defined (try to restart n times run a specific program if fails) A

Displaying data of data table

大城市里の小女人 提交于 2019-12-04 04:16:55
I want to display values or write them to a text file that it is written as such from a data set ColumnID columnName ColumnFamilyName ValueOne ValueTwo ValueThree ValueThree ValueFour ValueFive ValueSix ValueSeven ValueEight I have done this which does not do the trick foreach (DataRow row in myTopTenData.Rows) { Console.WriteLine(); foreach (DataColumn col in myTopTenData.Columns) { Console.Write(row[0].ToString() + " "); } } How can I do this? I still can't post a comment but here is a quick answer: foreach(DataRow row in myTopTenData.Rows) { string ID = row["ColumnID"].ToString(); string

how can I write an ANSI C console screen buffer?

馋奶兔 提交于 2019-12-04 03:55:48
问题 I'm working on making an ASCII based game, and everywhere I look people are saying to use Console.Write() from MSDN, which is dandy and all if you're using Windows, but I'm not. And thus, I'm trying to write a function, or group of functions in C that can alternate between two screen buffers, and write them to the screen, similar to what man pages would be like, as well as pico, vim, and emacs. I have the buffer's working, and found an old ASCII game for linux called 0verkill that uses C and

How to get returned value of async Task<string> method name()?

随声附和 提交于 2019-12-04 03:40:05
I'm trying to get the return string of my method but the problem is I don't know how can I get the return value from public async Task<string> Login(string username, string password, string site) . This is my codes from Program.cs static void Main(string[] args) { var username = "Leonel.Sarmiento"; var password = "welcome"; var site = "QADBSite"; var url = "na1.sabacloud.com"; ConsoleCustomizer.Spinner Spinner = new ConsoleCustomizer.Spinner("+", "x", "+", "x"); ConsoleCustomizer.TypeWriter TypeWriter = new ConsoleCustomizer.TypeWriter(15, 150); ConsoleCustomizer.Alerts Alerts = new

.Net Core / Console Application / Configuration / XML

夙愿已清 提交于 2019-12-04 02:51:35
My first little venture into the .Net Core libraries using the new ConfigurationBuilder, and Options pattern. Lot's of good examples here: https://docs.asp.net/en/latest/fundamentals/configuration.html and a good copy of the example here Item 1. it says this can be used with non MVC applications, but no examples on how to use it without MVC - particularly if you are using a custom, strongly-typed class. I would like to see an example of showing the setup of DependencyInjection, Configuration, and Logging using a Console application . Item 2. it says you can write back, but no examples or

cout<< “привет”; or wcout<< L“привет”;

▼魔方 西西 提交于 2019-12-04 01:38:22
Why cout<< "привет"; works well while wcout<< L"привет"; does not? (in Qt Creator for linux) ArtemGr GCC and Clang defaults to treat the source file as UTF-8. Your Linux terminal is most probably configured to UTF-8 as well. So with cout<< "привет" there is a UTF-8 string which is printed in a UTF-8 terminal, all is well. wcout<< L"привет" depends on a proper Locale configuration in order to convert the wide characters into the terminal's character encoding. The Locale needs to be initialized in order for the conversion to work (the default "classic" aka "C" locale doesn't know how to convert

Why is AsyncContext needed when using async/await with a console application?

情到浓时终转凉″ 提交于 2019-12-04 00:55:45
I'm calling an async method within my console application. I don't want the app to quit shortly after it starts, i.e. before the awaitable tasks complete. It seems like I can do this: internal static void Main(string[] args) { try { Task.WaitAll(DoThisAsync()); } catch (Exception ex) { Console.Error.WriteLine(ex); throw; } } internal static async Task DoThisAsync() { //... } But according to Stephen Cleary's article it seems like I can't do that and should instead create some kind of context for the async to return to when it's done (e.g. AsyncContext ). The code above works though, and it

Converting a C# Console App to a DLL

荒凉一梦 提交于 2019-12-04 00:42:37
问题 I am rewriting the Betfair API to JSON from SOAP and I have started off the way I did it before as a console APP which is then called from a task scheduler or win service. However now I have been asked to do various different jobs with the code and I don't want to write a console app for each job (different sites want prices, bets placed etc) The new codebase is much larger than the old one and I would have been able to copy the 4 files from the old system into a DLL app and then create

Scala: Draw table to console

蓝咒 提交于 2019-12-03 23:57:05
I need to display a table in a console. My simple solution, if you would call it a "solution", is as follows: override def toString() = { var res = "\n" var counter = 1; res += stateDb._1 + "\n" res += " +----------------------------+\n" res += " + State Table +\n" res += " +----------------------------+\n" for (entry <- stateDb._2) { res += " | " + counter + "\t | " + entry._1 + " | " + entry._2 + " |\n" counter += 1; } res += " +----------------------------+\n" res += "\n" res } We don't have to argue this a is looking bad when displayed b code looks kinda messed up Actually, such a question

How to add App.Config file in Console Application

…衆ロ難τιáo~ 提交于 2019-12-03 23:27:18
I want to store the connection string and some parameters in app.config file which we generaly do for windows aplication but I can't find app.config file for console application. So how should I use this file, how to add this file or there is some other work arroud for the same functionality. I am working in console application Right click on application->Go to Add->you will see the exact picture What i have attached here->Pick the Application Config File. source: http://blog.nickgravelyn.com/2010/02/visual-studio-2010-xna-and-you/ Well, the other answers might have worked for others, but for