protocol-buffers

When using google protocol buffers to transfer String character,got messy code

有些话、适合烂在心里 提交于 2019-12-14 04:17:07
问题 In debug view: Here is the code which encodes into messy string... ((S2CEnterCollection)objS2c).toByteString().toStringUtf8(); Output: ���"default( ���"default( ���"default( ���"default( ���"default( ����"default( ����"default( �����"default( Here is the code which has the right string: ((S2CEnterCollection)objS2c).toString() The original string was: cardList { cardId: 100001 liked: 100 number: 10 finder: "default" rank: 1 } cardList { cardId: 100002 liked: 123 number: 10 finder: "default"

Cannot parse a protocol buffers file in python when using the correct .proto file

為{幸葍}努か 提交于 2019-12-14 03:56:31
问题 (see update at bottom) Tilemaker is an OpenStreetMap programme to generate Mapbox vector tiles (which are themselves protocol buffers (pbf) files) from an OSM pbf data file. I have compiled it and used it to create a directory of vector tiles. I cannot parse those files in Python. I created the vector tiles with: tilemaker input.pbf --output=tiles/ Then I created a simple python programme, based on Google's Protocol Buffers Python Tutorial in this way: Compiling the .proto files: mkdir py

Python grpc protobuf stubs generation issue: --grpc_out: protoc-gen-grpc: Plugin failed with status code 1

房东的猫 提交于 2019-12-14 03:47:23
问题 As the question says, I compiled grpc from source and also did sudo pip install grpcio , however, the which grpc_python_plugin doesn't return anything. This is a problem because the grpc python example for route_guide requires me to run protoc -I . --python_out=. --grpc_out=. --plugin=protoc-gen-grpc='which grpc_python_plugin' ./route_guide.proto in order to generate the python stubs. Since, which grpc_python_plugin doesn't return anything, I get the following error: : program not found or is

How to handle error in swift when server is not available?

隐身守侯 提交于 2019-12-14 03:34:14
问题 How to handle error for this server call when the server is not available or is down? func createData(request:Crudpb_CreateRequest, with completion: @escaping (String) -> Void) throws { DispatchQueue.main.async { self.response = try! self.client.create(request) // <---- How to handle error for this server call when the server is not available or is down? completion(self.response.result) } } It returns an object, so when I store the result in response variable then say print(response.result)

Installing Protobuf Development Libraries in MinGW

风格不统一 提交于 2019-12-14 03:34:13
问题 I installed Protobuf in MinGW from the sources on github. When I try to compile my C++ program I get errors: CMakeFiles/nxcore_interface.dir/main.cpp.o:main.cpp:(.rdata$.refptr._ZN6google8protobuf8internal13empty_string_E[.refptr._ZN6google8protobuf8internal13empty_string_E]+0x0): undefined reference to `google::protobuf::internal::empty_string_' collect2: error: ld returned 1 exit status I found something that indicates the development libs are not present: Program with protocol-buffers don

How do I build, integrate, and compile java code created by google-protobuf into an Android Studio Project

守給你的承諾、 提交于 2019-12-14 01:45:44
问题 I have been trying to find a way to integrate java code, generated by google-protobuf's protoc compiler, into an Android Studio project. protoc --java_out=. Navigation.proto where Navigation.proto contains: syntax = "proto3"; option java_generic_services = true; message Navigation { string name = 1; string url = 2; } service NavRPC { rpc putNavigation(Navigation) returns (Navigation); }; will generate a java class (Navigation.java), but that class references packages that are not present in

Protobuf getAllFields() not working as expected

江枫思渺然 提交于 2019-12-13 21:42:55
问题 I need to parse protobuf messages sent by third party and process those. A part where I am facing an issue in accessing fields looks like following: ext {\n is_foo: NO\n is_bar: false\n 12: \"fgyhcbho-4594-34545-gbvj\"\n 13: 0\n } I am mainly interested in accessing the value of the field name "12". However, getAllFields().entrySet() returns only 2 entries - is_foo and is_bar . So I am unable to get the value "fgyhcbho-4594-34545-gbvj" of the field "12". Following is a part of my .proto file

Upcasting the downcasted object back in protobuffers

天涯浪子 提交于 2019-12-13 21:24:08
问题 Below is the proto code, message Animal { optional string name = 1; optional int32 age = 2; } message Dog{ optional string breed = 1; } Then the sample class using the above proto public class InheritanceTest { public static void main(String[] args){ Dog dog = Dog.getDefaultInstance(); printAnimalName(dog.getAnimal()); } public static void printAnimal(Animal animal){ Dog dog = (Dog)animal; // Not at all possible right! } } Is up-casting possible only by having an instance of dog as "required"

Protocol Buffer: Version Change

馋奶兔 提交于 2019-12-13 19:26:05
问题 I have accidentally installed version 3.0.0 and most of my files naturally gave tons of errors. Now I want to take it back to 2.6.1. I already downloaded 2.6.1 and installed, however when I do protoc --version it still shows libprotoc 3.0.0 , which is wrong. Is there a way to set the version to 2.6.1 or is there a way to uninstall 3.0.0? 回答1: Figured it out. One should delete everything regarding google protocol buffers under /local and /include , , and then simple reinstall the other version

Cannot query example AddressBook protobuf data in hive with elephant-bird

一笑奈何 提交于 2019-12-13 19:15:58
问题 I'm trying to use elephant bird to query some example protobuf data. I'm using the AddressBook example, and I serialized a handful of fake AddressBooks into files and put them in hdfs under /user/foo/data/elephant-bird/addressbooks/ The query returns no results I setup the table and query like so: add jar /home/foo/downloads/elephant-bird/hadoop-compat/target/elephant-bird-hadoop-compat-4.6-SNAPSHOT.jar; add jar /home/foo/downloads/elephant-bird/core/target/elephant-bird-core-4.6-SNAPSHOT.jar