formatting

How to zero fill a number inside of an Excel cell

How do you zero fill a number to 10 positions inside an excel spreadsheet? i.e. If cell A1 has 1234 how can cell A2 display 0000001234 (10 postions). ...

ASP.NET Charting Control currency formatting

I need to use a different currency for my Y Axis labels. I read http://social.msdn.microsoft.com/Forums/en-US/MSWinWebChart/thread/56453466-06b1-4df4-8265-5c63dc18efe5/ but I'm still battling to change the dollar sign to a different char. ...

How do I format positional argument help using Python's optparse?

As mentioned in the docs the optparse.OptionParser uses an IndentedHelpFormatter to output the formatted option help, for which which I found some API documentation. I want to display a similarly formatted help text for the required, positional arguments in the usage text. Is there an adapter or a simple usage pattern that can be used f...

How can I auto-fill a paragraph in Eclipse?

I would like to auto-fill a paragraph to 80 characters (or some other fixed width) in Eclipse. Is this possible via a keyboard command like in Emacs? Or is there maybe a plugin (I did not find anything on google)? Edit: I am not sure if this is relevant, but I need this for docstrings in Python code (using the PyDev plugin). ...

Inline wrapping of hyperlink text in HTML anchor tag

I'm trying to find a way to allow really long text in an HTML link to wrap while containing the link in a compact rectangle. Essentially, I want this: with a really, really Here is some text long link that wraps and here is some more text. around in a rectangle Instead of: Here ...

How to format a variable of Double type

I have a variable of double type and the value in it is something like 34.323423423123456 I'd like to format it using String.format method (or whatever works) to have only 2 decimal places (e.g. 34.32), but to also round it properly, e.g. 2.229934345 will be 2.23. I am new to Java and none the C# tricks worked. Thanks ...

Formatting an SQL numeric query result with an arbitrary number of decimal places

I have a database table with these two columns: Amount: numeric (18,0) DecimalPlaces: numeric (18,0) This table can store amounts in various currencies, with the decimal place removed from the amount (I can't change this data model). For example, there might be two rows like this: 1290, 2 (This is £12.90, needs to appear as "12.90"...

Good tutorial for stringstream manipulation in C++

I'm looking for a good tutorial on how to do string manipulation with stringstream in C++. Currently, I'm doing the following: double d = 7.234; stringstream out; out.width(8); out.precision(6); out << fixed << d; I like this link for a list of what options are available, but I learn best from examples and would like to see some more...

Data-bound WinForms form - how to format dates?

I have a form with a date value in a TextBox control. The form uses data binding with a BindingSource against a DataSet and a SQL 2005 CE database. Where do I control the formatting of the date? Nowhere in the properties along the way did I see a possibility to strip out the time part, for instance. I could of course do it in the databa...

Supressing line breaks in Fortran 95 write statements

Hello, I would like to write to the standard output in fortran without adding a line break. That is, I want to do something like this: a='some string and ' b='some other string' write(*,101) a ... write(*,102) b ... 101 format(a,...) 102 format(a) Is it possible to use some kind of format statement to supress the line break in 101, s...

Why do NSString and NSLog appear to handle %C and %lc (and %S and %ls) differently?

Apple's String Format Specifiers document claims, The format specifiers supported by the NSString formatting methods and CFString formatting functions follow the IEEE printf specification; … You can also use these format specifiers with the NSLog function. But, while the printf specification defines %C as an equivalent for %lc and ...

XSLT Decimal formatting based on input XML.

I have a situation where my XSLT files should display prices alongwith decimals conditionally, depending on whether the input XML contains decimals or not. So, I can receive XML files with two types of values - XML will contain all prices formatted with decimals upto two places (I call this one "Decimal-XML") or the prices will be rounde...

C# String Format Placeholders in Regular Expressions

Hi All, I have a regular expression, defined in a verbatim C# string type, like so: private static string importFileRegex = @"^{0}(\d{4})[W|S]\.(csv|cur)"; The first 3 letters, right after the regex line start (^) can be one of many possible combinations of alphabetic characters. I want to do an elegant String.Format using the above,...

how do I print an unsigned char as hex in c++ using ostream?

I want to work with unsigned 8-bit variables in C++. Either unsigned char or uint8_t do the trick as far as the arithmetic is concerned (which is expected, since AFAIK uint8_t is just an alias for unsigned char, or so the debugger presents it. The problem is that if I print out the variables using ostream in C++ it treats it as char. ...

How can I make java.text.NumberFormat format 0.0d as “0” and not “+0”?

Need result with sign, except for 0.0d. Ie: -123.45d -> "-123.45", 123.45d -> "+123.45", 0.0d -> "0". I invoke format.setPositivePrefix("+") on the instance of DecimalFormat to force the sign in the result for positive inputs. ...

Can AMF be used as "just another output format" from a web service?

I'm working on a RESTish server project that responds to HTTP requests in a variety of formats. This allows us to write user facing applications and retrieve whichever format seems most convenient at the time. For example, to see if there is a user logged in, we can send: http://serverurl/Authentication?command=whoami&amp;format=xml A...

Add lines to top of text file, retain formatting

I have a config file to which I nee to add a couple of lines at the top of the file. When I try to do it from the command line, it removes the new line characters from my file and gives me an unformatted file. So, my question is: Can I add some lines to the top of an already existing file and it should retain its formatting and new line...

Formatting code snippets for blogging on Blogger

My blog is hosted on Blogger and I frequently post code snippets in C / C# / Java / XML etc. but I find the snippet gets "mangled". Are there any web sites that I could use to parse the snippet beforehand and sort out the formatting, convert XML "<" to "<" etc. There are a numbers of questions around this area on SO but I couldn't find...

Problem with Convert.ToDateTime in asp.net

Hi, I have an application that works without any problem in a spanish server. When i uploaded the application into the online server (an english windows), im getting exceptions (of type "input string is not a valid Datetime/Int32") with Convert.ToDateTime and Convert.ToInt32. Are any web.config line that could help me in this matter? ...

How do you print your programs to MS Word?

Hi guys, We have a project, and the professor asked us to print the program codes using microsoft word. however when i pasted all my codes in ms word it turns out that it doesn't have coloring, those nice programming fonts.. It just looks awfully ugly in microsoft word.. I want this to be printed on papers very gorgeously. Like what w...