protocol-buffers

Parsing a raw Protocol Buffer byte stream in C#

吃可爱长大的小学妹 提交于 2019-12-21 20:26:40
问题 Given a protocol buffer encoded Stream or byte[] but NOT knowing the object type itself, how can we print the skeleton of the message? The use case is for debugging IO that's protobuf based, for root cause analysis. If there are existing tools that can parse the raw Protocol Buffer byte stream from a binary file - that would be great! An alternative could be using the ProtoBuf.NET class ProtoReader() to keep chugging along till we hit the error but the usage of ProtoReader() isn't clear. I

Can you represent CSV data in Google's Protocol Buffer format?

眉间皱痕 提交于 2019-12-21 17:12:06
问题 I've recently found out about protocol buffers and was wondering if they could be applied to my specific problem. Basically I have some CSV data that I need to convert to a more compact format for storage as some of the files are several gig. Each field in the CSV has a header, and there are only two types, strings and decimals (because sometimes there are alot of significant digits and I need to handle all numbers the same way). But each file will have different column names for each field.

.NET/C# Interop to Python

巧了我就是萌 提交于 2019-12-21 12:22:22
问题 My backend is written in .NET/C#, I have a requirement that I need to execute python scripts passing context from the .net side of the house. These are queued up in a background task engine called hangfire running as a windows service. I did a little digging and found IronPython, however, after implementing it failed to support many of the pypi python packages that I need to execute inside my script. Secondly, I looked at Python.Net which is a embedded interpreter that embeds or extends

Calling parseFrom() method for generic protobuffer class in java

爷,独闯天下 提交于 2019-12-21 08:49:30
问题 I'm calling an api to get the an input stream and then call static method parseFrom(inputstream) to convert it to the protobuffclass. If I do it with a specific class it works: public CustomerDTOOuterClass.CustomerDTO GetCustomer() { CustomerDTOOuterClass.CustomerDTO customer = null; try { URL url = new URL("https://localhost:44302/Api/customer/1?"); HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(); conn.setRequestMethod("GET"); conn.setRequestProperty("Content-Type",

How to best get a byte array from a ClientResponse from Spring WebClient?

五迷三道 提交于 2019-12-21 07:48:06
问题 I'm trying out the new WebClient from Spring 5 (5.0.0.RC2) in a codebase that uses reactive programming and I've had success mapping the JSON response from an endpoint to a DTO in my app, which works very nice: WebClient client = WebClient.create(baseURI); Mono<DTO> dto = client.get() .uri(uri) .accept(MediaType.APPLICATION_JSON) .exchange() .flatMap(response -> response.bodyToMono(DTO.class)); However, now I'm trying to the response body from an endpoint which uses Protocol Buffers (binary

weird ios libprotobuf.dylib cause crash

ⅰ亾dé卋堺 提交于 2019-12-21 06:06:46
问题 i have my own protobuf compiled in the project (in the main target, not a lib), but I found a crash which is caused by protobuf code in libprotobuf.dylib ( which in my guess is a newly included lib in new version of device -- mine is ipad air). * thread #1: tid = 0x6598, 0x0027e96e TutorChat`void google::protobuf::internal::RepeatedPtrFieldBase::Destroy<google::protobuf::RepeatedPtrField<google::protobuf::UninterpretedOption>::TypeHandler>(this=0x1567158c) + 66 at repeated_field.h:814, queue

Conversion between C structs (C++ POD) and google protobufs?

徘徊边缘 提交于 2019-12-21 04:31:24
问题 I have code that currently passes around a lot of (sometimes nested) C (or C++ Plain Old Data) structs and arrays. I would like to convert these to/from google protobufs. I could manually write code that converts between these two formats, but it would be less error prone to auto-generate such code. What is the best way to do this? (This would be easy in a language with enough introspection to iterate over the names of member variables, but this is C++ code we're talking about) One thing I'm

Parse in text file for Google Protocol Buffer

非 Y 不嫁゛ 提交于 2019-12-21 04:03:07
问题 According to the example code https://developers.google.com/protocol-buffers/docs/cpptutorial, they show how to parse in a proto file that is in binary format. using tutorial::AddressBook address_book; { // Read the existing address book. fstream input(argv[1], ios::in | ios::binary); if (!address_book.ParseFromIstream(&input)) { cerr << "Failed to parse address book." << endl; return -1; } } I tried removing the ios::binary for my input file that is in text format, but that still fails at

Inheritance in protocol buffers

落爺英雄遲暮 提交于 2019-12-21 03:13:08
问题 How to handle inheritance in Google Protocol Buffers 3.0? Java equivalent code: public class Bar { String name; } public class Foo extends Bar { String id; } What would be Proto equivalent code? message Bar { string name = 1; } message Foo { string id = 2; } 回答1: Protocol Buffers does not support inheritance. Instead, consider using composition: message Foo { Bar bar = 1; string id = 2; } However, that said, there is a trick you can use which is like inheritance -- but which is an ugly hack,

Is there any way to access Protocol Buffers with python 3.x?

拥有回忆 提交于 2019-12-20 11:18:14
问题 We use Python 3.x in our projects. But the official client of Protocol Buffers only supports python 2.x. I don't want to downgrade to python 2.x. 回答1: UPDATE 2 : Python 3.x is natively supported as of version 3.0.0. You can see versions released on GitHub here: https://github.com/protocolbuffers/protobuf/releases UPDATE : The stable version of protobuf, 2.6.1, does not support Python 3.x. However, the newer 3.0.0 release (still in beta) supports Python 3.x. You can see versions released on