protocol-buffers

Protocol Buffer first usage high latency

倖福魔咒の 提交于 2020-01-24 06:58:09
问题 In one of our java applications we have quite a few protocol buffer classes and the jar essentially exposes one interface with one method that is used by another application. We have noticed that the first time this method is called the invocation time is quite high (>500ms) while subsequent calls are much faster (<10ms). At first we assumed this has something to do with our code, however after profiling we could not confirm this. Through process of elimination it became obvious that it has

Protocol Buffers 3: Enums as keys in a map

夙愿已清 提交于 2020-01-24 02:43:05
问题 Enums are not allowed to be used as keys in map. PaxType here is an enum and not allowed to be used as key. enum PaxType { ADULT = 0 ; CHILD = 1 ; INFANT = 2 ; } message FlightData { map<PaxType, FareType> fareType = 1; } 回答1: This is disallowed because it doesn't play well with proto3 open enum semantics. For example, in Java, if you have a Map, the key can only be one of the defined values. If you happen to receive an enum key value from a remote client/server that's not in the defined

Android protobuf nano documentation

烈酒焚心 提交于 2020-01-21 03:35:26
问题 I am trying to reduce the number of methods that are generated by Google proto-buf and one of the alternatives is to use proto-buf nano. However I found no documentation on how to use it. Except the package link, I can't find anything on how to generate java files from proto files using nano. So the question is straight-forward: how to use google proto nano in order to generate java classes from proto files and how to use them in a project? 回答1: Looking at the main protobuf compiler source

Protobuf 2.5.0 bug?

限于喜欢 提交于 2020-01-20 08:29:06
问题 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:

how to use external jars in Cloudera hadoop?

Deadly 提交于 2020-01-15 11:09:32
问题 i have a cloudera hadoop version 4 installed on my cluster. It comes packaged with google protobuffer jar version 2.4. in my application code i use protobuffer classes compiled with protobuffer version 2.5. This causes unresolved compilation problems at run time. Is there a way to run the map reduce jobs with an external jar or am i stuck until cloudera upgrades their service? Thanks. 回答1: Yes you can run MR jobs with external jars. Be sure to add any dependencies to both the HADOOP_CLASSPATH

how to use external jars in Cloudera hadoop?

强颜欢笑 提交于 2020-01-15 11:08:22
问题 i have a cloudera hadoop version 4 installed on my cluster. It comes packaged with google protobuffer jar version 2.4. in my application code i use protobuffer classes compiled with protobuffer version 2.5. This causes unresolved compilation problems at run time. Is there a way to run the map reduce jobs with an external jar or am i stuck until cloudera upgrades their service? Thanks. 回答1: Yes you can run MR jobs with external jars. Be sure to add any dependencies to both the HADOOP_CLASSPATH

Caffe to Tensorflow (Kaffe by Ethereon) : TypeError: Descriptors should not be created directly, but only retrieved from their parent

我怕爱的太早我们不能终老 提交于 2020-01-15 05:49:08
问题 I wanted to use the wonderful package caffe-tensorflow by ethereon and I ran into the same problem described in this closed issue: When I run the example or try to import caffepb I got the error message: >>> import caffepb Traceback (most recent call last): File "<stdin>", line 1, in <module> File "caffepb.py", line 28, in <module> type=None), File "/home/me/anaconda/python2.7/site-packages/google/protobuf/descriptor.py", line 652, in __new__ _message.Message._CheckCalledFromGeneratedFile()

how to build protocol buffer for iOS7?

不问归期 提交于 2020-01-14 14:55:28
问题 I want to rebuild protocol buffer staticlib in xcode5 , download protocol buffer in http://code.google.com/p/protobuf/downloads/list use autogen.sh , I get a configure file, can make and install on mac, I write a shell script try to build glib for iOS, as blow : export ARCH=arm-apple-darwin10 export ARCH_PREFIX=${ARCH}- export PLATFORM=iPhoneOS export SDKVER=7.0 export DEVROOT=/Applications/Xcode.app/Contents/Developer/Platforms/${PLATFORM}.platform/Developer export SDKROOT="$DEVROOT/SDKs/$

Crash when parsing protobuf message containing a string using C++ and Android NDK

北战南征 提交于 2020-01-14 13:27:09
问题 I have two programs, both running on an Android 2.3.4 platform - one is a C++ binary in a daemon form, compiled with cmake, the other is a apk with jni part compiled with ndk-build. I'm using android-ndk-r6. I'm using protobuf messages and local unix sockets to pass data between them. I'm using the SerializeAsString and ParseFromString methods. Here is a snippet AbstractMessage protobuff_msg; protobuff_msg.set_id ( 1 ); //TODO: for now hardcoded, later can be used for request-response pairs

Reading a protobuf3 custom option from C#

為{幸葍}努か 提交于 2020-01-14 09:38:07
问题 TL;DR According to the doc, if I were doing C++, I could read the value of a custom option using string value = MyMessage::descriptor()->options().GetExtension(my_option); . There are similar examples for Java and Python. But I'm doing C# and I could find an equivalent. Can I do it, and if yes, how? More details I'm manipulating classes generated with protobuf3. The schemas are declaring a custom option. It looks like this: import "google/protobuf/descriptor.proto"; extend google.protobuf