serialization

How to marshal an object and its content (also objects)

I have a question for which I suspect the answer is a bit complex. At this moment I am programming a DLL (class library) in C#. This DLL uses a 3rd party library and therefore deals with 3rd party objects of which I do not have the source code. Now I am planning to create another DLL, which is going to be used in a later stadium in my ap...

Estimate serialization size of objects?

In my thesis, I woud like to enhance messaging in a cluster. It's important to log runtime information about how big a message is (should I prefer processing local or remote). I could just find frameworks about estimating the object memory size based on java instrumentation. I've tested classmexer, which didn't come close to the serial...

How to "serialize" and "deserialize" command line arguments to/from string?

I call my script: $ ./script 'a!#*`*& ^$' "sdf sdf\"qw sdsdf" 1 -- 2 3 It gets arguments: 1: a!#*`*& ^$ 2: sdf sdf"qw sdsdf 3: 1 4: -- 5: 2 6: 3 If I need to call something with the same arguments locally, I do this: someprogram "$@" But how can I put all that array to a string (to store in file or in environment variable or pas...

C# enums/reflection

Let's say I have a function that takes a string. That string contains the fully name of an enum type (e.g. "MyCompany.Area.AotherNamespace.MyEnum"). How could I create an array of strings (or List<string>) whose elements are the values of MyCompany.Area.AotherNamespace.MyEnum? Is that even possible? I'm basically trying to serialize a...

reading an objective C encoded object into a java class

I am writing a client server iPhone app. The server is J2EE based. I need to communicate the state of my client object (objective C) to the server. It is possible (and feasible) to say encode the objective C object, send the bytes to the J2EE server through a socket and create a Java object out of this stream. If so, can you kindly poin...

Save NSmutableArray to file and load

hello all , i am written app for my iphone and i want to save some NSmutablearray to file and load it later. i read about NSArchiver but didnt understand how to work with my calss is : @interface Shop : NSObject { NSString *m_Name; NSString *m_Description; NSString *m_Category; NSString *m...

Java. Serialization of objects in a multithreaded environment.

I have an object whose internal mutable state is being constantly updated by one or more threads. The object is synchronized, and the goal is to periodically save its state (via serialization) from yet another thread: public class Counter implements Serializable { private int dogCount; private int catCount; public synchron...

Java. Safe ways to serialize collections of highly volatile objects?

This is a followup question to: http://stackoverflow.com/questions/3077703/java-serialization-of-objects-in-a-multithreaded-environment. Suppose I have a collection of objects that are always acted upon by multiple threads. public class AlwaysChanging implements Serializable { // ... state ... public synchronized void updateFr...

serialize object with subitems c#

Hi I have this code: var store = GetStore(); using (IsolatedStorageFileStream fileStream = store.OpenFile(RootData, FileMode.Create)) { DataContractSerializer serializer = new DataContractSerializer(typeof(List<Root>)); serializer.WriteObject(fileStream, rootdatalist); } But this only serializes the rootdatalist, and not the s...

Adding KnownType attribute causes unknown error.

I'm using DataContract/DataMembers to serialise my class to JSON for a webservice, and it all works fine, except for one of my members, which could either be class a, or class b, where class b extends class a. If I omit the KnownType parameter, then an exception is thrown during serialisation: Type 'ClassB' with data contract name 'Cla...

get object from a method in as3

Hi, Is there a way to know from which object a method (a Function object) came from? tx ...

How to protect application pools from session serialization exceptions?

We're using an Out-of-Process Session Provider (ScaleOut) for an ASP.NET application and we've noticed that when an object that's not correctly setup for de-serialization inadvertently makes its way into session it will eventually cause the entire process to terminate. Reproducing and handling this scenario is where it gets even more i...

Make clos objects printable in lisp

If you want to make CLOS objects in common lisp printable (print readably), how do you go about doing this without using anything but print and read. ...

Would it be crazy to use a (serialized) array instead of a join table to link two database tables?

I'm using Ruby on Rails to develop a web application. I have a wiki article system as part of my project. As part of the wiki, articles can be linked to authors, and those links also need to be tracked by the revision system. Authors is an attribute of the Article as a whole, and not related to who enters particular Revision, and is a ...

Serializable vs Data Contract vs Noting at all in a WCF Service

I will use the Starter Example given when you create a WCF Service [DataContract] public class CompositeType { bool boolValue = true; string stringValue = "Hello "; [DataMember] public bool BoolValue { get { return boolValue; } set { boolValue = value; } } [DataMember] public string St...

Silverlight Object Binary Serialization to Database

Right now I am programming a multiplayer card game in Silverlight I am wondering how to store a object best binary in a sql database. I have a GameState Object which contains the current state of a game between two players. I want to store this object in a sql database that both player can access and change it anytime. How would you d...

Why does the DataContractSerializer bypass initializers?

Why does the DataContractSerializer bypass initializers? Background: The serialization formatter gets uninitialized instances of classes during deserialization. That is, instances where all fields are set to their default values. For reference types this will be null. That is why "authors" in this case causes a null reference except...

Best method for serializing objects in .NET (as of v4.0)

I have an simple custom object called MyObject (a couple of basic properties and a List(of MyObject), so it's recursive) that I need to serialize for storage. I'm not sure if I'll serialize to XML or Binary yet, but I want to make sure I'm using the most up-to-date methods for doing it, as there are a few different namespaces involved an...

IDeserializationCallback in XMLSrializer...

Is there a way to utilize the IDeserializationCallback interface with the standard xmlSerializer? It does not appear to be supported in this context. IDeserializationCallback works fine when used with the binary formatters. Basicaly i want to do some calculation when de-serialization e.g.: public void IDeserializationCallback.OnDeser...

Deserializing a MemoryStream - unexpected behaviour

Hey all, At the moment I am experiencing a very frustrating problem. I will try to abstract the problem to make it a bit easier. It has to with serializing my custom object to a database in one process and deserializing it in another process. I have two assemlies; AppToDB.dll and AppFromDB.dll. I have a 3rd assembly - MyCustomObject.d...