Re: [basex-talk] basexhttpstop hangs in 8.6.1

2017-02-27 Thread Christian Grün
Hi Marco,

Could you please report back to us what exactly is output on the two
shells? Ideally, please run both commands with the -d flag.

Thanks in advance,
Christian

PS: Does it work with 8.6, 8.5.3 or older versions?



> I just downloaded Basex861.zip for Linux (Ubuntu 16.04 the host).
>
> Unizipped and started basexhttp. Everything ok.
>
> In another shell I launch basexhttpstop which correctly shuts down the
> server started before. But basexhttpstop itself does not terminate.
>
> This is causing some headache in our scripts that launch and stop several
> instances.
>
> Any clue?
>
> Thanks a lot,
>
> Marco.
>


Re: [basex-talk] Exit a for-loop?

2017-02-27 Thread Marc van Grootel
Hi Joseph, 

Maybe hof:until [1] and hof:take-while [2]?

[1] http://docs.basex.org/wiki/Higher-Order_Functions_Module#hof:until
[2] http://docs.basex.org/wiki/Higher-Order_Functions_Module#hof:take-while


--Marc

> On 27 feb. 2017, at 19:25, Dirk Kirsten  wrote:
> 
> Hello Joseph,
> 
> to be honest, this doesn't sound particularly like functional
> programming. The nice thing about functional programming is that you
> shouldn't care about such optimization stuff (like breaking out of a for
> loop), but instead our optimizer should be clever enough to stop
> executing the function once he has enough results. So simply request the
> first result and you should be fine. Something like this:
> 
> 
>  (for $a at $pos in $seq1
>  where $a = $seq2[$pos]
>  return $a)[1]
> 
> Cheers
> 
> Dirk
> 
> 
>> On 02/27/2017 09:42 PM, Joseph wrote:
>> Hi,
>> 
>> I have two sets of numbers, and I would like to write a for-loop for
>> comparison, so that I get only the first match between the numbers. I
>> was thinking of a double for-loop, but I do not know how to exit the
>> comparison as soon as I get the first match. Any idea? Thanks.
>> 
>> Joseph
> 
> -- 
> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
> |   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
> `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22
> 


Re: [basex-talk] Exit a for-loop?

2017-02-27 Thread Dirk Kirsten
Hello Joseph,

to be honest, this doesn't sound particularly like functional
programming. The nice thing about functional programming is that you
shouldn't care about such optimization stuff (like breaking out of a for
loop), but instead our optimizer should be clever enough to stop
executing the function once he has enough results. So simply request the
first result and you should be fine. Something like this:


  (for $a at $pos in $seq1
  where $a = $seq2[$pos]
  return $a)[1]

Cheers

Dirk


On 02/27/2017 09:42 PM, Joseph wrote:
> Hi,
>
> I have two sets of numbers, and I would like to write a for-loop for
> comparison, so that I get only the first match between the numbers. I
> was thinking of a double for-loop, but I do not know how to exit the
> comparison as soon as I get the first match. Any idea? Thanks.
>
> Joseph 

-- 
Dirk Kirsten, BaseX GmbH, http://basexgmbh.de
|-- Firmensitz: Blarerstrasse 56, 78462 Konstanz
|-- Registergericht Freiburg, HRB: 708285, Geschäftsführer:
|   Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle
`-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22



[basex-talk] Exit a for-loop?

2017-02-27 Thread Joseph
Hi,

I have two sets of numbers, and I would like to write a for-loop for
comparison, so that I get only the first match between the numbers. I was
thinking of a double for-loop, but I do not know how to exit the comparison
as soon as I get the first match. Any idea? Thanks.

Joseph


[basex-talk] Multipart form-data submissions from RESTXQ

2017-02-27 Thread Tim Thompson
Hello,

I have been agonizing over a problem with a service I'm trying to call from
RESTXQ. The service (www.tei-c.org/oxgarage/) only accepts
multipart/form-data submissions. It provides a front-end client for
uploading files from the browser, which calls a back-end RESTful service to
do document conversion.

I've installed a local instance of the service (
https://github.com/TEIC/oxgarage) and have it running on Tomcat 7, along
with BaseX.

The problem arises when I try to submit documents with non-ASCII characters
from RESTXQ. Looking at the network traffic, I can see that if the document
contains only ASCII characters, the multipart submission body is not base64
encoded. For example:

Encapsulated multipart part:  (text/xml)
Content-Disposition: form-data; name='fileToConvert';
filename='homework.xml'\r\n
Content-Type: text/xml\r\n\r\n
eXtensible Markup Language
http://www.w3.org/1999/xhtml;>



Test



http://www.w3.org/1998/Math/MathML;>



2






However, if the document does contain non-ASCII characters (such as β),
BaseX sets the Content-Transfer-Encoding to "base64." This causes the
OxGarage service to fail because it thinks it is receiving an image file
rather than a textual document. For example:

Content-Type: text/xml\r\n
Content-Transfer-Encoding: base64\r\n\r\n
eXtensible Markup Language
[truncated]
PGh0bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGh0bWwiPjxoZWFkPjxtZXRhLz48\r\ndGl0bGU+VGVzdDwvdGl0bGU+PC9oZWFkPjxib2R5PjxtYXRoIHhtbG5zPSJodHRwOi8vd3d3Lncz\r\nLm9yZy8xOTk4L01hdGgvTWF0aE1MIj48bXN1Yj48bWk+zrI8L21pPjxtbj5Ud288L21

Attached here is a basic test case to replicate the problem: an HTML page
with a form and the RESTXQ function that it calls.

I've tried setting a new header to specify Content-Transfer-Encoding as
"binary" instead of "base64," but it doesn't replace the default header. Is
there any way that the encoding could be controlled from RESTXQ?

Thanks in advance!

Tim

--
Tim A. Thompson
Metadata Librarian (Spanish/Portuguese Specialty)
Princeton University Library

www.linkedin.com/in/timathompson
t...@princeton.edu
Title: Test multipart-post



Click to test multipart-post from RESTXQ: 


 
A small HTML doc containing the following MathML markup will be submitted by the server to an instance of the OxGarage service.


β
2







multipart-test.xqm
Description: Binary data