code-formatting

How to turn off the Eclipse code formatter for certain sections of Java code?

I've got some Java code with SQL statements written as Java strings (please no OR/M flamewars, the embedded SQL is what it is - not my decision). I've broken the SQL statements semantically into several concatenated strings over several lines of code for ease of maintenance. So instead of something like: String query = "SELECT FOO, BAR...

CSS why add whitespace before rules?

CSS code formatting question: I have an old habit of adding a single space before the { starts a new CSS rule, like this: body { font-size: 16px } the whitespaces like this one between body and { add up throughout the css. Ideally, i'd prefer writing my rules like so (and thus saving whitespace): body{ font-size: 16px } Actua...

CSS Code styling - background color is missing on empty lines.

I'm hoping this is simple. I'm not a CSS guy. I'm trying to make some code look a little better on a blog and I have the following <code> CSS style. code { display: block; white-space:normal; background-color: #eeeeee; font: 1em, 'Courier New', Courier, Fixed; padding: 7px; margin: 7px...

Xcode save code folding?

I know it's not directly related to programming, but what better place then stackoverflow right? So code folding is an awesome feature which I love, but does anyone know if there is a way to get Xcode to remember where you have certain sections collapsed whenever you open a file? BTW, I'm coding ruby on rails using git version control...

Is there a way to force a new line after php closing tag ?> when embedded among html??

I have been searching online with little success for a way to force php to output a newline after a closing php tag ?> so that my HTML will be rendered as I see it before its parsed by PHP so that it will look neat and tidy when viewing the html source code for a page. I want to stop it from removing the newline and causing the next lin...

How do I get the Intellij code autoformatter to keep an annotated field on one line?

Whenever I run the IntelliJ autoformatter - it converts this: @Autowired private CustomerDao customerDao; into this: @Autowired private CustomerDao customerDao; How can I stop it from doing that? ...

Insert template into every source file in an Eclipse project?

Is there a tool, option or script to insert a custom template into the header of every existing source file within an Eclipse project?` Some background information I have very recently open-sourced a small application written for a university assignment. Initially the source files did not require any explicit license or author inform...

Formating javascript source code

There is js file with a lot of code in unreadable format (all code in one line): JS file Is there a tool to format to a "normal" view? ...

SQL fixed-length insert statement formatter

Lets assume I have this long insert statement insert into table1 (id, name, phone, very_long_col_name, ...) values (1, 'very long name indeed...', '555-555-5555', 1, ...) As you can see above, it gets hard to tell values from their column since their length is uneven I'm looking for something (e.g. command line util) to ...

Oracle case sensitive Format SQL

Dears, I need to format SQL statement for Oracle Db. I have a sql statement and I don't want to change the case. For Eg. CREATE TABLE DPAuditTrailDetail ( ID NUMBER (19, 0) DEFAULT 0 NOT NULL, AuditTrail NUMBER (19, 0) DEFAULT 0 NOT NULL, sysObjectField NUMBER (19, 0) DEFAULT 0 NOT NULL, OldValue ...

How can I break up this long line in Python?

How would you go about formatting a long line such as this? I'd like to get it to no more than 80 characters wide: logger.info("Skipping {0} because its thumbnail was already in our system as {1}.".format(line[indexes['url']], video.title)) Is this my best option? url = "Skipping {0} because its thumbnail was already in our system as...

eclipse: changing the # of spaces to indent/unindent

How do I adjust the # of spaces added/removed by Eclipse when I hit Tab or Shift+Tab, for a given filetype? I am working on reStructuredText files (.rst) and want 2 spaces for those instead of 4. ...

Indention in C++ Builder

In C++ Builder, how can I make sure that even correctly nested code like: void func () { ... .. ) C++ Builder correctly nested only doing so: void func () { ... ... } This is very stressful, because I always have to correct by hand. So how can I make which indents code as well in the first instance? ...

Code/Function/Library to intent/format/prettify JavaScript/QtScript code for readablity within the application?

Greetings, in one of my applications I provide a simple code editor based on a QTextEdit widget and the QSyntaxHighlighter. I was wondering if there is function, library or generally a way to allow the user to have his/her code re-formatted and intented within the application? Websites like this allow you to re-format and intent JavaSc...

New line after every tag in eclipse when editing jsp files

When auto-formatting JSP files in Eclipse using Ctrl+Shift+F, it is trying to fit as many tags on a line as possible and then the tag that doesn't fit it will break and place the attributes on the next line. This is created very messy code, example below. <div class="type-text"><label for="echo">Project Name: </label> <s:textfi...

kdiff3 preprocessor: normalize code formatting

I want to compare side by side some C files with kdiff3 (the tool is what matters the less), but some parts have been "reformatted" in one of the files, thus giving false positives in the differences. Kdiff3 allows you to run a preprocessor on the input files, and I thought that using "indent" (or similar tools like astyle or uncrustify...

Eclipse formatter settings for the Builder pattern.

I'm extremely frustrated with the Eclipse formatting rules for a series of qualified invocations (i.e., the Builder pattern style). For example, here is my preferred formatting for some code that creates a new Apache Commons CLI Options object: Options options = new Options() .addOption(OPTION_HELP_SHORT, OPTION_HELP, false, "pr...

Flex: Display Color Coded XML?

Is there a component anyone knows of that will take XML and display it has a color coded string so you can read it easily? My app runs mostly from the dynamic XML that is loads. It would be great for debugging if I could click a button in the app to show me the XML it loaded in a readable format. Thanks! ...

Is it possible to auto-format your code in Dreamweaver ?

Is it possible to auto-format your code in Dreamweaver like in Visual Studio (ctrl+k+d) ...

Where can one post nicely formatted code combined with LaTeX for mathematical expressions?

Hi there, Admittedly not a programming question, but I don't really know where else to ask this... I'm planning to start a blog to post the stuff I'm working on, which is mostly about Expression Trees & Mathematics. Hopefully this will help me focus on the problem at hand instead of going off every possible tangent that comes up. I wo...