Re: [twitter-dev] Re: illegal character in json feed

2011-06-15 Thread michael hazzard
Much better!

I let http://jsfiddle.net/NBCGf/34/ run 1000 tries successfully before
taking mercy on your servers and shutting it off.

Good job and thanks,

//mh


On Tue, Jun 14, 2011 at 11:28 PM, themattharris
thematthar...@twitter.comwrote:

 Hey everyone,

 Thanks for all the information you provided. We were able to reproduce
 the problem and the engineers have now released a fix.
 You shouldn't receive any garbled API responses anymore, if you do
 please let us know.

 Best,
 @themattharris

 On Jun 14, 7:59 pm, michael hazzard miramardes...@gmail.com wrote:
  Marc,
  Nice theory but I'm not so sure since I'm reloading the same exact tweet
 (I
  think)over and over again and its getting corrupted.
  Although I've heard of type of thing before where an application
 (notepad)
  tries to do charset encoding detection but fails and outputs a corrupted
  file upon reopening.
  On Jun 14, 2011 9:24 PM, marc fawzi marc.fa...@gmail.com wrote:
 
 
 
 
 
 
 
 
 
   Re: error handling the jsonp script error
 
   I started using the previously mentioned window.onerror mechanism
   wherein I reload the iframe from which I'm initiating the jsonp call,
   up to 10 times, 3 seconds apart (the average delay in getting the
   script back from twitter, which triggers the error which in turn
   starts another jsonp request and so on, up to 10 times)
 
   I'm using this approach in addition to my pre-existing 5 retries on
   general error, 10 seconds apart non-blocking error handler which was
   able to survive the illegal character error on its own and recover
   from it, but sometimes it ended up with Sorry, try again
   later (twitter recovers after a while on its own and my app continues
   from there but sometimes the error persists with twitter.) The pre-
   existing handler was using more time on average (about 20-50 seconds)
   and the newly added window.onerror mechanism, which runs before the
   self-terminating, non-blocking handler loop, is taking less time on
   average (6-15 seconds) to go thru the same process for the jsonp
   script error reported by the browser. However, sometimes, this error
   persists for too many retries and falls out of the window.onerror but
   99% of the time so far it's getting caught by my pre-existing general
   error handler (now, the second layer of defense)
 
   I never thought I had to double up! :)
 
   Re: illegal character
 
   Wow. Really? you can have the unicode character for delete \u0008 in
   the response? I have a full dump of the jsonp response in firebug and
   that's the character that firebug terminates at when reporting the
   error so I assume that's the culprit, but could be others as well. On
   a more relevant note, I don't think the illegal character coming back
   in jsonp have anything to do with the tweet's content. It looks as if
   some tweets contain some combination of characters that cause twitter
   to return a binary dump of some sort (in casual terms, it causes it to
   hallucinate.)
 
   Anyway intriguing. :)
 
   Marc
   On Jun 14, 6:53 pm, Romica iordan.rom...@gmail.com wrote:
I have the same problem (bad JSON most of the times). The weird thing
is that if I access the URL direct from the browser it works (good
JSON every time). I'm using jQuery.getJSON and I think that this (or
something connected to this) might be the problem.
 
Unfortunately I cannot use window.onerror (as Michael suggested)
because I have multiple asynchronous requests at the same time (it
would be tricky and expensive to find out which one is bad - at least
I suppose so).
 
Good luck in solving this
 
   --
   Twitter developer documentation and resources:
 https://dev.twitter.com/doc
   API updates via Twitter:https://twitter.com/twitterapi
   Issues/Enhancements Tracker:
 
  https://code.google.com/p/twitter-api/issues/list Change your
 membership to this group:
 
  https://groups.google.com/forum/#!forum/twitter-development-talk

 --
 Twitter developer documentation and resources: https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk




-- 
Thank You,

Michael Hazzard
(954) 247-4461 https://www.google.com/voice#phones

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Re: illegal character in json feed

2011-06-14 Thread michael hazzard
Fyi Guys,

