protocol-buffers

Receiving 0 size messages while using ZMQ and protobuf

ぃ、小莉子 提交于 2019-12-11 13:15:17
问题 I am trying to set up a basic communication system between client and server using ZMQ. I am using protobuf for the message format. My problem is when I send the message from client the message size is 34 but the message size received on the server is 0. Following is my code; Client.cpp tutorial::Person person; person.set_id(1234); person.set_name("john"); person.set_email("john@mxyz.com"); person.set_phonenumber("12345678"); zmq::context_t context (1); // Prepare our context and socket zmq:

protobuf generated files does not compile on Solaris SPARC 64

雨燕双飞 提交于 2019-12-11 13:10:18
问题 I am trying to compile some generated proto.cc files on Solaris 10 SPARC 64. And I get these errors: "/apps/pkgs/studio-11.0.13/prod/include/CC/stlport4/stl/_alloc.h", line 134: Error: The function "__stl_new" must have a prototype. "/apps/pkgs/studio-11.0.13/prod/include/CC/stlport4/stl/_alloc.h", line 135: Error: The function "__stl_delete" must have a prototype. "/apps/pkgs/studio-11.0.13/prod/include/CC/stlport4/./stdexcept", line 52: Error: _STLP_EXCEPTION_BASE is not defined. Compiler

ProtoBuf-Net: Inheriting [ProtoMember] of type object[] from a parent class

二次信任 提交于 2019-12-11 12:59:23
问题 The object[] mList holds whatever objects that the child collection wants it to. This is supposed to be a dummy wrapper class for the rest of the more specified collections of objects. [ProtoInclude(98, typeof(Object1CollectionProto))] [ProtoInclude(99, typeof(Object2CollectionProto))] [ProtoInclude(100, typeof(Object3CollectionProto))] public class ObjectCollectionProto { protected ObjectType mCollectionType; protected object[] mList; public ObjectCollectionProto(){} [ProtoMember(1),

How would I retrieve an Embedded Entity with repeated properties using datastore java client

故事扮演 提交于 2019-12-11 12:31:25
问题 I created entities on datastore using the AppEngine SDK's python APIs and I'd like to retrieve them on Google Cloud Dataflow (Java). The entity's structure is something like this: entity embedded_entity (ndb.StructuredProperty(repeated=True)) name name name name Retrieving would be something like this, but I know I am missing the step where I extract the data. static class EmbeddedStringExtractor extends DoFn<Entity, String> { @Override public void processElement(ProcessContext c) { Map

Google Protocol Buffer serialized string can contain embedded NULL characters in it?

帅比萌擦擦* 提交于 2019-12-11 12:16:52
问题 I am using Google Protocol Buffer for message serialization. This is my sample proto file content. package MessageParam; message Sample { message WordRec { optional uint64 id = 1; optional string word = 2; optional double value = 3; } message WordSequence { repeated WordRec WordSeq = 1; } } I am trying to serialize the message in C++ like following MessageParam::Sample::WordSequence wordseq; for(int i =0;i<10;i++) { AddRecords(wordseq.add_wordseq()); } std::string str = wordseq

How Protobuf encodes oneof message construct

こ雲淡風輕ζ 提交于 2019-12-11 12:16:18
问题 For this python program running protobuf encoding when encoded gives following output: 0a 10 08 7f 8a 01 04 08 02 10 03 92 01 04 08 02 10 03 18 01 What I don't understand is why there is a 01 after 8a, and again why 01 after 92. Seems for information element of type oneof, extra 01 is added, but why? Please help me, if any body understands protobuf encoding import sys import test2_pb2 def write_to_file(file,value): with open(file, "wb") as f: f.write(value) def cell_test_dct(): msg=test2_pb2

What do I need to do to send out Protobuf serialized Data using C# ASP .NET web api?

不羁的心 提交于 2019-12-11 11:22:54
问题 I'm new to protobuf and fairly new to asp .net. so I might need help on this. I have this code snippet for my PersonsController: public class PersonController : ApiController { [ProtoContract] public class Person { [ProtoMember(1)] public int ID { get; set; } [ProtoMember(2)] public string First { get; set; } [ProtoMember(3)] public string Last { get; set; } } // GET api/values public IEnumerable<Person> Get() { List<Person> myList = new List<Person> { new Person { ID = 0, First = "Judy",

Read protobuf kafka message using spark structured streaming

守給你的承諾、 提交于 2019-12-11 10:44:44
问题 Is it possible to read protobuf message from kafka using spark structured streaming? 回答1: Approach 1 sparkSession.udf().register("deserialize", getDeserializer(), schema); DataStreamReader dataStreamReader = sparkSession.readStream().format("kafka"); for (Map.Entry<String, String> kafkaPropEntry : kafkaProps.entrySet()) { dataStreamReader.option(kafkaPropEntry.getKey(), kafkaPropEntry.getValue()); } Dataset<Row> kafkaRecords = dataStreamReader.load() .selectExpr("deserialize(value) as event")

Protobuf illegal Wire type

本秂侑毒 提交于 2019-12-11 10:18:39
问题 protobuf.min.js:63 Uncaught Error: Illegal wire type for field Message.Field .Data_new.vert: 5 (2 expected) I get this message when I try to decode my binary file with protobuf. vert.proto: message Vertice_new{ repeated float values = 1 [packed = true]; } message Data_new{ repeated Vertice_new vert = 1; } and in cpp i just put in a lot of raw data in the form of x,y,z,stress,strain ... and so on which are all floats and when I try to decode it on javascript side I get this weird message, it

How to define value and id for enum in protobuf? (proto java client)

耗尽温柔 提交于 2019-12-11 09:07:41
问题 I am new to protobuf usage. i am planning to write protobuf def with enum(s) in it. is there any way to provide id, value and as well description in it. after compilation i want generated enum should be equivalent as below example enum Sample{ W(0, "W"), P(0, "P"), C(0, "C"), B(0, "B") private final int id; private final String value; private Status(int id, String value) { this.id= id; this.value = value; } } Any help is very appreciated. 回答1: There is no way to generate exactly the Java enum