formatting

C# Code Formatter for Linux and/or MonoDevelop

MonoDevelop 1.0 doesn't appear to have a code-formatter like Eclipse does for Java. Is there a preferred shell script (or MonoDevelop add-in?) that you've found to work well? ...

How to escape brackets in a format string in .Net

How can brackets be escaped in a C# format string so, something like : String val = "1,2,3" String.Format(" foo {{0}}", val); doesn't throw a parse exception but actually outputs the string " foo {1,2,3}" Is there a way to escape the brackets or should a workaround be used. ...

While coding, how many columns do you format for?

in the old days everything was 80 columns. so if you wanted your code to be readable, you'd make it fit. but that's not the case anymore with wider and wider screens, so how long of line is too long? ...

Can the NetBeans code formatter be made to format javadoc comments?

The NetBeans 6.1 editor doesn't seem to like to wrap comments, and the code formatter seems to ignore them. For JavaDoc comments, this behaviour seems inappropriate, as you can end up spending a lot of wasted time manually reflowing paragraphs. I was wondering if there's some magic setting to get the builtin code formatter, or the edit...

Tabs and spaces conversion

I would like to automatically convert between tabs and spaces for indentation when I commit/update code to/from our repository. I have found the AnyEdit plugin for eclipse, which can convert directories of files. Not bad for a start, but does anybody have more expierience on how to handle this? Or maybe know of an Ant script or something...

Code formatting: is lining up similar lines ok?

I recently discovered that our company has a set of coding guidelines (hidden away in a document management system where no one can find it). It generally seems pretty sensible, and keeps away from the usual religious wars about where to put '{'s and whether to use hard tabs. However, it does suggest that "lines SHOULD NOT contain embedd...

How would you implement auto-capitalization in JavaScript/HTML.

I need to implement auto-capitalization inside of a Telerik RadEditor control on an ASPX page as a user types. This can be an IE specific solution (IE6+). I currently capture every keystroke (down/up) as the user types to support a separate feature called "macros" that are essentially short keywords that expand into formatted text. i....

How verbose should validation output be?

I have an application that reads a database and outputs alerts to any dependencies that are not being met. My thinking on this issue is "Give the minimum information that points the user to the issue." I have been told by a co-worker that I should be as verbose as possible, printing out the values of the database fields for each field ...

VB.NET - RichTextBox - Apply formatting to selected text.

Hello, this may be n00by, but, I have this simple question: I have a RichTextBox control on my form. I also have this button, labeled Bold, that I want, if someone selects text in the RichTextBox, then presses the button, the selected text turns bold. Any way to do that? Simple, everyday task for end users. Thanks. ...

ASP.Net GridView Size Formatting

I have an ASP.Net GridView control that I need to remain a fixed size whether there are 0 records or n records in the grid. The header and the footer should remain in the same position regardless of the amount of data in the grid. Obviously, I need to implement paging for larger datasets but how would I achieve this fixed sized GridVie...

How would you format multiple properties when using Property Initialization? (.Net)

For example: root.Nodes.Add(new TNode() { Foo1 = bar1, Foo2 = bar2, Foo3 = bar3 }); or: root.Nodes.Add(new TNode() { Foo1 = bar1, Foo2 = bar2, Foo3 = bar3 }); ...

Keeping my PHP pretty

I am creating a site in which different pages can look very different depending upon certain conditions (ie logged in or not, form filled out or not, etc). This makes it necessary to output diferent blocks of html at different times. Doing that, however, makes my php code look horrific... it really messes with the formatting and "shape...

What is the standard format for documenting functions in php?

I've written a fair few php apps in the past, but tonight is my first foray into SVN so I figured I'd also document my code properly. What's the adopted format for documenting php functions? Obviously I could adopt my own format, but, looking forward, if there's one which can be used by documentation tools then all the better. Cheers! ...

What's the Name of the Python Module that Formats arbitrary Text to nicely looking HTML?

A while ago I came across a Python library that formats regular text to HTML similar to Markdown, reStructuredText and Textile, just that it had no syntax at all. It detected indentatations, quotes, links and newlines/paragraphs only. Unfortunately I lost the name of the library and was unable to Google it. Anyone any ideas? Edit: re...

SQLplus script to format text as numeric

I am selecting rows from a table, but some of the columns are a text type, but they always have numeric data in them. How can I format them as numbers? e.g. column quantity heading 'Quantity' format 999,999 However, since the column in the table is text, the numeric formatting is ignored. ...

Is Programming Style important? How Important?

Last year I was troubleshooting a team member's code and it was lacking indents and comments. I was talking to him about it telling him it was not a good idea but he got offended. He was/is smarter than me or certainly more educated. Since then I found out he applied to Microsoft and when they had him do a doubly linked list implementa...

String Format Date - C# or VB.NET

Date coming out of a database, need to format as "mm/dd/yy" For Each dr as DataRow in ds.Tables(0).Rows Response.Write(dr("CreateDate")) Next ...

.NET currency formatter: can I specify the use of banker's rounding?

Does anyone know how I can get a format string to use bankers rounding? I have been using "{0:c}" but that doesn't round the same way that bankers rounding does. The Math.Round() method does bankers rounding. I just need to be able to duplicate how it rounds using a format string. Note: the original question was rather misleading, an...

C#: File-size format provider

Is there any easy way to create a class that uses IFormatProvider that writes out a user-friendly file-size? public static string GetFileSizeString(string filePath) { FileInfo info = new FileInfo(@"c:\windows\notepad.exe"); long size = info.Length; string sizeString = size.ToString(FileSizeFormatProvider); // This is where t...

Is there a source code formatter for Groovy?

I use the commercial version of Jalopy for my Java projects but it doesn't work on Groovy files. IntelliJ has a serviceable formatter but I don't like requiring a particular IDE. ...