netbeans outputs the results my code incorrectly - netbeans

So I downloaded and installed netbeans because my community college used to require it and now I am most comfortable using it rather than other programs.
But whenever I run a program, in the output box, it shows something like
PID=50
TTY=/dev/pt y0
PSID=50
NBMAGIC=49
and then show the output of my program.
And often, it doesn't completely show the output at all.
Like if the output is "Hello World,"
sometimes it just outputs "H" (even when my code is correct)
then after running program again (no change in the code) it shows "Hello World"
Does anyone know how to fix this?

Related

cobol "hello world" get error when using visual code with terminal

So I'm starting to learn COBOL, tried my first "hello world" program, and got an error that I can't solve.
this is the code:
*hello
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
ENVIRONMENT DIVISION.
PROCEDURE DIVISION.
DISPLAY 'HELLO'.
STOP RUN.
I'm using vs code with extensions that talk with gnucobol(openCobol), did that with the help of this video (using windows). When I'm running the code, I get this message:
hello.cbl:1: error: PROGRAM-ID header missing
I've tried to copy the code from a few other sources that have an example code but still got this message.
I would appreciate any help.
It might help you to see what your code looks like in a purpose-made IDE for COBOL. Here is a direct copy & paste of your code in OpenCobolIDE:
The main issue is the position of the code on lines 2 through 5. COBOL generally will require your code to be very specifically formatted, as you can see from the red lines above, there are limits to where data should exist. This can be changed, but I recommend keeping with it as this may increase your comfort in working with the legacy code that runs the world. Here is an example of how this should be written. I will share both a picture and the code itself so you can see where it is in relation to those red lines.
Code with errors still to show as an example:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
PROCEDURE DIVISION.
*this is a comment
*this is not a comment
MAIN-PROCEDURE.
DISPLAY "Hello world!"
DISPLAY "This display line is too long, creating the same issue but on the other side"
*STOP RUN has an error because the above line was cut off inappropriately
STOP RUN.
END PROGRAM HELLO.
Working code with no errors:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.
PROCEDURE DIVISION.
*this is a comment
MAIN-PROCEDURE.
DISPLAY "Hello world!"
STOP RUN.
END PROGRAM HELLO.
Definitely check out OpenCobolIDE which is a great free IDE for getting started with COBOL and getting the basics down! It helped me to get a better handle on formatting when I was new.

Perl: list the lines being run

I am debugging big perl program. To minimize debugging I would like only to debug the lines actually run.
Is there a tool which I can run my program under, that will give me a program only containing the lines actually being used (e.g. by commenting out the rest)?
You can use the Perl Debugger (http://perldoc.perl.org/perldebug.html).
Decent beginner's write up: http://www.thegeekstuff.com/2010/05/perl-debugger/
It sounds like you might want a coverage tool, like Devel::Cover, which indicates the lines which are being executed during a run of the code.
For example, where you currently execute your code as
perl yourprog args
instead you run
perl −MDevel::Cover yourprog args
cover
This will generate an HTML report showing the code which is actually executed.

Erratic Behavior in console for logging versus print messages

I am finding seemingly random ordering of print versus python logging outputs to the pydev console.
So for example here is my code:
import logging
logging.warning('Watch out!') # will print a message to the console
print "foo"
logging.info('I told you so') # will not print anything
logging.warning("Event:")
logging.warning("told ya")
Note the print line around "foo". What is bizzare is each time I run this the order of output with respect to foo changes! That is foo appears one time at the top another time in the middle another time at the end and so forth.
This is unfortunate in a less toy context when I want to know the sequence in which these output events occured in the code (e.g. when tracing/logging etc). Any suggestions as to what might be going on? Latest pydev, python 2.7.6
Thanks!
p.s. As a side-effect (probably) this is making an eclipse tool out there "grep console" behave oddly). But the problem I describe above is independent of that.

Why does matlab causes terminal std out crash and how do I fix it?

Every time when I finish running a matlab code collection on command line, when I exit matlab, the standard output just gets messed. I can still use the terminal window, but whatever I typed won't show up on the screen, leaving me either type with my eyes blind, or open up a new terminal and excessively cd to the old place.
This happens every single time when I use make to run a matlab collection, and since I'm working a lot on this, it turns out to be very annoying. Does anyone know what's the problem here and how should I fix it?
As was pointed out in the comments, the makescript is probably dumping "bad" characters to the terminal. You could prevent this (but possibly lose useful information) by redirecting the output - instead of sending it to the terminal window, you can send it to a file, or even /dev/null ("the great bit bucket in the sky").
The underlying problem, however, is that your makefile is even sending these characters to the terminal in the first place. I would recommend that you pipe the output to a file with something like make > myDump.txt, then examine the resulting file to see what is going on, and where in your makefile the problem is created. It is possible that you will still be getting some output when you do this - that's because by default > redirects stdout only, and not stderr - a second output stream used for error messages. You can redirect both to a file with make 2>&1 myDump.txt.
You have already seen the recommendation to use stty sane to restore the status of the terminal - I am repeating it here in case someone only looks at answers, and not at comments; but I don't take credit for it :-).

Matlab MCR program errors corrupt terminal

I have compiled a Matlab routine using the MCR and deployed it to other computers without having them installed matlab. So far, so good. But of course, the routine is not completely error-free, particularly the GUI part. The problem is that when the MCR tries to write the error message to the terminal, it seems to corrupt the terminal so that everything is no longer legible - not even the prompt. Sometimes I also get an extra window, vaguely resembling the matlab editor window, full of illegible ascii characters. Does anyone know what is causing this, or how to avoid it?
My first attempt was a big try-catch block around everything, but whatever it is still seems to get through. The catch block just tries to divert the error to an errordlg rather than the command prompt:
catch e
errordlg({e.message;['in: ',e.stack.name]})
end
MATLAB Compiler does not support command window functions.
Peter Webb tells on Loren's blog:
Certain MATLAB functions cannot be deployed because they act on
objects that are not present in a deployed application. For example,
since deployed applications have no command window, functions that
modify the command window can't be deployed.
So, you probably need to get rid of any function that prints to the command window.
Also, you can check out the mccExcludedFiles.log file.