Example: It's really annoying to type a list of strings in python:
["January", "February", "March", "April", ...]
I often do something like this to save me having to type quotation marks all over the place:
"January February March April May June July August ...".split()
Those took the same amount of time, and I got 2x the # of mont...
Hi all
We have a defined a set of rules in Eclipse for code formatting and clean up.
is there a way to run the code clean up using ant task ?
I know that there are tools like checkstyle but these tool have thier own configurations and rules, and I don't want to maintain 2 sets of rules.
I'm looking for an ant task that will use the s...
On a control like the GridView, you can specify the HeaderStyle attributes as attributes of the GridView element (e.g., HeaderStyle-Wrap="false"), or as an attribute of the HeaderStyle child element. Is one way better than the other? Or, is it just a readability preference?
<asp:GridView ID="myGrid" runat="server" HeaderStyle-Wrap="fals...
Possible Duplicates:
Is excessive use of this in C++ a code smell
Given that most organizations have a coding standard for member variables like "m_memberVar" or "memberVar_", are there good reasons to use "this->memberVal" format instead?
Is there any reason not to?
...
I would like to know if it is acceptable/preferred to use self::method() and parent::method() when working in php classes.
You can use $this->method() but $this-> can also refer to a class variable, a parent class variable, or a method from the parent class. There is no ambiguity in self::
Is self:: depreciated and/or are there any ca...
An interesting discussion arose today around the concept of having one method with flags versus two methods for each state of the flag. Which makes more sense and why?
void Submit(object data, bool isDraft);
or
void Submit(object data);
void SubmitAsDraft(object data);
I am tending toward the later, where each operation explicitly...
I'm working on a codebase that is known to only run on windows and be compiled under Visual Studio (it integrates tightly with excel so it's not going anywhere). I'm wondering if I should go with the traditional include guards or use #pragma once for our code. I would think letting the compiler deal with #pragma once will yield faster co...
So, I have a macro.
// swap_specialize.hpp
#include <algorithm>
#ifndef STD_SWAP_SPECIALIZE
#define STD_SWAP_SPECIALIZE( CLASSNAME ) \
namespace std { \
template<> inline \
void swap( CLASSNAME & lhs, CLASSNAME & rhs ) \
{ lhs.swap(rhs); } }
#endif
So then I have a class
// c.hpp
#include...
When declaring an associative array, how do you handle the indentation of the elements of the array? I've seen a number of different styles (PHP syntax, since that's what I've been in lately). This is a pretty picky and trivial thing, so move along if you're interested in more serious pursuits.
1) Indent elements one more level:
$arr...
Possible Duplicates:
== Operator and operands
How to check for equals? (0 == i) or (i == 0)
Why does one often see null != variable instead of variable != null in C#?
I saw many people suggesting to put constants on the left side in all comparisons to avoid the problem of missing an equal sign. Example: use "if (0 == value)"...
/*/ comment here
do some thing.
/*/
do some thing.
//*/
Why people write code like that? Is this a good practice?
...
Code Complete says it is good practice to always use block identifiers, both for clarity and as a defensive measure.
Since reading that book, I've been doing that religiously. Sometimes it seems excessive though, as in the case below.
Is Steve McConnell right to insist on always using block identifiers? Which of these would you use?
...
I have to make a decision regarding generalization vs polymorphism.
Well the scenario is standard: I want to make my monolithic interdependent
code to be more modular, clean and extensible.
It is still in a stage where the change of design principle is doable,
and, as I look at it, highly desirable.
Will I introduce purely virtual base...
If you don't provide an ID for your declared controls in ASPX files, I know that VS will automatically generate one for you. Should I always give the controls a descriptive ID even when I won't be accessing them from the code-behind?
...
I have some data being loaded from a server, but there's no guarantee that I'll have it all when the UI starts to display it to the user. Every frame there's a tick function. When new data is received a flag is set so I know that it's time to load it into my data structure. Which of the following ways is a more sane way to decide when to...
I'm tempted to add a suffix like "Ex" to differentiate methods (with similar signatures) that throw Exceptions from those that don't.
Is there such a convention?
...
Hello,
I'm learning jQuery now, and was reading an article of Jeffrey Way, "You Still Can’t Create a jQuery Plugin?"
Almost everything is clear, but there are some points that I still cannot understand.
Problems begin on the 'Step 3: Building the Plugin', heading title 'For Each...', and next 'Error Checking'.
this.each(function() ...
I like to organize my Java files a little and would like to know if there is a standard way of doing this. For example:
public class Example
{
private int exampleInt;
private String exampleString;
/*------------------------------------------------------------*/
/* I N N E R C L A S S E S ...
I am wondering why Java, with its many safety features and constraints, allows developers to start a class name with a lowercase letter even though it would be an extremely stupid idea to do so.
Or have I overlooked a case where this could be useful? Or is it simply a case of not bossing the programmer around?
...
I worked on a project which involved complex boolean logic. This complexity made the code very efficient, but unfortunately hard to read.
So we laid the logic out as below, which made it easier to see the groups within the compound statements, and also made it possible to add comments to parts of the logic.
(This code isn't real code f...