serialization

How to avoid ClassCastException in JMX calls with complex arguments on Websphere appserver

We are using JMX for communication between different EARs on the same Websphere application server (6.1). All works well if we only use Java types as arguments, but if we use our own classes as arguments the problem is that we get ClassCastExceptions on the receiver side. This is obviously a classloader problem: if the jar with the argum...

Restrict Serializing Entire Object Graph When Calling WCF Service to Update a EntityObject

We have a WCF service that uses Entity Framework to query a SQL database. The WCF service is our data access layer. If any of our applications what to read/write data to and from the database, we call a method on the WCF service. The WCF service serializes the EntityObjects to the client apps. In the client app (e.g. WPF app or ASP.NET ...

Clipboard Debugging

In the olden times of .NET 1.1, I could use the SoapFormatter to find out exactly what was getting serialized when I copied an object into the clipboard. Fast forward to 2010, and I tried to do the same trick. It turns out the SoapFormatter does not support generics. Is there an alternative way to find out exactly what binary objects ...

WCF: Serializing and Deserializing generic collections

I have a class Team that holds a generic list: [DataContract(Name = "TeamDTO", IsReference = true)] public class Team { [DataMember] private IList<Person> members = new List<Person>(); public Team() { Init(); } private void Init() { members = new List<Person>(); } [System.Runtime.Se...

python: send a list/dict over network

Hi, everyone I'm looking for an easy way of packing/unpacking data structures for sending over the network: on client just before sending: a = ((1,2),(11,22,),(111,222)) message = pack(a) and then on server: a = unpack(message) Is there a library that could do pack/unpack magic? Thanks in advance ...

Serialization for memcached

I have this huge domain object(say parent) which contains other domain objects. It takes a lot of time to "create" this parent object by querying a DB (OK we are optimizing the DB). So we decided to cache it using memcached (with northscale to be specific) So I have gone through my code and marked all the classes (I think) as [Serializa...

How to convert a non serializable object to byte array?

I'm trying to use javax.crypto.Cipher.doFinal(byte[]) method to encrypt an object. But, for security reasons, the object cannot be serializable. So, how to convert the object to byte array without serialization? --update is using serialization the only way to use this Cipher method? Because as I know important data should not be serial...

boost::serialization of mutual pointers

First, please take a look at these code: class Key; class Door; class Key { public: int id; Door *pDoor; Key() : id(0), pDoor(NULL) {} private: friend class boost::serialization::access; template <typename A> void serialize(A &ar, const unsigned int ver) { ar & BOOST_SERIALIZATION_NVP(id) & BOOST...

Why do I have to unserialize this serialized value twice? (wordpress/bbpress maybe_serialize)

What am I doing wrong here? I'm serializing a value, storing it in a database (table bb_meta), retrieving it... OK so far... but then I have to unserialize it twice. Shouldn't I be able to just unserialize once? This seems to work, but I'm wondering what point about serialization I'm missing here. //check database to see if user has eve...

When I renamed a class I am getting a deserialization error. How to fix it?

I renamed the class classBattle to Game and not I get "Unable to load type battle.classBattle+udtCartesian required for deserialization." This is the line of code MapSize = (Game.udtCartesian)formatter.Deserialize(fs); How do I fix this? Does this mean I cannot rename classes? ...

Serialization with Qt

I am programming a GUI with Qt. In my GUI I have a huge std::map. And "MyType" is a class that has different kinds of filds. So, in a word, I want to serialize the std::map. How can I do that? Does Qt provides us with neccesary features? ...

Deserialize generic collections - coming up empty

I've got a settings object for my app that has two collections in it. The collections are simple List generics that contain a collection of property bags. When I serialize it, everything is saved with no problem: XmlSerializer x = new XmlSerializer(settings.GetType()); TextWriter tw = new StreamWriter(@"c:\temp\settings.cpt"); x.Seriali...

Persisting a trie to a file - C

I have a trie which I am using to do some string processing. I have a simple compiler which generates trie from some data. Once generated, my trie won't change at run time. I am looking for an approach where I can persist the trie in a file and load it effectively. I have looked at sqllite to understand how they are persisting b-treebu...

Not-quite-JSON string deserialization in Python

I get the following text as a string from an XML-based REST API 'd':4 'ca':5 'sen':1 'diann':2,6,8 'feinstein':3,7,9 that I'm looking to deserialize into a pretty little Python dictionary: { 'd': [4], 'ca': [5], 'sen': [1], 'diann': [2, 6, 8], 'feinstein': [3, 7, 9] } I'm hoping to avoid using regular expression...

Json Jackson deserialization without inner classes

Hi everyone, I have a question concerning Json deserialization using Jackson. I would like to deserialize a Json file using a class like this one: (taken from http://wiki.fasterxml.com/JacksonInFiveMinutes) public class User { public enum Gender { MALE, FEMALE }; public static class Name { private String _first, _last; ...

What is the best way to deserialize generics written with a different version of a signed assembly?

In other cases it has been suggested that you simply add a SerializationBinder which removes the version from the assembly type. However, when using generic collections of a type found in a signed assembly, that type is strictly versioned based on its assembly. Here is what I've found works. internal class WeaklyNamedAppDomainAssembl...

Why can't I expose an interface in a .NET asmx web service?

I have a .NET web service (using asmx...have not upgraded to WCF yet) that exposes the following: public class WidgetVersion1 : IWidget {} public class WidgetVersion2 : IWidget {} When I attempt to bind to the web service, I get the following serialization error: Cannot serialize member WidgetVersion1 of type IWidget because it is an...

Is my objective possible using WCF (and is it the right way to do things?)

I'm writing some software that modifies a Windows Server's configuration (things like MS-DNS, IIS, parts of the filesystem). My design has a server process that builds an in-memory object graph of the server configuration state and a client which requests this object graph. The server would then serialize the graph, send it to the client...

Qt - serialize/deserialaize text plus picture

I want to use a field (kind of QTextEdit), which is capabale of storing picture and text (like MS Word is doing) and it serializes and deserialaizes picture+text data. Is there any Qt Widget that allows us to manipulate with picture and text simultaniously and it has set/get functions which operate with serializable type? In othger word...

Serialize the @property methods in a Python class.

Is there a way to have any @property definitions passed through to a json serializer when serializing a Django model class? example: class FooBar(object.Model) name = models.CharField(...) @property def foo(self): return "My name is %s" %self.name Want to serialize to: [{ 'name' : 'Test User', 'foo' : 'My name is Test User',...