serialization

cPickle ImportError: No module named multiarray

余生颓废 提交于 2020-01-22 12:59:25
问题 I'm using cPickle to save my Database into file. The code looks like that: def Save_DataBase(): import cPickle from scipy import * from numpy import * a=Results.VersionName #filename='D:/results/'+a[a.find('/')+1:-a.find('/')-2]+Results.AssType[:3]+str(random.randint(0,100))+Results.Distribution+".lft" filename='D:/results/pppp.lft' plik=open(filename,'w') DataOutput=[[[DataBase.Arrays.Nodes,DataBase.Arrays.Links,DataBase.Arrays.Turns,DataBase.Arrays.Connectors,DataBase.Arrays.Zones],

Serialize Ruby object to JSON and back?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-22 12:47:26
问题 I want to serialize an object to JSON, write it to file and read it back. Now I'd expect something like in .net where you have json.net or something like that and you do: JsonSerializer.Serialize(obj); and be done with it. You get back the JSON string. How do I do this in Ruby? No Rails, no ActiveRecord, no nothing. Is there a gem I can't find? I installed the JSON gem and called: puts JSON.generate([obj]) where obj is an object like: class CrawlStep attr_accessor :id, :name, :next_step def

WCF Serialization problems with WSDL file created by Java tools

对着背影说爱祢 提交于 2020-01-22 10:56:28
问题 My team is tasked with getting several in-house developed .NET client applications to connect to some new Java web services. The Java web service is a third party, vendor supplied WSDL file that our team has a limited ability to modify/control...meaning we probably have the power to request our vendor to make slight tweaks to the WSDL, but major changes would probably be either unfeasible or difficult to request. That said, we are attempting to utilize WCF/.NET 4.0 to generate the .NET proxy

What gives Smalltalk the ability to do image persistence, and why can't languages like Ruby/Python serialize themselves?

Deadly 提交于 2020-01-22 10:35:08
问题 In smalltalk, you're able to save the state of the world into an image file. I assume this has to do with Smalltalk's ability to "serialize" itself -- that is, objects can produce their own source code. 1) Is this an accurate understanding? 2) What is the challenge in adding this ability to modern languages (non-lisp, obviously)? 3) Is "serialization" the right word? What's the correct jargon? 回答1: It's much simpler than "serializing". A Smalltalk image is simply a snapshot of the object

Why do most serializers use a stream instead of a byte array?

隐身守侯 提交于 2020-01-22 08:20:25
问题 I am currently working on a socket server and I was wondering Why do serializers like XmlSerializer BinaryFormatter Protobuf-net DataContractSerializer all require a Stream instead of a byte array? 回答1: It means you can stream to arbitrary destinations rather than just to memory. If you want to write something to a file, why would you want to create a complete copy in memory first? In some cases that could cause you to use a lot of extra memory, possibly causing a failure. If you want to

Exclude property on WCF DataContract

我是研究僧i 提交于 2020-01-22 03:33:08
问题 Given a WCF interface definition like this, is there a way to exclude a property from the ComplexObject response value? I want to exclude the ChildObjects property. I don't want to remove the DataMember attribure from the property definition as I need it to be serialized in another case. [ServiceContract] public interface IComplexObjectService { [OperationContract] ComplexObject Test(int a); } ComplexObject is defined something like this: [DataContract(IsReference = true)] public class

Boost serialization : forward compatibility fail with input stream error

放肆的年华 提交于 2020-01-21 19:29:49
问题 Following this question : Boost serialize child class I'm trying to support forward compatibility for my archive generated with boost serialization but i'm having trouble reading a newer archive with older code : class A { public: A() {} virtual ~A() = default; private: friend class boost::serialization::access; template <class Archive> void serialize(Archive &ar, const unsigned int version) { ar &mAttributeFromA; } std::string mAttributeFromA = "mAttributeFromA"; }; BOOST_CLASS_VERSION(A, 0)

How to serialize using System.Json in MonoTouch

风格不统一 提交于 2020-01-21 18:03:16
问题 My other question seems to be too generic, so I tought I'd create a new one on the details. Sorry if that is considered bad practice. I am trying to serialize C# objects to JSON strings with MonoTouch and the System.Json namespace in a way that doesn't require me to descend through the object(s) myself. Is that possible? If yes, how to do it properly? De-serialization works well by implicitly casting a JsonValue to a string, int, whatever. Also, descending in the hierarchy is no problem. Like

How to serialize using System.Json in MonoTouch

北慕城南 提交于 2020-01-21 18:02:43
问题 My other question seems to be too generic, so I tought I'd create a new one on the details. Sorry if that is considered bad practice. I am trying to serialize C# objects to JSON strings with MonoTouch and the System.Json namespace in a way that doesn't require me to descend through the object(s) myself. Is that possible? If yes, how to do it properly? De-serialization works well by implicitly casting a JsonValue to a string, int, whatever. Also, descending in the hierarchy is no problem. Like

How to serialize using System.Json in MonoTouch

 ̄綄美尐妖づ 提交于 2020-01-21 18:02:27
问题 My other question seems to be too generic, so I tought I'd create a new one on the details. Sorry if that is considered bad practice. I am trying to serialize C# objects to JSON strings with MonoTouch and the System.Json namespace in a way that doesn't require me to descend through the object(s) myself. Is that possible? If yes, how to do it properly? De-serialization works well by implicitly casting a JsonValue to a string, int, whatever. Also, descending in the hierarchy is no problem. Like