我在其他计算机上导入了我的工作项目,因此它开始下载依赖项.
显然在此期间我的互联网连接崩溃了.现在我得到:
为漫画构建错误; org.apache.maven.lifecycle.LifecycleExecutionException:无法在项目漫画上执行目标测试:无法解析项目漫画的依赖项测试:漫画测试:war:0.0.1-SNAPSHOT:无法解析以下工件:org.springframework:spring- context:jar:3.0.5.RELEASE,org.hibernate:hibernate-entitymanager:jar:3.6.0.Final,org.hibernate:hibernate-core:jar:3.6.0.Final,org.hibernate:hibernate-commons-注释:jar:3.2.0.Final,org.aspectj:aspectjweaver:jar:1.6.8,commons-lang:commons-lang:jar:2.5,
mysql:mysql-connector-java:jar:5.1.13:无法传输org.springframework:来自http://repo1.maven.org/maven2的 spring-context:jar:3.0.5.RELEASE 缓存在本地存储库中,在中心的更新间隔过去或强制更新之前,不会重新尝试解析.
原始错误:无法传输工件org.springframework:spring-context:jar:3.0.5.RELEASE from central(http://repo1.maven.org/maven2):60000后没有收到回复
我不知道如何强制maven更新?
如果我使用,有什么不同
@OneToMany
public Set<Rating> ratings;
Run Code Online (Sandbox Code Playgroud)
或者如果我使用
@OneToMany
public List<Rating> ratings;
Run Code Online (Sandbox Code Playgroud)
两者都工作正常,我知道列表和集合之间的区别,但我不知道这有什么不同,如何hibernate(或更确切地说JPA 2.0)处理它.
我在Rails中遇到了文件上传问题.我找到了file_field :file帮手,可以用form_for(@some_model).但是,我找不到这种情况的任何用法,因为这些标签用于通过质量分配来创建/编辑某些模型.有AFAIK,不可能将fileupload视为典型字段(请参阅文件上传在Ruby on Rails 3中使用Multipart Form不起作用).在这种情况下,需要对上载文件进行手动操作.那么,为什么有人甚至想把文件上传作为模型编辑的一部分呢?
photo.rb
class Photo < ActiveRecord::Base
attr_accessible :name, :filename,
end
Run Code Online (Sandbox Code Playgroud)
photo_form.html.erb
<%= form_for(@photo, :multipart => true) do |f| %>
<%= f.label :name %>
<%= f.text_field :name %>
<%= f.file_field :file %>
<%= f.submit %>
<% end %>
Run Code Online (Sandbox Code Playgroud)
photos_controller.rb
def create
@photo = Photo.new(params[:photo])
Run Code Online (Sandbox Code Playgroud)
上面的行失败,因为theres no:file属性.必须先处理并手动删除:params.再一次 - 这些标签是否真的有用?
我想知道当一个验证器失败时是否可以停止其他验证器的执行?
我有一些豆子,注释如下
import org.hibernate.validator.constraints.*;
/*...*/
@NotBlank(message = SignupForm.NOT_BLANK_MESSAGE)
@Email(message = SignupForm.EMAIL_MESSAGE)
private String email;
@NotBlank(message = SignupForm.NOT_BLANK_MESSAGE)
@Length(min = 6, message = SignupForm.PASSWORD_LENGTH_TOO_SHORT_MESSAGE)
private String password;
Run Code Online (Sandbox Code Playgroud)
这是我的 JSP
<form:label path="email"><s:message code="email" /></form:label>
<form:errors path="email" element="div" class="text-error"/>
<form:input path="email" class="input-block-level" placeholder="Email address" />
<form:label path="email2"><s:message code="repeat_email" /></form:label>
<form:errors path="email2" element="div" class="text-error"/>
<form:input path="email2" class="input-block-level" placeholder="Email address" />
<form:label path="password"><s:message code="password" /></form:label>
<form:errors path="password" element="div" class="text-error"/>
<form:password path="password" class="input-block-level" placeholder="Password" />
<form:label path="password2"><s:message code="repeat_password" /> </form:label>
<form:errors path="password2" element="div" class="text-error"/>
<form:password path="password2" …Run Code Online (Sandbox Code Playgroud) 我有一些SQL函数
CREATE OR REPLACE FUNCTION tools.update_company(IN company_id integer, OUT value integer)
RETURNS integer AS
$BODY$
BEGIN
select * into value from function_making_int(company_id)
END;$BODY$
Run Code Online (Sandbox Code Playgroud)
并且来自Psycopg2(如果重要的话,它在Django内部)我这样做
c = connection.cursor()
c.callproc('tools.update_company', [1, ])
Run Code Online (Sandbox Code Playgroud)
但是函数返回与我给出的完全相同的输入序列,忽略结果和OUT参数.更改为IN OUT并传递一些foo值不会改变任何内容.在数据库中调用时,SQL函数按预期工作
在很多场合,我在的形式使用参数Option与None默认值-这样的:
def foo(bar:Option[String] = None)
Run Code Online (Sandbox Code Playgroud)
这很方便,让我可以轻松省略nulls.但是,如果我这样做,我需要将方法的每次调用都更改为
foo(Some("bar"))
Run Code Online (Sandbox Code Playgroud)
而不是简单的
foo("bar")
Run Code Online (Sandbox Code Playgroud)
然而,这看起来有点多余,因为很明显,当我指定一个值时,它是一个完整的选项.我很确定我可以尝试编写一些隐式转换器来为我做这样的包装 - 不幸的是,我不知道如何.
奖金 - 这是一个理智的事情吗?有没有其他方法来处理"可空"参数问题?
我想创建一些网站,应该有像site.com/user/m4ks这样的URL下可访问的用户配置文件我不知道如何使用Wicket进行此操作.可以用任何通配符制作BookMarkablePage 吗?
我尝试为用户创建表单以使用Wicket进行注册.我有用户POJO和wicket表单 - 这需要有"重复密码"字段,该字段不应该与User对象连接.但是我怎么能这样做呢?一世
public class RegisterForm extends Form<User> {
private static final long serialVersionUID = -9071906666130179515L;
public RegisterForm(String id) {
super(id, new CompoundPropertyModel<User>(new User()));
PasswordTextField pass = new PasswordTextField("password");
pass.setType(String.class);
PasswordTextField pass2 = new PasswordTextField("password2");
pass2.setType(String.class);
pass2.setDefaultModelObject("");
add(new EqualPasswordInputValidator(pass, pass2));
add(new TextField<String>("login")
.setType(String.class)
.setRequired(true)
.add(new PatternValidator("[a-z0-9]*")));
add(new TextField<String>("email")
.setType(String.class)
.add(EmailAddressValidator.getInstance()));
add(pass);
add(pass2);
}
Run Code Online (Sandbox Code Playgroud)
但我明白了
java.lang.IllegalStateException:尝试在组件的null模型上设置模型对象:
或者用户模型没有与password2相关的方法.如何处理这种情况?
我在使用Spring(3.0.5),Hibernate(3.6.0)和Wicket(1.4.14)开发应用程序时遇到了奇怪的问题.问题是:我无法将任何对象保存或修改为数据库.通过'不能',我的意思是对象的所有更改或对EntityManager.persist(foo)的调用都被简单地,默默地忽略.选择工作.
示例案例很简单 - 在一些wicket页面上我尝试将对象保存到数据库中,如下所示
public class ComicDetailsPage extends PublicBasePage {
@Override
protected void onConfigure() {
System.out.println("In onConfigure");
super.onConfigure();
comicDAO.insert("abc");
}
@SpringBean(name="comicDAO")
private ComicDAO comicDAO;
(....)
Run Code Online (Sandbox Code Playgroud)
这是comicDAO
@Service
public class ComicDAO {
@PersistenceContext
private EntityManager em;
(...)
@Transactional
public void insert(String title) {
Comic c = new Comic();
c.setTitle(title);
em.persist(c);
}
@Transactional
public Comic add1toTitle(int pk) {
System.out.println("Beginning fetching");
Comic c = em.find(Comic.class, pk);
System.out.println("Fetched updating");
c.setTitle(c.getTitle()+"1");
System.out.println("Updated persisting");
em.persist(c);
System.out.println("Persisted returning");
return c;
}
Run Code Online (Sandbox Code Playgroud)
我打开了日志记录,这里是日志的相关部分(Hibernate和Spring都设置为TRACE).我将**添加到我认为在这里很重要的行.
In onConfigure
01:53:19.330 [qtp2119047503-15] DEBUG …Run Code Online (Sandbox Code Playgroud) 我为iPad 3开发了应用程序 - 带Retina显示屏.我根据规格计算出图像应该是1536 x 2008,以填充(使用状态栏)整个屏幕.我将图像重新调整为这样的尺寸,并以编程方式加载它并将其设置为在UIImageView上显示(从故事板加载).更重要的是,为了获得最佳性能,我将UIImageView模式设置为Center(以避免缩放).当我运行应用程序时,我只看到我的图像的中心 - 好像我的图像是屏幕的4倍 - 这不是真的.
她是我的viewWillAppear方法的代码
UIImage *image = [UIImage imageWithContentsOfFile: self.pageData.pageFilename];
NSLog(@"Image size: %f %f", [image size].width, [image size].height);
NSLog(@"Image view size: %f %f", self.imageView.frame.size.width, self.imageView.frame.size.height);
[ self.imageView setImage: image];
Run Code Online (Sandbox Code Playgroud)
我得到输出:
Image size: 1536.000000 1990.000000
Image view size: 768.000000 1004.000000
Run Code Online (Sandbox Code Playgroud)
怎么纠正这个?我的图像是你可以看到的尺寸的JPG和72 DPI - 但我确信DPI并不重要
我尝试构建简单的应用程序,我想使用spring,wicket和JPA2.0(Hibernate).把所有这些放在一起我使用maven.我有hibernate的问题.下面是我的pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>comicsTest</groupId>
<artifactId>comicsTest</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<repositories>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Repository Group</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.5.RELEASE</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>wicket</groupId>
<artifactId>wicket</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>wicket</groupId>
<artifactId>wicket-spring</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>wicket</groupId>
<artifactId>wicket-extensions</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>3.0.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hiberante</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.6.0.Final</version>
</dependency>
</dependencies>
<modules>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Run Code Online (Sandbox Code Playgroud)
而我得到的只是
27.12.10 12:41:44 CET: Refreshing [/comicsTest/pom.xml]
27.12.10 12:41:48 CET: Downloaded …Run Code Online (Sandbox Code Playgroud) 这是我第一次使用Zookeeper,我使用Scala作为编程语言.Zookeeper是否支持Scala?如果没有,是否有任何解决方案?非常感谢你.