Link to Julia questions on StackOverflow


#1

I recently noticed that the halide mailing list receives posts from StackOverflow, with the question and with a link back to the StackOverflow posting. I find this idea quite nice, as it means I don’t need to check multiple sites for things I’m interested in.

I’d like to propose that we do the same with Julia, where StackOverflow posts get sent, here, with a link back to the StackOverflow. I’m not entirely sure of the best way to do this, but one possibility is through http://stackexchange.com/filters.

Thoughts?

Cheers,
Kevin


#2

StackExchange has pretty good API, so getting new questions should be straightforward (something like this).

Discourse also has an API, but for some reason, I can only find clients in multiple languages and not docs for REST methods. I’ll check if I can find something useful in existing clients.


#3

Maybe this is relevant: https://meta.discourse.org/t/discourse-api-documentation/22706


#4

Yep, or more specifically http://docs.discourse.org/.
And the very first thing it says is:

To become authenticated you will need to create an API Key from the admin panel.

Seems like it implies that only admins of the forum can provide a key :slight_smile: If some of these brave guys can send me a key, I’ll try to make a service to retrieve latest posts from SO and post it here (probably in a separate category or with a specific tag).


#5

@oxinabox has previously done this for the Gitter Julia channel.


#6

I am bit worried that there are going to be two places discussing the same question and if the noise associated is going to be large. Since gitter is a chatroom I see it as less of a problem there.


#7

In the version I’ve seen, the user is directed to post a response on StackOverflow. Perhaps we could even make the Discourse thread read-only (is this possible?).

Cheers,
Kevin


#8

Ok, @vchuravy provided me with the API key, but this forum seems to have non-standard API configuration: when I call locally installed Discourse instance with the request like this:

using Requests
get("http://localhost/admin/users/list/active.json?api_key=<local api key>&api_username=dfdx")

I get a correct JSON response. However, the same call to discourse.julialang.org:

get("http://discourse.julialang.org/admin/users/list/active.json?api_key=<discourse.julialang.org api key>&api_username=dfdx")

returns 404 error - page not found.

I don’t know much about Discourse, but I guess there’s a special config for API calls, maybe different port or something. Alternatively, there may be an issue with routing.


#9

Does HTTPS work?


#10

Nope, same result.

What’s also interesting is that if I change api_username or api_key to a random string, the server returns 500 Internal Server Error. So at least credentials are correct :slight_smile:


#11

@djsegal is using the API for his integration with juliaobserver.com, maybe he can shine light on how to use the API properly.


#12

On Julia Observer, I use the discourse gem because the project is written in rails. // see code below…

My guess is that you have to send the key & username as headers instead of as query params?


and @kevin.squire, not to seem annoying, but I could add stack overflow as a news item on juliaobserver.com. maybe that makes more sense than to put it on discourse?


#13

@djsegal, definitely not annoying. I hadn’t realized that you had a news section on juliaobserver. It certainly seems to fit there.

I still think that it would work on Discourse as well. I think it has the potential to increase the set of individuals contributing StackOverflow answers to Julia questions by making those questions more visible, and it should help limit cross posting the same question to both StackOverflow and Discourse (which isn’t that common, but still happens from time to time).

(@dfdx, thanks for trying to pull this together!)

Cheers,
Kevin


#14

Rather than “some service on someone’s random server” (that might expire when they graduate/move), it might be simpler to set up a (well-obfuscated) gmail address subscribed to the appropriate SO tags, and have a read-only Discourse category poll that address:


#15

It didn’t work either. I’ll check existing API clients and how they handle endpoints.


Indicator matrix for categorical data in GLM.jl with DataFrames.jl
#16

As far as I understand in this case it would be impossible to modify content of the topic, e.g. add a link to SO question or a text explaining that users should answer there. Am I right?


#17

Yes. But the category can have a permanent banner at the top, and the SO email already includes a link (though not necessarily the full text of the question, I guess that’s not ideal). If more customization is needed then using the API makes sense.


#18

It turns out the example endpoint from Discourse docs is just available only for admins. I tried other endpoints and they work fine. In fact, this post is created using an API call instead of web UI.
I’ll try to create the tool for re-posting SO questions here in the next couple of days.


#19

BTW, since we may need more Discourse-related stuff and posting to Julia forum from Julia itself is always funnier, I will put all API methods to a separate repository.


#20

Here’s a test topic created via API:

Notes / questions:

  1. StackOverflow returns HTML of a question. Discourse seems to process it correctly except for <code> tag which is escaped. From discussions on forums, I suppose this tag can be whitelisted and be inserted correctly here. If it doesn’t break any other configs, can somebody from admins take a look at it?

  2. Currently, I set the service to re-post questions to the “Usage” category on this forum. Does it make sense to create a separate category? Are there better ideas how to distinguish topics created here and reposted from SO?

  3. We may want a separate user to publish reposted questions. Otherwise, I will very quickly become the most active user here :slight_smile: