code-formatting

What is a good way to format sql of a view from MYSQL

As most of you would know, when you save a view in MYSQL and then retrieve it later, it's all in native MYSQL, looks terrible - no line spaces, indents, plenty of UTF encoding tags littered around the place making your code look like sql soup. Does anyone have a program or recommend a plugin to netbeans that i can use to format this sql...

I know I'm supposed to keep Python code to 79 cols, but how do I indent continuations of lines?

I am aware that the standard Python convention for line width is 79 characters. I know lines can be continued in a number of ways, such as automatic string concatenation, parentheses, and the backslash. What does not seem to be as clearly defined is how exactly the overflowing text should be formatted. Do I push it all the way back to co...

HTML line break formatting in VS is not working?

I've adjusted my VS 2010 HTML formatting settings to do line breaks "Before opening, within, and after closing" for many tags such as the <a> and <li> tags. But this only renders as the following when formatting the document: <ul> <li> <a href="#"> Item 0</a></li> <li> <a href="#"> Item 1...

Using Perl to move commas from end of line to begining of line

I've inherited a few dozen sql scripts that look like this: select column_a, column_b, column_c from my_table To format them so they match the rest of our sql library, I'd like to change them to look like this: select column_a ,column_b ,column_c from my_table where the commas start at the beginning ...

Clean up CREATE TABLE column layout

I've got a series of sql scripts that look like this: CREATE TABLE table_one ( column_one int not null, column_two varchar(100) not null, column_three_four_five int, column_six decimal(16,4) null, PRIMARY KEY ( column_one, column_three_four_five) ); I'd like to clean up the layout t...

Formatting HTML Source using Ruby

Hi All, Is there any Ruby library available to format the HTML source. By formatting I mean removing the extra spacing, apply proper indentation etc. I am already using Hpricot for parsing HTML. It would be nice if Hpricot could do this job. But I am not stick with Hpricot for the formatting stuff. Thanks, Imran ...

How can I use an Eclipse formatter profile in VIm?

My team has a standard Eclipse code formatter profile. I prefer to work with VIm. Is there any way I can convert this file and use it with VIm? ...

Pros and cons of CSS formatting

Pros and cons of CSS formatting I know four kinds of CSS formatting. Which do you think are better? A) classic .class1 { } .class1 .class2 { } .class1 .class2 .class3 { } .classFoo { } B) classic idented .class1 { } .class1 .class2 { } .class1 .class2 .class3 { } .classFoo { } C) same line .class1 {} .cla...

Is placement and format of copyright statement relevant?

Every software I have seen, contain copyright statement at the beginning of a file and takes pretty much lines of comment. Therefore you have to scroll down to see the code, which is a bit annoying, especially when code itself is very short. I think that it would be nicer to keep copyright statement at the bottom of a file and join all ...

A little help F-Sharping up this path-finding code, please

EDIT The bounty is regarding my follow up question re: the generic version of the code. As per my last post in this thread, Thanks, JD Hi all, I've just tried porting some of my C# 2D path-finding code into F#. But I'm currently in the 'limbo' of being a C# OO developer and also, probably, trying too hard to be purely functional with m...

Where should you place the * when declaring a pointer in C?

Possible Duplicate: Whats your preferred pointer declaration style, and why? Should it be: center: int * number; left: int* number; right: int *number; I see the left one as type centric the right one as variable name centric, and the center one as agnostic, but I'm really not sure. Does one make sense in certain situation...

How to make UniversalIndentGUI handle @interface xxx : yyy {} statement properly?

I'm playing with UniversalIndentGUI to format obj-c code as I want it to be formatted. Since i came from .NET world I want to format @interface declaration like @interface ManagedObjectCell : UITableViewCell { } Not like @interface ManagedObjectCell : UITableViewCell { } But i didnt find the option in UniversalIdentGUI to specify...

Visual Studio 2010 Document Formatting Rules

I know that in the Tools > Options (Text Editor > CSS > Format) menu I can choose between three types of document formatting for CSS files (compact, semi-expanded and expanded) as well as capitalization. A decision has been made in my organization to implement a formatting structure in XML files, where the attributes for an element line...

Which is the closest Python equivalent to Perl::Tidy?

Coming from Perl I've been used to hitting C-c t to reformat my code according to pre-defined Perl::Tidy rules. Now, with Python I'm astonished to learn that there is nothing that even remotely resembles the power of Perl::Tidy. PythonTidy 1.20 looks almost appropriate, but barfed at first mis-aligned line ("unexpected indent"). In part...

Dealing With Different Coding Conventions/Styles In Visual Studio...

I'm working on two different projects - both in VB.NET/Visual Studio 2008 (as much as I'd like to move to 2010). I find I'm confusing the different coding standards that I'm supposed to follow. IE - Project1 wants variables named in a Hungarian-style notation like 'iSomeValue'; the does not want a prefix. One project requires an _ pre...

formatting code within notepad++?

Is there a keyboard shortcut to format code within Notepad++ ? I'm mainly working with HTML, CSS and Python code. For example: <title>{% block title %} {% endblock %}</title> <link rel="stylesheet" href="/media/style.css" type="text/css" media="screen" /> </head> To: <head> <title> {% block title %} ...

how can I make the vim javascript pretty formatter plugin run?

I downloaded jsbeautify.vim from http://www.vim.org/scripts/script.php?script_id=2727 So where do I put jsbeautify.vim ? In ~/.vim/ or ~/.vim/ftplugin/ ? After I position the plugin file, I will vim somefile.js containing javascript code without any newlines (difficult to read). How do I invoke the plugin to pretty the code make it re...

Environment 'Preformatted' in Latex

I know two environments, lstlisting and verbatim but both behave difficult in my case. Is there a Latex environment which allows pre-formatted text, conserving my white space characters (most important the indentation)? I do not want to use verbatim or lstlisting for two reasons: I try to use lstlisting in a macro: \newcommand*{\fdesc...

Is there a tool for formatting javascript that doesn't suck?

I am looking for a tool that formats my javascript for me. There are many times when I wish I could just let a tool format my source code because of restructuring some code or because I want to make sure the code structure really is like I believe it to be. My problem is that all formatters I have found produce really retarded results. ...

How to write a true if()

I always write if statements like this: if (...) { /* do something */ } When I create topics on stackoverflow, sometimes people change this code to: if (...) { /* do something */ } So the first { goes to a new line. Does it make sense, what's the true way? ...