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.
Posts by Moshi
It's not a matter of order; Python simply does not directly allow else clauses as part of list comprehensions (docs). When we use [num if num != 11 else 22 for num in hand] We are actually usin...
Here I used asterisk after Node. Actually, why asterisk used for? What if I don't put any asterisk after Node (Both Node are structure). It's a pointer. A pointer, like its name implies, poin...
Consider the following method as an example: List<int> Foo() { // ... } Are there any disadvantages of returning an interface instead of a concrete implementation in C#? IList<i...
What's going on is that the compiler is deciding on what function to call at compile time rather than runtime. Since the type of vh is Vehicle *, it is essentially creating this call: vh->Vehic...
You cannot set text-align on a column element (Well, you can, but it won't have any effect) There are only a couple of properties that have an effect, namely border, background, width, and visibi...
You can use the pathlib standard module with __file__ to make things simple. from pathlib import Path scriptFolder = Path(__file__).parent with open(scriptFolder / 'data.txt') as file: dat...
Grouping related items into modules is of course generally good practice, but it serves a practical purpose as well. The important part here is the #[cfg(test)] annotation. The #[cfg(test)] anno...
RFC 3986 defines a suffix reference as follows (emphasis my own): 4.5. Suffix Reference The URI syntax is designed for unambiguous reference to resources and extensibility via the URI scheme. ...
Statements and expressions are two syntactic categories that are used by many programming languages. Since they are syntactic, they depend on the programming language's syntax. In a real sense, a s...
tl;dr, the lifetime of "second" is static The heart of your confusion is this: Since we are taking a long-lived reference r to a string slice inner which is destroyed at the end of its scope, ...
Method 1: <span> (or other HTML tag) It appears that Markdown isn't detected within HTML tags, so you can wrap the URL-like in a span or other tag and it won't turn into a link. <span>...
I'm rather new to using git, so I'm not sure about the best practices regarding it. I have a feature branch branched off, and periodically when the feature needs to be updated I will add some commi...
I've heard that in modern C++, smart pointers are preferred to raw pointers for ownership (the so-called RAII principle, as I understand it). This makes sense, and since then I've always used them...
Assignment = = is the assignment operator. There's nothing much to say here. Abstract Equality == == is abstract equality - it will attempt to perform a type conversion before evaluating equalit...
I was playing around with mapped tuples and came across an interesting case where TypeScript cannot infer the types used: interface Foo<A, B> { (a: A, b: B): any } function test<...
I was inspired by the contests on Outdoors and Writing, and thought that having some challenges over here would be fun as well. What do you all think about adding a new category where people can po...
From the Git docs "reset" copies the old head to .git/ORIG_HEAD To restore that commit, you can run $ git reset ORIG_HEAD If you want to restore more than one reset, then you'll have to l...
From the docs Example to exclude everything except a specific directory foo/bar (note the /* - without the slash, the wildcard would also exclude everything within foo/bar): $ cat .gitignore...
Why do we have the "Participate Everywhere" ability when we haven't yet done anything? Bootstrapping. Our communities are still small, so after we rolled out the abilities system we decided to p...
Each header is checked independently Having multiple Content Security Policy headers can only make it more restrictive I assume that each Content-Security-Policy: line you have is a separate CSP ...
The problem is that you are using row twice with different types. for row in self.diagram: # row is str here for row in self.seed_diagram: # row is list[str] here Renaming one or the other m...
Say we have an abstract class Foo declared as so: class Foo { public: virtual void test() = 0; }; Let's say that we make a derived concrete class FooDerived, and decide to mark it's ve...
This question probably stems from misunderstanding what case sensitivity is. Being case insensitive does not mean only allowing one case - in fact, it implies the opposite! If one case was treated ...
Let's say I have a variant that can hold a bunch of different types of values (say I got them from parsing a JSON or similar). using Value = std::variant<std::monostate, int, double, std::strin...
I've come to realize that tags began changing pretty rapidly recently. In the past 3 days alone, these happened: [urlrewrite] was changed to a more generic [url-rewriting] tag and the tag wiki for...