serialization

How to implement type-change for XML serialized types?

I have a class that is serialized to XML. Inside, I have a member: private double? mDefaultMin = null; protected double? DefaultMin { get { return mDefaultMin; } set { mDefaultMin= value; } } Later on, I realize that I actually need to store list of values: private DoubleList mDefaultMin = null; protected DoubleList DefaultM...

How to JSON serialize math vector type in F#?

Hello! I'm trying to serialize "vector" (Microsoft.FSharp.Math) type. And I get that error: Exception Details: System.Runtime.Serialization.SerializationException: Type 'Microsoft.FSharp.Math.Instances+FloatNumerics@115' with data contract name 'Instances.FloatNumerics_x0040_115:http://schemas.datacontract.org/2004/07/Microsoft.FSh...

Check if string is serialized in PHP

Hi everyone, I am in the middle of building a cache layer for the Redis DB to my application and I have come to the point where's it's about to take care of arrays. I wonder if there's any good (high performance!) way of controlling an string to be serialized or not with PHP? Thanks a lot! ...

Best way to send floating point numbers from .NET to Java and back

I'm writing a .NET application that will make an RPC call to a Java application (via a message queue). The data sent in both directions will be large arrays of floating-point numbers. What is the best way to serialize them to send them across the wire? I'd like something more compact than text, but architecture-independent as the server ...

Desine time XAML serialization problem in VS2010 Designer

The wired problem is, in VS 2008, everything works fine. In VS2010 while serializing, it is missing the "ReportDimensionElements" so I'm unable to get the values back from the serialized value back from the XAML. It says, "'ReportDimensionElements' is null" am I missing anything silly. Note: I have marked the ReportDimensionElements cla...

Problem converting a byte array into datatable.

Hi, In my aspx page I have a HTML inputfile type which allows user to browse for a spreadsheet.Once the user choses the file to upload I want to read the content of the spreadsheet and store the content into mysql database table. I am using the following code to read the content of the uploaded file and convert it into a datatable in o...

I get an exception during deserialization

I get this message when running the code below: There is an error in XML document (6, 22). namespace N1 { public class InputEntry { //FieldName is a class tht is generated from an XSD which has complex type Name and value private Field fields; public Field[] Fields { get { return ...

DataContractJsonSerializer generating Ghost string to JSON keys?

DataContractJsonSerializer this is nice class added in the .net framework which can be used to serialize/desirealize object into JSON. Now following is the example i am trying [Serializable] class User { public string name; public string userId; } Now following is the output generated Output : Notice structure where only "name"...

How to cache *any* object type to memory/disk in java?

Is there a generic way to cache any type of object (be in a java class, or a word document etc.) to memory or disk? Is simply serializing the object, and retaining the file extension (if it has one) enough to rebuild the object? ...

unserialize problem in php

hi i'm using serialize/unserialize functions in php 5.2. the text to be stored is POSTed via a form. btw, no white-space before or after. if text contains " or ' it serializes successfully. the problem is it does not unserialize back. what i'm doing wrong? ...

Settings File as Dictionary with Serialization

This is a three part question. One: Would using a Dictionary<String,Object> be a good way of saving data where it would be Dictionary<Key,Value> as the basis? Two: What would be a better way without using app.settings or xml? Three: How would you serialize this(Or the better solution) into a binary format that is compact and se...

Problems with Json Serialize Dictionary<Enum, Int32>

Hi, whenever i try to serialize the dictionary i get the exception: System.ArgumentException: Type 'System.Collections.Generic.Dictionary`2[[Foo.DictionarySerializationTest+TestEnum, Foo, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' ...

Trigger function on deserialization

I have a class with a number of fields which are normally calculated in the constructor from other data in the class. They are not serialized to XML because any changes to the rest of the data will likely require their recalculation. Is there a way I can set up a function call to be triggered on deserialization? ...

Serializing and Deserializing External Assembly in C#

I wrote a plugin system and I want to save/load their properties so that if the program is restarted they can continue working. I use binary serialization. The problem is they can be serialized but not deserialized. During the deserialization "Unable to find assembly" exception is thrown. How can I restore serialized data? ...

Preserving DataRowState when serializing DataSet using DataContractSerializer

For various reasons I am having to send a typed dataset to a WCF service endpoint. This works fine except that upon Deserializing, the RowState of each row in each DataTable is set to 'Added', regardless of what they were on the client. If I write the serialized stream out to a file, I see that the RowState is not part of the Serialized ...

Please provide scenarios/conditions those fail during deserialization when a class & serialized object have same serialVersionUID?

Please provide scenarios/conditions those fail during deserialization when a class & serialized object have same serialVersionUID? I'm looking scenarios like following 1) If a data type of an instance variable is changed then deserialization will fail Could you please provide all such scenarios. I couldn't find such scenarios list any...

How can I persist a large Perl object for re-use between runs?

I've got a large XML file, which takes over 40 seconds to parse with XML::Simple. I'd like to be able to cache the resulting parsed object so that on the next run I can just retrieve the parsed object and not reparse the whole file. I've looked at using Data::Dumper but the documentation is a bit lacking on how to store and retrieve it...

java serialization and final fields

I have an class defining an immutable value type that I now need to serialize. The immutability comes from the final fields which are set in the constructor. I've tried serializing, and it works (surprisingly?) - but I've no idea how. Here's an example of the class public class MyValueType implements Serializable { private final in...

Can I swap WCF deserializer from configuration?

I have a problem with WCF deserialization where the client hangs on the response for more than a minute. I'd like to try to swap different deserializers and see if it affects the behavior. Can I swap in/out different serializers (are there any others?) from configuration, and if so can I do that with any binding, or is that out of cont...

Entity Fremework serialization

Hello guys! I was confused with my problem. I'm using Entity Framework and want to save entities on hard disk and then to restore them. I have no problem with Serializing/Deserializing but i get an exception "The object cannot be added to the ObjectStateManager because it already has an EntityKey. Use ObjectContext.Attach to attach an ob...