protocol-buffers

Java: JSON -> Protobuf & back conversion

让人想犯罪 __ 提交于 2019-11-27 10:47:14
问题 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

Google Protocol Buffers - Storing messages into file

你说的曾经没有我的故事 提交于 2019-11-27 10:16:48
问题 I'm using google protocol buffer to serialize equity market data (ie. timestamp, bid,ask fields). I can store one message into a file and deserialize it without issue. How can I store multiple messages into a single file? Not sure how I can separate the messages. I need to be able to append new messages to the file on the fly. 回答1: I would recommend using the writeDelimitedTo(OutputStream) and parseDelimitedFrom(InputStream) methods on Message objects. writeDelimitedTo writes the length of

How do I get Eclipse to resolve classes generated with Maven 2?

不羁岁月 提交于 2019-11-27 10:01:52
问题 I'm using Google Protocol Buffers to generate some Java classes for my project. Using Maven 2 and its "antrun" plugin, these classes are freshly generated before compile, output to target/generated-sources and put on the classpath during the build. So building the project from the POM is no problem. However, Eclipse doesn't know how to resolve the generated class, because the folder it's in doesn't seem to be on the IDE's classpath during development. I'm using m2eclipse and have it manage

How to write a high performance Netty Client

不打扰是莪最后的温柔 提交于 2019-11-27 09:30:27
问题 I want an extremely efficient TCP client to send google protocol buffer messages. I have been using the Netty library to develop a server/client. In tests the server seems to be able to handle up to 500k transactions per second, without to many problems, but the client tends to peak around 180k transactions per second. I have based my client on the examples provided in the Netty documentation, but the difference is I just want to send the message and forget, I don't want a response (which

How fast or lightweight Is Protocol Buffer?

十年热恋 提交于 2019-11-27 09:25:37
问题 Is Protocol Buffer for .NET gonna be lightweight/faster than Remoting(the SerializationFormat.Binary)? Will there be a first class support for it in language/framework terms? i.e. is it handled transparently like with Remoting/WebServices? 回答1: I very much doubt that it will ever have direct language support or even framework support - it's the kind of thing which is handled perfectly well with 3rd party libraries. My own port of the Java code is explicit - you have to call methods to

Thrift vs Protocol buffers [duplicate]

最后都变了- 提交于 2019-11-27 09:13:02
问题 This question already has an answer here: Biggest differences of Thrift vs Protocol Buffers? 14 answers I've been using PB for quite a while now, but, Thrift has constantly been at the back of my mind. The primary advantages of thrift, as I see it are: Native collections (i.e, vector, set etc) vs PBs repeated providing functionality similar to, but not quite like (no iterators unless you dig into RepeatedField which the documentation states "shouldn't be required in most cases"). A decent RPC

Performance comparison of Thrift, Protocol Buffers, JSON, EJB, other?

风格不统一 提交于 2019-11-27 09:05:33
问题 We're looking into transport/protocol solutions and were about to do various performance tests, so I thought I'd check with the community if they've already done this: Has anyone done server performance tests for simple echo services as well as serialization/deserialization for various messages sizes comparing EJB3, Thrift, and Protocol Buffers on Linux? Primarily languages will be Java, C/C++, Python, and PHP. Update: I'm still very interested in this, if anyone has done any further

TensorFlow saving into/loading a graph from a file

浪子不回头ぞ 提交于 2019-11-27 05:51:33
From what I've gathered so far, there are several different ways of dumping a TensorFlow graph into a file and then loading it into another program, but I haven't been able to find clear examples/information on how they work. What I already know is this: Save the model's variables into a checkpoint file (.ckpt) using a tf.train.Saver() and restore them later ( source ) Save a model into a .pb file and load it back in using tf.train.write_graph() and tf.import_graph_def() ( source ) Load in a model from a .pb file, retrain it, and dump it into a new .pb file using Bazel ( source ) Freeze the

Errors when linking to protobuf 3 on MS Visual C

倖福魔咒の 提交于 2019-11-27 05:29:22
Encountered on Visual Studio 2013 , but it's reproducible with any version. I cloned the protocol buffer library from github, ran CMake-gui on it (I left everything to default, so it's the static version), only built libprotobuf (other project failed for some reason, cmd.exe error, might have something to do with tests, but libprotobuf builds fine). My project uses headers generated with the .proto file found on the mapbox vector tiles spec's github. When I link, I first have this error Error 1 error C4996: 'std::_Copy_impl': Function call with parameters that may be unsafe - this call relies

Google protocol buffers on iOS

随声附和 提交于 2019-11-27 05:15:38
问题 Is the metasyntactic static library for iOS . . . http://code.google.com/p/metasyntactic/wiki/ProtocolBuffers . . . compatible with regular old C++ compiled protofiles? I do not want to use the bundled compiler that generates Obj-C. Is there any way to compile the library supplied by Google for iOS? 回答1: Ok. It appears that the metasyntactic library (or any other 3rd party library) is unnecessary in this case. You can just add the Google source directly to your project. I found the following