Friday, October 22, 2010

Solaris Commands Reference

to check mem
mdb -k
::memstat


Samba

to check is the Samba service is running
# svcs | grep samba
View state of samba
# svcs samba wins 
 
Stop samba 
# svcadm disable svc:/network/samba
# svcadm disable svc:/network/wins
 
Start samba
# svcadm enable svc:/network/samba
# svcadm enable svc:/network/wins

Monday, October 18, 2010

Server Application Unavailable in XP IIS

Server Application Unavailable in XP IIS

I google this problem for a while and find out that answers can be variable.
so i list some solution found in net.

if you interest to have a quick view about skeleton  and how is app pool works in iis
go here.

When this issue were happen take look to iis log may found some clue.

some solutions that people who finally solved they problems here:


Reinstall dot net for iis
c:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe
  1. Open a command prompt
  2. Stop IIS: iisreset /stop
  3. Change to the .NET Framework 2.0 root directory: C:\winnt\Microsoft.Net\Framework\v2.0.50727\
  4. Reinstall ASP.NET 2.0 : aspnet_regiis -i .
  5. Start IIS again after it has been run: iisreset /start

IIS had not been granted write permissions on the log directory in C:\Windows\System32\Logfiles! I gave IUSR_, IWAM_ and ASPNET write permissions on that directory.

I used aspnet_regiis -ga domain\processusername
This resolved the issue listed above by authorising the ASP.NET process defined in the Machine.config to the IIS Metadata.

Virtual dir  Files copy may cause a permission problem, make sure files in virtual dir haveproper proper permission in this two accounts IUSR_xxxx and IWAM_xxxx 

Wednesday, October 13, 2010

GPRS and MMS Setup for Android

從目錄進入"設定"=>網際網路設定=>選擇WAP(GPRS)設定或者是MMS(多媒體訊息設定)

台哥大GPRS
設定組名稱:TCC
IP地址:010.001.001.002
首頁:http://ewap
連結埠:9201
電路提示:停止
連結網路類型LGPRS
GPRS設定:APN:mms
帳號:wap
密碼:wap
延遲時間:300秒
CSD設定:
電話號碼:+886935120120
連結類型:ISDN
帳號:wap
密碼:wap
延遲時間:300秒

台哥大MMS
設定組名稱:TCCMMS
IP地址:010.001.001.002
訊息伺服器位址:http://mms
連接埠:9201
連結網路類型:GPRS
GPRS設定:APN:mms
帳號:wap
密碼:wap
延遲時間:300秒
CSD:
電話類型:+886935120120
連結類型:ISDN
帳號:mms
密碼:mms
延遲時間:300秒



中華GPRS
設定組名稱:emome
IP地址:010.001.001.001
首頁:http://wap.emome.net
連接埠:9201
電路提示:停止
連結網路類型:GPRS
GPRS設定:APN:emome
帳號/密碼:空白
延遲時間:180秒
CSD設定:跳過不設

中華MMS
設定組名稱:CHTMMS
IP地址:010.001.001.001
訊息伺服器位址:
http://mms.emome.net:8002
連接埠:9201
連接網路類型:GPRS
GPRS設定:APN:emome
帳號密碼:空白
延遲時間:180秒
CSD:跳過不設

記得設定完之後要儲存,
儲存之後要記的啟動,才可以正常運作
還有要記得打去中華或者是台哥大的客服人員說要開通GPRS喔

Monday, October 4, 2010

DateTime and Number Format in C#

int intNum = 13; 
String.Format("{0:d4}", intNum);          // "0013"
intNum.ToString("D4");                    // "0013"

Decimal
// fixed two decimal part

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"
// maximum two decimal part
String.Format("{0:0.##}", 123.4567);      // "123.46"
String.Format("{0:0.##}", 123.4);         // "123.4"

String.Format("{0:0.##}", 123.0);         // "123"
// at least two digits at integer part
String.Format("{0:00.0}", 123.4567);      // "123.5"
String.Format("{0:00.0}", 1.4567);        // "01.5"

String.Format("{0:00.0}", -1.4456);       // "-03.4"
// Align numbers with spaces
// To align numbers to the left use negative number of spaces
String.Format("{0,10:0.0}", 123.4567);    // "     123.5"
String.Format("{0,-10:0.0}", 123.4567);   // "123.5     "
String.Format("{0,10:0.0}", -123.4567);   // "    -123.5"