The way I worked around this since a try-catch was useless is that I used a
window.oneerror = function(){ to ignore the offending tweet and count errors
etc.

//mh

On Tue, Jun 14, 2011 at 6:17 PM, Paul Bailey paul.m.bai...@gmail.comwrote:

 We are seeing the same problem on our latest site:
 http://grb.culturemap.com/senior-games/

 It is intermittent; sometimes good JSON is returned and sometimes not.

  --
 Twitter developer documentation and resources: https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk




-- 
Thank You,

Michael Hazzard
(954) 247-4461 https://www.google.com/voice#phones

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] Re: illegal character in json feed

2011-06-14 Thread michael hazzard
Marc,
Nice theory but I'm not so sure since I'm reloading the same exact tweet (I
think)over and over again and its getting corrupted.
Although I've heard of type of thing before where an application (notepad)
tries to do charset encoding detection but fails and outputs a corrupted
file upon reopening.
On Jun 14, 2011 9:24 PM, marc fawzi marc.fa...@gmail.com wrote:

 Re: error handling the jsonp script error

 I started using the previously mentioned window.onerror mechanism
 wherein I reload the iframe from which I'm initiating the jsonp call,
 up to 10 times, 3 seconds apart (the average delay in getting the
 script back from twitter, which triggers the error which in turn
 starts another jsonp request and so on, up to 10 times)

 I'm using this approach in addition to my pre-existing 5 retries on
 general error, 10 seconds apart non-blocking error handler which was
 able to survive the illegal character error on its own and recover
 from it, but sometimes it ended up with Sorry, try again
 later (twitter recovers after a while on its own and my app continues
 from there but sometimes the error persists with twitter.) The pre-
 existing handler was using more time on average (about 20-50 seconds)
 and the newly added window.onerror mechanism, which runs before the
 self-terminating, non-blocking handler loop, is taking less time on
 average (6-15 seconds) to go thru the same process for the jsonp
 script error reported by the browser. However, sometimes, this error
 persists for too many retries and falls out of the window.onerror but
 99% of the time so far it's getting caught by my pre-existing general
 error handler (now, the second layer of defense)

 I never thought I had to double up! :)

 Re: illegal character

 Wow. Really? you can have the unicode character for delete \u0008 in
 the response? I have a full dump of the jsonp response in firebug and
 that's the character that firebug terminates at when reporting the
 error so I assume that's the culprit, but could be others as well. On
 a more relevant note, I don't think the illegal character coming back
 in jsonp have anything to do with the tweet's content. It looks as if
 some tweets contain some combination of characters that cause twitter
 to return a binary dump of some sort (in casual terms, it causes it to
 hallucinate.)

 Anyway intriguing. :)

 Marc
 On Jun 14, 6:53 pm, Romica iordan.rom...@gmail.com wrote:
  I have the same problem (bad JSON most of the times). The weird thing
  is that if I access the URL direct from the browser it works (good
  JSON every time). I'm using jQuery.getJSON and I think that this (or
  something connected to this) might be the problem.
 
  Unfortunately I cannot use window.onerror (as Michael suggested)
  because I have multiple asynchronous requests at the same time (it
  would be tricky and expensive to find out which one is bad - at least
  I suppose so).
 
  Good luck in solving this

 --
 Twitter developer documentation and resources: https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
https://groups.google.com/forum/#!forum/twitter-development-talk

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] illegal character in json feed

2011-06-13 Thread michael hazzard
Taylor();

I took a pic of firebug here:
https://docs.google.com/leaf?id=0B1lcI5OlKM2xNDczZDdmYTMtMjFjZi00Y2E2LWE4MTMtM2YyM2I5ZTM4Njhlsort=namelayout=listnum=50


It is similar to this case (I believe the same chars)
http://groups.google.com/group/twitter-development-talk/browse_thread/thread/7567404004266db5?pli=1

It is reproducible on the jsfiddle url if you look at the error console
usually 10-20 iterations.
http://jsfiddle.net/NBCGf/34/

(Note: I recently added window.onerror to get around it for now and continue
loading feeds.)

Thanks,
//mh

