serialization

Java serialization and instance sharing using remote services

I'm currently thinking about some design details of remoting / serialization between a Java Swing WebStart Application (Fat Client) and some remote services running on Tomcat. I want to use a http compatible transport to communicate with the server and since I'm already using Spring, I assume Spring's HTTP Remoting is a good choice. But ...

C# memcpy equivalent

Hi Guys, I have 2 objects from the same type and i would like to shallow copy one state to the other. In C++ i have memcpy which is great. How can i do it in C#? The MemberwiseClone() is not good enough because it creates & returns a new object and i like to copy to an existing object. I thought of using reflection but i'm afraid it will...

How to serialize a derived class in Silverlight

I created a custom control in XAML, and added some custom properties as well. Now, I want to serialize it to JSON if possible. Here is (essentially) what I have: public partial class MyCustomClass : UserControl { public Dictionary<char, int[]> ValueMap; public int Value { get; set; } } And in the code that handles serializatio...

How do I maintain deserialization compatibility across obfuscated and debug builds?

Hi all, I'm trying to get the {smartassembly} .NET obfuscator to work with my system. I currently store user data in a series of serialized dictionary classes, and then deserialize those classes to get the data back. I'm already ignoring assembly version information, just because that way making life a pain. That code is adapted from...

Speed: Java serialization or csv?

I have a large array of Java simple structs (consists of just primitive members) and I need to save and load them from and to a file What would be faster, implementing java.io.Serializable and using read/writeObject or overriding toString() / toCSV(), adding a new constructor and reading/writing to text file? I want to avoid b...

Problem with C# serialization extension methods

I really like the extension method that TWith2Sugars posted here. I ran into an odd problem though. When I put this into a shared class library and call the serialization function, I get the following error: The type MyType was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known stati...

SOAP to Stream to String

I have a SOAP object that I want to capture as a string. This is what I have now: RateRequest request = new RateRequest(); //Do some stuff to request here SoapFormatter soapFormat = new SoapFormatter(); using (MemoryStream myStream = new MemoryStream()) { soapFormat.Serialize(myStream, request); myStream.Position = 0; using (Str...

deserializing a generic list returns null

I'm de/serializing an object like so: public class myClass : ISerializable { public List<OType> value; public myClass(SerializationInfo info, StreamingContext context) { this.value = (List<OType>)info.GetValue("value", typeof(List<OType>)); } void ISerializable.GetObjectData(SerializationInfo info, StreamingContext conte...

Will the VB.Net Serializers execute code in public members?

We wish to use the Binary Formatter. In debugging, thus far, it seems that it does not execute the getters for public properties. Does the XML Serializer behave the same way? Also, during deserialization, will the deserializers use the setters to apply the values during deserialization? Thus far, our testing with BinaryFormatter shows t...

Deserialize a byte array to a struct

I get a transmission over the network that's an array of chars/bytes. It contains a header and some data. I'd like to map the header onto a struct. Here's an example: #pragma pack(1) struct Header { unsigned short bodyLength; int msgID; unsigned short someOtherValue; unsigned short protocolVersion; }; int main() { ...

How can I serialise a javabean to be loaded by Spring's DataBinder?

I need to serialise a javabean (with arbitrary nested beans) to plain text, and then later restore as an Object graph. For the purposes of this question I am not interested in XML, JSON, etc. but rather name/value pairs. The Spring DataBinder is great for turning a list of name/value pairs into a real Object. For example we can supply:...

Deserialization Error: The XML element 'name' from namespace '' is already present in the current scope.

This is my first time using XML Serialization and this is driving me absolutely nuts after 2 days of trying to troubleshoot this. I get this error when the deserialization kicks in: The XML element 'name' from namespace '' is already present in the current scope. Use XML attributes to specify another XML name or namespace for the eleme...

How do you serialize an object in C++?

I have a small hierarchy of objects that I need to serialize and transmit via a socket connection. I need to both serialize the object, then deserialize it based on what type it is. Is there an easy way to do this in C++ (as there is in Java)? Are there any C++ serialization online code samples or tutorials? EDIT: Just to be clear, I...

How to store a hash table in a file?

How can I store a hash table with separate chaining in a file on disk? Generating the data stored in the hash table at runtime is expensive, it would be faster to just load the HT from disk...if only I can figure out how to do it. Edit: The lookups are done with the HT loaded in memory. I need to find a way to store the hashtable (in m...

What's the simplest way to import a System.Data.DataSet into Excel?

In .NET 2.0 (in this case VB), is there a standard API that'll serialize a DataSet object into a stream that can be saved as a tab-delimited file and opened directly in Excel? Or does one have to create the delimited file manually by iterating through the members of the table collection? In this case, the DataSet's small, consisting ...

Deserialization validation

I'm working with a list of fonts that I serialize and deserialize using DataContractSerializer. In between the two steps, it's conceivable that the user has removed a font from their machine. I'd like to check a font name as it's being deserialized to ensure that it still exists on the system. If it doesn't exist, that element is not inc...

DataContractSerializer: preserve references

Hi, Just a question of curiosity. When i preserve object refernces while serializing an object graph with DataContractSerializer the xml emitted where there are refrences looks like this: <test z:Ref="1" and i:nil="true" /> Can anybody tell me why it says i:nil="true" here? Why not just the reference? ...

C# Xml-Serializing a derived class using IXmlSerializable

I've got a base class which is compatible with XML serialization and a derived class which implements IXmlSerializable. In this example, the base class does implement IXmlSerializable: using System.Diagnostics; using System.Text; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; namespace XmlSerializationDeri...

Simple way to do Xml in Java

Is there is Simple way to read and write Xml in Java? I've used a SAX parser before but I remember it being unintuitive, I've looked at a couple of tutorials for JAXB and it just looks complicated. I don't know if I've been spoilt by C#'s XmlDocument class, but All I want to do is create an Xml Document that represents a a set of class...

Will adding automatic properties affect remoting?

We have a huge client/server WinForms app that uses .NET remoting to pass DAOs between the layers, which has a few problems. All of the DAOs were defined to use fields instead of properties long before I got here, and you can't bind fields to controls. Adding fields or properties to a DAO changes the serialization format, requiring a d...