Char(DesertFish)

A desert-fish want to go heaven.

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2010年12月16日

摘要: function Tail-Content([string[]] $Path,[int] $Last = 10,[string]$Newline=[Environment]::NewLine){ $fs = $null $resolvedPaths = $Path foreach ($rpath in $resolvedPaths) { $numLines = $Last $seekOffset = -1; $PathIntrinsics = $ExecutionContext.SessionState.Path if ($PathIntrinsics.IsProviderQualifi 阅读全文
posted @ 2010-12-16 16:10 沙漠鱼 阅读(1119) 评论(0) 推荐(0) 编辑

摘要: cls$EventVwr = Get-EventLog -listforeach ($Log in $EventVwr) {"{0,-28} {1,-20} {2,8}" -f `$Log.log, $Log.OverflowAction, $Log.MaximumKilobytes}"hex format: " + "0x{0:x}" -f 500"Currency Format: " +"{0,-25:C} {1,25:C}" -f 137.30, 88.90"Percentage: " + "{0,-10:p}" -f 0.875, 0.790"Time and Date " +"{0: 阅读全文
posted @ 2010-12-16 16:08 沙漠鱼 阅读(595) 评论(0) 推荐(0) 编辑

摘要: cls$maxQueueConut =5$queneCount =0$queueHead =0$queuetail =0$queue = New-Object int[] ($maxQueueConut)function EnQueue([int] $Value){ if($queneCount -eq $maxQueueConut) { throw "quene is full" } else { $script:queneCount++ $script:queue[$queueHead] = $Value } $script:queueHead = NextIndex $queueHead 阅读全文
posted @ 2010-12-16 16:03 沙漠鱼 阅读(285) 评论(0) 推荐(0) 编辑

摘要: 下面代码基于一个算法题目来实现一个用线性时间得到堆栈最大值的代码。cls$maxStackConut =5$stackTopIndex =-1$stack = New-Object int[] ($maxStackConut)$link2NextMaxItem = New-Object int[] ($maxStackConut)$maxStackItemIndex=-1function Push([int] $Value){ if($stackTopIndex -eq ($maxStackConut-1)) { throw "Stack is full" } else { $script:s 阅读全文
posted @ 2010-12-16 16:02 沙漠鱼 阅读(391) 评论(0) 推荐(0) 编辑

2010年12月10日

摘要: clsfunction Ini-TimeZoneInformation($arg_TimeZone){ $F_TZI = [byte[]]$arg_TimeZone.GetValue("TZI") $F_TimeZoneInformation = 1 |select bias,standardName,standardDate,standardBias,daylightName,daylightDate,daylightBias $F_TimeZoneInformation.bias = [BitConverter]::ToInt32($F_TZI, 0) $F_TimeZoneInforma 阅读全文
posted @ 2010-12-10 19:15 沙漠鱼 阅读(506) 评论(0) 推荐(1) 编辑