Same program behaves differently in different consoles - linux

I wrote a text mode batch C++ program that since today is giving me some troubles.
The executable worked correctly and it did not change.
The environment did not change; not even a reboot.
When I launch the program from a certain console, everything is fine.
When I launch the program from a new console, everything still works, but I get just the first two lines on the log file, even if the execution completes.
The parameters passed to the executable are the same.
The executable does not interact with the console in any way.
The two consoles' environment variables are the same.
When run from a remote computer as root, everything is fine, the log file is complete.
When logged in again with my user, from another session, everything is fine again.
When logging out and in again, everything is fine again.
So, could it be the from a certain instant on, the new consoles had some issues that caused this problem?
Could this be a problem of my Linux installation?
Or, more realistically, could the problem depend on my program?
Thank you!
Environment:
- Linux OpenSuse 11.4
- gcc 4.5.1

Here is another tool to throw into your debugging toolbox.
Try the command 'reset' -- read the man page for details.
In short, it resets the console to a known state. It is ... possible that your log files may contain control characters that try to interact with tty causing hard-to-trace problems.
You might also want to look at the command 'script' which captures all console activity to at et file for examination.

Related

I am facing issues printing things on repl.it

I am new to repl.it and I was trying to print the python version using this code Print Version of the Python Running on the Machine
Here's the code:
import sys
print("Python version")
print (sys.version)
print("Version info.")
print (sys.version_info)
but it prints absolutely nothing. Trying to do the same thing onto Jupyter Notebook and my code works. While I know I can print the version directly from the shell tab out there but I was wondering what's wrong with my code and why it isn't working with repl.it
This seems to be the same for user input as well where I try to do
name = input("Print my name?\n")
but it prints absolutely nothing onto the console. I am sure someone here must know what am I missing here. Sorry if this is a noob question.
"Help! 🙋 My REPL won't run"
Here are six reasons your Python REPL.it environment may not be working. 📃
Checklist to fix common problems
Have you configured your Run ▶️?
Repl.it doesn't automatically run your current working document. Configuring your Run ▶️ button will enable replit to know what to do when you hit the button.
Configuring the "Run" Button
A file named .replit can be added to any repl in order to customize the behavior of the "Run" button. Written in toml, a .replit file looks something like:
run = "<run command here>"
language = "<repl language>" # optional
In the snippet above, run is a string which will be executed in the shell whenever you hit the "Run" button. The language helps the IDE understand how to provide features like packaging and code intelligence. This is normally configured for you when you clone from a Git repository.
The .replit file can also provide other configuration hints. The full specification is provided below:
run: Command that is executed when the run button is clicked
language: Reserved
onBoot: Command that is executed once when the repl first starts up
packager.afterInstall: Command that is executed after a new package is installed
packager.ignoredPaths: List of paths to ignore while attempting to guess packages (More about installing packages)
packager.ignoredPackages: List of modules to never attempt to guess a package for, when installing packages (More about installing packages)
Example .replit File
run="python main.py"
language="python3"
onBoot="echo Booting up!"
[packager]
afterInstall="date >> package_install_log"
ignoredPaths=[".git"]
ignoredPackages=["twitter", "discord"]
Attempt running the *.py script through the interactive shell instead of console. If the script runs in console, you may be needing to diagnose the shell. See choices below.
Check that the Browser Developer Console is not showing any errors If you see errors, you may be having issues with your browser or extensions. Try disabling browser extensions temporarily.
REPL.it relies on Google Cloud Platform services for its backend functionality and sometimes those servers are unresponsive. Check the REPL.it status page or the REPLIT Twitter account to see if they're having a GCP backend service outage. If they haven't updated recently, they may be responding to an unreported outage. Check Google's own GCP status page here. You can also Tweet at the CEO of Repl.it here.
Try refreshing the REPL.it environment locally. Clear the console output and scroll-back by using the ✖️ next to the search icon 🔍. Also, try exiting the Python REPL with exit() to see if it will respond.
If #5 doesn't work, try an empty-cache hard reload. This can help to expunge unresponsive javascript, broken html, misbehaving css, and any unmetabolized toxins from the bowels of your browser.

How to Save Images from A Program Ran from Ubuntu Application Start-up Command

