serialization

marking a WinForms Button as serializable

This is my very first program for serialization. An error occurred when trying to serialize a button control. public Form1() { InitializeComponent(); CheckSerialization(); Button btn = btnSerialized; } public void CheckSerialization() { Stream write = File.OpenWrite(@"C:\ser.bin"); ...

How to detect whether there is anything left inside a boost archive

Is there a way to detect whether there is anything left inside a boost archive after I read from it? I tried this piece of code: const string s1("some text"); std::stringstream stream; boost::archive::polymorphic_text_oarchive oAr(stream); oAr << s1; boost::archive::polymorphic_text_iarchive iAr(stream); string s2; iAr >> s2; if (!str...

How can I wrap std::wstring in boost::asio::buffer ?

I am writing a client server application using boost::asio. I want to transfer a structure from a client to the server. The struct has a few std::wstrings in it. How do I encode the structure in boost::asio::buffer? ...

Does the DataContractSerializer call property getters/setters?

I know that on deserialization the DataContractSerializer does not call the constructor. Does it also bypass a public or private property's setter method? ...

Sending large objects over TCP: "End of Stream encountered before parsing was completed"

I keep getting an SerializationException whenever I try to deserialize a list of doubles from a NetworkStream: End of Stream encountered before parsing was completed I have a simple client server architecture: my TcpTransportClient wraps the functionality of a TcpClient and I utilize two basic methods: Send (sends a message) and...

Approximating Size of Serializable Class

I would like to know the approximate XML serialized size of a class instance, without actually serializing the instance. Certainly I can provide a property that explicitly sums together the size of all fields, along with padding for the XML tags that would be generated. However, (1) I'd like to know if there is already a tool that serv...

Frustrating TCP Serialization Exception: Binary stream '0' does not contain a valid BinaryHeader

I posted a question on how to send large objects over TCP and it seems like the primary issue is solved, but now frequently I get another exception: Binary stream '0' does not contain a valid BinaryHeader. Possible causes are invalid stream or object version change between serialization and deserialization. The issue is sti...

What is Serialization/Deserialization and marshalling/unmarshalling with example?

recently i read about interface iclonable,in that i studied about serialization and marshalling i like to know about that with examples. ...

Custom Array Serialization on Flex client

Hi, I was wondering if it is possible to do custom serialization of Arrays/ArrayCollections in as3 via amf. To be more specific, i want to be able to pool objects on the client so that im not instantiating new objects every time i make a RemoteObject call. I tried using IExternalizable but that only lets me serialize the objects myself ...

Write large 4 byte integer as an unsigned, binary

I have integers which floats between values: 4000000000-4294967000 (which is less than int max for a 4 byte unsigned int) and i want to save it to file, and then re-read value $f = fopen($fileName, 'wb'); fwrite($f, pack('I', $value)); It is important that in file, value must be exact 4 byte unsigned int, because external devices wil...

ASP.NET MVC - Serializable

Hello there! I'm trying to use the new Html helper extension Serialize() from the furthure assembly.. If you take a look at: View <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<List<MvcApplication2.Models.ProductViewBinding>>" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/...

How to serialize & deserialize Javascript objects?

I need to serialize and deserialize Javascript objects to store them in a DB. Note that these objects contain functions, so I can't store them as JSON, so I can't use json2.js. What's the state of the art in [de]serialization of javascript objects (in javascript of course). Thanks, Stewart ...

Serializing Exception to be throwable

While I realize there is a similar question (How to serialize an Exception object in C#?), and though the answers on that page were helpful, they didn't exactly solve the problem or answer the question posed. I believe the question was how to serialize the object to allow it to be reconstructed (deserialized) into the same object. I've...

Deserialize JSON with embedded Dictionary<string, string>

I need to determine if the DataContractJsonSerializer can deserialize JSON to a Dictionary if the Dictionary is not the wrapping object being deserialized. I know there are other open source codes projects that may be able to do this (json.net, json-framework) but I'd like to know definitively if .NET can natively handle this before taki...

Output Django Object into XML-RPC response

I'm trying to return a django object in a XML-RPC response. Is it possible to serialize a model as XML-RPC methodResponse? ...

Can multiple classes serialize the same object in Java?

I am serializing an ArrayList in 2 classes: private void serializeQuotes(){ FileOutputStream fos; try { fos = openFileOutput(Constants.FILENAME, Context.MODE_PRIVATE); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(quotesCopy); oos.close(); }...

Infinite loop when Json serializing a Collection (VB ASP.NET)

I am trying to use a Web Service to return Json for a Collection of Users from a Database Table. I'm only new to .NET (< 1 week experience), and I don't want to use the UpdatePanel for AJAX. I have tried using the JavaScriptSerializer as well as Json.NET to serialize. Both cases seem to spawn an Infinite Loop. What am I doing wrong? Is ...

How to preprocess ZipInputStream of XML data before deserialization?

In .NET and C#, I have some XSD generated class with root and type attributes set to [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://example.com")] [System.Xml.Serialization.XmlRootAttribute("myRootElement", Namespace="http://example.com", IsNullable=false)] Furthermore, I have files containing XML data from different sou...

.NET serialization of Array to XML. How to set an alias for array type?

Hi I'm trying to figure out serialization of .net arrays to XML. Here's a piece of code that I've come up with: public class Program { public class Person { public string Firstname { get; set; } public string Lastname { get; set; } public uint Age { get; set; } } ...

Can we assign name to the serialized objects ?

During serializing objects, can we assign name to different objects? So, that on the time of reading objects, i can call any object by its name and later on can access its members. I can do it by assigning a unique field to each object and later compare it against that field but that will cost - O(n). Is there any other way to fast acc...