Hi, I have a python robot which updates the state of a gadget. What
would be the right way to pass a list/array to the gadget? I assume
it's encoding it in JSON, right? But what's the right way to do that?
I tried importing simplejson from Django but it didn't really work
very well.
> Hi, I have a python robot which updates the state of a gadget. What
> would be the right way to pass a list/array to the gadget? I assume
> it's encoding it in JSON, right? But what's the right way to do that?
> I tried importing simplejson from Django but it didn't really work
> very well.
I did look at Row of 4 code and I just double checked it but I think
it doesn't send anything more than strings or numbers as values within
the delta dictionary.
> On Thu, Oct 22, 2009 at 2:56 AM, Agustin Horischnik <agu...@gmail.com>wrote:
> > Hi, I have a python robot which updates the state of a gadget. What
> > would be the right way to pass a list/array to the gadget? I assume
> > it's encoding it in JSON, right? But what's the right way to do that?
> > I tried importing simplejson from Django but it didn't really work
> > very well.
Ah, got it. What was your experiencing with using simplejson? You should be
able to serialize that object and pass it through the delta. We don't have a
demo of that, but think it should work.
You could also consider using more complex keys, like
viewerName-propertyName-subPropertyName, etc. That is a bit better in terms
of concurrency.
- pamela
On Thu, Oct 22, 2009 at 5:35 AM, Agustin Horischnik <agu...@gmail.com>wrote:
> I did look at Row of 4 code and I just double checked it but I think
> it doesn't send anything more than strings or numbers as values within
> the delta dictionary.
> > On Thu, Oct 22, 2009 at 2:56 AM, Agustin Horischnik <agu...@gmail.com
> >wrote:
> > > Hi, I have a python robot which updates the state of a gadget. What
> > > would be the right way to pass a list/array to the gadget? I assume
> > > it's encoding it in JSON, right? But what's the right way to do that?
> > > I tried importing simplejson from Django but it didn't really work
> > > very well.
> Ah, got it. What was your experiencing with using simplejson? You should be
> able to serialize that object and pass it through the delta. We don't have a
> demo of that, but think it should work.
I don't remember but I'll re-try simplejson and report back.
> You could also consider using more complex keys, like
> viewerName-propertyName-subPropertyName, etc. That is a bit better in terms
> of concurrency.
hmm... I'm not sure I get that... could you please give me an example
whenever you have the time?
For example, if you are storing the information about a shape that a
participant just drew:
You could do:
delta = {'pamela.fox': "{'color':'red','shape':'circle'}"}
Or, you could do:
delta = {'pamela.fox-color': 'red'}
delta = {'pamela.fox-shape': 'circle'}
It may seem less elegant, but it is better in terms of concurrency, as it
means that I can independently change different properties.
On Thu, Oct 22, 2009 at 11:56 AM, Agustin Horischnik <agu...@gmail.com>wrote:
> > Ah, got it. What was your experiencing with using simplejson? You should
> be
> > able to serialize that object and pass it through the delta. We don't
> have a
> > demo of that, but think it should work.
> I don't remember but I'll re-try simplejson and report back.
> > You could also consider using more complex keys, like
> > viewerName-propertyName-subPropertyName, etc. That is a bit better in
> terms
> > of concurrency.
> hmm... I'm not sure I get that... could you please give me an example
> whenever you have the time?
pamela...@gmail.com> wrote:
> For example, if you are storing the information about a shape that a
> participant just drew:
> You could do:
> delta = {'pamela.fox': "{'color':'red','shape':'circle'}"}
> Or, you could do:
> delta = {'pamela.fox-color': 'red'}
> delta = {'pamela.fox-shape': 'circle'}
> It may seem less elegant, but it is better in terms of concurrency, as it
> means that I can independently change different properties.
> On Thu, Oct 22, 2009 at 11:56 AM, Agustin Horischnik <agu...@gmail.com>wrote:
>> > Ah, got it. What was your experiencing with using simplejson? You should
>> be
>> > able to serialize that object and pass it through the delta. We don't
>> have a
>> > demo of that, but think it should work.
>> I don't remember but I'll re-try simplejson and report back.
>> > You could also consider using more complex keys, like
>> > viewerName-propertyName-subPropertyName, etc. That is a bit better in
>> terms
>> > of concurrency.
>> hmm... I'm not sure I get that... could you please give me an example
>> whenever you have the time?
Reporting back on serializing objects and submitting them as delta.
I tried again using simplejson and the result is what I described
earlier without explicitly encoding them: the gadget breaks (i.e. in
this case it doesn't get
appended to the blip) and yet I see no errors in the log.
Let me know if need more info.
Agustin.
On Oct 22, 2:14 am, Agustin Horischnik <agu...@gmail.com> wrote:
> Gotcha. Yeah, I can see why is better for concurrency.
> Thanks for your help.
> On Thu, Oct 22, 2009 at 3:05 AM, pamela (Google Employee) <
> pamela...@gmail.com> wrote:
> > For example, if you are storing the information about a shape that a
> > participant just drew:
> > You could do:
> > delta = {'pamela.fox': "{'color':'red','shape':'circle'}"}
> > Or, you could do:
> > delta = {'pamela.fox-color': 'red'}
> > delta = {'pamela.fox-shape': 'circle'}
> > It may seem less elegant, but it is better in terms of concurrency, as it
> > means that I can independently change different properties.
> > On Thu, Oct 22, 2009 at 11:56 AM, Agustin Horischnik <agu...@gmail.com>wrote:
> >> > Ah, got it. What was your experiencing with using simplejson? You should
> >> be
> >> > able to serialize that object and pass it through the delta. We don't
> >> have a
> >> > demo of that, but think it should work.
> >> I don't remember but I'll re-try simplejson and report back.
> >> > You could also consider using more complex keys, like
> >> > viewerName-propertyName-subPropertyName, etc. That is a bit better in
> >> terms
> >> > of concurrency.
> >> hmm... I'm not sure I get that... could you please give me an example
> >> whenever you have the time?
I think I'm also facing same issue with you.
in my case I'm sending data from the robot to the gadget also using
json, however my json data is arabic texts which is converted
unicode... so it become longer json strings.
the gadget will not show if the passed data is too long.
so I guess my json data is too big to be passed into the gadget.
anyone can help me in this?
On Oct 26, 7:17 pm, Agustin Horischnik <agu...@gmail.com> wrote:
> Reporting back on serializing objects and submitting them as delta.
> I tried again using simplejson and the result is what I described
> earlier without explicitly encoding them: the gadget breaks (i.e. in
> this case it doesn't get
> appended to the blip) and yet I see no errors in the log.
> Let me know if need more info.
> Agustin.
> On Oct 22, 2:14 am, Agustin Horischnik <agu...@gmail.com> wrote:
> > Gotcha. Yeah, I can see why is better for concurrency.
> > Thanks for your help.
> > On Thu, Oct 22, 2009 at 3:05 AM, pamela (Google Employee) <
> > pamela...@gmail.com> wrote:
> > > For example, if you are storing the information about a shape that a
> > > participant just drew:
> > > You could do:
> > > delta = {'pamela.fox': "{'color':'red','shape':'circle'}"}
> > > It may seem less elegant, but it is better in terms of concurrency, as it
> > > means that I can independently change different properties.
> > > On Thu, Oct 22, 2009 at 11:56 AM, Agustin Horischnik <agu...@gmail.com>wrote:
> > >> > Ah, got it. What was your experiencing with using simplejson? You should
> > >> be
> > >> > able to serialize that object and pass it through the delta. We don't
> > >> have a
> > >> > demo of that, but think it should work.
> > >> I don't remember but I'll re-try simplejson and report back.
> > >> > You could also consider using more complex keys, like
> > >> > viewerName-propertyName-subPropertyName, etc. That is a bit better in
> > >> terms
> > >> > of concurrency.
> > >> hmm... I'm not sure I get that... could you please give me an example
> > >> whenever you have the time?
Hi Teddy, can you paste a few lines from your outgoing json containing the
strings you think could be causing the problem and maybe the bit of code
you're using to submit the delta and encode it?
I ended up using Pamela's suggestion but I'll be happy to try your code and
see if I find something.
On Mon, Oct 26, 2009 at 4:06 PM, Teddy Jasin <jasin.te...@gmail.com> wrote:
> Hi Agustin,
> I think I'm also facing same issue with you.
> in my case I'm sending data from the robot to the gadget also using
> json, however my json data is arabic texts which is converted
> unicode... so it become longer json strings.
> the gadget will not show if the passed data is too long.
> so I guess my json data is too big to be passed into the gadget.
> anyone can help me in this?
> On Oct 26, 7:17 pm, Agustin Horischnik <agu...@gmail.com> wrote:
> > Reporting back on serializing objects and submitting them as delta.
> > I tried again using simplejson and the result is what I described
> > earlier without explicitly encoding them: the gadget breaks (i.e. in
> > this case it doesn't get
> > appended to the blip) and yet I see no errors in the log.
> > Let me know if need more info.
> > Agustin.
> > On Oct 22, 2:14 am, Agustin Horischnik <agu...@gmail.com> wrote:
> > > Gotcha. Yeah, I can see why is better for concurrency.
> > > Thanks for your help.
> > > On Thu, Oct 22, 2009 at 3:05 AM, pamela (Google Employee) <
> > > pamela...@gmail.com> wrote:
> > > > For example, if you are storing the information about a shape that a
> > > > participant just drew:
> > > > You could do:
> > > > delta = {'pamela.fox': "{'color':'red','shape':'circle'}"}
> > > > It may seem less elegant, but it is better in terms of concurrency,
> as it
> > > > means that I can independently change different properties.
> > > > On Thu, Oct 22, 2009 at 11:56 AM, Agustin Horischnik <
> agu...@gmail.com>wrote:
> > > >> > Ah, got it. What was your experiencing with using simplejson? You
> should
> > > >> be
> > > >> > able to serialize that object and pass it through the delta. We
> don't
> > > >> have a
> > > >> > demo of that, but think it should work.
> > > >> I don't remember but I'll re-try simplejson and report back.
> > > >> > You could also consider using more complex keys, like
> > > >> > viewerName-propertyName-subPropertyName, etc. That is a bit better
> in
> > > >> terms
> > > >> > of concurrency.
> > > >> hmm... I'm not sure I get that... could you please give me an
> example
> > > >> whenever you have the time?
here's the sample of some json I send to the gadget:
delta = {'surahcontent': u'\u0628\u0650\u0633\u0652\u0645\u0650
\u0627\u0644\u0644\u0651\u064e\u0647\u0650
\u0627\u0644\u0631\u0651\u064e\u062d\u0652\u0645\u064e
\u0670\u0646\u0650 \u0627\u0644\u0631\u0651\u064e\u062d\u0650\u064a
\u0645\u0650 \ufd3f \u0661\ufd3e\u0627\u0644\u0652\u062d\u064e
\u0645\u0652\u062f\u064f \u0644\u0650\u0644\u0651\u064e\u0647\u0650
\u0631\u064e\u0628\u0651\u0650 \u0627\u0644\u0652\u0639\u064e
\u0627\u0644\u064e\u0645\u0650\u064a\u0646\u064e \ufd3f \u0662\ufd3e',
'surahtitle': u'Al-Faatiha - The Opening (1-2)', 'translations':
u' (1) In the name of Allah, Most Gracious, Most Merciful.\n (2)
Praise be to Allah, the Cherisher and Sustainer of the worlds;\n'}
gadget.SubmitDelta(delta)
as u see the JSON I sending containing a long unicode strings, the
json above can successfuly show the gadget and show the content.
However when the delta above gets extremely long then it won't show
the gadget though no error in log file...
So I believe there's limit in the length of the delta that you can
send to gadget.
Teddy
On Oct 27, 4:02 am, Agustin Horischnik <agu...@gmail.com> wrote:
> Hi Teddy, can you paste a few lines from your outgoing json containing the
> strings you think could be causing the problem and maybe the bit of code
> you're using to submit the delta and encode it?
> I ended up using Pamela's suggestion but I'll be happy to try your code and
> see if I find something.
> Agustin.
> On Mon, Oct 26, 2009 at 4:06 PM, Teddy Jasin <jasin.te...@gmail.com> wrote:
> > Hi Agustin,
> > I think I'm also facing same issue with you.
> > in my case I'm sending data from the robot to the gadget also using
> > json, however my json data is arabic texts which is converted
> > unicode... so it become longer json strings.
> > the gadget will not show if the passed data is too long.
> > so I guess my json data is too big to be passed into the gadget.
> > anyone can help me in this?
> > On Oct 26, 7:17 pm, Agustin Horischnik <agu...@gmail.com> wrote:
> > > Reporting back on serializing objects and submitting them as delta.
> > > I tried again using simplejson and the result is what I described
> > > earlier without explicitly encoding them: the gadget breaks (i.e. in
> > > this case it doesn't get
> > > appended to the blip) and yet I see no errors in the log.
> > > Let me know if need more info.
> > > Agustin.
> > > On Oct 22, 2:14 am, Agustin Horischnik <agu...@gmail.com> wrote:
> > > > Gotcha. Yeah, I can see why is better for concurrency.
> > > > Thanks for your help.
> > > > On Thu, Oct 22, 2009 at 3:05 AM, pamela (Google Employee) <
> > > > pamela...@gmail.com> wrote:
> > > > > For example, if you are storing the information about a shape that a
> > > > > participant just drew:
> > > > > You could do:
> > > > > delta = {'pamela.fox': "{'color':'red','shape':'circle'}"}
> > > > > It may seem less elegant, but it is better in terms of concurrency,
> > as it
> > > > > means that I can independently change different properties.
> > > > > On Thu, Oct 22, 2009 at 11:56 AM, Agustin Horischnik <
> > agu...@gmail.com>wrote:
> > > > >> > Ah, got it. What was your experiencing with using simplejson? You
> > should
> > > > >> be
> > > > >> > able to serialize that object and pass it through the delta. We
> > don't
> > > > >> have a
> > > > >> > demo of that, but think it should work.
> > > > >> I don't remember but I'll re-try simplejson and report back.
> > > > >> > You could also consider using more complex keys, like
> > > > >> > viewerName-propertyName-subPropertyName, etc. That is a bit better
> > in
> > > > >> terms
> > > > >> > of concurrency.
> > > > >> hmm... I'm not sure I get that... could you please give me an
> > example
> > > > >> whenever you have the time?
But I can tell you that I tried sending a string of 200000 '1's and it
didn't break the gadget. And it's not getting chopped (i.e. on the
gadget, it's javascript length property equals 200000).
But if I encode the unicode string like so:
delta = {}
delta['surahcontent'] = u'\u0628\u0644\u0651\u064e
\u0647\u0650\u0627\u0644\u0631\u0651\u064e\u062d
\u0652\u0645\u064e'.encode('utf-8')
gadget.SubmitDelta(delta)
I get the gadget and the arabic caracters.
So I think what breaks the gadget is passing any thing other than a
string... If for instance I do:
delta['surahcontent'] = 1
it will fail. While doing:
delta['surahcontent'] = str(1)
will work.
Agustin.
On Oct 27, 4:59 am, Teddy Jasin <jasin.te...@gmail.com> wrote:
> here's the sample of some json I send to the gadget:
> delta = {'surahcontent': u'\u0628\u0650\u0633\u0652\u0645\u0650
> \u0627\u0644\u0644\u0651\u064e\u0647\u0650
> \u0627\u0644\u0631\u0651\u064e\u062d\u0652\u0645\u064e
> \u0670\u0646\u0650 \u0627\u0644\u0631\u0651\u064e\u062d\u0650\u064a
> \u0645\u0650 \ufd3f \u0661\ufd3e\u0627\u0644\u0652\u062d\u064e
> \u0645\u0652\u062f\u064f \u0644\u0650\u0644\u0651\u064e\u0647\u0650
> \u0631\u064e\u0628\u0651\u0650 \u0627\u0644\u0652\u0639\u064e
> \u0627\u0644\u064e\u0645\u0650\u064a\u0646\u064e \ufd3f \u0662\ufd3e',
> 'surahtitle': u'Al-Faatiha - The Opening (1-2)', 'translations':
> u' (1) In the name of Allah, Most Gracious, Most Merciful.\n (2)
> Praise be to Allah, the Cherisher and Sustainer of the worlds;\n'}
> gadget.SubmitDelta(delta)
> as u see the JSON I sending containing a long unicode strings, the
> json above can successfuly show the gadget and show the content.
> However when the delta above gets extremely long then it won't show
> the gadget though no error in log file...
> So I believe there's limit in the length of the delta that you can
> send to gadget.
> Teddy
> On Oct 27, 4:02 am, Agustin Horischnik <agu...@gmail.com> wrote:
> > Hi Teddy, can you paste a few lines from your outgoing json containing the
> > strings you think could be causing the problem and maybe the bit of code
> > you're using to submit the delta and encode it?
> > I ended up using Pamela's suggestion but I'll be happy to try your code and
> > see if I find something.
> > Agustin.
> > On Mon, Oct 26, 2009 at 4:06 PM, Teddy Jasin <jasin.te...@gmail.com> wrote:
> > > Hi Agustin,
> > > I think I'm also facing same issue with you.
> > > in my case I'm sending data from the robot to the gadget also using
> > > json, however my json data is arabic texts which is converted
> > > unicode... so it become longer json strings.
> > > the gadget will not show if the passed data is too long.
> > > so I guess my json data is too big to be passed into the gadget.
> > > anyone can help me in this?
> > > On Oct 26, 7:17 pm, Agustin Horischnik <agu...@gmail.com> wrote:
> > > > Reporting back on serializing objects and submitting them as delta.
> > > > I tried again using simplejson and the result is what I described
> > > > earlier without explicitly encoding them: the gadget breaks (i.e. in
> > > > this case it doesn't get
> > > > appended to the blip) and yet I see no errors in the log.
> > > > Let me know if need more info.
> > > > Agustin.
> > > > On Oct 22, 2:14 am, Agustin Horischnik <agu...@gmail.com> wrote:
> > > > > Gotcha. Yeah, I can see why is better for concurrency.
> > > > > Thanks for your help.
> > > > > On Thu, Oct 22, 2009 at 3:05 AM, pamela (Google Employee) <
> > > > > pamela...@gmail.com> wrote:
> > > > > > For example, if you are storing the information about a shape that a
> > > > > > participant just drew:
> > > > > > You could do:
> > > > > > delta = {'pamela.fox': "{'color':'red','shape':'circle'}"}
> > > > > > It may seem less elegant, but it is better in terms of concurrency,
> > > as it
> > > > > > means that I can independently change different properties.
> > > > > > On Thu, Oct 22, 2009 at 11:56 AM, Agustin Horischnik <
> > > agu...@gmail.com>wrote:
> > > > > >> > Ah, got it. What was your experiencing with using simplejson? You
> > > should
> > > > > >> be
> > > > > >> > able to serialize that object and pass it through the delta. We
> > > don't
> > > > > >> have a
> > > > > >> > demo of that, but think it should work.
> > > > > >> I don't remember but I'll re-try simplejson and report back.
> > > > > >> > You could also consider using more complex keys, like
> > > > > >> > viewerName-propertyName-subPropertyName, etc. That is a bit better
> > > in
> > > > > >> terms
> > > > > >> > of concurrency.
> > > > > >> hmm... I'm not sure I get that... could you please give me an
> > > example
> > > > > >> whenever you have the time?
hemm thanks agustin...
thats interesting, I havent tried that...
I do my work around of not passing big data to gadget by just
providing necessary data, the gadget then do an AJAX based on the data
passed by the robot and display it...
its seems faster this way... the gadget displayed faster and I don't
get HIGH CPU warning on my log...
On Oct 27, 6:31 pm, Agustin Horischnik <agu...@gmail.com> wrote:
> But I can tell you that I tried sending a string of 200000 '1's and it
> didn't break the gadget. And it's not getting chopped (i.e. on the
> gadget, it's javascript length property equals 200000).
> You can try this yourself:
> cont = ''
> for i in range(200000):
> cont += '1'
> But if I encode the unicode string like so:
> delta = {}
> delta['surahcontent'] = u'\u0628\u0644\u0651\u064e
> \u0647\u0650\u0627\u0644\u0631\u0651\u064e\u062d
> \u0652\u0645\u064e'.encode('utf-8')
> gadget.SubmitDelta(delta)
> I get the gadget and the arabic caracters.
> So I think what breaks the gadget is passing any thing other than a
> string... If for instance I do:
> delta['surahcontent'] = 1
> it will fail. While doing:
> delta['surahcontent'] = str(1)
> will work.
> Agustin.
> On Oct 27, 4:59 am, Teddy Jasin <jasin.te...@gmail.com> wrote:
> > Hi agustin,
> > here's the sample of some json I send to the gadget:
> > delta = {'surahcontent': u'\u0628\u0650\u0633\u0652\u0645\u0650
> > \u0627\u0644\u0644\u0651\u064e\u0647\u0650
> > \u0627\u0644\u0631\u0651\u064e\u062d\u0652\u0645\u064e
> > \u0670\u0646\u0650 \u0627\u0644\u0631\u0651\u064e\u062d\u0650\u064a
> > \u0645\u0650 \ufd3f \u0661\ufd3e\u0627\u0644\u0652\u062d\u064e
> > \u0645\u0652\u062f\u064f \u0644\u0650\u0644\u0651\u064e\u0647\u0650
> > \u0631\u064e\u0628\u0651\u0650 \u0627\u0644\u0652\u0639\u064e
> > \u0627\u0644\u064e\u0645\u0650\u064a\u0646\u064e \ufd3f \u0662\ufd3e',
> > 'surahtitle': u'Al-Faatiha - The Opening (1-2)', 'translations':
> > u' (1) In the name of Allah, Most Gracious, Most Merciful.\n (2)
> > Praise be to Allah, the Cherisher and Sustainer of the worlds;\n'}
> > gadget.SubmitDelta(delta)
> > as u see the JSON I sending containing a long unicode strings, the
> > json above can successfuly show the gadget and show the content.
> > However when the delta above gets extremely long then it won't show
> > the gadget though no error in log file...
> > So I believe there's limit in the length of the delta that you can
> > send to gadget.
> > Teddy
> > On Oct 27, 4:02 am, Agustin Horischnik <agu...@gmail.com> wrote:
> > > Hi Teddy, can you paste a few lines from your outgoing json containing the
> > > strings you think could be causing the problem and maybe the bit of code
> > > you're using to submit the delta and encode it?
> > > I ended up using Pamela's suggestion but I'll be happy to try your code and
> > > see if I find something.
> > > Agustin.
> > > On Mon, Oct 26, 2009 at 4:06 PM, Teddy Jasin <jasin.te...@gmail.com> wrote:
> > > > Hi Agustin,
> > > > I think I'm also facing same issue with you.
> > > > in my case I'm sending data from the robot to the gadget also using
> > > > json, however my json data is arabic texts which is converted
> > > > unicode... so it become longer json strings.
> > > > the gadget will not show if the passed data is too long.
> > > > so I guess my json data is too big to be passed into the gadget.
> > > > anyone can help me in this?
> > > > On Oct 26, 7:17 pm, Agustin Horischnik <agu...@gmail.com> wrote:
> > > > > Reporting back on serializing objects and submitting them as delta.
> > > > > I tried again using simplejson and the result is what I described
> > > > > earlier without explicitly encoding them: the gadget breaks (i.e. in
> > > > > this case it doesn't get
> > > > > appended to the blip) and yet I see no errors in the log.
> > > > > Let me know if need more info.
> > > > > Agustin.
> > > > > On Oct 22, 2:14 am, Agustin Horischnik <agu...@gmail.com> wrote:
> > > > > > Gotcha. Yeah, I can see why is better for concurrency.
> > > > > > Thanks for your help.
> > > > > > On Thu, Oct 22, 2009 at 3:05 AM, pamela (Google Employee) <
> > > > > > pamela...@gmail.com> wrote:
> > > > > > > For example, if you are storing the information about a shape that a
> > > > > > > participant just drew:
> > > > > > > You could do:
> > > > > > > delta = {'pamela.fox': "{'color':'red','shape':'circle'}"}
> > > > > > > It may seem less elegant, but it is better in terms of concurrency,
> > > > as it
> > > > > > > means that I can independently change different properties.
> > > > > > > On Thu, Oct 22, 2009 at 11:56 AM, Agustin Horischnik <
> > > > agu...@gmail.com>wrote:
> > > > > > >> > Ah, got it. What was your experiencing with using simplejson? You
> > > > should
> > > > > > >> be
> > > > > > >> > able to serialize that object and pass it through the delta. We
> > > > don't
> > > > > > >> have a
> > > > > > >> > demo of that, but think it should work.
> > > > > > >> I don't remember but I'll re-try simplejson and report back.
> > > > > > >> > You could also consider using more complex keys, like
> > > > > > >> > viewerName-propertyName-subPropertyName, etc. That is a bit better
> > > > in
> > > > > > >> terms
> > > > > > >> > of concurrency.
> > > > > > >> hmm... I'm not sure I get that... could you please give me an
> > > > example
> > > > > > >> whenever you have the time?
I am trying to send some json data through JAVA Gadget.setField() and
sees the same issues with passing data. My experiments show that if
the string includes an embeded double quote(\") then it will pass the
value up to that character in string.
I believe, there is nothing wrong in embedding double quotes in a
string as they would be escaped anyway. Gadget.setField() is just
stopping as soon as it sees the double quote even if it is escaped.
This definitely should be fixed.
On Oct 29, 12:50 am, Teddy Jasin <jasin.te...@gmail.com> wrote:
> hemm thanks agustin...
> thats interesting, I havent tried that...
> I do my work around of not passing big data togadgetby just
> providing necessary data, thegadgetthen do an AJAX based on the data
> passed by the robot and display it...
> its seems faster this way... thegadgetdisplayed faster and I don't
> get HIGH CPU warning on my log...
> On Oct 27, 6:31 pm, Agustin Horischnik <agu...@gmail.com> wrote:
> > But I can tell you that I tried sending a string of 200000 '1's and it
> > didn't break thegadget. And it's not getting chopped (i.e. on the
> >gadget, it's javascript length property equals 200000).
> > You can try this yourself:
> > cont = ''
> > for i in range(200000):
> > cont += '1'
> > But if I encode the unicode string like so:
> > delta = {}
> > delta['surahcontent'] = u'\u0628\u0644\u0651\u064e
> > \u0647\u0650\u0627\u0644\u0631\u0651\u064e\u062d
> > \u0652\u0645\u064e'.encode('utf-8')
> >gadget.SubmitDelta(delta)
> > I get thegadgetand the arabic caracters.
> > So I think what breaks thegadgetis passing any thing other than a
> > string... If for instance I do:
> > delta['surahcontent'] = 1
> > it will fail. While doing:
> > delta['surahcontent'] = str(1)
> > will work.
> > Agustin.
> > On Oct 27, 4:59 am, Teddy Jasin <jasin.te...@gmail.com> wrote:
> > > Hi agustin,
> > > here's the sample of some json I send to thegadget:
> > > delta = {'surahcontent': u'\u0628\u0650\u0633\u0652\u0645\u0650
> > > \u0627\u0644\u0644\u0651\u064e\u0647\u0650
> > > \u0627\u0644\u0631\u0651\u064e\u062d\u0652\u0645\u064e
> > > \u0670\u0646\u0650 \u0627\u0644\u0631\u0651\u064e\u062d\u0650\u064a
> > > \u0645\u0650 \ufd3f \u0661\ufd3e\u0627\u0644\u0652\u062d\u064e
> > > \u0645\u0652\u062f\u064f \u0644\u0650\u0644\u0651\u064e\u0647\u0650
> > > \u0631\u064e\u0628\u0651\u0650 \u0627\u0644\u0652\u0639\u064e
> > > \u0627\u0644\u064e\u0645\u0650\u064a\u0646\u064e \ufd3f \u0662\ufd3e',
> > > 'surahtitle': u'Al-Faatiha - The Opening (1-2)', 'translations':
> > > u' (1) In the name of Allah, Most Gracious, Most Merciful.\n (2)
> > > Praise be to Allah, the Cherisher and Sustainer of the worlds;\n'}
> > >gadget.SubmitDelta(delta)
> > > as u see the JSON I sending containing a long unicode strings, the
> > > json above can successfuly show thegadgetand show the content.
> > > However when the delta above gets extremely long then it won't show
> > > thegadgetthough no error in log file...
> > > So I believe there's limit in the length of the delta that you can
> > > send togadget.
> > > Teddy
> > > On Oct 27, 4:02 am, Agustin Horischnik <agu...@gmail.com> wrote:
> > > > Hi Teddy, can you paste a few lines from your outgoing json containing the
> > > > strings you think could be causing the problem and maybe the bit of code
> > > > you're using to submit the delta and encode it?
> > > > I ended up using Pamela's suggestion but I'll be happy to try your code and
> > > > see if I find something.
> > > > Agustin.
> > > > On Mon, Oct 26, 2009 at 4:06 PM, Teddy Jasin <jasin.te...@gmail.com> wrote:
> > > > > Hi Agustin,
> > > > > I think I'm also facing same issue with you.
> > > > > in my case I'm sending data from the robot to thegadgetalso using
> > > > > json, however my json data is arabic texts which is converted
> > > > > unicode... so it become longer json strings.
> > > > > thegadgetwill not show if the passed data is too long.
> > > > > so I guess my json data is too big to be passed into thegadget.
> > > > > anyone can help me in this?
> > > > > On Oct 26, 7:17 pm, Agustin Horischnik <agu...@gmail.com> wrote:
> > > > > > Reporting back on serializing objects and submitting them as delta.
> > > > > > I tried again using simplejson and the result is what I described
> > > > > > earlier without explicitly encoding them: thegadgetbreaks (i.e. in
> > > > > > this case it doesn't get
> > > > > > appended to the blip) and yet I see no errors in the log.
> > > > > > Let me know if need more info.
> > > > > > Agustin.
> > > > > > On Oct 22, 2:14 am, Agustin Horischnik <agu...@gmail.com> wrote:
> > > > > > > Gotcha. Yeah, I can see why is better for concurrency.
> > > > > > > Thanks for your help.
> > > > > > > On Thu, Oct 22, 2009 at 3:05 AM, pamela (Google Employee) <
> > > > > > > pamela...@gmail.com> wrote:
> > > > > > > > For example, if you are storing the information about a shape that a
> > > > > > > > participant just drew:
> > > > > > > > You could do:
> > > > > > > > delta = {'pamela.fox': "{'color':'red','shape':'circle'}"}
> > > > > > > > It may seem less elegant, but it is better in terms of concurrency,
> > > > > as it
> > > > > > > > means that I can independently change different properties.
> > > > > > > > On Thu, Oct 22, 2009 at 11:56 AM, Agustin Horischnik <
> > > > > agu...@gmail.com>wrote:
> > > > > > > >> > Ah, got it. What was your experiencing with using simplejson? You
> > > > > should
> > > > > > > >> be
> > > > > > > >> > able to serialize that object andpassit through the delta. We
> > > > > don't
> > > > > > > >> have a
> > > > > > > >> > demo of that, but think it should work.
> > > > > > > >> I don't remember but I'll re-try simplejson and report back.
> > > > > > > >> > You could also consider using more complex keys, like
> > > > > > > >> > viewerName-propertyName-subPropertyName, etc. That is a bit better
> > > > > in
> > > > > > > >> terms
> > > > > > > >> > of concurrency.
> > > > > > > >> hmm... I'm not sure I get that... could you please give me an
> > > > > example
> > > > > > > >> whenever you have the time?