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 Derek Elkinsâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #292981 | Initial revision | — | 1 day ago |
Answer | — |
A: Best Practices for Precalculating Expensive Variables in Functions If you want a best practice, I'm pretty sure the best practice is to do the straightforward and "naive" thing. From the perspective of OOP, your complaints are misguided. The unit of coherence isn't a function but a class. What's happening in the constructor should not be "unrelated code". Also, in t... (more) |
— | 1 day ago |
Edit | Post #292941 | Initial revision | — | 8 days ago |
Answer | — |
A: Why are model_q4.onnx and model_q4f16.onnx not 4 times smaller than model.onnx? Going from fp32 to fp16 is done usually by essentially just rounding the weights. To this end, you should expect pretty close to a 2:1 reduction in size. (Of course, not everything is weights, but the weights dominate.) Going from fp32 (or fp16) to an integral type is no longer simply a matter of ... (more) |
— | 8 days ago |
Comment | Post #292701 |
Your first code example isn't really idiomatic modern JavaScript. With the `class` syntax, you can *and should* declare methods separately from the constructor rather than mutating `this` to add fields that happen to be functions. So you should have:
```javascript
export class MyProject {
cons... (more) |
— | about 2 months ago |
Comment | Post #292701 |
It's pretty unclear what you *want* the result to be. What I think is most likely is either 1) you want to explore the old-style way of making "classes" in JavaScript, or 2) you want to explore how OO can be mimicked with higher-order functions without using JavaScript's built-in OO features. Only th... (more) |
— | about 2 months ago |
Edit | Post #292685 | Initial revision | — | about 2 months ago |
Answer | — |
A: Differences between Haskell tools Stack and Cabal? The short, broad strokes answer is that (modern) `cabal-install` uses a nix-style approach where there's a shared global cache, but you can have multiple versions of a package installed or even the same version of a package installed with different versions of its dependencies. `stack` takes an appro... (more) |
— | about 2 months ago |
Edit | Post #292663 |
Post edited: Mention nohup |
— | about 2 months ago |
Edit | Post #292663 | Initial revision | — | about 2 months ago |
Answer | — |
A: How to detach my terminal window from a program ran from it? This is usually handled by the shell, so it depends on the shell. That said, the relevant command is named the same across many different shells. Namely, the `disown`) command. You can probably enter `help disown` for details relevant for your shell. Most likely it's `bash`, where the details are als... (more) |
— | about 2 months ago |
Comment | Post #292311 |
I don't understand. The page you link to itself links to a definition on Wikipedia which gives the historical context. It certainly makes it clear that the answer to "is this something pytest invented" is "no". (more) |
— | 3 months ago |
Comment | Post #292291 |
This is more compelling, but it is also what `git merge/pull --verify-signatures` is for. If you expect all commits to be signed you can set the config `merge.verifySignatures` to true to have this happen automatically. In the case where you expect a mix of signed and unsigned commits, then you can r... (more) |
— | 3 months ago |
Comment | Post #292291 |
Sure. If you have some reason to think the next merge/rebase may cause issues, getting the hash ahead of time may be a bit more convenient. That said, a `git fetch` won't change the `git log` output, so you could just as well `git log` before the `git pull`. If you meant to actually look at the log o... (more) |
— | 3 months ago |
Edit | Post #292291 | Initial revision | — | 3 months ago |
Answer | — |
A: Is `git pull` dangerous? While any piece of software receiving input from an untrusted source is additional attack surface, generally speaking `git pull` is not a security threat. Three things happen when you `git pull`: a `git fetch`, a `git merge` or `git rebase` (depending on config), and any hooks you've defined may f... (more) |
— | 3 months ago |
Comment | Post #292287 |
This first piece of advice doesn't make sense given the "danger". The correct advice would be to set the `pull.ff` and/or `merge.ff` config to `only` rather than use `--ff-only` all the time. (more) |
— | 3 months ago |
Edit | Post #292230 | Initial revision | — | 3 months ago |
Answer | — |
A: Why does a lack of object encapsulation constitute a security breach? Let's pretend Java was a capability-safe language. Now let's consider the IDE scenario and imagine that we want to support Copilot-like AI plugins that use a 3rd-party service. To access these services, the plugins will need an API key. This is easy to accomplish. The plugin interface simply al... (more) |
— | 3 months ago |
Comment | Post #292142 |
I did say they were related. The difference is whether you use what GitHub has or you just give GitHub the output of a tool of your choice. As far as I know, GitHub Pages does not support server-side includes. If it does, then feel free to add an answer explaining how to use it with GitHub Pages.
... (more) |
— | 3 months ago |
Comment | Post #292190 |
This answer doesn't seem to add anything beyond my answer, so I'm curious what value you saw in posting it. (more) |
— | 3 months ago |
Comment | Post #292143 |
I wouldn't say that "a lot of boilerplate" is a consequence of a declarative definition. It's a consequence of configuration languages often being extremely weak with little to no abstraction facilities. Often this is resolved by using full-blown programming languages, but those have many downsides w... (more) |
— | 4 months ago |
Edit | Post #292153 |
Post edited: typos |
— | 4 months ago |
Edit | Post #292153 | Initial revision | — | 4 months ago |
Answer | — |
A: How can I create and modify a struct over iterations of a loop? tl;dr: Use `currentsection.asmut().unwrap()` instead of just `currentsection.unwrap()`. Ownership is a core language-supported concept in Rust and this means what might be a single method in most languages can multiply into several that differ in their behavior with respect to ownership.You can se... (more) |
— | 4 months ago |
Comment | Post #292149 |
This code doesn't do anything with the `current_section`s, i.e. it doesn't appear to store them in a `sections` array like the pseudo-code. Is that intentional? (more) |
— | 4 months ago |
Edit | Post #292142 | Initial revision | — | 4 months ago |
Answer | — |
A: Reusing HTML without rewriting it Use a static site generator. There are other possibilities, but they seem more complicated or worse for your use case. A static site generator takes in source data in some combination of markup formats (commonly including raw HTML and Markdown) and generates complete HTML pages from that. A key fe... (more) |
— | 4 months ago |
Edit | Post #291980 | Initial revision | — | 4 months ago |
Answer | — |
A: Can you have syntax highlighting for streaming text in Python? The answer is "it depends". It depends on the language, how much buffering you're willing to allow, how much you're willing to accept some approximate/incorrect syntax highlighting, and whether you'd accept control codes that correct the syntax highlighting after the fact. If your bar for syntax h... (more) |
— | 4 months ago |
Comment | Post #291931 |
You should use the [@abstractmethod](https://docs.python.org/3/library/abc.html) decorator for this which will prevent a class that doesn't implement all the methods from being instantiated at all rather than finding out a method wasn't implemented right as you go to use it. Suffice it to say that th... (more) |
— | 4 months ago |
Edit | Post #291931 | Initial revision | — | 4 months ago |
Answer | — |
A: Use cases for raising a 'NotImplementedError' in Python `NotImplementedError` should generally be viewed as indicating some design problem. You should not be reaching for it as a matter of course. Here are some potential times you might feel a desire to reach for `NotImplementedError`. 1. During development, you want to test some code that is partia... (more) |
— | 4 months ago |
Comment | Post #291928 |
While I think something like this is relatively common, it's hardly a "graceful" solution. A better solution would be to adhere more closely to the Single Responsibility Principle and not combine reading and writing into a single interface. Instead, your abstract base class could be split into an `Ac... (more) |
— | 4 months ago |
Comment | Post #291915 |
It doesn't seem relevant. The changes I made were for your original version of the code which didn't do what you intended. As mentioned in my answer and my previous comment, it is simply not possible to implement the function you want (without `unsafe`) with the type you provided. The borrow rules di... (more) |
— | 5 months ago |
Comment | Post #291915 |
Just to be clear, I did actually take the code from your (original) post and got it to successfully compile with the changes I mentioned.
As for your updated version, it falls under what I mentioned at the end referencing `Rc`. You will not be able to make a version of `components_mut` that retur... (more) |
— | 5 months ago |
Edit | Post #291915 |
Post edited: Add Rc comments |
— | 5 months ago |
Edit | Post #291915 | Initial revision | — | 5 months ago |
Answer | — |
A: Recursive traversal of composite tree of mutable "trait objects"? A `root.components` field need not exist, so I'm not sure what you're hoping for. Also, I don't know if it's an issue with your description or your code, but the code will only return mutable references to "leaf" `Component`s while your description talks about "all descendants". It's not clear if "al... (more) |
— | 5 months ago |
Comment | Post #291820 |
This seems to be a question about how to use a program, not how to write programs or use tools involved in developing software. Maybe the Linux site would be a better fit? (more) |
— | 5 months ago |
Edit | Post #291636 | Initial revision | — | 6 months ago |
Answer | — |
A: What does "parameterised type in the positive / negative position" mean in the context of invariant functors? "Invariant" isn't really the right word to search, though that's clearly not obvious. The idea is that we have covariant functors where if we have `a -> b` we can make `f a -> f b`, and contravariant functors where if we have `a -> b` we can make `f b -> f a`. You can see that the "functor" `f a = a ... (more) |
— | 6 months ago |
Edit | Post #291628 |
Post edited: |
— | 6 months ago |
Edit | Post #291628 | Initial revision | — | 6 months ago |
Answer | — |
A: Where does the name of the `pure` function in the `Applicative` type class come from? A direct answer to your question of where the name comes from is the paper that introduced Applicative functors, Applicative programming with effects (PDF). Quoting from there: > The idea is that `pure` embeds pure computations into the pure fragment of an effectful world[.] I would say this is... (more) |
— | 6 months ago |
Edit | Post #291491 | Initial revision | — | 6 months ago |
Answer | — |
A: In javascript is there really a good reason to never check for boolean true || false such as if(var){}else{}? r's answer is good, and I absolutely agree that the condition provided in the question is ridiculous and I've never seen anyone suggest it as a generic replacement for `if(var)`. But I think the actual advice that is being communicated (perhaps poorly) which is not explicitly called out in r's answer... (more) |
— | 6 months ago |
Comment | Post #291132 |
I think it's quite safe to neglect. Virtually no project is going to have a significant fraction of its contributions coming from non-users who are only motivated by a desire to contribute to FOSS. Such people will have plenty of FOSS projects that they use that they could contribute to and/or are mo... (more) |
— | 8 months ago |
Comment | Post #291132 |
There are multiple unstated premises in this question. Presumably these people are at least users of the software. Also, they'd need to have something they want changed. Further, those changes would need to be changes they want to contribute. For example, changes that tailor the software to my enviro... (more) |
— | 8 months ago |
Edit | Post #290661 | Initial revision | — | 10 months ago |