Update: I've figured out it is because I have a 'Link' in my schema, I want the field 'createdBy' to link to the OUser class of the user, but I can't seem to make that link. Somehow when the function creates the V it doesn't inherit the field type from the class. Any ideas?
-
I've got an issue writing using functions. I want to write to the Database but I cant. if I commit using the normal orient.getGraph() I get the following error: (OrientDB Version 2.0.7)
Error on parsing script at position #0: Error on execution of the script
Script: newConcept
------^
sun.org.mozilla.javascript.WrappedException: Wrapped com.orientechnologies.orient.core.exception.OStorageException: Error during transaction commit. (
<Unknown source>#26) in
<Unknown source> at line number 26
Wrapped com.orientechnologies.orient.core.exception.OStorageException: Error during transaction commit. (
<Unknown source>#26)
Error during transaction commit.
null
And if I try it with the non-transactional it just doesn't write.
I am sending a post request, I've tried enabling Javascript server side scripting but that is not the issue.
Here is my whole function:
var graph = orient.getGraph();
var currentUserId = getCurrentUserId();
var currentTimeStamp = getCurrentDateString();
//Check if the className is not specified or if the class does not exist.
if(graph.getVertexType(className)==null){
//return an Error message
return response.send(500, 'Class does not exist', "application/json", '{ "error": "Class does not yet exist or a blank class was specified, please create the class first." }' );
}
//The var v wraps OrientVertex class
var v = graph.addVertex('class:' + className);
if (label) { v.setProperty('label', label); }
if (value) { v.setProperty('value', value); }
v.setProperty('createdBy', currentUserId);
v.setProperty('createdAt', currentTimeStamp);
//Commit
graph.commit();
return v;
Related
I'm trying to embed Pdf tron to my React application. I'm receiving this error when I'm clicking on the tab I want to filter to find the relative pdf file.
const handleFilteredDocs = (id)=>{
const filteredDoc = props.location.documents && props.location.documents.filter(doc=>{
return doc.controlId === id
})
setFileteredDoc(filteredDoc)
setPdfPath(filteredDoc[0].filePath)
WebViewer(
{
path: 'lib',
initialDoc: `lib/pdf/${pdfPath}`,
extension: "pdf"
},
viewer.current,
).then((instance) => {
const { docViewer, Annotations } = instance;
const annotManager = docViewer.getAnnotationManager();
docViewer.on('documentLoaded', () => {
const rectangleAnnot = new Annotations.RectangleAnnotation();
rectangleAnnot.PageNumber = 1;
// values are in page coordinates with (0, 0) in the top left
rectangleAnnot.X = 100;
rectangleAnnot.Y = 150;
rectangleAnnot.Width = 200;
rectangleAnnot.Height = 50;
rectangleAnnot.Author = annotManager.getCurrentUser();
annotManager.addAnnotation(rectangleAnnot);
// need to draw the annotation otherwise it won't show up until the page is refreshed
annotManager.redrawAnnotation(rectangleAnnot);
});
});
}
I'm thinking is because the ref component didn't receive in time the pdfPath state and then throw the error. I've tried to place a separate button to load the pdf with the pdfPath correctly updated and in that case worked. What can i do make it render correctly there?
this is the error I get from the console:
(index)
Value
UI version "7.3.0"
Core version "7.3.0"
Build "Mi8yMi8yMDIxfDZmZmNhOTdmMQ=="
WebViewer Server false
Full API false
Object
CoreControls.js:189 Could not use incremental download for url /lib/pdf/. Reason: The file is not linearized.
CoreControls.js:189
{message: "The file is not linearized."}
CoreControls.js:189 There may be some degradation of performance. Your server has not been configured to serve .gz. and .br. files with the expected Content-Encoding. See http://www.pdftron.com/kb_content_encoding for instructions on how to resolve this.
CoreControls.js:189 There may be some degradation of performance. Your server has not been configured to serve .gz. and .br. files with the expected Content-Encoding. See http://www.pdftron.com/kb_content_encoding for instructions on how to resolve this.
CoreControls.js:189 There may be some degradation of performance. Your server has not been configured to serve .gz. and .br. files with the expected Content-Encoding. See http://www.pdftron.com/kb_content_encoding for instructions on how to resolve this.
81150ece-4c18-41b0-b551-b92f332bd17f:1
81150ece-4c18-41b0-b551-b92f332bd17f:1 PDFNet is running in demo mode.
81150ece-4c18-41b0-b551-b92f332bd17f:1 Permission: read
CoreControls.js:922 Uncaught (in promise)
{message: "Exception: ↵ Message: PDF header not found. The f… Function : SkipHeader↵ Linenumber : 1139↵", type: "InvalidPDF"}
Thank you guys for any help I will get on this!
The value of "pdfPath" isn't set to "filteredDoc[0].filePath" yet after you call "setPdfPath" (it'll still be the initial state till the next render). One thing you can do is pass a callback function when using "setState" to call "WebViewer()" after "pdfPath" has been updated
https://reactjs.org/docs/react-component.html#setstate
Also there is a guide on how to add PDFtron to a React project in the following link
https://www.pdftron.com/documentation/web/get-started/react/
One thing to note, is it's does the following
useEffect(() => {
// will only run once
WebViewer()
}, [])
By doing the above, "WebViewer" is only initialized once. It might be a good idea to do something similar and use "loadDocument" (https://www.pdftron.com/documentation/web/guides/best-practices/#loading-documents-with-loaddocument) when switching between documents instead of reinitializing WebViewer each time the state changes
I am trying to integrate Rocket chat to my application using asteroid but when I use Rocket.chat's LoadHistory method I get {isClientSafe: true, error: 400, reason: "Match failed", message: "Match failed [400]", errorType: "Meteor.Error"}. To be clear, I have never used Rocket.chat or Asteroid before. However some methods are working flawlessly.
/**
* Calls a server-side method with the specified arguments.
* #param method string required: the name of the method to call
* #param params [param1, param2, ...] any optional: parameters passed to the
server method
* #return Promise resolved, rejected
*/
let asteroidMethods = function (method, param){
return socket.call(method, param)
};
getMessageHistory = (lastMessage) => {
let param =[ lastMessage.rid, null, 50, lastMessage['ts']['$date']];
asteroidMethods("loadHistory", param).then(res=>{
console.log(res)
}).catch(e=>{
console.log(e)
})
}
Since the Match failed response is a rather generic one, there're several potential issues causing your error. For example, the lastMessage.rid could be empty.
With your problem, the Rocket.Chat server logs shall give you more information about the underlaying problem. For that, Rocket.Chat offers a nice way of accessing the server logs through the user interface:
Log in to the Rocket.Chat admin UI as admin user
Ensure the Log Level to be very verbose -> Level 2 (https://example.com/admin/Logs)
Visit the log view (https://example.com/admin/view-logs)
Execute your code once
Example
I've set my roomId to 42 in an example request:
connection.method('loadHistory', [42, roomId, oldestMessageDate, 15])
That triggers the following log event with very detailed information:
Exception while invoking method 'loadHistory'
{ Error: Match error: Expected string, got number }
With that information, you should be able to identify the actual issue behind your request.
Hi I'm trying to update my database with function that returns a number
$scope.sum = function()
{
return $scope.inp + $scope.points;
};
this function will update the record in object points, column name and id 1:
$scope.addPoint = function() {
PointService.addPoint($scope.sum, 1)
.then(function(result) {
$scope.inp = 0;
getMyPoints();
});
}
addPoint = function(id,points)
{
return $http.put(getUrlForId(1),points,name);
}
the error is: Error details: Cannot convert type 'int' to 'System.Collections.Generic.Dictionary'
the data type of the field is Float.
Any idea what is wrong with the code?
you are passing function reference to PointService.addPointer(),
use this:
$scope.addPoint = function() {
PointService.addPoint($scope.sum(), 1) // NOT PointService.addPoint($scope.sum, 1)
.then(function(result) {
$scope.inp = 0;
getMyPoints();
});
}
this will execute your function and pass the output (id parameter) to addPoint function, further, for more safe side, you can return Number from $scope.sum() i.e.
$scope.sum = function()
{
return Number($scope.inp + $scope.points);
};
This looks like an issue with how you're contacting Backand. You use the following code to send your points over:
addPoint = function(id,points)
{
return $http.put(getUrlForId(1),points,name);
}
This is an older version of calling the Backand API that is manually constructing a PUT request, and putting "points" and "name" as the "Data" and "config" parameters to $http. With an object update via PUT, you'll need to provide the updates as an object. So if you wanted to update the points and the name of the object (and I'm doing some assuming based upon what I can tell from the code snippet above), you'd need to encapsulate these properties in an object that has the following general format:
{
"field_name_1":"new value_1",
"field_name_2":"new value_2",
etc ...
}
This should then be sent as the body of the request. So, for your code, change it to the following and see if this helps:
addPoint = function(id,points)
{
return $http.put(getUrlForId(1),{points: points, name: name});
}
To give more info on why you're seeing this particular error, Backand is depending on this JSON format in the body. Our platform should definitely do more validation (and I'll create a ticket for the devs to handle non-conforming input more gracefully), but at the moment we simply take the body of the request, convert it to a dictionary object, then begin the requested operation. As your code above sends only "1.0" as the body, this fails the conversion into a dictionary, causing the stack exception and the issue you are seeing.
As a note, we offer a new SDK that encapsulates these HTTP methods, performing the authentication header generation and HTTP messaging for you, providing promises to handle responses. You can find it on our Github page at https://github.com/backand/vanilla-sdk. To make the same call using the new SDK, the code would resemble the following:
backand.object.update("your object name", 1, {name: name, points: points})
.then(function(response){
console.log(response.data);
});
I am trying to open a base64 encoded file in Word Online, using the code below based on .
function displayContents(myBase64) {
Word.run(function (context) {
console.log(Office.context.requirements.isSetSupported("WordApi", "1.1"));
// Create a proxy object for the document.
var thisDocument = context.document;
// Queue a command to clear the body contents.
thisDocument.body.clear();
thisDocument.body.insertFileFromBase64(myBase64, "replace");
// Create a proxy object for the default selection.
//var mySelection = thisDocument.getSelection();
// Queue a command to insert the file into the current document.
//mySelection.insertFileFromBase64(myBase64, "replace");
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
return context.sync();
})
.catch(function (error) {
console.log('Error: ' + JSON.stringify(error));
if (error instanceof OfficeExtension.Error) {
console.log('Debug info: ' + JSON.stringify(error.debugInfo));
}
});
}
This does not work (using body.insertFileFromBase64 or myselection.insertFileFromBase64). The code does function in the regular version of Word. I receive the following error:
Error:
"name":"OfficeExtension.Error",
"code":"GeneralException",
"message":"This browser does not support the requested API.",
"traceMessages":[],"debugInfo":{}}
LoadOfficeDoc.js:51 Debug info: {}
Office.context.requirements.isSetSupported("WordApi", "1.1") returns true.
Am I doing something wrong or is this functionality not available online?
The new Word API (e.g. anything using Word.run) is presently only supported in Word 2016 on Windows (and iPad?)
Though according to the documentation isSetSupported should be returning false.
That's correct, this is actually a bug we are working on right now.
That requirement set is not full supported on WAC hence the method must return false.
I have created and table in dynamodb (EU-WEST-1) and I have created a camel route to put a json payload into the table.
My route looks like this:
String dynamoDbEndpoint = String.format("aws-ddb://tablename?accessKey=%s&secretKey=RAW(%s)&tableName=tablename&amazonDdbEndpoint=dynamodb.eu-west-1.amazonaws.com",awsAccessKey,awsSecretKey);
from("direct:ipg-queue").to(dynamoDbEndpoint)
I get the error message:
com.amazonaws.AmazonServiceException: 1 validation error detected: Value null at 'item' failed to satisfy constraint: Member must not be null (Service: AmazonDynamoDB; Status Code: 400; Error Code: ValidationException; Request ID: 0AVSR54LRTOG3U0TTC5B1QO4KBVV4KQNSO5AEMVJF66Q9ASUAAJG)
An example payload is:
{"accountNumber":"123456789","customerName":"John Smith","id":"8422b9e0-739b-4d19-9291-037b68344068"}
Represented as a String.
I'm doing something stupid, but can't figure it out...
So it turns out I was being stupid. You just need to set the CamelAwdDbItem header in the exchange. I added the following process block to my route before the dynamo db endpoint and away I went...
.unmarshal()
.json(JsonLibrary.Gson, Map.class)
.process((Exchange exchange) -> {
Map body = (Map) exchange.getIn()
.getBody();
Map<String, AttributeValue> newBody = new HashMap();
for(Object key : body.keySet()) {
newBody.put(key.toString(), new AttributeValue(body.get(key).toString()));
}
exchange.getIn().setHeader("CamelAwsDdbItem", newBody);
})
I also put &operation=PutItem onto the end of the endpoint definition.