Error while trying to execute an example mirah script? - mirah

$ ../bin/mirah -e fib.mirah
Inference Error:
Cannot find static method fib() on DashE
DashE:1: Cannot find static method fib() on DashE
Got this while trying to run the mirah script that is grabbed from the examples folder. How can I fix this, thanks!

Ok. I should use mirahc instead of mirah. So... fixed.

Related

Print check_cxx_source_runs() detailed output

I have a find package module that utilizes check_cxx_source_runs() to test if package was loaded properly. However, it fails and I am not sure what causes it to.
Is there any way I can print the actual error (as one would see on terminal) from check_cxx_source_runs() rather than just the variable that tells success/failure?
I found the error output in "CMakeError.log" under the build directory.

Training a new entity type with spacy

Need help to try adding new entity and train my own model with spacy named entity recognition. I wanted first to try the example already done here:
https://github.com/explosion/spaCy/blob/master/examples/training/train_new_entity_type.py
but i'am getting this error :
ipykernel_launcher.py: error: unrecognized arguments: -f /root/.local/share/jupyter/runtime/kernel-c46f384e-5989-4902-a775-7618ffadd54e.json
An exception has occurred, use %tb to see the full traceback.
SystemExit: 2
/usr/local/lib/python3.6/dist-packages/IPython/core/interactiveshell.py:2890: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D.
warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)
Tried to look into all related questions and answers and couldn't resolve this.
Thank you for your help.
It looks like you're running the code from a Jupyter notebook, right? All spaCy examples are designed as fully standalone scripts to run from the command line. They use the Python library plac for generating the command-line interface, so you can run the script with arguments. Jupyter however seems to add another command-line option -f, which causes a conflict with the existing command-line interface.
As a solution, you could execute the script directly instead, for example:
python train_new_entity_type.py
Or, with command line arguments:
python train_new_entity_type.py --model en_core_web_sm --n-iter 20
Alternatively, you could also remove the #plac.annotations and plac.call(main) and just execute the main() function directly in your notebook.

WebHCat & Pig - how to pass a parameter file to the job?

I am using HCatalog's WebHCat API to run Pig jobs, such as documented here:
https://cwiki.apache.org/confluence/display/Hive/WebHCat+Reference+Pig
I have no problem running a simple job but I would like to attach a parameters file to the job, such as one can do using pig command line's parameter: --param_file .
I assume this is possible through arg request's parameter, so I tried multiple things, such as passing:
'arg': '-param_file /path/to/param.file'
or:
'arg': {'param_file': '/path/to/param.file'}
None seems to work, and error stacks don't say much.
I would love to know if this is possible, and if so, how to correctly achieve this.
Many thanks
Correct usage:
'arg': ['-param_file', '/path/to/param.file']
Explanation:
By passing the value in arg,
'arg': {'-param_file': '/path/to/param.file'}
webhcat generates "-param_file" for the command prompt.
Pig throws the following error
ERROR org.apache.pig.Main - ERROR 2999: Unexpected internal error. Can not create a Path from a null string
Using a comma instead of the colon operator passes the path to file as a second argument.
webhcat will generate "-param_file" "/path/to/param.file"
P.S: I am using Requests library on python to make the REST calls

Defining variables with indirect expansion

I know that I can use indirect expansion to call variables whose names are contained in other variables as follows
VAR="test"
VARNAME="VAR"
echo ${!VARNAME}
However if I try to redefine a variable with this:
VARVALUE=0
VALUE="VARVALUE"
${!VARNAME}=${!VALUE}
echo ${!VARNAME}
It doesnt work, and I get
bash: test=0: command not found
I can see why this variable declaration fails, but I can't see how to fix it. In searching I've only found examples calling variables with indirect expansion, but not defining them so.
edit:
After a bit more searching, I've tried
eval "${!VARNAME}=${!VALUE}"
which throws
bash: =0: command not found
Fiddling with it some more, I've managed to find a solution
eval "$VARNAME=${!VALUE}"

Space in path in a shell script

I have a variable
android="/media/New Volume_/android-sdk-linux_86"
I get an error saying that it cannot find the directory
I changed it to android="/media/New\ Volume_/android-sdk-linux_86"
I still get the same error. I even tried
android="/media/'New Volume_'/android-sdk-linux_86"
and I am using "$android" everywhere ...
I am not able to find the error, can someone help me..
Thanks
Take it this is bash? You assign variables with spaces like this:
android="/media/New Volume_/android-sdk-linux_86"
(Note you don't use the $ notation when setting a value.)
And reference them like this:
cd "$android"