run shell script from eclipse - eclipse

I want to use Eclipse to run build scripts (on Ubuntu).
I use make tool to do it like this:
build_android:
chmod 755 "./build_android.sh"
./build_android.sh
I use make tool to launch scripts but I get "permission denied" on some strings, like
./build_android.sh: 19: function: Permission denied
on
NDK=/home/student/devtools/android-ndk-r8d
PLATFORM=$NDK/platforms/android-8/arch-arm
PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86
function build_one
{
./configure --target-os=linux \
--prefix=$PREFIX \
--enable-cross-compile \
#and so on...
}
Why can it be and what solution is to launch scripts in Eclipse.
P.S. Why do I want it? I think it would be more productive to launch scripts in several clicks and also see the script output formatted in the console view of the environment.
Thanks.

You can use the eclipse plugin:
http://sourceforge.net/projects/shelled/

Probably Eclipse uses some other shell to execute the script, one that cannot define functions. Put a line #!/bin/bash at the top of the script.

Related

BiqQuery detected on windows command prompt but not on Bash

I've installed Cloud SDK on my windows 10 machine and I'm able to run commands like "gcloud", "gsutil" and "bq" on my command prompt. However, when I run "gsutil" or "bq" on Bash, this is the error I'm getting.
$ bq
bash: bq: command not found
Then I added this location to PATH C:\Users\User\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin, and afterwards I seem to be able to call gsutil and bq using gsutil.cmd and bq.cmd. But of course, I'd prefer calling bq / gsutil directly.
Has anyone has this problem before? Thank you!
I found one possible solution!
In Bash, go to the root bash folder by typing cd
Type touch .bashrc
write alias bq="bq.cmd" or alias gsutil="gsutil.cmd" or both
Press Esc and type :qa and Enter to save and exit
This tells Bash to remember bq as invoking bq.cmd, hence now I can invoke bq anywhere -- as far as I know.
If anyone has a better suggestion, please let me know! Thank you!
In the bash session itself, check what echo $PATH returns. It should inherit the path that was defined on Windows.
So open a new CMD session, and:
make sure the %PATH% does include C:\Users\User\AppData\Local\Google\Cloud SDK\google-cloud-sdk\bin,
then call C:\path\to\Git\bin\bash.exe to open a bash session
bq should work in such a shell session.

Run Play application in production mode using dist taks

I am using 'dist' task to generate a distribution of my play application. But if I unzip the generated artifact, in the bin/ directory I have access to the bash file generated by the 'dist' task. The last line of the script is : run "$#"
I saw in the official Play Framework documentation that 'run' command should not be used in production mode, and the recommended way is to generated a distribution with task 'dist'
Why 'dist' is generating a bash script which is using 'run' commmand if it is not recommended in production mode?
I am asking this, because when I deploy my application in production, the first request is slow...it seems the development behavior. But I am using the 'dist' command.
I would appreciate any help.
Thank you.
You are mixing two different things.
The run command stated in the Play documentation is a SBT command, that will start your app in dev mode. So to use that command you have to use activator or sbt (ex: ./activator run).
The run you see in that script is a bash function (defined a little above), that will start your app in production mode. A little snippet from that function:
# Actually runs the script.
run() {
# TODO - check for sane environment
# process the combined args, then reset "$#" to the residuals
# (...)
execRunner "$java_cmd" \
${java_opts[#]} \
"${java_args[#]}" \
-cp "$(fix_classpath "$app_classpath")" \
"${mainclass[#]}" \
"${app_commands[#]}" \
"${residual_args[#]}"
(...)
}
So, if you use this script to run your app, it will start in production mode.

is there a way to create shortcuts for a list of windows commands?

Not very sure if this is the right way of asking, but I was wondering if it is at all possible to "bunch/combine" these commands:
cd %webapps%
cls
mvn clean install
copy etc\environment\dev\yao\env.conf.bat webapps-dist\target\classes
yes
cd %jboss%
run.bat -c server -b 0.0.0.0
shutdown.bat -S
into ONE command like: %runserver% or something like that?
Also, is there a way to get rid of the prompt when I try to copy a file?
I literally do this every time I reinstall my apps, so a shortcut would be amazing.
I already just copy and paste these commands, but I'm lazy so I want shorter commands.
If you are running these commands from the same location, you can make a batch file and just run the batch file.

pycuda -- 'CUDA_ROOT not set, and nvcc not in path.'

Although i had installed pycuda and using it ok,it started (without doing sth) not to work.So,i i tried to do the install again ,but when i am doing
python configure.py --cuda-root=/usr/local/cuda/bin
it gives me the error in the title.
The nvcc file is in the above directory.
pycuda is not finding nvcc. Did you try adding /usr/local/cuda/bin to your env PATH variable? That's the way I have this setup.
Edit:
As far as I can tell the configure.py doesn't call nvcc compiler it just creates the the makefile. I take that this problem happens when you run sudo -c "make install" which calls setup.py.
A couple of things to try. Make sure that you have CUDA_ROOT set:
echo $CUDA_ROOT
If it's empty, set it with:
export CUDA_ROOT=/usr/local/cuda/bin
Try running the make command again. Now with the -E to preserve your env:
sudo -E sh -c "make install"
I encountered the same issue on a Slackware64 13.37.
Install command su -c "make install" switches to root (0bv10u5Ly) thus CUDA_ROOT should be set in the root's profile. CUDA_ROOT is not an environment variable, it's used by the setup.py. Add /usr/local/cuda/bin to PATH and define CUDA_ROOT=/usr/local/cuda/bin then try to install again.
This is the quick and dirty way but if none of above worked out for you like me, below will definitely work. (:
Remove
nvcc_path = search_on_path(["nvcc", "nvcc.exe"])
if nvcc_path is None:
print("*** CUDA_ROOT not set, and nvcc not in path. Giving up.")
sys.exit(1)
and set
cuda_root_default = "/usr/local/cuda/bin"
in setup.py file. Then try su -c "make install".
In my case, I had to set CUDA_ROOT=/usr/local/cuda because with /usr/local/cuda/bin path, it was not able find include folder and it was failing with error didn't find cuda.h.

How do I run a PAR packed file in Windows Vista or Windows 7 running with higher privileges?

Does anyone know how to make a PAR packed Perl application run with higher privileges?
I've read that there must be somewhere some kind of manifest file, but how should this file look like and how to combine it with the PAR packed executable? This is still unknown to me.
Any ideas?
In http://www.mail-archive.com/par#perl.org/msg04642.html Mark Dootson proposed a possible implementation of UAC manifests for pp-packed executables using Win32::Exe:PP.
Until that is done, though, there is an easy workaround, which you probably already knew: Name the .exe file "setup.exe" and the user will be prompted for elevated rights. :-)
Yes, I know.
Please see this http://codepad.org/CDWhFoZu
my $ exe = Win32 :: Exe-> new ('C: \ Users \ treeboa \ perl \ pic.exe');
Specifies the exe that want to run in administrator
$ Exe-> update (manifest => '. / Pic.exe.manifest');
I set to pic.exe the pic.exe.manifest
Run the update.pl
Double-click the pic.exe
Run dialog displays the administrator pic.exe
Success!