Can maven projects have multiple parents?

Even though maven projects have single parent, they can import any number of other pom’s like this: <dependencyManagement> <dependencies> <dependency> <groupId>org.example</groupId> <artifactId>my-shared-dependencies</artifactId> <version>0.0.1-SNAPSHOT</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> This has two important differences compared to a parent: Plugins defined in the imported pom won’t be imported Dependencies defined in the imported pom won’t be added … Read more

Should ‘using’ directives be inside or outside the namespace in C#?

There is actually a (subtle) difference between the two. Imagine you have the following code in File1.cs: // File1.cs using System; namespace Outer.Inner { class Foo { static void Bar() { double d = Math.PI; } } } Now imagine that someone adds another file (File2.cs) to the project that looks like this: // File2.cs … Read more

C++ Header order [closed]

In a header file you have to include ALL the headers to make it compilable. And don’t forget to use forward declarations instead of some headers. In a source file: corresponded header file necessary project headers 3rd party libraries headers standard libraries headers system headers In that order you will not miss any of your … Read more

Where do the Python unit tests go? [closed]

For a file module.py, the unit test should normally be called test_module.py, following Pythonic naming conventions. There are several commonly accepted places to put test_module.py: In the same directory as module.py. In ../tests/test_module.py (at the same level as the code directory). In tests/test_module.py (one level under the code directory). I prefer #1 for its simplicity … Read more

Including one C source file in another?

Used properly, this can be a useful technique. Say you have a complex, performance critical subsystem with a fairly small public interface and a lot of non-reusable implementation code. The code runs to several thousand lines, a hundred or so private functions and quite a bit of private data. If you work with non-trivial embedded … Read more

Should ‘using’ directives be inside or outside the namespace?

There is actually a (subtle) difference between the two. Imagine you have the following code in File1.cs: // File1.cs using System; namespace Outer.Inner { class Foo { static void Bar() { double d = Math.PI; } } } Now imagine that someone adds another file (File2.cs) to the project that looks like this: // File2.cs … Read more

tech