OrientDB Timestamp on Update via a hook - orientdb

Does anyone have a working example of a hook to update a document with a timestamp on update?
I was able to set the timestamp on record creation by using DEFAULT sysdate().
This doesn't help me when updating an existing record. Any advice would be appreciated.

Ok. Check out this thread in GG. I posted a Javascript function, which does what you are asking for.
All you need to do is save what I came up with as a custom function then create the customer trigger property on your class. See this section of the docs on how to do that.
Scott

I'm sure the first answer is great but here's another option I wrote for myself. It takes a schemaless prop from your updating record to save the editing user, and could be extended to save the field being updated too.

Related

Word API Custom Properties

I need some help on word add-ins
I will be programmatically creating a document and as part of that I need to add custom property (Pub_Doc_ID) to the document, as in the picture below.
I am using Word Java APIs now and could not find a way to do this job. The work flow I am targeting is very simple. Create a Document, get the Pub_Doc_Id from DB which is primary Key and assign to the document. Now primary key is attached to the document, so it will be lived with document.
Some more background :
As I mentioned earlier I am using Word APIs. I am adding text, sections, images etch. Now I need to have one connector (Pub_Doc_ID) between Doc and DB. So wanted to use custom properties. If there is any better way to do it. Then let me know.
I know how to do this in VSTO. I am looking for Word Java API.
This pub_doc_id ID then I will be using to call API's and to load task pane.
Thanks, really appreciate any help on this.
*Pub_Doc_Id : Publishing Document ID.
R/W access to custom properties is something my team is working on and would be delivered towards the end of the year.
Seems that for your scenarios you don't necessarily need to store that information as a custom property and you have a couple of alternatives in the meantime:
You can add your own customXmlPart to the doc to store this information. Here is a great example on how to use this: https://github.com/OfficeDev/Word-Add-in-Work-with-custom-XML-parts/tree/master/C%23/CustomXMLAppWeb/App
You could also store it a setting of your add in. Check out the settings object and how to store and retrieve settings: https://dev.office.com/reference/add-ins/shared/document.settings
Hope this helps!!
Thanks
You cannot presently access custom properties via the JavaScript API. They are currently working on it and have put information about proposed APIs on GitHub

How do you delete CloudKit "Field Names" programatically?

I've been looking around everywhere but all I can find is deleting a Zone though the Field Names stay. The only other way I found was you have to log into the CloudKit dashboard and do it manually. Is this the only way?
Thanks in advance for your help.
You must use the Dashboard to make any changes to your schema. It is not possible to modify the schema programatically.
Making schema changes is something you only need to do during development, and the schema is created on demand, so there's no need for client side API to manage the schema.
You don't need to send every possible field when updating a record, so you can just stop using the field you want to delete and clean it up later in the dashboard.

CRM Plugin executing several times

I'm trying to create a plugin on CRM 2011 online to notify users by mail when an opportunity is updated.
In the email, I need to have the value of some fields before and after the update.
So, I'm using Post operation on update message for the opportunity entity with the pre and post image.
It's working well if I update any fields except for the owner of the opportunity. I changed it, I get two emails generated. One with the owner who owns the record before the update and one with the owner who owns the record after the update. So I supposed that the plugins is called twice.
I think that I have an infinite loop in my plugin and I take a look at the depth property but it's not working for me.
Any help is greatly appreciated.
Owner is updated using other then Update message - Assign message is used. So I assume that behaviour of your plugin is correct.

Symfony 2.1 + #MongoDBUnique(fields="email") not unique

I'm trying to use MongoDB with Symfony2.1 but I'm facing a problem.
I'm following the tutorial from Symfony website called "How to implement a simple Registration Form with MongoDB".
In this tutorial, it is said that we can add a constraint on email field as a unique field.
After some tests, it doesn't work. I can add more than once the same email for my User entity.
The annotation #MongoDBUnique(fields="email") seems to fail.
I found someone which has the same problem in a Google Group. At this time (posted on january, 6th), no one has answered or no one seems to have any answer unfortunelately.
Thanks for any clue !
Make sure that index really exists in MongoDb. The specified annotation doesn't create any index automatically.
For more information check this.

Missing timestamps for uploaded images

I have mongoid and carrierwave-mongoid gems in my project (for avatars in user model) and need timestamps in uploaded images URL. I know there is Wiki page for this (https://github.com/jnicklas/carrierwave/wiki/How-to%3A-Use-a-timestamp-in-file-names) but there is note "This does not seem to be reliable. I'd strongly recommend saving the timestamp to the database and reading it from the model to generate the filename instead of using this method." and I'm not sure how to do that.
I think Rails should generate timestamps for images URL automatically or from specific attribute right? So I'm not sure what is the right name for this attribute or what is the right approach for this with Mongoid and carrierwave-mongoid.
Could you please provide me some info or link where I can found more about this or info about the solution.
Because my repo on GitHub is private I did this Gist (https://gist.github.com/2355128) where you can see my user model and avatar uploader.
Thanks for your help.
This may be more generic than you want for an answer, but hopefully it will get you to an appropriate solution. The unique ObjectID that is used for the default _id fields in MongoDB has a timestamp "built in", BSON::ObjectId would be what you are looking for in Mongoid to extract it.
There is also a write up on it here:
http://www.mongodb.org/display/DOCS/Optimizing+Object+IDs#OptimizingObjectIDs-Extractinsertiontimesfromidratherthanhavingaseparatetimestampfield.
Hence, you could use a wrapper around the ObjectID to construct your URLs and avoid the use of an extra timestamp entirely.