console

Code working in browser console but not in tampermonkey

戏子无情 提交于 2019-12-28 04:33:11
问题 I am trying to run the following block of code on https://lichess.org/uZIjh0SXxnt5. var x = document.getElementsByTagName("a"); for(var i = 0; i < x.length; i++) { if(x[i].href.includes("WaisKamal") && x[i].classList.contains("user_link")) { x[i].innerHTML = '<span class="title" data-title="GM" title="Grandmaster">GM</span> ' + x[i].innerHTML; } if(x[i].href.includes("WaisKamal") && x[i].classList.contains("text")) { x[i].innerHTML = '<span class="title" data-title="GM" title="Grandmaster">GM

Edit text in C# console application? [duplicate]

微笑、不失礼 提交于 2019-12-28 04:23:15
问题 This question already has answers here : C# Advanced Console I/O [duplicate] (4 answers) Console.ReadLine(“Default Text Editable Text On Line”) (2 answers) Closed last year . Is there a way to edit text in a C# console application? In other words, is it possible to place pre-defined text on the command line so that the user can modify the text and then re-submit it to the app? 回答1: One thing that came to my mind is to...simulate keystrokes. And a simple example using SendKeys: static void

How to output to the console in C++/Windows

岁酱吖の 提交于 2019-12-28 04:08:08
问题 When using iostream in C++ on Linux, it displays the program output in the terminal, but in Windows, it just saves the output to a stdout.txt file. How can I, in Windows, make the output appear in the console? 回答1: Since you mentioned stdout.txt I google'd it to see what exactly would create a stdout.txt; normally, even with a Windows app, console output goes to the allocated console, or nowhere if one is not allocated. So, assuming you are using SDL (which is the only thing that brought up

Why does my Qt 4.5 app open a console window under Windows?

試著忘記壹切 提交于 2019-12-28 04:00:28
问题 I've been playing around with Qt Creator 4.5 under Linux. My application builds just fine under Linux, but if I build in Windows, the app always opens a console window at startup. Can I stop it doing that? I'm building using the default MinGW setup, perhaps that is related. If need be I can build with Visual Studio, but I'd like to understand what is happening first... Edit : I just created a simple test GUI app with Qt Creator under Windows and it didn't exhibit this behaviour. Either this

How do I detect whether sys.stdout is attached to terminal or not? [duplicate]

北慕城南 提交于 2019-12-28 03:21:30
问题 This question already has an answer here : How to recognize whether a script is running on a tty? (1 answer) Closed 6 years ago . Is there a way to detect whether sys.stdout is attached to a console terminal or not? For example, I want to be able to detect if foo.py is run via: $ python foo.py # user types this on console OR $ python foo.py > output.txt # redirection $ python foo.py | grep .... # pipe The reason I ask this question is that I want to make sure that my progressbar display

How do I detect whether sys.stdout is attached to terminal or not? [duplicate]

大兔子大兔子 提交于 2019-12-28 03:21:05
问题 This question already has an answer here : How to recognize whether a script is running on a tty? (1 answer) Closed 6 years ago . Is there a way to detect whether sys.stdout is attached to a console terminal or not? For example, I want to be able to detect if foo.py is run via: $ python foo.py # user types this on console OR $ python foo.py > output.txt # redirection $ python foo.py | grep .... # pipe The reason I ask this question is that I want to make sure that my progressbar display

.NET Console TextWriter that Understands Indent/Unindent/IndentLevel

北慕城南 提交于 2019-12-28 03:10:34
问题 Does anybody have or know of a TextWriter for the Console that understand how to indent/unindent and has the ability to set the indent level. 回答1: Try this: class MyConsole : TextWriter { TextWriter mOldConsole; bool mDoIndent; public MyConsole() { mOldConsole = Console.Out; Console.SetOut(this); } public int Indent { get; set; } public override void Write(char ch) { if (mDoIndent) { mDoIndent = false; for (int ix = 0; ix < Indent; ++ix) mOldConsole.Write(" "); } mOldConsole.Write(ch); if (ch

Properly print utf8 characters in windows console

倾然丶 夕夏残阳落幕 提交于 2019-12-28 01:55:33
问题 This is the way I try to do it: #include <stdio.h> #include <windows.h> using namespace std; int main() { SetConsoleOutputCP(CP_UTF8); //german chars won't appear char const* text = "aäbcdefghijklmnoöpqrsßtuüvwxyz"; int len = MultiByteToWideChar(CP_UTF8, 0, text, -1, 0, 0); wchar_t *unicode_text = new wchar_t[len]; MultiByteToWideChar(CP_UTF8, 0, text, -1, unicode_text, len); wprintf(L"%s", unicode_text); } And the effect is that only us ascii chars are displayed. No errors are shown. The

In Python, command line args without import?

烂漫一生 提交于 2019-12-25 19:04:49
问题 In Python, is it possible to get the command line arguments without importing sys (or any other module)? 回答1: Yes, if you're using Linux. If you know the process ID, you can read its /proc/{pid}/cmdline file, which contains a null-separated list of the command line arguments: PROCESS_ID = 14766 cmdline = open("/proc/" + str(pid) + "/cmdline").read() print cmdline.split("\0") But it's hard to know the process ID before you start the process. But there's a solution! Look at ALL of the processes

How to clear python console (i.e. Ctrl+L command line equivalent)

心不动则不痛 提交于 2019-12-25 18:53:41
问题 OS = Linux [boris@E7440-DELL ~]$ uname -a Linux E7440-DELL 3.17.4-200.fc20.x86_64 #1 SMP Fri Nov 21 23:26:41 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux From python console (Spyder 2.2.4, Python 2.7.5 64bits, Qt 4.8.5) it is seen as: >>> import os >>> print(os.name) posix I'm trying to find out a way to clear python console. Not just any solution is suitable, but it must be exactly same result as pressing Ctrl+L. From other threads I have already tried several options: >>> import os >>> os.system