8 votes

Fortnightly Programming Q&A Thread

General Programming Q&A thread! Ask any questions about programming, answer the questions of other users, or post suggestions for future threads.

Don't forget to format your code using the triple backticks or tildes:

Here is my schema:

```sql
CREATE TABLE article_to_warehouse (
  article_id   INTEGER
, warehouse_id INTEGER
)
;
```

How do I add a `UNIQUE` constraint?

5 comments

  1. [4]
    krg
    Link
    question for @jgb: forked your plainchant repo to mess around with, but couldn't get it to run. How can I run it locally? Seems to be having issues looking for a database.

    question for @jgb:

    forked your plainchant repo to mess around with, but couldn't get it to run. How can I run it locally? Seems to be having issues looking for a database.

    4 votes
    1. [3]
      jgb
      Link Parent
      Hi, cheers for the fork :-) I honestly didn't expect anyone to be interested in running it so I didn't bother to put instructions, haha. It's really ugly but how you run it at the moment is to...

      Hi, cheers for the fork :-)

      I honestly didn't expect anyone to be interested in running it so I didn't bother to put instructions, haha. It's really ugly but how you run it at the moment is to create the following tree in the repository root:

      plainchant/fstest
      plainchant/fstest/boards [file]
      plainchant/fstest/rack [folder]
      plainchant/fstest/<board_id> [folder, for each board]
      

      Your boards file should have a series of rows in the following form:

      <board_id>,<slug>,<desc>,<post_ctr>
      

      For example:

      1234,mu,Music,10000
      

      Then if you do cargo run in the repository root it should get up and running on port 8088 :-)

      You should be able to access the catalog at http://localhost:8088/<slug>/catalog.

      4 votes
      1. [2]
        krg
        Link Parent
        Sweet! Yea, just looks like a fun bit of code to poke at. Don't know that I can contribute much of anything, but hopefully I learn something!

        Sweet! Yea, just looks like a fun bit of code to poke at. Don't know that I can contribute much of anything, but hopefully I learn something!

        3 votes
        1. jgb
          Link Parent
          All contributions are appreciated! I would ask only that you run cargo fmt on any code you make a PR for. I remember learning Rust by poking around with Matt Brubeck's robinson so it's flattering...

          All contributions are appreciated! I would ask only that you run cargo fmt on any code you make a PR for. I remember learning Rust by poking around with Matt Brubeck's robinson so it's flattering that you're doing the same with my project :-)

          3 votes
  2. hairypotter
    Link
    Maybe a simple question, but I have a frontend running in a docker container and a backend running in a docker container. My frontend hit Same Origin Policy errors when I try to query the backend....

    Maybe a simple question, but I have a frontend running in a docker container and a backend running in a docker container. My frontend hit Same Origin Policy errors when I try to query the backend.

    My current thought is to use nginx to serve my frontend and reverse proxy routes to my backend to avoid this error. Will this work? Any other obvious solutions?

    3 votes