Restler3- POST Upload (zip) Files - post

I really enjoy Restler3, but now there is a problem.
I want to POST a ZIP file to the server. Just by a simple HTML-Form.
To enable the upload if have to add
$restler->setSupportedFormats('UploadFormat');
But if do that all the JSON-GET-Requests just won't work.
Fatal error: Uncaught exception 'Luracast\Restler\RestException' with message 'UploadFormat is read only…
That's the error-message. What should I do to fix that?

I also had this problem. Changing my code to this worked:
$r->setSupportedFormats('UploadFormat','JsonFormat');

Related

Sentry error - IndexSizeError: The index is not in the allowed range

I am getting this error from Sentry repetitively in ios - safari 14.0 in react project.
There is no code trace and no other information than this but it repeats in almost every URL.
I have already searched for the options everywhere. I have tried debugging but I can't replicate it, and so I can't resolve it.
Does anyone know what does this error means? Or how can I add debug information in Sentry?
I have been looking for the solution for a while and couldn't get it. I know it's a bit lack of information to provide but that's why I am asking this. if someone can tell me how to deal with sentry errors if you don't know why it is repeating so often, it will be really helpful.
A similar issue still exists.
Faced this in Safari when Draft.js is updating the editor state.
The error which I see: IndexSizeError: The index is not in the allowed range.
For me, playing around with Paragraph Directioncontext menus items after right-clicking on the Editor selection reproduced the error.
My Solution/hack:
Add it to any JS file executing before the Editor file.
const nativeSelectionExtend = Selection.prototype.extend;
Selection.prototype.extend = function (...args) {
try {
return nativeSelectionExtend.apply(this, args);
} catch (error) {
console.log('Selection error.', error);
}
};
It works properly for me. Maybe will be useful for somebody as well.
Thanks to https://github.com/shpakkdv

Error in iOS: "you don't have permission"

I'm working on an iOS project in Swift which uses the Dropbox API to upload text files to Dropbox as well as load and read them from Dropbox. However, when I try to load a file using my DBRestClient using the following line:
restClient.loadFile("/data/" + yearStr + "/" + yearMonthStr + "/" + fullStr + ".txt", atRev: nil, intoPath: "temp2.txt")
I see the following error message in the console:
DropboxSDK: error making request to /1/files/sandbox/data/15/15_12/15_12_10.txt - (404) Path is a directory`
I'm not really sure what this means, since neither path involved in the call looks like a directory to me. I've searched for this error message but I can't seem to find it anywhere online, and I'm not sure what else might have caused it since commenting out this line prevents the error fro showing up and the same filepath works fine in other calls that don't involve loading files. Am I missing something about how loadFile() works?
UPDATE: I fixed the previous error by deleting a directory with the that filepath, making it choose the correct file. However, I am now getting the following error instead:
DropboxSDK: error making request to /1/files/sandbox/data/15/15_12/15_12_10.txt - (513) Error Domain=NSCocoaErrorDomain Code=513 "The file couldn’t be saved because you don’t have permission." UserInfo={path=/data/15/15_12/15_12_10.txt, destinationPath=temp2.txt}
I'm not sure what it means-- do I not have permission for the destination on my phone, or for the file on dropbox? I'm looking up this error message but I'm not finding anything yet, so help would be much appreciated.
According to the documentation, code 513 corresponds to:
NSFileWriteNoPermissionError = 513,
That seems to match the error message you get, and should be referring to the local destination path, which in your case is:
temp2.txt
You should check that you have access to write to that local path, and that it's a valid path, e.g., should it start with a '/'?. (Or moreover, perhaps you should be writing to NSTemporaryDirectory or something like that.)

How to print PDF file already opened in QLPreviewController using print button?

I get binary array then convert it and save in Documents folder and then showed in QLPreviewController. I have seen the right button on the tool bar of QLPreviewController.
I want to print that is in the preview right now. But when i tab error occurs
*** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit_Sim/UIKit-2380.17/UIDocumentInteractionController.m:960
Also please guide me about printing that document. I have read about UIPrintInteractionController.
Why this Error occurs because you have set the URL wrong.
You are setting url like that;
/Users/akrama2/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/59356D13-C021-431F-A5D2-B8CD16E2B301/Documents/Application_Report.pdf
Where as UIDocumentationController task URL as:
file://localhost/Users/akrama2/Library/Application%20Support/iPhone%20Simulator/6.1/Applications/59356D13-C021-431F-A5D2-B8CD16E2B301/Documents/Application_Report.pdf
This minor mistake will made you mad ;)

XNA SoundEffect fails to be loaded from file

I got a dictionary to store SoundEffects in, like:
public static Dictionary<string, SoundEffect> Hangok = new Dictionary<string, SoundEffect>();
I load sounds from files (normal .wav format), like:
GStatic.Hangok.Add(Azonosító, SoundEffect.FromStream(File.OpenRead(Azonosító)));
, where Azonosító was the filename.
All is just fine, files are loaded, except one; an exception is created:
Operation is not valid due to the current state of the object.
, what is not much of information for me. Could anyone explain this error message OR tell me why SoundEffect.FromStream fails to read? Why? When? Workaround?
Thanks in advance:
Péter
I use the ContentManager to load in SoundEffect's. Place the wav file in the content project and it should just load in.
E.g.
SoundEffect s = Content.Load<SoundEffect>("name");
Not a complete, but working solution to this problem. "Answering my question" only, because it may be useful for other developers, who also have no idea what the problem may be.
try
{
GStatic.Hangok.Add(Azonosító, SoundEffect.FromStream(File.OpenRead(Azonosító)));
}
catch
{
GStatic.Hangok.Add(Azonosító, new SoundEffect(File.ReadAllBytes(Azonosító), 11025, AudioChannels.Mono));
}
And well: I got no idea WHY you can not load that file in the normal way and why you can load the way like in the exception handler. Having a file in mono should not be that big problem. If someone knows, please drop a note/comment.

NSRangeException while opening local .doc files on webview

I am trying to open a downloaded .doc file in UIWebview on iPad.
Basically .doc file have unicode character in both file name & file content which i am trying to open .
I got following error logs in console
WebKit discarded an uncaught exception in the webView:decidePolicyForNavigationAction:request:frame:decisionListener: delegate: <NSRangeException> *** -[NSArray objectAtIndex:]: index 0 beyond bounds for empty array
But neither webview's didFailLoadWithError or webViewDidFinishLoad delegate is called so how can i trap the error .What could be reason for it?
I've seen a few questions like this here before.
Such as:
Displaying ppt, doc, and xls in UIWebView doesn't work but pdf does
and
UIWebView does not open ms word (doc) and ms excel (xls) files
You might find some helpful hints in those questions.
Does the file open correctly when you download it on a Macintosh?
Is the mime type set correctly?
What else have you implemented in your UIWebViewDelegate?

Resources