serialization

manual serialization / deserialization of AppEngine Datastore objects

泄露秘密 提交于 2020-01-15 10:17:14
问题 Is it possible to manually define the logic of the serialization used for AppEngine Datastore? I am assuming Google is using reflection to do this in a generic way. This works but proves to be quite slow. I'd be willing to write (and maintain) quite some code to speed up the serialization / deserialization of datastore objects (I have large objects and this consumes quite some percentage of the time). 回答1: The datastore uses Protocol-Buffers internally, and there is no way round, as its the

manual serialization / deserialization of AppEngine Datastore objects

笑着哭i 提交于 2020-01-15 10:17:09
问题 Is it possible to manually define the logic of the serialization used for AppEngine Datastore? I am assuming Google is using reflection to do this in a generic way. This works but proves to be quite slow. I'd be willing to write (and maintain) quite some code to speed up the serialization / deserialization of datastore objects (I have large objects and this consumes quite some percentage of the time). 回答1: The datastore uses Protocol-Buffers internally, and there is no way round, as its the

Json deserialization fails

僤鯓⒐⒋嵵緔 提交于 2020-01-15 10:11:13
问题 I have following json string which I receive from API call : "\"{\\r\\n \\\"Table\\\": [\\r\\n {\\r\\n \\\"MaxDate\\\": \\\"2019-06-09T00:00:00\\\",\\r\\n \\\"MinDate\\\": \\\"2019-01-26T00:00:00\\\"\\r\\n }\\r\\n ]\\r\\n}\"" I want to deserialize this string to following class structure public class Dates { public DateTime MaxDate { get; set; } public DateTime MinDate { get; set; } } public class TableResult { public List<Dates> Table { get; set; } } When I try to deserialize this json

How to serialize JavaFX Nodes preferably in XML?

扶醉桌前 提交于 2020-01-15 09:47:11
问题 I have some kind of drawpane, where the user can draw different kinds of Shapes, like Pathes, Rectangles, Texts, etc. Now I´d like to persist the DrawState, so that I can recreate it at any time. I just tried it with xstream, but like usual I get a whole lot of dependencies within these Shapes when persisting it in XML. After some research I found this Thread here: Serialize JavaFX components I liked the idea of jewelsea using the SceneBuilder API to serialize my shapes, since they are all

How to save ParseObject to disk in .NET

拥有回忆 提交于 2020-01-15 09:27:48
问题 I need to save a list of ParseObjects to disk in C#, and was wondering if anyone had any recommendations on how to achieve this. I am sure that the Parse .NET SDK has a means of converting ParseObjects to/from JSON since that is the format used during transit to parse server, but I haven't been able to find any public methods to do this :( Hopefully someone has an answer for what should be an easy question! :) 回答1: If you are using Newtonsoft You can do this var jsonString = JsonConvert

Serializing a Child Object Within a Parent Object in JavaScript

≡放荡痞女 提交于 2020-01-15 09:13:44
问题 This question is a follow-up to my last question: JavaScript Serialization and Methods. While related, I believe this is different which is why I started this thread. Regardless... I have a complex tree of objects that I need to pass around between pages. Because of this, I'm attempting to serialize and deserialize my objects. One of my objects in particular has several collections of child objects. Each of those child object types has a function on it, that I'm trying to call. Unfortunately,

Boost binary serialization doesn't work occasionally. The parsed data is corrupted sometimes

佐手、 提交于 2020-01-15 08:23:33
问题 With unknown reason, boost binary serialization doesn't work occasionally. The parsed data is corrupted sometimes. Originally I serialized instances of self-defined class manually, with each instance being a line in a text file. However, the speed was slow.(The text file was dealt in a speed of 2 MB/sec, which can be seen in windows task manager.) Recently I changed to use the boost binary serialization. However, strange things happens. I stored many many instances of class InstanceIdentity,

Issue with boost serialization of IplImage struct

浪子不回头ぞ 提交于 2020-01-15 06:41:19
问题 I'm having trouble getting the boost serialization module to work with OpenCV's IplImage struct. Here is my code for serializing an IplImage (along with some JSON data in a custom struct) template <class Archive> void save(Archive & ar, const unsigned int version) const { // First things first; save the essential variables // These are needed as input to the create function of IplImage ar & frame->width; ar & frame->height; ar & frame->depth; ar & frame->nChannels; ar & frame->widthStep; ar &

Remove [Serializable] attribute before class

Deadly 提交于 2020-01-15 06:22:05
问题 When working with the XmlSerializer , it is important that you mark your types with the [ Serializable ] attribute, part of the SerializableAttribute class. class Program { static void Main(string[] args) { XmlSerializer serializer = new XmlSerializer(typeof(Person)); string xml; using (StringWriter stringWriter = new StringWriter()) { Person p = new Person { FirstName = "John", LastName = "Doe", Age = 42 }; serializer.Serialize(stringWriter, p); xml = stringWriter.ToString(); } Console

C# - SqlDataReader and serialization

强颜欢笑 提交于 2020-01-15 06:00:09
问题 Can an SqlDataReader be passed to a session or sent to a client? For instance, if I retrieved some rows from a database, and want to send this data to another client machine. Can I simply do this by serializing it using json on the server and then deserializing back on the client? 回答1: No, any resource-related object cannot be "passed" to a client. This wouldn't really make sense. You should "materialize" the data reader and pass the results. I.e. you can create an SqlDataAdapter from your