marklogic undefined function error xdmp:server-root - console

when i run the script xdmp:server-root(xdmp:server("http-cvsearch-8200")) in Marklogic Console, i got an error: the xdmp:server-root() function is not defined. The ML version is 8.0-3.2.

I tried another function and it works well.
let $config := admin:get-configuration()
return admin:appserver-get-root($config,xdmp:server())

Probably you were executing the command on the qconsole attached with a database as a source, remember that xdmp:server-root works on AppServers, XDBC or ODBC server.

Related

XQuery process:execute how to execute external programm?

I am running exist-db on windows and would like to execute an external windows program.
This works inside the normal windows shell:
C:\path\to\webGLRtiMaker.exe C:\path\to\ImageFile.rti -q 90
And I would like to execute the same program from my xquery script (I have uploaded all the needed files according to my specified paths to my exist-db):
xquery version '3.1';
import module namespace process="http://exist-db.org/xquery/process" at "java:org.exist.xquery.modules.process.ProcessModule";
declare variable $options := '<options>
<workingDir>/db/apps/test-project/images</workingDir>
<stdin><line>/db/apps/execute-test/images/image1.rti -q 90</line></stdin>
</options>';
(:process:execute($webRtiMaker, <options/>):)
process:execute('/db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe', $options)
Even if I only execute the program without parameters (if I execute it inside windows I get the parameters as overview inside the command prompt so I should also receive some kind of output):
process:execute('/db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe', <options/>)
But I get the error:
exerr:ERROR An IO error occurred while executing the process /db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe: Cannot run program "/db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe": CreateProcess error=2, The System cannot find the file ...
I used this as reference: Execute External Process
What am I doing wrong?
I have not tried this recently, but try the following:
import module namespace process="http://exist-db.org/xquery/process" at "java:org.exist.xquery.modules.process.ProcessModule";
let $cmd := 'C:\path\to\webGLRtiMaker.exe C:\path\to\ImageFile.rti -q 90'
return
<results>{process:execute($cmd, <options/>)}</results>
There is an article at the XQuery WikiBook about it.
Unfortunately it is not possible to start an executable that is stored inside the database. The java API requires direct access to a file on the filesystem, and the '/db/....' path is not.

Using the package RAdwords in an R script on a Unix server Error in rjson

I have the following script, which works perfectly fine, when I run it on my local PC:
library(RAdwords)
autX <- doAuth()
data <- getData(clientCustomerId='xxx-xxx-xxxx',
google_auth=autx
)
However, when I try to run the very same script on my Unix-Server, then I get this error message:
Error in rjson::fromJSON(RCurl::postForm("https://accounts.google.com/o/oauth2/token", :
STRING_ELT() can only be applied to a 'character vector', not a 'raw'
Question: What could be the reason and how can I fix it?
By the way:
I did copy the files .gitgnore and .google.auth.RData from the folder on my local PC, where I already did this authentification, to the directory on my server.
If I just type doAuth() alone I do not get an error message.
Issue:
getData()calls the function refreshToken() that updates the authentication token of the Google AdWords API. Within the function refreshToken the RCurl command returns a raw data file instead of a character file format. rjson::fromJSON returns an error that is solved with the addition of rawToChar().
Solution:
I created a patch of the function and updated the Github development version of RAdwords.
You can install the new package version with:
require(devtools)
install_github('jburkhardt/RAdwords')

using pl/sql external package and getting error with declaration

I need to run a procedure in a package external to my script. The script is in an APEX page:
begin
idsud.segyload.loaddataset(p_dataset_id => :p40_dset, p_mode => 'INIT');
end;
When I try to use this I get an error saying that I must declare the "idsud.segyload" package. How to do this?
Have you added the appropriate permissions?
e.g. GRANT EXECUTE ON idsud.segyload TO {apex_schema};

Meteor Jade Handlebars on Windows 8 - Jade compiler error: Cannot read property 'length' of undefined

I'm attempting to use jade in meteor with this package https://github.com/SimonDegraeve/meteor-jade-handlebars
I'm on a windows machine. I've so far managed to use most meteorite packages by following the instructions here (www.discovermeteor.com/2013/03/20/using-meteor-and-atmopshere-on-windows/)
When i run 'meteor' on my project with .jade files, I'm getting this error:
While building the application:
client\todos.jade: Jade compiler error: Cannot read property 'length' of undefin
ed
=> Your application has errors. Waiting for file change.
Terminate batch job (Y/N)?
I tried to use this new fork too -> https://github.com/kynan/meteor-jade-handlebars/tree/refactor-for-meteor-0.6.5
Same problem.
I further tested this in a Linux machine and it works perfectly. I have no idea why this is failing with the above mention error on windows.
Try adding a blank extra line to the end of your file. For example, an extra line would be needed here.
template(name="name")
h1 Hello!
I've been dealing with a lot of problems getting jade-templating to work with meteor, but finally got it to work.. Here's how:
Add this to smart.json, belt-jade-handlebars is jade for newer versions of meteor:
"packages": {
"belt-jade-handlebars": {}
}
Add this to .meteor/packages:
belt-jade-handlebars
And finally add the extra blank line to all *.jade files. ( suggested by user3064375 )
Start the app by using:
$ meteor run --release template-engine-preview-3
This will use the latest template engine and start meteor.

Parse error when on production

I have developed a Symfony2 project (v2.2.2) and it was working all fine locally.
When I deploy it on my server I meet 2 issues:
the folder /bin does not transfer through Filezilla (impossible to start transfer)
i encounter a parse error when trying to access web/app.php/ in debug mode (see below)
First I do not understand why it would work in local but not on production.
I also guessed these errors where linked but I do not know what is /bin used for (contains only 2 files doctrine and doctrine.php) and if I remove it locally it keeps working ...
Parse error is the following :
"FatalErrorException: Parse: syntax error, unexpected '[' in /home/colocall/twinkler/src/Tk/ExpenseBundle/Services/Expenses.php line 21"
Expenses.php line 15->25:
public function getAllExpenses($member, $group)
{
$all_expenses_col = $group->getExpenses();
$all_expenses = array();
foreach($all_expenses_col as $expense){
$all_expenses[] = [$expense, $this->forYou($member, $expense)];
}
return $all_expenses;
}
Maybe linked to : The parse error also happen when i try to update my database through ssh connection.
If someone would know the reason why I can't make it working it would save my day that i have already lost ...
Thank you in advance,
Jules
Your error is produced by using the short array syntax [] in your code.
It is not available in PHP 5.3.10 aka on your production server. The short syntax was introduced in PHP 5.4 which explains why your code is working in your dev-environment.
change ...
$all_expenses[] = [$expense, $this->forYou($member, $expense)];
...to
$all_expenses[] = array($expense, $this->forYou($member, $expense));
... or update your server's php version and it will work :)

Resources