Folder naming convention for python projects

There are three conventions, which you might find confusing. The standard PEP8 defines a standard for how to name packages and modules: Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged. … Read more

What is the advantage of the ‘src/main/java” convention?

Main benefit is in having the test directory as subdirectory of src with the same directory structure as the one in main: Project-A bin lib src main java RootLevelPackageClass.java resources test java TestRootLevelPackageClass.java resources All package private methods of RootLevelPackageClass will be visible, i.e. testable from TestRootLevelPackageClass. Since the testing code is also source its … Read more

How to build/concatenate strings in JavaScript?

With ES6, you can use Template strings: var username=”craig”; console.log(`hello ${username}`); ES5 and below: use the + operator var username=”craig”; var joined = ‘hello ‘ + username; String’s concat(..) var username=”craig”; var joined = ‘hello ‘.concat(username); Alternatively, use Array methods: join(..): var username=”craig”; var joined = [‘hello’, username].join(‘ ‘); Or even fancier, reduce(..) combined with … Read more

Do C++ private functions really need to be in the header file?

Private helper functions can be hidden from the public header file by moving them to an inner class. This works because the inner class is considered part of the class and can access the surrounding class’s private members. Unlike the PIMPL idiom, this does not have any dynamic allocation or indirection penalty. Compile times should … Read more

Should programmers use boolean variables to “document” their code?

Splitting an expression that’s too nested and complicated into simpler sub-expressions assigned to local variables, then put together again, is quite a common and popular technique — quite independently of whether the sub-expressions and/or the overall expression are boolean or of just about any other type. With well-chosen names, a tasteful decomposition of this kind … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)