protocol-buffers

Protocol buffers for JavaScript?

让人想犯罪 __ 提交于 2019-11-30 01:42:36
Is there a way to do protocol buffers in JavaScript? Why for .js? If you think about sciencey requirements for a moment, situations pop up where you might want to send a large block of data to the client. With CRUD-style it doesn't really matter so much what you use. With sciencey stuff it does matter (at least I think it does). tradeoffs: protobuffs balances compactness, serialize and deserialize speeds well. text based protocols (xml / json) have a larger message size... but with javascript I wonder which is more effective. reference: code.google.com/p/protobuf-plugin-closure Google Protocol

Google's Protocol Buffers in c#

ε祈祈猫儿з 提交于 2019-11-30 01:16:18
问题 We are looking at using Google's Protocol Buffers to handle serialization between a c++ application and a c# application via networking. My question is, I've found a couple of different verisions for c#. Both look pretty good, however, does anyone know what is different (if anything) between the two protobuf-net jskeet / dotnet-protobufs 回答1: Sure; dotnet-protobufs is a port of the java version, so shares a very similar API and approach to the core google implementation; code-gem,

Java: JSON -> Protobuf & back conversion

大兔子大兔子 提交于 2019-11-29 23:18:35
I have an existing system, which is using protobuf-based communication protocol between GUI and server. Now I would like to add some persistence, but at the moment protobuf messages are straight converted to a third-party custom objects. Is there a way to convert proto messages to json , which could be then persisted to database. N.B.: I don't much like an idea of writing binary protobuf to database, because it can one day become not backward-compatible with newer versions and break the system that way. We are currently using protobuf-java-format to convert our Protobuf messages (anything

CMake and FindProtobuf

柔情痞子 提交于 2019-11-29 23:16:10
I'm using the FindProtobuf module in a project where the protocol buffer files are in a sub-directory. I want the CMakeLists.txt file in that sub-directory to invoke protoc to generate the CPP Files. My project folder structure is like this: cammy/CMakeLists.txt # Root CMakeLists.txt cammy/protofiles/test.proto # protofile cammy/protofiles/CMakeLists.txt I have the include(FindProtobuf), the find_package invocation and the call to PROTOBUF_GENERATE_CPP in the CMakeLists.txt file in protobuf folder. The executable build step is in the Root CMakeLists.txt file and I add the generated files to

What is the correct Protobuf content type?

爱⌒轻易说出口 提交于 2019-11-29 22:47:00
JSON has application/json as a standard. For protobuf some people use application/x-protobuf , but I saw something as odd as application/vnd.google.protobuf being proposed. Do we have an RFC or some other standard that I can use as a reference for this? There's an expired IETF proposal that suggests application/protobuf . It does not address the question how the receiving side could determine the particular message type. Previous discussions suggested using a parameter to specify package and message, e.g. application/protobuf; proto=org.some.Message In practice, the types you listed seem to be

Importing “google/protobuf/descriptor.proto” in java protocol buffers

陌路散爱 提交于 2019-11-29 20:08:59
问题 I have a .proto file definition which needs to import "google/protobuf/descriptor.proto" because I use Custom Options. So in my .proto file I do: import "google/protobuf/descriptor.proto"; package ...; ... Since my file didn't compile complaining about the dependency, I got a copy of the descriptor.proto file placing it in the same directory my proto file was. This solved the problem but I don't believe this is the correct way. Now the descriptor.proto gets compiled together with my .proto

Copy a std::vector to a repeated field from protobuf with memcpy

。_饼干妹妹 提交于 2019-11-29 18:56:45
问题 At first I have this simple protobuf file message messagetest { ... repeated float samples = 6; .... } Which creates a headerfile with this methods //repeated float samples = 6; inline int samples_size() const; inline void clear_samples(); static const int kSamplesFieldNumber = 6; inline float samples(int index) const; inline void set_samples(int index, float value); inline void add_samples(float value); inline const ::google::protobuf::RepeatedField< float >& samples() const; inline ::google

Installing Google Protocol Buffers on mac

荒凉一梦 提交于 2019-11-29 18:45:38
I would like to install the older version of Google Protocol Buffers (protobuf-2.4.1) on mac using Terminal command line. I tried with brew install protobuf , but the latest version 2.5.0 has been installed. Is it possible to install the older version from terminal. Thanks There are some issues with building protobuf 2.4.1 from source on a Mac. There is a patch that also has to be applied. All this is contained within the homebrew protobuf241 formula, so I would advise using it. To install protocol buffer version 2.4.1 type the following into a terminal: brew tap homebrew/versions brew install

Protocol Buffers versus JSON or BSON

故事扮演 提交于 2019-11-29 18:42:00
Does anyone have any information on the performance characteristics of Protocol Buffers versus BSON (binary JSON) or versus JSON in general? Wire size Serialization speed Deserialization speed These seem like good binary protocols for use over HTTP. I'm just wondering which would be better in the long run for a C# environment. Here's some info that I was reading on BSON and Protocol Buffers . Michael Greene Thrift is another Protocol Buffers-like alternative as well. There are good benchmarks from the Java community on serialization/deserialization and wire size of these technologies: https:/

why protocol buffer bytes is string in c++?

余生长醉 提交于 2019-11-29 17:12:05
问题 protocol buffer say it can contain any arbitrary sequence of bytes. but if my data contain '\0' ,how protocol buffer can encode my whole data from a string variable. 回答1: The C++ implementation of protocol buffers returns the byte and string types as std::string . This structure contains a length function telling you how long the corresponding data is (as well as the data itself.) Thus there is no special significance of embeded \0 characters. The setting functions accept a string too, or