Refactoring, braces, indentation, Hungarian notation, and other stylistic issues relating to code.

learn more… | top users | synonyms (8)

4
votes
0answers
118 views

How do I specify the step definition prototype name in Intellij Idea?

I write my cucumber scenario to include the following step: And the frabjous bandersnatch whiffled "Callooh" Type alt-enter, choose Create Step Definition, and it produces: @And("^the frabjous ...
4
votes
0answers
375 views

Global state in Python module

I am writing a Python wrapper for a C library using the cffi. The C library has to be initialized and shut down. Also, the cffi needs some place to save the state returned from ffi.dlopen(). I can ...
3
votes
0answers
266 views

How do I define an Eclipse “Code Style” for a C++ Macro?

When I auto-format my C++ code containing a macro, Eclipse adds a line break and indentation before the ";". For example: // Tests TEST(Test1, Test1) { EXPECT_EQ (2.0*2.0, 4.0) ; } How ...
3
votes
0answers
840 views

Issue with inherited style in Android

I'm using a custom dialog style to remove the white border. To achieve this, I created a custom style inheriting from Theme.Dialog, and set it in the dialog constructor. When not setting any style (I ...
2
votes
0answers
38 views

How to organize imports with blanks between packages?

I manage to organize my imports like this import javax.servlet.http.HttpServletResponse; import java.io.File; import org.apache.commons.io.IOUtils; import org.apache.commons.logging.Log; import ...
2
votes
0answers
35 views

How to stop eclipse to add space between class and … like template<class … Args>?

I'm new to eclipse CDT, and I like it. However, there is an annoying thing: I want my code to look like: template<class... Args> void f(const Args&... args) {} rather than look like: ...
2
votes
0answers
38 views

NameSpace resharper rules

I am creating a dotsettings file for corporate use. This file should conform to the coding standards for the company. One of the standards states that Attributes and Exceptions should be Suffixed ...
2
votes
0answers
196 views

Intellij Idea Code Style - Insert blank line after closing curly brace

I want Idea to insert a blank line after a closing curly brace when I format the code. So this, if(condition1) { someMethod(); } else { anotherMethod(); } statement1; statement2; would ...
2
votes
0answers
102 views

When is it okay to use copy.deepcopy()?

I'm working on a class that takes a certain number of images and performs different types of image operations on them. Images can be added to the class at any time to be modified by class methods. The ...
2
votes
0answers
48 views

Style preference for binary operators with long lines

Most style guides, such as Google's, for C++ recommend a maximum line length of 80 characters as well as relevant guidelines for function calls such that the function call is formatted correctly. For ...
2
votes
0answers
136 views

Get closing parenthesis of a multi-line method invocation aligned line containing the opening parenthesis

This is one of many Resharper indentation setting questions. I have got almost everything correctly formatted to my style, except a multiline method invocation, and to be exact, the closing ...
2
votes
0answers
443 views

Sublime Text 2 (or/and Xcode): Alternating background color for consecutive methods/functions?

I was wondering if there was a way to display methods/functions of a .cpp file with alternating background colors, to easily spot where these methods begin and end when browsing the code. Same ...
2
votes
0answers
459 views

What is an argument name specification (for)?

Resharper proposed me to add argument name specifications changing the method call from: MyEvent(sender, e); to MyEvent(sender: sender, e: e); Have not ever seen this syntax before and ...
2
votes
0answers
135 views

How to keep track of logic flow in huge volume of codes

I am creating a statistics page for My website which bring reports in form of charts.It have a JavaScript file which has some 500 to 800 lines of codes and sends nearly 5 to 8 ajax request to fetch ...
2
votes
0answers
276 views

Use this keyword in ASP.NET MVC Razor syntax

I have a problem about using this keyword in Razor syntax. If I write something like this: @foreach (var item in this.Model.Items) { @this.Html.ActionLink(item.Title, "MyAction") } I'll get an ...
2
votes
0answers
138 views

Is re-use of commands from the WPF command library a bad idea?

WPF provides a library of pre-defined commands (ApplicationCommands.Save, NavigationCommands.NextPage, etc.) that we can create command bindings for in our own application. I know that it is possible ...
2
votes
0answers
135 views

WordPress coding standards in emacs

After 3 years without my beloved emacs I managed to make the switch back and am very happy about it. I just lack some little tweaks to make my coding experience perfect. Is anyone here using emacs ...
2
votes
0answers
1k views

visual studio find and replace all references

Using Visual Studio (2010) is there any way to combine Find All References with a Replace All capability. I have inherited VB.NET code written by a VB6 programmer and I want to remove all the ...
2
votes
0answers
1k views

Why tabHost not working in 2.1, but in 2.2 works well?

I have problem with tabHost in Android 2.1. Simply code is working in Android 2.2, but in 2.1 not. Aplication FC. I don't know why, every examples are not working. I create new Android Project, select ...
2
votes
0answers
481 views

How to put custom style on dynamic created view

I have a problem with styling a dynamic created button in my android app. The way I'm doing it is to create the button from it's constructor: Button myButton = new Button(this, null, ...
1
vote
0answers
14 views

CodeBlocks: Change the style of { } completion

I am currently using CodeBlocks as my C++ IDE. If I am coding in "Allman Style", by which I mean this: foo() { // cursor goes here } the brace completion is very satisfactory. Upon typing the ...
1
vote
0answers
8 views

I have custom code that I need to bold for output. What google sheets script can I use?

I have created a customized work order submission form in Forms & Sheets that auto emails a confirmation from each submission (job request form) to create a data trail of vendor activity. Fairly ...
1
vote
0answers
18 views

Sort Stylus content

Is there a way to sort lines in Stylus files by some criteria, e.g. alphabetically, or by rules domain, like, all background things are put one after another, then all positioning things, like top, ...
1
vote
0answers
29 views

short/fast/elegant js to get an array of all css property names

I just came over the problem to get an array of all available css properties like: ['top',… , 'right', … ] I know it can be done in such a way: var a = document.createElement('a'), s = ...
1
vote
0answers
21 views

Editing pythonpath for every script in a project

So I structure almost all of my projects like this: root/ |- scripts/ |- src/ |- etc. ... I put runnable scripts in scripts/ and importable modules in src/, and by convention run every script from ...
1
vote
0answers
498 views

PMD Warning “Potential violation of Law of Demeter : object not created locally”, even on calling methods on local objects.

What I understood about law of demeter is : Your method can call other methods in its class directly Your method can call methods on its own fields directly (but not on the fields' ...
1
vote
0answers
16 views

Design Philosophy, what defines a bug

I have a problem with an older coworker and his code. He manages an old legacy project (30 years, his baby, two thirds of his career). I joined his team and searching through his sourcecode I find ...
1
vote
0answers
148 views

Google CodeStyle for Eclipse formatter shows version warning

Style xml is taken from: https://code.google.com/p/google-styleguide/source/browse/trunk/eclipse-java-google-style.xml In Eclipse Luna (Version 4.4.1) go to: Window Preferences Java CodeStyle ...
1
vote
0answers
118 views

MAX(minVal, MIN( val, maxVal)), std::max(minVal, std::min(val, maxVal)) replacement

I often end up writing stuff like MAX(minVal, MIN( val, maxVal)) or std::max(minVal, std::min(val, maxVal)) or qMax(minVal, qMin(val, maxVal)) (sure, you got it now) to saturate some value to a a ...
1
vote
0answers
45 views

How to compose “Given” clauses using inheritance in C# and MSTest

I've seen many Java developers implementing the Given part of a test using a test inheritance. For instance: Imagine this statement in the GIVEN-WHEN-THEN form: Given we have an Employee That has ...
1
vote
0answers
19 views

Programming for python with c API - how to avoid having casts everywhere

I am programming a module for python using C APIs. Inside my cmodule i define several Objects with specific names like MyObject. This MyObject contains a PyListObject and other stuffs. MyObject { ...
1
vote
0answers
95 views

PHPSTORM code style - Have different tab settings for view and save

I am current required to have all code meet the PSR1/PSR2 coding standards in PHPStorm. This unfortunately means that all my code has 4 space tabs, and I much prefer 2 space tabs. Is there anyway in ...
1
vote
0answers
87 views

Do other languages use things like Foo, Bar; Spam, Eggs

In languages like Java, Javascript, C, C++, C#, I have seen code similar to the folowing in tutorials and code snippets. int foo = 5; int bar = 10; baz(foo, bar); I assume these are used for quick ...
1
vote
0answers
48 views

Remove from list after correct twice and stopwatch

I'm creating a quiz and I'm new to python so please go easy on me! Basically I am trying to create a stopwatch that will display the time taken AFTER the quiz has ended and not while it is still ...
1
vote
0answers
88 views

How can I share (GitHub) my code (R) with sensitive information (passwords)?

Imagine you are using a package that uses an access token. Maybe one from rOpenSci. My current approach is to source a file at the beginning that is in the .gitignore. It, hence, gets ignored and I ...
1
vote
0answers
29 views

Is it possible to have a different 'views' of code with different coding styles?

I'm looking for a method to easily switch between coding styles (specifically - indentation and line breaks) This will allow different team members work with their preferred coding style - without ...
1
vote
0answers
467 views

Github Markdown README style guide

I've been looking around for a style guide for GitHub READMEs. How many headings to have, which headings, what size, how to describe example code, how to describe user input, all that kind of stuff. I ...
1
vote
0answers
93 views

eclipse - auto-indent works not like formatter

I've setup code formatter in Eclipse Juno to behave in a certain way, but it seems like it doesn't apply to auto-indenting (when you press Enter and Eclipse indents the new line automatically). For ...
1
vote
0answers
180 views

Best practice to keep method visibility with Spring @Controller stereotype

My project at current job use private access modifier for methods of MVC controllers: @Controller public class HelloWorldController { @RequestMapping("/helloWorld") private ModelAndView ...
1
vote
0answers
129 views

style sheets doesn't display on web host

I trying to create my first website and encounter problem with displaying style sheets. In offline mode it works fine (it means when it previewed in chrome from my hard drive). However when it's load ...
1
vote
0answers
924 views

Instagram API, Add followers, auto like, etc

we are trying to find the API or a simillar API that http://gramhoot.com uses! We have tried to source code it and google but nothing appears to be the same. It is an autofollow and autolike API.
1
vote
0answers
38 views

JSF Attributes Ordering plugin

I;ve inherited some poorly written jsf + richfaces markup looking like this <rich:comboBox selectFirstOnUpdate="true" suggestionValues="#{controller.getSuggestions}" id="someId" required="true" ...
1
vote
0answers
137 views

Can Maven PMD plugin be used to check for Java and Javascript in one run?

Reading the documentation, I can't figure out how the Maven PMD plugin can be configured to check for Java and Javascript violation in one run. Because of our internal workflow, I would like to ...
1
vote
0answers
65 views

Eclipse: coping with different coding styles when committing to repository?

I am in a team of developers who all have their own unique ways of styling their code. For me I like to have new lines for my braces when using controls or loops. Other developers like having a ...
1
vote
0answers
174 views

Common practice to name project directory which hold support scripts, configs, docs, etc for developers

I work with small set of projects so lack of knowledge about naming convention for directory in software project file hierarchy which desired to hold project development. I look to well-known ...
1
vote
0answers
295 views

lc-3: Loading a number into a register and Outputting it in the form of binary

I need help inputing a number into the console of an LC-3 simulator, such as 1 2 9, grab the number 129 and actually form it into the full number 129, (one hundred and twenty nine) and the output its ...
1
vote
0answers
158 views

“Universal” source code samples/snippets (in different programming languages) for checking IDE/editor syntax highlighting

Is there anywhere in Internet such compilation of "universal" example source codes - in different programming languages - for checking if code's syntax highlighting in IDE/editor works good? Source ...
1
vote
0answers
583 views

How do I disable JavaDoc code inspection for getters/setters in IntelliJ IDEA 11?

In our project properties (getters/setters) are already quite self-descriptive so we don't see the reason to add JavaDoc for those. So I was wondering: Is it possible to disable JavaDoc check (code ...
1
vote
0answers
116 views

Interface on Data objects

Is there any best practice for not using interface contracts on the data objects. I have couple of custom controls in my application and i want everyone to maintain a standard for creating controls. ...
1
vote
0answers
66 views

XTEA fragment: Which is better layout?

I am doing a University assignment in which part of the assignment is to implement the XTEA block cipher in C++. We are allowed to use Internet sources, so I went to the XTEA Wikipedia page and found ...