String.Format("{0,-10:0.0}", -123.4567);  // "-123.5    "

Currency
123.456 ("C3", en-US) -> ($123.456)
-123.456 ("C3", fr-FR) -> -123,456 €
-123.456 ("C3", ja-JP) -> -¥123.456

Decimal

1234 ("D") -> 1234
-1234 ("D6") -> -001234

Fixed-point

1234 ("F1", en-US) -> 1234.0
1234 ("F1", en-US) -> 1234.0


General
-123.456 ("G", en-US) -> -123.456
-1.234567890e-25 ("G", sv-SE) -> -1,23456789E-25


Number
1234.567 ("N", en-US) -> 1,234.57
1234 ("N", en-US) -> 1,234.0


Percent
1 ("P", en-US) -> 100.00 %
-0.39678 ("P1", en-US) -> -39.7 %


Round-trip
123456789.12345678 ("R") -> 123456789.12345678
-1234567890.12345678 ("R") -> -1234567890.1234567


Hexadecimal
255 ("X") -> FF
-1 ("x") -> ff
255 ("x4") -> 00ff
-1 ("X4") -> 00FF


 
 
DateTime.ToString() Patterns
 
ddd, dd MMM yyyy HH':'mm':'ss 'GMT'      Tue, 22 Aug 2006 06:30:07 GM
dddd, dd MMMM yyyy HH:mm:ss              Tuesday, 22 August 2006 06:30:07

yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK   2006-08-22T06:30:07.7199222-04:00 


// create date time 2008-03-09 16:05:07.123
DateTime dt = new DateTime(2008, 3, 9, 16, 5, 7, 123);
String.Format("{0:y yy yyy yyyy}", dt);  // "8 08 008 2008"   year
String.Format("{0:M MM MMM MMMM}", dt);  // "3 03 Mar March"  month
String.Format("{0:d dd ddd dddd}", dt);  // "9 09 Sun Sunday" day
String.Format("{0:h hh H HH}",     dt);  // "4 04 16 16"      hour 12/24
String.Format("{0:m mm}",          dt);  // "5 05"            minute
String.Format("{0:s ss}",          dt);  // "7 07"            second
String.Format("{0:f ff fff ffff}", dt);  // "1 12 123 1230"   sec.fraction
String.Format("{0:F FF FFF FFFF}", dt);  // "1 12 123 123"    without zeroes
String.Format("{0:t tt}",          dt);  // "P PM"            A.M. or P.M.
String.Format("{0:z zz zzz}",      dt);  // "-6 -06 -06:00"   time zone
String.Format("{0:d/M/yyyy HH:mm:ss}", dt); // "9/3/2008 16:05:07" - english (en-US)
String.Format("{0:d/M/yyyy HH:mm:ss}", dt); // "9.3.2008 16:05:07" - german (de-DE)

// month/day numbers without/with leading zeroes
String.Format("{0:M/d/yyyy}", dt);            // "3/9/2008"
String.Format("{0:MM/dd/yyyy}", dt);          // "03/09/2008"

// day/month names
String.Format("{0:ddd, MMM d, yyyy}", dt);    // "Sun, Mar 9, 2008"
String.Format("{0:dddd, MMMM d, yyyy}", dt);  // "Sunday, March 9, 2008"

// two/four digit year
String.Format("{0:MM/dd/yy}", dt);            // "03/09/08"
String.Format("{0:MM/dd/yyyy}", dt);          // "03/09/2008" 
 
String.Format("{0:t}", dt);  // "4:05 PM"                         ShortTime
String.Format("{0:d}", dt);  // "3/9/2008"                        ShortDate
String.Format("{0:T}", dt);  // "4:05:07 PM"                      LongTime
String.Format("{0:D}", dt);  // "Sunday, March 09, 2008"          LongDate
String.Format("{0:f}", dt);  // "Sunday, March 09, 2008 4:05 PM"  LongDate+ShortTime
String.Format("{0:F}", dt);  // "Sunday, March 09, 2008 4:05:07 PM" FullDateTime
String.Format("{0:g}", dt);  // "3/9/2008 4:05 PM"                ShortDate+ShortTime
String.Format("{0:G}", dt);  // "3/9/2008 4:05:07 PM"             ShortDate+LongTime
String.Format("{0:m}", dt);  // "March 09"                        MonthDay
String.Format("{0:y}", dt);  // "March, 2008"                     YearMonth
String.Format("{0:r}", dt);  // "Sun, 09 Mar 2008 16:05:07 GMT"   RFC1123
String.Format("{0:s}", dt);  // "2008-03-09T16:05:07"             SortableDateTime
String.Format("{0:u}", dt);  // "2008-03-09 16:05:07Z"            UniversalSortableDateTime 


