Protoc and line endings

2009-07-01 Thread Marc Gravell

I'm using protoc as the raw .proto parser for protobuf-net (I then
process the compiled binary for code-generation); at the moment, it is
very sensitive about line endings - if it isn't LF, it won't work.

This creates a bit of a nag for Windows users, as you have to go out
of your way to get the right line endings. I could patch the input
files, but that gets very tricky if the user is importing multiple
other files (with the wrong line endings) into their proto - and it
means that their CRLF files wouldn't work fully interoperably.

I have no idea how complex it would be, but is there any chance that
protoc could be less choosy about line endings?

For now, I've added some code to protobuf-net's "protogen", so that if
protoc reports failure it checks the *known* files for CR (and advises
the user) - but this is still tricky for the import scenario.

Thoughts?

Marc
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



output streams

2009-07-01 Thread J.V.

I'm trying to get the following to work but nothing is being written to 
the output stream.
any ideas?

private void testEncode() throws Exception {
OutputStream out = new ByteArrayOutputStream();
CodedOutputStream cos = CodedOutputStream.newInstance(out);

Person.person.Builder person = Person.person.newBuilder();
person.setFirstName("First");
person.setLastName("Last");
person.build().writeTo(cos);
}

When I try to decode cos it throws an exception
Exception in thread "main" 
com.google.protobuf.InvalidProtocolBufferException: Protocol message 
contained an invalid tag (zero).

--~--~-~--~~~---~--~~
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: Java jar - downloadable? or only compilable?

2009-07-01 Thread Kenton Varda
In order to *use* the Java implementation, you need to build that same C++
code -- the protocol compiler.  The Java protobuf runtime is mostly useless
without it.  However, you can get a prebuilt copy of protoc.exe for windows
here:
http://code.google.com/p/protobuf/downloads/detail?name=protoc-2.1.0-win32.zip

You can then use it to build the Java code.

On Wed, Jul 1, 2009 at 10:33 PM, J.V.  wrote:

>
> In order to get the Java implementation I have to compile some C++ code,
> but have limited resources on my machine at this time to install a
> compiler.
> Where can I get the Java jar to drop into my project for Win32?
>
> thanks
>
> J.V.
>
> >
>

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



Java jar - downloadable? or only compilable?

2009-07-01 Thread J.V.

In order to get the Java implementation I have to compile some C++ code, 
but have limited resources on my machine at this time to install a compiler.
Where can I get the Java jar to drop into my project for Win32?

thanks

J.V.

--~--~-~--~~~---~--~~
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: Service Factory?

2009-07-01 Thread rthompson.dtisoft....@gmail.com

That worked!  Thanks!

