Error
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.
  • JHTMLicon not supported. File not found.

format

Watch Steve Jobs' Life In a Facebook Timeline (Updated) [Steve Jobs]
Wednesday, 22 February 2012 11:02
Someone built a Facebook timeline with the life of Steve Jobs. It's quite nice to go through it and look at his life in this format, rather than having to suffer through Isaacson's rushed out prose. More »


Read more: http://feeds.gawker.com/~r/gizmodo/full/~3/dcHlCY_gJ_c/watch-steve-jobs-life-in-a-facebook-timeline

 
Cool use of String.Format method
Wednesday, 14 December 2011 02:05
The string.Format method is a static method that receives a string that specifies where the following arguments should be inserted, and these are called substitutions

Following example shows the use of the string.Format method to combine three strings with formatting options. The format string itself is the first argument to the string.Format method and it is specified as a string literal.

The position markers in the format string are specified to the left of the colons, and this means the "0", "1:", and "2:" indicate where the first, second, and third arguments are inserted. The part after the ":" and in between the { } brackets indicates the exact format specification for that variable.

String Literal

static void Main()
{
//
// Declare three variables that we will use in the format method.
// ... The values they have are not important.
//
string value1 = "This is test";
int value2 = 530;
DateTime value3 = new DateTime(2011, 11, 11);
//
// Use string.Format method with four arguments.
// ... The first argument is the formatting string.
// ... It specifies how the next three arguments are formatted.
//
string result = string.Format("{0}: {1:0.0} - {2:yyyy}",value1,value2,value3);
Console.WriteLine(result);
}
/*
OUTPUT
This is test: 530.0 - 2011
*/


Number formats
You can specify that a value type such as a double can be formatted inside the string.Format method based on the format string. The format string is the first argument to the string.Format method. The format string in this example uses the 0:0.0% syntax, which means that the second argument should be formatted with the pattern 0.0%. The arguments are numbered starting at zero.

static void Main()
{
//
// Format a ratio as a percentage string.
// ... You must specify the percentage symbol in the format string.
// ... It will multiply the value by 100 for you.
//
double ratio = 0.530;
string result = string.Format("string = {0:0.0%}",ratio);
Console.WriteLine(result);
}
/*
OUTPUT
string = 530.0%
*/


Padding (PadLeft and PadRight)
Padding can be used with strings in the C# language and this can be expressed declaratively in formatting strings and the string.Format method. The term 'padding' indicates that you are inserting a variable number of characters at the left or right of the string to ensure that the total length of the string is a fixed length. Instead of the PadLeft and PadRight methods, you can use the string.Format method with special substitutions.

static void Main()
{
//
// The constant formatting string.
// ... It specifies the padding.
// ... A negative number means to left-align.
// ... A positive number means to right-align.
//
const string format = "{0,-10} {1,10}";
//
// Construct the strings.
//
string line1 = string.Format(format,100,5);
string line2 = string.Format(format,"Carrot","Giraffe");
Console.WriteLine(line1);
Console.WriteLine(line2);
}
/*
OUTPUT
100 5
Carrot Giraffe
*/


ToString or string.Format
Sometimes, you need to just format a single number, like an integer or long. In this case, you don't need to use string.Format. You can just use the ToString virtual method.

static void Main()
{
int value = 123;
string a = string.Format("{0:0000}", value); // Too complex
string b = value.ToString("0000"); // Simpler
Console.WriteLine(a);
Console.WriteLine(b);
}
/*
OUTPUT
0123
0123
*/


DateTime Format
format string pattern defined as followse
MMM display three-letter month
ddd display three-letter day of the WEEK
d display day of the MONTH
HH display two-digit hours on 24-hour scale
mm display two-digit minutes
yyyy display four-digit year


static void Main()
{
DateTime time = DateTime.Now; // Use current time
string format = "MMM ddd d HH:mm yyyy"; // Use this format
Console.WriteLine(time.ToString(format)); // Write to console
}
/*
OUTPUT
Feb Fri 27 11:41 2009
*/

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/DUa-Zy493Oo/14175

 
Can a Simple Film Overlay Magically Transform a 2D Screen into a 3D One? [Video]
Wednesday, 29 June 2011 22:00
Take a sheet of Pic3D film, apply it to any LCD and it promises that it will properly display 3D video (displayed in the side-by-side format) without special glasses, thanks to lenticular lens technology. More »


Read more: http://feeds.gawker.com/~r/gizmodo/full/~3/rROMPtnh83Q/can-a-simple-film-overlay-magically-transform-a-2d-screen-into-a-3d-one

 
Any date to Mysql date
Monday, 24 January 2011 12:32
a little helper function which parses about any date and returns the same date in MySQL date/time format Download Wow Hits 2010 2011


function date_to_mysql($date) {
//if $date is not numeric, assume it's in textual format
if (!is_numeric($date)) {
$date=strtotime($date);
}
return date('Y-m-d H:i:s',$date);
}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/RaQnDGMQ8Nc/12883

 
WWF Is a New Green File Format That's Impossible To Print [Video]
Friday, 10 December 2010 12:40
The rabble rousers at the World Wildlife Fund (they re-named fake wrestling!) have created a new, PDF-type file format called WWF. It's a file format that CANNOT be printed out. The idea: save as WWF, save a tree. More »


Read more: http://feeds.gawker.com/~r/gizmodo/full/~3/tjwTdTsWOwg/wwf-is-a-new-green-file-format-thats-impossible-to-print

 
Start
Prev
1


Page 1 of 2
Taxonomy by Zaragoza Online