我有这个PSObject(来自XML):
bool : {IsActive, ShowOnB2C, ShowOnB2B, IsWebNews}
str : {id, ProductId, GroupName, Unit...}
int : {ProductIdNumeric, Prices_SalesOne, Prices_Treater, Prices_B2C...}
arr : {EnvironmentBrands, Catalogs, NavisionLevels}
long : long
Run Code Online (Sandbox Code Playgroud)
例如,我想在不使用属性名称的情况下迭代属性bool.
我试图像这样索引对象:
$document[0]
Run Code Online (Sandbox Code Playgroud)
但这没有给我什么,但它也不会导致任何错误.
Select-Object 有点作品,但后来我必须使用属性名称,我不希望这样.
$documents | Select-Object bool,str
Run Code Online (Sandbox Code Playgroud)
ForEach 不要迭代属性.
$documents | ForEach {
$_.name
}
Run Code Online (Sandbox Code Playgroud)
返回doc,这是包含bools,int和字符串的标记(XML)的名称.
我正在开发ASP.NET和SQL Server应用程序,有时我遇到SQL查询问题,我希望看到SQL Server"响应"而不只是ASP.NET错误消息(这并不总是非常有用)
SQL Server中的Profiler.exe工具具有此功能,但我正在MSDN上阅读Microsoft计划弃用该工具.
我们宣布弃用SQL Server Profiler进行数据库引擎跟踪捕获和跟踪重放.下一版本的SQL Server将支持这些功能,但将在以后的版本中删除.SQL Server的特定版本尚未确定.还将弃用包含Microsoft SQL Server跟踪和重播对象的Microsoft.SqlServer.Management.Trace命名空间.请注意,Analysis Services工作负载的SQL Server Profiler未被弃用,并将继续受支持.
http://msdn.microsoft.com/en-us/library/ms181091.aspx
他们没有提到什么工具会取代profiler.exe
有谁知道这件事吗?
如果我想查看(最近?)不成功的查询,是否有任何替代探查器?
我在这里找到了这个md5函数:http://www.makebetterthings.com/iphone/how-to-get-md5-and-sha1-in-objective-c-ios-sdk/
- (NSString *) md5:(NSString *) input
{
const char *cStr = [input UTF8String];
unsigned char digest[16];
CC_MD5( cStr, strlen(cStr), digest ); // This is the md5 call
NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[output appendFormat:@"%02x", digest[i]];
return output;
}
Run Code Online (Sandbox Code Playgroud)
我在头文件中有这样的签名:
- (NSString *) md5:(NSString *) input;
Run Code Online (Sandbox Code Playgroud)
xCode中没有出现错误,除非我尝试使用该函数.
NSString *credentials = [md5 @"test"];
Run Code Online (Sandbox Code Playgroud)
我收到消息:使用未声明的标识符'md5'
我该如何使用这个功能?
我有以下PowerShell功能:
function getProjReferences([string] $projFile) {
# Returns nothing
$Namespace = @{ ns = "http://schemas.microsoft.com/developer/msbuild/2003"; };
$Xml = Select-Xml -Path $projFile -Namespace $Namespace -XPath "//ns:Project/ItemGroup/Reference"
# Returns nothing
[xml] $xml = Get-Content -Path $projFile
[System.Xml.XmlNamespaceManager] $nsMgr = New-Object -TypeName System.Xml.XmlNamespaceManager($xml.NameTable)
$nsMgr.AddNamespace("ns", "http://schemas.microsoft.com/developer/msbuild/2003");
[XmlNode] $nodes = $xml.SelectNodes("/ns:Project/ItemGroup/Reference", $nsMgr);
}
Run Code Online (Sandbox Code Playgroud)
两次尝试都没有返回任何内容,虽然XPath查询是完全有效的,但我在xml中没有使用默认命名空间xmlns ="http://schemas.microsoft.com/developer/msbuild/2003"并且工作正常.
我知道我必须将默认命名空间映射到URI并使用它来查询带有此映射的XML,但我似乎无法使其工作.
如何使用默认命名空间查询XML?我还没有能够在Google上找到任何可用的东西.
工作代码:
function getProjReferences([string] $projFile) {
[xml] $xml = Get-Content -Path $projFile
[System.Xml.XmlNamespaceManager] $nsMgr = New-Object -TypeName System.Xml.XmlNamespaceManager($xml.NameTable)
$nsMgr.AddNamespace("ns", "http://schemas.microsoft.com/developer/msbuild/2003");
[XmlNode] $nodes = $xml.SelectNodes("/ns:Project/ns:ItemGroup/ns:Reference", $nsMgr);
}
Run Code Online (Sandbox Code Playgroud) 我想我也许终于在指针理解上有了一点突破,但我正在努力解决一个看似简单的问题,我想让一个指针指向与另一个指针相同的内存地址,例如:
\nchar* foo = "foo"; // memory address: 0x7ffdabc4dbf8\nchar* bar = "bar"; // memory address: 0x7ffdabc4dbf0\nRun Code Online (Sandbox Code Playgroud)\n如何将 foo 指向与 bar 相同的地址?我知道如何更改该值,例如:
\nfoo = bar; // foo is now "bar" but the memory address is the same as before\nRun Code Online (Sandbox Code Playgroud)\n我做了一些实验:
\n#include<stdio.h>\n#include<stdlib.h>\n#include<string.h>\n#include<errno.h>\n\nvoid print_info(char* string1, char* string2) {\n printf("Memory address of string1: %p\\n", &string1);\n printf("Memory address of string2: %p\\n", &string2);\n printf("Value of string1: %s\\n", string1);\n printf("Value of string2: %s\\n", string2);\n printf("\\n");\n}\n\nvoid change(char** ptr1, char** ptr2) {\n *ptr1 = …Run Code Online (Sandbox Code Playgroud) powershell ×2
c ×1
ios ×1
md5 ×1
objective-c ×1
pointers ×1
sql ×1
sql-server ×1
xml ×1
xpath ×1