serialization

Compare two objects with same data

I wanna to compare two objects, for example: DirectoryInfo di1 = new DirectoryInfo("C:\\"); DirectoryInfo di2 = new DirectoryInfo("C:\\"); OK, yeah I know we have here different reference, this class doesn't implement IComparable, and even GetHashCode is returning the different results. But they are the same! (logically:)) I know ...

Json <-> Java serialization that works with GWT

I am looking for a simple Json (de)serializer for Java that might work with GWT. I have googled a bit and found some solutions that either require annotate every member or define useless interfaces. Quite a boring. Why don't we have something really simple like class MyBean { ... } new GoodSerializer().makeString(new MyBean()); new...

Adding further attributes to a ActiveRecord serialization?

I have my json serialization working fine render :json => "#{current_object.serialize(:json, :attributes => [:id, :name])} But I also want to add further data to the json before it gets set back to the client. Mainly the auth_token. Googled around like crazy but I can not find what option serialize will take to allow me to append/me...

versioning serialized files

I've got a working app that serializes a document (of type IDocument) to disk. From there there's another app that I've made that can open that document (IDocument implements IPrintDocument) for viewing. Let's assume that I've written an IDocument to disk, and then a week later a field gets added to the IDocument object. Both the progra...

How can protocol-buffers support serialization/deserialization of std containers?

We plan to replace Boost.serialization with protocol-buffers used in distributed system design. How protocol-buffers support complicated data structures such as std containers? For instance, such a class is required to be serialized/deserialized in our case: class Foo { std::vector< std::pair< unsigned int, std::vector< std::pair< in...

Convert PHP array string into an array

I have an array: $myArray = array('key1'=>'value1', 'key2'=>'value2'); I save it as a variable: $fileContents = var_dump($myArray); How can convert the variable back to use as a regular array? echo $fileContents[0]; //output: value1 echo $fileContents[1]; //output: value2 ...

Is there a standard closure interface that is Serializable?

If not, maybe you could tell me why. I get NotSerializableException when my class is being serialized. Inside the class I am passing this anonymous class to a method: new org.apache.commons.collections.Closure() { ... }; The question is still unanswered. I want to know if there is a standard Closure interface that implements Seri...

Google Visualization API .net?

How can i use data in my .NET app that is coming in google's visualisation api json format? Can't imagine at the moment how to use this data. Do i have to parse the json to an object by myself? Can i use Json.NET to deserialize it? For now i have no idea how start with this. Any help is appreciated. Data looks like this: { cols: [ ...

boost serialization NVP macro and non-XML-element characters

When using the BOOST_SERIALIZATION_NVP macro to create a name-value pair for XML serialization, the compiler happily allows the following code to compile, even though the element name is not a valid XML element and an exceptions is thrown when trying to actually serialize the object into XML: BOOST_SERIALIZATION_NVP(_member[index]) An...

WCF Serialization error with "ArrayOfstring" Data Contract

Am getting an error mentioned below when I call my WCF service?How do i get rid of it? There was an error while trying to serialize parameter http://tempuri.org/:MyWCFSvc.svc The InnerException message was 'Type 'System.String[]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not ex...

Using .Net OnSerializingAttribute to alter variable names?

Hi, in order to obfuscate application code but still be able to use serialization to save application data, I want to map the names of all serialized members to custom serialization names. I know that I can achieve this by implementing the ISerizableInterface, but in the MSDN they suggest the use of OnDeserializedAttribute, OnSerializin...

What is the Serialization Proxy Pattern?

Alas, Google has failed me... What is the Serialization Proxy Pattern and where can I learn more about implementing and using it? ...

What are the deficiencies of the built-in BinaryFormatter based .Net serialization?

What are the deficiencies of the built-in BinaryFormatter based .Net serialization? (Performance, flexibility, restrictions) Please accompany your answer with some code if possible. Example: Custom objects being serialized must be decorated with the [Serializable] attribute or implement the ISerializable interface. Less obvious e...

How can I find out the serialVersionUID of a serialized Java object?

I have several serializable classes that were compiled without specifying a serialVersionUID. I now need to add some data members to these classes but wish to preserve some already serialized objects. Is there anyway to find out the serialVersionUID of these serialized objects so that I can specify the same ID in the source code? ...

Java StreamCorruptedException

I have a client and server application that transfer message using serialization over TCP. I got the following error when deserializing an object: Any ideas to the cause or possible next steps in analyzing this problem? java.io.StreamCorruptedException: invalid stream header: 383D4649 at java.io.ObjectInputStream.readStreamHeader(...

Convert.FromBase64String()

Hello, Q1 - If character ‘C’ is saved into viewstate, then just before the page is rendered,Asp.Net serializes ‘C’(along with other data) into Base64 string. If on postback I issue the following code: protected void Page_Load(object sender, EventArgs e) { TextBox1.Text = "ABCDEF"; if (IsPostBack) { string v...

Error on deserialization of Array Collection in Flex: RangeError: Error #2006

I am getting this error during serialization: RangeError: Error #2006: The supplied index is out of bounds. The error occurs in AbstractMessage.as when it attempts to read input of timestamp. After that my fault handler gets this error: faultCode:Server.Acknowledge.Failed faultString:'Didn't receive an acknowledge messa...

How would I go about reading/writing a Structs contents to a file in C++ ?

I'm working on a homework project and i'm trying to store inventory data into a file. The inventory data size shouldn't be too large cause technically no one is going to really use it. I need to write these contents to a file: • Item Description • Quantity on Hand • Wholesale Cost • Retail Cost • Date Added to Inventory I am g...

Java serialization over network

Just want to know if there's a tutorial or an how-to for serializing object, put it in a stream over network, and deserialize it on the other point. I understand the principles of serialization, I/O, streams, sockets and so on, just want an example (client sending object to a server) to start with. Thank you. ...

I'm trying to read/write the size of multiple structs to a .dat file. I am getting compile errors, what am I doing wrong? (C++)

I've already asked 2 questions kind of related to this project, and i've reached this conclusion. Writing the size of the Struct to the file , and then reading it back is the best way to do this. I'm creating a program for a homework assignment that will allow me to maintain inventory. I need to read / write multiple structs of the same...