serialization

How do you serialize a Spring Bean (spring 3)

I understand this is supposed to happen automatically, but it's doing anything but in my experience. Does anyone know how to serialize a Bean which has indirect/direct references to other non-serializable Beans/classes? ...

django-piston : Overriding default serialization in emitters

Hi ! I am currently writing an API for a django project, and using django-piston for this. However, I need to customize the way certain base types are serialized. More precisely, my models are subclassed from a special Model class, which inherits from django.db.models.base.ModelBase, but cannot be serialized as regular django models .....

How to serialize the Key and only one object value of a generic Dictionary<TKey, TValue> ?

Hi all, I am looking forward to serialize a Dictionary in order to save some of it's information, more precisely it's Key and one of it's Value, into Silverlight Isolated storage. I have read many question talking about the same subject on these boards, but none were explaining what I was trying to do, or at least not in a way I could u...

Deserialize a Digital Persona template in VB.net

Reading binary data out of the database, and I need to convert it back into a Digital Persona fingerprint template. I'm not familiar with serialization and deserialization, so I could use a bit of help. Here's what I tried: Dim rsBioData As SqlDataReader = SQL.ExecuteReader Dim byteTemplate As Byte Dim memStreamTemplate As MemoryStrea...

De-Serializing a generic (but Serializable) type

I'm wondering if it's possible to de-serialize a generic type into an instance of that type. If it is possible, does Java take into account the generic type's custom de-deserialization (if any)? In my case, I'm trying to implement a List that is backed by a file which contains the serialized form of the elements, and needs to instantiat...

XML to DynaBeans from only xsd. Possible ?

Hello, my question seems simple but I'm going crazy :) Is there a way, using JAXB, Castor or XStream to convert XML into DynaBeans, considering that I have the xsd schema but no precompiled mapping classes and no ObjectFactory or similar ? Blaise Doughan suggested to use MOXy (thanks again, Blaise) but unfortunately I have no permissio...

JSON deseralization to abstract list using DataContractJsonSerializer

Hello, I'm trying to deserialize a JSon file to an instance of a class that contains an abstract list. Serializing the instance to the Json works well (check the json file below). When deserializing I get a "System.MemberAccessException" with the message "Cannot create an abstract class". Obvisouly the deseralizer is trying to instantia...

Load JSON data stream from text file into objects C#

I'm using Newtonsoft.Json.Linq and I'd like to load the data into objects (or structs) that I define and put the objects into a list or collection. Currently I'm pulling out the JSON properties with indexes to the names. filename = openFileDialog1.FileName; StreamReader re = File.OpenText(filename); JsonTextReader reader = new JsonTex...

How to create a form login with Spring Framework on Google App Engine

I'm new to Spring and GAE, and I assume this is easy, so don't overlook the simple answer. In spring I understand that I need to create an implementation of UserDetailsService which populates UserDetails for the security framework on authentication. After doing this I got a NotSerializableException on my SpringUserDetailsService bean, ...

How to debug serialization error in tombstoned WP7 app

I am handling the current state of my WP7 app in the OnNavigatedFrom and To events so that if the app is tombstoned OR they navigate to a different page it saves the state to the inbuilt PhoneApplicationService state. I have a simple ViewModel which I dump to the state to make life easier. When navigate to a different page within my app...

Issue with MVVMLight ViewModelBase public parameterless constructor in inherited base class for WP7 Tombstoning

I am handling tombstoning in Wp7 by dumping my ViewModel into the PhoneApplicationService state (see this link for more info). My ViewModel (VM) inherits from the MVVM Light Toolkit (ViewModelBase) which has a protected parameterless constructor only. This causes the serilization to fail with: "The type 'GalaSoft.MvvmLight.ViewModelBa...

Is Hibernate / JPA taking in consideration the transiant modifier ( not the annotation )

Hi, I want to avoid serialisation ( in JMS / AMF ) but still persist the field with JPA/Hibernate. Is the transient modifier my friend ? Are @Transient annotation and the transient modifier related or not a all ? The java specification precise that a transient field will not be saved to a persistent storage by a system service. But is...

How should I unit test the serialization of an Exception class?

What's the best way to unit test the Serialization of an Exception class like this: [Serializable] public abstract class TankBaseException : Exception { public TankBaseException() : base() { } public TankBaseException(string message) : base(message) { } public TankBaseException(string message, Exception innerException) : b...

How to recognize versions of objects placed in isolated storage using .NET runtime serialization?

Hello, We are building application that stores objects to isolated storage using .NET runtime serialization. Problems occur when we update application by adding some new properties to the classes of objects we are serializing. So we want to do some kind of versioning of the objects in isolated storage so we can check if they are obsol...

How do I store arbitrary binary data in a binary serialized class?

Using C#/.NET for my application, I've got a series of classes in my main data model that represent "binary" (as opposed to text) content. I've got a inheritance setup like this: Basically, the abstract class BinaryContent contains a MemoryStream that stores arbitrary binary data. That data is read from a file on disk. Each type of bi...

Serialising my class is failing because of an eventhandler

I wasn't expecting to come across this error. I imagine I'm doing something wrong somewhere else. I have an MVVM application. My model can serialise its self using a BinaryFormatter. This was working fine. Today I added in an event handler to my model, and the viewmodel that contains the model subscribes to this event. Now when I try...

wcf generic datacontract does not get serialized

I am having the following data structure: [DataContract] public class OperationResult<T> { public OperationResult() { } [DataMember] public Int32 OpResult { get;set; } [DataMember] public IList<T> OperationResults { get;set; } public static OperationResult<T> Success(IList<T>...

DeSerializing JSON to C#

I see a lot of simple examples of JSON DeSerialization, but when it comes to anything slightly more complex, there is a lacking of samples. I'm looking at deserializing Responses from GetResponse's API: Simple e.g. { "result" : { "updated" : "1" }, "error" : null } Another: { "result" : null, "error" :...

Calculating byte-size of Java object

Hi, I am working on calculaitng the size [memory used] of a java object [hashmap] . It contains elements of different data types [at runtime] so [ no-of-elem * size-of-element] is not that good an approach. The code right now does it by series of if (x) do something else if (primitives) lookup size and calculate However this pro...

what is serialization all about?

Where exactly does serialization comes into the picture? I read about serializtion on the 'net and I have come to know that it is an interface that if implements in a class, means that it can be automatically be serialized and deserialized by the different serializers. Give me a good reason why and when would a class needs to be ...