On Mon, Jun 13, 2011 at 3:13 PM, Taylor Singletary 
taylorsinglet...@twitter.com wrote:

 Do you have more details about the specific illegal character(s) you're
 receiving? How frequently are you polling the API? Have you tried
 reproducing your scenario outside of a browser-based environment?

 @episod http://twitter.com/intent/user?screen_name=episod - Taylor
 Singletary



 On Mon, Jun 13, 2011 at 11:55 AM, miramardesign 
 miramardes...@gmail.comwrote:

 All browsers throw error illegal character in twitter jsonp feed

 http://jsfiddle.net/NBCGf/34/

 Please advise,
 //mh

 --
 Twitter developer documentation and resources:
 https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk


  --
 Twitter developer documentation and resources: https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk




-- 
Thank You,

Michael Hazzard
(954) 247-4461 https://www.google.com/voice#phones

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] illegal character in json feed

2011-06-13 Thread michael hazzard
Oh answers to #2 and #3

2) I am polling the jsonp api every second in this test but it will be
changed for production to like 6 seconds and cached after all 30 feeds are
loaded

3) No, I haven't tried outside the browser since this is strictly a jsonp
feed and I chose jsonp over server-side xml but now regretting a bit.

//mh


On Mon, Jun 13, 2011 at 3:43 PM, michael hazzard miramardes...@gmail.comwrote:

 Taylor();

 I took a pic of firebug here:

 https://docs.google.com/leaf?id=0B1lcI5OlKM2xNDczZDdmYTMtMjFjZi00Y2E2LWE4MTMtM2YyM2I5ZTM4Njhlsort=namelayout=listnum=50


 It is similar to this case (I believe the same chars)

 http://groups.google.com/group/twitter-development-talk/browse_thread/thread/7567404004266db5?pli=1

 It is reproducible on the jsfiddle url if you look at the error console
 usually 10-20 iterations.

 http://jsfiddle.net/NBCGf/34/

 (Note: I recently added window.onerror to get around it for now and
 continue loading feeds.)

 Thanks,
 //mh


 On Mon, Jun 13, 2011 at 3:13 PM, Taylor Singletary 
 taylorsinglet...@twitter.com wrote:

 Do you have more details about the specific illegal character(s) you're
 receiving? How frequently are you polling the API? Have you tried
 reproducing your scenario outside of a browser-based environment?

 @episod http://twitter.com/intent/user?screen_name=episod - Taylor
 Singletary



 On Mon, Jun 13, 2011 at 11:55 AM, miramardesign 
 miramardes...@gmail.comwrote:

 All browsers throw error illegal character in twitter jsonp feed

 http://jsfiddle.net/NBCGf/34/

 Please advise,
 //mh

 --
 Twitter developer documentation and resources:
 https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk


  --
 Twitter developer documentation and resources:
 https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk




 --
 Thank You,

 Michael Hazzard
 (954) 247-4461 https://www.google.com/voice#phones





-- 
Thank You,

Michael Hazzard
(954) 247-4461 https://www.google.com/voice#phones

-- 
Twitter developer documentation and resources: https://dev.twitter.com/doc
API updates via Twitter: https://twitter.com/twitterapi
Issues/Enhancements Tracker: https://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
https://groups.google.com/forum/#!forum/twitter-development-talk


Re: [twitter-dev] illegal character in json feed

2011-06-13 Thread michael hazzard
Taylor,

Firefox 4.01 on Windows Server 2003 and IE8 on Windows Server 2003
 (I believe they are both fully utf-8 compatible)
(using jQuery 1.3.2 js library, I would upgrade but I am stuck at it w/
other dependencies )

Can you not reproduce the error on the jsFiddlehttp://jsfiddle.net/NBCGf/34/?
(I will test on my ubuntu laptop when I get home)

As for the tweetid/url it is happening on multiple but I have
http://search.twitter.com/search.json?q=from:LansdowneResortrpp=1callback=?
http://search.twitter.com/search.json?q=from:LansdowneResortrpp=1callback=?%20
hard-coded in the jsfiddle example and its showing error after a couple
iterations.

