Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for Emily
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #291036 | Initial revision | — | 8 months ago |
Answer | — |
A: Why does bash seem to parse `sh -c` commands differently when called via `execl`? Because `execl`'s first argument isn't `argv[0]`. `execl("/bin/sh", "-c", ...)` runs the executable `/bin/sh`, but sets its `argv[0]` to `"-c"`, as if one had created a link called `-c` pointing at it and run that. The correct way to do this is `execl("/bin/sh", "sh", "-c", ...)`. Busybox works... (more) |
— | 8 months ago |
Edit | Post #291035 |
Post edited: |
— | 8 months ago |
Edit | Post #291035 | Initial revision | — | 8 months ago |
Question | — |
Why does bash seem to parse `sh -c` commands differently when called via `execl`? When I do this in a shell: ```plain $ /bin/sh -c 'echo hello world' hello world ``` it's my understanding that I'm running a process with `argv = {"/bin/sh", "-c", "echo hello world"}`. That is, the quotes cause all three words to be passed as one argument to `sh`, and that instance of `sh` is r... (more) |
— | 8 months ago |
Edit | Post #290010 |
Post edited: rm stray extra question mark |
— | about 1 year ago |
Edit | Post #290011 | Initial revision | — | about 1 year ago |
Answer | — |
A: How do I share a type between a client and server, but make a specific field optional for one and required for the other? This can be done using conditional types. I defined these helper types: ```typescript enum Role { server, client }; type PossiblyHiddenFromClients = T | (R extends Role.client ? undefined : never); ``` When R is `server`, this type reduces to `T` (via `T | never`); when R is `client`... (more) |
— | about 1 year ago |
Edit | Post #290010 | Initial revision | — | about 1 year ago |
Question | — |
How do I share a type between a client and server, but make a specific field optional for one and required for the other? Let's say I have a client/server application with a data structure on the server side: ```typescript type User = { name: string; superSecretGovernmentIdNumber: string; }; ``` These fields are both non-nullable; all users in this system have a `name` and a `superSecretGovernmentIdNumber... (more) |
— | about 1 year ago |
Comment | Post #289737 |
Hrm. I definitely learned some things, but I think I phrased this specific question far too generally for them to make sense as answers to it. I may sit down at some point this week and distill them into a few separate self-answered questions. (more) |
— | about 1 year ago |
Comment | Post #289737 |
Probably wouldn't have helped in this case, depending on whether I got lucky and copied the right rows. The answer for this particular query (which I eventually found via extensive use of commenting things out and staring really hard) wound up being a series of joins that *looked* (to both me and `EX... (more) |
— | about 1 year ago |
Comment | Post #289741 |
Edited `SELECT` into the question for clarity, thanks.
The query in question is mostly autogenerated at runtime, and is a search with arbitrary user inputs, but the complexity is entirely due to the application I work on having abnormally complicated visibility permission rules (it's bad even with... (more) |
— | about 1 year ago |
Edit | Post #289737 |
Post edited: |
— | about 1 year ago |
Edit | Post #289737 |
Post edited: clarity |
— | about 1 year ago |
Edit | Post #289737 | Initial revision | — | about 1 year ago |
Question | — |
Alternatives to `EXPLAIN ANALYZE` for queries that won't complete I have a large and complex PostgreSQL `SELECT` query that I would like to make faster. `EXPLAIN` suggests it should run quickly, with the worst parts being scans of a few thousand rows. When run, it does not complete in any reasonable amount of time (if `statementtimeout` is set to infinite, it event... (more) |
— | about 1 year ago |