serialization

Object serialization in PHP issues?

I was wondering if there is any reason to stay away from object serialization in PHP. My use case is for deferred processing. Ex: A mail queue where the mail object would be serialized when a send request is received, stored in a db and unserialized by a scheduled worker script. The alternative is to store all the information that is n...

Simple XML deserialization

I am trying out the Simple XML serializer. I am more interested in deserialization from XML->Java. Here is my code as a unit test: import java.io.StringReader; import java.io.StringWriter; import junit.framework.TestCase; import org.simpleframework.xml.Attribute; import org.simpleframework.xml.Root; import org.simpleframework.xml.Seri...

Question: Serializing and deserializing, the significants and when to use it

I am reading a book that is talking about serializing and deserializing files or sending data via web services. My question is.. Is it mandatory to use serialization when using web services. Also when saving files locally using serialization, what is the significants of doing so ? I know that it saves the data into binary data. Is this ...

What is the advantage of using DataContractAttribute over SerializableAttribute?

I have found that my WCF services work normally when the data types involved doesn't have the [DataContract], but the [Serializable] instead. But all the WCF tutorials shows the first one instead of the latter. Why? ...

What's the fastest way to deserialize a tree in C++

I'm working with a not so small tree structure (it's a Burkhard-Keller-Tree, > 100 MB in memory) implemented in C++. The pointers to the children of each node are stored in a QHash. Each node x has n children y[1] ... y[n], the edges to the children are labeled with the edit distance d(x, y[i]), so using a hash to store the nodes is an...

.Net Binary Serialization inheritance

In a C# Context, I have a Class B which is marked as Serializable and who's inheriting form a Class A who's not marked as this. Can i find a way to serialize instance of B without marking A as serializable? ...

How to unserialize PHP Serialized array/variable/class and return sutable object in C#

The goal is to unserialize a PHP serialized string and get sutable object in C# Is there any way to make this possible in C#(.Net)? To be more specific: We need to make an application which comunicates (Via HTTP) to specific website which returns the needed information. Fortunately/unfortunately we dont have permission to website so th...

Binary stream 'NN' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization

I am passing user defined classes over sockets. The SendObject code is below. It works on my local machine, but when I publish to the WebServer which is then communicating with the App Server on my own machine it fails. public bool SendObject(Object obj, ref string sErrMsg) { try { MemoryStream ms ...

Why is this class not Serializable?

I was using the Mersenne-Twister implementation at http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/VERSIONS/JAVA/MTRandom.java as a drop-in replacement for the default java.util.Random class. However, four fields (an int, a boolean and two byte[]) are marked as transient. This means that I can't serialize an object of this class without ...

XML serialization and LINQ

I've currently got an XML element in my database that maps to an object (Long story short the XML is complicated and dynamic enough to defy a conventional relational data structure without massive performance hits). Around it I've wrapped a series of C# objects that encapsulate the structure of the XML. They work off a base class and th...

Cannot Unserialize an object array in php

I have an array of Shift objects that I'm working with in PHP. I need to store these objects within a database. I'm working on a function that will add shifts to the database: $Serialized_S = get_option('MasterShiftString'); $MasterShiftArray = unserialize($Serialized_S); if(!$MasterShiftArray) { echo "MasterShiftArray returns false";...

Including Join Model Attributes in Serialization

Imagine a service where a User :has_many Events :through an Interest join model, and that there is an Interest#attending flag to indicate whether the user plans on being at the event. If I want to return a list of events, but also include the value of the #attending flag for the current user, I could do this: <interests> <interest> ...

Why does double brace initialization asks for SerialVersionUID?

public static List<Long> abc = new ArrayList<Long>(){{ //Asks for SerialVersionUID abc.add(5L); abc.add(7L); }}; public static List<Long> abc = new ArrayList<Long>();//Does not need SerialVersionUID static{ abc.add(5L); abc.add(7L); } ...

serialization and versionId

please help clarifying the doubt : While doing serialization, if we have defined the version id as static final long serialVersionUID = 2L;, and since this being static it should not get serialize while storing the object to the persistent medium. While reading the object back from persistent medium, how does the object match the ver...

What is the value of static variables after deserializing an object?

Let's say that I create an instance of class B, which has an static variable x, assigned with a value of 3 in the class B declaration. In the main() method, I do this: B b = new B(); b.x = 7; //allowed to use an instance to set the static member value After this, b is serialized and then de-serialized. Then, the following line occurs:...

XmlSerialization and List

I have the following class public class Notifications : List<Notification> { } Unfortunately, when it's serialized it looks like <ArrayOfNotification> <Notification> ... How can I get that root node to be Notifications? I've tried a few different attributes on the class, but none compile. ...

Sending an object over the Internet

I define a class, and then I instate an object of that class type. I want to send this object to another Java application running on a different computer transparently. What is the best technology to accomplish this? ...

Parallel Binary DeSerialization?

I have a solution where I need to read objects into memory very quickly, however the binary stream might be cached compressed in memory to save time on disk io. I've tinkered around with different solutions, obviously XmlTextWriter and XmlTextReader wasnt so good and neither was the built-in binary serialization. Protobuf-net is excel...

How to XmlSerialize System.Drawing.Font class

The classSystem.Drawing.Font is not XML Serializable since it doesn't have a default (empty) constructor. Is there some work around or alternative way to serialize Font nevertheless? ...

casting byte[] to user defined class in java

i want to cast byte[] which i got from socket a class which I write it (Message). I tried byte[] data=new btyte[100]; . . . Message m=(Message)data; but it did not work and give me error what should I do? ...