In any event, if you cannot, I am fine w/ the window.onerror error handling
I have implemented and have it working in both browsers now and have
implemented dom caching so as not to make too many requests.

Update:
I just tested in chrome and it threw
search.json:1http://search.twitter.com/search.json?q=from:TrumpSoHorpp=1callback=jsonp1308002393614_=1308002425423Uncaught
SyntaxError: Unexpected token ILLEGAL
http://search.twitter.com/search.json?q=from:TrumpSoHorpp=1callback=jsonp1308002393614_=1308002425423

So I imagine maybe it is an OS/charset thing.

Thanks
//mh

On Mon, Jun 13, 2011 at 5:20 PM, Taylor Singletary 
taylorsinglet...@twitter.com wrote:

 It would be very helpful if you could provide a specific Tweet ID that
 is exhibiting this behavior -- the test case you're presenting is a bit
 artificial. Do you know if the environment you're doing this consumption is
 fully capable of understanding the UTF-8 character set? Tweets can contain
 just about any UTF-8 character and your parsing should be prepared for
 that.

 On a side note, executing a specific query against the Search API every six
 seconds isn't the most efficient use of the API. Have you considered
 increasing the time you wait to poll and using additional Search API feature
 like since_id?

 @episod http://twitter.com/intent/user?screen_name=episod - Taylor
 Singletary


 On Mon, Jun 13, 2011 at 12:49 PM, michael hazzard miramardes...@gmail.com
  wrote:

 Oh answers to #2 and #3

 2) I am polling the jsonp api every second in this test but it will be
 changed for production to like 6 seconds and cached after all 30 feeds are
 loaded

 3) No, I haven't tried outside the browser since this is strictly a jsonp
 feed and I chose jsonp over server-side xml but now regretting a bit.

 //mh



 On Mon, Jun 13, 2011 at 3:43 PM, michael hazzard miramardes...@gmail.com
  wrote:

 Taylor();

 I took a pic of firebug here:

 https://docs.google.com/leaf?id=0B1lcI5OlKM2xNDczZDdmYTMtMjFjZi00Y2E2LWE4MTMtM2YyM2I5ZTM4Njhlsort=namelayout=listnum=50


 It is similar to this case (I believe the same chars)

 http://groups.google.com/group/twitter-development-talk/browse_thread/thread/7567404004266db5?pli=1

 It is reproducible on the jsfiddle url if you look at the error console
 usually 10-20 iterations.

 http://jsfiddle.net/NBCGf/34/

 (Note: I recently added window.onerror to get around it for now and
 continue loading feeds.)

 Thanks,
 //mh


 On Mon, Jun 13, 2011 at 3:13 PM, Taylor Singletary 
 taylorsinglet...@twitter.com wrote:

 Do you have more details about the specific illegal character(s) you're
 receiving? How frequently are you polling the API? Have you tried
 reproducing your scenario outside of a browser-based environment?

 @episod http://twitter.com/intent/user?screen_name=episod - Taylor
 Singletary



 On Mon, Jun 13, 2011 at 11:55 AM, miramardesign 
 miramardes...@gmail.com wrote:

 All browsers throw error illegal character in twitter jsonp feed

 http://jsfiddle.net/NBCGf/34/

 Please advise,
 //mh

 --
 Twitter developer documentation and resources:
 https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk


  --
 Twitter developer documentation and resources:
 https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk




 --
 Thank You,

 Michael Hazzard
 (954) 247-4461 https://www.google.com/voice#phones





 --
 Thank You,

 Michael Hazzard
 (954) 247-4461 https://www.google.com/voice#phones


  --
 Twitter developer documentation and resources:
 https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues/Enhancements Tracker:
 https://code.google.com/p/twitter-api/issues/list
 Change your membership to this group:
 https://groups.google.com/forum/#!forum/twitter-development-talk


  --
 Twitter developer documentation and resources: https://dev.twitter.com/doc
 API updates via Twitter: https://twitter.com/twitterapi
 Issues