serialization

How can I unserialize session data to an arbitrary variable in PHP?

I want to unserialize a session_encode()'d string of session data to my own array (i.e. not to $_SESSION.) There doesn't appear to be an in-built function that handles this. There's session_decode() but it writes directly to the $_SESSION super-global. There's unserialize() but it returns false on session_encode()'d strings as they're...

Extracting subset of DataSet by pulling rows, following relationships

Is there a relatively easy way to extract a relationship-consistent subset of a DataSet? The subset I want is: the rows I'm interested in, all the child and parent rows required by those rows, and nothing else. I have around a dozen tables, each with two to four relationships to other tables. I figure I could write code to traverse ...

How to use XmlSerializer to deserialize into an existing instance?

Is it somehow possible to use the XmlSerializer to deserialize its data into an existing instance of a class rather than into a new one? This would be helpful in two cases: Easily merge two XML files into one object instance. Let object constructer itself be the one who is loading its data from the XML file. If the is not possible b...

Serialization of struct objects by webservices

Hi, I have 'extended' the System.DateTime struct by adding some essential fields to it. Ideally I'd like to be able to deliver this object via a webservice to a winforms client. I've marked the stuct type as [Serializable] and it also implments ISerializable, however if I inspect the XML being delivered by the webservice it simply con...

Optimal Serialization of Primitive Types

We are beginning to roll out more and more WAN deployments of our product (.Net fat client w/ IIS hosted Remoting backend). Because of this we are trying to reduce the size of the data on the wire. We have overridden the default serialization by implementing ISerializable (similar to this), we are seeing anywhere from 12% to 50% gain...

Limiting the data returned by a controller

I need advice on how to return a limited set of data from an MVC controller. Lets say I have a class that is constructed like so: public interface ICustomerExpose { string Name {get; set;} string State {get; set;} } public interface ICustomer: ICustomerExpose { int Id {get; set;} string SSN {get; set;} } public class Cust...

WCF Recommend approaches for serializing multiple objects

I am attempting to optimise around a possible bottleneck. I have a server application that is serving objects from a database to applications remotely, who can work with 1 - n objects of 1 - n different types (where n can be a relatively high number) that all implement a common interface but may contain many unique properties on differe...

Is it possible to programmatically construct a Python stack frame and start execution at an arbitrary point in the code?

Is it possible to programmatically construct a stack (one or more stack frames) in CPython and start execution at an arbitrary code point? Imagine the following scenario: You have a workflow engine where workflows can be scripted in Python with some constructs (e.g. branching, waiting/joining) that are calls to the workflow engine. A ...

PHP unserialize problem

How come unserialize isn't restoring my array? See code below.. // prints a:1:{s:8:"txn_type";s:32:"recurring_payment_profile_cancel";} echo $item['response']; // prints nothing print_r(unserialize($item['response'])); I understand why the print_r($response) gives me nothing ** edit - I noticed this Notice: unserialize() [functio...

Fast and compact object serialization in .NET

Hi folks! I want to use object serialization to communicate over the network between a mono server and Silverlight clients. It is pretty important that serialization is space efficient and pretty fast, as the server is going to host multiple real time games. Any suggestions on what technique I should use? The BinaryFormatter adds a l...

Illegal characters in XML document in ASP.NET Web Service

I'm going to ask and answer my own question, I hope nobody minds but I thought this might be useful to other people. If you setup a ASP.NET Web Service that returns objects that contain characters that are invalid for XML an exception will be thrown after the object is serialized in to SOAP xml and the client attempts to deserialize tha...

Serializing an array of integers using XmlSerializer

I'm encountering a problem while trying to serialize a multi-dimensioned array of integers via XmlSerializer for an XNA project I'm working on. I'm able to serialize all of my other data (booleans, strings, even Colors, etc) without a hitch. I've also seen plenty of people claim that XmlSerializer will natively handle (single-dimension...

C++ serialization of complex data using Boost

Hi, I have a set of classes I wish to serialize the data from. There is a lot of data though, (we're talking a std::map with up to a million or more class instances). Not wishing to optimize my code too early, I thought I'd try a simple and clean XML implementation, so I used tinyXML to save the data out to XML, but it was just far to...

Python list serialization - fastest method

Hello, I need to load (de-serialize) a pre-computed list of integers from a file in a Python script (into a Python list). The list is large (upto millions of items), and I can choose the format I store it in, as long as loading is fastest. Which is the fastest method, and why? Using import on a .py file that just contains the list as...

WCF: DataMember attribute on property vs. member

In wcf, what is the difference between applying the DataMember attribute on a property private int m_SomeValue; [DataMember] public int SomeValue { get {...} set {...} } instead of a member variable [DataMember] private int m_SomeValue; public int SomeValue { get {...} set {...} } ? ...

Saving an ArrayList of custom objects to user settings

Is it possible to save an ArrayList of custom objects to the application user settings without resorting to custom serialization? For example, given a basic data class containing only public get/set properties and private backing fields: [Serializable] class SimpleClass() { ... } When I run the following in code, and then rest...

What are the advantages and disadvantes of yaml vs xml for Object graph de/serialization?

The use case is long term serialization of complex object graphs in a textual format. ...

What Class for Serializable Multidimensional Arrays?

EDIT: See Below I have a web service which uses a class of functions in order to return data used in various business processes (via InfoPath). One of the functions takes a given SQLCommand object and executes it into a SQLDataReader. Now depending on the SQL command text used this may return one or many rows of one or many columns....

using WCF with legacy complex types

I'm writing a WCF service to replace a current web service, and I'm having trouble with one of the legacy complex types that I need to return. Unfortunately I can't touch any of the code but looking at them all the classes are Serializable and the current web service is using it with no problem. Whenever my client calls the WCF service...

Developing a (file) exchange format for java

I want to come up with a binary format for passing data between application instances in a form of POFs (Plain Old Files ;)). Prerequisites: should be cross-platform information to be persisted includes a single POJO & arbitrary byte[]s (files actually, the POJO stores it's names in a String[]) only sequential access is required shoul...