Re: [CSV] Record Separator query

2017-08-09 Thread Gary Gregory
On Wed, Aug 9, 2017 at 5:04 PM, Guang Chao 
wrote:

> On Wed, Aug 9, 2017 at 6:12 AM, nitin mahendru  >
> wrote:
>
> > Hello All,
> >
> > I am trying to read in a csv file which may be 'crlf' or 'lf' seperated.
> > Then I want to change a particular column, say encrypt it and then write
> > back a new csv with that updated column. I want to use the same record
> > separator as was in the input file.
> >
> > Is there a way to get the record separator back from the CSVParser
> object ?
> > I am planning to use the below method to get the writer.
> > CSVFormat.RFC4180.withRecordSeparator( > separator).print()
> >
> > For using the above I need to know the record separator upfront which I
> > have no clue about as the Parser object does not expose that detail.
> >
> > thanks
> >
> > Nitin
> >
>
> I think CSVParser is strict and may not work for both LF and CRLF.  Maybe
> try to scan the file first and see if line ending is lf or crlf, and then
> use a corresponding CSVParser instance that can handle each case.
>

That's not how it works now but feel free to provide a PR on GitHub ;-)

Gary

>
> --
> Guang 
>


Re: [Math] PolyhedronsSet query

2017-08-09 Thread Guang Chao
On Thu, Aug 10, 2017 at 3:56 AM, Zach  wrote:

> Hi, I am making a PolyhedronsSet object by list of vertices and faces.
> Once I have created that object, I would like to get that same information
> back out or get a list of vertices. I am trying to use the union command to
> union two PolyhedronsSets and then get the lines or vertices of the unioned
> PolyhedronsSet. I've tried using the visit class to traverse the tree and
> see if the data is stored in the nodes but I can't figure out how to get
> data out of the nodes either.
>
> Thank you,
>
> Zach


Would you kindly share some code you are working on?

-- 
Guang 


Re: [CSV] Record Separator query

2017-08-09 Thread Guang Chao
On Wed, Aug 9, 2017 at 6:12 AM, nitin mahendru 
wrote:

> Hello All,
>
> I am trying to read in a csv file which may be 'crlf' or 'lf' seperated.
> Then I want to change a particular column, say encrypt it and then write
> back a new csv with that updated column. I want to use the same record
> separator as was in the input file.
>
> Is there a way to get the record separator back from the CSVParser object ?
> I am planning to use the below method to get the writer.
> CSVFormat.RFC4180.withRecordSeparator( separator).print()
>
> For using the above I need to know the record separator upfront which I
> have no clue about as the Parser object does not expose that detail.
>
> thanks
>
> Nitin
>

I think CSVParser is strict and may not work for both LF and CRLF.  Maybe
try to scan the file first and see if line ending is lf or crlf, and then
use a corresponding CSVParser instance that can handle each case.

-- 
Guang 


[Math] PolyhedronsSet query

2017-08-09 Thread Zach
Hi, I am making a PolyhedronsSet object by list of vertices and faces. Once I 
have created that object, I would like to get that same information back out or 
get a list of vertices. I am trying to use the union command to union two 
PolyhedronsSets and then get the lines or vertices of the unioned 
PolyhedronsSet. I've tried using the visit class to traverse the tree and see 
if the data is stored in the nodes but I can't figure out how to get data out 
of the nodes either.

Thank you,

Zach

Re: [CSV] Record Separator query

2017-08-09 Thread Gary Gregory
If you look at the Javadoc or the code for CSVFormat.RFC4180 you will see
that this format uses CR LF.

Gary

On Wed, Aug 9, 2017 at 10:51 AM, nitin mahendru 
wrote:

> Hi Gary,
>
> Thanks for a quick turnaround. We are using the below code to parse our
> input csv:
> CSVFormat.RFC4180.withIgnoreEmptyLines(true).parse(new
> InputStreamReader(this.getStreamIn(), readerCharset))
>
> We never tell the parser what line separator to expect and it automatically
> figures it out. What I want to know is that is it possible to extract this
> knowledge from the CSVParser object returned by the above as to what line
> separator it found ?
>
> -Nitin
>
>
> On Tue, Aug 8, 2017 at 3:23 PM Gary Gregory 
> wrote:
>
> > Hi Nitin,
> >
> > You _tell_ the parser what record separator to use, the parser does not
> > tell you.
> >
> > Gary
> >
> >
> > On Aug 8, 2017 16:13, "nitin mahendru" 
> wrote:
> >
> > Hello All,
> >
> > I am trying to read in a csv file which may be 'crlf' or 'lf' seperated.
> > Then I want to change a particular column, say encrypt it and then write
> > back a new csv with that updated column. I want to use the same record
> > separator as was in the input file.
> >
> > Is there a way to get the record separator back from the CSVParser
> object ?
> > I am planning to use the below method to get the writer.
> > CSVFormat.RFC4180.withRecordSeparator( > separator).print()
> >
> > For using the above I need to know the record separator upfront which I
> > have no clue about as the Parser object does not expose that detail.
> >
> > thanks
> >
> > Nitin
> >
>


Re: [CSV] Record Separator query

2017-08-09 Thread nitin mahendru
Hi Tim,

I am not worried about the delimiter. I am worried about the "line
seperator". We are in the process of writing a multi platform application.
So we need to be able to accept CSVs generated with Windows/Linux type Line
endings. While parsing the parser can identify that information, but it
does expose it somewhere.
We want to know if there is a way to get that information out ?

Thanks

Nitin




