serialization

Getting error in gson deserializing using android Studio

社会主义新天地 提交于 2019-12-23 17:23:30
问题 I am working on an application in which I am using android phone contacts in my application.So, for that first of all fetch contact details and store it into ArrayList. After that I serialized that arrayList using gson library and when I deserialize it getting error. I have used gson-2.1.jar for serializing and deserializing contact details. I am getting following error log. AndroidRuntime﹕ FATAL EXCEPTION: main com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected

SQL Server not finding serialization assembly

99封情书 提交于 2019-12-23 17:14:51
问题 I'm trying to deploy an UpdateContries SQL CRL Procedure which calls a Web Service, following help found here http://www.elzaris.co.za/using-web-services-in-sql-server-clr-assemblies/ http://msdn.microsoft.com/en-us/library/84b1se47.aspx footheory.com/blogs/bennie/archive/2006/12/07/invoking-a-web-service-from-a-sqlclr-stored-procedure.aspx So basically I have a Visual C# SQL CLR Database Project on Visual Studio 2010 with a simple Procedure that calls an external Web Services which was added

Serializing a class with a pointer in C++

こ雲淡風輕ζ 提交于 2019-12-23 17:13:57
问题 I want to serialize an object of type Person . I want to use it later on for data saving or even game saving. I know how to do it for primitives like int , char , bool , and even c-strings like char[] . The problem is, I want the string to be as big as it needs to rather than declaring a char array of size 256 and hoping no one enters something too big. I read that serializing a class with std::string as a member doesn't work because it has an internal pointer, but is there a way to serialize

How should I serialize an array of Moose objects?

一笑奈何 提交于 2019-12-23 17:11:12
问题 I use MooseX::Storage for serialization of Moose objects. Can I use it for serialization of multiple Moose objects to the same file, or more specifically, an array or a hash of Moose objects? I guess I can define another Moose objects ('array_of_myobj') but this isn't very elegant. So, how would you recommend to serialize an array (or a hash) of Moose objects? 回答1: You don't have to let MooseX::Storage manage your file IO just because it's available. You could use it to pack your objects into

how to deserialize object?

情到浓时终转凉″ 提交于 2019-12-23 17:09:21
问题 I have a class called Flight The Flight class when instantiated, instantiates another class called SeatingChart, and SeatingChart also instantiates another class and so on and so forth. public class Flight implements Serializable { SeatingChart sc = new SeatingChart(); seating //WaitingList wl = new WaitingList(); } public class SeatingChart extends ListAndChart implements PassengerList, Serializable { public static final int NOT_FOUND = 42; Passenger [] pass = new Passenger[40]; } public

Should any domain object, not be serializable?

情到浓时终转凉″ 提交于 2019-12-23 16:45:51
问题 Is there a way to just tell the compiler, that I want my objects to be serializable by default? 回答1: Pretty much every serialization engine is going to want to know that your objects are suitable. This can take the form of: [Serializable] / ISerializable ( BinaryFormatter , SoapFormatter ) [Serializable] / IXmlSerializable (and public ) ( XmlSerializer ) [DataContract] / [MessageContract] (or most of the above) ( DataContractSerializer and variants) AFAIK, there is no way of avoiding this

Serializing anonymous types

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-23 16:34:14
问题 I'd like to convert anonymous type variable to byte[], how can I do that? What I tried: byte[] result; var my = new { Test = "a1", Value = 0 }; BinaryFormatter bf = new BinaryFormatter(); using (MemoryStream ms = new MemoryStream()) { bf.Serialize(ms, my); //-- ERROR result = ms.ToArray(); } I've got error: An exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll but was not handled in user code Version=4.0.0.0, Culture=neutral, PublicKeyToken

Fastest serialize data format form PHP reading

不问归期 提交于 2019-12-23 16:32:50
问题 I have a PHP frontend and a C++ backend, and I need to be able to send groups of names to the frontend. What serialized format would be the most efficient/fastest for the PHP to read? Example data group1: name1 3923 name2 9879 name3 8944 group2: name5 9823 group3: name9 9822 name1 4894 What would be the fastest for PHP to read? XML JSON YAML Protocol Buffer Comma/Space Delimited our own system Anything else? other? 回答1: PHP's own serialized format will probably be the fastest. unserialize()

Is it possible to set a default value when deserializing xml in C# (.NET 3.5)?

痴心易碎 提交于 2019-12-23 16:26:31
问题 I've got a little problem that's slightly frustrating. Is it possible to set a default value when deserializing xml in C# (.NET 3.5)? Basically I'm trying to deserialize some xml that is not under my control and one element looks like this: <assignee-id type="integer">38628</assignee-id> it can also look like this: <assignee-id type="integer" nil="true"></assignee-id> Now, in my class I have the following property that should receive the data: [XmlElementAttribute("assignee-id")] public int

Properly serializing flash.utils.Dictionary to a SharedObject

五迷三道 提交于 2019-12-23 15:44:16
问题 I have a convenience collection class in my Flex project called HashMap, which is essentially a wrapper around the flash.utils.Dictionary with a bunch of convenience methods and an added (synced) ArrayCollection so that I can pass the HashMap to bindable controls that want an ArrayCollection. That all works fine. What doesn't work fine, I'm finding out just now, is putting that HashMap in a local SharedObject. Registering the class causes it to be stored and come back as the proper type, and