是否有可能与Doctrine 2.4中的条件进行关联映射?我有实体文章和评论.评论需要得到管理员的批准.评论的批准状态存储在"已批准的布尔字段"中.
现在我将@OneToMany关联映射到实体文章中的注释.它映射所有评论.但我想仅映射已批准的评论.
就像是
@ORM\OneToMany(targetEntity="Comment", where="approved=true", mappedBy="article")
Run Code Online (Sandbox Code Playgroud)
会非常有帮助的.不幸的是AFAIK没有映射条件的地方,所以我尝试用继承来解决我的问题 - 我创建了两个类Comment的子类.现在我有ApprovedComment和NotApprovedComment以及SINGLE_TABLE继承映射.
@ORM\InheritanceType("SINGLE_TABLE")
@ORM\DiscriminatorColumn(name="approved", type="integer")
@ORM\DiscriminatorMap({1 = "ApprovedComment", 0 = "NotApprovedComment"})
Run Code Online (Sandbox Code Playgroud)
问题是,由于"已批准"列是鉴别器,我不能再将其用作实体注释中的字段.
我正在编写一个简单的C#应用程序,我需要在Listview上使用onScroll事件.所以我创建了类ListviewEx女巫继承了原始的ListView.我发现如何从WinAPI检测滚动消息,我修改了WndProc方法.现在我有了这个WndProc:
protected override void WndProc(ref Message m)
{
base.WndProc(ref m);
if (m.Msg == WM_VSCROLL)
{
onScroll(this, new EventArgs());
}
}
Run Code Online (Sandbox Code Playgroud)
但问题是,我不知道如何检测有关滚动的信息.这个数据应该在WParam中,但在C#中没有像C++那样的LOWORD宏,我需要切换来检测SB_ BOTTOM,SB_ ENDSCROLL,SB_PAGEUP等参数.
有没有办法如何在C#中替换LOWORD宏?
或者其他方式如何检测有关滚动的必要参数?
我正在尝试运行Apache Hadoop 1.21,但是我遇到了这个异常:
Failed to set setXIncludeAware(true) for parser org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@2662e5cf:java.lang.UnsupportedOperationException
Run Code Online (Sandbox Code Playgroud)
完整堆栈跟踪:
13/10/17 17:22:52 ERROR conf.Configuration: Failed to set setXIncludeAware(true) for parser org.apache.xerces.jaxp.DocumentBuilderFactoryImpl@2662e5cf:java.lang.UnsupportedOperationException: setXIncludeAware is not supported on this JAXP implementation or earlier: class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
java.lang.UnsupportedOperationException: setXIncludeAware is not supported on this JAXP implementation or earlier: class org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
at javax.xml.parsers.DocumentBuilderFactory.setXIncludeAware(DocumentBuilderFactory.java:589)
at org.apache.hadoop.conf.Configuration.loadResource(Configuration.java:1131)
at org.apache.hadoop.conf.Configuration.loadResources(Configuration.java:1107)
at org.apache.hadoop.conf.Configuration.getProps(Configuration.java:1053)
at org.apache.hadoop.conf.Configuration.get(Configuration.java:460)
at org.apache.hadoop.fs.FileSystem.getDefaultUri(FileSystem.java:132)
at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:124)
at main.JobExecutor.executeModelCreation(JobExecutor.java:223)
at main.JobExecutor.main(JobExecutor.java:256)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.hadoop.util.RunJar.main(RunJar.java:160)
Run Code Online (Sandbox Code Playgroud)
我已经找了近3天的解决方案,我找到了几个网站(比如这个:Hadoop"无法为解析器设置setXIncludeAware(true)"错误以及如何解决它),建议将xerces和xalan添加到maven依赖.还有其他网站,建议几乎相反 …
我正在使用Visual Studio 2015 Native Test Project来测试我的C++项目.在调试测试时,有什么方法可以查看测试执行的顺序吗?或者任何详细的调试信息?
我想在线使用Visual Studio进行持续集成,但我的测试存在一些问题.它总是在VSO服务器上崩溃.我试图从我的计算机上的控制台手动运行它,它工作正常.但是当我在本地计算机上的Visual Studio中以调试模式运行它时,测试运行器会出现一些随机故障.它抛出异常
托管调试助手'DisconnectedContext'在'C:\ Program Files(x86)\ Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\TE.ProcessHost.Managed.exe'中检测到问题.
RuntimeCallableWrapper与其资源断开连接
HRESULT:0x80010108(RPC_E_DISCONNECTED)
问题是这个异常是非常随机的,我认为这取决于测试执行顺序.当我逐个运行所有测试时,它很好,没有抛出任何异常.我真的很绝望如何调试它:(
我正在使用D3库来创建绘图应用程序.
我需要在用户点击的坐标上绘制对象(简洁的圆圈).问题是当用户使用平移和缩放并移动视口时.然后对象位于错误的位置(我猜问题是事件坐标是相对于svg元素而不是g,因此它们是在没有适当转换的情况下计算的).
$('svg').on('click', function(event) {
d3.select('#content-layer').append('circle')
.attr('r', 10)
.attr('cx', event.offsetX)
.attr('cy', event.offsetY)
.attr('stroke', 'black')
.attr('fill', 'white');
});
var zoomBehavior = d3.behavior.zoom()
.scaleExtent([1, 10])
.on('zoom', () => {
var translate = "translate(" + d3.event.translate + ")";
var scale = "scale(" + d3.event.scale + ")";
d3.select('#content-layer').attr("transform", translate + scale);
});
d3.select('svg').call(zoomBehavior);
Run Code Online (Sandbox Code Playgroud)
我试图添加点击回调到g元素,但它不起作用(我猜它没有任何大小?).
这是jsfiddle:https://jsfiddle.net/klinki/53ftaw7r/
我正在维护几个用 ASP.NET 4.8(完整框架)和 ASP.NET Core 编写的应用程序。
.NET Core 实现了https://www.w3.org/TR/trace-context/,因此我可以看到我的日志(我使用 Serilog 进行结构化日志记录),其中包含 ParentId、SpanId 以及最重要的 TraceId。
有没有办法在旧的 ASP.NET 4.8 应用程序中读取和传播 TraceId?
我的应用程序之间正在执行大量请求,这将极大地改善调试体验。不幸的是,大多数请求源自旧的 ASP.NET 4.8 应用程序,并转到较新的 .NET Core 应用程序。
理想情况下,我希望达到与 ASP.NET Core 应用程序相同的状态 - 如果 Request-Id 来自 HTTP 标头,则使用它并将其填充到 ParentId 和 TraceId 中,并基于此生成 SpanId。此外,它还会进一步传播到源自 .NET Core 应用程序的其他 HTTP 请求。
谢谢!