我有一个过滤器名称列表:FILTERBYNAMES
我的查询结果项每个都包含一个名单:NAMES
我想过滤结果,取其名称列表中包含FILTERNAMELIST中至少一个名称的所有项目:
results= result.where(r=>r.NAMES.CONTAINS(...?)...?
Run Code Online (Sandbox Code Playgroud) 我有一个工厂应该创建在运行时从类Foo继承的对象.我认为System.Activator.CreateInstance的返回类型与它创建的对象的类型相同,但从以下错误消息判断,其返回类型是Object.
错误1无法将类型'object'隐式转换为'cs_sandbox.Foo'.存在显式转换(您是否缺少演员表?)F:\ projects\cs_sandbox\Form1.cs 46 24 cs_sandbox
好吧,也许我很缺少强制的,但
return (t)System.Activator.CreateInstance(t);
Run Code Online (Sandbox Code Playgroud)
导致又一条错误信息 - 我必须承认 - 这对我没有意义:
错误1找不到类型或命名空间名称't'(您是否缺少using指令或程序集引用?)F:\ projects\cs_sandbox\Form1.cs 45 25 cs_sandbox
这是我的代码:
class Foo { }
class FooChild1 : Foo { }
class FooChild2 : Foo { }
class MyFactory
{
public static Foo CreateInstance(string s)
{
Type t;
if (s.StartsWith("abcdef"))
{
t = typeof(FooChild1);
return System.Activator.CreateInstance(t);
}
else
{
t = typeof(FooChild2);
return System.Activator.CreateInstance(t);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我该如何修复此代码?或者,如果它不可修复,那么在运行时创建从特定类继承的对象的其他方法是什么?
我正在运行OSX 10.6 Snow Leopard,已下载rhino1_7R2并将其移至/ usr/local /
但我知道(虽然这会阻止它被操作系统更新改变)这可能不是它的最佳位置,并想象它可能需要连接到Java安装.
我对Rhino的用途是从终端命令行运行JavaScript,我正在寻求帮助,因为我相信我缺乏Java知识来快速解决这个问题.
我将不胜感激任何帮助或建议链接,
谢谢保罗
我是php,mysql的新手.我写了一个hello.php脚本,我试图将其复制到/ var/www目录中(稍后将要通过Web浏览器打开它).同样的问题是,尽管我是root用户,但我不允许在/ var/www中保存/写入任何文件.我尝试在这个问题中实现步骤,但是当我处理第三行时出现以下错误
find /var/www/ -type f -exec chmod g+w '{}' ';'
chmod: changing permissions of `/var/www/index.html': Operation not permitted
Run Code Online (Sandbox Code Playgroud)
我知道符号链接也是一种选择.我希望能够直接将文件写入/复制到/ var/www /目录.
什么是错误的任何建议?
我正在尝试使用远程svc Web服务.我创建了代理类svcutil.exe
,之后我将该类添加到我的控制台应用程序中,但它产生了一个错误:
从另一方收到了不安全的错误或错误的安全故障.有关故障代码和详细信息,请参阅内部故障异常.
System.ServiceModel.FaultException:验证消息的安全性时发生错误
我没有创建WCF端,它是一个远程svc.请帮忙.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="EloquaDataTransferService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://secure.eloqua.com/API/1.2/DataTransferService.svc"
binding="basicHttpBinding" bindingConfiguration="EloquaDataTransferService"
contract="DataTransferService" name="EloquaDataTransferService" />
</client>
</system.serviceModel>
</configuration>
Run Code Online (Sandbox Code Playgroud)
这是我的app.config
档案.我consoleApp.cs
使用obj.ServiceCredentials.UserName.UserName="xxxxxx"
和提供我的文件中的用户名和密码.Password="xxxXx"
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="EloquaDataTransferService" …
Run Code Online (Sandbox Code Playgroud) 我用C#开发了一个Windows服务.我用Visual Studio 2008创建了一个安装程序,它安装了Windows服务.到目前为止一切都很好.我想确保在安装时创建了事件源,以便运行时的任何错误/异常条件都正确记录到Windows事件日志中.
事件源是否作为Windows服务安装(和卸载)的一部分自动创建(和删除),或者我是否必须自己处理并创建自定义操作以创建和删除它,如下所示?
protected override void OnBeforeInstall(IDictionary savedState)
{
base.OnBeforeInstall(savedState);
if (!EventLog.SourceExists(ServiceName))
EventLog.CreateEventSource(ServiceName, "Application");
}
protected override void OnAfterUninstall(IDictionary savedState)
{
base.OnAfterInstall(savedState);
if (EventLog.SourceExists(ServiceName))
EventLog.DeleteEventSource(ServiceName);
}
Run Code Online (Sandbox Code Playgroud) 当我为域创建cookie时,是否可以设置此域应该在www和非www域上?
我检查了一个cookie,如果没有,我会重定向到登录页面(它不是一个超级安全的东西).当用户有cookie时,如果网址更改为www.它被重定向到再次登录.
我在C++中面临一个问题:
#include <iostream>
class A
{
protected:
void some_func(const unsigned int& param1)
{
std::cout << "A::some_func(" << param1 << ")" << std::endl;
}
public:
virtual ~A() {}
virtual void some_func(const unsigned int& param1, const char*)
{
some_func(param1);
}
};
class B : public A
{
public:
virtual ~B() {}
virtual void some_func(const unsigned int& param1, const char*)
{
some_func(param1);
}
};
int main(int, char**)
{
A* t = new B();
t->some_func(21, "some char*");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我正在使用g ++ 4.0.1和编译错误:
$ …
Run Code Online (Sandbox Code Playgroud) 我有一台服务器,我正在取消.我唯一要迁移的是我的存储库.此服务器被列为我的一个项目的源(主).移动存储库以保留历史记录的正确方法是什么.
c# ×3
asp.net ×2
.net ×1
activator ×1
c++ ×1
class ×1
cookies ×1
cp ×1
event-log ×1
g++ ×1
git ×1
inheritance ×1
java ×1
javascript ×1
linq ×1
macos ×1
overloading ×1
overriding ×1
permissions ×1
rhino ×1
unix ×1
wcf ×1