d Represents the day of the month as a number from 1 through 31. A single-digit day is formatted without a leading zero
dd Represents the day of the month as a number from 01 through 31. A single-digit day is formatted with a leading zero
ddd Represents the abbreviated name of the day of the week (Mon, Tues, Wed etc)
dddd Represents the full name of the day of the week (Monday, Tuesday etc)
h 12-hour clock hour (e.g. 7)
hh 12-hour clock, with a leading 0 (e.g. 07)
H 24-hour clock hour (e.g. 19)
HH 24-hour clock hour, with a leading 0 (e.g. 19)
m Minutes
mm Minutes with a leading zero
M Month number
MM Month number with leading zero
MMM Abbreviated Month Name (e.g. Dec)
MMMM Full month name (e.g. December)
s Seconds
ss Seconds with leading zero
t Abbreviated AM / PM (e.g. A or P)
tt AM / PM (e.g. AM or PM
y Year, no leading zero (e.g. 2001 would be 1)
yy Year, leadin zero (e.g. 2001 would be 01)
yyy Year, (e.g. 2001 would be 2001)
yyyy Year, (e.g. 2001 would be 2001)
K Represents the time zone information of a date and time value (e.g. +05:00)
z With DateTime values, represents the signed offset of the local operating system's time zone from Coordinated Universal Time (UTC), measured in hours. (e.g. +6)
zz As z but with leadin zero (e.g. +06)
zzz With DateTime values, represents the signed offset of the local operating system's time zone from UTC, measured in hours and minutes. (e.g. +06:00)
f Represents the most significant digit of the seconds fraction; that is, it represents the tenths of a second in a date and time value.
ff Represents the two most significant digits of the seconds fraction; that is, it represents the hundredths of a second in a date and time value.
fff Represents the three most significant digits of the seconds fraction; that is, it represents the milliseconds in a date and time value.
ffff Represents the four most significant digits of the seconds fraction; that is, it represents the ten thousandths of a second in a date and time value. While it is possible to display the ten thousandths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On Windows NT 3.5 and later, and Windows Vista operating systems, the clock's resolution is approximately 10-15 milliseconds.
fffff Represents the five most significant digits of the seconds fraction; that is, it represents the hundred thousandths of a second in a date and time value. While it is possible to display the hundred thousandths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On Windows NT 3.5 and later, and Windows Vista operating systems, the clock's resolution is approximately 10-15 milliseconds.
ffffff Represents the six most significant digits of the seconds fraction; that is, it represents the millionths of a second in a date and time value. While it is possible to display the millionths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On Windows NT 3.5 and later, and Windows Vista operating systems, the clock's resolution is approximately 10-15 milliseconds.
fffffff Represents the seven most significant digits of the seconds fraction; that is, it represents the ten millionths of a second in a date and time value. While it is possible to display the ten millionths of a second component of a time value, that value may not be meaningful. The precision of date and time values depends on the resolution of the system clock. On Windows NT 3.5 and later, and Windows Vista operating systems, the clock's resolution is approximately 10-15 milliseconds.
F Represents the most significant digit of the seconds fraction; that is, it represents the tenths of a second in a date and time value. Nothing is displayed if the digit is zero.
: Represents the time separator defined in the current DateTimeFormatInfo..::.TimeSeparator property. This separator is used to differentiate hours, minutes, and seconds.
/ Represents the date separator defined in the current DateTimeFormatInfo..::.DateSeparator property. This separator is used to differentiate years, months, and days.
" Represents a quoted string (quotation mark). Displays the literal value of any string between two quotation marks ("). Your application should precede each quotation mark with an escape character (\).
' Represents a quoted string (apostrophe). Displays the literal value of any string between two apostrophe (') characters.
%c Represents the result associated with a c custom format specifier, when the custom date and time format string consists solely of that custom format specifier. That is, to use the d, f, F, h, m, s, t, y, z, H, or M custom format specifier by itself, the application should specify %d, %f, %F, %h, %m, %s, %t, %y, %z, %H, or %M. For more information about using a single format specifier, see Using Single Custom Format Specifiers.
 

Related Link
http://www.csharp-examples.net/string-format-double/