Visual Studio Code - Can ruby debugger in vscode handle input from gets? - ruby

I am trying to debug a simple "tutorial" ruby program that uses gets to fetch input. It seems the debugger freezes and there is no way to input a line of text into the program when it runs in the debugger. Is this expected? Is it possible to debug interactive ruby console text input?
This seems useful to me when teaching some basic "enter your name and age" type programs to young developers.

Currently VSCode cannot handle this.
For interactive console app debugging where input can be accepted, other IDEs such as Eclipse plus ruby plugin, or Netbeans plus ruby plugin, or an IntelliJ family IDE with ruby plugin (or rubymine itself) is a better choice for teaching ruby with interactive visible execution (single step through code, stop, and accept user input then continue code).

By using the code runner extension and going to : settings => code runner : run in terminal => check , it will work and ask for the input.
03/01/2022 ; in case someone new is looking for the answer.

Related

Running Java/C++ Programs in Sublime (no command prompt): There is one unaddressed issue

I've gone through the questions and the solution proposed works great. It helps us both compile and run programs in Sublime text editor instead of opening the command line prompt every time you need to run a program.
However, it doesn't work when you have to accept input from the console (Like cin and Scanner(System.in)). How do you fix those?
Running programs within Sublime Text cannot accept input, regardless of the language they're written in. To interact with your program, you'll have to run it through the shell. The only way around this is if you're using an interpreted language like Python, Ruby, Perl, JavaScript, etc., in which case you can install the SublimeREPL package and run your code via an interactive session. Unfortunately, since you're using compiled languages, this is not an option.

Ruby and GTK3 without console window in background

Hello Stackoverflow user's. this is my first question. :)
I'm using ruby and gtk3 to make a few GUI's for scripts that I use a lot. The problem I'm having is that when I run the script it opens the console window as well as the GUI, which in my mind defeats the purpose of a GUI.
I'm currently trying to run the scripts by executing them on my desktop.
I tried packaging it inside OCRA but that generated a lot of errors. I don't mind packaging or running the script directly as long as it doesn't open a console window, or at the very least closes it when it launches.
I'm using windows, and ruby 2.0.x.
Basically I don't want a DOS console window to open when I run my script.
I'm intermediate with ruby so please, clear instructions and simple solutions.
Thanks in advance.
Found a simple solution. Save the script with .rbw extension instead of .rb extension.
Hopefully this will help other newbies.

view layout rebol 3 not working

I've copied Rebol3 to my computer under windows. I am running it from the download not a full install, and it and seemed ok.
I tried using some very simple sample code for the GUI in the console and it fails with various error messages.
If I put in view [ and type enter it tells me its a syntax error (this works in reb/view 2).
Its a win 7 machine.
Version of Rebol3 is 2014-03-04 04:54
When I used help and typed the command what, view wasn't listed as a command.
Note the runtime support for the Rebol3 GUI dialect is not available in the "core" builds available at http://rebolsource.net.
Currently the GUI dialect is available in Linux/Android and Windows builds from Atronix Engineering:
http://atronixengineering.com/downloads.html
Or from Saphirion AG:
http://development.saphirion.com/rebol/saphir/
Note that the GUI behaviors in Rebol3 are similar to Rebol2's VID but has some differences, and is called R3-GUI. For a tutorial you might try Cross Platform App Development with Rebol 3 Saphir
Also notice that before invoking VIEW you will have to LOAD-GUI.
If I put in view [ and type enter it tells me its a syntax error (this works in reb/view 2).
The Rebol3 console is more basic than the Rebol2 console, and unfortunately doesn't support multi-line input at this time. You can only enter complete expressions before hitting enter, not partial ones. So hitting enter while there is still an unclosed bracket will give you an error. However if the code you're putting in is coming from the clipboard you can use do clipboard:// (via #GrahamChiu)
While Rebol3 currently lacks the behavior, it's encouraging that the Red console handles multi-line input in the Rebol2 way.
I am running it from the download not a full install
And the good thing is that you can run it from the download with no install. Because there is no install. :-)

Disable Terminal for Command Line Tool

I programm an artificial life simulation on my mac with Xcode in C++/OpenGL.
Due to the fact that my programm has a visual output in a seperated window,
I do not need the terminal, while running the concrete programm.
Nevertheless the terminal opens when I run my application throwing '/path/programm ; exit;' at its user. I guess that is for debuging? Or maybe standard because it is a command line tool?
So if I want to make a proper looking application out of it, which does not bother its users with command line outputs, what do I have to do?
If it is inherent of the command line tool to open the terminal do I have to migrate the source code to a cocoa app or Qt even though I yet do not need these build interfaces?
Thank you for your effort.
If I understood your question right, you don't want the terminal to be shown when the user double-click your app ?
In this case you should create a .app bundle and embed your binary into it.
I just tested with the basic "Hello world" Xcode command line template, it works fine.
You can use
#echo off
In the part off your code that requires the terminal.

Graphical debugger for bash

Is it there any graphical debugger for bash on mac os x or linux? I mean something in the same fashion that the debugging mode of Visual Studio or Eclipse, where one can stop the program hover the mouse pointer over variables and get instantly values, modify them and go backwards and try modifications without the need to start the program fomr the beginning. I am talking about very long bash scripts
for debugging execute your script with:
bash -x <scriptname>
gui debugger:
http://bashdb.sourceforge.net/
Debugger for Bash version 3(Bourne again shell). Plugin for Eclipse. Will only work with shell script editor ShellEd.
http://sourceforge.net/projects/basheclipse/
I have found the vscode-bash-debug
extension (https://github.com/rogalmic/vscode-bash-debug) for the visual studio code editor (https://code.visualstudio.com/) very useful.
I haven't come across a visual debugger, but bashdb works quite well for debugging. You can set breakpoints, continue, print variables etc..
https://sourceforge.net/projects/bashdb/
Install via your distro's repositories. There is a quick-start guide here:
http://www.rodericksmith.plus.com/outlines/manuals/bashdbOutline.html
(first chapter takes only half an hour to read/try).

Resources