[protobuf] Re: How to use Protobuf with existing ORM(torque)?

2009-11-10 Thread Sankaravadivel S
Thanks. That worked me.

On Tue, Nov 10, 2009 at 8:21 AM, Kenton Varda ken...@google.com wrote:

 Add this to your .proto file:

   option java_multiple_files = true;

 Note that the outer class is still generated, it just doesn't contain the
 other classes.  You can still change the outer class name with:

   option java_outer_classname = Whatever;


 On Mon, Nov 9, 2009 at 6:47 PM, sansun08 csshankaravadi...@gmail.comwrote:


 To be more precise, how do I avoid the inner class implementations in
 the auto-generated code by protobuf(java). I want the java file name
 to be same as the Message name which also implies that the message
 class should not be an inner class. Is there a way to achieve this(In
 short similar to DAO classes used by ejb or hibernate)?

 On Nov 10, 6:32 am, sansun08 csshankaravadi...@gmail.com wrote:
  I am not asking specific to torque. Were there any successful attempt
  in integrating with any of the famous ORMs like hibernate or JPA?
 
  On Nov 9, 11:03 am, sansun08 csshankaravadi...@gmail.com wrote:
 
   We use a href=http://db.apache.org/torque/index.html;apache
 torque/
   a as ORM in our project. The DAOs( torque auto generates the DAO
   classes based on the schema design) generated are quite complex( since
   our database schema design is really complex). We use readExternal and
   writeExternal to deserialize /serialize objects. We already face some
   serious performance issues when the data is large. I think protobuf
   can definitely make things better for our case. Is there a way to
   integrate Protobuf classes with our existing DAO model?
 



--~--~-~--~~~---~--~~
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: how to resize a repeated field

2009-11-10 Thread Romain François

On 11/10/2009 11:04 AM, Romain François wrote:

 Hello,

 For example if I have a repeated int32 field that currently contains 10
 elements, and I want to modify the field to only contain 3 elements.

 Is there a way to achieve this using the methods of the Reflection
 class, or do I have to first ClearField, and then call AddInt32 three
 times ?

 Many thanks,

 Romain


Hi,