On Jun 30, 5:06 pm, Kenton Varda  wrote:
> On Tue, Jun 30, 2009 at 4:28 PM, rthompson.dtisoft@gmail.com <
>
> rthompson.dtisoft@gmail.com> wrote:
>
> > I'm confused. Shouldn't I just create a class called
> > DynamicServiceStub and have it inherit from "class LIBPROTOBUF_EXPORT
> > Service"?
> > And then implement a method like "Service* DynamicServiceStub::New
> > (ServiceDescriptor*, RpcChannel* )  " ?
>
> Yes, that is what I was suggesting.
>
> > If I get this working, I'd like to pass it back to you guys to perhaps
> > use it in the next release.
>
> Honestly, I'm having some trouble thinking of use cases for this.  How do
> you intend to use this class?  Why not just call RpcChannel directly
> instead?
>
>
>
>
>
> > On Jun 30, 2:08 pm, Kenton Varda  wrote:
> > > Oh, you want something like DynamicMessage except for services?
> > >  DynamicServiceStub, perhaps?  There is no such thing included in the
> > > library, but it would be really trivial to write.  All you need to do is
> > > implement the Service interface as a wrapper around the RpcChannel
> > > interface.  Have GetRequestPrototype() and GetResponsePrototype() return
> > > DynamicMessages, and have CallMethod() just call the RpcChannel's
> > > CallMethod().
> > > On Tue, Jun 30, 2009 at 2:03 PM, rthompson.dtisoft@gmail.com <
>
> > > rthompson.dtisoft@gmail.com> wrote:
>
> > > > Right, but I'm importing a .proto file at runtime using the Importer
> > > > class.  This ultimately leaves me with a ServiceDescriptor.  I'd like
> > > > to instantiate that Service from the ServiceDescriptor.
> > > > The python code has a ServiceStubBuilder class.  Where is there a
> > > > ServiceStubBuilder in the C++ API?
>
> > > > On Jun 30, 1:33 pm, Kenton Varda  wrote:
> > > > > Yes.  In C++ the protocol compiler will generate a service interface
> > and
> > > > a
> > > > > stub implementation when given a .proto file containing a service
> > > > > definition.  This is equivalent to what Python's service_reflection
> > > > module
> > > > > does.
> > > > > But this is not an RPC implementation.  You still have to add your
> > own
> > > > > networking layer.
>
> > > > > On Tue, Jun 30, 2009 at 9:26 AM, rthompson.dtisoft@gmail.com <
>
> > > > > rthompson.dtisoft@gmail.com> wrote:
>
> > > > > > Is there a C++ equivalent to
>
> >http://code.google.com/apis/protocolbuffers/docs/reference/python/goo.
> > > > ..
> > > > > > ?
>
> > > > > > which is used to create protocol service and service stub classes
> > from
> > > > > > ServiceDescriptor objects at runtime.
>
> > > > > > On Jun 29, 3:56 pm, Kenton Varda  wrote:
> > > > > > > Protocol Buffers does not include an RPC implementation, only
> > > > abstract
> > > > > > > interfaces for one.  ServiceDescriptor is useful for implementing
> > > > your
> > > > > > own
> > > > > > > RPC system on top of protocol buffers -- it allows you to define
> > your
> > > > > > > services directly in the .proto file even though protocol buffers
> > > > itself
> > > > > > > does not provide RPC.
>
> > > > > > > On Mon, Jun 29, 2009 at 10:15 AM,
> > rthompson.dtisoft@gmail.com <
>
> > > > > > > rthompson.dtisoft@gmail.com> wrote:
>
> > > > > > > > What can you do with a ServiceDescriptor?  Is there a
> > > > > > > > DynamicServiceFactory similar to the DynamicMessageFactory
> > where
> > > > you
> > > > > > > > can instantiate a service when all you have is a
> > ServiceDescriptor,
> > > > or
> > > > > > > > some other equivalent way of doing it?
>
> > > > > > > > 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
-~--~~~~--~~--~--~---



Re: Support for JDK 1.4?

2009-07-01 Thread Jarle Hansen

The Java ME version: http://code.google.com/p/protobuf-javame/
Should work fine with earlier versions of Java, I have however not
tested it.

I had an idea to optimize it for Java 1.4 as well, to offer things
like ArrayList and so on but didn't really know if there was any need
for it.
Let me know if you try out the Java ME version on Java 1.4 and please
remember that it is not in a final release version yet.

Jarle Hansen


On Jun 30, 4:32 pm, misha  wrote:
> I was wondering if google protocl buffers can work with java 1.4
--~--~-~--~~~---~--~~
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: ProtocolBuffer crash before program execution

2009-07-01 Thread Kenton Varda
Well, to be fair, Microsoft explicitly says that STL is not allowed to be
used in library interfaces for this exact reason.  However, protocol buffers
was designed on a platform that had no such restriction, and we can't very
well rewrite it now just because one platform -- that we don't even use
internally -- has unusual requirements.  So we did the best we could, and
documented in the readme that you need to use matching runtimes.

But yeah, I think it's a bad requirement and they could definitely do a
better job detecting the resulting problems.

On Wed, Jul 1, 2009 at 2:07 AM, rodrigob  wrote:

