Re: [PATCH 2/2] Generate correct json

2014-08-27 Thread Dirk Hohndel
On Wed, Aug 27, 2014 at 10:27:30AM +0300, Gehad Elrobey wrote: > On Wed, Aug 27, 2014 at 12:14 AM, Dirk Hohndel wrote: > > > On Tue, Aug 26, 2014 at 11:13:22PM +0300, Gehad Elrobey wrote: > > > This is very useful thanks, I ll try to migrate the JSON exporter to this > > > model. > > > > Yes, I t

Re: GSoC work priority? [Was: [PATCH 2/2] Generate correct json]

2014-08-27 Thread Dirk Hohndel
On Aug 27, 2014, at 3:42 AM, Lubomir I. Ivanov wrote: > On 27 August 2014 09:22, "Paul-Erik Törrönen" wrote: >>> So I think the better solution is to talk Gehad into doing it right when >>> things are created. >> >> This raises (at least in my mind) the question about the GSoC work that is >>

Re: GSoC work priority? [Was: [PATCH 2/2] Generate correct json]

2014-08-27 Thread Lubomir I. Ivanov
On 27 August 2014 09:22, "Paul-Erik Törrönen" wrote: >> So I think the better solution is to talk Gehad into doing it right when >> things are created. > > This raises (at least in my mind) the question about the GSoC work that is > done this year on Subsurface. Specifically whether this is to be

Re: [PATCH 2/2] Generate correct json

2014-08-27 Thread Gehad Elrobey
On Wed, Aug 27, 2014 at 12:14 AM, Dirk Hohndel wrote: > On Tue, Aug 26, 2014 at 11:13:22PM +0300, Gehad Elrobey wrote: > > This is very useful thanks, I ll try to migrate the JSON exporter to this > > model. > > Yes, I think Linus' post was extremely useful. :-) > I'd love to see a patch that use

GSoC work priority? [Was: [PATCH 2/2] Generate correct json]

2014-08-26 Thread Paul-Erik Törrönen
> So I think the better solution is to talk Gehad into doing it right when > things are created. This raises (at least in my mind) the question about the GSoC work that is done this year on Subsurface. Specifically whether this is to be considered as normal contribution as by anyone (in a FOSS-pro

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Dirk Hohndel
On Tue, Aug 26, 2014 at 11:08:56PM +0200, Salvo Tomaselli wrote: > Hello, > > First, let me point out that the json parser of Python, rejecting because of > the extra commas is not wrong. That's how the format is defined. I agree with you - we want to create correct JSON. > I had started to fix

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Dirk Hohndel
On Tue, Aug 26, 2014 at 11:13:22PM +0300, Gehad Elrobey wrote: > This is very useful thanks, I ll try to migrate the JSON exporter to this > model. Yes, I think Linus' post was extremely useful. :-) I'd love to see a patch that uses that pattern. > Dirk: I think you have missed a patch that adds

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Salvo Tomaselli
Hello, First, let me point out that the json parser of Python, rejecting because of the extra commas is not wrong. That's how the format is defined. I had started to fix the generation in a trivial way by changing all the bits where it puts commas (I wasn't using a do..while so it didn't look a

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Gehad Elrobey
This is very useful thanks, I ll try to migrate the JSON exporter to this model. Dirk: I think you have missed a patch that adds the divecomputer data to the exports. On Tue, Aug 26, 2014 at 10:02 PM, Linus Torvalds < torva...@linux-foundation.org> wrote: > On Tue, Aug 26, 2014 at 11:24 AM, Geh

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Linus Torvalds
On Tue, Aug 26, 2014 at 11:24 AM, Gehad Elrobey wrote: > I think this can be done easily by just checking if the item is the last > item in the array before putting the commas. So, quite frankly, you guys need to learn a very clean and simple model for outputting lists with separators. The way t

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Dirk Hohndel
On Tue, Aug 26, 2014 at 09:24:41PM +0300, Gehad Elrobey wrote: > I think this can be done easily by just checking if the item is the last > item in the array before putting the commas. That would be my by far preferred solution. Let's just not put the wrong commas there. /D __

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Gehad Elrobey
I think this can be done easily by just checking if the item is the last item in the array before putting the commas. Also I think there are other 3rd party JSON parsers for python that can be more advanced and coup with the trailing commas. Regards, Gehad On Tue, Aug 26, 2014 at 9:08 PM, Dirk

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Dirk Hohndel
On Tue, Aug 26, 2014 at 07:56:20PM +0200, Salvo 'LtWorf' Tomaselli wrote: > Not quite the solution I'd want, but the json generation would need > to be re-done from scratch to generate valid json code. ... and that is considered not worth it? > Instead, I wrote this, to find and remove the guilty

Re: [PATCH 2/2] Generate correct json

2014-08-26 Thread Salvo Tomaselli
Oh I found a bug with this: it needs to skip also \t. In data martedì 26 agosto 2014 19:56:20, Salvo 'LtWorf' Tomaselli ha scritto: > Not quite the solution I'd want, but the json generation would need > + //Skip whitespace > + while (buf[i + inc] == ' ' ||

[PATCH 2/2] Generate correct json

2014-08-26 Thread Salvo 'LtWorf' Tomaselli
Not quite the solution I'd want, but the json generation would need to be re-done from scratch to generate valid json code. Instead, I wrote this, to find and remove the guilty commas. It tries to move as little bytes around as possible, and writing it felt like interviewing for a position at Face