serialization

How to automatically execute a method after deserialization?

Hi, I've got a class Foo, it's Serializable. It represents a graphical object, and I want it to restore its handles to the state before serializing. All data is stored within the object, I just need a method to be called in the right moment. How can I achieve it? Is this possible in Java? (I have my Foos in a List in Bar object, and in...

Passing methods as parameters on a deserialized form with no ClassType.

I'm effectively trying to deserialize a form. One of the objects on the serialized form has a method which takes a series of events as parameters. Now since I don't have the class type of the object when I'm deserializing, I have a method on the object doing the deserialization called AddMethod which is declared like this: procedure T...

Why does Visual Studio use backing fields for WCF Service References?

As many of you will be aware, I can use the DataContract attribute to mark a class for serialization into XML in a WCF service. For example, I can create a DataContract thus: < DataContract() > Public Class fooClass < Datamember() > Public fooString as String End Class When I add a service reference to the code that wi...

Saving form state after a page refresh

I have a list of checkboxes. If the page is refreshed before the user submits the form, I want the state of the checkboxes (checked or not checked) to be preserved. Ie: user selects option 1, option 4 and option 5. The page refreshes and option 1, option 4 and option 5 remain checked. I have looked into serialising then storing a cook...

C# - Serializing and Deserializing Linq Tables whilst maintaining Relationships

Hi All, I want to Test my code! A noble goal I'm sure you agree. I need to mock out DataContexts for my Regression tests, running the test will verify that for any code change, given the same input we produce the same output. I'm using Moles to mock out my data contexts. It's awesome and simple, I recommend it, I might move to Moq if ...

Should data classes which are passed by a webservice be attributes with [Serializable]

Hey guys, I want to transfer some data classes via Webservice: public class MyClass { public int Int { get; set; } public MyClass(int v) { Int = v; } private MyClass() { } } public enum MyEnum { One = 7, Two = 13, Three = 15 } public class TestDataClass { private int _someInt; ...

Scheme: Data serializing, efficient [and functional]

I'm serializing data which may be an integer, an object (list) with other nested objects, and trying to make a choice as to what approach to be using. Of two, the first one is to create bytevectors recursively and copy them in the calling functions to a larger single bytevector; the second one is to use some kind of the stream I could wr...

Can I prevent a specific datamember from being deserialized?

I have a datacontract like this [DataContract] class MyDC { [DataMember] public string DM1; [DataMember] public string DM2; [DataMember] public string DM3; } and sometimes I want to prevent DM2 from being deserialized when being returned from an OperationContract. Something like this: [OperationContact] pu...

IPC: WM_COPYDATA + serialization/deserialization

Hello, I am currently working on 2 .NET apps which must communicate with each other. Simple Windows Messaging was chosen and this works nicely at the moment. The data that is sent in the messages is a simple string, but now I have created a message class which contains a command (enum) and a data (string) member, and later possible othe...

WCF Serialization

I have a class like so [DataContract] public MyClass { private string _Name; private bool _NameIsModified = false; public string Name; { get { return _Name; } set { _Name = value; _NameIsModified = true; } } } When a clients requests this class via a WCF service modifies the objects and sends it...

how send a class Instance to web service?

I want to send a class instance to my Web Service(ASP.NET - C#). How can I do? ...

passing a data structure from java to perl (and vice versa)

Hi, A few days ago I asked about passing a data structure from java to perl and vice versa, and one of the recos was JSON. I played with it (mainly using Gson for java) and it seems quite nice. The only problem is I have references inside my data structure (to other objects inside the same data structure). Currently, each such reference...

c# deserialize xml with a specified 'encoding' and 'stylesheet' lines

Hello, I am creating an XML file using the System.Xml.Serialization module. I have a class that gets serialized into an XML file. The file looks like this: <itemList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt; <itemListed> <item ID="81288" Synopsys="Reset search point" Co...

Does a Buffered ObjectInputStream exist?

I am deserializing an object from a file that is 350KB in size, and its taking rather a long time. My computer science TA told me that there is a way to use a Buffered reader along with the ObjectInputStream to greatly increase performance. I however can not find anything about this on Google. ...

Memory Leak with NSMutableDictionary

Confused to why this line of code is causing a memory leak: NSPropertyListFormat format; NSMutableDictionary *d = [NSPropertyListSerialization propertyListWithData:rawCourseArray options:NSPropertyListMutableContainers format:&format error:NULL]; Any suggestions on a fix is much appreciated! Regards, B ...

How to send class over TCP connection?

I am trying to send a class over a TCP connection using java. When the client receives the class it should invoke the methods of that class and return the result to the server. I have serialized the class to a byte array to send to the client, but I don't know with it once the client receives it. Thank you. ...

Write Serialized XML String to XML File

I have a decrypted XML string which was sent over the wire to the receiving box where my code resides. Now, I want to write this XML string to an XML file. Here's the Decrypt method which my code calls to generate this XML string... maybe this needs to be changed? [Update]: My problem is that I can't see a way to write/create an XML f...

Serializing A Custom BindableDictionary<TKey,TValue> ?

Question How would I go about serializing this custom BindableDictionary given that it implements IDictionary and IBindingList? BindableDictionary public class BindableDictionary<TKey, TValue> : IDictionary<TKey, TValue>, IBindingList { private Dictionary<TKey, TValue> source = new Dictionary<TKey, TValue>(); ...

JSF backing bean should be serializable?

I'm getting these messages: [#|2010-07-30T11:28:32.723+0000|WARNING|glassfish3.0.1|javax.faces|_ThreadID=37;_ThreadName=Thread-1;|Setting non-serializable attribute value into ViewMap: (key: MyBackingBean, value class: foo.bar.org.jsf.MyBackingBean)|#] Do these mean that my JSF backing beans should implement Serializable? ...

Controlling order of serialization in C#

I'm using an XmlSerializer to serialize an object and write it to a file. I've had quite a bit of success with the serializer doing what I want it to do in terms of nesting elements and what is serialized as elements vs attributes. Unfortunately, I've run into a problem where I need one member of a class to serialize before another. E...