From dibarra at aqualogy.net Tue Feb 5 13:32:37 2013 From: dibarra at aqualogy.net (=?iso-8859-1?Q?David_Ibarra_G=F3mez?=) Date: Tue, 5 Feb 2013 13:32:37 +0100 Subject: [Rprotobuf-yada] Some help wanted Message-ID: <73BF4AC06CB74F44BB2575D554395220076A098245@SRVEXMBV01.ga.local> Hello, I'm using RProtobuf (on Debian Wheezy, R version 2.14.1 (2011-12-22), just downloaded RProtobuf). I'm using this proto file: message caudal{ required uint32 id = 1; required string signo =2; optional string s_id =3; } message sector{ required string nombre=1; required string nombre_abreviado=2; required string gerencia = 3; required uint32 activo=4; required string literal = 5; repeated caudal caudales = 6; } message explotacion{ required string nombre =1; repeated sector sectores =2; } I'm putting data inside a proto from a data.frame that I read from CSV (by the way I suppose it's not the best option but nevertheless I try). But I'm not able to use correctly the add method (for adding a repeated message): sectores <-new(explotacion,nombre="SB") conjunto<-seq(1,length(gerencias[,1])) for(i in conjunto){ sectorini <-new(sector, nombre=as.character(gerencias[i,]$NOM.SECTOR), nombre_abreviado=as.character(gerencias[i,]$ABREVIAT), gerencia = as.character(gerencias[i,]$GERENCIA), activo = as.numeric(gerencias[i,]$codi), literal = as.character(gerencias[i,]$LITERAL.FUNCI) ) sectores$add("caudal",sectorini) } I get "Error in add(x, ...) : could not get FieldDescriptor for field" Could you please help me to use that add function: "sectores$add("caudal",sectorini)" Thank you David ________________________________ Disclaimer: http://disclaimer.aqualogy.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dibarra at aqualogy.net Tue Feb 5 18:23:21 2013 From: dibarra at aqualogy.net (=?iso-8859-1?Q?David_Ibarra_G=F3mez?=) Date: Tue, 5 Feb 2013 18:23:21 +0100 Subject: [Rprotobuf-yada] Also play with lists but I get the same problem Message-ID: <73BF4AC06CB74F44BB2575D554395220076A098642@SRVEXMBV01.ga.local> Hi, I also tried to do something more like the examples but I get the same error: i=1 sectorini <-list(new(sector, nombre=as.character(gerencias[i,]$NOM.SECTOR), nombre_abreviado=as.character(gerencias[i,]$ABREVIAT), gerencia = as.character(gerencias[i,]$GERENCIA), activo = as.numeric(gerencias[i,]$codi), literal = as.character(gerencias[i,]$LITERAL.FUNCI) )) sectores$caudales<-sectorini sectores$caudales<-sectorini Error in `$<-`(`*tmp*`, "caudales", value = list()) : could not get FieldDescriptor for field Is it my error or should I change the definition of the proto to carry the "caudal" message inside? Regards David Ibarra ________________________________ Disclaimer: http://disclaimer.aqualogy.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From dibarra at aqualogy.net Tue Feb 5 18:35:42 2013 From: dibarra at aqualogy.net (=?iso-8859-1?Q?David_Ibarra_G=F3mez?=) Date: Tue, 5 Feb 2013 18:35:42 +0100 Subject: [Rprotobuf-yada] Forget my last 2 messages Message-ID: <73BF4AC06CB74F44BB2575D554395220076A098650@SRVEXMBV01.ga.local> I feel like it's monday morning. Sorry for the stupid questions Regards ________________________________ Disclaimer: http://disclaimer.aqualogy.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From edd at debian.org Tue Feb 5 18:54:15 2013 From: edd at debian.org (Dirk Eddelbuettel) Date: Tue, 5 Feb 2013 11:54:15 -0600 Subject: [Rprotobuf-yada] Forget my last 2 messages In-Reply-To: <73BF4AC06CB74F44BB2575D554395220076A098650@SRVEXMBV01.ga.local> References: <73BF4AC06CB74F44BB2575D554395220076A098650@SRVEXMBV01.ga.local> Message-ID: <20753.18247.108697.300876@max.nulle.part> On 5 February 2013 at 18:35, David Ibarra G?mez wrote: | I feel like it's monday morning. :) | Sorry for the stupid questions No worries. So what was the problem? Dirk -- Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com From dibarra at aqualogy.net Tue Feb 5 19:08:00 2013 From: dibarra at aqualogy.net (=?iso-8859-1?Q?David_Ibarra_G=F3mez?=) Date: Tue, 5 Feb 2013 19:08:00 +0100 Subject: [Rprotobuf-yada] Forget my last 2 messages In-Reply-To: <20753.18247.108697.300876@max.nulle.part> References: <73BF4AC06CB74F44BB2575D554395220076A098650@SRVEXMBV01.ga.local> <20753.18247.108697.300876@max.nulle.part> Message-ID: <73BF4AC06CB74F44BB2575D554395220076A098667@SRVEXMBV01.ga.local> I was using the same name for a protocol buffer message and the R object. So if I use "zectores" rather then "sectores" it works, even using "add" rather than "list". zectores <-new(explotacion,nombre="SB") for(i in conjunto){ zectores$add("sectores",new(sector, nombre=as.character(gerencias[i,]$NOM.SECTOR), nombre_abreviado=as.character(gerencias[i,]$ABREVIAT), gerencia = as.character(gerencias[i,]$GERENCIA), activo = as.numeric(gerencias[i,]$codi), literal = as.character(gerencias[i,]$LITERAL.FUNCI) ) ) } Also during test process, I changed the protocol definition, but I think It would work in the other case also: message sector{ message caudal{ required uint32 id = 1; required string signo =2; optional string s_id =3; } required string nombre=1; required string nombre_abreviado=2; required string gerencia = 3; required uint32 activo=4; required string literal = 5; repeated caudal caudales = 6; } message explotacion{ required string nombre =1; repeated sector sectores =2; } David Ibarra Gomez -----Mensaje original----- De: Dirk Eddelbuettel [mailto:edd at debian.org] Enviado el: martes, 05 de febrero de 2013 18:54 Para: David Ibarra G?mez CC: Rprotobuf-yada at lists.r-forge.r-project.org Asunto: Re: [Rprotobuf-yada] Forget my last 2 messages On 5 February 2013 at 18:35, David Ibarra G?mez wrote: | I feel like it's monday morning. :) | Sorry for the stupid questions No worries. So what was the problem? Dirk -- Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com Disclaimer: http://disclaimer.aqualogy.net/ From mstokely at google.com Tue Feb 5 19:10:41 2013 From: mstokely at google.com (Murray Stokely) Date: Tue, 5 Feb 2013 10:10:41 -0800 Subject: [Rprotobuf-yada] Forget my last 2 messages In-Reply-To: <73BF4AC06CB74F44BB2575D554395220076A098667@SRVEXMBV01.ga.local> References: <73BF4AC06CB74F44BB2575D554395220076A098650@SRVEXMBV01.ga.local> <20753.18247.108697.300876@max.nulle.part> <73BF4AC06CB74F44BB2575D554395220076A098667@SRVEXMBV01.ga.local> Message-ID: I have seen exactly this mistake many tines at Google. Probably we should make it provide a more user friendly error when add on a descriptor is called Murray On Feb 5, 2013 10:08 AM, "David Ibarra G?mez" wrote: > I was using the same name for a protocol buffer message and the R object. > > So if I use "zectores" rather then "sectores" it works, even using "add" > rather than "list". > > zectores <-new(explotacion,nombre="SB") > for(i in conjunto){ > zectores$add("sectores",new(sector, > nombre=as.character(gerencias[i,]$NOM.SECTOR), > nombre_abreviado=as.character(gerencias[i,]$ABREVIAT), > gerencia = as.character(gerencias[i,]$GERENCIA), > activo = as.numeric(gerencias[i,]$codi), > literal = as.character(gerencias[i,]$LITERAL.FUNCI) > ) > ) > } > > Also during test process, I changed the protocol definition, but I think > It would work in the other case also: > > message sector{ > message caudal{ > required uint32 id = 1; > required string signo =2; > optional string s_id =3; > } > > required string nombre=1; > required string nombre_abreviado=2; > required string gerencia = 3; > required uint32 activo=4; > required string literal = 5; > repeated caudal caudales = 6; > } > message explotacion{ > required string nombre =1; > repeated sector sectores =2; > } > > > > David Ibarra Gomez > > > -----Mensaje original----- > De: Dirk Eddelbuettel [mailto:edd at debian.org] > Enviado el: martes, 05 de febrero de 2013 18:54 > Para: David Ibarra G?mez > CC: Rprotobuf-yada at lists.r-forge.r-project.org > Asunto: Re: [Rprotobuf-yada] Forget my last 2 messages > > > On 5 February 2013 at 18:35, David Ibarra G?mez wrote: > | I feel like it's monday morning. > > :) > > | Sorry for the stupid questions > > No worries. So what was the problem? > > Dirk > > -- > Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com > > Disclaimer: http://disclaimer.aqualogy.net/ > _______________________________________________ > Rprotobuf-yada mailing list > Rprotobuf-yada at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rprotobuf-yada > -------------- next part -------------- An HTML attachment was scrubbed... URL: From johansen at adobe.com Tue Feb 26 00:28:14 2013 From: johansen at adobe.com (Josh Hansen) Date: Mon, 25 Feb 2013 15:28:14 -0800 Subject: [Rprotobuf-yada] How are multiple messages delimited? Message-ID: Examples such as the one in http://lists.r-forge.r-project.org/pipermail/rprotobuf-yada/2009-November/000042.html indicate that RProtoBuf is able to read multiple messages from the same file. Is that correct? If so, how does RProtoBuf's read method expect those messages to be delimited? I have files with multiple messages delimited using the PB library's writeDelimitedTo(?) function but haven't been able to read it using RProtoBuf. Any thoughts would be appreciated. - Josh -------------- next part -------------- An HTML attachment was scrubbed... URL: From mstokely at google.com Tue Feb 26 01:02:55 2013 From: mstokely at google.com (Murray Stokely) Date: Mon, 25 Feb 2013 16:02:55 -0800 Subject: [Rprotobuf-yada] How are multiple messages delimited? In-Reply-To: References: Message-ID: Are you using Python or Java's writeDelimitedTo function? I think this function isn't implemented in the C++ library that RProtoBuf is based on : http://stackoverflow.com/questions/8269452/google-protocol-buffers-parsedelimitedfrom-and-writedelimitedto-for-c Can you write a length before each method and write a helper function to parse that? It would be a nice addition to RProtoBuf. - Murray On Mon, Feb 25, 2013 at 3:28 PM, Josh Hansen wrote: > Examples such as the one in > http://lists.r-forge.r-project.org/pipermail/rprotobuf-yada/2009-November/000042.html indicate > that RProtoBuf is able to read multiple messages from the same file. Is > that correct? If so, how does RProtoBuf's read method expect those messages > to be delimited? I have files with multiple messages delimited using the PB > library's writeDelimitedTo(?) function but haven't been able to read it > using RProtoBuf. > Any thoughts would be appreciated. > - Josh > > _______________________________________________ > Rprotobuf-yada mailing list > Rprotobuf-yada at lists.r-forge.r-project.org > https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rprotobuf-yada > -------------- next part -------------- An HTML attachment was scrubbed... URL: