Grails 2.3.1 in GGTS(Eclipse): Out of memory error when using run-script - eclipse

I am executing a groovy script with run-script and running out of memory. I have found instructions for configuring ones GRAILS_OPTS on the command line, however I am not on the command line. How do I make sure that the grails command prompt in GGTS(Eclipse) is configured to provide enough memory for a script?
Just to be clear - this is a problem with run-script from the groovy command prompt inside The GGTS 3.4.0 release (Eclipse).

You can try setting the JAVA_OPTS system variable instead of the specific GRAILS_OPTS variable. It seems to work for me.
e.g
JAVA_OPTS="-Xms1024m -Xmx2024m -XX:MaxPermSize=512m"
For reference from grails docs - http://grails.org/doc/2.3.x/guide/commandLine.html, search for JAVA_OPTS. Depending on what OS you are on the syntax may be different.

Related

Can't load cake module - Preprocessor directive expected

I'm trying to run a cake build script that loads a module for long file path but it only returns
error CS1024: Preprocessor directive expected
In the cake file I have added
#module nuget:?package=Cake.LongPath.Module&version=0.5.0
and this is the line where I get the error at (1,2)
In the docs It states that this is the format and that I should run the script with --bootstrap before actually running the script. Running Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" --bootstrap" causes a the error and then I also get it on the line after when running it without the --bootstrap flag.
What I need is to make sure that Cake.LongPath module is installed and loaded in CI. Any thoughts on other solutions would also be helpful
The --bootstrap command was only added in Version 0.24.0 of Cake. You can see the release notes here:
https://github.com/cake-build/cake/releases/tag/v0.24.0
And the issue that it was worked on here:
https://github.com/cake-build/cake/issues/1950
I am fairly sure that this issue will be solved by upgrading to a newer version of Cake. This can be done by changing the version number in the packages.config file, and by clearing out the tools folder. NOTE: Depending on what version of the bootstrapper you are using, the clearing out of the tools folder may be done for you automatically.

configuring the interpreter for eclipse 4.6.0

I am trying to start a new PyDev Project and first need to setup the interpreter. The auto-config does not find a "valid interpreter". And so I must manual config. Perhaps someone with experience in this procedure knows of the specific name for the Interpreter Executable I am looking for. Thanks!
To get the interpreter you need to use, start the python interactive console in a shell and then do:
import sys; print(sys.executable)
The path printed is the interpreter you should use.
As a note, PyDev 4.6.0 is pretty old already, so, my suggestion would be upgrading to the latest release as many things were improved in the meanwhile.

How do I read a Linux environment variable into install4j

My application sets CLASSPATH in a shell script named shrc that sets up the environment to run java commands. Is there an easy way to pass the CLASSPATH used in an installed application to install4j so I can use it in an action? The working solution I have uses "Run executable or batch file" to run a script that does this:
. ./shrc
${APPHOME}/jre/bin/java -cp ${CLASSPATH} ...etc...
I do this within an add-on installer, so the shrc already exists, but I need to run some of the existing java code to configure the patches.
It seems to me there must be a better way to do this that would work on Windows also. Any help is appreciated.
To read environment variables, use
System.getenv("CLASSPATH")
If you would like to use it as an install4j installer variable, add a "Set a variable" action with the above line as the script.

Unable to acquire Oracle environment handle

Environment: Eclipse Indigo or Eclipse Juno 4.2 on Windows 7. Oracle 11g XE (local install)
When running my Django project in pydev, attempted page access results in the message "Unable to acquire Oracle environment handle".
Normally, all I have to do is set TNS_ADMIN to point to the correct tnsnames.ora directory.
If I run manage.py from the command line, all works as expected. I thought at first that it was probably an environment variable difference, but the TNS_ADMIN values are the same. In any case, explicitly setting TNS_ADMIN in the Eclipse run configuration didn't make a difference.
PYTHONPATH was somewhat different between the two, and I went to the trouble of overriding it in the run config to see if it made the difference. Nope.
Looking at the cx_Oracle source, the error seems to come from a failure in a call to OCIEnvNlsCreate, but I didn't see anything obvious in the Oracle documentation.
Can anyone give me a clue why I'm getting this in Pydev?
I figured it out. I didn't look hard enough at the PATH variable.
Basically, there was a virtual environment that needed its scripts directory (containing OCI.DLL) to be first in the path, but my Oracle installation was ahead of it. So, the error message was basically the result of calling the wrong OCI.DLL (the one associated with my Oracle installation, rather than the one cx_Oracle was bound to).
Activating the virtual environment worked because it changed the path. Pydev works differently, so Eclipse was seeing my standard path with the Oracle install first.

How to make sphinx look for modules in virtualenv while building html?

I want to build html docs using a virtualenv instead of the native environment on my machine.
I've entered the virtualenv but when I run make html I get errors saying the module can't be imported - I know the errors are due to the module being unavailable in my native environment.
How can I specify which environment should be used when searching for docs (eg the virtualenv)?
The problem is correctly spotted by Mathijs.
$ which sphinx-build
/usr/local/bin/sphinx-build
I solved this issue installing sphinx itself in the virtual environment.
With the environment activated:
$ source /home/migonzalvar/envs/myenvironment/bin/activate
$ pip install sphinx
$ which sphinx-build
/home/migonzalvar/envs/myenvironment/bin/sphinx-build
It seems neat enough.
The problem here is that make html uses the sphinx-build command as a normal shell command, which explicitly specifies which Python interpreter to use in the first line of the file (ie. #!/usr/bin/python). If Python gets invoked in this way, it will not use your virtual environment.
A quick and dirty way around this is by explicitly calling the sphinx-build Python script from an interpreter. In the Makefile, this can be achieved by changing SPHINXBUILD to the following:
SPHINXBUILD = python <absolute_path_to_sphinx-build-file>/sphinx-build
If you do not want to modify your Makefile you can also pass this parameter from the command line, as follows:
make html SPHINXBUILD='python <path_to_sphinx>/sphinx-build'
Now if you execute make build from within your VirtualEnv environment, it should use the Python interpreter from within your environment and you should see Sphinx finding all the goodies it requires.
I am well aware that this is not a neat solution, as a Makefile like this should not assume any specific location for the sphinx-build file, so any suggestions for a more suitable solution are warmly welcomed.
I had the same problem, but I couldn't use the accepted solution because I didn't use the Makefile. I was calling sphinx-build from within a custom python build file. What I really wanted to do was to call sphinx-build with the exact same environment that I was calling my python build script with. Fiddling with paths was too complicated and error prone, so I ended up with what seems to me like an elegant solution, which is to "manually" load the console script entry point and call it:
from pkg_resources import load_entry_point
cmd = load_entry_point('Sphinx', 'console_scripts', 'sphinx-build')
cmd(['sphinx-build', basepath, destpath])