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

2009-10-29 Thread BI Guy

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  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  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 thegadget. 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 nogadgetand 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 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  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  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  
> > > > 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  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.
>
> > > > >

[Google Wave APIs] Null pointer exception from TextView.setAuthor() ...

2009-10-20 Thread BI Guy

Where am I going wrong below. It's throwing "null pointer exception"
when I call TextView.setAnnotation().
I believe, we can put an annotation on the root blip and read
annotations from it. Am I wrong?

String text = "Annotation added.";

Blip root = wavelet.getRootBlip();

if (root != null)
{
TextView t = root.getDocument();
if (t != null)
{
if (t.hasAnnotation("case-closed"))
{
text = "Case is already closed";
}
else
{
t.setAuthor("mybot");
t.setAnnotation("case-closed", 
"");
}
}

Blip b = wavelet.appendBlip();
TextView tView = b.getDocument();
tView.append(text);

}



==
java.lang.NullPointerException
at com.google.wave.api.impl.TextViewImpl.setAuthor(TextViewImpl.java:
691)
at com.bi.wave.AskFiservBankIntelligenceServlet.processEvents
(AskFiservBankIntelligenceServlet.java:57)
at com.google.wave.api.AbstractRobotServlet.doPost
(AbstractRobotServlet.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1093)
at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter
(SaveSessionFilter.java:35)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at
com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter
(TransactionCleanupFilter.java:43)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter
(ServletHandler.java:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:
360)
at org.mortbay.jetty.security.SecurityHandler.handle
(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:
181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:
712)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
405)
at com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle
(AppVersionHandlerMap.java:238)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:
139)
at org.mortbay.jetty.Server.handle(Server.java:313)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
506)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete
(HttpConnection.java:830)
at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable
(RpcRequestParser.java:76)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
at
com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest
(JettyServletEngineAdapter.java:139)
at com.google.apphosting.runtime.JavaRuntime.handleRequest
(JavaRuntime.java:239)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:5135)
at com.google.apphosting.base.RuntimePb$EvaluationRuntime
$6.handleBlockingRequest(RuntimePb.java:5133)
at com.google.net.rpc.impl.BlockingApplicationHandler.handleRequest
(BlockingApplicationHandler.java:24)
at com.google.net.rpc.impl.RpcUtil.runRpcInApplication(RpcUtil.java:
363)
at com.google.net.rpc.impl.Server$2.run(Server.java:814)
at com.google.tracing.LocalTraceSpanRunnable.run
(LocalTraceSpanRunnable.java:56)
at com.google.tracing.LocalTraceSpanBuilder.internalContinueSpan
(LocalTraceSpanBuilder.java:516)
at com.google.net.rpc.impl.Server.startRpc(Server.java:769)
at com.google.net.rpc.impl.Server.processRequest(Server.java:351)
at com.google.net.rpc.impl.ServerConnection.messageReceived
(ServerConnection.java:437)
at com.google.net.rpc.impl.RpcConnection.parseMessages
(RpcConnection.java:319)
at com.google.net.rpc.impl.RpcConnection.dataReceived
(RpcConnection.java:290)
at com.google.net.async.Connection.handleReadEvent(Connection.java:
436)
at com.google.net.async.EventDispatcher.processNetworkEvents
(EventDispatcher.java:762)
at com.google.net.async.EventDispatcher.internalLoop
(EventDispatcher.java:207)
at com.google.net.async.EventDispatcher.loop(EventDispatcher.java:101)
at com.google.net.rpc.RpcService.runUntilServerShutdown
(RpcService.java:251)
at com.google.apphosting.runtime.JavaRuntime$RpcRunnable.run
(JavaRuntime.java:396)
at java.lang.Thread.run(Unknown Source)


--~--~

[Google Wave APIs] Designing for Wave

2009-10-13 Thread guy

Howdy all,

Just FYI, I am not a developer...but a designer. If anyone wants help
adding a bit of design elements to their Wave plug-in I'd be glad to
help out.

Just looking for something to do :P

Cheers

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---