eXist-db size limit - http-put

I'm trying to upload a file to eXist-db using a PUT request and am getting the following message:
500 Server Error: Form too large 392430>200000
How can I override this limit?

Answered on the exist-open mailing list at http://markmail.org/message/njpvhheytnlhiidu.

Related

How to be Sure that page downloaded is complete by python

I am downloading a JSON based huge page, most of the time it is downloaded successfully but sometimes, its downloading partially. How can I sure that download completed.
My example code is as follows:
mac_sonuclari_url = "http://mservice.fanatik.com.tr/LeagueStage?TournamentID={}&includeFixture=1"
with urllib.request.urlopen(mac_sonuclari_url.format(1)) as url:
try:
data = json.loads(url.read().decode())
except Exception as err:
logging.error("{}: Error Getting URL: {} with Error: {}".format(fna, mac_sonuclari_url.format(1), err))
unfortunately, I can't catch partial download by Try - Except.
Then my code breaks as it doesn't catch all data needed.
Is there any way to understand that page loaded completely?
Thanks a lot
[From the comments]
You could do a size check of the read string against the returned 'Content-Length' header. If all data has been retrieved, the two sizes should agree.

How do I init XOD in WebViewer? "DisplayModes" is undefined

I'm trying to load a XOD document into a PDFTron WebViewer. As far as I can read in the documentation and samples, this should be a simple "plug and play"-operation - it should simply work when you point at a file. Ideally, in my example, the document should be fetched from a service, as so:
fetch('/myservice/GetXOD')
.then(function(data) {
$(function() {
var viewerElement = document.getElementById("viewer");
var myWebViewer = new PDFTron.WebViewer({
initialDoc: data.body
}, viewerElement);
});
});
Unfortunately I get the following error:
Uncaught TypeError: Cannot read property 'DisplayModes' of undefined
The reason I'm doing it in a fetch, is because I'm rendering a Handlebars template, and pass the data to instantiate in a callback. However, I've isolated the code into an otherwise "empty" HTML-document, and in the simplified example below, I'm simply pointing at the XOD provided by PDFTron on page load (no fetch this time).
$(function() {
var viewerElement = document.getElementById("viewer");
var myWebViewer = new PDFTron.WebViewer({
initialDoc: 'GettingStarted.xod' // Using the XOD provided by PDFTron
}, viewerElement);
});
This unfortunately returns a different error (HTTP status 416).
Uncaught Error: Error loading document: Error retrieving file: /doc/WebViewer_Developer_Guide.xod?_=-22,. Received return status 416.
The same error appears when I run the samples from PDFTron on localhost.
I'm at a complete loss of how I should debug this further - all the samples assume everything is working out of the box.
I should note that I can actually get PDFs working just fine on localhost, but not on the server. XODs are problematic both on the server and on localhost.
I'm sorry to hear you are having troubles running our samples.
Your error message says 416 which means "Requested range not satisfiable". Perhaps your development servers do not support byte range requests (https://en.wikipedia.org/wiki/Byte_serving).
Could you try passing an option streaming: true? When streaming is true you're just requesting the entire file up front which shouldn't be a problem for any servers but it is a problem for WebViewer if the file is large because it will need to be completely downloaded and parsed at the start which is slow.

How can you detect a 500 Internal Server Error using Capybara?

I want to test whether some URLs are broken or not.
Now I just assert some words I know are on these pages. I feel this isn't the best that i can do. Any help?
I figured it out,
You Can detect "500 Internal Server Error" using poltergeist
Inspecting network traffic
You can inspect the network traffic (i.e. what resources have been loaded) on the current page by calling page.driver.network_traffic. This returns an array of request objects. A request object has a response_parts method containing data about the response chunks.
so, this will work :
page.driver.network_traffic.each do |request|
request.response_parts.uniq(&:url).each do |response|
puts "Error : #{response.url}" if response.status == 500
end
end

FormatMessage gets Error 317 while trying to read EventLog

I had nearly similar problem with this.
FormatMessage Fails with error code 317
The difference is it is said as an answer that this is caused by "FORMAT_MESSAGE_FROM_SYSTEM" but when I remove it it happens again.
I am trying to read from EventLog in Windows Server 2003. But when I try to use FormatMessage function I get 317 error.
Interestingly same code works for Windows Server 2008. How can I fix this or what can I use instead of FormatMessage?
My code:
FormatMessage(FORMAT_MESSAGE_FROM_HMODULE |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_ALLOCATE_BUFFER,
g_hResources, // handles DLL containing message table
MessageId,
0, // Default language
(LPWSTR) &pMessage,
0,
(va_list*)pArgs )
Good day to you..
Error 317 is "The system cannot find message text for message number 0x%1 in the message file for %2.". That means the MessageId is not an error number known to the system.
You are combining FORMAT_MESSAGE_FROM_HMODULE and FORMAT_MESSAGE_FROM_SYSTEM, which doesn't make sense. Where do you want to get the message from? Do you want to get it from g_hResources or from the system error message table? From the comment, it sounds like you want to get it from g_hResources, in which case you should remove FORMAT_MESSAGE_FROM_SYSTEM. If you still get error 317, then it means that the message number you passed doesn't exist in g_hResources.

Node.js : EBADF, Bad file descriptor

If I reload my application (from the browser with the reload button) a lots of times like 50 reload/10 seconds it gives me this error:
events.js:45
throw arguments[1]; // Unhandled 'error' event
^
Error: EBADF, Bad file descriptor
This seems to me like a bandwidth error or something like that, originally I've got the error when I played with the HTML 5 Audio API, and If I loaded the audio file 10-15 times sequentially then I've got the error, but now I've discovered that I get the error without the Audio API too just by reloading the site a lots of times, also Safari gives me the error much faster than Chrome (WTF?)
I'm using Node.js 0.4.8 with express + jade and I'm also connected to a MySQL database with the db-mysql module.
I can't find any articles on the web about this topic what helps, so pleeease let me know what can cause this error because it's really confusing :(
By "reload your application" do you mean refresh your app's home page from a browser, or actually stop and restart the node.js server process? I assume the former, in which case if you can't reliably reproduce this it will be pretty tricky to debug, especially since you don't have a good stack trace to pinpoint the source. But if you use the express.js app.error hook (docs here) you'll want to log the error path from the "Bad file descriptor" error, which should hopefully clue you in to whether this is a temporary file that got deleted or what. In terms of the actual cause, we can only offer guesses since "Bad file descriptor" is a very generic low level error that basically means you are calling an operation on a file descriptor that is no longer in the correct state to handle that operation (like reading a closed file, opening a file that has been deleted, etc).
#CIRK, take a look at this: https://github.com/joyent/node/issues/1189
it's not a node problem, but a system tuning issue.
edit: or maybe it's related to this error in connect 1.4.3:
https://github.com/senchalabs/connect/issues/297
if this is your case, just try to upgrade it
This error may result from using fs to save a file whose name is a number rather than a string. File names must be strings:
Incorrect:
const fileName = 12345;
const fileContent = "The great croissant."
fs.writeFileSync(fileName, fileContent);
Correct:
fs.writeFileSync(`${fileName}`, fileContent);
Also correct:
const fileName = "12345";
fs.writeFileSync(fileName, fileContent);

Resources