[protobuf] Using Protobuf in Ruby

2011-03-31 Thread BJ Neilsen
For those who may be interested in using Protobuf with Ruby, I recently did 
an interview with Pat Eyler http://twitter.com/gnupate that details the 
library I've been using/writing.

http://on-ruby.blogspot.com/2011/03/protocol-buffers-bj-nielsens-take.html

Cheers,
BJ Neilsen

-- 
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] Enum changes compatiblities

2011-03-31 Thread Aaron
Hey,

I wanted to know that a enum values can be changed like optional/
repeated fields in a protobuf. The new values would only be available
to applications using the new .proto. Or, will it cause a decode error
for an application receiving the new enum value but doesn't have the
updated .proto.

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.



Re: [protobuf] Enum changes compatiblities

2011-03-31 Thread Jason Hsueh
It won't be a decode error as long as the enum field is not required. If an
application without the new values receive a message containing one of the
new enum values, it will treat the value as an unknown field. In the C++ and
Java implementations (Python doesn't propagate unknown fields), the value
will be stored in the UnknownFieldSet so that it will be included if the
message is reserialized. However, the field will not be set, and accessing
the field will give you the default value.

On Thu, Mar 31, 2011 at 1:25 PM, Aaron aaron.r...@gmail.com wrote:

 Hey,

 I wanted to know that a enum values can be changed like optional/
 repeated fields in a protobuf. The new values would only be available
 to applications using the new .proto. Or, will it cause a decode error
 for an application receiving the new enum value but doesn't have the
 updated .proto.

 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] Unexpected memory usage when using RepeatedPtrField

2011-03-31 Thread Jason Hsueh
Does your memory allocator immediately release memory to the system?
Google's tcmalloc, for instance, does not, for performance reasons.

On Wed, Mar 30, 2011 at 3:22 AM, martin sowasdum...@googlemail.com wrote:

 Hello everybody,

 I've got a strange behaviour when using a message with a repeated
 attribute inside.

 This is a very simplified example:

 message Input
 {
   required bytes content = 1;
   required bytes sender = 2;
   required bytes rcpt = 3;
 }

 message Response
 {
  repeated Input entries = 1;
 }


 TEST(CreateResponse)
 {
 {
 Response response;
 google::protobuf::RepeatedPtrFieldInput* entries =
 response.mutable_entries();
 //entries-Reserve(1);

 for(int i=0;i1;++i)
 {
std::auto_ptrInput in = createInputEntry();
std::string serialized = in-SerializeAsString();

Input* entry = response.add_entries();
entry-ParseFromArray(serialized.data(), serialized.length());
 }

 std::string serializedResponse = response.SerializeAsString();

 }
 }

 The createInputEntry and serialization does not make in this example
 any sense, but it is a simplified scenario what happens in the real
 application.

 I was expecting that when Response is out of scope the memory usage
 should get back to the initial memory size, but unfortunately this
 does not happen. In my test case (it is not the initial size is around
 2MB, after inserting some entries it increases up to 9MB and the
 memory is not released.

 The behaviour changes in case I resize the pointer array to lets say
 1 in this example. After Response is out of scope the memory usage
 is the same as at the beginning. But If I reserve more than entries
 are created the inital behaviour comes back.

 I am not totally sure what happens at that point. Maybe someone could
 explain this strange behaviour.

 Thanks in advance.
 Martin

 --
 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] self including message array

2011-03-31 Thread Jason Hsueh
Recursive definitions should work, though I'm not sure we have a test case
to verify use in repeated fields. I know there is one for optional messages.
What result did you get?

On Tue, Mar 29, 2011 at 5:58 AM, zad emanuele.plac...@gmail.com wrote:

 Is it possible to have in a message declaration an array of the
 declaring message?
 Let me explain better:
 I'm trying to achieve the following:

 message resource_info {
optional string device_name=18;
optional Res_type res_type=19 [default=RAW];
repeated resource_info resources=2;
 }

 I tried also with this:
 message resource_info {
optional string device_name=18;
optional Res_type res_type=19 [default=RAW];
extensions 2 to 3;
 }
 extend resource_info{
repeated resource_info resources=2;
 }



 --
 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] Protobuf in JAX-WS

2011-03-31 Thread Canggih PW
hi, 

Sorry, i'm new in Java.

Currently, i make a web service using python (for server) and java (for 
client). 
Client-Server can updates data synchronously, i'm using long polling method. 
All 
i know about how to implement those thing is using JAX WS, to send request and 
read the callback response. But, JAX WS using XML. How can i using protobuf in 
JAX-WS, or there are any other library in java that can do it?

Thanks in advance
Canggih

-- 
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] Re: Protobuf in JAX-WS

2011-03-31 Thread Ben Wright
Unfortunately JAX-WS (Java API for XML Web Services) only works
directly with XML (anyone feel free to correct me if I'm
misinformed in this regard as I've never fully explored using JAX-WS
without XML)

You have a couple of options though...

If you want to stick with XML based web services you can go with using
Base64 encoded protocol buffer message(s) in appropriate XML fields.
Likewise you can return data this way.  The drawbacks of this are that
you're essentially throwing away a lot of the good that comes from web
services being well defined in terms of argument and return data
types. (Base64 is an encoding scheme for putting binary data in human
readable data streams such as XML by only using displayable
characters... encoding suffers a 4/3 size penalty as it takes four 6-
bit chars to encode three 8-bit bytes)

If you're more flexible you can implement a non-XML based web service
using a RESTful model, or thin HTTP requests, to post and get protocol
buffers directly as raw bytes.  There are also some remoting
services built on top of protocol buffers that act much like web
services.  I have not used any of them so I'll leave it to someone
more versed in those to speak to them.

If you want more info you can ask more questions or do a search on
RESTful web services (and yes JAX-WS supports RESTful but still
using XML...)

Best of luck,
Ben Wright

On Mar 31, 10:38 pm, Canggih PW cangca...@gmail.com wrote:
 hi,

 Sorry, i'm new in Java.

 Currently, i make a web service using python (for server) and java (for 
 client).
 Client-Server can updates data synchronously, i'm using long polling method. 
 All
 i know about how to implement those thing is using JAX WS, to send request and
 read the callback response. But, JAX WS using XML. How can i using protobuf in
 JAX-WS, or there are any other library in java that can do it?

 Thanks in advance
 Canggih

-- 
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.