serialization

jQuery matched set to string

I need to serialize a matched set so it's values can be passed to my rails app. The matched set code is (returns the parent div of every uninitialized select element): jQuery('select').filter(function(index){ return jQuery(this).val() == 0;}).closest('div') for serialization I really only need the id of each matched element so I...

Zend_Cache unserialize - memory hog?

I've setup Zend_Db_Table_Abstract so it uses metadata cache and then profiled with xhprof to see how much memory it uses. Turns out 34 calls from _setupMetadata to Zend_Cache_Core::load use up 7mb memory, most of it being used by calling unserialize. The configuration for the metadata cache is: resources.cachemanager.db_metadata.front...

How can I add child elements in XML inside particular parent node?

I have serialized a following log class: [Serializable] [XmlRoot("Log")] public class Log { [XmlElement("ErrorLog")] public ErrorLog Error { get; set; } [XmlElement("MessageLog")] public MessageLog Message { get; set; } } public class ErrorLog { [XmlElement("ErrorMessage")] public string ErrorMessage { get; se...

Does mono support DataContractSerializer with the preserveObjectReferences flag?

Hi all, I am trying to serialize a complex graph using c# mono (mono v2.6) the graph has bi-directional links and there are objects which create circular dependencies. After doing some reading I tried setting the preserveObjectReferences flag which should allow circular references to be set (this constructor): public DataContractSeria...

Serialization across projects with inheritance

I have a base class ("MyBaseClass") in a project called "BaseFramework" which is included in several solutions within the company. There are several derived class's in various projects throughout the company that inherit from "MyBaseClass". If I then create a List and add derived class's to it, it will not serialize. I realise that if I...

Serialization of Interface Reference for an Implementation Class fails at De-serialization

Hello, I'll try and explain my problem as concisely and clearly as possible. I feel that what I'm trying might inherently be wrong, but somehow I believe it should work. So please feel free to treat this post as a mere clarification about the Serialization mechanism. So, I have an Interface implemented by a class [it's implied they exi...

Serialize/deserialize objects - order of fields matters?

Is it possible that DataContractSerializer wrongly deserializes object if fields are not in the "correct" (whatever that means) order? My classes that I serialize/deserialize do not have order attributes placed on fields/properties. Yet one of my fields always get deserialized as null although it has values, it actually contains a list o...

How can I have more flexible serialization and deserialization in Java?

If I serialize an object in Java, and then later add an extra field to the java class, I can't deserialize the object into the modified class. Is there a serialization library or some way that I can have deserialization be less strict, like if there is an extra field added to the class then it just fills that with null upon deserializat...

Java - When do I have to change the serialVersionUID?

I know that I can use serialVersionUID to control the version of classes. And I read that I can then add or remove fields and the class will still be compatible, it will just use default values. When must I change the serialVersionUID? ...

Changing [Serializable] to [DataContract]

Hi, I have an existing set of classes that use the [Serializable] attribute. I need to expose them in a WCF service and so I need them to have the [DataContract] attribute. It works with just Serializable but then the properties get funny names like ...k__BackingField. These classes are also used elsewhere and I'm wondering whether I r...

GWT serialization and decorator pattern

I use the decorator pattern to describe Actions, and I would like to use those Actions in RPC calls public abstract class Action implement Serializable { boolean isDecorated = false; public Action() {} // default constructor for Serialization } public abstract class ActionDecorator extends Action { private Action _decora...

C# serialising data structure with objects in multiple lists/collections

In C# I wish to serialise a data structure where objects can belong to more than one collection. For example, I have a Person class. I also have a Family class and School class, which each contain a MemberList. An instance of the Person class can be present in both the MemberList of the Family and the School. I wish to serialise the en...

WCF Data Contract / Serialization

I created a simple WCF application which expose one operation. This operation takes a composite data type as parameter. I have not decorated this composite data type with [DataContract] attribute. But this is working and I can see the Schema for this in WSDL. Now my understanding is that this new custom type should be decorated with ...

Create an alternative to serializable anonymous delegates

Hello stack, there have been quite some posts about this, all trying to serialize a Func delegate. But could someone think of an alternative, when the use of the delegate is always clear? We have a generic create command, which takes a delegate as paramater in the constructor. This delegate will create the Item for the create command:...

Object serialization in XML format using Obj-C / iPhone SDK

Hi folks, I have an iPhone App that uses a relatively small amount of data. I'd like to save the data in the XML format and be able to load this in memory to Objective-C objects. I'd like to use iPhone SDK facilities like NSPropertyListSerialization or writeToFile:atomically: classes and methods. The NSPropertyListSerialization documen...

XML to/from a Python dictionary

I need to use Python 2.4.4 to convert XML to and from a Python dictionary. All I need are the node names and values, I'm not worried about attributes because the XML I'm parsing doesn't have any. I can't use ElementTree because that isn't available for 2.4.4, and I can't use 3rd party libraries due to my work environment. What's the easi...

Data loss during WPF clipboard operations

I am working with a FlowDocument in a WPF RichTextBox. Some of the flow document elements are created using subclasses of the System.Windows.Documents framework classes and all of the elements use the Tag property to store additional data. If I use a XamlWriter to serialize a document tree, everything is correctly reflected in the resul...

Use variable value as a Type in Scala

Hi Guys. I'm playing with serialisation, and hitting an issue with typing when reading back in from a file. My current plan of action is to use a filename prefix to suggest the correct type, then base the deserialisation on that type. (This may well be a "Very Bad Idea", so any suggestions otherwise would be most gratefully received!)...

Object Serialization on different platform

Hi guys I'm creating a very simple socket server that lets its clients save its own object state based on Keys by sending it over the wire. I'm using a very simple protocol encoding the serialized object to base64 string and will be sent out as part of my custom xml format. I wanted to know if the serialization will still be the same if ...

Deserialized object has null in all fields

I have written my Container<T> class which backups its T items in several collections -- primary one is List<T>, others are various maps with data derived from items, mostly for optimized search. Class looks like this: class Container<T> implements Serializable { private static final long serialVersionUID = 1L; private final ...