我在seam-gen(2.1.2)应用程序中创建了一个普通的servlet,现在我想使用注入.因此,我用@Name注释它,它被识别为组件:
INFO [Component] Component: ConfigReport,
scope: EVENT, type: JAVA_BEAN, class: com.mycompany.servlet.ConfigReport
Run Code Online (Sandbox Code Playgroud)
不幸的是记录器的注射不起作用NullPointerException在init()
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.Log;
@Name("ConfigReport")
public class ConfigReport extends HttpServlet {
@Logger
private Log log;
public void init(ServletConfig config) throws ServletException {
log.info( "BOOM" );
}
Run Code Online (Sandbox Code Playgroud)
}
我的做法是滥用吗?
什么是替代方案(客户端向servlet发送请求是curl,而不是浏览器)?
我面临与此处描述的相同的问题Rich modalpanel会自动关闭
我正在使用richfaces 3.3.0(包含在接缝2.12中).我试图找出问题所在,Firebug显示在modalpanel出现后,会生成对服务器的请求.面板在几毫秒后关闭.我为rich_modalPanel标签(在窗体外部)中的几个位置进行了多处理.
有任何想法吗?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:rich="http://richfaces.org/rich"
xmlns:a="http://richfaces.org/a4j"
xmlns:s="http://jboss.com/products/seam/taglib">
<head />
<body id="pgHome">
<f:view>
<div id="document">
<h:form id="login">
<fieldset>
<h:outputLabel id="UsernameLabel" for="username">Login Name</h:outputLabel>
<h:inputText id="username" value="#{identity.username}" style="width: 175px;" />
</fieldset>
<h:commandButton id="search2" value="modal"
onclick="#{rich:component('mp')}.show()" />
</h:form>
<rich:modalPanel id="mp" height="200" width="500">
<f:facet name="header">
<h:outputText value="Modal Panel Title" />
</f:facet>
</rich:modalPanel>
</div>
</f:view>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
编辑:
我终于使用了这个例子:
<rich:modalPanel id="modalPanelID">
<f:facet name="header">
<h:outputText value="header" />
</f:facet>
<a onclick="Richfaces.hideModalPanel('modalPanelID');" href="#">Hide</a>
</rich:modalPanel> …Run Code Online (Sandbox Code Playgroud) 我想提取基于Features2D + Homography的 FAST功能来查找已知对象
SurfFeatureDetector detector( minHessian );
std::vector<KeyPoint> keypoints_object, keypoints_scene;
detector.detect( img_object, keypoints_object );
detector.detect( img_scene, keypoints_scene );
//-- Step 2: Calculate descriptors (feature vectors)
SurfDescriptorExtractor extractor;
Run Code Online (Sandbox Code Playgroud)
SurfFeatureDetector和FastFeatureDetector类继承自Detector,可以进行交换.但我找不到SurfDescriptorExtractor的匹配类我希望找到像FastDescriptorExtractor这样的类,但这样的类不可用.似乎很奇怪的是,如果我只将Detector更改为FastFeatureDetector,则示例似乎正常工作.
我的问题是:对于快速功能,上述序列应该如何?
这不是一个真正的编程(编码)问题,对不起(但设计是第一位的).
我不明白之间的差别disjoint和overlapping.它出现在几本书中,与之相关OCL,被认为是其中的一部分UML,但OMG最新的OCL规范不再提及这些术语; 因此,对我来说,它似乎有些不明确.如果有人能澄清这背后的原因,我将不胜感激.它只是同一个超类的多重继承吗?
我正在重构java 1.3遗留代码,大约700个类.由于此代码中缺少泛型,我目前看到成千上万的警告,我应该禁用哪些警告?我不想讨论每一个警告,只是根据错误/警告对话框的日食显示的组的经验法则.
如果int var = 20则如何
printf("%d %d %d", var--, ++var, --var);
Run Code Online (Sandbox Code Playgroud)
执行发生在C编程语言中.
我有两个表Part和SubPart.部分表具有一般字段,如id,name,desc等.SubPart表具有part_id,sub_part_id作为复合键.这两列都引用了Part表,并且每个列都有一对多的映射,就像Part表中的每个part_id一样,SubPart表中的两个列都可以有多个条目.我在定义SubPart表的复合键时遇到问题.我尝试了嵌入式标签,但它不起作用.我该如何解决这个问题.非常感谢.
像这样的零件表.
@Entity
@Table(name="Part")
public class Part {
@Id
@GeneratedValue
@Column(name="Part_Id")
private int id;
@Column(name="Part_Number")
private String partNumber;
@Column(name="Part_Name")
private String partName;
}
Run Code Online (Sandbox Code Playgroud)
子部件表
@Entity
@Table(name="SubPart")
public class SubPart {
// part and subPart combination is the compound key here.
@ManyToOne
@JoinColumn(name="Part_Id")
private Part part;
@ManyToOne
@JoinColumn(name="Sub_Part_Id")
private Part subPart;
@Column(name="Quantity")
private Integer quantity;
}
Run Code Online (Sandbox Code Playgroud) 如果我有一个非原始公共成员的类,并且我想用OpenCSV从CSV文件中填充它们,我该怎么做?我注意到OpenCSV有一些与PropertyDescriptors相关的受保护成员
因此,假设我有一个具有地址成员的Person类,我的CSV文件包含每个人的详细信息,包括他们的地址.
Person{
private String name;
private Address al
public void setAddress(Address a){..}
public void setName(String name){..}
}
Addess{
private String line1;
private String line2;
private String postCode;
.
.
.
}
Run Code Online (Sandbox Code Playgroud)
CSV文件:
NAME | ADDR1 | ADDR2 | PCODE ...
John Smith |Some place | Some town | NW234
Run Code Online (Sandbox Code Playgroud)
谢谢,
我正在尝试在Visual Studio 2010中编译OpenHMD.我开始使用Win32库项目布局.我注意到stdafx.cpp已创建并删除了该文件以及生成的标头.现在我仍然得到像这样的编译错误(内联注释):
OHMD_APIENTRY int ohmd_ctx_probe(ohmd_context* ctx)
{
memset(&ctx->list, 0, sizeof(ohmd_device_list));
int i; // <-- error C2143: syntax error : missing ';' before 'type'
for(i = 0; i < ctx->num_drivers; i++){ // <-- error C2065: 'i' : undeclared identifier
ctx->drivers[i]->get_device_list(ctx->drivers[i], &ctx->list);
}
return ctx->list.num_devices;
}
Run Code Online (Sandbox Code Playgroud)
我在哪里可以强制进行纯C编译或设置C语言级别C99?这似乎是C89问题?
注意:我已经改变了for循环
for(int i = 0; ...
Run Code Online (Sandbox Code Playgroud)
至
int i;
for( i = 0; ...
Run Code Online (Sandbox Code Playgroud) 我想尝试Spring 3.1 Cache Abstraction,使用@Cachable注释一些方法。在没有参数的方法上,这很好用。对于带有参数的方法则不是。在文档(http://static.springsource.org/spring/docs/3.1.x/spring-framework-reference/html/cache.html)中找不到任何内容。
有人遇到同样的事情吗?
方法调用为:
@Cachable("countries")
public List<ConfigEntity> findCountries(Locale locale) {
ConfigSearchDescription desc = new ConfigSearchDescription();
// ...
return findConfigs(desc);
}
Run Code Online (Sandbox Code Playgroud)
谢谢乔尼