What is an easy way in Python to format integers into strings representing thousands with K, and millions with M, and leaving just couple digits after comma?
I'd like to show 7436313 as 7.44M, and 2345 as 2,34K.
Is there some % string formatting operator available for that? Or that could be done only by actually dividing by 1000 in a l...
I have the following statement
DateTime now = DateTime.Now;
string test = string.Format("{0}{1}{2}{3}", now.Day, now.Month, now.Year, now.Hour);
This gives me:
test = "242200915"
But I'd like to have something like:
test = "2402200915"
So the question is, how can I enforce the string formatter to output each int with the width ...
Here is the code
$i=0;
while ($row = mysql_fetch_array($result))
{
$output.="idno".$i."=".urlencode($row['usr_id']).
'&'."res".$i."=".urlencode($row['responce']).
'&'."sex".$i."=".urlencode($row['sex']).
'&'."com1".$i."=".urlencode($row['com1']).
'&'."com2".$i."=".urlencode($row['com2']);
$i++;
}
OUTPUT i get ...
Using the Oracle to_char(number) function, is it possible to append ascii characters to the returned string?
Specifically, I need to add a percentage character to the returned string.
"select to_char(89.2244, '999G999G999G999G990D00') from dual" -->
returns "89.22". I need a format pattern that returns "89.22%".
I am using this throug...
How do I format my output in C++ streams to print fixed width left-aligned tables? Something like
printf("%-14.3f%-14.3f\n", 12345.12345, 12345.12345);
poducing
12345.123 12345.123
...
I tried strftime( ) to get a formatted time-stamp.
char ft[ 256 ];
struct tm *tmp;
strftime( ft, 256, "%D - %T", tmp );
My problem is that I get "13/02/60 - 03:07:-17958194" as a result. Is there a way to display the seconds properly? (I'm using Mac OS X and gcc)
...
I am extracting some data from SQL Server. One of the columns is a ntext column that has a blob of XML there. As I extract it, it looks really ugly. Is there any way to format the XML inside a SQL Server 2005 stored proc?
...
Search:
Scripting+Language Web+Pages Applications
Results:
...scripting language originally...producing dynamic web pages. It has...graphical applications....purpose scripting language that is...d creating web pages as output...
Suppose I want a value that represents the amount of characters to allow as padding on eit...
Man, I know this is probably dead simple, but I've got some data such as this in one file:
Artichoke
Green Globe, Imperial Star, Violetto
24" deep
Beans, Lima
Bush Baby, Bush Lima, Fordhook, Fordhook 242
12" wide x 8-10" deep
that I'd like to be able to format into a nice TSV type of table, to look something like this:
Name ...
Duplicate of: http://stackoverflow.com/questions/292026/is-there-a-good-reason-to-use-upper-case-for-t-sql-keywords
Simple question. I personally find a string of lowercase characters to be more readable than a string of uppercase characters. Is some old/popular flavor of SQL case-sensitive or something?
For reference:
select
th...
I get dates in my dataset in the form "yyyyMMdd" (ie 20080228 means Feb 28, 2008)
I need to convert these to "M/d/yyyy"
Examples:
20080228 = 2/28/2008
20080101 = 1/1/2008
20081001 = 10/1/2008
20081212 = 12/12/2008
what is the correct expression to handle this?
EDIT
The expression that I used (ORDDTE is in the "yyyyMMdd" format and...
I want to make a page for a website that will let the user create a blog post, and want them to be able to graphically edit the formatting, like paragraphs and styles, then convert this to html. Is there a way to do it in PHP? Do I need to use Javascript or Ajax or something?
...
I have inherited a large source tree, C#, Visual Studio 2008.
It has many quality issues, one of them is that the code is generally badly formatted.
I am looking for a tool, preferably a plugin for Visual Studio, that will go over the whole solution and apply the same basic formatting that Visual Studio itself applies when, for example...
Using WPF, what is the most efficient way to measure a large number of short strings? Specifically, I'd like to determine the display height of each string, given uniform formatting (same font, size, weight, etc.) and the maximum width the string may occupy?
...
Is there a printf()-like formatting in MySQL?
I couldn't find a straightforward way in the documentation.
For example, how can I make something like:
SELECT STRFORMATFUNCTIONIMLOOKINGFOR("%03d", 17)
to get 017 ?
...
When typing code in a .aspx file (an MVC view in this case), Visual Studio applies two types of formatting, one to the regular html tag structure (which can be controlled from Tools->Options->Text Editors->Html) and another to content inside the <% %> tags.
I've run into two annoyances with the second type of automatic formatting, the <...
I'm in the process writing a 'clever' number formatting function, which would behave this way :
1500 -> 1.5k
1517 -> 1 517
1234000 -> 1 234k
1200000 -> 1.2M
Is it possible to do this using double.toString() or another .net built-in class ?
I know it's quite easy to code, but I'd rather reuse the framework classes if the functionality...
I want to take two times (in seconds since epoch) and show the difference between the two in formats like:
2 minutes
1 hour, 15 minutes
3 hours, 9 minutes
1 minute ago
1 hour, 2 minutes ago
How can I accomplish this??
...
When I write code, I try to group lines of similar code together, then leave a blank line and write another block.
I believe this contributes to the neatness and readability of the code.
I'm not a big fan of bunching stuff together without any line spacing. It looks like hell, it's hard to read and it's difficult to follow.
One of th...
It's another Visual Studio 2008 HTML formatting question...I think I have either found a bug in the infamously bad VS HTML formatting, or I'm doing something wrong. Here's what I'm doing:
I remove all client side tags via:
Tools -> Options -> Text Editor -> HTML -> Format -> Tag Specific options
I then add b and span tags:
I press...