hmmm.... can i use systemd-resolve as a DNS server?
or am i doing something wrong...
ive been using bind to manage my house's computers, but its really overkill. i just want basically a single hosts file
i thought dnsmasq was going to be better for me. but then i found that when i killed bind another process called systemd-resolve took over for some reason. and looking it up it seems to do everything i want
In Emacs under C mode, why did the single quote key give me a U+2019 right single quotation mark, not a plain ASCII single quote? (That was corrected by a bot https://stackoverflow.com/posts/64104679/revisions)
Does the U+2019 right single quotation mark not work in C code?
In emacs:
How can I t...
Do people use Visual Studio Code or other modern editors/IDEs for C instead?
(I temporarily reread part of CSAPP, The book is based on C, so I revisit C temporarily)
(I reread CSAPP to revise my knowledge of levels of abstractions in a computer system, and read some part which I guess is useful at software levels, such as program optimization)
The character problem in C mode is potentially bad, I think.
(IMHO, CSAPP's way of organizing topics is very confusing, which caused difficulty to my self learning at first time a few years ago. Nissan's The Elements of Computer Systems seems better although doesn't have some details. Tanenbaum's Computer System Organization may also give a better picture)
@jesse_b (moving here so as not to clutter the comments)
@terdon: Apparently it wasn't because OPs issue went away when they removed root. Also I don't necessarily recommend it but if /bin/sh is bash it will most likely accept bashisms. Additionally this doesn't provide an alternative. — jesse_b11 mins ago
Fair point about not providing an alternative. But the OP's problem didn't go away, they've already deleted their answer.
And yes, bash called as sh should still understand [[ but I don't know if RH uses bash for sh. If it's dash or something else, the [[ will fail so it is generally a good idea not to use them .
Do people programming in higher level languages than C consider necessary to optimize their programs? Are the strategies the same across different languages?
In Computer Systems: a Programmer's Perspective:
We have described a number of basic strategies for optimizing program performance:
Basic coding principles. Avoid optimization blockers so that a compiler can generate efficient code.
Eliminate excessive function
calls. Move computations out of l...
@Tim higher-level languages don’t mean you can stop paying attention to optimisation; some optimisation techniques are universal (e.g. using better algorithms, more appropriate data structures), others are language-specific
Ch 5 and 6 of the book are about optimization at assembly level and at microarchitecture level
Ch5 is mentioned in the post. Ch6 has a section about using cache to improve program's efficiency
programmers can make changes manually to C programs, and/or rely on compilers, so that the translated assembly programs or their execution at microarchitecture level will be more efficient
Design with choosing algorithms and data structures is at a higher level than these. A whole different level.
It’s badly structured, it recommends things which were long-obsolete the last time it was updated, and it causes you to ask loads of questions which suggests that it’s not that good at explaining things.
For general development, I like The Pragmatic Programmer and Code Complete.
@Tim considering development in a layered approach is too limiting; if you hit performance problems, there are “low-level” techniques that are useful, but you need to take a holistic approach.
Like I’ve said before too, when it comes to learning to program, nothing beats practice, and reading other people’s code.
So Code Reading and Code Quality are also high up on my recommended lists, along with Beautiful Code and Beautiful Architecture.
But then, spend time reviewing code, following a project’s development (without butting in), and writing your own code.
@jesse_b which one’s that, if you don’t mind saying?
@Tim In my experience, the choice of algorithms and data structures are as important as anything, and more important than most. It's perfectly possible to write C or C++ or Fortran code that is slow as molasses, and conversely it's also possible to write fast Python code.
The bottom line - you need to know what you are doing. It also helps to understand the underying implementations. And of course, you have to be willing to experiment.
Mercurial is actually a good example of a Python code base which is still (mostly) fast.
Though some of the more time-critical stuff is in C. Though now being rewritten in Rust, for some reason. Apparently C isn't good enough.
And if you look at Mercurial's development, there is tons of micro-optimization, as befits an interactive tool with many code paths, like version control.
In my experience, fast data structures mostly reduce to using a simple contiguous slab of memory. Like a C array, and adapting one's algorithms to that.
@FaheemMitha Yes, you are correct. I was not saying which one is more important than which. I noticed something that was not algorithms and data structures and that was not heard of as often
Anything more complex tends to slow things down noticeably, even in C. Of course, that assumes that one is writing performance sensitive code, which isn't always the case.
Actually, C and C++ (and maybe Fortan), tend to use rather less memory than most other things, which is probably at least as important.
At least the standard implementations of things like strings.
Basically because a Python string is a much more complicated and larger object than a C string.