如果我把:
public CountryState CountryState.find(long id) {
return (CountryState) findById(CountryState.class, id);
}
Run Code Online (Sandbox Code Playgroud)
我正在类CountryState中创建一个方法find.
有没有办法在几个类中创建一个方法?我是否需要为我想要创建的每个类重复代码?
我知道使用方面我可以使一个类继承自另一个,但是,这样做,我可以创建一个超类,因为java不接受多重继承.
我需要使用detachedCriteria执行此SQL查询:
SELECT g.id FROM games g
WHERE NOT EXISTS (
SELECT 1 FROM users_games ug WHERE ug.user_id = 1 AND g.id = ug.game_id)
Run Code Online (Sandbox Code Playgroud)
我们的想法是从不属于用户的游戏中获取ID.我尝试了10种不同的方法与detachedCriteria,但我得到"未知的实体:null"MappingException代码应如下所示:
DetachedCriteria subquery = DetachedCriteria.forClass(UserGame.class, "ug")
.add(Restrictions.eq("ug.user.id", 1))
.add(Restrictions.eqProperty("ug.game.id","u.id"));
DetachedCriteria criteria = DetachedCriteria.forClass(Game.class, "g")
.add(Subqueries.notExists(subquery));
Run Code Online (Sandbox Code Playgroud)
设置预测只返回游戏的ID.
有任何想法吗?我认为Hibernate在没有别名的情况下加入查询时遇到了一些麻烦.添加别名有效,但结果非常错误.
如何在C++中实现对私有基类的转换?我不想使用诸如添加朋友之类的黑客.定义公共投射操作符不起作用.
编辑:
例如,我有:
class A {
//base class
}
class AX : private A {
//a child
}
class AY : private A {
//another specialized child
}
class B {
//base class
void do (A a) {//do
}
}
class BX : private B {
//a child
void do (AX a) {
B::do( static_cast <A> (a) );
}
}
class BY : private B {
//another specialized child
void do (AY a) {
B::do( static_cast <A> (a) );
} …Run Code Online (Sandbox Code Playgroud) 我试图在IIS管理器中配置.NET编译设置,但我看到的是一条错误消息,告诉我web.config文件中有一个无法识别的元素C:\windows\Microsoft.NET\Framework64\v.4.0.30319\config\.
对我来说有点奇怪的是,我在Windows 7系统和Windows Server 2008 R2上都收到此错误消息.
虽然谷歌搜索了一点点我发现的是这篇博客文章http://olegtarasov.me/2010/09/nastrojka-iis-7-5-i-asp-net-4/.我尝试了这个aspnet_regiis -i -enable命令,但这对我来说不是解决方案.
看起来clojure 将有一个fork-join实现,它看起来像是java的fork join框架的功能包装器.
我想知道这些和pmap/preduce之间的区别是什么?
在根(www)我有两个文件夹.
在第一个文件夹"folder1"中,我放了一个名为register.php的文件.
在下一个文件夹"folder2"中,我放置了名为header.php和footer.php的文件.
我需要在register.php文件中包含folder2的页眉和页脚文件.
我怎样才能做到这一点?我试图使用这个包括../folder2/header.php ..
但它不起作用
我正在构建一个相当简单的配方应用程序来学习RoR,我试图通过单击链接而不是通过表单来允许用户保存配方,所以我通过link_to连接user_recipe控制器的'create'功能.
不幸的是,由于某种原因,link_to正在调用索引函数而不是create.
我把link_to写成了
<%= "save this recipe", :action => 'create', :recipe_id => @recipe %>
此链接位于user_recipes/index.html.erb上,并且正在调用同一控制器的"create"功能.如果我包含:controller,它似乎没有什么区别.
控制器看起来像这样
def index
@recipe = params[:recipe_id]
@user_recipes = UserRecipes.all # change to find when more than one user in db
respond_to do |format|
format.html #index.html.erb
format.xml { render :xml => @recipes }
end
end
def create
@user_recipe = UserRecipe.new
@user_recipe.recipe_id = params[:recipe_id]
@user_recipe.user_id = current_user
respond_to do |format|
if @menu_recipe.save
format.html { redirect_to(r, :notice => 'Menu was successfully created.') }
format.xml { render :xml = … 在现代浏览器中,我的网站被标记为sorta不安全:
例如谷歌浏览器The server does not support the TLS renegotiation extension在"页面信息"中说" ".
HTTPS运行正常,连接已加密且证书有效.
# openssl version
OpenSSL 0.9.8g 19 Oct 2007
# cat /etc/debian_version
5.0.6
# apache2ctl -V
Server version: Apache/2.2.9 (Debian)
Server built: Apr 20 2010 21:44:40
Server's Module Magic Number: 20051115:15
Server loaded: APR 1.2.12, APR-Util 1.2.12
Compiled using: APR 1.2.12, APR-Util 1.2.12
Architecture: 64-bit
Server MPM: ITK
threaded: no
forked: yes (variable process count)
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/experimental/itk"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped …Run Code Online (Sandbox Code Playgroud) 更新:我找到了解决方法.如果我提交一个虚拟表单字段和文件,它可以工作.这是一个ColdFusion错误,还是HTTP规范中有些内容表明表单必须包含至少一个非文件表单字段?
更新2:我确信这是一个ColdFusion cfhttp错误.这是基于Leigh的答案以及我使用下面的代码使用javascript 仅使用文件元素提交表单的事实,并且它工作正常:
<form enctype="multipart/form-data" action="<cfoutput>#CGI.PATH_INFO#</cfoutput>" method="POST" name="theForm">
<input name="theFile" type="file" /><br/>
</form>
<a href="#" onclick="document.theForm.submit()">submit</a>
Run Code Online (Sandbox Code Playgroud)
我在将文件从ColdFusion服务器上传到另一个Web服务器时遇到了问题.似乎cfhttpparam type="file"是不加选择地在文件末尾添加换行符(回车符和换行符).这打破了二进制文件.这不,当我手动上传通过表单字段的文件发生.我尝试过有和没有mimetype参数,我试过用各种二进制格式(exe,zip,jpg)说谎mimetype,但没有任何效果.是否有一些我缺少的参数,或者这是ColdFusion中的一个错误?(我在WinXP上运行CF 8.0.1.195765.)
下面是我正在使用的测试代码,它只是将文件上传到同一目录.手动上载有效,但基于服务器的上载最终会将CRLF附加到文件中.
<cfset MyDir = "C:\test" />
<cfset MyFile = "test.zip" />
<cfif IsDefined("Form.TheFile")>
<cffile action="upload" fileField="theFile" destination="#MyDir#" nameConflict="MakeUnique" />
<cfelse>
<cfhttp url="http://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#" method="POST" throwOnError="Yes">
<cfhttpparam type="file" name="theFile" file="#MyDir#\#MyFile#" />
</cfhttp>
</cfif>
<html><body>
<h2>Manual upload</h2>
<form enctype="multipart/form-data" action="<cfoutput>#CGI.PATH_INFO#</cfoutput>" method="POST">
<input name="theFile" type="file" /><br/>
<input type="submit" value="Submit" />
</form>
</body></html>
Run Code Online (Sandbox Code Playgroud) 我一直在测试用PHP和JavaScript编写的Web应用程序,我正在寻找可以与持续集成服务器(可能是phpUnderControl)进行良好通信的集成测试工具.
作为集成测试工具,我使用了Selenium和Rspec,它运行得很好.这会生成html文件报告并且非常容易编写代码.但我不确定Selenium是否可以与CI通信,并想知道是否有任何集成测试工具可以与持续集成服务器(如phpUnderControl)通信,并与其他测试工具一起使用以实现自动化测试.
我非常感谢任何建议.
最诚挚的问候
@naoyamakino
java ×2
php ×2
aop ×1
apache ×1
aspectj ×1
aspects ×1
base-class ×1
c++ ×1
casting ×1
clojure ×1
coldfusion ×1
concurrency ×1
file-upload ×1
forms ×1
hibernate ×1
iis-7.5 ×1
link-to ×1
openssl ×1
qa ×1
selenium ×1
ssl ×1
subquery ×1
web-config ×1