console-application

QtWebkit: console application

大憨熊 提交于 2019-11-30 10:08:40
I am new to Qt. I am building a console application and I need to process lot of real world html pages. QtWebkit comes as an easy choice because of clearly cut APIs and easy availability. I checked out the docs and they say that I can load pages by using QWebView::load(). But I am building a console application and I cannot use a widget. I get the error as: ? QWidget: Cannot create a QWidget when no GUI is being used The program has unexpectedly finished. So how can I process the html pages using QtWebkit in console application. Marçal Juan QtWebkit can be used in a widget-less environment,

How to call a console command in web application action in Yii?

让人想犯罪 __ 提交于 2019-11-30 09:39:37
I have a console command to do a consumer time, AND I need to know how to call (execute) it in a web application action in YII. class MyCommand extends CConsoleCommand{ public function actionIndex(){ $model = new Product(); $model->title = 'my product'; ... $model->save(); . . . } } I want to execute this code. try this: Yii::import('application.commands.*'); $command = new MyCommand("test", "test"); $command->run(null); The 2 parameters with value "test" must be set but do not have an impact, they are used for the --help option when using the console. /** * Constructor. * @param string $name

Prevent a console app from closing when not invoked from an existing terminal?

一世执手 提交于 2019-11-30 09:17:11
There are many variants on this kind of question. However I am specifically after a way to prevent a console application in Python from closing when it is not invoked from a terminal (or other console, as it may be called on Windows). An example where this could occur is double clicking a .py file from the Windows explorer. Typically I use something like the following code snippet, but it has the unfortunate side effect of operating even if the application is invoked from an existing terminal: def press_any_key(): if os.name == "nt": os.system("pause") atexit.register(press_any_key) It's also

Colorize stdout output to Windows cmd.exe from console C++ app

女生的网名这么多〃 提交于 2019-11-30 09:02:28
问题 I would like to write something similar to cout << "this text is not colorized\n"; setForeground(Color::Red); cout << "this text shows as red\n"; setForeground(Color::Blue); cout << "this text shows as blue\n"; for a C++ console program running under Windows 7. I have read that global foreground & background can be changed from cmd.exe's settings, or by calling system() - but is there any way to change things at character-level that can be coded into a program? At first I thought "ANSI

How To Get A Stream Object From A Resource File (Console App/Windows Service Project)

廉价感情. 提交于 2019-11-30 09:00:17
问题 I'm creating a Windows service and am trying to access some files I added to a resource file, but I'm stuck because I don't know how to access the individual files. Just for some background info, here's what I've done so far: This is a C# Windows Service application running in debug mode as a console app, which helps me step into the code. I added a resource file to the root called "Resources.resx". In my resource file, I added a few jpg images and html files using the visual designer/editor.

Using UTF-8 Encoding (CHCP 65001) in Command Prompt / Windows Powershell (Windows 10)

 ̄綄美尐妖づ 提交于 2019-11-30 08:46:52
问题 I've been forcing the usage of chcp 65001 in Command Prompt and Windows Powershell for some time now, but judging by Q&A posts on SO and several other communities it seems like a dangerous and inefficient solution. Does Microsoft provide an improved / complete alternative to chcp 65001 that can be saved permanently without manual alteration of the Registry? And if there isn't, is there a publicly announced timeline or agenda to support UTF-8 in the Windows CLI in the future? Personally I've

C# How to redirect stream to the console Out?

一个人想着一个人 提交于 2019-11-30 07:22:48
问题 I found lots of samples how to redirect console output into a file. However I need an opposite solution - I have StreamWriter which I want to be shown in the Console output once I do sw.WriteLine("text"); 回答1: Just point the stream to standard output: sw = new StreamWriter(Console.OpenStandardOutput()); sw.AutoFlush = true; Console.SetOut(sw); 回答2: Not that previous answer not correct, but since i do not have enough reputation level to add comment, just adding another answer: If you would

Can I get copy/paste functionality from a C# Console Window?

拥有回忆 提交于 2019-11-30 07:19:21
问题 I am developing a console application in C#, and was wondering if there was a way to get the "copy-paste" or "mark-paste" functionality into my application, similar or identical to that of the standard Windows command prompt. Is this a wild goose chase or a simple application variable? 回答1: I've copied text from the Console window and pasted it into another source many times. It's there as default in a Console application; Right click the console border: Select Edit > Mark: Drag over the text

Is it possible to send Toast notification from console application?

白昼怎懂夜的黑 提交于 2019-11-30 07:05:58
Is it possible to send Toast notifications from console application using ToastNotificationManager ? I know that it is possible to send Toast notifications from Windows Universal app: var toast = new ToastNotification(doc); ToastNotificationManager.CreateToastNotifier().Show(toast); *doc - Toast stored in XML string To use ToastNotificaionManager I need Windows.UI.Notifications library which I can't reference in console application project. The library I mentionet before is actualy used by WinRT. Is it possible to use WinRT APIs in Windows console application ? At first you need to declare

c# console, Console.Clear problem

久未见 提交于 2019-11-30 06:58:27
问题 I am writing a console program in C#. Is there a way I can use a Console.Clear() to only clear certain things on the console screen? Here's my issue: I have a logo (I put it on screen using Console.WriteLine()) and a 2d array which I want to keep constant and clear everything below it. 回答1: You could use a custom method to clear parts of the screen... static void Clear(int x, int y, int width, int height) { int curTop = Console.CursorTop; int curLeft = Console.CursorLeft; for (; height > 0;)