On Wed, Aug 9, 2017 at 10:58 AM Tim Cronin  wrote:

> you can extend the formats and set the delimiter that way.
>
>
> https://commons.apache.org/proper/commons-csv/archives/1.2/apidocs/org/apache/commons/csv/CSVFormat.html
>
>
> https://commons.apache.org/proper/commons-csv/archives/1.2/apidocs/org/apache/commons/csv/CSVFormat.html#withDelimiter-char-
>
> On Wed, Aug 9, 2017 at 12:51 PM, nitin mahendru <
> nitin.mahendr...@gmail.com>
> wrote:
>
> > Hi Gary,
> >
> > Thanks for a quick turnaround. We are using the below code to parse our
> > input csv:
> > CSVFormat.RFC4180.withIgnoreEmptyLines(true).parse(new
> > InputStreamReader(this.getStreamIn(), readerCharset))
> >
> > We never tell the parser what line separator to expect and it
> automatically
> > figures it out. What I want to know is that is it possible to extract
> this
> > knowledge from the CSVParser object returned by the above as to what line
> > separator it found ?
> >
> > -Nitin
> >
> >
> > On Tue, Aug 8, 2017 at 3:23 PM Gary Gregory 
> > wrote:
> >
> > > Hi Nitin,
> > >
> > > You _tell_ the parser what record separator to use, the parser does not
> > > tell you.
> > >
> > > Gary
> > >
> > >
> > > On Aug 8, 2017 16:13, "nitin mahendru" 
> > wrote:
> > >
> > > Hello All,
> > >
> > > I am trying to read in a csv file which may be 'crlf' or 'lf'
> seperated.
> > > Then I want to change a particular column, say encrypt it and then
> write
> > > back a new csv with that updated column. I want to use the same record
> > > separator as was in the input file.
> > >
> > > Is there a way to get the record separator back from the CSVParser
> > object ?
> > > I am planning to use the below method to get the writer.
> > > CSVFormat.RFC4180.withRecordSeparator( > > separator).print()
> > >
> > > For using the above I need to know the record separator upfront which I
> > > have no clue about as the Parser object does not expose that detail.
> > >
> > > thanks
> > >
> > > Nitin
> > >
> >
>


Re: [CSV] Record Separator query

2017-08-09 Thread Tim Cronin
you can extend the formats and set the delimiter that way.

https://commons.apache.org/proper/commons-csv/archives/1.2/apidocs/org/apache/commons/csv/CSVFormat.html

https://commons.apache.org/proper/commons-csv/archives/1.2/apidocs/org/apache/commons/csv/CSVFormat.html#withDelimiter-char-

On Wed, Aug 9, 2017 at 12:51 PM, nitin mahendru 
wrote:

> Hi Gary,
>
> Thanks for a quick turnaround. We are using the below code to parse our
> input csv:
> CSVFormat.RFC4180.withIgnoreEmptyLines(true).parse(new
> InputStreamReader(this.getStreamIn(), readerCharset))
>
> We never tell the parser what line separator to expect and it automatically
> figures it out. What I want to know is that is it possible to extract this
> knowledge from the CSVParser object returned by the above as to what line
> separator it found ?
>
> -Nitin
>
>
> On Tue, Aug 8, 2017 at 3:23 PM Gary Gregory 
> wrote:
>
> > Hi Nitin,
> >
> > You _tell_ the parser what record separator to use, the parser does not
> > tell you.
> >
> > Gary
> >
> >
> > On Aug 8, 2017 16:13, "nitin mahendru" 
> wrote:
> >
> > Hello All,
> >
> > I am trying to read in a csv file which may be 'crlf' or 'lf' seperated.
> > Then I want to change a particular column, say encrypt it and then write
> > back a new csv with that updated column. I want to use the same record
> > separator as was in the input file.
> >
> > Is there a way to get the record separator back from the CSVParser
> object ?
> > I am planning to use the below method to get the writer.
> > CSVFormat.RFC4180.withRecordSeparator( > separator).print()
> >
> > For using the above I need to know the record separator upfront which I
> > have no clue about as the Parser object does not expose that detail.
> >
> > thanks
> >
> > Nitin
> >
>


Re: [CSV] Record Separator query

2017-08-09 Thread nitin mahendru
Hi Gary,

Thanks for a quick turnaround. We are using the below code to parse our
input csv:
CSVFormat.RFC4180.withIgnoreEmptyLines(true).parse(new
InputStreamReader(this.getStreamIn(), readerCharset))

We never tell the parser what line separator to expect and it automatically
figures it out. What I want to know is that is it possible to extract this
knowledge from the CSVParser object returned by the above as to what line
separator it found ?

-Nitin


On Tue, Aug 8, 2017 at 3:23 PM Gary Gregory  wrote:

> Hi Nitin,
>
> You _tell_ the parser what record separator to use, the parser does not
> tell you.
>
> Gary
>
>
> On Aug 8, 2017 16:13, "nitin mahendru"  wrote:
>
> Hello All,
>
> I am trying to read in a csv file which may be 'crlf' or 'lf' seperated.
> Then I want to change a particular column, say encrypt it and then write
> back a new csv with that updated column. I want to use the same record
> separator as was in the input file.
>
> Is there a way to get the record separator back from the CSVParser object ?
> I am planning to use the below method to get the writer.
> CSVFormat.RFC4180.withRecordSeparator( separator).print()
>
> For using the above I need to know the record separator upfront which I
> have no clue about as the Parser object does not expose that detail.
>
> thanks
>
> Nitin
>