Random button broken?

Need the mods or admins to do something for you? Post here. Read the "About" post first.

Moderators: Moderators General, Prelates, Magistrates

User avatar
FurbyFubar
Posts: 26
Joined: Wed Oct 17, 2007 10:03 am UTC
Location: Stockholm, Sweden

Random button broken?

Postby FurbyFubar » Mon Apr 08, 2013 3:24 pm UTC

When I click the "Random"-buttom to get a random strip, I get a "503 Service Unavailable No server is available to handle this request".

User avatar
Zarq
Posts: 1993
Joined: Mon Jul 26, 2010 7:29 pm UTC
Location: Third Rock from Earth's Yellow Sun

Re: Random button broken?

Postby Zarq » Mon Apr 08, 2013 8:49 pm UTC

Same here.
You rang?

"It is better to shit yourself, than to die of constipation." - Some picture on reddit

User avatar
Esern
Posts: 6
Joined: Thu Oct 25, 2012 12:52 am UTC
Location: Sydney, Australia.

Re: Random button broken?

Postby Esern » Mon Apr 08, 2013 11:17 pm UTC

Im getting the same issue, keep getting 503 errors as soon as i try to use it.

i also accidently made another thread about this in the help desk section
viewtopic.php?f=20&t=101285

User avatar
PM 2Ring
Posts: 3713
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: Random button broken?

Postby PM 2Ring » Wed Apr 10, 2013 5:17 am UTC

On a probably-related note, the JSON feed for the comic is currently down. My comic-fetching script just failed on me, so I did a quick test using wget

Code: Select all

wget -O- http://dynamic.xkcd.com/api-0/jsonp/comic/
--2013-04-10 15:14:26--  http://dynamic.xkcd.com/api-0/jsonp/comic/
Resolving dynamic.xkcd.com... 208.118.225.100
Connecting to dynamic.xkcd.com|208.118.225.100|:80... connected.
HTTP request sent, awaiting response... 503 Service Unavailable
2013-04-10 15:14:26 ERROR 503: Service Unavailable.


FWIW, I found the forum site very slow to respond earlier today.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Random button broken?

Postby phlip » Wed Apr 10, 2013 8:11 am UTC

Well, for the JSON you can always get the static file from http://xkcd.com/info.0.json - though it's raw JSON then, not JSONP, if that's what you need. I don't think the JSONP URL was ever advertised though, it was just pulled out of the unixkcd script.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
dudiobugtron
Posts: 1098
Joined: Mon Jul 30, 2012 9:14 am UTC
Location: The Outlier

Re: Random button broken?

Postby dudiobugtron » Wed Apr 10, 2013 9:03 pm UTC

PM 2Ring wrote:FWIW, I found the forum site very slow to respond earlier today.


The same happened for me yesterday. On two different computers using two different ISPs. Not sure if that helps.
Image

User avatar
PM 2Ring
Posts: 3713
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: Random button broken?

Postby PM 2Ring » Thu Apr 11, 2013 3:22 am UTC

phlip wrote:Well, for the JSON you can always get the static file from http://xkcd.com/info.0.json - though it's raw JSON then, not JSONP, if that's what you need. I don't think the JSONP URL was ever advertised though, it was just pulled out of the unixkcd script.

Thanks, phlip.

I use the static file URL in my Python comic fetcher (and parse it using the json module), but I don't know how to handle raw JSON in JavaScript.

Where was the JSON URL advertised? I only learned about it (and the JSONP URL) from the "Getting the most recent comic" thread in the Coding forum.

User avatar
phlip
Restorer of Worlds
Posts: 7572
Joined: Sat Sep 23, 2006 3:56 am UTC
Location: Australia
Contact:

Re: Random button broken?

Postby phlip » Thu Apr 11, 2013 3:42 am UTC

Well, "advertised" as in davean has posted about it on the forums. Which mentions the JSONP proxy too, but doesn't document it at all.

PM 2Ring wrote:I don't know how to handle raw JSON in JavaScript

Well, if you trust the source to never put anything sketchy in there, you can just use window.eval... that's what you're essentially doing when you use JSONP anyway (which requires just as much trust). There's also JSON.parse() built into most browsers these days. However, the hard part with JavaScript isn't reading the JSON, it's fetching it, since there's cross-domain download policies and security stuff like that to handle. This is why JSONP exists - it lets you fetch data in an AJAXy-like manner from other domains.

Code: Select all

enum ಠ_ಠ {°□°╰=1, °Д°╰, ಠ益ಠ╰};
void ┻━┻︵​╰(ಠ_ಠ ⚠) {exit((int)⚠);}
[he/him/his]

User avatar
PM 2Ring
Posts: 3713
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: Random button broken?

Postby PM 2Ring » Thu Apr 11, 2013 11:00 am UTC

phlip wrote:
PM 2Ring wrote:I don't know how to handle raw JSON in JavaScript

Well, if you trust the source to never put anything sketchy in there, you can just use window.eval... that's what you're essentially doing when you use JSONP anyway (which requires just as much trust). There's also JSON.parse() built into most browsers these days.


I thought JSONP was safer than eval; I didn't realise that it does an "invisible" eval to make the retrieved object's contents available to your callback function. But I guess it has to, given the possible contents of a general JavaScript object.

phlip wrote:However, the hard part with JavaScript isn't reading the JSON, it's fetching it, since there's cross-domain download policies and security stuff like that to handle. This is why JSONP exists - it lets you fetch data in an AJAXy-like manner from other domains.

Yeah. I was using the term "handle" to cover both the fetching & parsing aspects. A similar cross-domain security barrier exists when doing image processing on an image displayed in a HTML Canvas, but in that situation browsers pop up a security warning (at least, Firefox does), giving you the option to proceed with the potentially dangerous action.

User avatar
PM 2Ring
Posts: 3713
Joined: Mon Jan 26, 2009 3:19 pm UTC
Location: Sydney, Australia

Re: Random button broken?

Postby PM 2Ring » Mon May 06, 2013 5:24 am UTC

Well, it looks like the Random button is working properly again, and so is the JSONP feed.
Thanks, to whoever fixed it.


Return to “Site/Forum issues”

Who is online

Users browsing this forum: No registered users and 4 guests