# Link to Julia questions on StackOverflow

**URL:** <https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357>\
**Category:** Meta Discussion\
**Created:** [April 24, 2017, 5:02pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357 "2017-04-24T17:02:49Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![kevin.squire](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin.squire/32/62_2.png) [@kevin.squire](https://discourse.julialang.org/u/kevin.squire)\
**Post date:** [April 24, 2017, 5:02pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/1 "2017-04-24T17:02:49Z")

</div>

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 [Log In - Meta Stack Exchange](http://stackexchange.com/filters).

Thoughts?

Cheers,  
Kevin

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [April 24, 2017, 6:14pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/2 "2017-04-24T18:14:06Z")

</div>

StackExchange has pretty good API, so getting new questions should be straightforward (something like [this](https://api.stackexchange.com/docs/questions#page=1&pagesize=10&fromdate=2017-04-24&order=desc&sort=creation&tagged=julia&filter=default&site=stackoverflow&run=true)).

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.

---

<div class="post-metadata">

**Author:** ![Tero\_Frondelius](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tero_frondelius/32/7629_2.png) [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Post date:** [April 24, 2017, 6:38pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/3 "2017-04-24T18:38:11Z")

</div>

Maybe this is relevant: [Discourse API Documentation - developers - Discourse Meta](https://meta.discourse.org/t/discourse-api-documentation/22706)

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [April 24, 2017, 8:57pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/4 "2017-04-24T20:57:04Z")

</div>

Yep, or more specifically [http://docs.discourse.org/](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 🙂 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).

---

<div class="post-metadata">

**Author:** ![fengyang.wang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fengyang.wang/32/104_2.png) [@fengyang.wang](https://discourse.julialang.org/u/fengyang.wang)\
**Post date:** [April 24, 2017, 9:07pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/5 "2017-04-24T21:07:58Z")

</div>

@oxinabox has previously done this for the [Gitter](https://gitter.im/JuliaLang/julia) Julia channel.

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [April 25, 2017, 2:22am UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/6 "2017-04-25T02:22:59Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kevin.squire](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin.squire/32/62_2.png) [@kevin.squire](https://discourse.julialang.org/u/kevin.squire)\
**Post date:** [April 25, 2017, 6:46pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/7 "2017-04-25T18:46:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [April 25, 2017, 8:58pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/8 "2017-04-25T20:58:34Z")

</div>

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:

```julia
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](http://discourse.julialang.org):

```julia
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.

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [April 25, 2017, 9:06pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/9 "2017-04-25T21:06:01Z")

</div>

Does HTTPS work?

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [April 25, 2017, 9:14pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/10 "2017-04-25T21:14:38Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![vchuravy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vchuravy/32/8_2.png) [@vchuravy](https://discourse.julialang.org/u/vchuravy)\
**Post date:** [April 25, 2017, 9:31pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/11 "2017-04-25T21:31:11Z")

</div>

@djsegal is using the API for his integration with [juliaobserver.com](http://juliaobserver.com), maybe he can shine light on how to use the API properly.

---

<div class="post-metadata">

**Author:** ![djsegal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/djsegal/32/13752_2.png) [@djsegal](https://discourse.julialang.org/u/djsegal)\
**Post date:** [April 25, 2017, 9:44pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/12 "2017-04-25T21:44:22Z")

</div>

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`?

[https://github.com/djsegal/julia\_observer/blob/41fd8126489e467ed8a134669562998850dd82bc/lib/tasks/news.rake#L143-L145](https://github.com/djsegal/julia_observer/blob/41fd8126489e467ed8a134669562998850dd82bc/lib/tasks/news.rake#L143-L145)

* * *

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

---

<div class="post-metadata">

**Author:** ![kevin.squire](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kevin.squire/32/62_2.png) [@kevin.squire](https://discourse.julialang.org/u/kevin.squire)\
**Post date:** [April 26, 2017, 12:10am UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/13 "2017-04-26T00:10:21Z")

</div>

> [@djsegal](#):
>
> @kevin.squire, not to seem annoying, but I could add stack overflow as a news item on [juliaobserver.com](http://juliaobserver.com). maybe that makes more sense than to put it on discourse

@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

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [April 26, 2017, 2:21am UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/14 "2017-04-26T02:21:08Z")

</div>

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:

> **[Troubleshoot reply by email](https://meta.discourse.org/t/troubleshoot-reply-by-email/42026)**
>
> If your Discourse does not have incoming email set up, see these topics: Set up reply by email with POP3 polling Configure direct-delivery incoming email for self-hosted sites ℹ If you already have basic reply via email set up (which is common...

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [April 26, 2017, 11:03am UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/15 "2017-04-26T11:03:58Z")

</div>

> [@djsegal](#):
>
> My guess is that you have to send the key & username as headers instead of as query params?

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

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [April 26, 2017, 11:06am UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/16 "2017-04-26T11:06:36Z")

</div>

> [@ihnorton](#):
>
> 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:

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?

---

<div class="post-metadata">

**Author:** ![ihnorton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ihnorton/32/26_2.png) [@ihnorton](https://discourse.julialang.org/u/ihnorton)\
**Post date:** [April 26, 2017, 12:43pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/17 "2017-04-26T12:43:53Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [April 26, 2017, 10:12pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/18 "2017-04-26T22:12:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [April 26, 2017, 10:29pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/19 "2017-04-26T22:29:54Z")

</div>

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](https://github.com/dfdx/Discourse.jl).

---

<div class="post-metadata">

**Author:** ![dfdx](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dfdx/32/120_2.png) [@dfdx](https://discourse.julialang.org/u/dfdx)\
**Post date:** [April 30, 2017, 9:22pm UTC](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357/20 "2017-04-30T21:22:59Z")

</div>

Here’s a test topic created via API:

> [@Indicator matrix for categorical data in GLM.jl with DataFrames.jl](https://discourse.julialang.org/t/indicator-matrix-for-categorical-data-in-glm-jl-with-dataframes-jl/3448):
>
> I am working with a large data set and want to run a logit regression on monthly data. For this I create a DataFrame and use the GLM package in Julia. My code looke something like that: f=glm((Y ~ Age + Duration + Gender + Nationality + MonthIn), Data2000, Binomial(), LogitLink()) My question is, as I have monthly data I want to create dummy variables for the 12 months, or eleven when I want to use a constant. The MonthIn is just a column which have numbers for the month (eg 3 for march). No…

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 🙂

[Next page](https://discourse.julialang.org/t/link-to-julia-questions-on-stackoverflow/3357.md?page=2)