Sorry for wasting bandwidth, I should use RemoveLast I guess.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/EAD5 : LondonR slides
|- http://tr.im/BcPw : celebrating R commit #5
`- http://tr.im/ztCu : RGG #158:161: examples of package IDPmisc


--~--~-~--~~~---~--~~
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] Retrieving data with field number and wire type

2009-11-10 Thread rahul prasad
Hi,

Is there a facility in protobuf library to retrieve data if the field
numbers and wire types are known? If so how to go about this?

Regards,
Rahul

--~--~-~--~~~---~--~~
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: Retrieving data with field number and wire type

2009-11-10 Thread Evan Jones

On Nov 10, 2009, at 9:25 , rahul prasad wrote:
 Is there a facility in protobuf library to retrieve data if the  
 field numbers and wire types are known? If so how to go about this?

If you don't want to use the generated code that handles this for you  
for some reason, you want to look at CodedInputStream

C++:
http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google.protobuf.io.coded_stream.html

Java:
http://code.google.com/apis/protocolbuffers/docs/reference/java/index.html?com/google/protobuf/CodedInputStream.html

--
Evan Jones
http://evanjones.ca/


--~--~-~--~~~---~--~~
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: [Debian] Compilation problem

2009-11-10 Thread Evan Jones

Visionweb wrote:
 Hello,
 
 I have a programm test that I can't compile under Debian, with g++.
 The same programm is runing with my Ubuntu, and eclipse. Now, I try to
 compile it under Debian, with g++ (command line). But I have this
 error:
 
 g++ -o udp_client udp_client.cpp
 /tmp/ccaUFigk.o: In function `main':
 udp_client.cpp:(.text+0x1cf): undefined reference to
 `test::Tube_Info::Tube_Info()'
 udp_client.cpp:(.text+0x570): undefined reference to
 `google::protobuf::MessageLite::SerializeToString
 (std::basic_stringchar, std::char_traitschar, std::allocatorchar
 *) const'
 udp_client.cpp:(.text+0x6f7): undefined reference to
 `test::Tube_Info::~Tube_Info()'
 collect2: ld returned 1 exit status
 
 What I have forget?

You need to include the .cpp file that defines the Tube_Info class, or a 
.o that has a compiled version of it. You may wish to read:

http://pages.cs.wisc.edu/~beechung/ref/gcc-intro.html


Evan

-- 
Evan Jones
http://evanjones.ca/

--~--~-~--~~~---~--~~
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] [Debian] Compilation problem

2009-11-10 Thread Visionweb

Hello,

I have a programm test that I can't compile under Debian, with g++.
The same programm is runing with my Ubuntu, and eclipse. Now, I try to
compile it under Debian, with g++ (command line). But I have this
error:

g++ -o udp_client udp_client.cpp
/tmp/ccaUFigk.o: In function `main':
udp_client.cpp:(.text+0x1cf): undefined reference to
`test::Tube_Info::Tube_Info()'
udp_client.cpp:(.text+0x570): undefined reference to
`google::protobuf::MessageLite::SerializeToString
(std::basic_stringchar, std::char_traitschar, std::allocatorchar
*) const'
udp_client.cpp:(.text+0x6f7): undefined reference to
`test::Tube_Info::~Tube_Info()'
collect2: ld returned 1 exit status

What I have forget?

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



[protobuf] Re: Difference between protobuf implementations

2009-11-10 Thread Kenton Varda
On Tue, Nov 10, 2009 at 7:28 AM, rahul prasad rahu...@gmail.com wrote:

 Hi,

 May i ask whats the difference between these two protobuf implementations?

 com.google.common.io.protocol.ProtoBuf.java


I've never heard of this.  Where does it come from?


 com.google.protobuf package classes


This is the official implementation.

--~--~-~--~~~---~--~~
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: Retrieving data with field number and wire type

2009-11-10 Thread Kenton Varda
On Tue, Nov 10, 2009 at 6:25 AM, rahul prasad rahu...@gmail.com wrote:

 Hi,

 Is there a facility in protobuf library to retrieve data if the field
 numbers and wire types are known?


Write a .proto file with that information.  Then you can compile it, or you
can use protoc's --decode flag.

If you need something automated that runs as part of a larger app, you can
construct a FileDescriptorProto at run-time, which is a structured
representation of the contents of a .proto file.  You can then convert that
to a FileDescriptor using DescriptorPool (C++) or
Descriptors.FileDescriptor.buildFrom() (Java), and then construct a
DynamicMessage from the descriptors (either language).

--~--~-~--~~~---~--~~
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] Regd: How do I represent java.util.Date in my .proto definition?

2009-11-10 Thread rahul prasad
How do I represent java.util.Date in my .proto definition? Is this
supported, or any other workaround for doing this?

Regards,
Rahul Prasad

--~--~-~--~~~---~--~~
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: Difference between protobuf implementations

2009-11-10 Thread rahul prasad
So, If I am developing for Android, should I use this protobuf library
instead of the standard implementation present at com.google.protobuf? Will
I encounter any problems mid way due to this switch? Any feedback would be
greatly appreciated.

Regards,
Rahul


On Tue, Nov 10, 2009 at 3:56 PM, Henner Zeller h.zel...@acm.org wrote:

 Seems to be part of Android
  http://www.google.com/codesearch?q=com.google.common.io.protocol.ProtoBuf

 On Tue, Nov 10, 2009 at 11:36, Kenton Varda ken...@google.com wrote:
  On Tue, Nov 10, 2009 at 7:28 AM, rahul prasad rahu...@gmail.com wrote:
 
  Hi,
  May i ask whats the difference between these two protobuf
 implementations?
  com.google.common.io.protocol.ProtoBuf.java
 
  I've never heard of this.  Where does it come from?
 
 
  com.google.protobuf package classes
 
  This is the official implementation.
   
 


--~--~-~--~~~---~--~~
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: Difference between protobuf implementations

2009-11-10 Thread Kenton Varda
You'd have to ask the Android people, as they are the owners of this
alternate implementation.  IIRC, they have not released the code generator
program to go with it, so you probably won't be able to use it.

The official protobuf implementation in lite mode should work great on
Android -- this is exactly the use case lite-mode was created for.  Add the
following to your .proto file in order to use lite mode:
  option optimize_for = LITE_RUNTIME;

So I'd recommend using the official implementation, but again I know almost
nothing about Android's implementation so it's hard for me to make an
informed recommendation.

On Tue, Nov 10, 2009 at 1:36 PM, rahul prasad rahu...@gmail.com wrote:

 So, If I am developing for Android, should I use this protobuf library
 instead of the standard implementation present at com.google.protobuf? Will
 I encounter any problems mid way due to this switch? Any feedback would be
 greatly appreciated.

 Regards,
 Rahul


 On Tue, Nov 10, 2009 at 3:56 PM, Henner Zeller h.zel...@acm.org wrote:

 Seems to be part of Android

 http://www.google.com/codesearch?q=com.google.common.io.protocol.ProtoBuf

 On Tue, Nov 10, 2009 at 11:36, Kenton Varda ken...@google.com wrote:
  On Tue, Nov 10, 2009 at 7:28 AM, rahul prasad rahu...@gmail.com
 wrote:
 
  Hi,
  May i ask whats the difference between these two protobuf
 implementations?
  com.google.common.io.protocol.ProtoBuf.java
 
  I've never heard of this.  Where does it come from?
 
 
  com.google.protobuf package classes
 
  This is the official implementation.
   
 




--~--~-~--~~~---~--~~
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: Difference between protobuf implementations

2009-11-10 Thread rahul prasad
I am in a situation, where the .proto files are not present for the Protocol
Buffers used in the application I am working on. Since the .proto files need
to be created, I was wondering if the following yellow highlighted numbers
should correspond to the same fields they stood for in the actual .proto
files which were used to generate the classes?

For example, -

old proto file:
package protos;
message Person {
  required string name = 1;
  optional string age = 2;
}

new proto file:
package protos;
message Person {
  required string name = 2;
  optional string age = 1;
}

will this throw error when trying to retrieve data?, so what would your
suggestion be in creating such a proto file when the original is not
present.

Regards,
Rahul

--~--~-~--~~~---~--~~
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: Difference between protobuf implementations

2009-11-10 Thread Kenton Varda
Yes, the tag numbers have to be the same.

If you have code that was generated from the original .proto file, look
inside it for comments that look like proto field definitions -- they should
include the tag number.  Otherwise you're out of luck.

On Tue, Nov 10, 2009 at 4:00 PM, rahul prasad rahu...@gmail.com wrote:

 I am in a situation, where the .proto files are not present for the
 Protocol Buffers used in the application I am working on. Since the .proto
 files need to be created, I was wondering if the following yellow
 highlighted numbers should correspond to the same fields they stood for in
 the actual .proto files which were used to generate the classes?

 For example, -

 old proto file:
 package protos;
 message Person {
   required string name = 1;
   optional string age = 2;
 }

 new proto file:
 package protos;
 message Person {
   required string name = 2;
   optional string age = 1;
 }

 will this throw error when trying to retrieve data?, so what would your
 suggestion be in creating such a proto file when the original is not
 present.

 Regards,
 Rahul

 


--~--~-~--~~~---~--~~
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: Streaming Dynamic Messages

2009-11-10 Thread Dan

Yes! That works, thanks.



On Nov 9, 8:37 pm, Kenton Varda ken...@google.com wrote:
 You want:  com.google.protobuf.Descriptors.FileDescriptor.buildFrom()



 On Mon, Nov 9, 2009 at 5:25 PM, Dan lozi...@gmail.com wrote:

  Im trying to write the following client/server exchange using the Java
  Protobuf API:

  1) Client makes a request to the server
  2) Server creates a series of Messages all of the same type to stream
  back to the client.  The type of the messages will be different
  depending on the parameters of the client's request.
  3) The Server streams the messages back to the client in the following
  format:

  Descriptor Size
  MessageDescriptor (as a DescriptorProto message)
  Message Size
  Message
  Message Size
  Message
  ...

  4) (This is where I'm stuck) The client makes a csv file from the
  results by reading the field names from the DescriptorProto to use for
  the header and iterates through the fields of each message to write
  the records.  It looks like DynamicMessage should give me what I need
  but I can't figure out how to convert the DescriptorProto object to
  the Descriptor object.

  Note: I know this approach of sending just the DescriptorProto for the
  messages cannot possibly work if the message has any fields that are
  of a Message Type that are not nested but for my use case I know that
  fields of the messages returned will always be a primative type.  Even
  using the approach described in the techniques section of the wiki of
  sending an entire FileDescriptorSet I still have the same problem of
  converting the Proto objects to the proper framework objects.  I've
  seen in previous posts how to do this using the C++ API but not the
  Java Implementation.- Hide quoted text -

 - Show quoted text -
--~--~-~--~~~---~--~~
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: On SnowLeopard, EXC_CRASH (SIGABRT)

2009-11-10 Thread Ryan Rosario

Hi,

I am the fellow that has been dealing with this problem on Snow
Leopard.
I am left scratching my head as to the cause.

I installed VMware in Snow Leopard and loaded Snow Leopard Server onto
VMware (not possible to install regular Snow Leopard on it).
I wanted to experiment with a clean system that only has an OS and
XCode on it.

I built pkg-config as well as protobuf using the Apple g++. I am able
to get a bit further with Saptarshi's example program given earlier,
and then I get the same crash. It seems like it may be occurring in
some type of destructor, when the program ends. I am not sure if this
progress is due to the clean configuration, or if it is due to the
fact that I am using 10.6 Server instead of regular 10.6.

I also tried adding -D_GLIBCXX_FULLY_DYNAMIC_STRING to CPPFLAGS and
even CXXFLAGS to the makefiles for both protobuf and the example and
rebuilding protobuf and the examples to no avail.

If more information is needed, let me know and I will post.

-Ryan

10.6 Server, clean configuration with Apple compilers

Program received signal SIGABRT, Aborted.
0x7fff869b8ff6 in __kill ()
(gdb) backtrace
#0  0x7fff869b8ff6 in __kill ()
#1  0x7fff86a5a072 in abort ()
#2  0x7fff86971095 in free ()
#3  0x00018399 in __tcf_1 () at basic_string.h:238
#4  0x7fff8697d274 in __cxa_finalize ()
#5  0x7fff8697d18c in exit ()
#6  0x0001187f in start () at atomicity.h:50

10.6, custom configuration, GCC 4.5

#0  0x7fff836bdff6 in __kill ()
#1  0x7fff8375f072 in abort ()
#2  0x7fff83676095 in free ()
#3  0x7fff87aa71e8 in std::string::reserve ()
#4  0x7fff87aa742b in std::string::append ()
#5  0x00010002fd3c in
google::protobuf::io::CodedInputStream::ReadString ()
#6  0x0001346c in
google::protobuf::internal::WireFormatLite::ReadString () at /usr/
local/include/google/protobuf/wire_format_lite_inl.h:142
#7  0x0001346c in STRING::MergePartialFromCodedStream
(this=0x1004014b0, input=0x7fff5fbfeed0) at wire_format_lite_inl.h:939
#8  0x00014e58 in ReadMessageNoVirtualSTRING [inlined] ()
at /usr/local/include/google/protobuf/wire_format_lite_inl.h:200
#9  0x00014e58 in REXP::MergePartialFromCodedStream
(this=0x1004012c0, input=0x7fff5fbfeed0) at wire_format_lite_inl.h:397
#10 0x000152b8 in ReadMessageNoVirtualREXP [inlined] () at /
usr/local/include/google/protobuf/wire_format_lite_inl.h:200
#11 0x000152b8 in REXP::MergePartialFromCodedStream
(this=0x7fff5fbfef70, input=0x7fff5fbfeed0) at wire_format_lite_inl.h:
438
#12 0x00010001736e in
google::protobuf::MessageLite::ParseFromArray ()
#13 0x000181ca in main (argc=value temporarily unavailable,
due to optimizations, argv=value temporarily unavailable, due to
optimizations) at testparse.cc:25


On Nov 1, 6:35 am, Saptarshi Guha saptarshi.g...@gmail.com wrote:
 Hello,
 Your explanation sounds right. Neither do I have Snow Leopard, so will  
 have to ask the user.
 Personally, I would never (unless absolutely  forced to) install  
 another GCC.  Tried it once, and so many things started failing it was  
 miserable.

 I'll get back to this thread.

 Regards
 Saptarshi

 On Nov 1, 2009, at 3:15 AM, Kenton Varda wrote:



  Sorry, I don't have access to a Snow Leopard machine to test this on.

  However, your second link looks like a very likely culprit.  They  
  seem to be saying that all C++ code on Snow Leopard needs to be  
  compiled with -D_GLIBCXX_FULLY_DYNAMIC_STRING, otherwise it will  
  likely crash.  So, I'd recommend re-compiling libprotobuf and your  
  app with this flag.

  But I'm confused.  This seems like a truly massive bug --  
  essentially, it sounds like Apple has released a C++ compiler that,  
  by default, is not compatible with their C++ standard library.  Is  
  it really possible that such a huge problem would make it through  
  basic testing, let alone be shipped and live several months with  
  fewer than 10 sites on the entire internet mentioning it?

  No, that seems unlikely to me.  My guess is that the Apple release  
  of GCC actually sets this flag correctly by default, but you are  
  actually using some other GCC, perhaps from MacPorts or some such.  
  Could this be the case?

  On Sat, Oct 31, 2009 at 5:58 PM, Saptarshi Guha saptarshi.g...@gmail.com
   wrote:

  On Oct 30, 2009, at 7:14 PM, Kenton Varda wrote:

   There's not much we can do with this without a reproducible demo.

  Hello,
  I have placed a link[1] to tgz file, which can be run like

  tar zxvf test.parse.tgz
  cd testdata
  make
  ./testme testdata.bin

  If all works well, it should display an  entry of string keys and
  string values.
  It compiles and runs on Leopard 10.5.7 (Macbook), but fails with

  
  ./testme testdata.bin
  Reading in 3239 bytes
  testme(41471) malloc: *** error for object 0x100222520: pointer being
  freed was not allocated
  *** set a breakpoint in malloc_error_break to debug
  
  on Snow Leopard (i can't