We're trying to run a program at start with Ubuntu's Application Start-up command. We're successfully starting the camera and viewing the images. But the images are not saving to the folder we expect them to be saved too.
The program works flawlessly when started manually from the terminal. Saving into the appropriate folder.
Does anyone have any idea of how to get the images saved but when started from the Application Start-up command upon start-up?
Thanks.
You're not providing a whole lot of details, so my answer may be totally off. To me it sounds like you've created an app that takes a picture with the webcam and saves it to disk. Now you want the app run it when the user logs in, so you've added your app to the list of Startup Applications. The app starts, takes a picture, but can't write it do disk. If that's the case, I'd consider:
Try adding debug logging to your app, so you can see why it fails opening the file. What ever language this app is written in, if opening a file fails, the API will tell you. This information is vital. The easiest is to print to stdout and then, when starting the app, forward it to a log .e.g. /usr/local/bin/myapp &>> /tmp/myapp.log.
Try writing to a location like /tmp where permissions aren't that much of an issue.
Try adding a delay before starting the app, see this list of various approaches on how to do this, the most simple being using this a the command: sleep 10 ; /usr/local/bin/myapp &>> /tmp/myapp.log
If this is all rubbish you need to add more details in your question.

Getting detailed crash dumps from a hooked exe

I am trying find a problem with my program that is hooking into a game. This is
vc++. Basically I launch the program and then hook into it using SDL. When I run the code from VS2010, all works fine. But when I try to run from command prompt, my program can launch the game, but after that the game crashes immediately.
I was viewing windows event logs, and it appears that there is an access violation. 0xc000005
How can I log any further details about the program that crashes? I tried "procdump" but that is not useful as I cannot INDIRECTLY target the hooked game from console. Rather it can only target my application that hooks.
Anyway of getting detailed dumps is highly appreciated in this case.
Thanks!
You can perform postmortem debugging by using a combination of the WER registry keys/values to trap any dump that is produced. I’ve used this method to prevent the WER system from collecting the dump file (.dmp). I’ve also written about this in another similar post. To accomplish this, you will need to create a registry key under
Software\Microsoft\Windows\Windows Error Reporting
if one does not already exist. The key should be
LocalDumps\your application.exe
Once that’s done, modify these keys/values to meet your needs:
DumpCount, DumpFolder, DumpType
You’ll need Administrator rights to create and modify the keys, and, you should reset everything you’ve modified when you’re done debugging.

AutoHotkey Run command issue in Windows 8.1

this is my first time on such a prestidigious site, so please welcome me by assisting me. I am doing independent development and am primarily a music designer. So that is why I may not sound like a real pro coder but nevertheless truly love creating my music through automative processes.
My present issue is this:
Windows 8.1 Pro
AutoHotkey 1.0.48.5 32bit (running as Admin)
Everytime I attempt to use the command 'RUN' with an .ahk target, I get the expected result except that the .ahk residing folder is opened by MS Explorer. I suspect that something like the fact that AutoHokey is an unsigned app, windows does not want it to run flawlessly. I am now trying a number of Administrative Tool Services disabling, but with no success yet.
RUN C\:XZN\Mecanisms\AnyAHK_script.ahk
;;or
RUN AnyAHK_script.ahk, C\:XZN\Mecanisms
;;or
RUN C\:XZN\Mecanisms\BactchfileLaunchingAboveScript.bat
;;or
RUN AnyAHK_script.ahk, C\:XZN\Mecanisms
Would there be a workaround this at the OS settings level or another way to run/start an .ahk file?
I tried the 'Comspec' approach as well as running an .ahk from within a batchfile, but the .ahk always get intercepted whenever it contains a 'RUN' command requesting an .ahk target.
Thanks.
You are using outdated version of AutoHotkey which is more than 5 years old. Always use AutoHotkey and its documenatation from http://ahkscript.org/ (current uptodate version, new official website)! AutoHotkey and its documentation from autohotkey.com is outdated and you may have some problems using them!
One thing to try if you only have this problem on win 8 is to Enable interaction with administrative programs http://www.autohotkey.com/board/topic/70449-enable-interaction-with-administrative-programs/
That script modifies the executable file's embedded manifest, then creates and installs a self-signed certificate and uses it to sign the file. The executable will not run on any other system, unless you install the certificate used to sign the file.
But lets see some script code that way we have something to test with and can better help you out...

What's the difference between an application launcher and type in an application name and run it from teriminal?

I have a QT application. When I use my created application launcher to start it, it doesn't work.
However, if I go to terminal and run the application from there, it works.
I'm wondering what their differences are.
Thanks.
Maybe your application launcher doesn't contain the right command and environment?
How is your launcher trying to start the program? Are any errors being reported?
It could be that the current directory is not set as expected. Or the command line parameters being sent aren't formatted correctly. Hard to say without seeing some code or an error message.

Resources