How can I enter input in the output of vs code? - c++

How would I enter user text (entered via cin) if I build the file using the top right button in the image below?
Is there a plugin that I have to use to disable the readonly console?

I believe that this is code runner extension, which by default disables (REPL) interactive terminal. To enable it, add this to your vscode json settings:
"code-runner.runInTerminal": true
Or open ui settings: type "code runner terminal" and check the
code-runner: Run In Terminal option
Next time you will run this code, it will run in the terminal.
Take a look at the configuration section config

Related

Run AHK script as admin without hitting "run as administrator"

Is it possible to have an AHK script instantly run as admin without me having to right-click on it? I would like to have the UAC prompt pop up when I double-click the script.
(Sorry if I am bad at explaining I am a beginner)
You this snippet from the documentation to automatically relaunch any script as admin (if it already wasn't ran as admin).
full_command_line := DllCall("GetCommandLine", "str")
if (!(A_IsAdmin or RegExMatch(full_command_line, " /restart(?!\S)")))
{
try
{
if (A_IsCompiled)
Run *RunAs "%A_ScriptFullPath%" /restart
else
Run *RunAs "%A_AhkPath%" /restart "%A_ScriptFullPath%"
}
ExitApp
}
Just make sure this is in the auto-execute section (the top of the script).
Create a shortcut to the AHK script (or to the compiled EXE that you made from it). In the properties for the shortcut, select the SHORTCUT tab, and click on the ADVANCED button. On the popup, put a check in the RUN AS ADMINISTRATOR box, then click OK, APPLY, OK

VSCode C++ debug capture console output

I am running VSCode in Ubuntu to debug a C++ program. Debugging a console app with GDB is working fine except I really want to capture the console log output to a file. I cannot see a way or option to do this. Is there any option to capture this console log output?
Since there does not seem to be a native feature to save the output of a VSCode terminal, maybe you can use in said terminal a command allowing you to save that session.
See for instance "Gdb print to file instead of stdout"
gdb core.3599 -ex bt -ex quit |& tee backtrace.log
As mentioned, the output is written to backtrace.log and also on the screen.
As the OP Andy Tomlin mentions in the comments, this is not compatible with a debugger session.
We solved the problem by just handling it inside the app and redirecting cout internally to a file.

PyCharm - colored output in django console

The problem is that when I'm lauching dev-server through Kubuntu's Konsole app, debug output is colored:
But wher I'm launching it trough built-in "Run" or "Debug" in PyCharm, the output in PyCharm's console is all red:
Is there a way to make output in PyCharm colored? Because I can't find anything related in Settings.
UPD: link to issue on PyCharm issue tracker
As I see some people woting on this question, so here is the link to this issue on PyCharm issue tracker - youtrack.jetbrains.com/issue/PY-19790. If you will vote for this feature, it will be released faster!
Some time ago I wrote a code snippet that does the thing for me. It's not a perfect solution, but does the trick. BSD License
To use it:
Option 1: git clone/download this and import it somewhere (e.g. django development settings). Read the module docstring and the readme for details.
Option 2: include the code snippet below into your django development/debug settings (or anywhere else, where it will be run early). It's automatically verified with SHA-2 against file changes.
try: # Colored logger CaaS. Auto downloaded and verified.
import os
import hashlib
from urllib import request
url, sha256 = "https://lab.it.hs-hannover.de/lukyanch/pydevutils/raw/c531eaf7/colored_logger.py", "083e1a39cfdbe17a7126188b5477fb8f324be8106a39ed4a00faeb3f18c5aedc"
cached_file = "/tmp/{0}.py".format(sha256)
code = bool(os.path.exists(cached_file) or [request.urlretrieve(url, cached_file), print("Downloaded: " + url)]) and open(cached_file, "r").read()
assert hashlib.sha256(code.encode()).hexdigest() == sha256, os.remove(cached_file) or "Bad content: " + cached_file
exec(code)
except Exception as e:
print("No colored logger: {e.__class__.__name__}: {e}".format(e=e))
"grep console" is the plugin which handles this perfectly:
https://plugins.jetbrains.com/plugin/7125-grep-console
This is because the development console for PyCharm is not using the same kind of standards to display colors as your normal shell terminal (they are two very different things).
The output console for PyCharm is just a display of commands (its not a full shell with all the bells and whistles of your local terminal emulator).
You can embed a terminal into PyCharm (see the documentation on how to set it up) but doing so will not allow you to redirect the output of the built-in run commands to the terminal window. It will enable you to run arbitrary shell commands there, and avoid having to switch over to a terminal console.
Keep in mind if you have any special shell customization or fonts/glyphs these may not appear correctly in the embedded terminal, because it is using a different set of fonts and configuration.
You can try and raise this as an enhancement at the PyCharm bug tracker; if it gets enough votes it may make it in to the next release.

Open command prompt from final builder

Is it possible to open a command prompt from inside final builder 6.. with the env created from inside final builder?
Yes, just use the Execute Program Action, set the Program File to %DOSCMD% and turn off Wait for Completion and Hide Window. Any environment variables you set in FinalBuilder will be available in the command prompt window.

How to run a console application with command line parameters in Visual C++ 6.0?

I've got a console application that compiles and executes fine with Visual C++ 6.0, except that it will then only get as far as telling me about missing command line parameters. There doesn't seem to be anywhere obvious to enter these. How do I run or debug it with command line parameters?
I assume you're talking about setting the command line parameters for running in the IDE.
Open the Project/Settings property page and go to the Debug tab.
There's a "Program arguments" field you can put them into.
If I remember correctly, under Project/Settings/Debug tab there is a place to enter the command line parameters. It's the "Program arguments" field.
In VS2010:
Right click the project.
Select Properties.
Select Debug tab.
Start Options -> Command line arguments: Enter the arguments here.