Re: [protobuf] Re: 2.4 release?

2010-11-02 Thread Pherl Liu
It's on the SVN head now, see
http://code.google.com/p/protobuf/source/detail?r=349
Will make a release candidate soon.

On Wed, Nov 3, 2010 at 1:02 AM, Zachary Turner wrote:

> Just wanted to follow up on this and see if this is still on target to
> be released within a month or so, and still include a beta of the
> python C++ work.
>
> Thanks,
> Zach
>
> On Sep 14, 11:28 am, Kenton Varda  wrote:
> > Petar mostly finished this work, but then left the company.  We're trying
> to
> > tie up the loose ends so that we can get it out, but everyone is pretty
> > busy.  We'll probably do 2.4.0 within a month or two as we have a new
> team
> > member who needs to learn the release process, and it should at least
> > include a beta of this work.
> >
> > On Tue, Sep 14, 2010 at 10:36 AM, Zachary Turner <
> divisorthe...@gmail.com>wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Reading through old threads, I found one that said that the next
> > > release would probably include Petar's python wrapper for native C++
> > > protobufs, greatly increasing speed of protubufs when calling from
> > > Python.
> >
> > > Another post mentioned that this was expected to be done sometime this
> > > summer.
> >
> > > Now that summer has come and gone, does anyone have an update about
> > > when this release might be ready?  We're considering re-inventing a
> > > python / C++ wrapper just because the performance is such a blocker on
> > > what we're working on at the moment, but given how long it's been in
> > > the works, it seems like it's such a black hole of work that we're
> > > going to embark on, whereas the magic hammer solution might only just
> > > around the corner.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Protocol Buffers" group.
> > > To post to this group, send email to proto...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > protobuf+unsubscr...@googlegroups.com
> 
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/protobuf?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: 2.4.0 release candidate #1

2011-01-05 Thread Pherl Liu
You can try:

InfoClass.Builder builder = info.toBuilder();
builder.getKeyBuilder().getPrivateBuilder().setD(ByteString.copyFrom(decryptedPrivateKey));
info = builder.build();

On Thu, Jan 6, 2011 at 5:06 AM, Scratch  wrote:

> Hi there!
> I've seen that there're new sub-builders for sub-messages (Java) but
> couldn`t figure out how to use them properly. My task is to replace a
> single field in a message and right now I solve it like this:
>
> //replace encrypted key with decrypted one
> info =
>
> info.toBuilder().setKey(info.getKey().toBuilder().setPrivate(ECPrivateKey.newBuilder().setD(ByteString.copyFrom(decryptedPrivateKey)).build()).build()).build();
>
> which looks pretty ugly to me.
> Will new sub-builders help me in this situation?
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] 2.4.0 not compiling lite version for Java

2011-01-27 Thread Pherl Liu
Thanks for reporting this. Working on a fix now.

On Thu, Jan 27, 2011 at 4:12 AM, Michael  wrote:

> Using the normal mvn package/install commands, the size of the jar
> files generated by Maven for 2.4.0 is identical for the normal and
> lite versions.  This is not true under 2.3.0.  Also, I can't get the
> "mvn test -P lite" command to work for 2.4.0 without first running
> "mvn test".  Under 2.3.0, I can directly run "mvn test -P lite" and
> get a successful test run.
>
> Generated using "mvn package {-P lite}"
> $ ls -lah java/target/protobuf*
> -rw-r--r--  1 molson  staff58K Jan 26 12:01 java/target/protobuf-
> java-2.3.0-lite.jar
> -rw-r--r--  1 molson  staff   321K Jan 26 12:01 java/target/protobuf-
> java-2.3.0.jar
> $ cd ../protobuf-2.4.0/
> $ ls -lah java/target/protobuf*
> -rw-r--r--  1 molson  staff   439K Jan 26 11:52 java/target/protobuf-
> java-2.4.0-lite.jar
> -rw-r--r--  1 molson  staff   439K Jan 26 11:53 java/target/protobuf-
> java-2.4.0.jar
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] 2.4.0 not compiling lite version for Java

2011-01-27 Thread Pherl Liu
There are actually 2 issues here. One is a known issue
http://code.google.com/p/protobuf/issues/detail?id=203 (when the lite
version is built *after* the full version without cleaning in between)
The other is 2.4.0 release problem, fixed in svn now. Will have another
micro release to fix it. You can update the pom.xml with this one:
http://protobuf.googlecode.com/svn-history/r373/trunk/java/pom.xml

Thanks.

On Thu, Jan 27, 2011 at 10:12 PM, Pherl Liu  wrote:

> Thanks for reporting this. Working on a fix now.
>
>
> On Thu, Jan 27, 2011 at 4:12 AM, Michael  wrote:
>
>> Using the normal mvn package/install commands, the size of the jar
>> files generated by Maven for 2.4.0 is identical for the normal and
>> lite versions.  This is not true under 2.3.0.  Also, I can't get the
>> "mvn test -P lite" command to work for 2.4.0 without first running
>> "mvn test".  Under 2.3.0, I can directly run "mvn test -P lite" and
>> get a successful test run.
>>
>> Generated using "mvn package {-P lite}"
>> $ ls -lah java/target/protobuf*
>> -rw-r--r--  1 molson  staff58K Jan 26 12:01 java/target/protobuf-
>> java-2.3.0-lite.jar
>> -rw-r--r--  1 molson  staff   321K Jan 26 12:01 java/target/protobuf-
>> java-2.3.0.jar
>> $ cd ../protobuf-2.4.0/
>> $ ls -lah java/target/protobuf*
>> -rw-r--r--  1 molson  staff   439K Jan 26 11:52 java/target/protobuf-
>> java-2.4.0-lite.jar
>> -rw-r--r--  1 molson  staff   439K Jan 26 11:53 java/target/protobuf-
>> java-2.4.0.jar
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To post to this group, send email to protobuf@googlegroups.com.
>> To unsubscribe from this group, send email to
>> protobuf+unsubscr...@googlegroups.com
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/protobuf?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] 2.4.0 release?

2011-01-27 Thread Pherl Liu
It isn't officially announced yet, but the files are on the site, feel free
to try it out. We are still working on the documentation. The final release
would be very soon.

On Thu, Jan 27, 2011 at 4:17 AM, CB  wrote:

> I'm considering updating from 2.3.0 to 2.4.0, but it seems 2.4.0 isn't
> final, yet?  Can you comment on how stable the build is, and when it
> might become a formal release?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] 2.4.0a released.

2011-02-02 Thread Pherl Liu
The final release of 2.4.0a Protobuf is uploaded:
http://code.google.com/p/protobuf/downloads/list

Note that 2.4.0a fixed a java protobuf-lite build problem in 2.4.0. If you
are using the 2.4.0 version, please upgrade to 2.4.0a (the only diff is the
java protobuf-lite problem).

Documentation updates should be live within a day.

Special thanks to Kenton Varda for the support and help.

2011-02-02 version 2.4.0:

  General
  * The RPC (cc|java|py)_generic_services default value is now false instead
of
true.
  * Custom options can have aggregate types. For example,
  message MyOption {
optional string comment = 1;
optional string author = 2;
  }
  extend google.protobuf.FieldOptions {
optional MyOption myoption = 12345;
  }
This option can now be set as follows:
  message SomeType {
optional int32 field = 1 [(myoption) = { comment:'x' author:'y' }];
  }

  C++
  * Various speed and code size optimizations.
  * Added a release_foo() method on string and message fields.
  * Fixed gzip_output_stream sub-stream handling.

  Java
  * Builders now maintain sub-builders for sub-messages. Use getFooBuilder()
to
get the builder for the sub-message "foo". This allows you to repeatedly
modify deeply-nested sub-messages without rebuilding them.
  * Builder.build() no longer invalidates the Builder for generated messages
(You may continue to modify it and then build another message).
  * Code generator will generate efficient equals() and hashCode()
implementations if new option java_generate_equals_and_hash is enabled.
(Otherwise, reflection-based implementations are used.)
  * Generated messages now implement Serializable.
  * Fields with [deprecated=true] will be marked with @Deprecated in Java.
  * Added lazy conversion of UTF-8 encoded strings to String objects to
improve
performance.
  * Various optimizations.
  * Enum value can be accessed directly, instead of calling getNumber() on
the
enum member.
  * For each enum value, an integer constant is also generated with the
suffix
_VALUE.

  Python
  * Added an experimental  C++ implementation for Python messages via a
Python
extension. Implementation type is controlled by an environment variable
PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION (valid values: "cpp" and
"python")
The default value is currently "python" but will be changed to "cpp" in
future release.
  * Improved performance on message instantiation significantly.
Most of the work on message instantiation is done just once per message
class, instead of once per message instance.
  * Improved performance on text message parsing.
  * Allow add() to forward keyword arguments to the concrete class.
  E.g. instead of
item = repeated_field.add()
item.foo = bar
item.baz = quux
  You can do:
repeated_field.add(foo=bar, baz=quux)
  * Added a sort() interface to the BaseContainer.
  * Added an extend() method to repeated composite fields.
  * Added UTF8 debug string support.

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] v2.4 question

2011-02-02 Thread Pherl Liu
2.4.0a is officially released now.

Please check:
http://code.google.com/p/protobuf/downloads/list

On Wed, Feb 2, 2011 at 3:12 AM, David Dabbs  wrote:

> Hello.
>
>
>
> From what I gather catching up on list messages, 2.4 is final, but not
> officially released, perhaps because some documentation is in the works.
>
> I ask because I would like to incorporate 2.4 in my product’s upcoming
> build cycle, but only if there is reasonable certainty that the bits won’t
> change (or will change very little) and that it will be officially released
> in, say, six weeks.
>
> Are these reasonable assumptions?
>
>
>
> Thanks,
>
>
>
> David
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com
> .
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Protobuf 2.4 and Android

2011-02-04 Thread Pherl Liu
The protobuf in android source code is a branched protobuf for google voice,
which is not intended for public use, and may change in the future.
Generally, you should use the opensource version of protobuf in your app,
set the "option optimize_for = "LITE_RUNTIME";" in your proto file and use
the protobuf-lite library.

On Thu, Feb 3, 2011 at 3:52 PM, pprados  wrote:

> Hello,
>
> With Android source code, we can find a specific version of Protobuf.
> The version 2.4 is it compatible with Android ?
> What is the best approch to use a lite and optimized version,
> parameter, options of Protobuf with Android ?
>
> Regards
>
> Philippe
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Circular package import problem

2011-02-07 Thread Pherl Liu
You probably need to break up your proto files to eliminate the circular
dependency.. (i.e. have multiple .proto files for a package, and only import
necessary .proto files).

On Mon, Feb 7, 2011 at 5:42 PM, Ken  wrote:

> Hi,
>
> I have two proto files: A.proto and B.proto. If I import package B in
> A and import A in B, I got StackOverFlow exception during compiling.
> Does anyone know any sulotion for it?
>
> Thanks,
>
> Ken
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: Compilation error for ppc/440 target

2011-02-09 Thread Pherl Liu
A workaround is now in svn:
http://code.google.com/p/protobuf/source/detail?r=380
Could you please try patch the diff to check if that fixes the problem?

Thanks.

On Fri, Feb 4, 2011 at 11:06 PM, dear chap  wrote:

> Unfortunately we have to use the particular compiler in question and
> cannot upgrade. Is the
> DescriptorBuilder::OptionInterpreter::AggregateOptionFinder new code ?
> I dont see this problem with protobuf-2.3.0.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] About "import"

2011-03-03 Thread Pherl Liu
Right. Please see the document in
http://code.google.com/apis/protocolbuffers/docs/proto.html

The protocol compiler searches for imported files in a set of directories
specified on the protocol compiler command line using the
-I/--proto_pathflag. If no flag was given, it looks in the directory
in which the compiler
was invoked. In general you should set the --proto_path flag to the root of
your project and use fully qualified names for all imports.

On Thu, Mar 3, 2011 at 7:36 AM, ZHOU Xiaobo  wrote:

> I can't use "import ../other_path/xx.proto".
> It seems that the 'import' instruction doesn't search files out of
> 'ptoto_path'
>
> thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] python/setup.py

2011-03-24 Thread Pherl Liu
I'm a bit concerned about setting arbitrary proto compiler via
environment variables. Protobuf runtime library requires exactly
matching protoc generated classes to work. Separating the protoc and
library potentially increased the risk of having incompatibility
errors. Not sure if this would bring security issues though.

Maybe you can write a wrapper script to symbol link the correct protoc
in your environment.

On Wed, Mar 23, 2011 at 8:36 AM, cmas...@chromium.org
 wrote:
> Hello!  I'm a developer on Chromium OS, and we recently (today) started
> needing to build the protocol buffers with python support enabled in our
> cross-compilation environment.  Passing --with-protoc to ./configure got me
> partway there, but then when it tried to run "python setup.py build", it got
> intro trouble.  Turns out there's logic in setup.py to go looking for the
> protoc that was just compiled.  In a cross-compile situation, that won't
> work :-/  I've got a patch to allow the desired protoc to be overridden by
> an environment variable:
> diff -Naur protobuf-2.3.0-orig/python/setup.py
> protobuf-2.3.0/python/setup.py
> --- protobuf-2.3.0-orig/python/setup.py 2011-03-22 16:33:33.0 -0700
> +++ protobuf-2.3.0/python/setup.py 2011-03-22 17:01:14.0 -0700
> @@ -16,7 +16,9 @@
>  maintainer_email = "protobuf@googlegroups.com"
>
>  # Find the Protocol Compiler.
> -if os.path.exists("../src/protoc"):
> +if 'PROTOC' in os.environ and os.path.exists(os.environ['PROTOC']):
> +  protoc = os.environ['PROTOC']
> +elif os.path.exists("../src/protoc"):
>    protoc = "../src/protoc"
>  elif os.path.exists("../src/protoc.exe"):
>    protoc = "../src/protoc.exe"
> Is such an approach acceptable?  How would I go about getting this patch
> committed?
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] python/setup.py

2011-03-24 Thread Pherl Liu
OK, it turns out we will use whatever "protoc" in the PATH as a fail
over. This change is probably fine then.

Sent you a code review. Also add a warning message if the protoc is
set via env variable.

On Thu, Mar 24, 2011 at 5:48 PM, Pherl Liu  wrote:
> I'm a bit concerned about setting arbitrary proto compiler via
> environment variables. Protobuf runtime library requires exactly
> matching protoc generated classes to work. Separating the protoc and
> library potentially increased the risk of having incompatibility
> errors. Not sure if this would bring security issues though.
>
> Maybe you can write a wrapper script to symbol link the correct protoc
> in your environment.
>
> On Wed, Mar 23, 2011 at 8:36 AM, cmas...@chromium.org
>  wrote:
>> Hello!  I'm a developer on Chromium OS, and we recently (today) started
>> needing to build the protocol buffers with python support enabled in our
>> cross-compilation environment.  Passing --with-protoc to ./configure got me
>> partway there, but then when it tried to run "python setup.py build", it got
>> intro trouble.  Turns out there's logic in setup.py to go looking for the
>> protoc that was just compiled.  In a cross-compile situation, that won't
>> work :-/  I've got a patch to allow the desired protoc to be overridden by
>> an environment variable:
>> diff -Naur protobuf-2.3.0-orig/python/setup.py
>> protobuf-2.3.0/python/setup.py
>> --- protobuf-2.3.0-orig/python/setup.py 2011-03-22 16:33:33.0 -0700
>> +++ protobuf-2.3.0/python/setup.py 2011-03-22 17:01:14.0 -0700
>> @@ -16,7 +16,9 @@
>>  maintainer_email = "protobuf@googlegroups.com"
>>
>>  # Find the Protocol Compiler.
>> -if os.path.exists("../src/protoc"):
>> +if 'PROTOC' in os.environ and os.path.exists(os.environ['PROTOC']):
>> +  protoc = os.environ['PROTOC']
>> +elif os.path.exists("../src/protoc"):
>>    protoc = "../src/protoc"
>>  elif os.path.exists("../src/protoc.exe"):
>>    protoc = "../src/protoc.exe"
>> Is such an approach acceptable?  How would I go about getting this patch
>> committed?
>> Thanks!
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To post to this group, send email to protobuf@googlegroups.com.
>> To unsubscribe from this group, send email to
>> protobuf+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/protobuf?hl=en.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: How to Programmatically determine the Builder method names (getter and setter) for a given field name

2011-03-24 Thread Pherl Liu
You can find the algorithm in source code.
http://code.google.com/p/protobuf/source/browse/trunk/src/google/protobuf/compiler/java/java_helpers.cc

On Wed, Mar 16, 2011 at 2:42 PM, Ravi  wrote:
> Hi Thanks a lot for your time.
>
> Yes the approach looks very clean as the api getField and setField are
> in built. I think we would go with this approach.
>
> But i am just curious to know whether protobuf published anywhere the
> algorithm for deriving getter and setter method names.
>
> Thanks,
> Ravikumar K
>
> On Mar 15, 3:09 pm, Dmitriy Ryaboy  wrote:
>> We needed to do something similar for our project "Elephant-Bird" that
>> provides support for working with Protocol Buffers in Hadoop.
>>
>> Protobufs have Descriptors that allow you to determine all of these things
>> on the fly, without encoding method naming rules and such.
>>
>> Here is the relevant snippet 
>> fromhttps://github.com/kevinweil/elephant-bird/blob/master/src/java/com/t...
>>
>> public static Message addField(Message m, String name, Object value) {
>>     Message.Builder builder = m.toBuilder();
>>     setFieldByName(builder, name, value);
>>     return builder.build();
>>
>> }
>>
>> public static void setFieldByName(Message.Builder builder, String
>> name, Object value) {
>>     FieldDescriptor fieldDescriptor =
>> builder.getDescriptorForType().findFieldByName(name);
>>     if (value == null) {
>>       builder.clearField(fieldDescriptor);
>>     } else {
>>       builder.setField(fieldDescriptor, value);
>>     }
>>   }
>> *
>> *
>>
>> On Tue, Mar 15, 2011 at 2:19 AM, Ravi  wrote:
>> > Hi,
>>
>> > We would like to know how to determine the getter and setter method
>> > names generated in java builder class for a particular field defined
>> > in proto message.
>>
>> > Of course, the simple rule says that
>> > * Convert first letter of the field name to upper case
>> > * prefix "get" or "set" to the field name
>>
>> > But we want to know all the cases considered while generating builder
>> > class.
>> > Like what are the special characters considered? what are the
>> > exceptional cases?
>>
>> > Why we want this is,
>> > In our framework we would be programmatically generating proto files
>> > from the xsds which we have already.
>>
>> > Along with this we would be generating an adapter class between our
>> > framework and the java class generated by protoc compiler.
>>
>> > This adapter would call getter and setter methods of the builder class
>> > available in the builder class to retrieve the value and to build the
>> > object.
>>
>> > Any help would be appreciated.
>>
>> > Thanks,
>> > Ravikumar K
>>
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "Protocol Buffers" group.
>> > To post to this group, send email to protobuf@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > protobuf+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> >http://groups.google.com/group/protobuf?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to 
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Android Cross Compile

2011-03-24 Thread Pherl Liu
Looks like pthread library is missing. This should have been covered
by the acx_pthread.m4 script. Could you please try to manually run the
linker(the g++ line you pasted in email), by adding extra -pthread
and/or -lpthread parameters?

On Thu, Mar 10, 2011 at 3:42 AM, Evol  wrote:
> Hello,
>
> I am attempting to cross-compile the libprotobuf library so I can use
> it on native android c/c++ code. Due to the ues of bionic as the
> android libc, I am getting the following error when I do a make.
>
>  libtool: link: g++ -Wall -Wwrite-strings -Woverloaded-virtual -Wno-
> sign-compare -O2 -g -DNDEBUG -o .libs/protoc main.o  ./.libs/
> libprotobuf.so ./.libs/libprotoc.so -lz -Wl,-rpath -Wl,/usr/local/
> android/lib
> ./.libs/libprotobuf.so: undefined reference to `pthread_once'
>
> I am using the standalone compiler that comes with the NDK.  Thanks in
> advance for any help.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to 
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Android Cross Compile

