我使用Eclipse开发Java代码并定期收到以下消息:
资源与文件系统不同步.
右键单击>刷新将始终清除此项.
但是为什么Eclipse在找到这种情况时不能自动刷新?是否存在您希望资源不同步的情况?
如果有这样的条件并且它们不适用于我的工作,有没有办法让Eclipse在遇到这种状态时自动刷新?(我很欣赏它应该在正常开发中尽可能少地刷新,以提高人类开发人员的性能.)
更新(2012-06-25):我的最新更新(版本:Indigo Release Build id:20110615-0604)不再显示首选项 - 常规 - 工作区 - 自动刷新有一个选项"访问时刷新" - 我应该使用它吗?
这些之间有什么区别
Webdriver.Close()Webdriver.Quit()Webdriver.Dispose()哪一个和什么时候使用?
当我使用全局标志和不区分大小写的标志时,这个正则表达式有什么问题?查询是用户生成的输入.结果应该是[true,true].
var query = 'Foo B';
var re = new RegExp(query, 'gi');
var result = [];
result.push(re.test('Foo Bar'));
result.push(re.test('Foo Bar'));
// result will be [true, false]
Run Code Online (Sandbox Code Playgroud)
var reg = /^a$/g;
for(i = 0; i++ < 10;)
console.log(reg.test("a"));Run Code Online (Sandbox Code Playgroud)
这是我的pom文件的片段.
....
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
......
</configuration>
</execution>
</executions>
</plugin>
</plugins>
...
Run Code Online (Sandbox Code Playgroud)
我在命令中成功使用它
mvn install
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试将其封装到"pluginManagement"标签中时,maven-dependency-plugin当我启动install目标时停止工作.为什么"pluginManagement"标签会改变构建行为?或者我应该使用其他目标或选项?
为什么这种创建私有类方法的方法有效:
class Person
def self.get_name
persons_name
end
class << self
private
def persons_name
"Sam"
end
end
end
puts "Hey, " + Person.get_name
puts "Hey, " + Person.persons_name #=> raises "private method `persons_name' called for Person:Class (NoMethodError)"
Run Code Online (Sandbox Code Playgroud)
但这不是:
class Person
def self.get_name
persons_name
end
private
def self.persons_name
"Sam"
end
end
puts "Hey, " + Person.get_name
puts "Hey, " + Person.persons_name
Run Code Online (Sandbox Code Playgroud) 如何根据一个简单的模式(如"dd-MM-yyyy")让杰克逊序列化我的Joda DateTime对象?
我试过了:
@JsonSerialize(using=DateTimeSerializer.class)
private final DateTime date;
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
ObjectMapper mapper = new ObjectMapper()
.getSerializationConfig()
.setDateFormat(df);
Run Code Online (Sandbox Code Playgroud)
谢谢!
我有以下Java代码:
byte value = 0xfe; // corresponds to -2 (signed) and 254 (unsigned)
int result = value & 0xff;
Run Code Online (Sandbox Code Playgroud)
打印时结果是254,但我不知道这段代码是如何工作的.如果&运算符只是按位,那么为什么它不会产生一个字节而是一个整数呢?
以下依赖项之间有什么区别?
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
VS
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
如果我spring-webmvc单独包含,则spring-web隐式添加.
什么时候应该spring-web单独使用?
我已经将log4jConfigLocation放在web.xml中,但我仍然收到以下警告:
log4j:WARN No appenders could be found for logger ?
? (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>/WEB-INF/classes/log4j.properties</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.util.Log4jConfigListener
</listener-class>
</listener>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>suara2</servlet-name>
<servlet-class>
org.springframework.web.servlet.DispatcherServlet
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>suara2</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)