serialization

Java serialization, ObjectInputStream.readObject(), check if will block

I'm using an ObjectInputStream to call readObject for reading in serialized Objects. I would like to avoid having this method block, so I'm looking to use something like Inputstream.available(). InputStream.available() will tell you there are bytes available and that read() will not block. Is there an equivalent method for seriailzation...

Saving WPF content to an aribitary format

WPF has a framewok for serializing WPF to an arbitary format (such as html, rtf, xps) where 3rd parties can plug in. Has anyone ever seen (or written) any serializer except the XPS one that comes with the framework that we can use? ...

BinaryFormatter picking up events

I have a storage class that has events on adding items to it. My form class handles the event. When I try to serialize it, formatter complains about form class not marked as serializable. Of course, I don't want to serialize it, however, i can't mark event as [NonSerialize] since it is not field... What to do? EDIT: Aditional info: ...

storing an array in a file in java

Hello, I plan to store an array of numbers in a file and read it when needed. What would be a good way to do this? I can think of afew ways such as storing each element in a line as a text file or serialize it and store / call by that method. Speed is my first concern. Thanks ...

How do I serialise a List<T> to XML using LINQ to XML?

I've this generic list List<zil> listKD = new List<zil> { new zil{day="Mon",c="1",S1="08:00",S2="08:40",S3="08:47"}, new zil{day="Mon",c="2",S1="08:50",S2="09:30",S3="09:37"}, new zil{day="Mon",c="3",S1="09:40",S2="10:20",S3="10:27"}, new zil{day="Mon",c="4",S1="10:30",S2="1...

How can I cause fields to be serialized to disk, but not deep-cloned?

Suppose I have an application with the following code: public class Node { public Node Clone() {//implementation} public List<Node> Children{get;set;} //Many properties public string Content { get; set; } // ... etc ... } I use serialization in two different scenarios: Saving my objects to the disk, and Performing deep c...

How to implement xml serialization for custom types?

I have some types that I want to serialize/deserialize and generate a UI based on the selected object. The UI will also change the object which in turn I will have to serialize to store it in my app. So: [obj_apple stored in the app] -> select obj_apple -> deserialize -> show in UI -> use the UI to change obj_apple -> deselect obj_appl...

PHP: POST data + apostrophes

Imagine this: Form data contains an apostrophe Form gets submitted POST data gets serialized POST data is written to database Database data is retrieved Data cannot be unserialized The problem is found in the serialized data. I tried without and with an apostrophe: s:7:"company";s:12:"Joes company" s:7:"company"...

Java: Serializing String[] Array to store in a MySQL Database?

Yes, I know it's bad practice and I should instead normalize my tables. That put aside, is it possible to serialize a String [] array and store it in the database? I am from the lenient and forgiving world of PHP, where invoking the serialize() function and would convert the array into a string. Is there an equivalent of doing such her...

Monitoring Changes of a Bean to build deltas?

Hi StackOverflow! I have several Beans in my Application which getting updated regularly by the usual setter methods. I want to synchronize these beans with a remote application which has the same bean classes. In my case, bandwidth matters, so i have to keep the amount of transferred bytes as low as possible. My idea was to create delt...

Rails' ActiveRecord serialize :attr method gives "Missing Class or module error"

Hi there, I'm trying to serialize a simple attribute in an ActiveRecord model, and Rails 2.3.4 doesn't like it. class Shopper serialize :tags end >> a = Shopper.new => <#Shopper...> >>a.tags = ['aoeu','stnh'] => ['aoeu','snth'] >> a.save => TypeError: class or module required anyone know what I'm missing? ...

How can I extend a lexical cast to support enumerated types?

I have the following function that will convert a string into a numeric data type: template <typename T> bool ConvertString(const std::string& theString, T& theResult) { std::istringstream iss(theString); return !(iss >> theResult).fail(); } This does not work for enumerated types, however, so I have done something like this: ...

How to serialize only selected properties when using web services in ASP.NET application

In most cases we are using ASP.NET web services (System.Web.Script.Services.ScriptService) in our AJAX based web applications. This approach brings a major advantage providing automatically all the server-side classes (used in the web service methods) on client side in form of JavaScript alternatives (javascript classes with appropriate ...

Convert a 'css' or 'json' style string into a Hash/Dictionary or Kvp<T,T> ?

Does anyone know if there is a way to convert the following string into an object? "width: 100px; height: 20px; border: solid 1px black;" As you notice, this is a standard CSS property. I know it would be fairly trivial to split on ';' and do the work myself, but looking at some other languages it seems they have native support to do...

Is there an attribute to turn off serialisation for fields in a custom object (DataContractJsonSerializer)

I am using the DataContractJsonSerializer class to serialise my objects to JSON. Is there an attribute I can use on fields in my custom objects (C#) that will turn off serialisation for that one particular field? ...

Impossible null pointer

Hey, I have a real weird problem. I have 2 classes: (very important note: this is an example cause I can't paste the original code, I wrote it as text with no compiler) class B { private int num = 9; public int getNum(){ return num; } public void setNum(int num){ this.num = num; } } class A { pri...

XML serialization array

I have a custom XML (Vendor specific) which I need to serialize and deserialize. The format of the XML is as follows <RootElement> <childelement> <id/> <description/> </childelement> <childelement> <id/> <description/> </childelement> </RootElement> Root element is ...

Best way to save the state of controls of Winform forms?

If your app has 1 form, that has n group boxes each of which contain any number of controls. How would you save the settings of all these controls? A few things I am concerned are: I don't need properties like BackColor to be saved, because they aren't changed by the user. I need a way so that when I add new properties or remove some ...

C# Binary Serialization

Hi all, I am trying to serialize and deserialize objects to/from a Byte array for network communication, I currently have an interface 'ISerialize'. However I got thinking there should be a more robust way to do this via reflection. I've looked around a little bit at doing this using BinaryFormater, but I can't see if it will give me t...

.NET Hosted workflow clustering problem

I am attempting to reproduce a server farm in my test environment, in order to try something out for an application that I am busy designing. I have two web servers, running IIS 6.0 and 7.0 respectively, each hosting a workflow service with exactly the same dlls. They share a persistence database. When ServerA saves the workflow to the...