Questions tagged [serialization]

Serialization is the process by which an object is converted into a format that can be stored and later retrieved.

Filter by
Sorted by
Tagged with
4
votes
1answer
99 views

Struct Serialization using Unsafe Field

I want to use structs as a container for data packets for asynchronous networking in C#. Found out that you can create a union style struct without the need to mark the struct itself as unsafe--...
7
votes
2answers
71 views

constexpr Precalculate size of serialized data with templates and C++20 concepts

Im writing a serializer that will do serialization/deserialization as fast as possible, and that uses templates so that i dont have to create a ton of functions for every data structure, This is the ...
6
votes
2answers
119 views

Simplify Generic Method

I am writing a GenericDeserializer for Apache Kafka. My class implements IDeserializer<T> from Confluent.Kafka.Net package....
5
votes
2answers
185 views

(de)serializing c++ object almost automagically

Here's one way to solve the serialization problem in c++20, using a json library: ...
3
votes
1answer
95 views

JSON serializable string enum in C# with generic JsonConverter

How can StringEnumeration be changed in the code below into a generic class, so that ConsensusState wouldn't need the ...
4
votes
1answer
61 views

How to properly decode a JSON dictionary into different Swift classes using Decodable and JSONDecoder?

Generally, the approach I've taken is to try calling container.decode from a decodable enum with its associated value returning ...
1
vote
0answers
17 views

Custom JsonConverter for class

Note that this is about System.Text.Json, not NewtonSoft. The underlying issue that inspired this example is the problem of using different serialization on a particular property of a particular class ...
1
vote
0answers
61 views

Better way to Read /Write Memory<byte> to/from POCO

I am communicating with a machine that sends/received structured binary data to my netcore service. The machine supplier's new library uses Memory in their library's API. I have written the following ...
2
votes
2answers
104 views

Reading and Storing Integer from Serial Monitor

Description I wanted to understand how integers can be written and stored inside variables without the use of Serial.parseInt(). I couldn't find any code examples about this. Perhaps this is the ...
1
vote
1answer
51 views

Traffic Light which revolves around Serial Communication

Assignment description This is the improved code for a question I've posted earlier. I'd like to receive feedback on an assignment which I'm currently working on. I have to make two traffic lights ...
2
votes
1answer
63 views

Feedback on Traffic Light which revolves around Serial Communication

Assignment description I'd like to receive feedback on an assignment which I'm currently working on. I have to make two traffic lights which allow traffic to run smoothly. I'm using a master Arduino ...
1
vote
1answer
84 views

Serializing object graph to proprietary binary file

I'm creating a class library to read/write .3di files which are binary files describing 3D models for a video game. This review is for the write/serialization process. I've mapped the different ...
3
votes
1answer
150 views

Convenience function to save and load pickle objects

I want to come up with a simple convenience function to save and load pickle objects. A secondary objective is to simply execute the function without the above function. I have come up with two ...
2
votes
2answers
61 views

User Management Program

Main Goal My goal is to create a chat app for my company (they are all software developers). I first make a console version and if it is working fine, I will make a GUI version. The program will run ...
3
votes
0answers
478 views

C# Rest Client Benchmarking

I build a C# Rest Client library / framework. I noticed that it seemed to be significantly faster than RestSharp for GET at least. So, I decided to put together some benchmarks comparing it to other ...
3
votes
0answers
53 views

Getting a list of waypoints assuming that there is a map [closed]

I'm a beginner learning ROS. I'm developing an android application that will control my robot and that includes getting the list of waypoints to display it to my spinner. How do you get the list of ...
4
votes
1answer
148 views

Parse data into an array of structs

I'd had a hard time getting this to work. I’d like to parse a file containing data and copy this data into a struct. The data file (test.dat) looks like this: <...
2
votes
0answers
115 views

F# XML Generation in .NET Core: XmlSerializer or XmlProvider

I am working on SEPA XML generator in F#. I developed two solutions that are roughly equivalent, one relies on the XmlSerializer while the other relies on ...
2
votes
1answer
106 views

An imitation of reading a C Struct from binary file in python 2.7

Preliminary I need to read a binary file constructed by writing a Struct to it with Python. So I decided to write a simple wrapper using ...
1
vote
1answer
278 views

Hex string to Base64 in Haskell

This is my take on the first challenge on the cryptopals crypto challenges list. I think that i made it quite simple but i feel like it is possible to optimize it further. Any suggestion? The code: ...
1
vote
1answer
93 views

Async Tcpwriter and Reader

