bcoder

10月 252013
 

Delphi version: Delphi2010

1. SysUtils

//检查当前系统版本,如果当前系统版本大于等于AMajor.AMinor则返回true
function CheckWin32Version(AMajor: Integer; AMinor: Integer = 0): Boolean;
//获取文件版本
function GetFileVersion(const AFileName: string): Cardinal;
//将字符串转换为大写
function UpperCase(const S: string): string; overload;
function UpperCase(const S: string; LocaleOptions: TLocaleOptions): string; overload;
//将字符串转换为小写
function LowerCase(const S: string): string; overload;
function LowerCase(const S: string; LocaleOptions: TLocaleOptions): string; overload;
//比较两个字符串s1和s2,大小写第三,如果s1<s2返回小于0的值,如果s1=s2返回0,如果s1>s2返回大于0的值
function CompareStr(const S1, S2: string): Integer; overload;
function CompareStr(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;
//判断两个字符串是否相等,大小写敏感,相等返回true,不相等返回false
function SameStr(const S1, S2: string): Boolean; overload;
function SameStr(const S1, S2: string; LocaleOptions: TLocaleOptions): Boolean; overload;
//比较p1和p2所指向的指定长度的内存,相等返回true,不相等返回false
function CompareMem(P1, P2: Pointer; Length: Integer): Boolean; assembler;
//比较两个字符串s1和s2,大小写不敏感,所有小写字母被转换为大写字母,如果s1<s2返回小于0的值,如果s1=s2返回0,如果s1>s2返回大于0的值
function CompareText(const S1, S2: string): Integer; overload;
function CompareText(const S1, S2: string; LocaleOptions: TLocaleOptions): Integer; overload;

//比较s1和s2是否相等,大小写不敏感,如果相等返回true,不相等返回false

function SameText(const S1, S2: string): Boolean; overload;
function SameText(const S1, S2: string; LocaleOptions: TLocaleOptions): Boolean; overload;

//

function AnsiUpperCase(const S: string): string; overload;
function AnsiLowerCase(const S: string): string; overload;
function AnsiCompareStr(const S1, S2: string): Integer; overload;
function AnsiSameStr(const S1, S2: string): Boolean; inline; overload;
function AnsiCompareText(const S1, S2: string): Integer; overload;
function AnsiSameText(const S1, S2: string): Boolean; inline; overload;
function AnsiStrComp(S1, S2: PAnsiChar): Integer; inline; overload;
function AnsiStrComp(S1, S2: PWideChar): Integer; inline; overload;
function AnsiStrIComp(S1, S2: PAnsiChar): Integer; inline; overload;
function AnsiStrIComp(S1, S2: PWideChar): Integer; inline; overload;
function AnsiStrLComp(S1, S2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function AnsiStrLComp(S1, S2: PWideChar; MaxLen: Cardinal): Integer; inline; overload;
function AnsiStrLIComp(S1, S2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function AnsiStrLIComp(S1, S2: PWideChar; MaxLen: Cardinal): Integer; inline; overload;
function AnsiStrLower(Str: PAnsiChar): PAnsiChar; overload;
function AnsiStrLower(Str: PWideChar): PWideChar; inline; overload;
function AnsiStrUpper(Str: PAnsiChar): PAnsiChar; overload;
function AnsiStrUpper(Str: PWideChar): PWideChar; inline; overload;
function AnsiLastChar(const S: AnsiString): PAnsiChar; overload;
function AnsiLastChar(const S: UnicodeString): PWideChar; overload;
function AnsiStrLastChar(P: PAnsiChar): PAnsiChar; overload;
function AnsiStrLastChar(P: PWideChar): PWideChar; overload;
function WideUpperCase(const S: WideString): WideString;
function WideLowerCase(const S: WideString): WideString;
function WideCompareStr(const S1, S2: WideString): Integer;
function WideSameStr(const S1, S2: WideString): Boolean; inline;
function WideCompareText(const S1, S2: WideString): Integer;
function WideSameText(const S1, S2: WideString): Boolean; inline;

//去掉头尾空格的函数

function Trim(const S: string): string; overload;
function TrimLeft(const S: string): string; overload;
function TrimRight(const S: string): string; overload;

//在字符串S的头和尾加上单引号

function QuotedStr(const S: string): string; overload;

//在字符串S的头和尾加上Quote,例如AnsiQuotedStr(‘b’, ‘c’)=cbc

function AnsiQuotedStr(const S: string; Quote: Char): string; overload;

//

function AnsiExtractQuotedStr(var Src: PAnsiChar; Quote: AnsiChar): AnsiString; overload;
function AnsiExtractQuotedStr(var Src: PWidechar; Quote: WideChar): UnicodeString; overload;

//如果S以AQuote开始和结尾,则去掉开始和结尾的AQuote,如果不是返回原字符串

function AnsiDequotedStr(const S: string; AQuote: Char): string; overload;

//将字符串中的换行符格式为指定的格式

function AdjustLineBreaks(const S: string; Style: TTextLineBreakStyle =
{$IFDEF LINUX} tlbsLF {$ENDIF}
{$IFDEF MACOSX} tlbsLF {$ENDIF}
{$IFDEF MSWINDOWS} tlbsCRLF {$ENDIF}): string; overload;

//

function IsValidIdent(const Ident: string; AllowDots: Boolean = False): Boolean;

//将整数型转换为字符串类型

function IntToStr(Value: Integer): string; overload;
function IntToStr(Value: Int64): string; overload;

//将无符号整数转换为字符串

function UIntToStr(Value: Cardinal): string; overload;
function UIntToStr(Value: UInt64): string; overload;

//将一个整数转换为十六进制字符串,Digits为最少显示多少位字符

function IntToHex(Value: Integer; Digits: Integer): string; overload;
function IntToHex(Value: Int64; Digits: Integer): string; overload;

//将一个字符串转换为整数,StrToIntDef中如果S为非整数格式字符串则返回Default

function StrToInt(const S: string): Integer; overload;
function StrToIntDef(const S: string; Default: Integer): Integer; overload;
function TryStrToInt(const S: string; out Value: Integer): Boolean; overload;

//将字符串转换为int64类型整数

function StrToInt64(const S: string): Int64; overload;
function StrToInt64Def(const S: string; const Default: Int64): Int64; overload;
function TryStrToInt64(const S: string; out Value: Int64): Boolean; overload;

//字符串类型转换为布尔类型

function StrToBool(const S: string): Boolean; overload;
function StrToBoolDef(const S: string; const Default: Boolean): Boolean; overload;
function TryStrToBool(const S: string; out Value: Boolean): Boolean; overload;

//从可执行程序的资源文件中根据Ident标识加载字符串

function LoadStr(Ident: Integer): string;

//从资源文件中加载字符串,并进行格式化操作

function FmtLoadStr(Ident: Integer; const Args: array of const): string;

//

function FileOpen(const FileName: string; Mode: LongWord): Integer;
function FileCreate(const FileName: string): Integer; overload; inline;
function FileCreate(const FileName: string; Rights: Integer): Integer; overload; inline;
function FileCreate(const FileName: string; Mode: LongWord; Rights: Integer): Integer; overload;
function FileRead(Handle: Integer; var Buffer; Count: LongWord): Integer;
function FileWrite(Handle: Integer; const Buffer; Count: LongWord): Integer;
function FileSeek(Handle, Offset, Origin: Integer): Integer; overload;
function FileSeek(Handle: Integer; const Offset: Int64; Origin: Integer): Int64; overload;
procedure FileClose(Handle: Integer); inline;
function FileAge(const FileName: string): Integer; overload; deprecated;
function FileExists(const FileName: string): Boolean;
function DirectoryExists(const Directory: string): Boolean;
function ForceDirectories(Dir: string): Boolean;

//
function FindFirst(const Path: string; Attr: Integer;var F: TSearchRec): Integer;
function FindNext(var F: TSearchRec): Integer;
procedure FindClose(var F: TSearchRec);
function FileGetDate(Handle: Integer): Integer;
function FileSetDate(const FileName: string; Age: Integer): Integer; overload;
function FileSetDate(Handle: Integer; Age: Integer): Integer; overload; platform;
function FileGetAttr(const FileName: string): Integer; platform;
function FileSetAttr(const FileName: string; Attr: Integer): Integer; platform; 
function FileIsReadOnly(const FileName: string): Boolean; inline;
function FileSetReadOnly(const FileName: string; ReadOnly: Boolean): Boolean;
function DeleteFile(const FileName: string): Boolean; inline;
function RenameFile(const OldName, NewName: string): Boolean; inline;
{ IsAssembly returns a boolean value that indicates whether the specified file is a .NET assembly. }
function IsAssembly(const FileName: string): Boolean;
function ChangeFileExt(const FileName, Extension: string): string; overload;
function ChangeFilePath(const FileName, Path: string): string; overload;
function ExtractFilePath(const FileName: string): string; overload;
function ExtractFileDir(const FileName: string): string; overload;
function ExtractFileDrive(const FileName: string): string; overload;
function ExtractFileName(const FileName: string): string; overload;
//获取文件的扩展名
function ExtractFileExt(const FileName: string): string; overload;
//将相对路径表示的文件名转换成绝对路径表示的文件名
function ExpandFileName(const FileName: string): string; overload;
function ExpandFileNameCase(const FileName: string; out MatchFound: TFilenameCaseMatch): string; overload;
function ExpandUNCFileName(const FileName: string): string; overload;
function ExtractRelativePath(const BaseName, DestName: string): string; overload;
function ExtractShortPathName(const FileName: string): string; overload;
function FileSearch(const Name, DirList: string): string;
function DiskFree(Drive: Byte): Int64;
function DiskSize(Drive: Byte): Int64;

//

function FileDateToDateTime(FileDate: Integer): TDateTime;
function DateTimeToFileDate(DateTime: TDateTime): Integer;
function GetCurrentDir: string;
function SetCurrentDir(const Dir: string): Boolean;
function CreateDir(const Dir: string): Boolean;
function RemoveDir(const Dir: string): Boolean;
//
function StrLen(const Str: PAnsiChar): Cardinal; overload;
function StrLen(const Str: PWideChar): Cardinal; overload;
function StrEnd(const Str: PAnsiChar): PAnsiChar; overload;
function StrEnd(const Str: PWideChar): PWideChar; overload;
function StrMove(Dest: PAnsiChar; const Source: PAnsiChar; Count: Cardinal): PAnsiChar; overload;
function StrMove(Dest: PWideChar; const Source: PWideChar; Count: Cardinal): PWideChar; overload;
function StrCopy(Dest: PAnsiChar; const Source: PAnsiChar): PAnsiChar; overload;
function StrCopy(Dest: PWideChar; const Source: PWideChar): PWideChar; overload;
function StrECopy(Dest: PAnsiChar; const Source: PAnsiChar): PAnsiChar; overload;
function StrECopy(Dest: PWideChar; const Source: PWideChar): PWideChar; overload;
function StrLCopy(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): PAnsiChar; overload;
function StrLCopy(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar; overload;
function StrPCopy(Dest: PAnsiChar; const Source: AnsiString): PAnsiChar; overload;
function StrPCopy(Dest: PWideChar; const Source: UnicodeString): PWideChar; overload;
function StrPLCopy(Dest: PAnsiChar; const Source: AnsiString;
MaxLen: Cardinal): PAnsiChar; overload;
function StrPLCopy(Dest: PWideChar; const Source: UnicodeString;
MaxLen: Cardinal): PWideChar; overload;
function StrCat(Dest: PAnsiChar; const Source: PAnsiChar): PAnsiChar; overload;
function StrCat(Dest: PWideChar; const Source: PWideChar): PWideChar; overload;
function StrLCat(Dest: PAnsiChar; const Source: PAnsiChar; MaxLen: Cardinal): PAnsiChar; overload;
function StrLCat(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar; overload;
function StrComp(const Str1, Str2: PAnsiChar): Integer; overload;
function StrComp(const Str1, Str2: PWideChar): Integer; overload;
function StrIComp(const Str1, Str2: PAnsiChar): Integer; overload;
function StrIComp(const Str1, Str2: PWideChar): Integer; overload;
function StrLComp(const Str1, Str2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function StrLComp(const Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; overload;
function StrLIComp(const Str1, Str2: PAnsiChar; MaxLen: Cardinal): Integer; overload;
function StrLIComp(const Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; overload;
function StrScan(const Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function StrScan(const Str: PWideChar; Chr: WideChar): PWideChar; overload;
function StrRScan(const Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function StrRScan(const Str: PWideChar; Chr: WideChar): PWideChar; overload;
function TextPos(Str, SubStr: PAnsiChar): PAnsiChar; overload;
function TextPos(Str, SubStr: PWideChar): PWideChar; overload;
function StrPos(const Str1, Str2: PAnsiChar): PAnsiChar; overload;
function StrPos(const Str1, Str2: PWideChar): PWideChar; overload;
function StrUpper(Str: PAnsiChar): PAnsiChar; overload;
function StrUpper(Str: PWideChar): PWideChar; overload;
function StrLower(Str: PAnsiChar): PAnsiChar; overload;
function StrLower(Str: PWideChar): PWideChar; overload;
function StrPas(const Str: PAnsiChar): AnsiString; overload;
function StrPas(const Str: PWideChar): UnicodeString; overload;
function AnsiStrAlloc(Size: Cardinal): PAnsiChar;
function WideStrAlloc(Size: Cardinal): PWideChar;
function StrAlloc(Size: Cardinal): PChar;
function StrBufSize(const Str: PAnsiChar): Cardinal; overload;
function StrBufSize(const Str: PWideChar): Cardinal; overload;
function StrNew(const Str: PAnsiChar): PAnsiChar; overload;
function StrNew(const Str: PWideChar): PWideChar; overload;
procedure StrDispose(Str: PAnsiChar); overload;
procedure StrDispose(Str: PWideChar); overload;
//
function Format(const Format: string;
const Args: array of const): string; overload;
function Format(const Format: string; const Args: array of const;
const FormatSettings: TFormatSettings): string; overload;
procedure FmtStr(var Result: string; const Format: string;
const Args: array of const); overload;
procedure FmtStr(var Result: string; const Format: string;
const Args: array of const; const FormatSettings: TFormatSettings); overload;
function StrFmt(Buffer, Format: PAnsiChar;
const Args: array of const): PAnsiChar; overload;
function StrFmt(Buffer, Format: PAnsiChar; const Args: array of const;
const FormatSettings: TFormatSettings): PAnsiChar; overload;
function StrFmt(Buffer, Format: PWideChar;
const Args: array of const): PWideChar; overload;
function StrFmt(Buffer, Format: PWideChar; const Args: array of const;
const FormatSettings: TFormatSettings): PWideChar; overload;
function StrLFmt(Buffer: PAnsiChar; MaxBufLen: Cardinal; Format: PAnsiChar;
const Args: array of const): PAnsiChar; overload;
function StrLFmt(Buffer: PAnsiChar; MaxBufLen: Cardinal; Format: PAnsiChar;
const Args: array of const;
const FormatSettings: TFormatSettings): PAnsiChar; overload;
function StrLFmt(Buffer: PWideChar; MaxBufLen: Cardinal; Format: PWideChar;
const Args: array of const): PWideChar; overload;
function StrLFmt(Buffer: PWideChar; MaxBufLen: Cardinal; Format: PWideChar;
const Args: array of const;
const FormatSettings: TFormatSettings): PWideChar; overload;
function FormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
function FormatBuf(Buffer: PWideChar; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(var Buffer: UnicodeString; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function FormatBuf(Buffer: PWideChar; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
function FormatBuf(var Buffer: UnicodeString; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
function WideFormat(const Format: WideString;
const Args: array of const): WideString; overload;
function WideFormat(const Format: WideString;
const Args: array of const;
const FormatSettings: TFormatSettings): WideString; overload;
procedure WideFmtStr(var Result: WideString; const Format: WideString;
const Args: array of const); overload;
procedure WideFmtStr(var Result: WideString; const Format: WideString;
const Args: array of const; const FormatSettings: TFormatSettings); overload;
function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const): Cardinal; overload;
function WideFormatBuf(var Buffer; BufLen: Cardinal; const Format;
FmtLen: Cardinal; const Args: array of const;
const FormatSettings: TFormatSettings): Cardinal; overload;
//
function FloatToStr(Value: Extended): string; overload;
function FloatToStr(Value: Extended;
const FormatSettings: TFormatSettings): string; overload;
function CurrToStr(Value: Currency): string; overload;
function CurrToStr(Value: Currency;
const FormatSettings: TFormatSettings): string; overload;
function FloatToCurr(const Value: Extended): Currency;
function TryFloatToCurr(const Value: Extended; out AResult: Currency): Boolean;
function FloatToStrF(Value: Extended; Format: TFloatFormat;
Precision, Digits: Integer): string; overload;
function FloatToStrF(Value: Extended; Format: TFloatFormat;
Precision, Digits: Integer;
const FormatSettings: TFormatSettings): string; overload;
function CurrToStrF(Value: Currency; Format: TFloatFormat;
Digits: Integer): string; overload;
function CurrToStrF(Value: Currency; Format: TFloatFormat;
Digits: Integer; const FormatSettings: TFormatSettings): string; overload;
function FloatToText(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer): Integer; overload;
function FloatToText(BufferArg: PWideChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer): Integer; overload;
function FloatToText(BufferArg: PAnsiChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer;
const FormatSettings: TFormatSettings): Integer; overload;
function FloatToText(BufferArg: PWideChar; const Value; ValueType: TFloatValue;
Format: TFloatFormat; Precision, Digits: Integer;
const FormatSettings: TFormatSettings): Integer; overload;
function FormatFloat(const Format: string; Value: Extended): string; overload;
function FormatFloat(const Format: string; Value: Extended;
const FormatSettings: TFormatSettings): string; overload;
function FormatCurr(const Format: string; Value: Currency): string; overload;
function FormatCurr(const Format: string; Value: Currency;
const FormatSettings: TFormatSettings): string; overload;
function FloatToTextFmt(Buf: PAnsiChar; const Value; ValueType: TFloatValue;
Format: PAnsiChar): Integer; overload;
function FloatToTextFmt(Buf: PAnsiChar; const Value; ValueType: TFloatValue;
Format: PAnsiChar; const FormatSettings: TFormatSettings): Integer; overload;
function FloatToTextFmt(Buf: PWideChar; const Value; ValueType: TFloatValue;
Format: PWideChar): Integer; overload;
function FloatToTextFmt(Buf: PWideChar; const Value; ValueType: TFloatValue;
Format: PWideChar; const FormatSettings: TFormatSettings): Integer; overload;
function StrToFloat(const S: string): Extended; overload;
function StrToFloat(const S: string;
const FormatSettings: TFormatSettings): Extended; overload;
function StrToFloatDef(const S: string;
const Default: Extended): Extended; overload;
function StrToFloatDef(const S: string; const Default: Extended;
const FormatSettings: TFormatSettings): Extended; overload;
function TryStrToFloat(const S: string; out Value: Extended): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Extended;
const FormatSettings: TFormatSettings): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Double): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Double;
const FormatSettings: TFormatSettings): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Single): Boolean; overload;
function TryStrToFloat(const S: string; out Value: Single;
const FormatSettings: TFormatSettings): Boolean; overload;
function StrToCurr(const S: string): Currency; overload;
function StrToCurr(const S: string;
const FormatSettings: TFormatSettings): Currency; overload;
function StrToCurrDef(const S: string;
const Default: Currency): Currency; overload;
function StrToCurrDef(const S: string; const Default: Currency;
const FormatSettings: TFormatSettings): Currency; overload;
function TryStrToCurr(const S: string; out Value: Currency): Boolean; overload;
function TryStrToCurr(const S: string; out Value: Currency;
const FormatSettings: TFormatSettings): Boolean; overload;
function TextToFloat(Buffer: PAnsiChar; var Value;
ValueType: TFloatValue): Boolean; overload;
function TextToFloat(Buffer: PAnsiChar; var Value; ValueType: TFloatValue;
const FormatSettings: TFormatSettings): Boolean; overload;
function TextToFloat(Buffer: PWideChar; var Value;
ValueType: TFloatValue): Boolean; overload;
function TextToFloat(Buffer: PWideChar; var Value; ValueType: TFloatValue;
const FormatSettings: TFormatSettings): Boolean; overload;
function HashName(Name: PAnsiChar): Cardinal;
procedure FloatToDecimal(var Result: TFloatRec; const Value;
ValueType: TFloatValue; Precision, Decimals: Integer);
//
function DateTimeToTimeStamp(DateTime: TDateTime): TTimeStamp;
function TimeStampToDateTime(const TimeStamp: TTimeStamp): TDateTime;
function MSecsToTimeStamp(MSecs: Comp): TTimeStamp;
function TimeStampToMSecs(const TimeStamp: TTimeStamp): Comp;
function EncodeDate(Year, Month, Day: Word): TDateTime;
function EncodeTime(Hour, Min, Sec, MSec: Word): TDateTime;
function TryEncodeDate(Year, Month, Day: Word; out Date: TDateTime): Boolean;
function TryEncodeTime(Hour, Min, Sec, MSec: Word; out Time: TDateTime): Boolean;
procedure DecodeDate(const DateTime: TDateTime; var Year, Month, Day: Word);
function DecodeDateFully(const DateTime: TDateTime; var Year, Month, Day,
DOW: Word): Boolean;
procedure DecodeTime(const DateTime: TDateTime; var Hour, Min, Sec, MSec: Word);
procedure DateTimeToSystemTime(const DateTime: TDateTime; var SystemTime: TSystemTime);
function SystemTimeToDateTime(const SystemTime: TSystemTime): TDateTime;
function DayOfWeek(const DateTime: TDateTime): Word;
function Date: TDateTime;
function Time: TDateTime;
function GetTime: TDateTime;
function Now: TDateTime;
function CurrentYear: Word;
function IncMonth(const DateTime: TDateTime; NumberOfMonths: Integer = 1): TDateTime;
procedure IncAMonth(var Year, Month, Day: Word; NumberOfMonths: Integer = 1);
procedure ReplaceTime(var DateTime: TDateTime; const NewTime: TDateTime);
procedure ReplaceDate(var DateTime: TDateTime; const NewDate: TDateTime);
function IsLeapYear(Year: Word): Boolean;
function DateToStr(const DateTime: TDateTime): string; overload; inline;
function DateToStr(const DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload; inline;
function TimeToStr(const DateTime: TDateTime): string; overload; inline;
function TimeToStr(const DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload; inline;
function DateTimeToStr(const DateTime: TDateTime): string; overload; inline;
function DateTimeToStr(const DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload; inline;
function StrToDate(const S: string): TDateTime; overload;
function StrToDate(const S: string;
const FormatSettings: TFormatSettings): TDateTime; overload;
function StrToDateDef(const S: string;
const Default: TDateTime): TDateTime; overload;
function StrToDateDef(const S: string; const Default: TDateTime;
const FormatSettings: TFormatSettings): TDateTime; overload;
function TryStrToDate(const S: string; out Value: TDateTime): Boolean; overload;
function TryStrToDate(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean; overload;
function StrToTime(const S: string): TDateTime; overload;
function StrToTime(const S: string;
const FormatSettings: TFormatSettings): TDateTime; overload;
function StrToTimeDef(const S: string;
const Default: TDateTime): TDateTime; overload;
function StrToTimeDef(const S: string; const Default: TDateTime;
const FormatSettings: TFormatSettings): TDateTime; overload;
function TryStrToTime(const S: string; out Value: TDateTime): Boolean; overload;
function TryStrToTime(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean; overload;
function StrToDateTime(const S: string): TDateTime; overload;
function StrToDateTime(const S: string;
const FormatSettings: TFormatSettings): TDateTime; overload;
function StrToDateTimeDef(const S: string;
const Default: TDateTime): TDateTime; overload;
function StrToDateTimeDef(const S: string; const Default: TDateTime;
const FormatSettings: TFormatSettings): TDateTime; overload;
function TryStrToDateTime(const S: string;
out Value: TDateTime): Boolean; overload;
function TryStrToDateTime(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean; overload;
function FormatDateTime(const Format: string;
DateTime: TDateTime): string; overload; inline;
function FormatDateTime(const Format: string; DateTime: TDateTime;
const FormatSettings: TFormatSettings): string; overload;
procedure DateTimeToString(var Result: string; const Format: string;
DateTime: TDateTime); overload;
procedure DateTimeToString(var Result: string; const Format: string;
DateTime: TDateTime; const FormatSettings: TFormatSettings); overload;
function FloatToDateTime(const Value: Extended): TDateTime;
function TryFloatToDateTime(const Value: Extended; out AResult: TDateTime): Boolean;
//
function SysErrorMessage(ErrorCode: Cardinal): string;
function GetLocaleStr(Locale, LocaleType: Integer; const Default: string): string; platform;
function GetLocaleChar(Locale, LocaleType: Integer; Default: Char): Char; platform;
procedure GetFormatSettings;
procedure GetLocaleFormatSettings(LCID: Integer;
var FormatSettings: TFormatSettings);
//
function GetModuleName(Module: HMODULE): string;
function ExceptionErrorMessage(ExceptObject: TObject; ExceptAddr: Pointer;
Buffer: PChar; Size: Integer): Integer;
procedure ShowException(ExceptObject: TObject; ExceptAddr: Pointer);
procedure Abort;
procedure OutOfMemoryError;
procedure Beep; inline;
// MBCS functions
function ByteType(const S: AnsiString; Index: Integer): TMbcsByteType; overload;
function ByteType(const S: UnicodeString; Index: Integer): TMbcsByteType; overload;
function StrByteType(Str: PAnsiChar; Index: Cardinal): TMbcsByteType; overload;
function StrByteType(Str: PWideChar; Index: Cardinal): TMbcsByteType; overload;
function ByteToCharLen(const S: AnsiString; MaxLen: Integer): Integer; overload; inline;
function ByteToCharLen(const S: UnicodeString; MaxLen: Integer): Integer; overload; inline; deprecated ‘Use ElementToCharLen.’;
function ElementToCharLen(const S: AnsiString; MaxLen: Integer): Integer; overload;
function ElementToCharLen(const S: UnicodeString; MaxLen: Integer): Integer; overload;
function CharToByteLen(const S: AnsiString; MaxLen: Integer): Integer; overload; inline;
function CharToByteLen(const S: UnicodeString; MaxLen: Integer): Integer; overload; inline; deprecated ‘Use CharToElementLen.’;
function CharToElementLen(const S: AnsiString; MaxLen: Integer): Integer; overload;
function CharToElementLen(const S: UnicodeString; MaxLen: Integer): Integer; overload;
function ByteToCharIndex(const S: AnsiString; Index: Integer): Integer; overload; inline;
function ByteToCharIndex(const S: UnicodeString; Index: Integer): Integer; overload; inline; deprecated ‘Use ElementToCharIndex.’;
function ElementToCharIndex(const S: AnsiString; Index: Integer): Integer; overload;
function ElementToCharIndex(const S: UnicodeString; Index: Integer): Integer; overload;
function CharToByteIndex(const S: AnsiString; Index: Integer): Integer; overload; inline;
function CharToByteIndex(const S: UnicodeString; Index: Integer): Integer; overload; inline; deprecated ‘Use CharToElementIndex.’;
function CharToElementIndex(const S: AnsiString; Index: Integer): Integer; overload;
function CharToElementIndex(const S: UnicodeString; Index: Integer): Integer; overload;
function StrCharLength(const Str: PAnsiChar): Integer; overload;
function StrCharLength(const Str: PWideChar): Integer; overload;
function StrNextChar(const Str: PAnsiChar): PAnsiChar; inline; overload;
function StrNextChar(const Str: PWideChar): PWideChar; overload;
function CharLength(const S: AnsiString; Index: Integer): Integer; overload;
function CharLength(const S: UnicodeString; Index: Integer): Integer; overload;
function NextCharIndex(const S: UnicodeString; Index: Integer): Integer; overload;
function NextCharIndex(const S: AnsiString; Index: Integer): Integer; overload;
function IsLeadChar(C: AnsiChar): Boolean; overload; inline;
function IsLeadChar(C: WideChar): Boolean; overload; inline;
function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean; overload; inline;
function CharInSet(C: WideChar; const CharSet: TSysCharSet): Boolean; overload; inline;
function IsPathDelimiter(const S: string; Index: Integer): Boolean; overload;
function IsDelimiter(const Delimiters, S: string; Index: Integer): Boolean; overload;
function IncludeTrailingPathDelimiter(const S: string): string; overload;
function IncludeTrailingBackslash(const S: string): string; platform; overload; inline;
function ExcludeTrailingPathDelimiter(const S: string): string; overload;
function ExcludeTrailingBackslash(const S: string): string; platform; overload; inline;
function LastDelimiter(const Delimiters, S: string): Integer; overload;
function FindDelimiter(const Delimiters, S: string; StartIdx: Integer = 1): Integer;
function AnsiCompareFileName(const S1, S2: string): Integer; inline; overload;
function SameFileName(const S1, S2: string): Boolean; inline; overload;
function AnsiLowerCaseFileName(const S: string): string; overload;
function AnsiUpperCaseFileName(const S: string): string; overload;
function AnsiPos(const Substr, S: string): Integer; overload;
function AnsiStrPos(Str, SubStr: PAnsiChar): PAnsiChar; overload;
function AnsiStrPos(Str, SubStr: PWideChar): PWideChar; overload;
function AnsiStrRScan(Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function AnsiStrRScan(Str: PWideChar; Chr: WideChar): PWideChar; inline; overload;
function AnsiStrScan(Str: PAnsiChar; Chr: AnsiChar): PAnsiChar; overload;
function AnsiStrScan(Str: PWideChar; Chr: WideChar): PWideChar; overload; inline;
function StringReplace(const S, OldPattern, NewPattern: string;
Flags: TReplaceFlags): string; overload;
function WrapText(const Line, BreakStr: string; const BreakChars: TSysCharSet;
MaxCol: Integer): string; overload;
function WrapText(const Line: string; MaxCol: Integer = 45): string; overload;
function FindCmdLineSwitch(const Switch: string; const Chars: TSysCharSet;
IgnoreCase: Boolean): Boolean; overload;
function FindCmdLineSwitch(const Switch: string): Boolean; overload;
function FindCmdLineSwitch(const Switch: string; IgnoreCase: Boolean): Boolean; overload;
procedure FreeAndNil(var Obj); inline;
// Interface support routines
function Supports(const Instance: IInterface; const IID: TGUID; out Intf): Boolean; overload;
function Supports(const Instance: TObject; const IID: TGUID; out Intf): Boolean; overload;
function Supports(const Instance: IInterface; const IID: TGUID): Boolean; overload;
function Supports(const Instance: TObject; const IID: TGUID): Boolean; overload;
function Supports(const AClass: TClass; const IID: TGUID): Boolean; overload;
function CreateGUID(out Guid: TGUID): HResult; stdcall;
function StringToGUID(const S: string): TGUID;
function GUIDToString(const GUID: TGUID): string;
function IsEqualGUID(const guid1, guid2: TGUID): Boolean; stdcall;
// Package support routines
function LoadPackage(const Name: string): HMODULE; overload;
function LoadPackage(const Name: string; AValidatePackage: TValidatePackageProc): HMODULE; overload;
procedure UnloadPackage(Module: HMODULE);
procedure GetPackageInfo(Module: HMODULE; Param: Pointer; var Flags: Integer;
InfoProc: TPackageInfoProc);
function GetPackageDescription(ModuleName: PChar): string;
procedure InitializePackage(Module: HMODULE); overload;
procedure InitializePackage(Module: HMODULE; AValidatePackage: TValidatePackageProc); overload;
procedure FinalizePackage(Module: HMODULE);
procedure RaiseLastOSError; overload;
procedure RaiseLastOSError(LastError: Integer); overload;
procedure RaiseLastWin32Error; deprecated ‘Use RaiseLastOSError’;
function Win32Check(RetVal: BOOL): BOOL; platform;
//Termination procedure support
procedure AddTerminateProc(TermProc: TTerminateProc);
function CallTerminateProcs: Boolean;
function GDAL: LongWord;
procedure RCS;
procedure RPR;

 Posted by on 2013-10-25
10月 092013
 

  当我们在卸载程序或者更新安装程序时,我们需要先将运行的进程杀掉再进行安装或者卸载程序。NSIS本身并没有提供杀掉进程的脚本,但是有一个插件可以实现此功能,插件的名字叫KillProcDLL,插件下载地址为http://nsis.sourceforge.net/KillProcDLL_plug-in。插件的用法请参考插件页面所提供的内容。下面给出在安装包中的代码:

  • .onInit为安装程序启动时触发的事件,此处杀掉进程是防止更新安装时不能更新主程序的问题
  • .onInstFailed为安装失败时触发的事件,此处启动程序文件是为防止安装失败后本该运行着的程序因为前面被杀掉不能继续运行
  • un.onInit为初始化卸载过程时触发的事件,在此事件的对话框选Yes的时候,即确认要卸载的时候跳转到NoAbort并杀掉进程,选No的时候不做任何操作。

  本文中的方法仅供参考,在使用过程中请自行修改此脚本。

10月 072013
 

  刚才在开发的时候,突然不能改变工程的图标和版本等信息了,把dof文件删除掉也不起作用。后来想起来,原来在前几天把工程默认的引用的资源文件的代码去掉了{$R *.res},打开Project->View Source后,将{$R *.res}加到里面就可以了。如下所示:

Delphi版本:Delphi7

 Posted by on 2013-10-07
9月 172013
 

Delphi中读取Outlook的数据,代码如下:

 Form代码:

相关链接:
 Microsoft Outlook Constants
AppointmentItem Object Members
Items Members (Outlook)
Folders Property
Attachment Object Members
Application Object Members
ContactItem Object Members

PHP易犯错误整理

 分类:PHP 阅读 (774)  No Responses »
8月 182013
 

  1. 在子函数中引用全局变量,错误描述:在一个公共文件中定义了一个$dblink对象用于访问数据库,在另外一个文件FileA中require了这个公共文件,同时在FileA中定义了一个子函数GetUserId(),在此函数中需要访问数据库读取数据,访问数据库的时候直接使用了$dblink对象,发现根本取不到相应的数据,访问数据库不成功。

  后经gg搜索,明白了在子函数中是不能直接使用公共变量的,所以必须把$dblink对象传入这个函数中才可以使用,因此解决办法是把GetUserId()改为GetUserId($tmpdblink),再使用时把$dblink对象传入此函数。

  2. PHP中连接字符串时使用“+”操作符,PHP中的“+”操作符可用于数字型数据或者数组的操作,但是不能用于字符串的连接,所以一定要注意,因为很多其他的编程语言是用“+”进行连接字符串的,所以很容易书写错误。PHP中使用“.”来进行字符串连接。

  3. PHP写函数的时候,定义时传入的变量也要使用$以标识为变量。今天写了一个函数,定义时变量直接写的变量名字convertStatus(status),没加&,导致整个页面空白,经检查发现是这个问题,改正后convertStatus($status)问题解决。

  4. 在php文件中,引用了某个php文件(用require xxx.php),但是显示时此文件布局前面总是有一空行,用chrome和IE的开发人员工具查看,会有几个字符,但页面上没显示。经研究,是因为xxx.php文件使用的是Utf8有BOM格式,文件的前几个字节后置上utf8的标志,浏览器则把那几个字节认为了是字符来处理。

  处理方式:使用notepad++打开文件,选择格式-〉转为utf8无BOM格式,保存重新上传后问题解决。

  此问题也可能会在html或者其他网页格式文件中出现。

  5. PHP中使用多个连接的问题,使用相同配置的多个连接时,总会使用最后一个连接的DB

CSS易犯错误收集

 分类:CSS 阅读 (804)  No Responses »
8月 112013
 

1. 写子风格的时候,子风格和父风格之间无空格,如:#contactonline.co_row_comments{height: 120px;}这样是错误的,应该在#contactonline后加一空格

 Posted by on 2013-08-11

AlertDialog使用总结

 分类:Android, Java 阅读 (1,775)  No Responses »
5月 112013
 

  AlertDialog直接继承自Dialog类,可以用于显示确认提示框或者列表选择框,还可以用于显示有自定义布局的提示框,Android中内置的ProgressDialog、DatePickerDialog和TimePickerDialog都是继承自于该对象。

AlertDialog的创建

  AlertDialog的实例化函数是声明的protected的,所以不能直接通过new AlertDialog(context)来创建,而是要通过它的一个子类Builder来创建,AlertDialog的很多属性也是通过这个builder对象来实现的。

AlertDialog的区域

  AlertDialog从上到下共分3个区域,即标题区、内容区和控制按钮区。

  • 标题区用于显示提示框的标题,给用户简单提示此提示框是什么用途的。我们可以通过builder的setTitle方法来设置标题的内容。
  • 内容区可以放置详细的操作提示、信息提示或者选择列表,也可以使用自定义的Layout显示更为丰富的内容。
  • 按钮区用于放置操作按钮,最多可放置三个按钮,一个确定按钮,一个否定按钮,一个中性按钮,就如Windows程序中常见的“是、否和取消。我们可以通过setPositiveButton、setNegativeButton和setNeutralButton来设置三个按钮的显示内容和点击时的响应函数

在AlertDialog中显示一个选择列表

  AlertDialog.Builder提供了几种方法可以用于在内容区域显示一个可选择的列表框,这几种方法分别是setAdapter、setItems、setSingleChoiceItems、setMultiChoiceItems。

  • setItems(int itemsId, final OnClickListener listener)可以传入一个CharSequence数据或者一个数组资源R.array,但是此方法显示的列表的样式没办法改变,只能使用AlertDialog默认的样式,而且只能显示一列,数据只能是字符串类型。如果给后面的listener传入null值则点击列表的项目后窗口不会自动关闭。
  • setAdapter可以传入一个ListAdapter,开发者可以通过这个ListAdapter对象设计复杂的列表布局,以增加程序的可视化效果。
  • setSingleChoiceItems可以打开一个右侧带单选按钮的提示框,可接受CharSequence数组、资源数组、ListAdapter、Cursor对象,传入CharSequence数组、资源数组时右侧会显示一个单选按钮,传入ListAdapter时右侧无单选按钮,需要自己来实现单选按钮,Cursor未测试。当选择某项时,提示框不会自己关闭,而是要通过返回键或者下面的按钮来关闭提示框。
  • setMultiChoiceItems可以打开一个右侧带复选按钮的提示框,可接受CharSequence数组、资源数组、Cursor对象,不知道为什么没有支持ListAdapter。

AlertDialog中显示自定义部局

  当我们需要一个复杂的提示框的时候,我们可用自定义的Layout来填充到AlertDialog窗口中。这里主要用到的是Builder的setView方法。我们可以先用getLayoutInflater()或者getActivity().getLayoutInflater()来获取一个LayoutInflater对象,然后用View dlgV=inflater.inflate(R.layout.custom_dialog, null);得到一个View对象,然后再用setView方法将自定义部局填充到AlertDialog中。

  虽然我们可以在自定义部局中设计自己的标题和按钮,但我们仍然还可以使用setTitle和setPositiveButton等方法来使用AlertDialog中的标题栏和按钮。

  如果我们想将一个Activity转换成一个Dialog,并不需要再创建一个AlertDialog然后重新实现这些代码,只需要在AndroidManifest.xml中将Activity的Theme设置为Dialog样式的主题即可,如:

AlertDialog内容区域的优先级

  AlertDialog中详细提示信息和选择列表是不能同时显示的,几个方法的优先显示顺序为setMessage、setAdapter、setItems

Activity如何转换成Dialog

  当我们想把一个Activity转换成Dialog时,如果再建立一个AlertDialog或者DialogFragment来实现的话,很多代码都要进行修改,比如DialogFragment需要增加getActivity来实现对Activity的一些方法进行访问,也不支持设计时设置的android:onclick属性,需要在java代码中用setOnClickListener来执行单击事件,这样做起来相当的麻烦。

  那么比较简单的方法就是通过在AndroidManifest.xml中给该Activity设置一个Dialog使用的Theme来进行支持,这样做的缺点是如果使用的不是android的主题则需要自己写一个符合程序的主题。

 如何设置AlertDialog的样式

  我们需要先定义一个样式,在res/values/style.xml中定义一个MyAlertDialog的样式(此方法暂时不可用,设置效果总不是想要的效果,再研究后再发布过来)

  在代码中,创建builder的时候传入这个样式名称,如下:

点击此处下载AlertDialogTest代码

5月 082013
 

  如何使用:在Eclipse中,打开项目下的res\values目录,在values上右键,新建->Other->Android XML File,Resource Type那选择Values,输入文件的名字,如:mycolors,点“确定”,把下面表格中的文字复制到新建的文件中。在设计界面静态调用时为@color/blue,在java代码中为getResources().getColor(R.color.hotpink)

  因为页面复制过去的xml包含中文特殊字符,大家可以点击这里下载此xml文件 mycolors.xml

<?xml version=”1.0″ encoding=”utf-8″ ?>  
<resources>  
<color name=”white”>#ffffff</color><!–白色 –>  
<color name=”ivory”>#fffff0</color><!–象牙色 –>  
<color name=”lightyellow”>#ffffe0</color><!–亮黄色 –>  
<color name=”yellow”>#ffff00</color><!–黄色 –>  
<color name=”snow”>#fffafa</color><!–雪白色 –>  
<color name=”floralwhite”>#fffaf0</color><!–花白色 –>  
<color name=”lemonchiffon”>#fffacd</color><!–柠檬绸色 –>  
<color name=”cornsilk”>#fff8dc</color><!–米绸色 –>  
<color name=”seaShell”>#fff5ee</color><!–海贝色 –>  
<color name=”lavenderblush”>#fff0f5</color><!–淡紫红 –>  
<color name=”papayawhip”>#ffefd5</color><!–番木色 –>  
<color name=”blanchedalmond”>#ffebcd</color><!–白杏色 –>  
<color name=”mistyrose”>#ffe4e1</color><!–浅玫瑰色 –>  
<color name=”bisque”>#ffe4c4</color><!–桔黄色 –>  
<color name=”moccasin”>#ffe4b5</color><!–鹿皮色 –>  
<color name=”navajowhite”>#ffdead</color><!–纳瓦白 –>  
<color name=”peachpuff”>#ffdab9</color><!–桃色 –>  
<color name=”gold”>#ffd700</color><!–金色 –>  
<color name=”pink”>#ffc0cb</color><!–粉红色 –>  
<color name=”lightpink”>#ffb6c1</color><!–亮粉红色 –>  
<color name=”orange”>#ffa500</color><!–橙色 –>  
<color name=”lightsalmon”>#ffa07a</color><!–亮肉色 –>  
<color name=”darkorange”>#ff8c00</color><!–暗桔黄色 –>  
<color name=”coral”>#ff7f50</color><!–珊瑚色 –>  
<color name=”hotpink”>#ff69b4</color><!–热粉红色 –>  
<color name=”tomato”>#ff6347</color><!–西红柿色 –>  
<color name=”orangered”>#ff4500</color><!–红橙色 –>  
<color name=”deeppink”>#ff1493</color><!–深粉红色 –>  
<color name=”fuchsia”>#ff00ff</color><!–紫红色 –>  
<color name=”magenta”>#ff00ff</color><!–红紫色 –>  
<color name=”red”>#ff0000</color><!–红色 –>  
<color name=”oldlace”>#fdf5e6</color><!–老花色 –>  
<color name=”lightgoldenrodyellow”>#fafad2</color><!–亮金黄色 –>  
<color name=”linen”>#faf0e6</color><!–亚麻色 –>  
<color name=”antiquewhite”>#faebd7</color><!–古董白 –>  
<color name=”salmon”>#fa8072</color><!–鲜肉色 –>  
<color name=”ghostwhite”>#f8f8ff</color><!–幽灵白 –>  
<color name=”mintcream”>#f5fffa</color><!–薄荷色 –>  
<color name=”whitesmoke”>#f5f5f5</color><!–烟白色 –>  
<color name=”beige”>#f5f5dc</color><!–米色 –>  
<color name=”wheat”>#f5deb3</color><!–浅黄色 –>  
<color name=”sandybrown”>#f4a460</color><!–沙褐色 –>  
<color name=”azure”>#f0ffff</color><!–天蓝色 –>  
<color name=”honeydew”>#f0fff0</color><!–蜜色 –>  
<color name=”aliceblue”>#f0f8ff</color><!–艾利斯兰 –>  
<color name=”khaki”>#f0e68c</color><!–黄褐色 –>  
<color name=”lightcoral”>#f08080</color><!–亮珊瑚色 –>  
<color name=”palegoldenrod”>#eee8aa</color><!–苍麒麟色 –>  
<color name=”violet”>#ee82ee</color><!–紫罗兰色 –>  
<color name=”darksalmon”>#e9967a</color><!–暗肉色 –>  
<color name=”lavender”>#e6e6fa</color><!–淡紫色 –>  
<color name=”lightcyan”>#e0ffff</color><!–亮青色 –>  
<color name=”burlywood”>#deb887</color><!–实木色 –>  
<color name=”plum”>#dda0dd</color><!–洋李色 –>  
<color name=”gainsboro”>#dcdcdc</color><!–淡灰色 –>  
<color name=”crimson”>#dc143c</color><!–暗深红色 –>  
<color name=”palevioletred”>#db7093</color><!–苍紫罗兰色 –>  
<color name=”goldenrod”>#daa520</color><!–金麒麟色 –>  
<color name=”orchid”>#da70d6</color><!–淡紫色 –>  
<color name=”thistle”>#d8bfd8</color><!–蓟色 –>  
<color name=”lightgray”>#d3d3d3</color><!–亮灰色 –>  
<color name=”lightgrey”>#d3d3d3</color><!–亮灰色 –>  
<color name=”tan”>#d2b48c</color><!–茶色 –>  
<color name=”chocolate”>#d2691e</color><!–巧可力色 –>  
<color name=”peru”>#cd853f</color><!–秘鲁色 –>  
<color name=”indianred”>#cd5c5c</color><!–印第安红 –>  
<color name=”mediumvioletred”>#c71585</color><!–中紫罗兰色 –>  
<color name=”silver”>#c0c0c0</color><!–银色 –>  
<color name=”darkkhaki”>#bdb76b</color><!–暗黄褐色 –>  
<color name=”rosybrown”>#bc8f8f</color><!–褐玫瑰红 –>  
<color name=”mediumorchid”>#ba55d3</color><!–中粉紫色 –>  
<color name=”darkgoldenrod”>#b8860b</color><!–暗金黄色 –>  
<color name=”firebrick”>#b22222</color><!–火砖色 –>  
<color name=”powderblue”>#b0e0e6</color><!–粉蓝色 –>  
<color name=”lightsteelblue”>#b0c4de</color><!–亮钢兰色 –>  
<color name=”paleturquoise”>#afeeee</color><!–苍宝石绿 –>  
<color name=”greenyellow”>#adff2f</color><!–黄绿色 –>  
<color name=”lightblue”>#add8e6</color><!–亮蓝色 –>  
<color name=”darkgray”>#a9a9a9</color><!–暗灰色 –>  
<color name=”darkgrey”>#a9a9a9</color><!–暗灰色 –>  
<color name=”brown”>#a52a2a</color><!–褐色 –>  
<color name=”sienna”>#a0522d</color><!–赭色 –>  
<color name=”darkorchid”>#9932cc</color><!–暗紫色 –>  
<color name=”palegreen”>#98fb98</color><!–苍绿色 –>  
<color name=”darkviolet”>#9400d3</color><!–暗紫罗兰色 –>  
<color name=”mediumpurple”>#9370db</color><!–中紫色 –>  
<color name=”lightgreen”>#90ee90</color><!–亮绿色 –>  
<color name=”darkseagreen”>#8fbc8f</color><!–暗海兰色 –>  
<color name=”saddlebrown”>#8b4513</color><!–重褐色 –>  
<color name=”darkmagenta”>#8b008b</color><!–暗洋红 –>  
<color name=”darkred”>#8b0000</color><!–暗红色 –>  
<color name=”blueviolet”>#8a2be2</color><!–紫罗兰蓝色 –>  
<color name=”lightskyblue”>#87cefa</color><!–亮天蓝色 –>  
<color name=”skyblue”>#87ceeb</color><!–天蓝色 –>  
<color name=”gray”>#808080</color><!–灰色 –>  
<color name=”grey”>#808080</color><!–灰色 –>  
<color name=”olive”>#808000</color><!–橄榄色 –>  
<color name=”purple”>#800080</color><!–紫色 –>  
<color name=”maroon”>#800000</color><!–粟色 –>  
<color name=”aquamarine”>#7fffd4</color><!–碧绿色 –>  
<color name=”chartreuse”>#7fff00</color><!–黄绿色 –>  
<color name=”lawngreen”>#7cfc00</color><!–草绿色 –>  
<color name=”mediumslateblue”>#7b68ee</color><!–中暗蓝色 –>  
<color name=”lightslategray”>#778899</color><!–亮蓝灰 –>  
<color name=”lightslategrey”>#778899</color><!–亮蓝灰 –>  
<color name=”slategray”>#708090</color><!–灰石色 –>  
<color name=”slategrey”>#708090</color><!–灰石色 –>  
<color name=”olivedrab”>#6b8e23</color><!–深绿褐色 –>  
<color name=”slateblue”>#6a5acd</color><!–石蓝色 –>  
<color name=”dimgray”>#696969</color><!–暗灰色 –>  
<color name=”dimgrey”>#696969</color><!–暗灰色 –>  
<color name=”mediumaquamarine”>#66cdaa</color><!–中绿色 –>  
<color name=”cornflowerblue”>#6495ed</color><!–菊兰色 –>  
<color name=”cadetblue”>#5f9ea0</color><!–军兰色 –>  
<color name=”darkolivegreen”>#556b2f</color><!–暗橄榄绿 –>  
<color name=”indigo”>#4b0082</color><!–靛青色 –>  
<color name=”mediumturquoise”>#48d1cc</color><!–中绿宝石 –>  
<color name=”darkslateblue”>#483d8b</color><!–暗灰蓝色 –>  
<color name=”steelblue”>#4682b4</color><!–钢兰色 –>  
<color name=”royalblue”>#4169e1</color><!–皇家蓝 –>  
<color name=”turquoise”>#40e0d0</color><!–青绿色 –>  
<color name=”mediumseagreen”>#3cb371</color><!–中海蓝 –>  
<color name=”limegreen”>#32cd32</color><!–橙绿色 –>  
<color name=”darkslategray”>#2f4f4f</color><!–暗瓦灰色 –>  
<color name=”darkslategrey”>#2f4f4f</color><!–暗瓦灰色 –>  
<color name=”seagreen”>#2e8b57</color><!–海绿色 –>  
<color name=”forestgreen”>#228b22</color><!–森林绿 –>  
<color name=”lightseagreen”>#20b2aa</color><!–亮海蓝色 –>  
<color name=”dodgerblue”>#1e90ff</color><!–闪兰色 –>  
<color name=”midnightblue”>#191970</color><!–中灰兰色 –>  
<color name=”aqua”>#00ffff</color><!–浅绿色 –>  
<color name=”cyan”>#00ffff</color><!–青色 –>  
<color name=”springgreen”>#00ff7f</color><!–春绿色 –>  
<color name=”lime”>#00ff00</color><!–酸橙色 –>  
<color name=”mediumspringgreen”>#00fa9a</color><!–中春绿色 –>  
<color name=”darkturquoise”>#00ced1</color><!–暗宝石绿 –>  
<color name=”deepskyblue”>#00bfff</color><!–深天蓝色 –>  
<color name=”darkcyan”>#008b8b</color><!–暗青色 –>  
<color name=”teal”>#008080</color><!–水鸭色 –>  
<color name=”green”>#008000</color><!–绿色 –>  
<color name=”darkgreen”>#006400</color><!–暗绿色 –>  
<color name=”blue”>#0000ff</color><!–蓝色 –>  
<color name=”mediumblue”>#0000cd</color><!–中兰色 –>  
<color name=”darkblue”>#00008b</color><!–暗蓝色 –>  
<color name=”navy”>#000080</color><!–海军色 –>  
<color name=”black”>#000000</color><!–黑色 –>  
</resources>  
4月 172013
 

 

其他注意事项:

1、如何设置自己的Dialogfragment没有标题栏?
可以通过两种方法来设置 ,一种是使用dialogfragment的setStyle函数,另外就是使用getDialog().getWindow().requestFeature方法,具体代码如下

使用getDialog的方法

2. The method show(FragmentManager, String) in the type DialogFragment is not applicable for the arguments (FragmentManager, String)

此问题常是由于你所自定义的DialogFragment子类继承自android.app.dialogfragment,而非继承自android.support.v4.app.DialogFragment,解决办法就是将你的自定义的DialogFragment子类继承自android.support.v4.app.DialogFragment。如下所示:

 

4月 122013
 

1. 今天check out项目的时候,svn突然报了一个如下错误:

在网上查了一上解决办法为:

在地址和项目名称之间加上svn,本例中为如下:http://127.0.0.1/svn/financing,再进行check out就没问题了

SVN客户端:TortoiseSVN 1.7.11, Build 23600 – 64 Bit, Subversion 1.7.8

SVN服务端:VisualSVN Server Manager Version: 2.5.9