conventions

Handling Data Hierarchies in code

Hi there So, say I have a string to parse with a given format that maps to a tree like data structure. The string is kinda similar to a folder path, and the structure is similar to a file structure, except its got some rules so for something@cat1@otherSomething you would get /something/cat1/otherSomething for something@cat2...

Is there a convention for organizing the include/exports in a large C++ project ?

Hello, In a large C++ solution, is there a best/standard way to separate the include files necessary to build an intermediary DLL and the include files which will be used by the DLL clients ? We have grouped all the include files in a folder called Interface (for DLL interface), but there the customers have to either include the Inter...

linux script, standard directory locations.

I am trying to write a bash script to do a task, I have done pretty well so far, and have it working to an extent, but I want to set it up so it's distributable to other people, and will be opening it up as open source, so I want to start doing things the "conventional" way. Unfortunately I'm not all that sure what the conventional way i...

Url convention: article/1234/article-name vs articles/1234/article-name

I asking just for your opinion, of what make more sense. Currently, this is my design: www.site.com/articles <-- list www.site.com/article/1234/article-name <-- details www.site.com/article/write <-- write new article Is is make sense too you? or article's make more sense? Can you tell me what ...

Python proper use of __str__ and __repr__

Hey, My current project requires extensive use of bit fields. I found a simple, functional recipe for bit a field class but it was lacking a few features I needed, so I decided to extend it. I've just got to implementing __str__ and __repr__ and I want to make sure I'm following convention. __str__ is supposed to be informal and conci...

Is it (width, height) or (height, width)?

Is there a convention for the order of (height, width) in function arguments or when displaying dimensions? ...

Should I suppress CA2204: Literals should be spelled correctly?

I've recently upgraded my project from Visual Studio 2008 to Visual Studio 2010. By enabling Code Analysis, I'm getting a lot of warnings resulted in rule CA2204: Literals should be spelled correctly. EDIT: Let's say I have a method called GetResult(), and in it I want to throw an exception for some reason. I want the exception to say...

Python readability hints for a Java programmer

I'm a java programmer, but now entering the "realm of python" for some stuff for which Python works better. I'm quite sure a good portion of my code would look weird for a Python programmer (e.g. using parenthesis on every if). I know each language has its own conventions and set of "habits". So, from a readability standpoint what are c...

Rails modeling for a user

When building a rails app that allows a User to login and create data, is it best to setup a belongs_to :user association on every single model? For example, let's say a user can create Favorites, Colors and Tags. And let's say Favorites has_many :tags and Colors also has_many :tags. Is it still important for Tags to belong_to :user ...

Strategies for when to use properties and when to use internal variables on internal classes?

In almost all of my classes, I have a mixture of properties and internal class variables. I have always chosen one or the other by the rule "property if you need it externally, class variable if not". But there are many other issues which make me rethink this often, e.g.: at some point I want to use an internal variable from outside th...

What is your favorite convention for organizing a ASP.NET project?

Hello world. My team is starting a brand new ASP.NET solution which will probably become large. Inspired by ASP.NET MVC, we currently express all data access objects in a model project. We, however, do not have good conventions for organizing ASP.NET ascx's and aspx's. We have already reviewed DotNetNuke and want to avoid the com...

ASP.NET MVC 2: Data DataAnnotations validation be convention

I have a required attribute that used with resources: public class ArticleInput : InputBase { [Required(ErrorMessageResourceType = typeof(ArticleResources), ErrorMessageResourceName = "Body_Validation_Required")] public string Body { get; set; } } I want to specify the resources be convention, like this: public class ArticleI...

Learning ant path style

Where can I find resources to learn ant path style conventions? I've gone to the ant site itself, but couldn't find any information on path styles. ...

Check if a symlink has changed

I have a daemon that, when it's started, loads its data from a directory that happens to be a symlink. Periodically, new data is generated and the symlink updated. I want a bash script that will check if the current symlink is the same as the old one (that the daemon started with) and if not, restart the daemon. My current thought is: i...

What is the advantage of the 'src/main/java'' convention?

I've noticed that a lot of projects have the following structure: Project-A bin lib src main java RootLevelPackageClass.java I currently use the following convention (as my projects are 100% java): Project-A bin lib src RootLevelPackageClass.java I'm not currently using Maven but am wondering if this is a Maven conven...

Why do Java source files go into a directory structure?

as weSuppose that I am creating a Java project with the following classes com.bharani.ClassOne com.bharani.ClassTwo com.bharani.helper.HelperOne com.bharani.helper.support.HelperTwo with files put immediately under the folder 'src' src/ClassOne.java src/ClassTwo.java src/HelperOne.java src/HelperTwo.java and compile them using th...

Why are "Extracted Interfaces" Internal rather than Public?

Visual Studio includes a refactoring function called "Extract Interface" that generates an interface based on a class implementation. The extracted interfaces are Internal by default. Problem is, we end up changing nearly all of them to Public. Does anyone know why it's Internal by default? Better yet, is there a way to customize th...

FluentNHibernate: mapping a Version property

How do I map a Version property using conventions (e.g. IClassConvention, AutomapperConfiguration)? public abstract class Entity { ... public virtual int? Version { get; protected set; } ... } <class ...> <version name="Version" column="version" generated="never" type="Int32" unsaved-value="0" /> </class> ...

how can i configure my custom result type using convetions plugin in result.

I have created custom result class to serialize json data to xml. I want to configure this result class as a result type for some specific actions via conventions plug ins. But it is giving errors at the time of starting container. My code and error is given below. Please advice ASAP. Thank you for your valuable advice. My custom Resul...

"T* ptr" vs "T *ptr" declaration

Possible Duplicate: C++: Asterisks and Pointers First of, excuses if this is a duplicate, it was kind of hard to find any results using the search so I assume it hasn't been asked yet (which I don't believe) As it appears, there's two different pointer (and for C++: reference) declaration conventions. Some people prefer to us...