使用 svcutil,我尝试为遵循OGC CSW 2.0.2 (07-006r1)目录服务标准的Web 服务端点生成代理类。
我已经下载了整个 OGC 架构文件并将它们放入我的“D:/temp/OGCSchemas/”目录中。
我感兴趣的模式是 CSW,但是 CSW 模式包含并导入其他模式,这就是我下载整个集合的原因。
例如,您将看到如下内容:
<wsdl:import namespace="http://www.opengis.net/cat/csw/2.0.2/requests" location="./xml-interfaces.wsdl"/>
<xsd:schema targetNamespace="http://www.opengis.net/cat/csw/2.0.2" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="2.0.2">
<xsd:include schemaLocation="../../csw/2.0.2/CSW-discovery.xsd"/>
<xsd:include schemaLocation="../../csw/2.0.2/CSW-publication.xsd"/>
</xsd:schema>
Run Code Online (Sandbox Code Playgroud)
到目前为止,我的命令行看起来像:
svcutil D:\temp\OGCSchemas\csw\2.0.2\examples\wsdl\2.0.2\*.wsdl D:\temp\OGCSchemas\csw\2.0.2\*.xsd D:\temp\OGCSchemas\filter\1.1.0\*.xsd D:\temp\OGCSchemas\ows\1.0.0\*.xsd /out:D:\temp\ogc.csw.proxy.cs
Run Code Online (Sandbox Code Playgroud)
但是我收到了很多类似这样的错误:
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://www.opengis.net/cat/csw/2.0.2/soap']/wsdl:binding[@name='csw-SO
AP']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.opengis.net/cat/csw/2.0.2/wsdl']/wsdl:service[@name='CSW']/
wsdl:port[@name='csw-SOAP-Port']
Run Code Online (Sandbox Code Playgroud)
我相信这个错误告诉我在我的命令行中包含更多的 xsds。
所以我的问题是:如何确定要在命令行中包含哪些 xsd?
我以为我已经为每个包含它的目录包含了一个 *.xsd,但显然不是。
编辑 #1 …
我一直在使用这个解决方案来解析 Windows 快捷方式并确定快捷方式指向的内容。但是,它仅适用于本地文件和网络共享。Windows 快捷方式也可以指向 URL。我一直使用的解决方案无法正确解析 URL 快捷方式。知道为什么或如何解决它吗?
对我来说,它在这一行抛出 ArrayIndexOutOfBoundsException:
int file_location_info_flag = link[file_start + file_location_info_flag_offset_offset];
Run Code Online (Sandbox Code Playgroud)
我一直在使用名为“C:\googleshort.url”的快捷方式进行测试,该快捷方式指向http://www.google.com/。单击快捷方式效果很好并会显示 google,但 java 解析器失败。
我想在.NET 3.5中做这样的事情.什么是最快的方式?
IEnumerable<DataRow> collection =
TypedDataSet.TypedTableBase<DataRow>.Rows as IEnumerable<DataRow>;
Run Code Online (Sandbox Code Playgroud) 我错过了一些明显的东西,但请考虑以下内容,
int k = 10;
int *p = &k;
int i = (int)p;
Run Code Online (Sandbox Code Playgroud)
以上产生,
warning: cast from pointer to integer of different size
Run Code Online (Sandbox Code Playgroud)
和以下,
int k = 10;
int *p = &k;
int i = p;
Run Code Online (Sandbox Code Playgroud)
原因
warning: initialization makes integer from pointer without a cast
Run Code Online (Sandbox Code Playgroud)
一点谷歌搜索引导我,
哪个建议使用uintptr_t,
int k = 10;
int *p = &k;
int i = (uintptr_t)p;
Run Code Online (Sandbox Code Playgroud)
上面的工作没有错误没有警告.所以我的问题是k是一个int而p是一个指向k的int指针为什么我得到一个错误解除引用p?
如您所知,"接口程序"设计原则广泛地倾向于使用超类型而不是具体类型或实现.
是否与在Java程序中使用instanceof从超类型派生具体类型的原则一致?
在我的应用程序中,Storehouse是一个抽象的超类型类,包含几个私有变量和公共getter和setter.
ConcreteStorehouseA继承自Storehouse,有很多具体的方法和变量.ConcreteStorehouseB类似但不同.
我的应用程序收到了一个仓库.但是,Storehouse不是一个有用的类型.因为具体类型中只包含真正有用的方法,所以我使用instanceof如下:
if (storehouse instanceof ConcreteStorehouseA) {
ConcreteStorehouseA concreteStorehouseA = (ConcreteStorehouseA) storehouse;
// perform operations on the concrete type's useful methods and variables
Run Code Online (Sandbox Code Playgroud)
使用instanceof与原理兼容吗?
编辑:
本质上,该应用程序是桌面RPG,Shadowrun的骰子模拟器.具体类型是不同的测试类型 - 成功测试,反对测试,扩展测试 - 它们的成功操作都有非常不同的因素和参数.超类型基本上包含骰子池!
核心数据驱动应用程序的常见方案是从后备存储中获取唯一对象.如果存在具有特定唯一属性的对象,则返回该对象,如果它不返回新创建的对象.我发现自己一遍又一遍地写同样的东西,所以我用一种方便的方法把它包起来.但这似乎是微不足道的,我在这里重新发明轮子吗?有没有更简单,开箱即用的方法来实现这一目标?
干杯,
EP
+(id)uniqueEntityfForName:(NSString *)name
withValue:(id)value
forKey:(NSString *)key
inManagedObjectContext:(NSManagedObjectContext *)context {
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
request.entity = [NSEntityDescription entityForName:name inManagedObjectContext:context];
request.predicate = [NSPredicate predicateWithFormat:[key stringByAppendingString:@" == %@"], value];
NSArray *result = [context executeFetchRequest:request error:nil];
id entity = [result lastObject];
if (entity == nil) {
entity = [NSEntityDescription insertNewObjectForEntityForName:name inManagedObjectContext:context];
[entity setValue:value forKey:key];
} else {
entity = [result lastObject];
}
return entity;
}
Run Code Online (Sandbox Code Playgroud)
我使用这样的方法:
SomeEntity *entity = [CDUtils uniqueEntityfForName:@"SomeEntity" withValue:@"foo" forKey:@"bar" inManagedObjectContext:context];
Run Code Online (Sandbox Code Playgroud) 平等有什么区别:
==
Run Code Online (Sandbox Code Playgroud)
和严格的平等?
===
Run Code Online (Sandbox Code Playgroud) 我试图最终让这个代码工作:
function Timer(callback, delay) {
var timerId, start, remaining = delay;
this.pause = function() {
window.clearTimeout(timerId);
remaining -= new Date() - start;
};
this.resume = function() {
start = new Date();
timerId = window.setTimeout(callback, remaining);
};
this.resume();
}
var timer;
function onEvent(){
timer = new Timer(anotherEvent(), 5000);
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用,所以我简化它以查看可能存在的问题,并将其归结为:
var timer;
function event(){
timer = window.setTimeout(anotherEvent(), 5000);
}
Run Code Online (Sandbox Code Playgroud)
它所做的只是另一个事件().
有任何想法吗?
在C#中使用时,如何在C++/CLI中声明具有可选参数的托管方法?
我使用Optional和DefaultParameterValue属性修饰了参数(请参阅:如何编码默认参数值),但只有Optional属性才被尊重.
C++/CLI:
public ref class MyClass1
{
public:
MyClass1([System::Runtime::InteropServices::Optional]
[System::Runtime::InteropServices::DefaultParameterValue(2)]
int myParam1) ?
{
System::Console::WriteLine(myParam1);
}
};
Run Code Online (Sandbox Code Playgroud)
C#:
var myInstance1 = new MyClass1(); // compiles and runs
Run Code Online (Sandbox Code Playgroud)
输出:
0
Run Code Online (Sandbox Code Playgroud)
预期产出:
2
Run Code Online (Sandbox Code Playgroud)
Visual C#IntelliSense:
MyClass1.MyClass1([int myParam1 = 0]); // wrong default value
?
Run Code Online (Sandbox Code Playgroud)
编辑:仔细观察反汇编程序会发现C++/CLI编译器确实没有生成所需的.param [1] = int32(2)指令.Reflector显示的IL代码是错误的.
反射:
.method public hidebysig specialname rtspecialname instance void .ctor([opt] int32 myParam1) cil managed
{
.param [1] = int32(2) // bug
...
Run Code Online (Sandbox Code Playgroud)
ILDASM:
.method …Run Code Online (Sandbox Code Playgroud) Python有这个美丽的功能来解决这个问题:
bar1 = 'foobar'
bar2 = 'jumped'
bar3 = 'dog'
foo = 'The lazy ' + bar3 + ' ' + bar2 ' over the ' + bar1
# The lazy dog jumped over the foobar
Run Code Online (Sandbox Code Playgroud)
进入:
bar1 = 'foobar'
bar2 = 'jumped'
bar3 = 'dog'
foo = 'The lazy {} {} over the {}'.format(bar3, bar2, bar1)
# The lazy dog jumped over the foobar
Run Code Online (Sandbox Code Playgroud)
JavaScript有这样的功能吗?如果没有,我将如何创建一个遵循与Python实现相同的语法?
.net ×3
c# ×2
java ×2
javascript ×2
.net-3.5 ×1
c ×1
c++-cli ×1
core-data ×1
format ×1
gcc ×1
ienumerable ×1
instanceof ×1
linq ×1
objective-c ×1
ogc ×1
python ×1
schema ×1
settimeout ×1
shortcut ×1
svcutil.exe ×1
timer ×1
unique ×1
url ×1
window ×1
windows ×1