serialization

SerializationException when serializing lots of objects in .NET

I'm running into problems serializing lots of objects in .NET. The object graph is pretty big with some of the new data sets being used, so I'm getting: System.Runtime.Serialization.SerializationException "The internal array cannot expand to greater than Int32.MaxValue elements." Has anyone else hit this limit? How have you solved it?...

How to deep copy between objects of different types in C#.NET

I have a requirement to map all of the field values and child collections between ObjectV1 and ObjectV2 by field name. ObjectV2 is in a different namspace to ObjectV1. Inheritence between the template ClassV1 and ClassV2 has been discounted as these 2 classes need to evolve independently. I have considered using both reflection (which ...

Can a PHP script unserialize a Storable file created with Perl?

Can a PHP script unserialize a Storable file created with Perl? ...

How to tell for which object attribute pickle fails?

When you pickle an object that has some attributes which cannot be pickled it will fail with a generic error message like: PicklingError: Can't pickle <type 'instancemethod'>: attribute lookup __builtin__.instancemethod failed Is there any way to tell which attribute caused the exception? I am using Python 2.5.2. Even if I understand...

WCF Passthrough

Hi everyone, I have an N-tier structure composed of WCF nodes. I need to occasionally pass very large volumes of data from a terminal node to the top node and I would like to avoid deserializing the very large data field during the intermediate hops. I can't pass directly to the top due to our fall over strategy. Is there any way to avo...

Python serialize lexical closures?

Is there a way to serialize a lexical closure in Python using the standard library? pickle and marshal appear not to work with lexical closures. I don't really care about the details of binary vs. string serialization, etc., it just has to work. For example: def foo(bar, baz) : def closure(waldo) : return baz * waldo ...

Php serialize

Im trying to save serialized arrays into my mysql database then retrive them and unserilize them but I cant work out how to unserialize them. here is what I have so far: $query = mysql_query("SELECT friends FROM users WHERE id='$myid'"); $friends = mysql_fetch_array($query); unserialize($friends); Stuck here ????? array_push($friend...

unserialize problem

Hi, I have another problem with my scripy now I have made it more advance, first off the count function doesnt work properly and it gives this error. *Warning: array_push() [function.array-push]: First argument should be an array in C:\wamp\www\social\add.php on line 42* Here is my script: $query = mysql_query("SELECT friends FROM use...

customize deserialization sample in C#?

Hello everyone, I am looking for a sample, which could let me deserialize an XML stream encoded in UTF-8 into a field of a class. More specifically, I have a class like, class Foo { string abc; byte[] bcd; } and abc maps to XML element "Abc" and bcd maps to XML element "Bcd", and I want to get the stream for bcd and retrieve ...

Serialize/deserialize to/from multiple XML config files

I have a set of custom XML configuration management classes in .NET. There are two configuration scopes in my application: User: the setting applies to the user regardless of the account she's logged into. Stored in a XML config file in the user's directory. User/Account: the setting applies to the user when logged into a particular ...

C#: Render object as XML

I am looking for a way to convert an object tree to XML. It would be fun to write, but I am sure someone has already written it. Here is my wish list: It should not care about constructors It should ideally handle circular references (not too fussed how) It should not require changes to the objects - e.g., no custom attributes It shoul...

List serialVersionUIDs in serialized data

Hi, I have a file that contains serialized Java classes. I would like to parse this file in order to get a list of the classes in the file and the serialVersionUID of each class. Is there a tool anyone can recommend to do this, or perhaps someone could offer some pointers on where I should start to accomplish this myself? Cheers Rich...

SharePoint Webpart deserialize error

I am getting a random web part error, it works one refresh and then not the next: Web Part Error: One of the properties of the web part has an incorrect format. Windows SharePoint services cannot deserialize the Web Part. Check the format of the properties and try again. The web parts have been on the site for a long time...

Why am I getting this NullReferenceException?

Hi all, I'm working on a project that involves some home-made (de-)serialization code, and I have run into some issues with the deserializing of a List. The following code is throwing a NullReferenceException on the second line, even though the var list is not null, and happily reports Count = 0 when hovering my mouse over it. System.C...

What is best practice for serializing Java enums to XML?

Hi I have a Java enum and I want serialize a variable containing an enum value back and forth from XML for persistence. My enum is defined like this... public enum e_Type { e_Unknown, e_Categoric, e_Numeric } My variable is declared like this... private e_Type type; I want it to go into an XML tag like this... <type>value</typ...

Deserialisation/parsing of a custom message format

Hi, I am currently looking into writing a fast deesrialisation/parsing of a custom message format which are similar to BNF syntax. There are maybe 50 different objects involved. The grammar of the objects contains a recursive definition which is the biggest problem for me at the moment. Do you know any good examples or would you write yo...

Serialize custom object to XML

I'm trying to create a class which I can serialize to produce the following XML: <chart palette='1'> <categories> <category label='2001' /> <category label='2002' /> ..etc I have a class which look something like this: [XmlRoot("chart")] public class Chart { [XmlAttributeAttribute("palette")] public string ...

How can you control WCF serialization so it uses attributes instead of elements?

If I have a class marked as a DataContract and a few properties on it marked with DataMember attributes I can serialize it out to XML easily, but it would use an output like. <Person> <Name>John Smith</Name> <Email>[email protected]</Email> <Phone>123-123-1234</Phone> </Person> What I would prefer is attributes, like... ...

Problems with binary deserialization - can anyone help?

I have the same issue as in this post: http://social.microsoft.com/Forums/en-US/netfxbcl/thread/10027dd8-da47-4691-91a6-a8b89a7f514a Anyone know a possible answer / solution? Funny thing is that I have 2 collections in my serializable class (binary serialization). One is List, one is Dictionary. The List collection is OK, Dictionary re...

Overriding a property with an attribute

I'm trying to find a way to change the serialization behavior of a property. Lets say I have a situation like this: [Serializable] public class Record { public DateTime LastUpdated {get; set; } // other useful properties ... } public class EmployeeRecord : Record { public string EmployeeName {get; set; } // other useful ...