protocol-buffers

how to write a valid decoding file based on a given .proto, reading from a .pb

有些话、适合烂在心里 提交于 2019-11-29 16:32:38
Based on the answer to this question I'm thinking that I've provided my .pb file with a "faulty decoder". This is the data I'm trying to decode . This is my .proto file . Based on the ListPeople.java example provided in the Java tutorial documentation , I tried to write something similar to start picking apart that data, I wrote this: import cc.refectorie.proj.relation.protobuf.DocumentProtos.Document; import cc.refectorie.proj.relation.protobuf.DocumentProtos.Document.Sentence; import java.io.FileInputStream; import java.io.IOException; import java.io.PrintStream; public class ListDocument {

Protobuf 2.5.0 bug?

◇◆丶佛笑我妖孽 提交于 2019-11-29 15:58:42
I've migrated from google protobuf v. 2.4.1 to v. 2.5.0 (no other change). I had a perfectly working client-server [android<>gae dev server] communication using 2.4.1. Now with 2.5.0 it is broken. Without any modification to the .proto file, I've setup my client and server with the new 2.5.0 jar, and with the new protoc executable I've generated a new source file for client and server from the same proto file. Now I get this error on the server when I'm trying to parse the message: VerifyError: class ... overrides final method getUnknownFields.()Lcom/google/protobuf/UnknownFieldSet; full stack

Protobuf-net fails to serialize property with only getter - Cannot apply changes to property

左心房为你撑大大i 提交于 2019-11-29 10:59:10
I am using protobuf-net to serialize an object and I get exception: Cannot apply changes to property TestProject.TestMessage.ClientId with stacktrace: at ProtoBuf.Serializers.PropertyDecorator.SanityCheck(TypeModel model, PropertyInfo property, IProtoSerializer tail, Boolean& writeValue, Boolean nonPublic, Boolean allowInternal) at ProtoBuf.Serializers.PropertyDecorator..ctor(TypeModel model, Type forType, PropertyInfo property, IProtoSerializer tail) at ProtoBuf.Meta.ValueMember.BuildSerializer() at ProtoBuf.Meta.ValueMember.get_Serializer() at ProtoBuf.Meta.MetaType.BuildSerializer() at

How to detect when a Protocol Buffer message is fully received?

删除回忆录丶 提交于 2019-11-29 09:42:59
问题 This is kind of a branch off of my other question. Read it if you like, but it's not necessary. Basically, I realized that in order to effectively use C#'s BeginReceive() on large messages, I need to either (a) read the packet length first, then read exactly that many bytes or (b) use an end-of-packet delimiter. My question is, are either of these present in protocol buffers? I haven't used them yet, but going over the documentation it doesn't seem like there is a length header or a delimiter

google protobuf maximum size

我只是一个虾纸丫 提交于 2019-11-29 09:09:04
I have some repeating elements in my protobuf message. At runtime the length of the message could be anything - I see some questions already asked like this one - [1]: Maximum serialized Protobuf message size I have a slightly different question here. If my JMS (Java Messaging service) provider (in this case my weblogic or tibco jms server) doesn't have any size limit on the max message size, will protocol buffer compiler complain at all about the maximum message size ? Does the performance of encoding/decoding suffer horribly at large sizes (around ~10MB)..? 10MB is pushing it but you'll

How can I use protocol buffers for Python on windows?

浪尽此生 提交于 2019-11-29 09:01:23
问题 I have been trying to use protocol buffers in my Python program, but cannot get it to work. I'm running a Windows 8 machine and have tried Python 2.7.6 and Python 3.3. I downloaded the binary protocol buffer compiler for Python and used it to generate myProto_pb2.py from my myProto.proto file, but when I get the following error when I run my Python program: from the "import myProto_pb2" line, I get the following error when using Python 2.7.6 from protocol buffers version 2.5: from google

Protobuf-Net error message: No Serializer defined for type: System.Type

无人久伴 提交于 2019-11-29 08:39:13
问题 I am getting the following error message when trying to serialize List<Tuple<string, Type, object>> : No Serializer defined for type: System.Type I tried both, just serializing the above collection or serializing a class that has the same collection defined as protoMember. Both result in the same error message. Is this a non-supported type? I assume it is supported and I overlooked something else but maybe I am incorrect? Thanks for any pointers that may help resolve this... 回答1: Edit:

TensorFlow Manual Construction of GraphDef

自古美人都是妖i 提交于 2019-11-29 08:12:48
In TensorFlow, I found that I can do the following, from tensorflow.core import framework from google.protobuf import json_format graph_def = framework.graph_pb2.GraphDef() node_def = framework.node_def_pb2.NodeDef() graph_def.node.extend([node_def]) print json_format.MessageToJson(graph_def) Which prints { "node": [ {} ] } Now, my node is not actually set to an Operation. I can't figure out how to make node_def be an operation. I can construct OpDefs via, from tensorflow.python.ops import gen_array_ops const_op_def = gen_array_ops._InitOpDefLibrary()._ops['Const'].op_def Which is of class

How can we put a variant message ( one of a few message types ) inside a protobuf message?

你。 提交于 2019-11-29 06:30:20
How can we put a variant message ( one of a few message types ) inside a protobuf message? message typeA { .... } message typeB { .... } message typeC { [typeB|typeA] payload; } You need to do it like this: message TypeC { optional TypeA a = 1; optional TypeB b = 2; } If there are a lot of variants, you might also want to add a tag field so that you don't have to check has_*() for each one. This is covered in the Protobuf docs: https://developers.google.com/protocol-buffers/docs/techniques#union PS. This missing feature of Protobufs is fixed in Cap'n Proto , a new serialization system by the

How to add metadata to nodejs grpc call

浪子不回头ぞ 提交于 2019-11-29 05:58:32
I'd like to know how to add metadata to a nodejs grpc function call. I can use channel credentials when making the client with var client = new proto.Document('some.address:8000', grpc.credentials.createInsecure() ) Which are send when using client.Send(doc, callback) , but the go grpc server looks in the call metadata for identification information which I have to set. I tried using grpc.credentials.combineChannelCredentials with the insecure connection and a grpc.Metadata instance but I can't find the right way to do it. The error I run into is TypeError: compose's first argument must be a