Hi,
As I see there are lots of bright people here, I'll ask away. I don't know if this question has been asked before - most probably it has been. Duplicate this if so. For anyone who does not know what "the zone" for programmers is, it is when you are at your most productive and it feels like you are not coding but the code is writin...
When an IEnumerable needs both to be sorted and for elements to be removed, are there advantages/drawback of performing the stages in a particular order? My performance tests appear to indicate that it's irrelevant.
A simplified (and somewhat contrived) example of what I mean is shown below:
public IEnumerable<DataItem> GetDataItems(in...
I am using Source->Implement Method sometimes, but I noticed that the generated code does not follow the defined code style from the preferences (the style is applied when I use Source->Format correctly) - Is there some setting I missed or is that a bug?
Using Eclipse Version 3.5.2 and CDT 6.0.2 on Ubuntu Linux 10.04 LTS.
Example: we d...
I am in the process of learning C# (using Visual Studio 2010) to design some stand-alone applications for desktop users. Almost all of my programming experience is with Java for web development. I have read a few books now on C# and am comfortable with the programming but would like to see an example of building an actual program using...
Possible Duplicate:
When do you use the this keyword?
In OOP sometimes we can write this.PropertyName = VALUE and sometimes we can skip this. and just write PropertyName = VALUE.
So my question is, should we try always to use this.?
Does using / writing this have any effect on application performance or does it just make the ...
Hello,
I am looking for a list of code formatting and prettifying software; I have only found a few topics that all are language specific.
This is not about syntax highlighting!
If possible, I prefer lightweight, command-line, multiplatform, portable tools.
Nevertheless, if there is no interesting alternative, I also like to know what...
I'm a beginner to Ruby/Rails, and just generated my first HTML programmatically - kind of exciting-- but when I viewed "page source" from the browser, my HTML had all these additional gaps and messed up the logical indentation:
This code in a View:
<% @states_array.each do |state| %>
<ul><%= state %></ul>
<% end %>
and this code in...
Here is what I just wrote:
public void mutate(){
ListIterator<Double> git = genome.listIterator();
Iterator<Double> mit = mutationStrategies.iterator();
while (git.hasNext() && mit.hasNext()){
git.set(alleleUpdate(git.next(), mit.next()));
}
}
Is this the most efficient and clearest way of doing that? All tha...
I'm looking for a very flexible C code formatting solution.
Here's the context: I need to convert some external C code to my organization's "coding rules". For example, these rules demand that I put the type of each variable in its name (int_foo, pfloat_bar, etc.). Most of these rules are completely absurd but I don't have a choice.
I ...
Are all PEP 8 rules still valid?
Are there any which are obsolete?
Isn't there a more explanatory cheat sheet that this one.
...
The following is pseudocode:
myGoto:
try
{
// do some db updating
myDB.doOptimisticConcurrency();
} catch (MyConcExeption ex) {
if (tried < fiveTimes) {
myDB.Refresh();
tried++;
goto myGoto;
}
}
I have several try-catch blocks in one method, and I don't want to reinvoke my method from the beginning ...
I have been working on this plugin system. I thought I passed design and started implementing. Now I wonder if I should revisit my design. my problem is the following:
Currently in my design I have:
An interface class FileNameLoader for loading the names of all the shared libraries my application needs to load. i.e. Load all files in ...
I've got 2 applications (lets call them AppA and AppB) communicating with each other.
AppA is sending objects to AppB.
There could be different objects and AppB does not support every object.
An object could be a Model (think of a game, where models are vehicles, houses, persons etc).
There could be different AppBs. Each supporting anoth...
I have placed comments with my questions inline. The code supports making rest calls.
// (1) Is appending Base to the name of base classes useful?
public abstract class RestCallBase : IRestCall
{
// (2) Is there a good way to decide on the ordering/grouping of members?
// I have seen code that uses #region f...
I know this is going to not be the same across all languages, but it's something I've wondered for awhile.
Since the title isn't very clear, is there a technical difference between
if (...) {
// ...
} else if (...) {
// ...
}
and
if (...) {
...
} else {
if (...) {
...
}
}
I know from a practical perspecti...
My approach:
<?
switch($id)
{
case 1:
?>
a lots of html stuff goes here...
<?
break;
case 2:
?>
a lots of html stuff goes here2...
<?
break;
}
?>
Is there any way to do this thing prettier? I mean more readable or something? I would really appreaciate that. (haven't learned smarty ...
I've seen both of the following two styles of declaring opaque types in C APIs. Is there any clear advantage to using one style over the other?
Option 1
// foo.h
typedef struct foo * fooRef;
void doStuff(fooRef f);
// foo.c
struct foo {
int x;
int y;
};
Option 2
// foo.h
typedef struct _foo foo;
void doStuff(foo *f);
// fo...
HI all
I have problem when trying to convert list collection string to one line string.
But for each item i must edit with specific format.
Example
List<string> items = new List<string>();
string result = string.Empty;
items.Add("First");
items.Add("Second");
items.Add("Last");
result = string.Join(",", items.ToArray());
Console.Writ...
I have the following problem.
I got a class PluginLoader which oversees loading of plugins. It divides sub-stages of work to other classes like Plugin. Plugin calls functions of PluginLoader in its processing. Let's call that function AddData. Here, PluginLoader has to check if the data it receives is duplicate. For that, it uses a Conf...
I got a question for you guys on C# code writing:
I had a long debate with collegue of mine:
He says that by declaring and initilizing all variables in the beginning of the function make code more readable and fast.
Please give me at least one sane reason that it could be right.
1. It's not readable as if you have a long function, yo...