naming-conventions

What is the preferred naming conventions du jour for c++?

南楼画角 提交于 2019-12-06 03:55:09
I am quite confused by looking at the boost library, and stl, and then looking at people's examples. It seems that capitalized type names are interspersed with all lowercase, separated by underscores. What exactly is the way things should be done these days? I know the .NET world has their own set of conventions, but it appears to be completely different than the C++ sphere. What a can of worms you've opened. The C++ standard library uses underscore_notation for everything, because that's what the C standard library uses. So if you want your code to look consistent across the board (and

Why does CakePHP use different plural/singular naming conventions?

ぐ巨炮叔叔 提交于 2019-12-06 03:49:36
问题 Can somebody perhaps explain here why on earth CakePHP has a convention of using plural names for db tables and controllers and singular for models? Why not always use singular terms, or always plural? For me it seems confusing to always have to think "now do I use plural or singular here?" (Or is there an easy way to remember??) And then you have the join-tables that use a combination of both! I assume there's a good reason somewhere, but just have not come across it. (I really hope it's not

Using UNNEST with a JOIN

陌路散爱 提交于 2019-12-06 03:15:49
问题 I want to be able to use unnest() function in PostgreSQL in a complicated SQL query that has many JOIN s. Here's the example query: SELECT 9 as keyword_id, COUNT(DISTINCT mentions.id) as total, tags.parent_id as tag_id FROM mentions INNER JOIN taggings ON taggings.mention_id = mentions.id INNER JOIN tags ON tags.id = taggings.tag_id WHERE mentions.taglist && ARRAY[9] AND mentions.search_id = 3 GROUP BY tags.parent_id I want to eliminate the taggings table here, because my mentions table has

Conflicts between member names and constructor argument names [duplicate]

拥有回忆 提交于 2019-12-06 01:59:44
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Members vs method arguments access in C++ I have a class that has some members, like x , y , width and height . In its constructor, I wouldn't do this: A::A(int x, int y, int width, int height) { x = x; y = y; width = width; height = height; } This doesn't really make sense and when compiled with g++ x , y , width , and height become weird values (e.g. -1405737648 ). What is the optimal way of solving these

Python naming conventions for attributes and methods meant to be overwritten

柔情痞子 提交于 2019-12-06 00:06:15
问题 I have some object oriented code in Python, where some classes are meant to be extended to provide the missing custom bits of code (a la Template Method pattern, but also with variables), that will only be used by the super class, not by the client code using them. Are there any style conventions for such abstract (or dull, because their implementation in the super class would be either pass or raise a NonImplemented exception) methods and attributes? I've been browsing the PEP-0008 and it

What are the best practices for naming ant targets?

╄→гoц情女王★ 提交于 2019-12-05 23:57:53
问题 What are the best practices for naming ant targets? For example, what would you expect the target "test" to run? All unit tests? All functional tests? Both? What are the standard names used for running different types of tests (unit/functional/all)? Are there standards for target names to deploy software in J2SE? in J2EE? My project uses ant for a java project with junit, Swing applications, and J2EE applications. 回答1: See the "Naming Conventions" section on this page : The Elements of Ant

Visual Studio CommandBar “Names”

て烟熏妆下的殇ゞ 提交于 2019-12-05 23:29:27
问题 In Visual Studio 2010, the only option you can create is a commandbar under "Tools" on the "MenuBar". In some cases, I would want to know how to place the command bar on the standard bar, or be found when I right-click a project file. Example: Microsoft.VisualStudio.CommandBars.CommandBar menuBarCommandBar = ((Microsoft.VisualStudio.CommandBars.CommandBars)_applicationObject. CommandBars)["MenuBar"]; By default it shows "MenuBar" and I am certain there is others, such as "Standard". However I

Get property-name of generic abstract class

房东的猫 提交于 2019-12-05 22:16:45
Considering the following implementation of a generic, abstract class: public abstract class BaseRequest<TGeneric> : BaseResponse where TRequest : IRequestFromResponse { public TGeneric Request { get; set; } } Is there any chance to get the name of the property Request without having an instance inherited from it? I need Request as string "Request" to avoid using hardcoded strings. Any ideas how to make this through reflection? Douglas Starting from C# 6, you should be able to use the nameof operator: string propertyName = nameof(BaseRequest<ISomeInterface>.Request); The generic type parameter

Names of HTML form naming conventions

徘徊边缘 提交于 2019-12-05 21:35:22
问题 In Rails and CakePHP1.2, forms tend to include input elements with names like the following: <input name="comment[author]" /> Is there a formal name for the notation used in the "name" attribute? Likewise, in CakePHP1.1 I do believe that the same would have looked like this: <input name="comment/author" /> Again, is there a formal name for the notation used in the "name" attribute? 回答1: in cake php, the naming scheme is in multidimensional array access format, though i'm not really sure what

Naming convention for IDs in Android

三世轮回 提交于 2019-12-05 19:20:24
Android 2.3.3. I have a question regarding naming the IDs in Android. Let's say I have two buttons in Activity1 (save and cancel). I name them (IDs) as btnSave and btnCancel. Now I have Activity2, where in I have save and cancel buttons as well. Both does the same functionality. What will happen if I give the IDs as btnSave and btnCancel. Will i face a problem while compiling? When I press, R.id. and ctrl+space, will I get two btnSave and btnCancel(s) to choose from? And most importantly, Why should I name them differently, if I should? If its only matter to easy way for writing in code, then