我正在使用Jquery实现自动完成功能,当我输入名称时,它从数据库中获取记录,存储在db中的记录是大写和小写字母的混合.我编写了一个HQL查询,它以区分大小写的方式获取记录,但我需要记录而不管大小写.这是查询,
List<OrganizationTB> resultList = null;
Query query = session.createQuery("from DataOrganization dataOrg where dataOrg.poolName
like '%"+ poolName +"%'");
resultList = query.list();
Run Code Online (Sandbox Code Playgroud)
例如:如果我有池名称,HRMS数据集,Hrms数据,Hr数据等...如果我输入HR或hr我需要获得所有3条记录,这是我无法做到的.
请帮忙...
<input id="text1" tabindex="1" onblur="invokeFunc()"/>
<input id="text2" tabindex="2" onblur="invokeFunc()"/>
function invokeFunc(){
// ajax request
alert(document.activeElement);
// this returns body element in firefox, safari and chrome.
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用适当的tabindex设置在文本框上设置焦点onblur.
当我调用javascript函数onblur并尝试获取document.activeelement然后它总是返回我的body元素而不是焦点所在的active元素.
我在hibernate中编写一个函数来递归地递归初始化对象的所有属性,从而加载整个对象图.
我有两个复杂的场景,我需要使用它
1)自组合对象,如类别和子类别......
@Entity
public class Category {
@Column(nullable = false, length = 50)
@NotNull
@Size(max = 50, message = "{50}")
protected String name;
@ManyToOne(targetEntity = Category.class, fetch = FetchType.LAZY, optional = true)
private Category parentCategory;
}
Run Code Online (Sandbox Code Playgroud)
2)复杂的对象图,它可以在使用前有很多对象进行初始化.
问题是我不能使用渴望获取,因为我只在选择性情况下需要这个整个对象图,我想要通用代码,所以不需要为对象编写HQL查询.
我为此写了部分代码,
public void recursiveInitliaze(Object obj) throws Exception {
if(!Hibernate.isInitialized(obj))
Hibernate.initialize(obj);
PropertyDescriptor[] properties = PropertyUtils.getPropertyDescriptors(obj);
for (PropertyDescriptor propertyDescriptor : properties) {
Object origProp = PropertyUtils.getProperty(obj, propertyDescriptor.getName());
if (origProp != null) {
this.recursiveInitliaze(origProp);
}
if (origProp instanceof Collection && origProp != null) { …Run Code Online (Sandbox Code Playgroud) 主要思想是允许用户重新着色到基于特定墙的用户选择.目前我已经使用cvFloodFill(帮助准备掩模图像)实现了这个功能,这可以帮助我改变HSV墙的相对值,这样我就可以保留边缘.但是这个解决方案的问题在于它适用于颜色,并且所有墙壁都被重新绘制,而不是由用户选择的单个墙壁.
我也尝试过canny边缘检测,但它只能检测边缘但不能将其转换为区域.
请在下面找到我目前用于重绘功能的代码
准备面具
cvFloodFill(mask, new CvPoint(295, 75), new CvScalar(255, 255, 255,0), cvScalarAll(1), cvScalarAll(1), null, 4, null);
分道
cvSplit(hsvImage, hChannel, sChannel, vChannel, null);
换颜色
cvAddS(vChannel, new CvScalar(255*(0.76-0.40),0,0,0), vChannel, mask);
我们如何从图像中检测边缘和相应区域.
我正在寻找解决方案,除了opencviPhone和Android 之外,应该是可能的

编辑
我可以使用以下步骤在下面的图像中获得一些结果
cvCvtColor(image, gray, CV_BGR2GRAY);
cvSmooth(gray,smooth,CV_GAUSSIAN,7,7,0,0);
cvCanny(smooth, canny, 10, 250, 5);
Run Code Online (Sandbox Code Playgroud)
这个输出有两个问题,不知道如何解决它们1.靠近边缘近距离2.去除小边缘

我正在开发一个大型ERP项目,该项目拥有大约2100个表的数据库模型.使用Hibernate映射的"仅"500个表,部署在Web服务器上的应用程序需要大约3GB的工作内存.
在一个持久性单元中使用那么多表时,有没有办法减少Hibernate的元模型内存占用?或者我应该放弃ORM并使用普通的旧JDBC(甚至是jOOQ)?
现在我正在使用Hibernate 4.1.8,Spring 3.1.3,JBoss AS 7.1并使用MSSQL数据库.
编辑:
JavaMelody内存直方图输出 - 使用2000个生成的测试表,这些测试表的范围比原始数据库模型小一点(因此'仅花费了1.3GB的内存)
编辑2:
Java MAT堆分析:
我有一个BaseEntity抽象id和版本属性.此类还基于PK(id)属性实现hashcode和equals.
BaseEntity{
Long id;
Long version;
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
BaseEntity other = (BaseEntity) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false; …Run Code Online (Sandbox Code Playgroud) 我有登录成功和重定向到页面的奇怪问题.
下面是我的弹簧安全配置.
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/login.hst**" access="anonymous or authenticated" />
<intercept-url pattern="/**/*.hst" access="authenticated" />
<form-login login-page="/login.hst"
authentication-failure-url="/login.hst?error=true"
authentication-success-handler-ref="loginSucessHandler" />
<logout invalidate-session="true" logout-success-url="/home.hst"
logout-url="/logout.hst" />
<remember-me key="jbcpHaverERP" authentication-success-handler-ref="loginSucessHandler"/>
<session-management>
<concurrency-control max-sessions="1" />
</session-management>
</http>
Run Code Online (Sandbox Code Playgroud)
LoginSuessHandler类:
@Service
public class LoginSucessHandler extends
SavedRequestAwareAuthenticationSuccessHandler {
@Override
public void onAuthenticationSuccess(HttpServletRequest request,
HttpServletResponse response, Authentication authentication)
throws ServletException, IOException {
...
super.setUseReferer(true);
super.onAuthenticationSuccess(request, response, authentication);
}
}
Run Code Online (Sandbox Code Playgroud)
现在成功重定向到请求页面的问题.如果我直接引用任何安全网址spring将我重定向到登录页面并成功登录到原始请求的链接.但是,如果用户之前选择了remember-me然后关闭浏览器并且现在请求直接URL,那么这不起作用,他正在进行适当的身份验证,而不是将他重定向到请求的页面重定向到/.我检查了日志和一些弹簧源代码,发现它无法确定目标网址.
我试图设置引用但引用值为null.但有一件奇怪的事我注意到,在spring安全配置中,如果我从remember-me配置中删除authentication-success-handler,那么它可以工作.
<remember-me key="jbcpHaverERP" authentication-success-handler-ref="loginSucessHandler"/>
Run Code Online (Sandbox Code Playgroud)
无法弄清楚问题.是身份验证成功处理程序实现需要不同的表单登录和记住我吗?
关于Spring MVC 格式化程序和转换器之间的区别,我需要澄清一下.
我对它们之间的主要区别的理解是格式化程序处理将要显示给最终用户的数据,例如日期,SSN或信用卡号,而转换器处理隐藏在表单控件后面的数据,例如value属性选择的选项.
我是对还是错?有人可以提供建议和/或样本,以便更好地解释两者之间的差异.
我尝试将angular.js与PhoneGap一起使用.它在chrome浏览器上工作正常.但它不适
用于ng-view标签.当我在模拟器上运行时,角度模块不会调用.你有什么主意吗?
我的代码是这样的.
<body>
<div class="app" >
<h1>Welcome!</h1>
<div id="deviceready">
<div ng-view></div>
</div>
</div>
<script type="text/javascript" src="cordova-2.0.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
</script>
<script src="http:////cdnjs.cloudflare.com/ajax/libs/zepto/1.0rc1/zepto.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.2/angular.min.js"> </script>
<script type="text/javascript" src="js/router.js"></script>
</body>
Run Code Online (Sandbox Code Playgroud)
var app = {
initialize: function() {
this.bind();
},
bind: function() {
document.addEventListener('deviceready', this.deviceready, false);
},
deviceready: function() {
// note that this is an event handler so the scope is that of the event
// so we need to call app.report(), and not this.report() …Run Code Online (Sandbox Code Playgroud) 我正在构建用于检测欺诈ATM卡交易的实时处理.为了有效地检测欺诈,逻辑要求按卡分配最后交易日期,交易金额按天(或最后24小时)计算.
其中一个用例是,如果在该国家/地区之外的卡片交易超过该国家最后一次交易的30天,则会发送警报作为可能的欺诈行为
所以试着将Spark流视为一种解决方案.为了实现这一目标(可能我对功能编程缺乏了解),下面是我的psudo代码
stream=ssc.receiverStream() //input receiver
s1=stream.mapToPair() // creates key with card and transaction date as value
s2=stream.reduceByKey() // applies reduce operation for last transaction date
s2.checkpoint(new Duration(1000));
s2.persist();
Run Code Online (Sandbox Code Playgroud)
我这里面临两个问题
1)如何进一步使用这个最后的交易日期以便将来从同一张卡进行比较
2)如何保持数据所以即使重启驱动程序然后s2的旧值恢复回来3)updateStateByKey可以用来维持历史状态?
我想我错过了如何实现这种逻辑的火花流/函数编程的关键点.