When I normally run my application from the command line it looks like this:
However, when I schedule the command using the crontab (or the "at" command), the window looks like this:
The command that I schedule is as follows: "export DISPLAY=:0.0 && myprogram". I use Ubuntu 12.04 64-bit.
Any idea how to get the nice appearance for the scheduled window? Thank you.
I think that when you run the program using the crontab the program is running with other environmet. Environment that don't have the configurations you already do.
For instance, in your user space you said QT theme that you want it looks like GNOME.
This can happend if the user root runs the app since root has a different environment, hence different setting for QT gui themes/appareance.
Possible solution, try to specify the environment which will run the app.
Another solution could be select the theme programatically, here you have a discussion about the subject.
Test: Try running the app yourself as root, and compare result. Don't use sudo. Try with su -c.
Program started from crontab has different environment. So you can create a shell script that sources your profile, for example using bash:
#!/bin/bash
source ~/.profile
export DISPLAY=:0.0
exec myprogram
And run that from crontab. If you do not normally use bash, you may need to use script with shell that you use.
Alternative would be to investigate your profile and find out, what difference in environment changes window appearance. Then export that variable in such script, or put it directly into crontab job, like you do for variable DISPLAY.
Related
might be a stupid question, but I've just started using Netbeans 10 for a C++ project.
When I run/debug the project, I'd need to first execute a bash script which sets up the environment, and then execute the binary (including an argument to be passed):
#!/bin/bash
source setup_script.sh
./bin/my_program -c some_argument
I've tried just pointing Project Properties -> Run -> Run Command to the .sh file containing this launch script, but that won't do it (the Run / Debug buttons are either greyed our, or it'll tell me it doesnt recognize the executable type).
Is there any way to setup Netbeans to launch my application via this script, or any other way to achieve the same - e.g. setting up some sort of pre-run command that'd execute setup_script.sh in the same session?
Thanks!
I'm on 64-bit Windows 7 with 64-bit Python 2.7 and gsutil version 4.11
I'm trying to set up gsutil so that I can run it from the windows command prompt with the commands python gsutil or gsutil. I'm referring to the documentation here in the section called "Facilitating the use of gsutil"
According to that documentation and other references in that guide, I should be able to set up gsutil to run by using either python gsutil or just gsutil. I am able to run gsutil by cd-ing to the C:\gsutil directory or by running python C:\gsutil\gsutil, which will work fine, but I'd like to set it up the way the guide says it can be set up. I've looked at this answer but it just explains what I already can do.
The first step of the guide is associate .py files with Python, which I'm assuming is already done because when I double click a .py file, it runs in Python, but maybe I'm confused.
The second step of the guide is to rename the 'gsutil' file to 'gsutil.py', but that doesn't make sense because there's already a file in the C:\gsutil folder called gsutil.py. I've opened both the files in Sublime Text and they're both different, so maybe they do the same thing but I'm not sure...
The third step is to add C:\gsutil to my PATH environment variable, but I'm still unable to run gsutil using the command python gsutil after doing that.
I've also tried steps 4 and 5 but they don't help me either. There is no gsutil\boto path (unless they mean C:\gsutil\third_party\boto) and I should be able get this set up without anything to do with boto anyways.
I can still use gsutil but I'd like to understand why I can't run it the way Google says I should be able to. Thanks for any help.
I'm looking at the docs for Windows and they do seem a bit messed up. You don't need to rename anything as long as you have installed Python correctly, as you can just invoke 'gsutil.py' from anywhere as long as 'C:\gsutil' (or wherever you installed it) is in your path. The 'gsutil' script is just another Python wrapper that imports 'gsutil.py', which would work on a Unix system to save typing the extension if it was in your path but not on Windows (Windows needs a file extension to associate the type). I'd recommend just installing the Google Cloud SDK using the Windows installer as it installs gsutil properly along with a 'gsutil.cmd' wrapper for Windows which actually does this properly.
You could only ever run 'python gsutil' from inside the installation directory as Windows path rules would never apply to a filename given as an argument to another command.
If you just want the functionality of typing 'gsutil' as it is supposed to work, the 'gsutil.cmd' script essentially does this (substituting with the actual directories where you installed stuff):
cmd.exe /C C:\Python27\python.exe "C:\gsutil\gsutil.py" %*"
I have a custom shell that I can run C++ applications in. I start the shell from a bash prompt and then run my C++ code. I want to emulate this behavior with Eclipse, particularly for debugging. I can't seem to figure this out.
I could write a simple bash script that kicks off the custom shell and runs my application but Eclipse does not let me debug when I do this.
Is there a way to achieve this functionality?
Please keep in mind eclipse can set environment variables for running/debugging job.
If your shell is more complicated than that, please provide more details about your shell.
But I'm not optimistic about it.
Btw, you can always attach an existing process for debugging.
Im new about compile code for linux. It's propably Debian 5.0. And I need compile my cpp code for it as ready to run, i mean the other person can easly run program like in Windows, by just clicking on it.
Anybody can help?
I use virtualbox for this. It's easy and convenient. You can run multiple Linux distros and multiple versions of Windows provided you have the proper licenses. You can also run subversion, etc on each virtual machine so that you can sync your changes across all of them when building.
Assuming you want to be able to compile something on Windows and have it work on any Linux machine, that's simply not possible. Debian and Ubuntu both support many architectures, many of which have absolutely no binary compatibility. If you know what type of hardware your friend has you can build a binary targeted to that architecture.
If you want a quick and dirty answer, you can build for i386 since a 64bit machine can probably still run it fine (not guaranteed though).
Once you compile it, you can easily create a shortcut on the Desktop -or add an entry on a menu- to launch your program via a script; something like:
#!/bin/bash
/path/to/your/progam
Save it as launch.sh -for example- and give it ugo+x permissions as such
chmod ugo+x launch.sh
When you create the shortcut, you can associate a icon to your script exactly in the same way you do it in Windows.
UPDATE
If you are sending the compiled program to your friend (let's assume via email). You can simply instruct your friend to launch the terminal window in the same directory where he downloaded your file and run the following:
chmod ugo+x your_program
./your_program
Or you can send him 2 files: one with your program and one with a "launch" script as I described above. Since both files will be downloaded to the same directory, you can change your launch script to:
#!/bin/bash
./your_program
When he clicks on launch.sh, your program will be executed.
I use nativeprocess api in AIR to launch a c++ console app. The console app runs correctly but does not appear, but I want it to be visible and user be able to interact with it. How can I achieve that?
Instead of launching your executable directly, you'll need to launch your platform's terminal application (on Windows, that's CMD.exe, on OS-X it's Terminal.app, and on unix/linux it's xterm).
By default, the terminal application will run an interactive shell prompt, but you can use command-line arguments to tell it to execute any other program instead. In this case, you'll want to tell it to execute your C++ console application.
On Windows, this might look something like this:
CMD.exe /K C:\path\to\your\app.exe
on OS-X, it's a little more complicated. Here's a related S.O. post ( Running a command in a new Mac OS X Terminal window)