I currently have a class that I want to serialize/deserialize messages sent to this socket. My plan was to use Task.WhenAny() to monitor 2 tasks (Either watch ...
16
votes
6answers
2k views

Avoiding repetition when using the “snprintf idiom” to write text

I'm writing a function to stringify a nested struct. I'm using snprintf to pre-calculate how much space I'll need to allocate. The problem is, it's extremely ...
1
vote
1answer
67 views

Sign-up serialization in Python [closed]

I built a small project using Django-Rest-Framework. Please comment on the best practice style for the code below, which will make it simpler. ...
2
votes
1answer
116 views

Deserializing response to correct type

I use this method to get either Customer or Account. The server will determine which type it is. The response will have a property "Type": "Customer" or ...
2
votes
1answer
231 views

Converting hex strings to byte arrays and back to hex strings in Java

Here is my attempt at converting hex strings to byte arrays and converting byte arrays to hex strings: net.coderodde.util.ByteStringConverter ...
2
votes
1answer
106 views

Indeterminate-length big-endian to little-endian conversion in Python

I have a need to convert wire encoding (big-endian) to little-endian in Python. The conversion needs to happen as a separate function; I am not allowed to change the function that reads the byte ...
6
votes
1answer
130 views

Java objects for a network sniffer program

I'm working on a network sniffer program, whose structure uses 3 main classes: Frame Class - One per monitored frame, holds reference to all the other sub frames Parse Class - Holds the hex value of ...
3
votes
1answer
146 views

Convert characters to octal, binary, and integer

I have implemented a sample program that converts vector of characters to its integer representation depending on the bit size specified. I was hoping to get some input on how to simplify the sequence....
3
votes
0answers
218 views

Java code to convert BigDecimal to/from .NET decimal

Background In many languages we have built-in data types for representing decimal floating point numbers. In .NET that's decimal, and in Java we have ...
6
votes
2answers
628 views

Unmanaged byte array to managed structure

I have a need to turn byte arrays into various structures. First version: ...
3
votes
1answer
74 views

Settings class implementation

I have a settings.txt file with the following format: ...
2
votes
0answers
240 views

WebAPI: Async Filtering CSV content + Json/XML Serialization

I am coding a csv file filtering api in ASP.NET Core, which takes a csv file located at a given uri (and retrieved via the query string) convert the content to a collection of records, then apply a ...
2
votes
1answer
359 views

IEnumerable<T> async serialization

I am building some classes to serialize (in an async / await way) potentially pretty long ...
11
votes
3answers
2k views

Decoding assembly instructions in a Game Boy disassembler

I am coding a game boy disassembler in C++. The program (simplified here) converts a vector of byte into an assembly instruction and print it. To do so, it iterates through the vector of bytes (char)...
6
votes
0answers
130 views

Reading sparse matrix from binary file

I have binary files containing sparse matrices. Their format is: number of rows int length of a row int column index int value float Reading ...
4
votes
1answer
69 views

Deserializing an XML Object without Reflection / Meta-Programming

I need to deserialize an XML file, without using any sort of "reflection" (or meta-programming). Instead, I need to do it via a raw object, that knows of it's structure and can properly identify and ...
4
votes
2answers
76 views

Parsing Bitcoin binary data file with Python

The script parses Bitcoin database (blkXXXXX.dat) files directly from raw binary to txt human readable view. And I think about how to encrease the speed of processing. Can anyone suggest how to ...
0
votes
1answer
77 views

Breaking a 32-bit value into bytes for an ArrayList

I am very new to Java and its collections and I'm trying to figure out "best" way to populate an ArrayList<Byte> in Java. In particular, I'm trying to take a ...
1
vote
2answers
2k views

Write byte array to end of file

I'm writing a byte array at the end of file. The code works fine, but can you please suggest performance improvements? ...
0
votes
1answer
71 views

Invocable callout(Post) from processbuilder

I am relatively new in making (invocable)callouts. My main concern is if I should be using smaller parts for example for the body and using a query only once in this case. Any suggestions would be ...
5
votes
2answers
97 views

Custom serialiser with object factory

A couple of years ago I wrote a serialisation library for my project. By the time it worked well, but recently I thought it could be modernised. Back then I needed something that looks similar to ...
7
votes
1answer
2k views

A little Python hex editor

First off I'm quite new to Python, there will be a lot of messy/overcomplicated code, that's why I'm posting on this site. This code is written in Python (2.7) using the Tkinter library. Questions To ...
0
votes
1answer
70 views

Serializable game loop thread

I have been working on a small game lately and I was tired of looking up and copy-pasting game loops so I tried to make one as you can see. It works perfectly so if you want to feel free to use it, ...
1
vote
0answers
762 views

A simple and efficient packet frame encoder/decoder

I have written a simple packet-framing class, for converting un-encoded 'packets' into encoded/delimited 'frames,' to be sent over a P2P serial connection. The functionality is based on the RFC 1662 "...
7
votes
1answer
177 views

Library for managing sub-byte named bitfields

When writing custom network serialization in Rust, I've come across a use case for storing and retrieving values in bitfields smaller than the u8 available in Rust. ...
8
votes
4answers
4k views

reinterpret_cast vs bit shifts for extracting 32-bit integers from bytes, with either endianness [closed]

I've written some simple helper functions that read data types from a vector of bytes (binary files) and having a tough time deciding which route to go. Method 1 : reinterpret_cast ...
7
votes
3answers
443 views

Convert binary raster file to text CSV

I have a binary file input.hgt from the Shuttle Radar Topography Mission. It contains a 3601✕3601 matrix, stored as 2-Byte big-endian integer numbers. My code ...
3
votes
1answer
106 views

Serializing a table for filing

I have a table in Lua, which contains two 1-dimensional arrays in which each array contains approximately 800,000 elements. I want to serialize this Lua table to file efficiently. Hence, I planned to ...
2
votes
0answers
56 views

Whole Packet Protocol Communication Library in Node

I have built this small class as a small library to be able to talk to a server that uses CapeSoft's NetTalk library as socket library, and which uses the Whole Packet Protocol, which is a simple ...
4
votes
2answers
72 views

Parsing CAN frames from a ByteArray

Here's my method used for parsing a ByteArray into multiple frames of CAN interface. It works now correctly but it's somewhat ugly in my opinion. It's written in ...

1
2 3 4 5 6