2011-03-24 Thread Pherl Liu
Please also take a look at the config.log file, generated after
running ./configure, in the project root directory; search for
"checking for pthreads library"
"checking whether pthreads work without any flags"
There should be a line, after debug info, saying "result: no" or "result: yes"
>From your error message, it seems android NDK doesn't require any
flags to link pthread...

On Thu, Mar 24, 2011 at 8:31 PM, Pherl Liu  wrote:
> Looks like pthread library is missing. This should have been covered
> by the acx_pthread.m4 script. Could you please try to manually run the
> linker(the g++ line you pasted in email), by adding extra -pthread
> and/or -lpthread parameters?
>
> On Thu, Mar 10, 2011 at 3:42 AM, Evol  wrote:
>> Hello,
>>
>> I am attempting to cross-compile the libprotobuf library so I can use
>> it on native android c/c++ code. Due to the ues of bionic as the
>> android libc, I am getting the following error when I do a make.
>>
>>  libtool: link: g++ -Wall -Wwrite-strings -Woverloaded-virtual -Wno-
>> sign-compare -O2 -g -DNDEBUG -o .libs/protoc main.o  ./.libs/
>> libprotobuf.so ./.libs/libprotoc.so -lz -Wl,-rpath -Wl,/usr/local/
>> android/lib
>> ./.libs/libprotobuf.so: undefined reference to `pthread_once'
>>
>> I am using the standalone compiler that comes with the NDK.  Thanks in
>> advance for any help.
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To post to this group, send email to protobuf@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> protobuf+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/protobuf?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Java: Protobuf jars compatibility (2.4.0 with 2.0.3)

2011-04-07 Thread Pherl Liu
No, there's no version backward-compatibility like this. protobuf library
only works with the matching protoc generated files.
There's a feature
requestasking
for reporting errors when the protoc & runtime library versions don't
match.

On Sat, Apr 2, 2011 at 3:16 AM, Blackbird  wrote:

> Hi,
>
> After finishing our project using latest protobuf-java-2.4.0a jar and
> corresponding protoc compiler, we came to know that there are usages
> of protobuf-2.0.3.jar (which is older) in our system. So, now it turns
> only one of these jars can exists.
>
> Can you guys let me know whether there will be any problem when the
> old jar is replaced with new 2.4.0a jar?
>
> I agree that I have test the behavior anyway, still I would like to
> know whether Google Protocol Buffers officially support this version
> backward-comaptibility?
>
> Thanks,
> {"name": "blackbird"}
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Search inside a protocolbuffers file

2011-04-07 Thread Pherl Liu
protobuf officially does not provide this function. There might be some 3rd
party libraries though.

On Thu, Apr 7, 2011 at 4:38 PM, Sankar  wrote:

> Hi,
>
> I am trying to use protocolbuffers as a storage database for my
> application, as it provides data-format-versioning which is not
> available in other storage options such as sqlite. However, I want to
> know if there is a way we can search inside a protocolbuffers file
> (like a select query with WHERE clause on a sqlite db). Can someone
> help me with this ?
>
> Please CC me in the replies. Thanks.
>
> Sankar
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Search inside a protocolbuffers file

2011-04-19 Thread Pherl Liu
We only have auto-generated API docs.
http://code.google.com/apis/protocolbuffers/docs/reference/cpp/index.html
BTW, to implement such a database, you can actually build it using protobuf
APIs. Probably don't need to dig into protobuf implementations.

On Tue, Apr 19, 2011 at 7:28 PM, Sankar P wrote:

> On Thu, Apr 7, 2011 at 8:07 PM, Sankar P 
> wrote:
> > On Thu, Apr 7, 2011 at 3:06 PM, Pherl Liu  wrote:
> >> protobuf officially does not provide this function. There might be some
> 3rd
> >> party libraries though.
> >>
> >
> > I did a search and could not find any. Have you (or anyone in the
> > list) come across any such tools/libraries ? If I am ready to
> > implement it, what will be the best place to begin understanding about
> > the protocolbuffer ? The google code page seem to contain links which
> > are more suited for consumers of protocolbuffers than the
> > architecture/implementation of it. Any help is appreciated. Thanks.
> >
>
>
> Any pointers to such documents ? I checked out the protocolbuffers
> sources. But I could not find any docs on the file-format.
>
> Also, are there any known tools to synchronize protocol buffers
> between two places ? (Say I am storing my browser history in
> protocolbuffers and synchronizing it with a server)
>
> Thanks for any help.
>
> >
> >> On Thu, Apr 7, 2011 at 4:38 PM, Sankar 
> wrote:
> >>>
> >>> Hi,
> >>>
> >>> I am trying to use protocolbuffers as a storage database for my
> >>> application, as it provides data-format-versioning which is not
> >>> available in other storage options such as sqlite. However, I want to
> >>> know if there is a way we can search inside a protocolbuffers file
> >>> (like a select query with WHERE clause on a sqlite db). Can someone
> >>> help me with this ?
> >>>
> >>> Please CC me in the replies. Thanks.
> >>>
> >>> Sankar
> >>>
> >>> --
> >>> You received this message because you are subscribed to the Google
> Groups
> >>> "Protocol Buffers" group.
> >>> To post to this group, send email to protobuf@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> protobuf+unsubscr...@googlegroups.com.
> >>> For more options, visit this group at
> >>> http://groups.google.com/group/protobuf?hl=en.
> >>>
> >>
> >>
> >
> >
> >
> > --
> > Sankar P
> > http://psankar.blogspot.com
> >
>
>
>
> --
> Sankar P
> http://psankar.blogspot.com
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: Issue 270 in protobuf: Precompiled protoc binary for OS X

2011-04-21 Thread Pherl Liu
This is due to the gcc 3.x bug. A workaround is submitted in svn
r380.
You can use svn head version, or patch the r380, or wait for the coming
2.4.1 release (soon).

On Fri, Apr 22, 2011 at 2:19 AM, Inderjeet Singh  wrote:

> I have OSX 10.5 and Xcode 3 installed.
>
> I followed the following instructions from README.txt (for Unix
> systems):
>  $ ./configure
>  $ make
>
> make fails with the error I listed above. Are there instructions
> specific to Mac OS?
>
> Thanks
> Inder
>
>
> On Apr 20, 11:45 am, Peter Ondruska  wrote:
> > I have OSX 10.6 and built with Xcode 3 and 4 with no problems. Did you
> > readme.txt?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: Issue 270 in protobuf: Precompiled protoc binary for OS X

2011-04-21 Thread Pherl Liu
Also, you can upgrade your gcc to 4.3+ if possible.

On Fri, Apr 22, 2011 at 11:58 AM, Pherl Liu  wrote:

> This is due to the gcc 3.x bug. A workaround is submitted in svn 
> r380<http://code.google.com/p/protobuf/source/detail?r=380>.
> You can use svn head version, or patch the r380, or wait for the coming
> 2.4.1 release (soon).
>
>
> On Fri, Apr 22, 2011 at 2:19 AM, Inderjeet Singh wrote:
>
>> I have OSX 10.5 and Xcode 3 installed.
>>
>> I followed the following instructions from README.txt (for Unix
>> systems):
>>  $ ./configure
>>  $ make
>>
>> make fails with the error I listed above. Are there instructions
>> specific to Mac OS?
>>
>> Thanks
>> Inder
>>
>>
>> On Apr 20, 11:45 am, Peter Ondruska  wrote:
>> > I have OSX 10.6 and built with Xcode 3 and 4 with no problems. Did you
>> > readme.txt?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To post to this group, send email to protobuf@googlegroups.com.
>> To unsubscribe from this group, send email to
>> protobuf+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/protobuf?hl=en.
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Reusing builders. . .

2011-04-24 Thread Pherl Liu
You might want to have a benchmark for this. Allocation in Java is cheap,
but would increase the GC costs; resetting builder will introduce some CPU
overhead (recursively setting data members and bit masks).

On Fri, Apr 22, 2011 at 6:15 AM, David Dabbs  wrote:

> Hello.
>
> I have a PB builder I build and write to a stream from a servlet-based
> webapp thousands of times/second.
> Something like the following
>
>   Protos.Response.Builder respBuilder =
> Protos.Response.newBuilder().setFoo(12).setBar(345);  // etc. . .
>   Protos.Response response = respBuilder.build();
>   response.writeTo(getHttpRes().getOutputStream());
>
> Would there be any performance advantage to having a ThreadLocal builder I
> reset before processing each request?
>
>
> Thank you,
> David
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: adding submessages to higher message

2011-04-24 Thread Pherl Liu
Yes, you should use AddAllocated() in this case. Noted that the ownership of
the object will be passed to the wrapper proto.

On Thu, Apr 21, 2011 at 7:12 AM, Aaron Rich  wrote:

> I found the method:
> AddAllocated(Element*)
>
> which I think will add the Pong* that I have already created/allocated
> myself.
>
> Any input if there is a better method then this to use would be
> appreciated.
>
> Thanks.
>
> -Aaron
>
> On Wed, Apr 20, 2011 at 4:25 PM, Aaron Rich  wrote:
> > New to protoco buffers so sorry if this is a simple/stupid question.
> >
> > I have a proto:
> > message WrapperMessage
> > {
> >enum Type {
> >PING   = 1;
> >PONG   = 2;
> >}
> >
> >message Header{
> >required Type   type = 1;
> >required string source = 2;
> >required int64  time = 3;
> >}
> >
> >required TIMIHeader header = 1;
> >repeated Ping ping= 2;
> >repeated Pong pong= 3;
> >extensions 500 to max;
> > }
> >
> > message Pong
> > {
> >  optional int32 count =1;
> >  optional string message = 2;
> > }
> >
> > message Ping
> > {
> >  optional int32 count =1;
> >  optional string message = 2;
> > }
> >
> >
> > I need the wrapper so that I can send multiple other message types
> > over a single udp datastream. I was going to make a message factory to
> > generate the Ping and Pong messages:
> > Pong* pong = myFactory->createPong("Hello");
> >
> > How can I add this Pong message now to a wrapper? I want to be able to
> > use the factory so I can generate several Pong messages at once to
> > pack together in a single WrapperMessage before sending. I only see
> > that calling:
> > WrapperMessage.add_pong()
> >
> > will give me a Pong* back. But then I either have to merge that will
> > my factory message or pass it to factory to populate.
> >
> > Any suggestions of better way to do this (or improve my proto design)?
> >
> > Thanks.
> >
> > -Aaron
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] mvn test failing

2011-04-27 Thread Pherl Liu
Looks like a classpath problem for the easy mock..  Could you please double
check if net.sf.cglib.proxy.Enhancer is installed and set in the classpath
of your environment?

On Thu, Apr 28, 2011 at 3:40 AM, danbaatar  wrote:

> I am trying to compile version 2.3.0 (for compatibility with protoc
> installed by system packages under Ubuntu 10.10), and when I try to
> run 'mvn package', it fails with 2 errors in the ServiceTest.  I will
> paste the contents of the appropriate test log at the end of my
> message.
>
> Any help would be appreciated.
>
> Thanks.
>
>
> ---
> Test set: com.google.protobuf.ServiceTest
>
> ---
> Tests run: 7, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 0.107
> sec <<< FAILURE!
> testCallMethod(com.google.protobuf.ServiceTest)  Time elapsed: 0.036
> sec  <<< ERROR!
> java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Enhancer
>at
>
> org.easymock.classextension.internal.MocksClassControl.createProxyFactory(MocksClassControl.java:
> 35)
>at org.easymock.internal.MocksControl.createMock(MocksControl.java:
> 36)
>at com.google.protobuf.ServiceTest.testCallMethod(ServiceTest.java:
> 83)
>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 57)
>at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 43)
>at java.lang.reflect.Method.invoke(Method.java:616)
>at junit.framework.TestCase.runTest(TestCase.java:168)
>at junit.framework.TestCase.runBare(TestCase.java:134)
>at junit.framework.TestResult$1.protect(TestResult.java:110)
>at junit.framework.TestResult.runProtected(TestResult.java:128)
>at junit.framework.TestResult.run(TestResult.java:113)
>at junit.framework.TestCase.run(TestCase.java:124)
>at junit.framework.TestSuite.runTest(TestSuite.java:232)
>at junit.framework.TestSuite.run(TestSuite.java:227)
>at
> org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:
> 81)
>at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:
> 62)
>at
>
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:
> 140)
>at
>
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:
> 127)
>at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 57)
>at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 43)
>at java.lang.reflect.Method.invoke(Method.java:616)
>at
>
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:
> 345)
>at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:
> 1009)
> Caused by: java.lang.ClassNotFoundException:
> net.sf.cglib.proxy.Enhancer
>at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
>at java.security.AccessController.doPrivileged(Native Method)
>at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
>at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
>... 26 more
>
> testGetPrototype(com.google.protobuf.ServiceTest)  Time elapsed: 0.001
> sec  <<< ERROR!
> java.lang.NoClassDefFoundError: net/sf/cglib/proxy/Enhancer
>at
>
> org.easymock.classextension.internal.MocksClassControl.createProxyFactory(MocksClassControl.java:
> 35)
>at org.easymock.internal.MocksControl.createMock(MocksControl.java:
> 36)
>at
> com.google.protobuf.ServiceTest.testGetPrototype(ServiceTest.java:
> 100)
>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 57)
>at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 43)
>at java.lang.reflect.Method.invoke(Method.java:616)
>at junit.framework.TestCase.runTest(TestCase.java:168)
>at junit.framework.TestCase.runBare(TestCase.java:134)
>at junit.framework.TestResult$1.protect(TestResult.java:110)
>at junit.framework.TestResult.runProtected(TestResult.java:128)
>at junit.framework.TestResult.run(TestResult.java:113)
>at junit.framework.TestCase.run(TestCase.java:124)
>at junit.framework.TestSuite.runTest(TestSuite.java:232)
>at junit.framework.TestSu

Re: [protobuf] mvn test failing in 2.4.0a java subproject

2011-04-27 Thread Pherl Liu
I see, so you are using JDK1.5. Will send out a fix for this.

On Thu, Apr 28, 2011 at 12:07 AM, CRozeboom  wrote:

> I installed maven and am trying to build the java jar files for a
> project. I've tried this on a Windows XP and Ubuntu 10.10 system with
> the same results. I've even tried removing the @Override annotations
> that are being complained about and simply doing a "maven package",
> but that fails as well.
>
> If there were a pre-built jar file for 2.4.0a, I'd just as soon work
> with that.
>
> mvn test
> [INFO] Scanning for projects...
> [WARNING]
> [WARNING] Some problems were encountered while building the effective
> model for com.google.protobuf:protobuf-java:jar:2.4.0a
> [WARNING] 'build.plugins.plugin.version' for
> org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 57,
> column 15
> [WARNING] 'build.plugins.plugin.version' for
> org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 64,
> column 15
> [WARNING]
> [WARNING] It is highly recommended to fix these problems because they
> threaten the stability of your build.
> [WARNING]
> [WARNING] For this reason, future Maven versions might no longer
> support building such malformed projects.
> [WARNING]
> [INFO]
> [INFO]
> 
> [INFO] Building Protocol Buffer Java API 2.4.0a
> [INFO]
> 
> [INFO]
> [INFO] --- maven-antrun-plugin:1.3:run (generate-sources) @ protobuf-
> java ---
> [INFO] Executing tasks
> [INFO] Executed tasks
> [INFO] Registering compile source root /root/protobuf-2.4.0a/java/
> target/generated-sources
> [INFO]
> [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources)
> @ protobuf-java ---
> [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
> resources, i.e. build is platform dependent!
> [INFO] skip non existing resourceDirectory /root/protobuf-2.4.0a/java/
> src/main/resources
> [INFO]
> [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
> protobuf-java ---
> [WARNING] File encoding has not been set, using platform encoding
> UTF-8, i.e. build is platform dependent!
> [INFO] Compiling 38 source files to /root/protobuf-2.4.0a/java/target/
> classes
> [INFO] -
> [ERROR] COMPILATION ERROR :
> [INFO] -
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> GeneratedMessage.java:[424,5] method does not override a method from
> its superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> GeneratedMessage.java:[448,7] method does not override a method from
> its superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> GeneratedMessage.java:[1133,11] method does not override a method from
> its superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> GeneratedMessage.java:[1228,11] method does not override a method from
> its superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[414,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[419,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[424,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[429,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[538,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[544,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[555,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[592,7] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[596,7] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[600,7] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[607,7] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> RepeatedFieldBuilder.java:[576,3] method does not override a method
> from its supe

Re: [protobuf] mvn test failing in 2.4.0a java subproject

2011-04-27 Thread Pherl Liu
Hmm, what errors did you get after removing the @Override annotations?

On Thu, Apr 28, 2011 at 12:07 AM, CRozeboom  wrote:

> I installed maven and am trying to build the java jar files for a
> project. I've tried this on a Windows XP and Ubuntu 10.10 system with
> the same results. I've even tried removing the @Override annotations
> that are being complained about and simply doing a "maven package",
> but that fails as well.
>
> If there were a pre-built jar file for 2.4.0a, I'd just as soon work
> with that.
>
> mvn test
> [INFO] Scanning for projects...
> [WARNING]
> [WARNING] Some problems were encountered while building the effective
> model for com.google.protobuf:protobuf-java:jar:2.4.0a
> [WARNING] 'build.plugins.plugin.version' for
> org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 57,
> column 15
> [WARNING] 'build.plugins.plugin.version' for
> org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 64,
> column 15
> [WARNING]
> [WARNING] It is highly recommended to fix these problems because they
> threaten the stability of your build.
> [WARNING]
> [WARNING] For this reason, future Maven versions might no longer
> support building such malformed projects.
> [WARNING]
> [INFO]
> [INFO]
> 
> [INFO] Building Protocol Buffer Java API 2.4.0a
> [INFO]
> 
> [INFO]
> [INFO] --- maven-antrun-plugin:1.3:run (generate-sources) @ protobuf-
> java ---
> [INFO] Executing tasks
> [INFO] Executed tasks
> [INFO] Registering compile source root /root/protobuf-2.4.0a/java/
> target/generated-sources
> [INFO]
> [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources)
> @ protobuf-java ---
> [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
> resources, i.e. build is platform dependent!
> [INFO] skip non existing resourceDirectory /root/protobuf-2.4.0a/java/
> src/main/resources
> [INFO]
> [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
> protobuf-java ---
> [WARNING] File encoding has not been set, using platform encoding
> UTF-8, i.e. build is platform dependent!
> [INFO] Compiling 38 source files to /root/protobuf-2.4.0a/java/target/
> classes
> [INFO] -
> [ERROR] COMPILATION ERROR :
> [INFO] -
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> GeneratedMessage.java:[424,5] method does not override a method from
> its superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> GeneratedMessage.java:[448,7] method does not override a method from
> its superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> GeneratedMessage.java:[1133,11] method does not override a method from
> its superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> GeneratedMessage.java:[1228,11] method does not override a method from
> its superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[414,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[419,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[424,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[429,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[538,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[544,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[555,5] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[592,7] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[596,7] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[600,7] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> SmallSortedMap.java:[607,7] method does not override a method from its
> superclass
> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
> RepeatedFieldBuilder.java:[576,3] method does not override a method
> from

Re: [protobuf] mvn test failing in 2.4.0a java subproject

2011-04-27 Thread Pherl Liu
I see, probably the AbstractMap.SimpleEntry usage in the SmallSortedMapTest.

On Thu, Apr 28, 2011 at 12:45 PM, Pherl Liu  wrote:

> Hmm, what errors did you get after removing the @Override annotations?
>
> On Thu, Apr 28, 2011 at 12:07 AM, CRozeboom  wrote:
>
>> I installed maven and am trying to build the java jar files for a
>> project. I've tried this on a Windows XP and Ubuntu 10.10 system with
>> the same results. I've even tried removing the @Override annotations
>> that are being complained about and simply doing a "maven package",
>> but that fails as well.
>>
>> If there were a pre-built jar file for 2.4.0a, I'd just as soon work
>> with that.
>>
>> mvn test
>> [INFO] Scanning for projects...
>> [WARNING]
>> [WARNING] Some problems were encountered while building the effective
>> model for com.google.protobuf:protobuf-java:jar:2.4.0a
>> [WARNING] 'build.plugins.plugin.version' for
>> org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 57,
>> column 15
>> [WARNING] 'build.plugins.plugin.version' for
>> org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 64,
>> column 15
>> [WARNING]
>> [WARNING] It is highly recommended to fix these problems because they
>> threaten the stability of your build.
>> [WARNING]
>> [WARNING] For this reason, future Maven versions might no longer
>> support building such malformed projects.
>> [WARNING]
>> [INFO]
>> [INFO]
>> 
>> [INFO] Building Protocol Buffer Java API 2.4.0a
>> [INFO]
>> 
>> [INFO]
>> [INFO] --- maven-antrun-plugin:1.3:run (generate-sources) @ protobuf-
>> java ---
>> [INFO] Executing tasks
>> [INFO] Executed tasks
>> [INFO] Registering compile source root /root/protobuf-2.4.0a/java/
>> target/generated-sources
>> [INFO]
>> [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources)
>> @ protobuf-java ---
>> [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
>> resources, i.e. build is platform dependent!
>> [INFO] skip non existing resourceDirectory /root/protobuf-2.4.0a/java/
>> src/main/resources
>> [INFO]
>> [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
>> protobuf-java ---
>> [WARNING] File encoding has not been set, using platform encoding
>> UTF-8, i.e. build is platform dependent!
>> [INFO] Compiling 38 source files to /root/protobuf-2.4.0a/java/target/
>> classes
>> [INFO] -
>> [ERROR] COMPILATION ERROR :
>> [INFO] -
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> GeneratedMessage.java:[424,5] method does not override a method from
>> its superclass
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> GeneratedMessage.java:[448,7] method does not override a method from
>> its superclass
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> GeneratedMessage.java:[1133,11] method does not override a method from
>> its superclass
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> GeneratedMessage.java:[1228,11] method does not override a method from
>> its superclass
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> SmallSortedMap.java:[414,5] method does not override a method from its
>> superclass
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> SmallSortedMap.java:[419,5] method does not override a method from its
>> superclass
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> SmallSortedMap.java:[424,5] method does not override a method from its
>> superclass
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> SmallSortedMap.java:[429,5] method does not override a method from its
>> superclass
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> SmallSortedMap.java:[538,5] method does not override a method from its
>> superclass
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> SmallSortedMap.java:[544,5] method does not override a method from its
>> superclass
>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>> SmallSortedMap.java:[555,5] method does

Re: [protobuf] mvn test failing in 2.4.0a java subproject

2011-04-28 Thread Pherl Liu
Should be fix in r384<http://code.google.com/p/protobuf/source/detail?r=384>;
will be included in the next release (2.4.1)

On Thu, Apr 28, 2011 at 1:41 PM, Pherl Liu  wrote:

> I see, probably the AbstractMap.SimpleEntry usage in the
> SmallSortedMapTest.
>
>
> On Thu, Apr 28, 2011 at 12:45 PM, Pherl Liu  wrote:
>
>> Hmm, what errors did you get after removing the @Override annotations?
>>
>> On Thu, Apr 28, 2011 at 12:07 AM, CRozeboom  wrote:
>>
>>> I installed maven and am trying to build the java jar files for a
>>> project. I've tried this on a Windows XP and Ubuntu 10.10 system with
>>> the same results. I've even tried removing the @Override annotations
>>> that are being complained about and simply doing a "maven package",
>>> but that fails as well.
>>>
>>> If there were a pre-built jar file for 2.4.0a, I'd just as soon work
>>> with that.
>>>
>>> mvn test
>>> [INFO] Scanning for projects...
>>> [WARNING]
>>> [WARNING] Some problems were encountered while building the effective
>>> model for com.google.protobuf:protobuf-java:jar:2.4.0a
>>> [WARNING] 'build.plugins.plugin.version' for
>>> org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 57,
>>> column 15
>>> [WARNING] 'build.plugins.plugin.version' for
>>> org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 64,
>>> column 15
>>> [WARNING]
>>> [WARNING] It is highly recommended to fix these problems because they
>>> threaten the stability of your build.
>>> [WARNING]
>>> [WARNING] For this reason, future Maven versions might no longer
>>> support building such malformed projects.
>>> [WARNING]
>>> [INFO]
>>> [INFO]
>>> 
>>> [INFO] Building Protocol Buffer Java API 2.4.0a
>>> [INFO]
>>> 
>>> [INFO]
>>> [INFO] --- maven-antrun-plugin:1.3:run (generate-sources) @ protobuf-
>>> java ---
>>> [INFO] Executing tasks
>>> [INFO] Executed tasks
>>> [INFO] Registering compile source root /root/protobuf-2.4.0a/java/
>>> target/generated-sources
>>> [INFO]
>>> [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources)
>>> @ protobuf-java ---
>>> [WARNING] Using platform encoding (UTF-8 actually) to copy filtered
>>> resources, i.e. build is platform dependent!
>>> [INFO] skip non existing resourceDirectory /root/protobuf-2.4.0a/java/
>>> src/main/resources
>>> [INFO]
>>> [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @
>>> protobuf-java ---
>>> [WARNING] File encoding has not been set, using platform encoding
>>> UTF-8, i.e. build is platform dependent!
>>> [INFO] Compiling 38 source files to /root/protobuf-2.4.0a/java/target/
>>> classes
>>> [INFO] -
>>> [ERROR] COMPILATION ERROR :
>>> [INFO] -
>>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>>> GeneratedMessage.java:[424,5] method does not override a method from
>>> its superclass
>>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>>> GeneratedMessage.java:[448,7] method does not override a method from
>>> its superclass
>>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>>> GeneratedMessage.java:[1133,11] method does not override a method from
>>> its superclass
>>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>>> GeneratedMessage.java:[1228,11] method does not override a method from
>>> its superclass
>>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>>> SmallSortedMap.java:[414,5] method does not override a method from its
>>> superclass
>>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>>> SmallSortedMap.java:[419,5] method does not override a method from its
>>> superclass
>>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>>> SmallSortedMap.java:[424,5] method does not override a method from its
>>> superclass
>>> [ERROR] /root/protobuf-2.4.0a/java/src/main/java/com/google/protobuf/
>>> SmallSortedMap.java:[429,5] metho

Re: [protobuf] Error in java Main

2011-04-28 Thread Pherl Liu
This is because JDK 1.5 doesn't allow @Override to annotate a method that
implements part of an interface. The compatibility issue is fixed in svn
http://code.google.com/p/protobuf/source/detail?r=384

You can either patch the diff, or wait for the next release (2.4.1) soon.

On Wed, Apr 20, 2011 at 2:02 AM, SImplyG2010 wrote:

> Good evening,
>
> I have been stepping through the non maven compile of proto buffers
> for Java and everything seems to have compiled correctly. However when
> I bring the main code into Eclipse as a project I get the following
> error.
>
> The method getUnknownFields() of type
> GeneratedMessage.Builder must override a superclass
> method
>
> has anyone seen this before or know how I can resolve it?
>
> Any help you are able to give will be very much appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] 2.4.1 released.

2011-04-30 Thread Pherl Liu
The v2.4.1 Protobuf is uploaded:
http://code.google.com/p/protobuf/downloads/list

v2.4.1 is a bug fix release for v2.4.0 and v2.4.0a.

CHANGES

2011-05-01 version 2.4.1:

  C++
  * Fixed the frendship problem for old compilers to make the library now
gcc 3
compatible again.
  * Fixed vcprojects/extract_includes.bat to extract compiler/plugin.h.

  Java
  * Removed usages of JDK 1.6 only features to make the library now JDK 1.5
compatible again.
  * Fixed a bug about negative enum values.
  * serialVersionUID is now defined in generated messages for java
serializing.
  * Fixed protoc to use java.lang.Object, which makes "Object" now a valid
message name again.

  Python
  * Experimental C++ implementation now requires C++ protobuf library
installed.
See the README.txt in the python directory for details.

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] 'RepeatedCompositeFieldContainer' object has no attribute 'extend'

2011-05-02 Thread Pherl Liu
This is probably a wrong version problem. Have you installed previous
versions? Could you try:

import google.protobuf
print google.protobuf.__file__

On Tue, May 3, 2011 at 9:54 AM, William Tu  wrote:

> Hi,
> I just downloaded the protocol buffer 2.4.1 and I followed the foo bar
> example for python.
>
> http://code.google.com/apis/protocolbuffers/docs/reference/python-generated.html
> However, I got an error when I call extend (the rest are fine)
>
> -
> foo = Foo()
> bar = foo.bars.add()# Adds a Bar then modify
> bar.i = 15
> foo.bars.add().i = 32   # Adds and modify at the same time
> new_bar = Bar()
> new_bar.i = 47
> foo.bars.extend([new_bar])
> --
> Traceback (most recent call last):
>  File "", line 1, in 
> AttributeError: 'RepeatedCompositeFieldContainer' object has no
> attribute 'extend'
>
> Am I using the wrong version of protocol buffer? My python is 2.6
> Thanks!
>
> William
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: MSVC 2010 x64 build fails tests

2011-05-13 Thread Pherl Liu
Strange, looks like the serialization & parsing are completely broken in
MSVC 2010. Have you ever installed early versions? Could you please try a
clean build?

On Tue, May 10, 2011 at 8:53 PM, Mark S  wrote:

> This also fails with the new 2.4.1 release using MSVC 2010 SP1.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: Generated hashcode() returns different values across JVM instances?

2011-05-16 Thread Pherl Liu
We discussed internally and decided not to make the hashCode()
return deterministic result. If you need consistent hashcode in different
runs, use toByteString().hashCode().

Quoted from Kenton:

Hashing the content of the descriptor would actually be incorrect, because
two descriptors with exactly the same content are still considered different
types.  Descriptors are compared by identity, hence they are hashed by
pointer.

Removing the descriptor from the calculation would indeed make hashCode()
consistent between two runs of the same binary, and probably insignificant
runtime cost.  Of course, once you do that, you will never be able to
introduce non-determinism again because people will depend on it.

But there's a much bigger risk.  People may actually start depending on
hashCode() returning consistent results between two different versions of
the binary, or two completely separate binaries that compile in the same
protocol, or -- most dangerously -- two different versions of the same
protocol (e.g. with fields added or removed).  I think it would be very
difficult and limiting to make these guarantees, so I would be extremely
cautious about this.

Certainly, there is no implementation of hashCode() that would be any safer
than .toByteString().hashCode().  So, I'd advise steering people to the
latter.  Note that if unknown fields are present, the results may still be
inconsistent.  However, there is no reasonable way to implement a hashCode()
that is consistent in the presence of unknown fields.

On Thu, May 12, 2011 at 5:32 AM, Ben Wright  wrote:

> I think we wrote those replies at the same time : )
>
> You're right, at the cost of some additional hash collisions, the
> simplest solution is to simply not include the type / descriptor in
> the hash calculation at all.
>
> The best / least-collision solutions with good performance would be
> what I wrote in my previous post, but that requires that someone
> (presumably a current committer) with sufficient knowledge of the
> Descriptor types to have enough time to update the compiler and java
> libraries accordingly.
>
> Any input from a committer for this issue?  Seems the simple solution
> would take less than an hour to push into the stream and could make it
> into the next release.
>
> On May 11, 5:25 pm, Ben Wright  wrote:
> > Alternatively... instead of putting the onus on the compiler, the
> > hashcode could be computed by the JVM at initialization time for the
> > Descriptor instance, (which would also help performance of dynamically
> > parsed Descriptor instance hashcode calls).
> >
> > i.e.
> >
> > private final int computedHashcode;
> >
> > public Descriptor() {
> >//initialization
> >
> >   computedHashcode = do_compute_hashCode();
> >
> > }
> >
> > public int hashCode() {
> > return computedHashcode;
> >
> > }
> >
> > punlic int do_compute_hashCode(){
> >   return // compute hashcode
> >
> > }
> >
> > This is all talking towards optimum performance implementation... the
> > real problem is the need for a hashCode implementation for Descriptor
> > based on the actual Descriptor's content...
> >
> > On May 11, 4:54 pm, Ben Wright  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Jay:
> >
> > > Using the class name to generate the hashcode is logically incorrect
> > > because the class name can be derived by the options java_package_
> > > name and java_outer_classname.
> >
> > > Additionally (although less likely to matter), separate protocol
> > > buffer files can define an identical class names with different
> > > protocol buffers.
> >
> > > Lastly, and most importantly...
> >
> > > If the same Message is being used with generated code and with dynamic
> > > code, the hash code for the descriptor would still be identical if
> > > generated from the descriptor instance, whereas the dynamic usage does
> > > not have a classname from which to derive a hashcode.  While in your
> > > case this should not matter, it does matter for other users of
> > > protobuf.  The hashcode function would be better served by being
> > > implemented correctly from state data for the descriptor.
> > > Additionally, in generated code it seems that this hashcode could be
> > > pre-computed by the compiler and Descriptor.hashcode() could return a
> > > constant integer - which would be much more efficient than any other
> > > method.
> >
> > > On May 11, 3:02 pm, Jay Booth  wrote:
> >
> > > > It can be legitimate, especially in the case of Object.hashCode(),
> but
> > > > it's supposed to be in sync with equals() by contract.  As it stands,
> > > > two objects which are equal() will produce different hashes, or the
> > > > same logical object will produce different hashes across JVMs.  That
> > > > breaks the contract..  if the equals() method simply did return
> (other
> > > > == this), then it'd be fine, albeit a little useless.
> >
> > > > I created an issue and posted a 1-liner patch that would eliminate
> the
> > > > problem by using getClass().getName().has

Re: [protobuf] protobuf-2.4.1 (java) build problems

2011-05-24 Thread Pherl Liu
Does setting higher heap memories in jvm flags(i.e. -Xmx) help?

On Mon, May 23, 2011 at 4:23 PM, bogl  wrote:

> Hello
> I'm trying to create generated-sources and generated-test-sources
> files for protobuf-2.4.1 (java), but getting an error message:
>
> [INFO]
> 
> [ERROR] BUILD FAILURE
> [INFO]
> 
> [INFO] Compilation failure
> Failure executing javac, but could not parse the error:
>
>
> The system is out of resources.
> Consult the following stack trace for details.
> java.lang.OutOfMemoryError: Java heap space
>at
> com.sun.tools.javac.util.Position$LineMapImpl.build(Position.java:
> 139)
>at com.sun.tools.javac.util.Position.makeLineMap(Position.java:63)
>at com.sun.tools.javac.parser.Scanner.getLineMap(Scanner.java:1105)
>at
> com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:512)
>at
> com.sun.tools.javac.main.JavaCompiler.parse(JavaCompiler.java:550)
>at
> com.sun.tools.javac.main.JavaCompiler.parseFiles(JavaCompiler.java:
> 801)
>at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:
> 727)
>at com.sun.tools.javac.main.Main.compile(Main.java:353)
>at com.sun.tools.javac.main.Main.compile(Main.java:279)
>at com.sun.tools.javac.main.Main.compile(Main.java:270)
>at com.sun.tools.javac.Main.compile(Main.java:87)
>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
>at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 25)
>at java.lang.reflect.Method.invoke(Method.java:597)
>at
>
> org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:
> 420)
>at
>
> org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:
> 141)
>at
>
> org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:
> 493)
>at
> org.apache.maven.plugin.TestCompilerMojo.execute(TestCompilerMojo.java:
> 102)
>at
>
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:
> 443)
>at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:
> 539)
>at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:
> 480)
>at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:
> 459)
>at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:
> 311)
>at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:
> 278)
>at
>
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:
> 143)
>at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
>at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
>at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
>at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
> 39)
>at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
> 25)
>
> with protobuf-2.3.0 everything was ok.
>
> Please, can anybody help me to resolve this problem.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Python ParseFromString always returns None

2011-05-24 Thread Pherl Liu
+robinson

The ParseFromString() in python now always returns None. Note the
MergeFromString() returns the number of bytes read, but there's a TODO to
make that always return None. Will may have some ideas about this.

On Sat, May 21, 2011 at 4:22 PM, jsia  wrote:

> Hi,
>
> I created a proto file and did something like this
>
> data = test_pb2.Payload()
> data.id = 1234
>
> output = data.SerializeToString()
>
> print data.ParseFromString(output)
>
> The output is always None
>
> I tried deserializing it in java and it worked  , is this a bug?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Optional,Repated fields and Submessages

2011-06-02 Thread Pherl Liu
On Wed, Jun 1, 2011 at 3:45 PM, aara  wrote:

> I actually have 3 questions.
>
> 1.When we specify default values for optional fields,the default value
> gets assigned automatically when we ourselves dont assign it a value.
> But why doesnt the has_member field get set to 1??? It still remains
> zero.
>

To clarify the default value a bit:
In your code, if you don't set_somefield() explicitly:
1) has_somefield() will return false.
2) somefield() will return the default value.
3) the default value won't be serialized into the wire. that said, if you
don't set any field in your message, the serialized bytes will be empty.

Each field has a default value, e.g. 0 for int, "" for string. You can
override the default value by set [default=xxx] in the .proto file, but it
won't change the behavior described above.


>
> 2.Can we not specify default values for repeated fields too??? The
> protoc-c compiler throws an error.
>

Do you mean you want to set default values for repeated fields? No, you
can't.


>
> 3. In nested submessages, we have to call the INIT function for each
> of the submessages manually. Why doesnt the calling of the INIT
> function for the main message recursively call the INIT functions of
> the nested messages??? This becomes tedious when we have numerous
> nested messages.
>

What INIT function were you referring to? I'm not aware of this INIT
function in protobuf code base.


>
> Please let me know the solutions of these problems as soon as
> possible
>
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Optional,Repated fields and Submessages

2011-06-02 Thread Pherl Liu
So are you using a 3rd party C protobuf plugin? Then my previous reply may
not be applicable for that implementation. You may want to contact the
plugin author directly for these questions.

On Thu, Jun 2, 2011 at 6:14 PM, AARADHANA SRIDHARAN
wrote:

> I am working on a C code base... INIT functions are used in this case
> instead of a constructor in C++.
>
> Thanks for your reply.
>
> On Thu, Jun 2, 2011 at 3:33 PM, Pherl Liu  wrote:
>
>>
>>
>>  On Wed, Jun 1, 2011 at 3:45 PM, aara  wrote:
>>
>>> I actually have 3 questions.
>>>
>>> 1.When we specify default values for optional fields,the default value
>>> gets assigned automatically when we ourselves dont assign it a value.
>>> But why doesnt the has_member field get set to 1??? It still remains
>>> zero.
>>>
>>
>> To clarify the default value a bit:
>> In your code, if you don't set_somefield() explicitly:
>> 1) has_somefield() will return false.
>> 2) somefield() will return the default value.
>> 3) the default value won't be serialized into the wire. that said, if you
>> don't set any field in your message, the serialized bytes will be empty.
>>
>> Each field has a default value, e.g. 0 for int, "" for string. You can
>> override the default value by set [default=xxx] in the .proto file, but it
>> won't change the behavior described above.
>>
>>
>>>
>>> 2.Can we not specify default values for repeated fields too??? The
>>> protoc-c compiler throws an error.
>>>
>>
>> Do you mean you want to set default values for repeated fields? No, you
>> can't.
>>
>>
>>>
>>> 3. In nested submessages, we have to call the INIT function for each
>>> of the submessages manually. Why doesnt the calling of the INIT
>>> function for the main message recursively call the INIT functions of
>>> the nested messages??? This becomes tedious when we have numerous
>>> nested messages.
>>>
>>
>> What INIT function were you referring to? I'm not aware of this INIT
>> function in protobuf code base.
>>
>>
>>>
>>> Please let me know the solutions of these problems as soon as
>>> possible
>>>
>>>
>>> Thanks.
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Protocol Buffers" group.
>>> To post to this group, send email to protobuf@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> protobuf+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/protobuf?hl=en.
>>>
>>>
>>
>
>
> --
> Regards,
> Aaradhana
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] How can I set multi proto_path

2011-06-02 Thread Pherl Liu
Yes, you can. See:
http://code.google.com/apis/protocolbuffers/docs/proto.html#generating

On Wed, Jun 1, 2011 at 2:39 PM, jonason  wrote:

> can I set multi proto_path?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Numeric range not supported?

2011-06-02 Thread Pherl Liu
We also have another internal thread talking about the "restriction" support
for protobuf. Basically we think the restriction or value validation
function of protobuf should be implemented in the upper layer due to various
concerns..

On Mon, May 30, 2011 at 6:54 PM, Marco Tedone wrote:

> Hi all,
>
> I'm checking the protobuf language definition and I couldn't find
> anywhere support for numeric range. In XSD, for instance, one could
> have:
>
> 
>
>  
>  
>
>  
>
> However I couldn't find equivalent translation in the proto language
> definition. I could find defaults and enums, but not number ranges.
>
> Regards,
>
> Marco
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Problem with reading class

2011-06-02 Thread Pherl Liu
That one will parse from binary encoded data. Looks like your
sample_message.txt is in ASCII format. In short:
Binary format:
serialize: msg.writeTo() / msg.toByteArray()
parsing: MyMessage.parseFrom() / builder.mergeFrom()

ASCII format:
serialize: msg.toString() / TextFormat.printToString()
parsing: TextFormat.merge()

You should use them in pair.

On Thu, May 26, 2011 at 1:18 AM, ch007  wrote:

> Hi all,
>
>  I wrote a reading class to print the data in the message to the
> console. the problem is i am not able to print any thing on the
> console. code is running fine. I think the problem is with the
> following part.
>
>  File myFile = new File ("C:/Documents and Settings/ch007/Desktop/
> sample_message.txt");
> FileInputStream fis = new FileInputStream(myFile);
> Good good = Good.parseFrom(fis);
>if(good==null)
>{
>System.out.println("problem in reading message");
>
>}
> if(good.hasMessageId())
>{
>System.out.println("MessageId: "+good.getMessageId());
>}
>
>
> in the sample_message.txt there is messageid but in the output it is
> not printing any messaage id. Same problem with all other fields.I am
> not able to get any of the fields. I followed the address book
> tutorial and trid to implement this. please help me
> Is the below line correct?
> Nta2Sse nta2sse = Nta2Sse.parseFrom(fis);
>
>
> thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Best Practices on updating generated Message object

2011-06-02 Thread Pherl Liu
You can probably use sub-builders in this case: e.g.

myBuilder.getPriceBuilder().setValue(123);

See
http://code.google.com/apis/protocolbuffers/docs/reference/java-generated.html#messagein
sub builders section.

On Thu, May 26, 2011 at 2:58 PM, veaven  wrote:

> Hi,
>
>  What's the best practices on updating generated Message objects?
>
>  I use google-protobuf to generate Java classes according to proto
> file, since these classes are immutable so I need to use its Builder
> to copy/close the object and then update it.
>  It is okay for a few update on the message object, however, it will
> not perform well if I do multiple update on its field in different
> methods several times, because it asked me to copy/clone the object
> everytime.  I know I can pass Builder object instead of message
> object, but the builder object also asked me to copy/clone its
> reference.
>
> E.g.
>  // I want to update MyObject's instance myobject
>  MyObject.Builder myBuilder = MyObject .newBuilder( myobject); //copy
> & clone
>
> myBuilder.setPrice(Price.newBuilder(tmdObject.getPrice()).setValue(123));//
> 1st copy & clone
>
> myBuilder.setPrice(Price.newBuilder(tmdObject.getPrice()).setValue(456));//
> 2nd copy & clone
> myobject = myBuilder.build();
>
>  Can we reduce the copy&clone during update an object?  Could you
> please let me know what is the best way to update an existing protobuf
> object?
>
> David
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] How to convert Descriptors.Descriptor to Java class name?

2011-06-20 Thread Pherl Liu
Quoted from our internal discussion by Kenton:

You should build a Map upfront, mapping every
descriptor you care about to the corresponding default instance.  Avoid
using Class objects because that will make your code incompatible with
DynamicMessage.  Using default instances instead avoids this problem and
should cover all the same use cases.

Note that it should be easy to write a function like:
  void populate(Message root, Map map);
which recursively populates the map with the given message type and all of
its dependencies.
In C++, we have a singleton MessageFactory::generated_factory() which
effectively provides a Descriptor -> default instance map for all
compiled-in types.  But, this leads to all the usual singleton problems, and

code that uses it is often needlessly incompatible with DynamicMessage.
 People like the idea of being able to look up any compiled-in type because
it seems convenient, but in practice the convenience is typically not very
large, whereas the loss of reusability can be a big problem down the road.

On Tue, Jun 7, 2011 at 7:36 AM, ondrej par  wrote:

> Hi all,
>
> is there a convenient way to extract the name of Java (generated) class
> that represents the Message from Descriptors.Descriptor?
>
> What I need is a method with the following signature:
> public Class extractJavaClass(Descriptors.Descriptor d);
>
> I can derive class name using file/message descriptors methods, but that
> seems quite difficult, since I have to take java_package_name and
> java_outer_class_name options into account, and I have to convert
> underscores in proto file name to camel case
>
> Thanks for answer,
> Ondrej
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/ZDBENWpTLVlYdDhK.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Copy nested repeated messages

2011-06-21 Thread Pherl Liu
This shouldn't happen.. That means your unfiltered C also contains
uninitialized messages.. Did you add new required fields in your .proto file
(or change optional to required)?

On Wed, Jun 8, 2011 at 5:55 AM, ksamdev  wrote:

> Hi,
>
> I've got nested messages like:
>
> message A
> {
>required double value = 1;
> }
>
> message B
> {
>   required A a = 1;
> }
>
> message C
> {
>   repeated B entries = 1;
> }
>
> The C object is saved in file and may have any number of B entries.
> However, now I'd like to save a copy of C in a different file with B's that
> match some criteria, e.g.
>
> ...
> C original;
> // Read object from file
>
> C *copy = new C();
> typedef ::google::protobuf::RepeatedPtrField Bs;
>
> for(Bs::const_iterator b = c->entries().begin();
> c->entries().end() != b;
> ++b)
> {
> if (b->a().value() < 5)
> continue;
>
> // Copy B entry and add it to the Filtered C
> B *entry = copy->add_entries();
> *entry = *b;
> }
> // save copy
>
> Sometimes it happens that I get the error message upon reading filtered C:
>
> libprotobuf ERROR google/protobuf/message_lite.cc:123] Can't parse message
> of type "C" because it is missing required fields: entries[0].A
>
> It seems that deep copy of nested repeated messages failed for some reason.
> Any ideas how to fix this?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/WmZZUDM2ZDR0ZmNK.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Dynamic deserialization of enums

2011-06-21 Thread Pherl Liu
This is because EnumValueDescriptor doesn't override toString(). You can use
getName() and getValue() in the EnumValueDescriptor to read the value.
EnumValueDescriptor is defined in com.google.protobuf.Descriptors

On Sun, Jun 19, 2011 at 10:34 AM, Nik Hodgkinson <11x...@gmail.com> wrote:

> I'm working on a system to serialize descriptors and send them over the
> wire. All has gone fairly well with the exception of enums. I have no
> problem serializing the descriptor or deserializing it on the receiving end,
> but when I try to read from one I get an object like
> com.google.protobuf.Descriptors$EnumValueDescriptor@2993a66f and I can't
> seem to figure out how to get the value or name out of the object. So
> here's what I'm working with:
>
> First two functions that I've made from a snippet on someone else's post:
>
> private Descriptors.Descriptor getDescriptorForBytes(ByteString wireType)
>   throws InvalidProtocolBufferException,
> Descriptors.DescriptorValidationException
>   {
> DescriptorPackage.WireDescriptor wireItem =
> DescriptorPackage.WireDescriptor.parseFrom(wireType);
>
> DescriptorProtos.DescriptorProto protoOut =
> DescriptorProtos.DescriptorProto
> .parseFrom(wireItem.getDescriptorProto());
> DescriptorProtos.DescriptorProto modified =
>
> DescriptorProtos.DescriptorProto.newBuilder(protoOut).setName(wireItem.getProtoName()).build();
> DescriptorProtos.FileDescriptorProto fileProto =
> DescriptorProtos.FileDescriptorProto
> .newBuilder()
> .addMessageType(modified)
> .setPackage(wireItem.getPackageName())
> .build();
> Descriptors.FileDescriptor file = Descriptors.FileDescriptor.buildFrom(
> fileProto, new
> Descriptors.FileDescriptor[]{}
> );
>
> return file.findMessageTypeByName(wireItem.getProtoName());
>   }
>
>   private ByteString getBytesForDescriptor(Descriptors.Descriptor desc)
>   {
> DescriptorProtos.DescriptorProto proto = desc.toProto();
> String name = Testing.TestItem.getDescriptor().getFullName();
> int dotIndex = name.lastIndexOf('.');
> String protoName = name.substring(dotIndex + 1);
> String packageName = (dotIndex == -1) ? "" : name.substring(0,
> dotIndex);
>
> ByteString bytes = proto.toByteString();
>
> return DescriptorPackage.WireDescriptor
> .newBuilder()
> .setProtoName(protoName)
> .setPackageName(packageName)
> .setDescriptorProto(bytes)
> .build()
> .toByteString();
>   }
>
> Then I have the following proto:
>
> message TestItem {
>   required int32 id = 1;
>   required string name = 2;
>
>   enum Type {
> FOO = 0;
> BAR = 1;
> BAZ = 2;
>   }
>   optional Type type = 3;
>
>   message SubItem {
> required string name = 1;
> optional int32 id = 2;
>   }
>
>   optional SubItem item = 5;
>
>   repeated string data = 4;
> }
>
> Finally I have a deserialized descriptor which I use to create a dynamic
> message:
>
> Descriptors.Descriptor descriptor = getDescriptorForBytes(descriptorBytes);
>
> DynamicMessage item = DynamicMessage.parseFrom(descriptor, testItemBytes);
>
> Map fields = item.getAllFields();
> Set keys = fields.keySet();
>
> for (Descriptors.FieldDescriptor i : keys) {
>   System.out.println(i.getName());
>   Object field = fields.get(i);
>   System.out.println(field);
>   System.out.println();
> }
>
> Which outputs:
>
> id
> 1
>
> name
> Test 1
>
> type
> com.google.protobuf.Descriptors$EnumValueDescriptor@2993a66f
>
> data
> [Datum 1, Datum 2]
>
> item
> name: "Foo"
> id: 42
>
> So the question is then how can I get the enum over the wire and make use
> of it on the other end? Also, using the method in the functions above are
> there any other gotcha's that I might be missing?
>
> Thanks,
> -N
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/FtyKvJNj4joJ.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Uploading the maven-protoc-plugin to Maven Central?

2011-06-21 Thread Pherl Liu
+Gregory

On Sun, Jun 19, 2011 at 4:16 PM, Marco Tedone wrote:

> Hi all,
>
> Is there a reason why the plugin hasn't been uploaded to Maven
> Central? If you want I could take ownership of that but then I'd have
> to be the owner of the com.google.protobuf Maven groupId, which I
> don't think is a good idea.
>
> There are already two other maven-protoc-plugin out there, both custom
> and this is causing confusion. I believe people would like to see the
> "Google" maven-protoc-plugin and use that, but in a way is easy to use
> (e.g. available in Maven Central).
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Undefined references to `google::protobuf::internal::kEmptyString'