>
> Ok,
> using the debug version library with the debug version of the program
> fixed the crash.
> It is very disappointing to see that in VS20xx such miserable errors
> can occur, without any proper error message ("incompatible libraries"
> when linking, instead of random crash when executing).
>
> Thanks for the quicks answer.
> Regards,
> rodrigob.
>
> On Jun 30, 1:01 am, Kenton Varda  wrote:
> > Sorry, I don't see what the problem could be.
> > Make sure that you are compiling libprotobuf and your project with the
> same
> > C runtime version (e.g. debug vs. non-debug, DLL vs. static,
> single-threaded
> > vs. multi-threaded).
> >
> > If that doesn't help, can you send me a minimal example program that
> > demonstrates the problem, so I can debug it?
> >
> > On Mon, Jun 29, 2009 at 5:45 AM, rodrigob  >wrote:
> >
> >
> >
> > > I have uploaded the crash screenshot with Protobug 2.1.0 at
> >
> > >http://files.getdropbox.com/u/185965/parking_planning/protobuf_crash_.
> ..
> >
> > > as you can see the error is very similar.
> > > This problem is being a show stopper for us, any help will be greatly
> > > appreciated...
> >
> > > Regards,
> > > rodrigob.
> >
> > > On Jun 26, 9:25 pm, Kenton Varda  wrote:
> > > > The stack trace you provided looks like it is from v2.0.3.  The
> > > > initialization code changed drastically in 2.1.0 -- the method
> > > > DescriptorPool::InternalBuildGeneratedFile no longer exists, for
> example.
> > > >  Can you provide a stack trace using 2.1.0?
> >
> > > > On Fri, Jun 26, 2009 at 8:07 AM, rodrigob <
> rodrigo.benen...@gmail.com
> > > >wrote:
> >
> > > > > Hello there,
> > > > > I'm usually a linux developer, but I occasionally have to develop
> some
> > > > > Windows applications.
> >
> > > > > I have a Gtk + Cairo + ProtocolBuffers that was ported to windows
> some
> > > > > months ago without any problem.
> >
> > > > > Now I have a new one, with similar setup but a few more
> dependencies
> > > > > (CGAL, RSVG and others).
> >
> > > > > After configuring the visual studio project and getting the code to
> > > > > compile and link correctly the executable crashes miserably on a
> > > > > ProtocolBuffers exception.
> >
> > > > > The crash details can be inspected at
> >
> > >
> http://files.getdropbox.com/u/185965/parking_planning/protobuf_crash.jpg
> >
> > > > > the weird thing is that the application crashes before ever
> entering
> > > > > in the main, during some static elements initialization defined by
> > > > > Protocol Buffer.
> >
> > > > > I used first protobuf 2.1.0 and then 2.0.3, both crash in the same
> > > > > way.
> >
> > > > > Any idea of what is going on ? I know that Protobuf can work unders
> > > > > VisualStudio, but this time it is not working for me... what could
> > > > > cause this kind of crashes ?
> >
> > > > > The problem seems similar to
> >
> > > > >
> http://groups.google.com/group/protobuf/browse_thread/thread/f0f8108f.
> > > ..
> >
> > > > > but the crash source is no the same.
> >
> > > > > I'm using Windows Xp and Visual Studio 2005.
> >
> > > > > Any help would be appreciated.
> >
> > > > > Regards,
> > > > > rodrigob.
> >
>

--~--~-~--~~~---~--~~
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: where are the examples

2009-07-01 Thread Kenton Varda
We have our own system.  While we would love to open source it in principle,
it is currently tightly coupled to our internal datacenter and machine
configurations, so we can't really release the code as-is.  I personally
hope that we manage to get it out eventually but I have no idea if or when
it would happen.

On Wed, Jul 1, 2009 at 10:18 AM, J.V.  wrote:

>
> thanks, which product(s) does Google use internally or find most
> beneficial?
>
> Kenton Varda wrote:
> > You could look at one of the open source RPC implementations listed here:
> >
> >
> http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns#RPC_Implementations
> >
>
> >
>

--~--~-~--~~~---~--~~
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: where are the examples

2009-07-01 Thread Alek Storm
Google uses its own internal RPC implementation, and I don't think we can
endorse a particular third-party one as better than the others.  I'd tell
you which one I personally found most beneficial, but I have no experience
with any of them.

Cheers,
Alek

