formatting

How can I include break lines in mysql records?

When someone types in the following to be put into a database: Hello, My name is John and I am 22, and looking for a good time. My Phone Number is: 555-NOT-REAL Sincerely, John D. I want the break lines to stay there, but it seems that when I pull the value back out it comes out as follows. Hello, My name is John and I am 22, and ...

In F#, How do I customize output of a custom type using printf?

I've read through a good chunk of Expert F# and am working on building an actual application. While debugging, I've grown accustomed to passing fsi commands like this to make things legible in the repl window: fsi.AddPrinter(fun (x : myType) -> myType.ToString()) I would like to extend this to work with the printf formatter, so I cou...

Formatting of the caption of a chart

Does anyone of you know a way to format the caption of a chart in Crystal Reports? I have a number that stands for a specific year, this number is 4 digits long. I wnat the caption to be shown like: 2009 But the current way its shown is 2.009 EDIT: The years are dynamically load from the database and in the DB they are stored...

Exporting ReportViewer to Excel - Line width variation

I am creating reports using the Microsoft ReportViewer control. I am encountering some formatting issues when exporting the reports into Excel. The problem is that I am specifying a line width of 1pt in ReportViewer, which is the smallest line possible (or is it?). When the export is done, the line widths in Excel are all thick bor...

PHP simpleXML how to save the file in a formatted way?

I'm trying add some data to an existing XML file using PHP's SimpleXML. The problem is it adds all the data in a single line: <name>blah</name><class>blah</class><area>blah</area> ... And so on. All in a single line. How to introduce line breaks? How do I make it like this? <name>blah</name> <class>blah</class> <area>blah</area> I...

Always show decimal places in SQL?

Hi, I'm working on a query which returns numeric values (currency). Some of the values are whole numbers and are being displayed as 3, 5, 2 etc whilst other numbers are coming up like 2.52, 4.50 etc. How can I force oracle to always show the decimal places? Thanks ...

keeping same formatting for floating point values

I have a python program that reads floating point values using the following regular expression (-?\d+\.\d+) once I extract the value using float(match.group(1)), I get the actual floating point number. However, I am not able to distinguish if the number was 1.2345678 or 1.234 or 1.2340000. The problem I am facing is to print out th...

DecimalFormat and doubles

DecimalFormat parses Double.toString() representation (which could be in scientific and financial format). Why Sun has chosen this approach, instead of direct converting double to String? PS: To be more concrete. Why DecimalFormat internally uses Double.toString() in order to format Double, instead of formatting internal representation...

How do I format number locale-specific in Perl?

I need to format numbers in my web application depending on user's chosen language, e.g. 1234.56 = "1.234,56" in German. Stuff like sprintf is currently out of question, since they depend on LC_NUMERIC (which is sensible for desktop applications IMHO) and I'd have to generate every locale on the server, which is a no-go. I would prefer u...

Formatting file sizes in Java/JSTL.

I was wondering if anyone knew of a good way to format files sizes in Java/JSP/JSTL pages. Is there a util class that with do this? I've searched commons but found nothing. Any custom tags? Does a library already exist for this? Ideally I'd like it to behave like the -h switch on Unix's ls command 34 -> 34 795 -> 795 2646 -> 2.6K 2...

Finding locale date representation in PHP5

Hi, my site changes its locale dependent upon either user settings or browser settings (where the user hasn't set their preference). I am using amline charts, the stock chart specifically, which requires the date format in 'MM/DD/YYYY' or 'DD-MM-YYYY', I guess so the chart knows how to understand the dates. There are many ways to format ...

Best timestamp format for CSV/Excel?

I'm writing a CSV file. I need to write timestamps that are accurate at least to the second, and preferably to the millisecond. What's the best format for timestamps in a CSV file such that they can be parsed accurately and unambiguously by Excel with minimal user intervention? ...

How do I use JavaScript for number formatting?

Hi, I want to use JavaScript to restrict input on a text box to currency number formatting. For example: <input type="text" value="2,500.00" name="rate" /> As given above, the text box should accept only numbers, commas and a period. But, after the period it should accept two digits after numbers. How do I accomplish this? Please ...

Source text contains simple HTML. How can I simply format the text in MS Word?

I've inherited a project that stores basic HTML formatting (i.e. - <b>, <i> tags) in a database and writes it out to a Word document. This is my first Word automation assignment, so be gentle! Currently, there is a complicated function that runs after the document is complete that searches and replaces these tags. However, as this is ...

How to convert byte[] to that text format?

Hello, I can say I don't know what I'm asking for help,because I don't know the format,but I've got a picture. I have a byte[] array ,how do I convert it to that format below(in right)? Its not plain ascii. ...

Changing JTable cell color

This is driving me absolutely insane. I know that, to change the formatting of table cells with JTable, I have to use my own renderer. But I cannot seem to implement this properly. This is my current setup: public class MyClass { public static void main(String args[]) { JTable myTable = new JTable(10, 10); myTable.se...

Fuzzy date algorithm

I'm looking for a fuzzy date algorithm. I just started writing one and realised what a tedious taks it is. It quickly degenerated into a lot of horrid code to cope with special cases like the difference between "yesterday", "last week" and "late last month" all of which can (in some cases) refer to the same day but are individually corre...

Oracle Date formatting "2009-02-13T11:46:40+00:00"

Hi Guys, I've had some brilliant help before and I'm hoping you can get me out of a hole again. I've got a date coming in from a web service in this format: 2009-02-13T11:46:40+00:00 which to me looks like standard UTC format. I need to insert it into an Oracle database, so I'm using to_date() on the insert. Problem is, I cant get a...

Why is this Java formatted output not right-justified?

I'm a beginner, and I'm experimenting with formatted output. I'm trying to produce a table of decimals: for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { row = (double) 5*i; column = (double) j + 1; System.out.format("% 6.3f", row/column); System.out.print("\t"); } System.out.format("%n"); } This produces: 0.00...

Formatting a (large) number "12345" to "12,345"

Say I have a large number (integer or float) like 12345 and I want it to look like 12,345. How would I accomplish that? I'm trying to do this for an iPhone app, so something in Objective-C or C would be nice. ...