console-application

C# Console Application - How to draw in BMP/JPG file using GDI+?

无人久伴 提交于 2019-12-07 12:22:36
问题 I want to draw shapes like rectangles, arrows, text, lines in a BMP or JPG file, using a C# Console Application and GDI+. This is what I found on the web: c# save System.Drawing.Graphics to file c# save System.Drawing.Graphics to file GDI+ Tutorial for Beginners http://www.c-sharpcorner.com/UploadFile/mahesh/gdi_plus12092005070041AM/gdi_plus.aspx Professional C# - Graphics with GDI+ codeproject.com/Articles/1355/Professional-C-Graphics-with-GDI But this still doesn't help me. Some of these

using curses with raw_input in python

ε祈祈猫儿з 提交于 2019-12-07 11:38:23
问题 In my python linux console application I use curses to handle displaying of data. At the same time I'd like to have an input line to enter commands, pretty much in good ol' irssi-style. With default curses getch() I'd have to do a lot of coding just to get the basic funcionality of raw_input function - arrow keys to move cursor / browse through the input history. Is there a simple way to get such behavior working with curses, as it captures input events and I can't just use functions that

ThreadPool not starting new Thread instantly

筅森魡賤 提交于 2019-12-07 10:10:31
问题 I have a C# Windows Service that starts up various objects (Class libraries). Each of these objects has its own "processing" logic that start up multiple long running processing threads by using the ThreadPool . I have one example, just like this: System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(WorkerThread_Processing)); This works great. My app works with no issues, and my threads work well. Now, for regression testing, I am starting those same objects up, but

How do I write a c++ console exe which I can run on msdos?

送分小仙女□ 提交于 2019-12-07 10:03:49
问题 I've been looking all over google for this but never got a clear answer.. I'm trying to write a simple hello world application and make it run under msdos (which I will be installing on a old rig lying around here). But first things first, I've been trying to compile a normal console application and drop it in dosbox to test it out which doesn't work, just says it's invalid. So I assume I need something else to compile it with. Does this mean I'm obligated to build my code in a msdos

SetConsoleScreenBufferInfoEx … bug?

ⅰ亾dé卋堺 提交于 2019-12-07 09:56:45
问题 Each time I run this code ( on Win7) the console gets 1 character smaller in both directions. int wmain( INT argc, WCHAR **argv ) { CONSOLE_SCREEN_BUFFER_INFOEX csbi; csbi.cbSize = sizeof(CONSOLE_SCREEN_BUFFER_INFOEX); GetConsoleScreenBufferInfoEx(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); wprintf(L"Window: %u x %u\n", csbi.srWindow.Right - csbi.srWindow.Left + 1, csbi.srWindow.Bottom - csbi.srWindow.Top + 1); SetConsoleScreenBufferInfoEx(GetStdHandle(STD_OUTPUT_HANDLE), &csbi); return 0; } I

Synchronizing events from different threads in console application

倖福魔咒の 提交于 2019-12-07 08:10:52
问题 I am feeling like a total noob asking this, but anyway, here it goes: I was wondering what the easiest way of synchronizing events from different threads is. Some sample code: class Program { static void Main(string[] args) { Console.WriteLine("# started on:" + Thread.CurrentThread.ManagedThreadId); tt t = new tt(); t.First += new EventHandler(t_First); t.Second += new EventHandler(t_Second); Task task = new Task(new Action(t.Test)); task.Start(); while (true) { Console.ReadKey(); Console

Correct Way to Exit From Console Application [duplicate]

好久不见. 提交于 2019-12-07 08:04:10
问题 This question already has answers here : What is the command to exit a Console application in C#? (6 answers) Closed 3 years ago . I've done some reading here, and here and I'm still confused about if I should use Enviorment.Exit() in my console application. In a method, I have the following code if the user types exit at the prompt, if(userSelect == "exit"){ { Environment.Exit(0); } Update: class Program { public static void Main(string[] args) { Console.WriteLine("Welcome to my Console App"

C++ Printing special ascii characters to the Windows console

允我心安 提交于 2019-12-07 07:30:30
After 2 hours of searching and trying various methods, I'm pulling my hair out trying to print special ascii characters to the console! (C++) typedef unsigned char UCHAR; int main() { UCHAR c = '¥'; cout << c; return 0; } Why does this code print Ñ (209) instead of ¥ (165)??? I've tried: SetConsoleCP(CP_UTF8); SetConsoleOutputCP(CP_UTF8); but neither seems to do anything, no matter which values I pass to it. Someone else suggested that the console's font needed to be changed through the registry. But that's ridiculous. I don't want my end users to have to start changing registry values simply

Python Interactive Shell Type Application

廉价感情. 提交于 2019-12-07 06:08:51
问题 I want to create an interactive shell type application. For example: > ./app.py Enter a command to do something. eg `create name price`. For to get help, enter "help" (without quotes) > create item1 10 Created "item1", cost $10 > del item1 Deleted item1 > exit ... I could of course use a infinte loop getting user input, splitting the line to get the individual parts of the command, but is there a better way? Even in PHP (Symfony 2 Console) they allow you to create console commands to help

SetConsoleMode fails with zero, lasterror = 0

我是研究僧i 提交于 2019-12-07 05:13:35
问题 This is not a duplicate! - Well, after reading the comments, maybe it is. I was looking for a way to italicize text in the console output of a console application, in c#, Visual Studio 2015, Targeting .NET Framework 4.5.2, OS = Windows 7. The Microsoft Documentation is pretty clear It's here - and it's so misleading it's wrong. This is an OS problem. I found the following question with a solution that does what I want by Vladimir Reshetnikov, adding text decorations to console output answered