serialization

Data structure for storing serial port data in firmware

I am sending data from a linux application through serial port to an embedded device. In the current implementation a byte circular buffer is used in the firmware. (Nothing but an array with a read and write pointer) As the bytes come in, it is written to the circular bufffer. Now the PC application appears to be sending the data too f...

Passing a Safearray of custom types from C++ to C#

Hi, how can one use a Safearray to pass an array of custom types (a class containing only properties) from C++ to C#? Is using the VT_RECORD type the right way to do it? I am trying in the following way, but SafeArrayPutElement returns an error when trying to fill the safearray the reference to the array of classes gets to the managed ...

Silverlight C#: XML Serialization: System.InvalidOperationException: <tagname> was not expected

I'm trying to de-serialize an XML Document and when the desserializer encounters a certain tag about halfway down the doc, it gives the error: System.InvalidOperationException <mytagname> was not expected. It has a [System.Xml.Serialization.XmlArrayItemAttribute("MyTagName", typeof(MediaFile))] tag right before it in the class, and...

PHP serialization with non-serializable parts

I have a PHP class that stores database query results, but also contains a PDO object so that the results can be updated/re-inserted/etc on the fly. A makeshift ORM, if you will. Problem is, I need to serialize this class but instances of PDO cannot be serialized. I'm ok with that; by the time the object gets serialized, I have no nee...

how do you pass binary messages to/from a javascript web worker?

I'm building a multi-threaded client side javascript application, and I would like to have a background thread pull binary data and pass it to the main thread. I know this can be done in other languages via serialization, but how do I accomplish this in javascript? ...

Will adding a method change the java-calculated serialVersionUid on my class?

Hi All, If I have a class like this: public class Name implements Serializable { private final String firstName; private final String lastName; public Name(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public String getFirstName() { return first...

Problems with class loading during deserialization of type from another assembly

There are two assemblies: 1) Assembly containing serializer. This is a place from where serialization and deserialization starts. 2) Assembly containing serialized types. This is a place which is calling serializer from 1st assembly. The idea of serializer in assembly1 is simple. It has two methods which are used for conversions of objec...

Serialization Exception in compiled dll

I've inherited an ecommerce ASP.NET (c# code behind) web application. We've recently moved servers and it's proving somewhat troublesome. I have very little experience with IIS server configuration and dealing with large projects like this. Most of the problems have now been fixed, but we're experiencing problems with a crucial part, as ...

Can I get ORA-08177 if there's only one connection to the database?

I've been tasked with running the unit tests on a storm backend for oracle so that we can see if the backend is of sufficient quality to use in production. One problem that I'm running into is that I'm getting ORA-08177 (can't serialize access for this transaction) if I connect in serializable mode. The problem goes away when I use rea...

Serializing a DataTable with an IPAddress column

I'm using C# with .NET 3.5. I am using the System.Configuration.ApplicationSettingsBase class to load and save application settings. One of the settings I would like to preserve is an in-memory System.Data.DataTable. The DataTable contains just two columns of type UInt32 and System.Net.IPAddress, respectively. When I call the Save() ...

Can you program Java collections to an interface and use Serializable?

I've gone through and programmed all my domain level logic to interfaces. Now I find that when I want to put data in a bean, the bean doesn't work because the Collection interfaces (Collection, List, Set, etc) do not implement Serializable. Do I need to refactor all my code to use concrete types or is there a better course of action her...

Using Django JSON serializer for object that is not a Model

Is it possible to use Django serializer without a Model? How it is done? Will it work with google-app-engine? I don't use Django framework, but since it is available, I would want to use its resources here and there. Here is the code I tried: from django.core import serializers obj = {'a':42,'q':'meaning of life'} serialised = seri...

How to serialize static data members of a Java class?

When we serialize objects, static members are not serialized, but if we need to do so, is there any way out? ...

InvalidOperationException while SOAP serialization of complex type

Hi guys, I encountered a problem with SOAP serialization and it would be great to find an answer. Here's a very simplified example: public void Test() { StringBuilder sb = new StringBuilder(); StringWriter writer = new StringWriter(sb); SoapReflectionImporter importer = new SoapReflectionImporter(); XmlTypeMapping map =...

Serializing POCO Excluding Class Members

I wish to make a POCO [Serializable] but not any other class members in its class hierarchy tree. I know there is [NonSerialized] which works only for fields, but is there any way to exclude them or choose specific members using [Serializable] on the POCO? ...

Persist WPF Control in *.settings File

Is it possible to persist a WPF Control, or any other non-trivial object to a *.settings file in a .NET application? I figured this would be easy since the *.settings file allows me to specify an atrbitrary type for each individual settings, unfortunately, it does not appear to be functioning for me. What I am trying to do is to persist...

Public getter, protected setter with CodeDOM

Is it possible to generate a property with a public getter and a protected setter with CodeDOM? The goal is to achieve something similar to the following. [Serializable] public class Wrapper { public Wrapper() { } private string _Field; public string Field { get; protected set; } } I have a large COM based API for which I wish t...

Problem with serialization

I have problem with serialization. I want to convert an object into a string and vice versa. I have two utility methods: public static byte[] Serialize(Object o) { MemoryStream ms = new MemoryStream(); BinaryFormatter bf1 = new BinaryFormatter(); bf1.Serialize(ms, o); byte[] buffer = ms.ToArray(); //string retStr = Conver...

.NET Serialization Ordering

Hi, I am trying to serialize some objects using XmlSerializer and inheritance but I am having some problems with ordering the outcome. Below is an example similar to what I have setup: ~ public class SerializableBase { [XmlElement(Order = 1)] public bool Property1 { get; set;} [XmlElement(Order = 3)] public bool Prope...

Serialize Python dictionary to XML

Hi, There is simple JSON serialization module with name "simplejson" which easily serializes Python objects to JSON. I'm looking for similar module which can serialize to XML. Thank you ...