xquery- getting duplicate function definition error when I use the functx library from xqueryfunctions.com - xquery

I am trying to run some Xquery code in a java program and I am using the Saxon free java library for this purpose.
Now for some reason I am getting repeated "duplicate function definition" errors when I run this code-- this error is occurring for the "Functx" Xquery library which I downloaded from xqueryfunctions.com.
I dont understand what is wrong here? I am making straightforward calls to some functions in the FunctX Library.
Given below is a section of the error log- it also mentions the line numbers for the "duplicate functions"-- however, when I went to the 2 line numbers I saw that one line number corresponded to the start of that function, while the other line number closed that function.
The library that I am using is at this URL--
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.com/functx-1.0.xq
A section of the error log is given below--
Error on line 2488 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-days-from-duration (see line 2
484 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2502 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-hours-from-duration (see line
2498 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2516 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-minutes-from-duration (see lin
e 2512 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2530 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-months-from-duration (see line
2526 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2544 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...ion the duration :) declare#:
Duplicate definition of function functx:total-seconds-from-duration (see lin
e 2540 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Error on line 2558 column 4 of functx-1.0.xq:
XQST0034 XQuery static error near #...e string to trim :) declare#:
Duplicate definition of function functx:total-years-from-duration (see line
2554 in
http://e0aad1ab954aa14b69e0-bd55729d8fadb0b3214bfee0a8fb65e0.r16.cf1.rackcdn.c
om/functx-1.0.xq)
Now, looking at the last error as shown above-- the line numbers for the duplicate function definition error in functx-1.0.xq are "2558" and "2554"
The relevant code from the file functx-1.0.xq for lines 2554-2558 is now given below--
declare function functx:total-years-from-duration
( $duration as xs:yearMonthDuration? ) as xs:decimal? {
$duration div xs:yearMonthDuration('P1Y')
} ;
How do I resolve this error?

When you use xquery engine in a loop for example (my case) and you use one single object to execute multiple xquery that import the same function the engine will try to import the function each time, so you have duplicate the second loop.
To solve that I simply reset the object configuration each time I execute the xquery (in my Java problem I created a class that run the xquery engine and do al lthe configuration from 0 each time, so that previous run does not mess up the new run).

Related

Creating winword from ACUCOBOL using OLE object definitions

I'm pretty new to COBOL and programming and I'm having problems to create a word document from COBOL using ole object definitions.
I cant really find a good documentation for it, just some vba examples.
I got some stuff to work - creating the document, writing text, formatting the text.
Now I'm trying to add a header with an image to it - I found some vba code which I'm trying to translate:
With ActiveDocument.Sections(1).Headers _ .Item(wdHeaderFooterFirstPage).Range.InsertBefore "Sales Report"
I don't really understand it, because "headers" is not a property of sections, and also I never learned vba...
I'm using microfocus acubench 10.2.1
Current code:
working-storage section.
77 hFileSystemObject handle of FileSystemObject.
01 word-handles.
03 wrdApp handle of Application of word.
03 wrdDoc handle of Document of word.
03 sections handle of section of word.
03 myHeaderFooter handle of WdHeaderFooterIndex of word.
procedure division.
word-testing-section.
word-testing-010.
CREATE Application OF Word HANDLE IN WrdApp.
MODIFY WrdApp Documents::Add() GIVING wrdDoc.
MODIFY WrdApp #Visible = 1.
modify wrddoc #range = (0,100).
modify wrddoc #sections ::add() giving headersection.
modify wrddoc #sections(1)::#headers::
#item(wdHeaderFooterFirstPage)::#range::#insertbefore =
"Sales Report".
leads to:
D:\AcuReal\Source\testing2.cbl, line 52: Wrong number of parameters: 0 expected, 1 found
D:\AcuReal\Source\testing2.cbl, line 52: '#HEADERS' is not a property or method of 'CLASS #SECTIONS'
D:\AcuReal\Source\testing2.cbl, line 52: 'SECTIONS' must be a 'put' property or method of '#SECTIONS'
D:\AcuReal\Source\testing2.cbl, line 52: Undefined data item: #HEADERS
D:\AcuReal\Source\testing2.cbl, line 52: Verb expected, :: found
i also tried
modify WRDdoc #sections::#item(1)::
#headers::#item(#wdHeaderFooterPrimary)::#range::insertbefore"test".
D:\AcuReal\Source\testing2.cbl, line 60: Wrong number of parameters: 0 expected, 1 found
D:\AcuReal\Source\testing2.cbl, line 60: Wrong number of parameters: 0 expected, 1 found
and if i delete the parameters
D:\AcuReal\Source\testing2.cbl, line 58: Wrong number of parameters: 1 expected, 0 found
D:\AcuReal\Source\testing2.cbl, line 60: Wrong number of parameters: 1 expected, 0 found
Im pretty sure i have to use item twice with the wdHeaderFooterFirstPage parameter, but i have no idea why i get "wrong number of parameters"
Really frustrating
How can I create a word document from COBOL using ole object definitions?

Error in source() unexpected numeric constant

when I write an R script in a test.R file
nb <- 22
paste("Etudions le nombre: ",nb)
paste("Le logarithme népérien de ce nombre est: ", log(nb))
paste("La racine carrée de ce nombre est: ", sqrt(nb))
paste("Le cosinus de ce nombre est: ", cos(nb))
paste("Si on ajoute 3 au nombre ", nb, " on obtient: ", nb + 3)
q("ask")
I executed using :
source("/Users/shous/Desktop/Master2.0/LanguageR/test.R")
error message :
Error in source("/Users/shous/Desktop/Master2.0/LanguageR/test.R") :
/Users/shous/Desktop/Master2.0/LanguageR/test.R:1:9: unexpected numeric constant
1: nb <- 22
It can be encoding problem: unexpected numeric constant 1: nb <- 22
I guess you don't want to have this character Â.Try to change file encoding or rewrite problematic line (not copy paste).
unexpected numeric constant 1: nb <- 22
This is R telling you that it found the line
nb <- 22
and that isn't valid syntax. You can duplicate this simply on the command line with something like a = a 22, which also isn't valid syntax. You need to correct that line of code - I don't know what you want it to be, perhaps there is a missing line break, or perhaps it should be  + 22 or Â[22], etc...
The line that produces the error does not occur in the code you show, perhaps you should make sure you are running the right file.

Scilab Error 10000

Hi I am new to scilab and don't have much mathematical background.
I have been following code for another example and am being shown error 10000 for the following code:
function [z]=f(x,y)
z=0.026*(1.0-(y/ym))*y;
endfunction;
ym=12000;
x0=1950;y0=2555;xn=5;h=10;
x=[x0:h:xn];
y=ode("rk",y0,x0,x,f);
disp("x y")
disp("--------")
disp([x'y']);
function z=fe(x)
z=ym/(1-(1-ym/y0)*e^(-k*(t-t0)));
endfunction;
xe=(x0:h/10:xn);
n=length(xe)
for i=1:n
ye(i)=fe(xe(i));
end;
plot (x,y,'ro',xe, ye,'-b');legend ('rk4','Exact',3);
xtitle('solving dy/dx=k(1-y/ym)y','x','y');
I have worked through several other error messages. I am lost and don't know if the problem is in the code or the way I set up the problem. The following is the current error message:
!--error 10000
plot: Wrong size for input argument #2: A non empty matrix expected.
at line 57 of function checkXYPair called by :
at line 235 of function plot called by :
plot (x,y,'ro',xe, ye,'-b');legend ('rk4','Exact',3);
at line 25 of exec file called by :
I would appreciate any help.
Thanks
Start by adding clear as first statement, this will erase all variables before running your function. In the above script you don't declare ye.
Also the statement x=[x0:h:xn]; is strange with those values for x0,h and xn. You are now trying to get a list of x-values starting at 1950 and with positive steps of 10 up until 5 is reached.
I would recommend to try each line and see if the outcome is as expected. You do not need to know everything about the code, but probaly x and y should contain at least some values. The error is telling you that it expected a non-empty matrix for argument 2. This is y, so essentially it is telling you y is empty.

Errors when loading ci-merchant library

I'm trying to use http://ci-merchant.org/ for CodeIgniter. But when I load the merchant library, I get these errors:
A PHP Error was encountered
Severity: Warning
Message: stripos() expects parameter 1 to be string, array given
Filename: libraries/merchant.php
Line Number: 97
A PHP Error was encountered
Severity: Warning
Message: strtolower() expects parameter 1 to be string, array given
Filename: libraries/merchant.php
Line Number: 103
Here is my code:
$this->load->library('merchant');
$this->merchant->load('paypal_express');
Looking at the source of that file, the driver name needs to be passed as a string. So I highly doubt the two lines of code you put above is actually what's being called, it looks like you are passing an array as the driver name.
If you aren't sure where it's coming from, try adding some debug_print_backtrace() lines to the merchant.php file to figure out where the array is getting passed from.

flex builder new projects with syntax errors

I'm a junior developer and I'm having some problems with my Flex Builder 3. Every time I make a new project, Flex Builder detects syntax errors like:
1084: Syntax error: expecting rightbracket before leftbrace. FotoBeheer line 23
1084: Syntax error: expecting rightbracket before public. FotoBeheer line 22
1084: Syntax error: expecting rightparen before s. DomoticaSystem line 16
1093: Syntax error. DomoticaSystem line 16
Nevertheless, Fotobeheer will run, but any other program won't even start. Does anybody have any ideas how to solve this problem?
This is indicitive of syntax problems at or before the first line of error. Extra brackets or parenthesis are the typical culprit.

Resources