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]
    bltzkrg22
    (edited )
    Link
    EDIT: Well, the app is live. There are still some edges to iron out. Some more resource-intensive parts never complete on my phone; on my PC though everything “works” (with the exception of 22B)....

    EDIT: Well, the app is live. There are still some edges to iron out. Some more resource-intensive parts never complete on my phone; on my PC though everything “works” (with the exception of 22B).


    I would appreciate a little help.

    https://gitlab.com/bltzkrg.22/advent-of-code-2020-in-blazor-wasm

    As a learning exercise, I’m currently trying to make a simple in-browser solver for last year’s Advent of Code problems, something akin to this. I didn’t publish it anywhere yet, but the repository contents should be buildable either in VS 2019 or with dotnet build/dotnet run command.

    I run into an issue specifically with problem 22. If I try to run the solver for part B of that day, it eats around 2.5 GiB of RAM and then crashes. The same solver runs fine as a simple console app. I don’t know if I’m doing something wrong, or if it’s some Blazor or WebAssembly limitation. Requesting garbage collection explicitly in C# code seems to have to effect on the app running in browser. Choosing Debug/Release also seems to have no effect on crashing.

    Is there anything I could do to reduce RAM usage?

    1 vote
    1. [3]
      TemulentTeatotaler
      (edited )
      Link Parent
      Nothing lept out at me in a quick look. I ran it in the VS 2022 preview. Other solutions worked fine. I had the same crash on 22 part B. Extracting part B into a quick notebook confirmed it worked...

      Nothing lept out at me in a quick look.

      • I ran it in the VS 2022 preview.
      • Other solutions worked fine.
      • I had the same crash on 22 part B.
      • Extracting part B into a quick notebook confirmed it worked elsewhere.
      • Firefox/Edge made no difference. No errors thrown.

      I'm not experienced with Blazor, but afaik the WASM is still a bit of a work in progress. Blazor Server might be worth trying out for the short term, if you aren't.

      1 vote
      1. [2]
        bltzkrg22
        Link Parent
        Thank you for taking the time to look into my issue. I guess I’ll leave this part as is, and maybe come back in a few months and see if anything improves after rebuilding. Whole idea was to deploy...

        Thank you for taking the time to look into my issue.

        I guess I’ll leave this part as is, and maybe come back in a few months and see if anything improves after rebuilding. Whole idea was to deploy this as a “static” app and make user’s browser handle all the computing, with no backing server.

        I wish I was able to see someone else’s attempt at the same problem, but all the projects I was able to find didn’t get past day 20. (There are plenty of solvers, just none specifically using Blazor WASM).

        1 vote
        1. balooga
          Link Parent
          I don't have much to contribute but I love the concept, a WASM solver is an awesome idea. I built a solver for AoC 2020 as well, mine was a CLI built in TypeScript. Never finished the solutions...

          I don't have much to contribute but I love the concept, a WASM solver is an awesome idea. I built a solver for AoC 2020 as well, mine was a CLI built in TypeScript. Never finished the solutions past day 12 though, one of these days I should circle back and finish! And maybe do some previous years as well if I get really bored and suddenly have tons of free time, haha.

  2. helloworld
    Link
    Any NixOS + Emacs users developing common lisp, here? Because I could use some help. I'm trying to run a simple webapp, it compiles and loads into SLY repl just fine. But when I try to start it, I...

    Any NixOS + Emacs users developing common lisp, here? Because I could use some help.

    I'm trying to run a simple webapp, it compiles and loads into SLY repl just fine. But when I try to start it, I get errors that it couldn't find OpenSSL. So I created a shell.nix modifying LD_LIBRARY_PATH but still no luck. I have the direnv package for emacs which detects the shell.nix and loads it automatically but for some reason its not working with SLY. Interestingly enough, when I check the path that SLY is using to look for libraries in, is NIL. I even set it in .sbclrc but still no dice. What gives?