serialization

How do I create an instance of value from the attribute's meta object with Moose?

I'm working on a serialization tool using Moose to read and write a file that conforms to a nonstandard format. Right now, I determine how to load the next item based on the default values for the objects in the class, but that has its own drawbacks. Instead, I'd like to be able to use information in the attribute meta-class to generat...

How to Serialize an Object Containing a System.Threading.Thread?

System.Runtime.Serialization.SerializationException: Type 'System.Threading.Thread' in Assembly 'mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable. Is there a way around that? ive added the Serializable attribute to all of my class's, but i cant add attributes to things like tha...

Save struct into a file In C#

I want to save a struct of data in a file in C#, but I don't want to use serialize and deserialize to implement it. I want implement this action like I implement it in the C and C++ languages. ...

.NET Serialization and Caching question

Say I have Object A which has a member of type Object B.. and Object B has a member of type Object C. Object A VERY RARELY changes but is read very frequently, whereas Object C frequently does. It makes sense to cache Object A, but when it's serialized to go in the cache obviously is serialized the whole graph. Scenario: Object A is re...

Why It is not possible to serialize PHP built-in objects ?

I have tried to unserialize a PHP Object. Warning: unserialize() [function.unserialize]: Node no longer exists in /var/www/app.php on line 42 But why was that happen? Even if I found a solution to unserialize simplexml objects, its good to know why php cant unserialize objects? To serialize simplexml object i use this function func...

What is the proper way to prepare XML data for serialization/deserialization.

<?xml version="1.0" encoding="utf-8" ?> <Hero> <Legion> <Andromeda> <SpellOne> <Name>Comet</Name> <Icon>Images/Spell/Andromeda/Spell1.gif</Icon> <Action>Target Unit</Action> <Description>Andromeda rips a comet from her dimension to hurl at an enemy, damaging and stunning them.</Description>...

When serializing/deserializing XML data, do the XML elements and the class attributes have the same name?

For example: Here's a simple class. class Hero { public string faction; public string name; public HeroType herotype; } And here's the XML counterpart. <Hero> <android> <Faction>evil</Faction> <nombre>android</nombre> </android> </Hero> Do the attributes have to be exactly the same in order to s...

Strategy for cross-language (java and c#) object serialization

I'm working on a project where I'll need to serialize some data in a java 6 app and deserialize it a c# 2.0 app. Is there a strategy or something already in existence I can look at that would allow me to do this with these two languages? I'm guessing they both support XML serialization but I really need it to be binary serialized. ...

Json and Circular Reference Exception

I have an object which has a circular reference to another object. Given the relationship between these objects this is the right design. To Illustrate Machine => Customer => Machine As is expected I run into an issue when I try to use Json to serialize a machine or customer object. What I am unsure of is how to resolve this issue as...

Speeding up cross-AppDomain communication

I am trying to execute some logic on multiple AppDomains in parallel. I am doing this because I am working with legacy code which is "un-changeable" and I want to improve performance by parallelizing some things. The problem is that if I run multiple instances within 1 AppDomain they all rely on some static data structures and interfer...

Can I use JDO to serialize entities into byte[] ?

In Google App Engine, I can use JDO to persist Java objects into the data store. Can I also use JDO to turn the object into a byte[], so that I can put it into memcache or send it over HTTP? Clarification: I want to serialize classes that I have already annotated for JDO persistence. Having to use another serialization mechanism seems t...

JSON Serialization/Deserialization mismatch (ASP.Net)

Hi, When I call a PageMethod in my page, the serialized object looks like: {"d":{"__type":"MyAsembly.MyNamespace.Person","Name":"ulu","Age":40}} This is ok for Javascript, but my .Net deserializer won't understand it: var result= new JavaScriptSerializer(new SimpleTypeResolver()).Deserialize<Person>(source); throws System.InvalidOpe...

C# Xml serialization - disable rendering root element of array

hi, can i someway disable rendering of root element of collection? this class with serialization attibutes [XmlRoot(ElementName="SHOPITEM", Namespace="")] public class ShopItem { [XmlElement("PRODUCTNAME")] public string ProductName { get; set; } [XmlArrayItem("VARIANT")] public List<Sho...

Serialize objects containing objects java

I try to serialize an object that contains an other object which is itself serializable. Is there a way to make it work ? The pointer to the other object seems to be lost when I serialize the first object. ...

PHP Storing Sessions: Can't Seem to Serialize Session Variables

Hello all, I am making use of seralize and unseralize to set and get session variables from my Database. A user is in a session and every time they click save. I do this: $array = serialize($_SESSION); //and save to DB field When a user loads a session, I load the variables too to continue that session like so: //get row from DB $_...

Sending a serialized object from Android to a servlet using HTTP client

Hey guys I have tried to create a android application that sends a serialzed object from the phone to a servlet the contents of the object is the input from the user which i will store in a database using hibernate. I believe the problem is around the serializing and deserializing of the object the code is below. If anyone could help i ...

Serialize and Deserialize Date between ASP.Net MVC and ExtJS

I've been searching through the web to look for a solution for this but still stuck. I'm having difficulties serializing DateTime object. The standard serialize using DataContract will give this result \/Date(1262600239000)\/. After Ext.encode the result changed to /Date(1262600239000)/. The result from Ext.encode is not readable in Ext...

XOR on streams, reading and writing

My recent turn-on is using BinaryFormatter instead of some database product. I have an idea to write simple 64bit number into hardware dongle, and encrypt my files with it - via simple XOR operation. Just so it can't be readable at some other end. Do I derive from Stream, or what? I know I can simply put that number into the file and...

C# : manually reading XML config for derived classes

Suppose I have class CarResource, class RaceCarResource : public CarResource, and class SuperDuperUltraRaceCarResource : public RaceCarResource. I want to be able to load their data using a single method LoadFromXML. How would I go about getting the CarResource:LoadFromXML to load it's data, RaceCarResource to call CarResource:LoadFrom...

WCF Serialization Problem

I'm switching code generators for my business objects. I was using SQL Metal, but in moving to the T4 toolbox's generator, serialization seems to have stopped working, and it looks like the two are doing pretty much the same thing. This is the property generated by SQL Metal (which works): [Association(Name="FK_FamilyConfiguration_Fam...