In below code i am writing file contents in backup serialize file through boost serialization library, but what i observed that every time i need to store all the data in file then only i would be able to read the entire data. so in case if i perform single write operation and just try to get the store data in backup file then not able to read anything stored in backup file as it looks like old contents were not present in the file . After executing entire code i am able to read the serialize map from file …

Member Avatar
Member Avatar
+0 forum 2

Is there are an easier way of serializing a vector attribute of an object in c++ using sqlite3?

Member Avatar
Member Avatar
+0 forum 2

I can serialize an object if it's class definition has attributes. So if I have an object whose class does not have attributes, do I serialize the attributes importedi in it's class definition? For example; suppose I have the following class, #ifndef BREAD_H #define BREAD_H #include "EGGS.h"; #include "FLOUR.h"; class BREAD { public: BREAD();~BREAD(); //lame example std::vector<string> selectIngredient(std::vector<FLOUR>grocery); }; #endif How would I go about serializing attributes defined in the FLOUR.h class if incase I have to? Thanks in advance.

Member Avatar
Member Avatar
+0 forum 2

Hi Kind-DaniWebbers, How do you initialise a boost::archive:binary_oarchive in a different place to where you declare it? So: class CBase { std::ofstream m_ofs; boost::archive:binary_oarchive m_binOA(); // <== default constructor virtual void Open(std::string& s) = delete; }; class CDerived : CBase { void Open(std::string& s) override { CBase::m_ofs("filename.bin", std::ios::binary); CBase::m_binOA(CBase::m_ofs, /*flags*/); // <== says error C2660: '...'::m_binOA' : // function does not take 2 arguments } }; I am trying to create different interfaces for XML, TXT and BIN. So I just derive from the one I want. Is this the way to do it? I struggling to design this. Please …

Member Avatar
Member Avatar
+0 forum 1

Hello good afternoon. I have successfully serialized data in the past, however it seems as if I don;t fully understand the process. I have a class called ProgramState which stores a variable (called lastCreated) with custom class LinesProject and an ArrayList variable(called recentProjects) of this custom class. The purpose of these variables is to store the last created project as well as a list of five recently opened projects. Here is ProgramState: public class ProgramState implements Serializable{ private LinesProject lastCreated; private ArrayList<LinesProject> recentProjects; public ProgramState() { lastCreated=new LinesProject(); recentProjects=new ArrayList<LinesProject>(); } public ProgramState(LinesProject proj) { lastCreated=proj; recentProjects=new ArrayList<LinesProject>(); } //Setters …

Member Avatar
Member Avatar
+0 forum 3

I'm trying to send data back and forth between two computers using a Socket (TCP). The data is in the form of serialized Packet objects. At an early point in the application, it must send 25 or so Packets of the same type to the other side. See Case 1 in HandlePacket(). After a few Packets of this type are sent (2 to 5, it's random), the other side crashes with a SerializationException: "Binary stream '0' does not contain a valid BinaryHeader." I've confirmed that I am always reading the same amount of data from the socket that was sent …

Member Avatar
Member Avatar
+0 forum 13

Currently I have something like this: class FileWritter{ ofstream file; public: FileWritter(string filename,A_Class a){//A_Class is class which has defined the >> and the << operators file.open(filename.c_str()); file<<a; } ~FileWritter(){ file.close(); } }; what I want is to have something like this: template <class AbstractClass> class FileWritter{ ofstream file; public: FileWritter(string fileName, AbstractClass ab){ file.open(fileName.c_str()); file<<ab; } ~FileWritter(){ file.close(); } }; in this case, the compiller shows this error: > use of class template requires template argument list my question is how can I use an template class with FileWritter?

Member Avatar
Member Avatar
+0 forum 9

Hi, I have a webservice which needs to be serialized. At the moment I can call the webservice as: Call10.Process("field_a","field_b") and the function looks like this: Public Function Call10(ByVal User As String, ByVal Password As String) As String If User = "user" Then MsgBox("Correct User") End If If Password = "password" Then MsgBox("Correct Password") End If Return "Success" End Function The client wants to be able to call the webservice as: Dim Call10Input as New Call10Input Call10Input.User = "user" Call10Input.Password = "password" Call10.Process(Call10Input) I'm assuming I would have to create Call10Input as a class and then accept Call10Input into the …

Member Avatar
Member Avatar
+0 forum 2

im trying to make my own Serialization library but I have some problems with the following. I have a package wich I serialize to a t_stream and then I need to serialize the t_stream to a char * again. This is the complete code: typedef struct{ int16_t port; int16_t priority; char * ip; char * code; }__attribute__((__packed__)) t_file_package; typedef struct { int8_t packageType; int32_t length; char *data; }__attribute__((__packed__)) t_stream; // t_stream * package_file_serializer(t_file_package *self) { char *data = malloc( strlen(self->ip) + 1 + sizeof(int16_t) + sizeof(int16_t) + strlen(self->code) + 1); t_stream *stream = malloc(sizeof(t_stream)); int32_t offset = 0 , tmp_size …

Member Avatar
Member Avatar
+0 forum 1

I'm using Netbeans 7, JEE project with application client, stateless ejb with remote interface, and JPA entity clasess made from sql script. Interfaces are in separate library project which is referenced in ejb and client project. **And the problem is the remote method that use custom interface object made from entity class cannot be returned. Serialized probably.** Remote methods that use standard types work properly. You can look exceptions at the error code: Exception in thread "AWT-EventQueue-0" javax.ejb.EJBException: java.rmi.RemoteException: CORBA NO_IMPLEMENT 1398079489 Maybe; and this one: Caused by: java.lang.ClassNotFoundException: entity_klase.Varalica (no security manager: RMI class loader disabled) I'm suspecting that …

Member Avatar
+0 forum 0

Hi! Using string, ifstream and ofstream object. Compiling - ok, but give a run-time error after printing Name in ReadData() function. My Person class include only one string member "name" and function "Name()" which return string object "this->name". And constructor with string parameter of course... [CODE]#include <iostream> #include <fstream> #include "Person.h" using namespace std; void ReadData(string path) { ifstream rFile; Person temp; rFile.open(path, ios::in); rFile.read((char*)&temp, sizeof(temp)); cout << temp.Name(); rFile.close(); } void WriteData(string path) { ofstream wFile(path, ios::out); Person man("My Name"); cout << man.Name(); wFile.write((char*)&man, sizeof(man)); wFile.close(); }[/CODE] can someone give a tips for this? Thanks

Member Avatar
Member Avatar
+0 forum 1

Hi all, I'm trying to write a program that holds student data in arraylists. I've managed to get all the adding, editing, deleting, displaying etc. working and now all I need to do is to make sure it saves on exit and loads on startup By following another tutorial, I have managed to get the data saved into a file, but I can't get it to load back in again. I know there is something missing and I'm pretty sure it's obvious, but I'm having a total 'blonde moment' and can't think what it is! Any help is appreciated, if …

Member Avatar
Member Avatar
+0 forum 2

So I just started reading about serialization of class and how I can save them into a binary file. But after I define my class as <serializable()> and try to save the object it keeps throwing me this exception. [COLOR="Red"]"An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll Additional information: Type 'System.Windows.Forms.CheckBox' in Assembly 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable."[/COLOR] My class is about 1000 lines of code so I won't post it as it contains information from other modules so it will be hard to figure out what i'm doing. My class basically consists of dynamic …

Member Avatar
Member Avatar
+0 forum 2

Hi guys, I've been searching for hours now and haven't yet found a good source of C# information for what I need to do. The general gist is this: I have 1 Client app (a simple windows form which gathers data) and 1 Server console app (which holds the business logic) The client needs to send a file (which is a serialized class object called info.sco) to the server and then call a specific server method on that file. Example: User enters data into a form on the client app Client app adds the data to a custom class User …

Member Avatar
Member Avatar
+0 forum 2

Hello. I'm trying to serialize a class that implements Serializable and a Runnable. My class has a transient Thread object as a field that is created and started after the restoration of my class(object). This is proven possibile by a tutorial from Oracle, [URL="http://java.sun.com/developer/technicalArticles/Programming/serialization/"]here[/URL]. But i fail to compile my program which is very similar to the one in the tutorial(i think). So in the following i attach my source code and the exception's trace in hope that someone can help me out. [code=java] /* * To change this template, choose Tools | Templates * and open the template in …

Member Avatar
Member Avatar
+0 forum 4

Hi all, In my project I am creating .dat(or any extension) file after BinnaryFormat Type Serialization of objects(Datatable) and I deserialize that .dat file to retrieve Data from object(Datatable). Problem is when I open that .dat file , I can simply see sort of Data. [I] My question is how can I stop anyone to see the data in .dat file.? [/I]

Member Avatar
Member Avatar
+0 forum 1

Hallo! I've been having some trouble getting a save/load function to work properly. I'm trying to save object and their properties to a file in binary using fstream. And then being able to load the object from the binary file the next time im running my project. Quick breakdown: I got this class CMapMgr which holds a vector of CMap instances, and each CMap instance holds a vector with CTile instances. So when everything is initiated and running, and when i run this code, how much is saved? [CODE] // mFile is of fstream type and is a private member. …

Member Avatar
Member Avatar
+0 forum 5

Hello everyone, I am not a professional at vb.net so help me out. I have made a small program and a want to add a serial control to it.... here is my code.... Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = "12345" And TextBox2.Text = "12345" And TextBox3.Text = "12345" And TextBox4.Text = "12345" And TextBox5.Text = "12345" And TextBox6.Text = "12345" Then Form2.Show() Me.Hide() Else MsgBox("Incorrect Serial Number") End If End Sub End Class Now, that code is all fine, but every time i open up my program, it …

Member Avatar
Member Avatar
+0 forum 7

Hello, I am trying to send an object over a socket using C#. I originally used a memorystream and binaryformatter, but to do this I need to include a reference from program1 to program2. I don't want to have a reference, so I just want to be able to transform an object to a byte[] but this does not seem to work either when casting it on the otherside of the wire back to object. So for instance Object obj = MyClassObj; byte[] bytes = (byte[])obj; (send over wire) Program1 -> Program2. It seems as though it does not transfer …

Member Avatar
Member Avatar
+0 forum 5

Basically I've got a text editor which revolves around a jTextArea. There are some settings (e.g. whether line wrap is enabled) that I'd like to save to a file when the application closes, and then load up again when it runs next. I've spent a few hours trying to get it to work by saving to a plain text file and failed, then tried using a serialisable class (which probably isn't even meant to work that way) - and have eventually given up on getting it working without help :) There are two main questions I have: [B]1. How should …

Member Avatar
Member Avatar
+0 forum 2

So, a while ago I wrote a SerializableImage class in order to easily bundle several images together into a single file. The class worked fine, both serializing, file I/O and drawing. In another project I'm working on I successfully used a copy of this SerializableImage class, until recently. I had decided that I wanted my project in a "real" package, rather than the default_package (due to some jar-ing problems). Now, all of a sudden, my SerializableImage class starts generating ClassNotFound exceptions when I try to cast the objects from my image file to SerializableImage. Nothing in the class has changed …

Member Avatar
Member Avatar
+0 forum 3

Hope I chose the correct forum. I have a dataset object with one table that comes to me from a common custom component's GetDS method. I need to pass XML to another process (chunked as byte array). I have it all working but the XML is missing some attributes that the consuming process expects. I use the GetXML method to serialize to XML that looks like the following: [CODE] <?xml version="1.0" standalone="yes" ?> <FooUpload> <Foo> <FooMasterID>483</FooMasterID> <Country>27</Country> <PaymentCode>ANN</PaymentCode> <Amount>132</Amount> <PaidDate>2012-12-31 00:00:00</PaidDate> <PaidBy>FooServices</PaidBy> </Foo> </FooUpload> [/CODE] The calling process expects [CODE] <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <FooUpload ClientCode="FOOO" RecordCount="1" CreateDate="2008-12-09T15:02:18.920" CreateUser="valli"> …

Member Avatar
+0 forum 0

Hi! I'm new to the site! I've been searching for help on Google for a while and keep getting results that point to this site, so I figured I should jump on. I'm new to C#. I've been programming in VBA in MS Access for a while now and have a solution that is running effectively where I work. (had to brag about that for a second :) ) But I just started with C# though. VBA is okay, but it is (to me) a little limiting. I've decided as my first learning tutorial to teach myself how to create …

Member Avatar
Member Avatar
+1 forum 55

In my project I had been using a set of arrays to hold some data, realized it was a bad design, so then I decided to create an object that holds all the relevant data, and add them to an arraylist, this work great except all the data was information that extended a complicated dynamic button. So then, since the button was a custom user control anyway. I just added the fields i needed to store to the button class its self and everything was simple and right with the world. then I come to the problem of saving the …

Member Avatar
Member Avatar
+0 forum 8

The End.