On Wed, Jul 1, 2009 at 10:18 AM, J.V.  wrote:

>
> thanks, which product(s) does Google use internally or find most
> beneficial?
>
> Kenton Varda wrote:
> > You could look at one of the open source RPC implementations listed here:
> >
> >
> http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns#RPC_Implementations
> >
>
> >
>

--~--~-~--~~~---~--~~
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: where are the examples

2009-07-01 Thread J.V.

thanks, which product(s) does Google use internally or find most beneficial?

Kenton Varda wrote:
> You could look at one of the open source RPC implementations listed here:
>
> http://code.google.com/p/protobuf/wiki/ThirdPartyAddOns#RPC_Implementations
>

--~--~-~--~~~---~--~~
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: ProtocolBuffer crash before program execution

2009-07-01 Thread rodrigob

Ok,
using the debug version library with the debug version of the program
fixed the crash.
It is very disappointing to see that in VS20xx such miserable errors
can occur, without any proper error message ("incompatible libraries"
when linking, instead of random crash when executing).

Thanks for the quicks answer.
Regards,
rodrigob.

On Jun 30, 1:01 am, Kenton Varda  wrote:
> Sorry, I don't see what the problem could be.
> Make sure that you are compiling libprotobuf and your project with the same
> C runtime version (e.g. debug vs. non-debug, DLL vs. static, single-threaded
> vs. multi-threaded).
>
> If that doesn't help, can you send me a minimal example program that
> demonstrates the problem, so I can debug it?
>
> On Mon, Jun 29, 2009 at 5:45 AM, rodrigob wrote:
>
>
>
> > I have uploaded the crash screenshot with Protobug 2.1.0 at
>
> >http://files.getdropbox.com/u/185965/parking_planning/protobuf_crash_...
>
> > as you can see the error is very similar.
> > This problem is being a show stopper for us, any help will be greatly
> > appreciated...
>
> > Regards,
> > rodrigob.
>
> > On Jun 26, 9:25 pm, Kenton Varda  wrote:
> > > The stack trace you provided looks like it is from v2.0.3.  The
> > > initialization code changed drastically in 2.1.0 -- the method
> > > DescriptorPool::InternalBuildGeneratedFile no longer exists, for example.
> > >  Can you provide a stack trace using 2.1.0?
>
> > > On Fri, Jun 26, 2009 at 8:07 AM, rodrigob  > >wrote:
>
> > > > Hello there,
> > > > I'm usually a linux developer, but I occasionally have to develop some
> > > > Windows applications.
>
> > > > I have a Gtk + Cairo + ProtocolBuffers that was ported to windows some
> > > > months ago without any problem.
>
> > > > Now I have a new one, with similar setup but a few more dependencies
> > > > (CGAL, RSVG and others).
>
> > > > After configuring the visual studio project and getting the code to
> > > > compile and link correctly the executable crashes miserably on a
> > > > ProtocolBuffers exception.
>
> > > > The crash details can be inspected at
>
> >http://files.getdropbox.com/u/185965/parking_planning/protobuf_crash.jpg
>
> > > > the weird thing is that the application crashes before ever entering
> > > > in the main, during some static elements initialization defined by
> > > > Protocol Buffer.
>
> > > > I used first protobuf 2.1.0 and then 2.0.3, both crash in the same
> > > > way.
>
> > > > Any idea of what is going on ? I know that Protobuf can work unders
> > > > VisualStudio, but this time it is not working for me... what could
> > > > cause this kind of crashes ?
>
> > > > The problem seems similar to
>
> > > >http://groups.google.com/group/protobuf/browse_thread/thread/f0f8108f.
> > ..
>
> > > > but the crash source is no the same.
>
> > > > I'm using Windows Xp and Visual Studio 2005.
>
> > > > Any help would be appreciated.
>
> > > > Regards,
> > > > rodrigob.
--~--~-~--~~~---~--~~
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: Thread-safe messages

2009-07-01 Thread Jes

Thanks Cristopher and Kenton!

I will provide a Mutex to the higher levels as you recommend.

Jes.

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