protocol-buffers

Specifying the JSON name for protobuf extension

陌路散爱 提交于 2021-02-07 12:46:36
问题 I've added an extending message to a message and need to marshal it as a json. However the field name for the extension message is [message.extension_message_name] . I would prefer it to be named just extension_message_name , without the braces and prefix, since this extension message exists elsewhere in our API and and having this weird name adds confusion. As far as I can tell the bit of code responsible is in protobuf/jsonpb, where the JSONName is set with fmt.Sprintf("[%s]", desc.Name and

Protobuf, nested maps?

南笙酒味 提交于 2021-02-07 05:22:18
问题 I'm using Protobuf 3. From the docs, it seems like it's not possible to define nested maps: message MyMessage { map<string, map<string, string>> nestedMap = 1; // doesn't work } I'm trying to create a message type to represent pricing information (bid and ask prices) for an Option Chain. For those unfamiliar with these financial instruments, basically, I have a set of "expiration dates (YYYYMMDD)". In each of these expiration dates I have a set of "strikes (float numbers; could be represented

Protobuf, nested maps?

北城以北 提交于 2021-02-07 05:21:05
问题 I'm using Protobuf 3. From the docs, it seems like it's not possible to define nested maps: message MyMessage { map<string, map<string, string>> nestedMap = 1; // doesn't work } I'm trying to create a message type to represent pricing information (bid and ask prices) for an Option Chain. For those unfamiliar with these financial instruments, basically, I have a set of "expiration dates (YYYYMMDD)". In each of these expiration dates I have a set of "strikes (float numbers; could be represented

Tensorflow model import to Java

我与影子孤独终老i 提交于 2021-02-06 09:19:28
问题 I have been trying to import and make use of my trained model (Tensorflow, Python) in Java. I was able to save the model in Python, but encountered problems when I try to make predictions using the same model in Java. Here, you can see the python code for initializing, training, saving the model. Here, you can see the Java code for importing and making predictions for input values. The error message I get is: Exception in thread "main" java.lang.IllegalStateException: Attempting to use

Install Protocol Buffers on Windows

拈花ヽ惹草 提交于 2021-02-05 19:40:43
问题 I am unable to find clear instructions to install Google Protocol Buffers (including compiler) on Windows x64 platform. I went through the instructions README file for compiler and source: For Compiler: To install, simply place this binary somewhere in your PATH I added system variable to Path: PROTOC 'C:\dev_tools\protoc-2.4.1-win32' I am stuck on installing Protocol Buffers source using Cygwin. I tried following Unix instructions provided in the readme file: To build and install the C++

Install Protocol Buffers on Windows

点点圈 提交于 2021-02-05 19:35:53
问题 I am unable to find clear instructions to install Google Protocol Buffers (including compiler) on Windows x64 platform. I went through the instructions README file for compiler and source: For Compiler: To install, simply place this binary somewhere in your PATH I added system variable to Path: PROTOC 'C:\dev_tools\protoc-2.4.1-win32' I am stuck on installing Protocol Buffers source using Cygwin. I tried following Unix instructions provided in the readme file: To build and install the C++

Install Protocol Buffers on Windows

六月ゝ 毕业季﹏ 提交于 2021-02-05 19:34:59
问题 I am unable to find clear instructions to install Google Protocol Buffers (including compiler) on Windows x64 platform. I went through the instructions README file for compiler and source: For Compiler: To install, simply place this binary somewhere in your PATH I added system variable to Path: PROTOC 'C:\dev_tools\protoc-2.4.1-win32' I am stuck on installing Protocol Buffers source using Cygwin. I tried following Unix instructions provided in the readme file: To build and install the C++

Generate a DLL which uses protocol-buffers

这一生的挚爱 提交于 2021-02-05 11:16:10
问题 I am working on a C++ (VS2017) project that uses a protobuf type I created. However, this project requires a .dll of said protobuf type. The __declspec( dllexport ) in each class declaration are not there by default, and I read online that they can be added by generating the protobuf object with this command line: --cpp_out=dllexport_decl=MY_EXPORT_MACRO:output/directory No one has explained what MY_EXPORT_MACRO is or how to define it. When I first generated my protobuf objects I used the

Generate a DLL which uses protocol-buffers

佐手、 提交于 2021-02-05 11:16:07
问题 I am working on a C++ (VS2017) project that uses a protobuf type I created. However, this project requires a .dll of said protobuf type. The __declspec( dllexport ) in each class declaration are not there by default, and I read online that they can be added by generating the protobuf object with this command line: --cpp_out=dllexport_decl=MY_EXPORT_MACRO:output/directory No one has explained what MY_EXPORT_MACRO is or how to define it. When I first generated my protobuf objects I used the

Sending explicit zeroes in protobuf3

…衆ロ難τιáo~ 提交于 2021-02-05 07:11:29
问题 In Protobuf3 zero is the default value for numeric types, and so they are filtered out when serialized. I have an application where I need to send a value only when it has changed. For example, x was 1, now x is 0, send this value. It isn't possible to send only the delta, eg -1, because some of these values are floats or doubles, and we do not want to accrue errors. There are over 200 different variables in some classes I need to serialize, so solutions like "add a boolean to flag which