日期: 2010-02-22
类别: PowerShell
运行PowerShell脚本提示错误: File C:\Users\xxx\Desktop\p.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details. At line:1 char:8 + .\p.ps1 <<<< + CategoryInfo : NotSpecified: (:) [], PSSecurityException + FullyQualifiedErrorId : RuntimeException 查了下原因,原来是PowerShell默认的执行权限的问题。在PowerShell中有4中执行权限: Restricted——默认的设置, 不允许任何script运行 AllSigned——只能运行经过数字证书签名的script RemoteSigned——运行本地的script不需要数字签名,但是运行从网络上下载的script就必须要有数字签名 Unrestricted——允许所有的script运行 可以使用Get-ExecutionPolicy来获取当前的权限,使用Set-ExecutionPolicy来更改执行权限
日期: 2010-02-09
类别: C#
Each version of C# has a number of new features and generally a major theme. The major themes have been generics and nullable types in C# 2.0, LINQ in C# 3.0, and dynamic types in C# 4.0. The major features added in each release are generally considered to be the following: C#1.0/.Net1.0/vs2002 C#1.2/.Net1.1/vs2003 C# 2.0/.Net2.0/vs2005 [...]
日期: 2010-02-08
类别: C#
将数组中的奇数移到偶数的前面,要求1)时间复杂度o(n),2)不增加额外存储空间 static void Main(string[] args) { int[] array = new int[10]; Random r = new Random(5); for (int i = 0; i < array.Length; i++) { array[i] = r.Next(1, 100); Console.Write(array[i] + " "); } Console.WriteLine(); Separate(array); for (int i = 0; i < array.Length; i++) { Console.Write(array[i] + " "); } } private [...]