[Google Wave APIs] Re: JSON from robot (python) to gadget the right way

2009-10-28 Thread Teddy Jasin

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:
 I'm not sure about the length. There's something about that in this
 thread:http://groups.google.com/group/google-wave-api/browse_thread/thread/8...

 But I can tell you that I tried sending a string of 20 '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 20).

 You can try this yourself:

 cont = ''
 for i in range(20):
     cont += '1'

 delta['cont'] = cont
 gadget.SubmitDelta(delta)

 What I did find playing with your code is this:

 When I do:

 delta = {}
 delta['surahcontent'] = u'\u0628\u0644\u0651\u064e
 \u0647\u0650\u0627\u0644\u0631\u0651\u064e\u062d\u0652\u0645\u064e'
 gadget.SubmitDelta(delta)

 I get no gadget and no error.

 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'}}

   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

[Google Wave APIs] Re: How much data can I submit through submitDelta()?

2009-10-27 Thread Teddy Jasin

ahhh I think what GH asked is what I wanted to know too...

my robot is sending data to gadget using submitdelta.
the data sending is unicode text like this way:
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'

most of the times the data is very long. This caused my gadget not
showing even though there's no error in the log.

On Oct 8, 6:11 am, Brian Kennish (Googler) byoo...@google.com
wrote:
 On Wed, Oct 7, 2009 at 12:12 PM, GH gregjho...@gmail.com wrote:
  I want to send a lot of data to a robot via a gadget through the
  javascript api using the submitDelta() method (so through the gadget
  state).  What is the most data I can send through?  Can I send more
  data if I split it up into multiple key-value pairs?

 Hey Greg, what I said during office hours was about right -- blip
 contributors plus XML plus annotations can currently total 100K.
 Gadget state doesn't have an independent limit, which makes it pretty
 hard to predict whether your state pushes are going to succeed.

 The total limit is something of an open question, though. If you have
 a use case that suggests the limit is too low, submit a feature
 request and help convince us.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: JSON from robot (python) to gadget the right way

2009-10-27 Thread Teddy Jasin

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'}}

 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.comwrote:

  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?

 Agustin.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---



[Google Wave APIs] Re: JSON from robot (python) to gadget the right way

2009-10-26 Thread Teddy Jasin

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'}}

   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.comwrote:

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?

   Agustin.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Google Wave API group.
To post to this group, send email to google-wave-api@googlegroups.com
To unsubscribe from this group, send email to 
google-wave-api+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-wave-api?hl=en
-~--~~~~--~~--~--~---