2011-06-21 Thread Pherl Liu
protobuf-c is a 3rd party plugin/branch, which is not in official protobuf
release. You may need to contact the author directly.

On Tue, Jun 21, 2011 at 12:43 PM, Greg Corradini wrote:

> Hello,
> I'm trying to compile protobuf-c-0.15 on Ubuntu-10.10. I've been
> running into this undefined reference problem and have come up short
> on answers thought searches. Any ideas from the dump below what I
> should look into?
>
>
> /bin/bash ../../libtool --tag=CXX   --mode=link g++  -g -O2 -pthread  -
> o cxx-generate-packed-data cxx-generate-packed-data.o test-full.pb.o -
> lprotobuf
> libtool: link: g++ -g -O2 -pthread -o cxx-generate-packed-data cxx-
> generate-packed-data.o test-full.pb.o  /usr/lib/libprotobuf.so -lz -
> pthread
> cxx-generate-packed-data.o: In function
> `foo::TestFieldNo15::set_test(char const*)':
> /home/gcorradini/Downloads/protobuf-c-0.15/src/test/generated-code/
> test-full.pb.h:3844: undefined reference to
> `google::protobuf::internal::kEmptyString'
> cxx-generate-packed-data.o: In function
> `foo::TestFieldNo16::set_test(char const*)':
> /home/gcorradini/Downloads/protobuf-c-0.15/src/test/generated-code/
> test-full.pb.h:3906: undefined reference to
> `google::protobuf::internal::kEmptyString'
> cxx-generate-packed-data.o: In function
> `foo::TestFieldNo2047::set_test(char const*)':
> /home/gcorradini/Downloads/protobuf-c-0.15/src/test/generated-code/
> test-full.pb.h:3968: undefined reference to
> `google::protobuf::internal::kEmptyString'
> cxx-generate-packed-data.o: In function
> `foo::TestFieldNo2048::set_test(char const*)':
> /home/gcorradini/Downloads/protobuf-c-0.15/src/test/generated-code/
> test-full.pb.h:4030: undefined reference to
> `google::protobuf::internal::kEmptyString'
> cxx-generate-packed-data.o: In function
> `foo::TestFieldNo262143::set_test(char const*)':
> /home/gcorradini/Downloads/protobuf-c-0.15/src/test/generated-code/
> test-full.pb.h:4092: undefined reference to
> `google::protobuf::internal::kEmptyString'
> cxx-generate-packed-data.o:/home/gcorradini/Downloads/protobuf-c-0.15/
> src/test/generated-code/test-full.pb.h:4154: more undefined references
> to `google::protobuf::internal::kEmptyString' follow
> collect2: ld returned 1 exit status
> make[2]: *** [cxx-generate-packed-data] Error 1
> make[2]: Leaving directory `/home/gcorradini/Downloads/protobuf-c-0.15/
> src/test'
> make[1]: *** [all-recursive] Error 1
> make[1]: Leaving directory `/home/gcorradini/Downloads/protobuf-c-0.15/
> src'
> make: *** [all-recursive] Error 1
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] installation in windows

2011-07-05 Thread Pherl Liu
Please take a look at the vsprojects/readme.txt

On Wed, Jun 29, 2011 at 9:50 PM, Enrico Viappiani wrote:

> Let me ask a stupid question.. I have to install protobuf 2.4.1 C++,
> in windows 7 64 bit.
> I've done that in ubuntu, but i don't have seen the installation
> instruction for windows around..
> I'll use visual c++ 10 express.
> Help me.. I'm feeling really stupid!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] How to use protoc --decode option?

2011-07-05 Thread Pherl Liu
The protoc reads the input from STDIN. If you pass the payload file name as
parameter, protoc will treat that file as a ".proto" file. You should pipe
the payload to protoc instead.

On Tue, Jul 5, 2011 at 7:30 PM, Ravi  wrote:

> Hi,
>
> I am trying to convert a protobuf stream in to a readable format. I
> got following exception.
>
> protobuf.txt:2:1: Invalid control characters encountered in text.
> protobuf.txt:2:2: Expected top-level statement (e.g. "message").
> protobuf.txt:2:9: Invalid control characters encountered in text.
>
>
> Steps i tried:
> 1)  Built the protobuf message object and saved the output to a file
> (protobuf.txt). (tried in java)
> 2)  Used the decode option in command line. The arguments are
> protoc --proto_path=   --
> decode=  the protobuf payload>
>
> protoc --proto_path=D:\Work\ProtoBuf\workspace2_4_0_a\TesteLVIS\src\com
> \proto D:\Work\ProtoBuf\workspace2_4_0_a\TesteLVIS\src\com\proto
> \TestSameName.proto --decode=com.ebay.test.Book D:\Work\ProtoBuf
> \workspace2_4_0_a\TesteLVIS\src\com\proto\protobuf.txt
>
> Please let me know what i am doing wrong here?
> is it something related to file encoding? If so how do i resolve it?
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: How to use protoc --decode option?

2011-07-05 Thread Pherl Liu
Can you try:

protoc [various options]  < payload.txt

So that the content will be read as STDIN to protoc.

On Tue, Jul 5, 2011 at 10:12 PM, Ravi  wrote:

> Hi,
>
> I tried that also. I pasted the payload directly in the command prompt
> when it asked.
> I got following error.
>
> "Failed to parse input."
>
> Thanks,
> Ravikumar K
>
> On Jul 5, 7:06 pm, Pherl Liu  wrote:
> > The protoc reads the input from STDIN. If you pass the payload file name
> as
> > parameter, protoc will treat that file as a ".proto" file. You should
> pipe
> > the payload to protoc instead.
> >
> > On Tue, Jul 5, 2011 at 7:30 PM, Ravi 
> wrote:
> > > Hi,
> >
> > > I am trying to convert a protobuf stream in to a readable format. I
> > > got following exception.
> >
> > > protobuf.txt:2:1: Invalid control characters encountered in text.
> > > protobuf.txt:2:2: Expected top-level statement (e.g. "message").
> > > protobuf.txt:2:9: Invalid control characters encountered in text.
> >
> > > Steps i tried:
> > > 1)  Built the protobuf message object and saved the output to a file
> > > (protobuf.txt). (tried in java)
> > > 2)  Used the decode option in command line. The arguments are
> > > protoc --proto_path=   --
> > > decode=  > > the protobuf payload>
> >
> > > protoc --proto_path=D:\Work\ProtoBuf\workspace2_4_0_a\TesteLVIS\src\com
> > > \proto D:\Work\ProtoBuf\workspace2_4_0_a\TesteLVIS\src\com\proto
> > > \TestSameName.proto --decode=com.ebay.test.Book D:\Work\ProtoBuf
> > > \workspace2_4_0_a\TesteLVIS\src\com\proto\protobuf.txt
> >
> > > Please let me know what i am doing wrong here?
> > > is it something related to file encoding? If so how do i resolve it?
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Protocol Buffers" group.
> > > To post to this group, send email to protobuf@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > protobuf+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/protobuf?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Inserting values by tag numbers

2011-07-08 Thread Pherl Liu
Which language are you using? In c++, you can call
message::GetDescriptor()->FindFieldByNumber() to get a FieldDescriptor; then
call GetReflection()->Set* functions.

On Fri, Jul 8, 2011 at 3:58 AM, SM  wrote:

> Hello,
>
> Is there a way to set the field value by the tag which we mention in
> the proto file?
>
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Allocator Support for strings

2011-07-12 Thread Pherl Liu
In the common.h, we have a  "using namespace std;", and we use "string"
directly in runtime libraries. However, we use "::std::string" in generated
file; you need to modify the proto compiler to support different string
allocators. We do have custom allocator support in our TODO list internally,
but that probably won't happen in near future.

On Tue, Jul 12, 2011 at 5:45 AM, Jason Hsueh  wrote:

> +Pherl
>
> Hm, not sure how feasible this is. The code generator emits references to
> ::std::string. I suppose there might be some hack like adding a typedef of
> ::std::string to ::protobuf::string in one of the header stubs; then you
> could override that (or perhaps use some kind of preprocessor macro, so that
> it can be overridden via build flags, rather than modifying source)
> #ifndef PROTOBUF_STRING_IMPLEMENTATION
> #define PROTOBUF_STRING_IMPLEMENTATION ::std::string
> #endif
>
> Pherl's more familiar with the open source release - have any ideas?
>
> (This does seem a little dangerous: if people are shipping around dynamic
> libraries compiled with different string implementations, this would be
> problematic. This is similar to the issues people have had with different
> STL implementations in prod vs debug builds in MSVC. Not sure we want to
> open up another can of worms.)
>
> On Fri, Jul 8, 2011 at 7:26 PM, Gokulakannan Somasundaram <
> gokul...@gmail.com> wrote:
>
>> Thanks a lot for the reply. I understood that part. Currently in the
>> .proto file, there is a string definition which gets translated to
>> std::string. What we actually need is a typedef which can be configured as
>> per the end user wish, before building the protobuf. But can i get some
>> assistance on how to implement the same.
>>
>> Thanks,
>> Gokul.
>>
>>
>> On Sat, Jul 9, 2011 at 5:02 AM, Jason Hsueh  wrote:
>>
>>> We don't support this at this time - the primary problem is that
>>> specifying an allocator for C++ string's produces a completely new type.
>>> This means allocators can't simply be injected into a particularly message
>>> instance; instead it would have to be part of the message definition.
>>>
>>> On Wed, Jul 6, 2011 at 6:28 PM, Gokul  wrote:
>>>
 Hi,
   In the application, i am working on, we are managing the memory of
 strings using allocators. But i find that the protobuf uses strings
 without any allocator support. Is there a plan to provide allocator
 support for strings in future?
 Or can someone guide me on how to go about implementing this change?

  I would need a typedef somewhere to mention the string type and the
 library should generate the appropriate code for it.

 Thanks,
 Gokul.

 --
 You received this message because you are subscribed to the Google
 Groups "Protocol Buffers" group.
 To post to this group, send email to protobuf@googlegroups.com.
 To unsubscribe from this group, send email to
 protobuf+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/protobuf?hl=en.


>>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: Inserting values by tag numbers

2011-07-12 Thread Pherl Liu
You can use message.getDescriptor().findFieldByNumber() to get the
FieldDescriptor. Then use the reflection interface: Builder#setField()
Take a look at
http://code.google.com/p/protobuf/source/browse/trunk/java/src/main/java/com/google/protobuf/Message.java


On Fri, Jul 8, 2011 at 11:56 PM, SM  wrote:

> Hi,
>
> I'm using java I found the corresponding methods in java. Thanks for
> the quick response.
>
>
> On Jul 8, 3:08 am, Pherl Liu  wrote:
> > Which language are you using? In c++, you can call
> > message::GetDescriptor()->FindFieldByNumber() to get a FieldDescriptor;
> then
> > call GetReflection()->Set* functions.
> >
> >
> >
> > On Fri, Jul 8, 2011 at 3:58 AM, SM  wrote:
> > > Hello,
> >
> > > Is there a way to set the field value by the tag which we mention in
> > > the proto file?
> >
> > > Thanks.
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Protocol Buffers" group.
> > > To post to this group, send email to protobuf@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > protobuf+unsubscr...@googlegroups.com.
> > > For more options, visit this group at
> > >http://groups.google.com/group/protobuf?hl=en.- Hide quoted text -
> >
> > - Show quoted text -
> --
> Sumanth
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] about add_field、copyfrom

2011-07-12 Thread Pherl Liu
In C++ protobuf, each message owns its fields. That said, two different
messages cannot share a sub-message, which will complicate the system when
releasing resources.

In your case, if you always need to copy the records, there may be a better
design. For instance, keep the records in a global pool, and change the
RecordSet to only contain the ids, i.e. change the repeated Records into
repeated int32. Also if you don't need to use them simultaneously, you can
use add_allocated_record() and swap.

On Sun, Jul 10, 2011 at 4:04 PM, xyluch...@163.com wrote:

> hello:
>
> we defined two object in field.proto
> message Record{
> optional int id = 1;
> }
> message RecordSet{
> repeated Record record= 1;
> }
>
> so when we define a Record pointer,we do like this:
> RecordSet recordsetA,recordsetB;
> Recrod *pRecordA = recordsetA.add_record();
> pRecordA->set_id(111);
>
> actually ,recordsetB has the same member as fieldsetA,we can only do
> like this:
> Record *pRecordB = recordsetB.add_record();
> pRecordB->CopyFrom(*pRecordA);
>
> we found that it cost  much time to  copy.
>
> if there is this method,we can solve this problem:
>
> recordasetB.add_record(pRecordA);
>
> in this way ,we don't need to copy。
>
> i've read topic in this forum, add_record() this api just for thread
> safe and don't worry about the pRecordA being accidently changed。
>
> so hope for your answer.
>
> thans!!
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Java - DynamicMessage and FileDescriptorProto

2011-07-22 Thread Pherl Liu
Take a look at com.google.protobuf.Descriptors and
com.google.protobuf.DynamicMessage

On Mon, Jul 18, 2011 at 8:20 AM, yoave  wrote:

> Hi all,
>
> I've got 2 questions:
>
> 1. how do I generate a Descriptor from a FileDescriptorProto in Java?
>   In cpp, I'm using DescriptorPool class's 'BuildFile()'
> functionality.
>

Descriptors.FileDescriptor.buildFrom()

>
> 2. how do I generate a Dynamic Message from a Descriptor in Java?
>   In cpp, I'm using DynamicMessageFactory class's 'GetPrototype()'
> functionality.
>

DynamicMessage.newBuilder(descirptor)


>
> thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: Java - DynamicMessage and FileDescriptorProto

2011-07-26 Thread Pherl Liu
Not sure if I understand your question correctly. You can set the label in
FieldDescriptorProto:

LABEL_OPTIONAL = 1;

LABEL_REQUIRED  = 2;LABEL_REPEATED  = 3;


On Tue, Jul 26, 2011 at 12:21 AM, Giancarlo Frison wrote:

> There is this example that I'm approaching to re-implement
> http://flori.posterous.com/dynamically-creating-protocol-buffer-objects
>
> a question:
>
> How to handle repeated fields? How can you describe them in the
> fieldDescriptor?
>
>
>
> On Jul 18, 5:20 pm, yoave  wrote:
> > Hi all,
> >
> > I've got 2 questions:
> >
> > 1. how do I generate a Descriptor from a FileDescriptorProto in Java?
> >In cpp, I'm using DescriptorPool class's 'BuildFile()'
> > functionality.
> >
> > 2. how do I generate a Dynamic Message from a Descriptor in Java?
> >In cpp, I'm using DynamicMessageFactory class's 'GetPrototype()'
> > functionality.
> >
> > thanks
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Failed test from tests.exe and lite-test.exe

2011-07-26 Thread Pherl Liu
I didn't see any test failures from your log:

[==] 764 tests from 102 test cases ran. (3249 ms total)
[  PASSED  ] 764 tests.

The ERROR logs are expected, to test the protoc complains in some
situations.

On Mon, Jul 25, 2011 at 2:28 PM, Chris Morris wrote:

> So I downloaded the source to Google Protocl Buffers 2.4.1 on my Windows7
> machine. Per the README in the vsprojects directory, I opened the .sln file
> in Visual Studio 2008 (which said it had to convert the solution file to the
> 2008 version because, apparently, it is some other version by default).
>
> I then built the solution in both DEBUG and RELEASE mode, and then ran the
> two initial tests, as suggested in the README. All tests in
> lite-test.exe succeeded. For tests.exe, I've attached the output (for
> RELEASE mode).  Some tests failed because of some sort of DEATH test macro
> that isn't supported in Windows. The others tests...I don't know why they
> failed. I'm not that familiar with protocol buffers so I simply wanted to
> put my output file up here and see if anyone has any ideas. In addition,
> maybe these tests are *supposed* to fail for Windows, in which case, the
> developers should make a note of this.
>
> Any help would be appreciated. Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/m4Ba879xKp4J.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Out-of-date Extensions Documentation?

2011-07-26 Thread Pherl Liu
The SetExtension() is mentioned in the example. The accessors mentioned in
the following paragraph are "similar" to the SetExtension template function.

On Mon, Jul 25, 2011 at 5:07 PM, Chris Morris wrote:

> Should the Extensions section in the Language Guide (
> http://code.google.com/apis/protocolbuffers/docs/proto.html#extensions)
> add SetExtension() as one of the available Extension-related functions? Note
> that the Extensions section in the C++ Generated Code (
> http://code.google.com/apis/protocolbuffers/docs/reference/cpp-generated.html#extension)
>  does,
> indeed, have this function.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/4jPStsKruMYJ.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] how to create descriptors dynamically with repeated and complex fields

2011-07-26 Thread Pherl Liu
See my response in the other thread. You can set label to the
FieldDescriptorProto.

On Tue, Jul 26, 2011 at 12:31 AM, Giancarlo Frison wrote:

> Hi all,
>
> I'm attempting to create descriptors dynamically for generating custom
> message on the fly.
> The trouble is when I have to describe a field as 'repeated' and
> dynamically serialize and parse it.
>
> How define 'repeated' fields?
>
>
> This is how I create such descriptors (http://flori.posterous.com/
> dynamically-creating-protocol-buffer-objects):
>
> desBuilder = DescriptorProtos.DescriptorProto.newBuilder();
>
> DescriptorProtos.FieldDescriptorProto.Builder fd1Builder =
> DescriptorProtos.FieldDescriptorProto.newBuilder()
>.setName(fieldName).setNumber(i++).setType(type);
>
> desBuilder.addField(fd1Builder.build());
>
> thanks,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Out-of-date Extensions Documentation?

2011-07-26 Thread Pherl Liu
Quote: >>
Foo foo;
foo.SetExtension(bar, 15);
Similarly, the Foo class defines templated accessors HasExtension(),
ClearExtension(), GetExtension(), MutableExtension(), and AddExtension().
end quote <<

To re-write the sentence: "Similarly to the SetExtension() mentioned in the
above example, the Foo class also defines templated accessors, bla bla bla"
It generally says what else functions the Foo class defines, besides the
SetExtension(). It doesn't need to mention SetExtension() again, based on
context.

On Tue, Jul 26, 2011 at 12:15 PM, Chris Morris wrote:

> So should SetExtension() be explicitly listed in the Language Guide, or
> not?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/cij0Z7Gnvn4J.
>
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: Java - DynamicMessage and FileDescriptorProto

2011-07-27 Thread Pherl Liu
Take a look at the buildFrom() method. You need to provide an array of
FileDescriptor as dependencies. If one of your message field is a complex
type, you should build that complex type first, and pass the built
FileDescriptor object to the buildFrom() in the dependencies array.

On Wed, Jul 27, 2011 at 7:36 AM, Giancarlo Frison wrote:

> if I call setTypeName(messageName), how protobuf match the name with
> related Descriptor?
> How can I map messageName and the descriptor of the type?
>
> On Jul 27, 3:56 pm, Robert  wrote:
> > Hi,
> >
> > you either call setType() for primitive types or setTypeName(String)
> > for referenced messages.
> > You pass in the name of the message.
> >
> > Kind regards,
> > Robert
> >
> > On 27 Jul., 10:35, Giancarlo Frison  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > Thank you very much Pherl!
> >
> > > An another question. What about not-primitive fields, or message
> > > fields?
> >
> > > when I add fields I do:
> >
> > > DescriptorProtos.DescriptorProto.Builder desBuilder
> > > 
> > > DescriptorProtos.FieldDescriptorProto.Builder fd1Builder =
> > > DescriptorProtos.FieldDescriptorProto.newBuilder()
> > > .setName(fieldName).setNumber(i+
> > > +).setType(type).setLabel(label);
> > > desBuilder.addField(fd1Builder.build());
> >
> > > with message typed field I set type as
> > > 'DescriptorProtos.FieldDescriptorProto.Type.TYPE_MESSAGE'. How do I
> > > describe the field type?
> > > I mean, I suppose to describe the field with a inner
> > > 'DescriptorProtos.DescriptorProto.Builder', is it correct? How I can
> > > do to describe a complex type field?
> >
> > > Thanks!
> >
> > > On Jul 26, 8:21 pm, Pherl Liu  wrote:
> >
> > > > Not sure if I understand your question correctly. You can set the
> label in
> > > > FieldDescriptorProto:
> >
> > > > LABEL_OPTIONAL = 1;
> >
> > > > LABEL_REQUIRED  = 2;LABEL_REPEATED  = 3;
> >
> > > > On Tue, Jul 26, 2011 at 12:21 AM, Giancarlo Frison <
> gfri...@chelab.com>wrote:
> >
> > > > > There is this example that I'm approaching to re-implement
> > > > >
> http://flori.posterous.com/dynamically-creating-protocol-buffer-objects
> >
> > > > > a question:
> >
> > > > > How to handle repeated fields? How can you describe them in the
> > > > > fieldDescriptor?
> >
> > > > > On Jul 18, 5:20 pm, yoave  wrote:
> > > > > > Hi all,
> >
> > > > > > I've got 2 questions:
> >
> > > > > > 1. how do I generate a Descriptor from a FileDescriptorProto in
> Java?
> > > > > >In cpp, I'm using DescriptorPool class's 'BuildFile()'
> > > > > > functionality.
> >
> > > > > > 2. how do I generate a Dynamic Message from a Descriptor in Java?
> > > > > >In cpp, I'm using DynamicMessageFactory class's
> 'GetPrototype()'
> > > > > > functionality.
> >
> > > > > > thanks
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> Groups
> > > > > "Protocol Buffers" group.
> > > > > To post to this group, send email to protobuf@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > > > protobuf+unsubscr...@googlegroups.com.
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/protobuf?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Protobuf for Android

2011-09-21 Thread Pherl Liu
The size isn't correct. Please run mvn clean; then mvn package -P lite
The correct size is around 80k

On Thu, Sep 15, 2011 at 8:12 AM, sanjoy  wrote:

> Hello,
>
> Is there a version of protobuf for Android?  I built the "lite"
> version of protobuf-2.4.1 and its 450KB.  That's huge.  Is there
> anything smaller?
>
> Thanks,
> Sanjoy
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] How can unknown fields appear in a message?

2011-09-21 Thread Pherl Liu
Can you try to print the DebugString() of the message containing unknown
fields? One possibility is you used the wrong message type to parse the
bytes.

On Tue, Sep 20, 2011 at 3:04 PM, Michael Videlgauz wrote:

> Hello!
>
> I am now investigating a bug in my program under debugger (VS2008
> IDE). I see that some my messages have unknown fields set. I don't use
> any executable compiled with old proto files, whenever I change my
> proto file I rebuild entire project with new pp.h and pb.cc sources.
> Even more, I have reverted my recent changes in proto and now I have
> it exactly the same as it was when project was built very first time
> (I mean there is no chance that executable compiled with a different
> proto exists anywhere). Still I am getting those unknown fields - I
> see under debugger that message destructor iterates over unknown field
> set and deletes them one by one. The value of fileds is a string that
> I do set in my program and 'numbers' (if I guess correctly they are
> field's tags) are 5 and 7 - tags that always existed in my proto from
> very first time it was compiled...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Custom options namespace

2011-09-21 Thread Pherl Liu
The document generally said you can use the same extension number for
different level of options, but the qualified extension name needs to be
unique. e.g. a single extension name cannot extend more than one type. That
said, you probably have to use different option name for the purpose.

Note, there's some internal effort to support docs in generated file;
hopefully will be included in the next major release.

On Sat, Sep 17, 2011 at 3:20 AM, Thiago Cangussu  wrote:

> Hi,
>
> I am trying to create an option (documentation) that appears at
> different levels (message-level, field-level, etc), but I got an error
> saying that the name was already defined in the package. The
> documentation states that:
>
> Also, note that each option type (file-level, message-level,
> field-level, etc.) has its own number space, so e.g. you could declare
> extensions of FieldOptions and MessageOptions with the same number.
>
> Does it make sense to have a separate number space and a common
> option-name space? Am I doing something wrong?
>
> I'm trying to use the custom option (documentation) to create
> self-documented messages. The idea is to use a plugin to generate the
> documentation.
>
> Regards,
> Thiago
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] protocol buffer for android and Iphone application

2011-09-21 Thread Pherl Liu
You can use protobuf-lite for Android (see the java/README.txt); for iphone,
there are some 3rd-party add-ons for object-c. Take a look at
http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns

On Wed, Sep 14, 2011 at 4:33 PM, Visionweb  wrote:.

> Hello,
>
> Just a question. Is it a version available for Android and Iphone
> development? I want to use protobuf to serialize data for an API, but
> it must be accessible by Android and Iphone.
>
> Thank a lot, and sorry for my english, I don't try it enough :p
>
> Olivier
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] My Protocol Buffers implementation in C#

2011-09-21 Thread Pherl Liu
Done. Thanks for the work.

On Sat, Sep 10, 2011 at 12:38 AM, Peter Hultqvist  wrote:

> Hello
>
> I have been working on this c# code generating Protocol Buffers
> implementation for a while and now I dare to announce it.
>
> https://silentorbit.com/**protobuf/ 
>
> It is a command line tool that generates standalone c# code from a .proto
> file.
>
> My goal was to have simple serializing code in case I had to debug it and
> easier integration when adding serializing features to existing classes.
>
> I would be happy if it got included on the Third Party page
> https://code.google.com/p/**protobuf/wiki/ThirdPartyAddOns
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to protobuf+unsubscribe@**
> googlegroups.com .
> For more options, visit this group at http://groups.google.com/**
> group/protobuf?hl=en .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] build PB with c++ builder XE (runtime - not compiler)

2011-09-21 Thread Pherl Liu
Unfortunately we officially doesn't support this platform, and I'm not aware
of any 3rd party BCB support. You can try to make it BCB compatible, and
share with other users :) It requires lots of work to support a certain
platform though, e.g. there are #ifdef _MSC_VER everywhere.

On Sat, Sep 10, 2011 at 3:19 PM, •Jonas•  wrote:

> Hello, I wish to use PB on wondows in C++ builder XE.
>
> I am wondering if any user  here - have already tried that. Or with
> any version of bcb.
> Since it can build in VC, it should also be possible in bcb - right ?
> Meaning, not needing any linux/gcc stuff.
>
> Searching the groups shows that a user (dazza) did compile the light
> version, but
> it seems those changes were not included in current version. Also it
> was back in 2009.
>
> Thank you
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] C++ implementation for Python

2011-09-21 Thread Pherl Liu
There's no lite-runtime for python. It's generally reflection based.

On Tue, Sep 6, 2011 at 2:45 PM, Slava  wrote:

> Hi,
> is there any way to use lite runtime for the subj?
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Initialisation of nested messages ?

2011-09-21 Thread Pherl Liu
You cannot set default values for messages (or fields in message). You would
have to create default instances of ColorData in your code.

On Mon, Sep 5, 2011 at 5:50 AM, Werner  wrote:

> Hello,
>
> message ColorData
> {
>  required int32 red   =263;
>  required int32 green =264;
>  required int32 blue  =265;
> };
>
> message BpmDjConfigData
> {
>  optional ColorDatacolor_tempo44=225 [default=?];
>  optional ColorDatacolor_tempo46=226 [default=?];
> ...
>
> How can I specifify a different default value for color_tempo44 and
> color_tempo46 ?
>
> With kind regards,
>
> Werner,-
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Extensions with Python

2011-09-21 Thread Pherl Liu
Take a look at Python API.
http://code.google.com/apis/protocolbuffers/docs/reference/python-generated.html#extension
There are few examples of how to use extensions in Python.

On Mon, Sep 5, 2011 at 9:58 PM, Dave  wrote:

> Hi, I have a C++ based service that uses messages defined like so
>
> [code]
> message RPCMessage {
>required string rpcname = 1;
>extensions 100 to max;
> }
> [/code]
>
>
> [code]
>
>
> message CustomRPCMessage  {
>
>message Response {
>required String id = 1;
>required int version = 2;
>repeated String data = 3;
>}
>
>extend RPCMessage {
>repeated Response response = 100;
>}
> }
> [/code]
>
> I want to write a python based script to act as a dummy server for
> testing my client.
>
> In C++ I can write:
>
> CustomRPCMessage::Response* response =
> message.AddExtension(CustomRPCMessage::response);
> response->set_id("My ID");
> response->set_version(10);
> 
>
>
> I've been trying to do the same in python, but can't seem to figure
> out how to do it.  The AddExtension method doesn't seem to be
> available.  Can anyone point me in the right direction?  Cheers?
>
>
> At the moment I have
> [code]
> import CustomMessages_pb2
> import RPCMessage_pb2
>
> message = RPCMessage_pb2.RPCMessage()
> message.rpcName = 'MyCustomMessage'
>
> message.AddExtension(CustomMessages_pb2.CustomRPCMessage.response)
>
> print 'do something here'
> [/code]
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] A new third-party implementation

2011-09-21 Thread Pherl Liu
Added to http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns
Thanks for the work!

On Wed, Aug 31, 2011 at 11:28 PM, jpa  wrote:

> Hi,
>
> Here is my ansi-C implementation of Protocol Buffers for memory-
> restricted embedded devices:
> http://koti.kapsi.fi/jpa/nanopb/
>
> It's still in its infancy, but achieves very small code sizes (2kB
> library + 10 bytes per each message field).
>
> --
> Petteri Aimonen
> jpa (at) kapsi.fi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] release date for next version

2011-09-21 Thread Pherl Liu
Probably this quarter. There are still couple of memory issues for the
experimental C++ implementation for python that we'd like to fix before next
release.

On Wed, Aug 31, 2011 at 6:34 AM, Chris Morris wrote:

> When is the next version coming out?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/9LJa0QTWzxIJ.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] release date for next version

2011-09-21 Thread Pherl Liu
Sorry, I mean Q4 2011.

On Thu, Sep 22, 2011 at 12:45 PM, Pherl Liu  wrote:

> Probably this quarter. There are still couple of memory issues for the
> experimental C++ implementation for python that we'd like to fix before next
> release.
>
>
> On Wed, Aug 31, 2011 at 6:34 AM, Chris Morris 
> wrote:
>
>> When is the next version coming out?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/protobuf/-/9LJa0QTWzxIJ.
>> To post to this group, send email to protobuf@googlegroups.com.
>> To unsubscribe from this group, send email to
>> protobuf+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/protobuf?hl=en.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] build protobuf without iostreams

2011-09-21 Thread Pherl Liu
There are plenty of APIs for different IOs including string, array, please
take a look at the message_lite.h. Also you can implement your own
ZeroCopyStream for your IO layer.

On Tue, Aug 30, 2011 at 5:23 AM, anand  wrote:

> Hello All,
>
> Is it possible to use protobuf without iostreams?
>
> Thanks,
> Anand.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Java: Is there a way to create a new builder for a Message given one of its FieldDescriptors?

2011-11-07 Thread Pherl Liu
I assume you want to use generated class. In that case, you can keep a map
from Descriptor to the default instance. Then when you get the
FieldDescriptor, you can get the containing type Descriptor; then look up
the map the get the default instance, and call newBuilderForType() to get
the generated builder.

On Sat, Nov 5, 2011 at 12:28 AM, Ori  wrote:

> I'd like to create and populate a Message given only a FieldDescriptor
> from that message.
>
> Is it possible to create a new Builder without knowing the Message's
> type in advance? I don't want to use DynamicMessage, I want to create
> the Builder implementation for the descriptor's containingType.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Java Nested Builders being built on insert?

2011-11-07 Thread Pherl Liu
Can you use addChildBuilder() API for the repeated field, and then call
addGrandChildBuilder() in the returned builder?

On Thu, Nov 3, 2011 at 12:24 AM, users   wrote:

> I am working on a solution to basically allow me to persist any
> protocol buffer with hibernate.  However, I have run into a challenge
> with nested builders.  In order for hibernate to create relationships
> it's requiring the parent object be referenced.  For these purpose I
> wanted the parent object to be a builder.  However, in the case of a
> nested repeated message field (see example below), upon adding the
> builder to the parent the generated code actually builds the object.
> You can start to work around this for one level nesting but beyond
> that it's really ugly.
>
> message Parent {
>
>  repeated Child = 1;
>  }
>
> message Child {
>  repeated GrandChild = 1;
> }
>
> message GrandChild {
>   optional int32 id = 1;
> }
>
> The problem is that hibernate want's linkage between Java objects and
> the builder to message conversions actually destroy this
> relationship.  My question is why are the objects being built before I
> call build and is there any way to fix this?  I'd be happy if they
> would all be builders until the parent build call is made.
>
> Thanks,
>
> Mike
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Why can't we clear UnknownFields from a Java instance?

2011-11-07 Thread Pherl Liu
You cannot clear the unknown fields in a message because messages are
immutable. However, you can parse the bytes into a builder, and then clear
the unknowns fields there.

On Sat, Oct 22, 2011 at 3:52 PM, Ashwin Jayaprakash <
ashwin.jayaprak...@gmail.com> wrote:

> Hi, I have 2 simple messages defined - Person and PersonLite. PersonLite
> (5 fields) is actually a smaller "view" of Person (20 fields).
>
> I was thinking of using PersonLite to read in the contents of a message
> that was written by Person. It works alright by reading 5 fields, but
> PersonLite also reads the remaining 15 fields into the UnknownFields map
> which is an unmodifiable collection. I was hoping to read the subset of the
> fields and then discard the unknown fields but alas..!!
>
> Is there a reason why UnknownFields cannot be cleared by the user? I
> wanted to serialize PersonLite from Person's data and send only those 5
> fields over the network. But now I realize that the entire 20 fields get
> serialized.
>
> Proto below:
> package com.javaforu.demo.protobuf;
>
> option java_package = "com.javaforu.demo.protobuf";
> option java_outer_classname = "DemoProtos";
>
> message Person {
> required string field_1 = 1;
> optional string field_2 = 2;
> optional string field_3 = 3;
> optional string field_4 = 4;
> optional string field_5 = 5;
> optional string field_6 = 6;
> optional string field_7 = 7;
> optional string field_8 = 8;
> optional string field_9 = 9;
> optional string field_10 = 10;
> optional string field_11 = 11;
> optional string field_12 = 12;
> optional string field_13 = 13;
> optional string field_14 = 14;
> optional string field_15 = 15;
> optional string field_16 = 16;
> optional string field_17 = 17;
> optional string field_18 = 18;
> optional string field_19 = 19;
> optional string field_20 = 20;
> }
>
> message PersonLite {
> required string field_1 = 1;
> optional string field_5 = 5;
> optional string field_10 = 10;
> optional string field_15 = 15;
> optional string field_20 = 20;
> }
>
>
> Java code:
> public class TestPerson {
> public static void main(String[] args) throws IOException {
> Person person = Person.parseFrom(new FileInputStream(args[0]));
> System.out.println("Read into " + person.getClass().getName() + "
> from " + args[0]);
> System.out.println(person);
> System.out.println("Bytes length " + person.getSerializedSize());
>
> System.out.println();
> PersonLite personLite = PersonLite.parseFrom(new
> FileInputStream(args[0]));
> System.out.println("Read into " + personLite.getClass().getName()
> + " from " + args[0]);
> System.out.println(personLite);
> System.out.println("Bytes length " +
> personLite.getSerializedSize());
> }
> }
>
>
> Ashwin.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/vJwtr6NZxJAJ.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: Contribution: C++Builder Compiling

2011-11-07 Thread Pherl Liu
Thanks for the work! I've put a link in the 3rd party wiki
page


On Tue, Oct 11, 2011 at 11:32 PM, Scott Saad  wrote:

> A quick status update on this effort:
>
>- I forked the source at GitHub under the 
> protobuf-cppbuilderproject.
>- The biggest overarching changes revolved around namespaces. These
>changes were minimal but touched many files.
>   - Main cause of this change was a "using namespace std;" statement
>   in common.h. I removed this but then had to fully qualify std types when
>   there were used (i.e. string became std::string).
>   - C++Builder sometimes had problems resolving namespaces. For
>   example if we were in google::protobuf and something was referenced in
>   google::protobuf::internal, I had to qualify that by adding internal:: 
> to
>   whatever was being referenced.
>- Other changes revolved around #ifdef/#ifndef certain includes, etc.
>(similar to MSVC).
>- A very interesting compiler complaint that took me a while to track
>down was how dependent names were being sometimes used/declared. When they
>referred to types and templates I had to 
> disambiguate.
>This cleaned things up and made the source cleaning compile across all
>platforms.
>- *The libraries are compiling under C++Builder and can be linked
>against.*
>- *protoc is not fully working. *It compiles fine but gets a runtime
>error when parsing options. I'm not yet sure what's going on here. A
>workaround is to not use the protoc that gets compiled with this project,
>but use the distributed binary to generate the C++ protocol buffers. Hoping
>I can make some headway on this issue soon.
>- I've compiled all changes on both gcc and MSVC. *All unit tests are
>passing.*
>
> In my opinion these changes would be great to have merged back into the
> protobuf proper branch as most of them aim to make the code base more cross
> compiler compliant. I suppose the C++Builder is a bit more strict on a few
> items.
>
> I would be happy to produce is diff/patch to be looked at by a main
> contributor on the google project. Please just let me know what I can do to
> help facilitate this.
>

We'd like to accept patches. However, we don't have enough engineering
resources to maintain another platform. Supporting a different platform
requires much testing work in the release process (also user support). I'd
suggest to keep the C++ builder branch. You can always merge when a new
version of protobuf is released.


>
> Thank you,
> Scott Saad
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/5L32fr5BM-QJ.
>
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Re: Contribution: C++Builder Compiling

2011-11-09 Thread Pherl Liu
On Thu, Nov 10, 2011 at 1:35 AM, Scott Saad  wrote:

> Hello,
>
> Thank you for adding a link!
>
> We'd like to accept patches. However, we don't have enough engineering
>> resources to maintain another platform. Supporting a different platform
>> requires much testing work in the release process (also user support). I'd
>> suggest to keep the C++ builder branch. You can always merge when a new
>> version of protobuf is released.
>>
>
> I can completely understand not wanting to support another platform and am
> happy to maintain the C++Builder branch. At the same time, if I were
> wanting to submit a patch, how do I go about that? Through this group?
>

Thanks for the understanding. You can create an issue on the project page(
http://code.google.com/p/protobuf/issues/list) and put the diffs as
attachments.


>
> Kind regards,
> Scott
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/8X7Wsx6yns4J.
>
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] 2.4.1 on Win32 with VC 2008 cannot pass the tests.

2012-03-20 Thread Pherl Liu
Could you please post the error logs?

On Tue, Mar 13, 2012 at 1:15 AM, Wei Cheng  wrote:

> The lite-test passes well.
> The tests either crash (release mode always, debug mode sometimes) or
> failed 12 tests of CommandLineInterfaceTests.
> Is there anyone else has the same problem?
> Thanks.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] proto buff crash

2012-03-20 Thread Pherl Liu
It sounds like a memory ownership issue. Basically the message object owns
the fields (including the unknown fields). From the stack trace, the string
is probably freed before the destructor is called. Could you please write a
simple function that could reproduce this issue?

On Sun, Feb 26, 2012 at 7:25 PM, jjshang  wrote:

> hi,
>
> we use proto buff for our c-s application. We find there seem to be no
> problems if server proto's optional, repeated field do not exist in
> client's proto, so our server and client use different proto defines,
> and it works well.
>
> But recently there happens some crash in client proto buff code when
> server send a lot of undefined complicate nested optional/repeated
> field to client.
>
>app.exe!
> std::basic_string,std::allocator
> >::`scalar deleting destructor'()  + 0x9 字节 C++
>app.exe!google::protobuf::UnknownField::Delete()  行177 + 0x1f 字节
>  C++
>app.exe!google::protobuf::UnknownFieldSet::ClearFallback()  行58 C++
>app.exe!google::protobuf::UnknownFieldSet::~UnknownFieldSet()  行51
>  C+
> +
>app.exe!MyProtoInner::~MyProtoInner()  行15119 + 0x4a 字节 C++
>app.exe!MyProtoInner::`scalar deleting destructor'()  + 0x8 字节  C++
>app.exe!
>
> google::protobuf::internal::RepeatedPtrFieldBase::Destroy::TypeHandler>()
> 行622 + 0x11 字节  C++
>app.exe!MyProto::~MyProto()  行16864 + 0x10 字节   C++
>
> It seems happen in memory release procedure, and if we bring the 5
> lines proto buff relative code to a gtest, it crash in same place
> steady. Can anybody help?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] Package Mandatory ?

2012-03-20 Thread Pherl Liu
The function name is determined by the source proto file path. Looks like
you always generate messages from a single .proto file. You would have to
generate the message in different files. Otherwise, even if you worked
around the function name issue, the runtime DescriptorPool would complained
about duplicated file descriptors.

On Thu, Mar 1, 2012 at 6:41 AM, Julien PONNOU wrote:

> Hello,
>
> When I include several couples of .h/.cc in my project, I got the
> following errors during the compilation:
>
> error C2086: 'google::protobuf::ProtobufOnceType `anonymous-
> namespace'::protobuf_AssignDescriptors_once_' : redefinition
> see declaration of '`anonymous-
> namespace'::protobuf_AssignDescriptors_once_'
> error C2084: function 'void `anonymous-
> namespace'::protobuf_AssignDescriptorsOnce(void)' already has a body
> see previous definition of 'protobuf_AssignDescriptorsOnce'
> error C2084: function 'void `anonymous-
> namespace'::protobuf_RegisterTypes(const std::string &)' already has a
> body
> see previous definition of 'protobuf_RegisterTypes'
>
> Basically, it's telling me these functions are declared in all couples
> of .h/.cc. Using a different package for each couple of .h/.cc
> corrects the problem, but I don't want to do so. Without using any
> package, can someone explain me how to solve this error ?
>
> Best regards,
>
> Julien.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] gcc 4.7.0 compile error with -std=c++11

