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 aghastâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #291606 |
Post edited: Add hint about drop while |
— | 6 months ago |
Edit | Post #291606 | Initial revision | — | 6 months ago |
Answer | — |
A: How do I trim a sorted list in Python? The library module `itertools` provides a function called `dropwhile()`. The example they give is: dropwhile(lambda x: x<5, [1,4,6,3,8]) → 6 3 8 So, to get a list of numbers greater than 4, drop items while they are less than or equal to 4: import itertools l = [1, 3... (more) |
— | 6 months ago |
Edit | Post #291540 | Initial revision | — | 6 months ago |
Answer | — |
A: What does the static keyword do in C? `static` is an unfortunately heavily overloaded keyword. At "file scope" Symbols are said to be at "file scope" if their definition is not inside a function. When the `static` keyword appears at file scope, it specifies the linkage of the symbol to which it is applied. "Linkage" in this cas... (more) |
— | 6 months ago |
Edit | Post #291435 | Initial revision | — | 7 months ago |
Answer | — |
A: How would I display the first line of all files matching a glob? The first line of a file is `head -1`. But you probably also want the file name. So something like: for file in glob do firstline="$(head -1 "$file")" printf "%s: %s\n" "$file" "$firstline" done Where `glob` above is something like `.csv` or whatever. (more) |
— | 7 months ago |
Comment | Post #290786 |
Here's an excerpt from `man tar`:
> ## NOTE
> This manpage is a short description of GNU tar. For a detailed discussion,
> including examples and usage recommendations, refer to the GNU Tar Manual
> available in texinfo format. If the info reader and the tar documentation
> are prop... (more) |
— | 8 months ago |
Comment | Post #290786 |
No. GNU decided at some point that man pages were "so last century," and that all the good info would be in ~~emacs~~^W^W in the "info" browser. So if you check "man some-gnu-program" there's a fair chance the last paragraph will be something like "we've provided this man page as a courtesy, but the ... (more) |
— | 8 months ago |
Edit | Post #290786 | Initial revision | — | 9 months ago |
Question | — |
What guarantees does Bash make about order of :- Parameter Expansion when it is not in POSIX mode? I tried to check `info bash` but only got a copy of the `man` page. This is when I learned that I could `apt install bash-doc` to get the "full" Bash manual. After checking both the info pages and the man page, I found this is pretty much the only description of Parameter Expansion: > In eac... (more) |
— | 9 months ago |
Edit | Post #290783 | Initial revision | — | 9 months ago |
Answer | — |
A: What is the difference between hashing and encryption? I would say the difference is one of intent. In encryption, the objective is to hide the information contained in such a way that third parties cannot get it, but approved second parties can retrieve it (with the key). In pursuit of this, security is the primary goal, with performance as a second... (more) |
— | 9 months ago |
Comment | Post #290316 |
I suspect that if you go far enough back, `stdin` was probably an expression macro, like `&Global_file_structs[0]` or some such. So this is probably the case of some early library corrupting the standard. They probably could have done a better job of *allowing* the name to be a macro without *requiri... (more) |
— | 11 months ago |
Edit | Post #290316 | Initial revision | — | 12 months ago |
Answer | — |
A: What is the purpose of having underscored names and then defining a non-underscored alias to it? Quoting here the 1999 C standard, as being close enough to "this century" while also being hella old. Source: ISO/IEC 9899:1999 > 7.19 Input/output > 7.19.1 Introduction > 1 The header `` declares three types, several macros, and many functions for performing input and output. > ... > ... (more) |
— | 12 months ago |
Comment | Post #290215 |
When I say `gcc -E -xc -` and type:
#define FOO(x) x+1
#define BAR(x) x,1
int y = FOO(BAR(10));
I get back:
int y = 10,1 +1;
If I say
#define LIST3(delim, a, b, c) a delim b delim c
#define INIT3(a, b, c) { LIST3(COMMA, a, b, c) }
#define COMMA... (more) |
— | about 1 year ago |
Edit | Post #290215 |
Post edited: Add tips about stringizing, code |
— | about 1 year ago |
Edit | Post #290215 | Initial revision | — | about 1 year ago |
Answer | — |
A: When should I parenthesize macro arguments in C? With macros, you are better off using parens at any time you use one of the parameters in an expression context. The problem with operator precedence is not limited to + and . Did you know that comma (`,`) is an operator? Did you know that comma has a lower precedence than assignment? Did you know... (more) |
— | about 1 year ago |
Edit | Post #287136 | Initial revision | — | about 2 years ago |
Question | — |
How do I (compactly) initialize a 2-d array of structs with the same value? I learned about the `` operator for array-repeat, and I love it. I have a struct that contains a 2-d array of inner structs, like const D1 = 30; const D2 = 40; const Inner = struct { .a: u32, .b: bool }; const Outer = struct { // ... .array: D1Inner, ... (more) |
— | about 2 years ago |
Edit | Post #286625 | Initial revision | — | over 2 years ago |
Question | — |
How to pass in a readable file (stream) to a Zig function? Most of the example code in the Zig online docs is in the form of test blocks. Sadly, this means there aren't quite enough examples of how to write functions. Given that one has a readable file, possibly including `stdin`, what is the "ziggy" way to pass that to a function that will read input fro... (more) |
— | over 2 years ago |