formatting

When do you use StringBuilder.AppendLine/string.Format vs. StringBuilder.AppendFormat?

A recent question came up about using String.Format(). Part of my answer included a suggestion to use StringBuilder.AppendLine(string.Format(...)). Jon Skeet suggested this was a bad example and proposed using a combination of AppendLine and AppendFormat. It occurred to me I've never really settled myself into a "preferred" approach fo...

Best source code formatter for Javascript?

I've been digging through Stack Overflow as well as a number of Google searches, and I cannot find a satisfactory code formatter for Javascript. I have found several related tools, such as syntax highlighters and pretty-printers, but I am looking for a tool that I can ideally create a wrapper for in Eclipse and simply run from the menu ...

HTML to Excel: How can tell Excel to treat columns as numbers?

I need to achieve the following when opening an HTML in Excel (Response.contentType="application/vnd.ms-excel") : force Excel to consider content of td cells as numbers make the above so that any subsequent user-entered formulas work on these cells (when the spreadsheet is opened) So far I was successful with adding style="vnd.ms-exc...

Formatting double as string in C#

I have a Double which could have a value from around 0.000001 to 1,000,000,000.000 I wish to format this number as a string but conditionally depending on its size. So if it's very small I want to format it with something like: String.Format("{0:.000000000}", number); if it's not that small, say 0.001 then I want to use something lik...

mssql handles line returns rather awkwardly

Here is the problem: for your reference: http://www.freeimagehosting.net/uploads/b443e7a1fe.jpg database entries 1,2 and 3 are made using jython 2.2.1 using jdbc1.2. database entry 4 is made using vb the old to be replace program using odbc. We have found that if I copy and paste both jython and vb MailBody entries to wordpad directl...

VB.net: Date without time

How do you format the date time to just date? for example, this is what i retrievedd from the database: 12/31/2008 12:00:00 AM, but i just want to show the date and no time. ...

DateTime Format like HH:mm 24 Hours without AM/PM

Hi there, I was searching here about converting a string like "16:20" to a DateTime type without losing the format, I said I dont want to add dd/MM/yyy or seconds or AM/PM, because db just accept this format. I tried with Cultures yet Thanks in Advance Added Angel says "I am using C#". ...

best way to print data in columnar format?

I am using Python to read in data in a user-unfriendly format and transform it into an easier-to-read format. The records I am outputting are usually going to be just a last name, first name, and room code. I I would like to output a series of pages, each containing a contiguous subset of the total records, divided into multiple colum...

How can I make Eclipse CDT auto-indent properly when using BOOST_FOREACH?

I write this tiny C++ example in Eclipse 3.4.1 (CDT 5.0.1): #include <iostream> #include <vector> #include <boost/foreach.hpp> int foo() { std::vector<int> numbers; BOOST_FOREACH(int n, numbers) { std::cout << n << std::endl; } std::cout << numbers.size << std::endl; } Then I hit Shift+Ctrl+F to format my code, and it b...

Automatically reformatting inherited PHP spaghetti code

I've taken over a mixed PHP4/PHP5 project which has been handed down from developer to developer, with each one making things worse. Before I spend too much time on it I'd like to develop a base-standard, with consistent formatting at a minimum. Can anyone recommend a utility (Linux or Mac OS X preferably) that will reformat the code? ...

Formatting inline items? What does the general code look like?

This is a total newbie question, so thanks in advance. I'm trying to get my head around the difference between divs and spans, and when and how to use them. Say for instance, I want to have an image left justified, and I want the text to flow around the image on the right, while maintaining justification. If the text flows past the imag...

Are there any good OSS instances of converting an Exception to HTML (C#) ?

Working with EntLib 4.1 and want the Exception block to send an email with error information. All that is fine but out of the box I have either the Text or Xml formatter to work with. I would love an Html representation that which brings in other information such as browser, http headers etc. Years ago I wrote one but dont have the sourc...

Format Double as Fraction

Is there a library that will convert a Double to a String with the whole number, followed by a fraction? For example 1.125 = 1 1/8 I am only looking for fractions to a 64th of an inch. ...

software that store data in flat file, what are common encoding/file format techniques

Hi, I have been spoiled by either using sql server to store data, or using xml files. What are common techniques for storing data in flat files other than xml and CSV. I know many times when I open files that data is all jumbled up, which means it is encoded right? Are there any common techniques that I could read about somewhere? ...

Standalone java base java formatter

Is there a Java-based program(jar) that can format java code(indenting/spacing). If it would be configurable that would be great. ...

Show HH:mm 24H format in TemplateField using text property

Hi there, im trying to show a 24 hours format using this line: Text='<%# Bind("Appointment", "{HH:mm}") So how it'll be formated for showing for example 16:40 instead 4:40 ? thanks in advance ...

How to change Visual Studio Auto Format

Is there any way to change Visual Studio Auto formatting options? Like VS by default uses close bracket format for Javascripts. ...

SQL string formatter

Does anyone know of a program, a utility, or some programmatic library, preferably for Linux, that takes an unformatted SQL string and pretty prints it? For example I would like the following select * from users where name = 'Paul' be changed to something like this select * from users where name = 'Paul' The exact formatting i...

What are the steps I need to take to add nice java code formatting to my blogger/blogspot blog?

I'm looking for a sequence of steps to add java code formatting to my blogspot blog. I'm really looking for a dummies guide - something so simple a cleaner could follow it if they found it on a piece of paper on the floor. ...

Garbled html in email

Is there some sort of formatting protocol for html email? We have an automated system that sends reports via email, when I look at the source I see them delimited by line length with an "=" breaking the line. That is, I get something like : <html><body>some text some text some text some= some text some text some text some text som<ta= ...