Thursday, February 26, 2009
Thursday, February 19, 2009
C# String.Format for Double/Decimal Values
The following examples show how to format float numbers to string in C#. You can use static method String.Format or instance methods double.ToString and float.ToString.
Digits after decimal point
This example formats double to string with fixed number of decimal places. For two decimal places use pattern "0.00". If a float number has less decimal places, the rest digits on the right will be zeroes. If it has more decimal places, the number will be rounded.
[C#]
// just two decimal places
String.Format("{0:0.00}", 123.4567); // "123.46"
String.Format("{0:0.00}", 123.4); // "123.40"
String.Format("{0:0.00}", 123.0); // "123.00
More examples are in the original article here...
Digits after decimal point
This example formats double to string with fixed number of decimal places. For two decimal places use pattern "0.00". If a float number has less decimal places, the rest digits on the right will be zeroes. If it has more decimal places, the number will be rounded.
[C#]
// just two decimal places
String.Format("{0:0.00}", 123.4567); // "123.46"
String.Format("{0:0.00}", 123.4); // "123.40"
String.Format("{0:0.00}", 123.0); // "123.00
More examples are in the original article here...
Wednesday, February 18, 2009
Architect Competencies
A couple of good articles were shared with me today about the competencies of a software architect and some training resources for them.
Microsoft Certified Architect Program Competencies
Learn Architecture
Microsoft Certified Architect Program Competencies
Learn Architecture
Tuesday, January 27, 2009
PowerShell Script for Find In Files
A co-worker gave me this Windows PowerShell script that I used to find files that contained a certain value...because the Windows Search Companion stinks!
gci -include *.txt *.* |? { $n = $_.FullName; $t = $false; gc $_ |% {$t = $t -or $_.Contains("stringtofind")}; if($t) {$n} }
Seems to do the trick!
Thanks Jason Turnage!!! :)
gci -include *.txt *.* |? { $n = $_.FullName; $t = $false; gc $_ |% {$t = $t -or $_.Contains("stringtofind")}; if($t) {$n} }
Seems to do the trick!
Thanks Jason Turnage!!! :)
Tuesday, January 13, 2009
Failed to create a CLSID_BizTalkPropertyBagFactory
Was getting this message, "Failed to create a CLSID_BizTalkPropertyBagFactory" when trying to refresh the Group Overview screen in the BizTalk 2006 Administration Console.
What was the answer? Restart the Windows Management Instrumentation service.
Thanks to Michael Stephenson's blog for the answer...
http://geekswithblogs.net/michaelstephenson/archive/2007/09/01/115103.aspx
What was the answer? Restart the Windows Management Instrumentation service.
Thanks to Michael Stephenson's blog for the answer...
http://geekswithblogs.net/michaelstephenson/archive/2007/09/01/115103.aspx
Subscribe to:
Posts (Atom)