protocol-buffers

use protobuf3 with some lib which depends on protobuf2 in Java

给你一囗甜甜゛ 提交于 2019-12-06 10:12:00
问题 I'm using protobuf3 to represent our data, while we need hbase to store the data, it seems like hbase depends on protobuf2. When i write the following line to create our hbase table admin.createTable(desc); then I got an Excepiton: NoClassDefFoundError: com/google/protobuf/LiteralByteString I've tried using gradle's shadow plugin to relocate com.google.protobuf to shadow.google.com, then it throw a similar message NoClassDefFoundError: shadow/google/protobuf/LiteralByteString . 回答1: Create a

Reachability and International Roaming

房东的猫 提交于 2019-12-06 09:25:50
I am using the Reachability class from Apple to determine whether or not data or wifi is available. However, a user (with a U.S. iPhone) is testing the app in another country and he is seeing the following error while trying to access the MapKit. Console In my research on this error, I have found that PBRequester is ProtocolBuffer . 2012-10-15 21:16:00.921 WrightsCS App[24239:907] PBRequester failed with Error Error Domain=kCFErrorDomainCFNetwork Code=-1018 "International roaming is currently off." UserInfo=0x1e5587d0 {NSErrorFailingURLKey=https://gsp13-cn.ls.apple.com/shift,

Generating a Protocol Buffers definition

杀马特。学长 韩版系。学妹 提交于 2019-12-06 09:19:12
问题 I have a large set of XML files of a propriatary schema -the XML files define binary communication protocol (message structure). I'd like to leverage Google's protocol buffers technology. I am using existing code to load the XML files into an object model (in memory). I'd like to generate a .proto file from that object model. so basically what I am looking for is code/library (in C#/.NET) that represents the .proto file format as an object model and can save that object model into a .proto

Using ProtoBuf-net with gRPC

陌路散爱 提交于 2019-12-06 08:32:00
问题 I am trying to build a PoC at work that utilizes gRPC. The google document here takes us through a sample application. I was wondering if protobuf-net, and specifically protogen, had the capability to understand service definitions and classes necessary to perform gRPC calls? Or is this something being worked on? Would it work if I use google's protoc for client and server code generation(which involves the service definitions and RPC calls) and protobuf-net for my business objects. 回答1:

How to serialize/deserialize a protobuf message that uses 'oneof' with ScalaPB?

[亡魂溺海] 提交于 2019-12-06 08:27:11
问题 I'm using ScalaPB to compile my Scala case classes for serializing my protobuf messages. I have a .proto file with the following messages: message WrapperMessage { oneof msg { Login login = 1; Register register = 2; } } message Login { required string email = 1; required string password = 2; } message Register { required string email = 1; required string password = 2; optional string firstName = 3; optional string lastName = 4; } How do I create my WrapperMessage knowing that I want to put a

Cannot deserialize protobuf data from C++ in Java

前提是你 提交于 2019-12-06 08:20:20
问题 My problem is to serialize protobuf data in C++ and deserialize the data in Java probably. Here is the code I use to the hints given by dcn: With this I create the protobuf data in C++ and write it to an ostream which is send via socket. Name name; name.set_name("platzhirsch"); boost::asio::streambuf b; std::ostream os(&b); ZeroCopyOutputStream *raw_output = new OstreamOutputStream(&os); CodedOutputStream *coded_output = new CodedOutputStream(raw_output); coded_output->WriteLittleEndian32

Protobuf backward compatibility and proto3 vs proto2

给你一囗甜甜゛ 提交于 2019-12-06 07:49:56
One of selling points of Protobuf was backward compatibility, i.e. developers can evolve format, and older clients can still use it. Now with new Protobuf version called proto3, the IDL language itself is not compatible as such things as options , required where dropped, new syntax for enuns, no extention. Does it mean that using proto3 there's no way to produce binary that older proto2 would read/understand also? It is like you have to continue to use proto2. If you start using proto3, you can't talk to older systems, or have to rewrite, recompile all those .proto s That is compatibility

Protocol Buffer: How to import?

偶尔善良 提交于 2019-12-06 07:37:10
I have 2 .proto files : First file: package com.test.model; message ProtoModel { required CustomObj custom=1; } Second file: package com.test.model; message CustomObj { required string smth=1; } The issue here is that "CustomObj" is said to be "unresolved reference" . Thus, I've tried to import the second file into first file: import "com/test/model/firstFile.proto" package com.test.model; message ProtoModel { required CustomObj custom=1; } I still get the same issue !! The import statement is the folder relative to the place where you invoke protoc . It looks like you have treated it as

have to create java pojo for the existing proto includes Map

风流意气都作罢 提交于 2019-12-06 07:34:22
I have tried converting proto to java pojo . But got the error [Stderr] Order.proto:12:18: Expected "required", "optional", or "repeated". [Stderr] Order.proto:12:21: Expected field name. optional int32 orderID = 1; optional int32 quantity = 2; map<string,string> map_field = 4; repeated string product = 3; Please help me what needs to be changed. i searched on google protobuf developer site https://developers.google.com/protocol-buffers/docs/proto#maps It says that Map fields cannot be repeated, optional, or required Please help me to resolve the issue. Maps are a new feature in protobuf 3.0

Protobuf C# Message Translation to JAVA

旧城冷巷雨未停 提交于 2019-12-06 06:53:23
I am trying to translate a message generated using C# to JAVA. As a first step, i generated proto file and this is what i got package Om.Business.Scanner; message ScannerActivityDetail { optional string ActivityId = 1; optional string ContextId = 2; optional int32 ActivityStart = 3; optional bcl.DateTime ActivityEnd = 4; } How do i interpret bcl.DateTime in java world? I am using protobuf-net and trying to de-serialize message generated by C# app. Thanks in advance for your help. Looking at bcl.proto , it should be pretty straightforward. Create a Map<DateTime.TimeSpanScale, TimeUnit> in the