2012-07-02 Thread Pherl Liu
The internal version is already c++11 compatible. It will be included in
the next release.

On Fri, Apr 20, 2012 at 4:23 PM, Brian Nesbitt wrote:

> Hello folks,
>
> Protobuf 2.4.1 fails to build using gcc 4.7.0 (on CentOS 6.2) with the
> C++11 standard enabled (-std=c++11). The error is shown at the end. The fix
> is simple though:
>
> *snip*
> --- protobuf-2.4.1/src/google/protobuf/compiler/command_line_interface.cc 
> 2012-04-19
> 22:20:07.426070065 +0100
> +++ protobuf-2.4.1/src/google/protobuf/compiler/command_line_interface.cc 
> 2012-04-19
> 22:20:20.351925288 +0100
> @@ -910,7 +910,7 @@
>  cerr << disk_path << ": warning: directory does not exist." <<
> endl;
>}
>
> -  proto_path_.push_back(make_pair(virtual_path,
> disk_path));
> +  proto_path_.push_back(make_pair(virtual_path, disk_path));
>  }
>
>} else if (name == "-o" || name == "--descriptor_set_out") {
> *snip*
>
> Without this fix the error is:
>
> libtool: compile:  g++-4.7.0 -DHAVE_CONFIG_H -I. -I.. -pthread -Wall
> -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -std=c++11 -MT
> plugin.lo -MD -MP -MF .deps/plugin.Tpo -c
> google/protobuf/compiler/plugin.cc  -fPIC -DPIC -o .libs/plugin.o
> google/protobuf/compiler/command_line_interface.cc: In member function
> ‘bool
> google::protobuf::compiler::CommandLineInterface::InterpretArgument(const
> string&, const string&)’:
> google/protobuf/compiler/command_line_interface.cc:913:78: error: no
> matching function for call to ‘make_pair(std::string&, std::string&)’
> google/protobuf/compiler/command_line_interface.cc:913:78: note: candidate
> is:
> In file included from
> /opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_algobase.h:65:0,
>  from
> /opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/char_traits.h:41,
>  from
> /opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/string:42,
>  from ./google/protobuf/stubs/common.h:41,
>  from
> ./google/protobuf/compiler/command_line_interface.h:41,
>  from
> google/protobuf/compiler/command_line_interface.cc:35:
> /opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_pair.h:274:5:
> note: template constexpr std::pair std::__decay_and_strip<_T1>::__type, typename
> std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)
> /opt/gcc-4.7.0/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/../../../../include/c++/4.7.0/bits/stl_pair.h:274:5:
> note:   template argument deduction/substitution failed:
> google/protobuf/compiler/command_line_interface.cc:913:78: note:   cannot
> convert ‘virtual_path’ (type ‘std::string {aka std::basic_string}’)
> to type ‘std::basic_string&&’
>
> Can we get this into the next release?
>
> Thanks.
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/_cf6a7cyH2kJ.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



Re: [protobuf] How to make a self-describing message

2012-07-12 Thread Pherl Liu
Unfortunately no.. You could, however, put the Emessages opCode in the
MsgFirst message (instead of in the MsgHeader). Then you can specify the
default value for the EMessages to MSG_FIRST.

On Tue, Jul 10, 2012 at 10:06 PM, Barzo  wrote:

> Hi,
> I'm new to PB and I would ask a simple thing...
> I've already read the 'Techniques' page but, if I want to do the following:
>
> enum EMessages
> {
>   MSG_FIRST;
>   MSG_SECOND;
> }
>
> message MsgHeader
> {
>   required FileDescriptorSet proto_files = 1;
>   required string type_name = 2;
>
>   required EMessages opCode = 3;
> }
>
> message MsgFirst
> {
>   required MsgHeader Header = 1;
>
> *  // Here would be nice to do*
> *  Header.opCode = MSG_FIRST;*
>
>   required int MyData = 2;
> }
>
> Is there a way to assign a constant to a message field?
>
> Thanks in advance,
> Daniele.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/protobuf/-/elpUPyh_ACEJ.
> To post to this group, send email to protobuf@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/protobuf?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.