我在IntelliJ IDEA中有一个项目,我想在本地运行.当我点击它的调试按钮时,它说:
ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options.
Disconnected from server
Error occurred during initialization of VM
agent library failed to init: jdwp
Run Code Online (Sandbox Code Playgroud)
当我单击运行按钮时,它可以工作.有什么事?
当我将SQL插入DateTime数据库时,我得到了2007-02-07 12:00:00.00
但我做了Date这样的对象:2007-02-07 17:29:46.00
如何获取数据库中秒的值.它总是把它改回来12:00:00.00
date.setYear(Integer.valueOf(parsedDate[2].replaceAll(" ", "")) - 1900);
date.setMonth(Integer.valueOf(parsedDate[0].replaceAll(" ", "")));
date.setDate(Integer.valueOf(parsedDate[1].replaceAll(" ", "")));
...
java.sql.Date sqlDate = new java.sql.Date(date.getTime());
Run Code Online (Sandbox Code Playgroud)
我应该使用任何格式化程序吗?
我在gwt应用程序上有一个FlowPanel对象.
FlowPanel flowPanel = new FlowPanel();
flowPanel.add(new Button("Edit"));
flowPanel.add(new Button("Delete"));
flowPanel.getElement().setId("idOfFlow");
Run Code Online (Sandbox Code Playgroud)
它给了我以下错误:
flowPanel.getElement().setId("idOfFlow") = No such instance method:
'void com.google.gwt.core.client.JavaScriptObject$.setId (java.lang.String)'
Run Code Online (Sandbox Code Playgroud)
如何设置ID FlowPanel?
当我在eclipse上启动tomcat时,我得到了这样的消息:
Tomcat v6.0 Server在localhost上所需的端口8009已在使用中.服务器可能已在另一个进程中运行,或者系统进程可能正在使用该端口.要启动此服务器,您需要停止其他进程或更改端口号.
当我手动启动tomcat时,它给了我这个异常轨道:
C:\apache-tomcat-6\bin>catalina.bat run
Using CATALINA_BASE: "C:\apache-tomcat-6"
Using CATALINA_HOME: "C:\apache-tomcat-6"
Using CATALINA_TMPDIR: "C:\apache-tomcat-6\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.6.0_20"
Using CLASSPATH: "C:\apache-tomcat-6\bin\bootstrap.jar"
Dec 14, 2011 11:32:17 AM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.22.
Dec 14, 2011 11:32:17 AM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], r
andom [true].
Dec 14, 2011 11:32:20 AM org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Dec 14, 2011 11:32:20 AM org.apache.coyote.ajp.AjpAprProtocol init
SEVERE: …Run Code Online (Sandbox Code Playgroud) 我正在做一些PHP的东西,而不是它是调试模式.所以我就是我们
error_reporting(E_ALL);
Run Code Online (Sandbox Code Playgroud)
但是当我尝试访问字符串的任何字符时,由于错误报告而导致错误.
$sentence = "Hello World";
$sentence[0] //Uninitialized string offset: 0
Run Code Online (Sandbox Code Playgroud)
编辑:
public static function prepareSentence($sentence)
{
$sentence = trim($sentence);
if ($sentence[0] == '"') //Uninitialized string offset: 0
$sentence = substr($sentence, 1, strlen($sentence));
if ($sentence[strlen($sentence) - 1] == '"')
$sentence = substr($sentence, 0, -1);
if ($sentence[0] == '"' || $sentence[strlen($sentence) - 1] == '"')
return self::prepareSentence($sentence);
return $sentence;
}
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能在开发模式下工作.我需要error_reporting(E_ALL);
提前致谢.
我正在测试hibernate并给出这个查询
transaction = session.beginTransaction();
city = new City("A");
city = (City)session.merge(city);
city.setName("B");
transaction.commit();
Run Code Online (Sandbox Code Playgroud)
我在命令行中收到这些查询:
Hibernate: insert into CITY (name) values (?)
Hibernate: update CITY set name=? where CITY_ID=?
Run Code Online (Sandbox Code Playgroud)
我使用merge而不是save,所以为什么hibernate正在更新我的对象,它不应该更新.是吗?这是什么错误?
我为实现了一项服务entity object,它使用了pure jpa,我使用了spring,因此在spring xml config配置hibernate为jpaimpl。我正在使用spring数据进行crud操作。但是在我们的系统中,我们的entity对象被多次拉/更新,并且concurrency对数据的争用程度很高。从我们很多地方的代码中,classes只有inject服务bean和调用getEntity方法来获得实体,它们改变了实体(按照我的理解是分离的,但是在同一线程中,所以em对象应该与我所知相同)因此实体需要一段时间才能恢复服务,因此他们调用save()服务的方法来保存实体。Save()方法只不过是调用merge()杂物操作。它具有@Transactional注释性。出现一个问题,当某人拉一个实体对象,而在更改它时,别人可能拉回并更改它,然后将其保存回去,所以我的实体读取是脏的,如果保存,我将覆盖已经更新的实体。问题在于,我们正在更改服务之外的实体,然后调用保存。在这里,Spring数据存储库类是DAO层。
Optimistic lock是一种解决方案,但由于某些原因我们不喜欢它,因此它对我们不起作用。我在想pessimistic lock。例如,当我通过锁定获取要更新的实体时,然后在其他位置的其他位置将其更改并回叫(entity已被锁定以防止更新!),它是否有效?我不确定它是否仍然EntityManager反对我用来拉实体的对象。如果存在,那么在更新和解锁之前,要花费相当长的时间传递那些“智能”逻辑。
这是该方案的简单示例代码:
class SomeEntity {
Long id;
String field1;
String field2;
String field3;
String field4;
String field5;
String field6;
String field7;
//getters and setters, column annotations
}
class SomeEntityServiceImple implemenet SomeEntityService{ …Run Code Online (Sandbox Code Playgroud) 我正在使用spring mvc 3.0.这是我的控制器类:
@Controller
@RequestMapping("/author")
public class AuthorController {
@Autowired
private IAuthorDao authorDao;
@InitBinder
public void initBinder(WebDataBinder binder) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
binder.registerCustomEditor(Date.class, new CustomDateEditor(
dateFormat, true));
}
@RequestMapping(method = RequestMethod.GET)
public String get(Model model) {
return "author-list";
}
@RequestMapping(value = "/new", method = RequestMethod.GET)
public String create(Model model) {
model.addAttribute("author", new Author());
return "author-form";
}
@RequestMapping(value = "/new", method = RequestMethod.POST)
public String createPost(@ModelAttribute("author") Author author,
BindingResult result) {
new AuthorValidator().validate(author, result);
if (result.hasErrors()) {
return "author-form"; …Run Code Online (Sandbox Code Playgroud) 我有一个字符串,它保存一个对象的innerHtml(通过调用收到$.html()).
如何基于该字符串创建jQuery对象?
我有一个Vertiacal面板对象,该对象包含许多单选按钮
那么我可以通过Vertiacal面板对象获取那些radioButton对象.
也许通过迭代或?
private void initCourse() {
coursePopupPanel.clear();
VerticalPanel verticalPanel = new VerticalPanel();
coursePopupPanel.setWidget(verticalPanel);
JsArray<JCourse> jCourseArray = JCourse.getList(stringMainData);
for (int i = 0; i < jCourseArray.length(); i++) {
final RadioButton courseRadioButton = new RadioButton("course");
courseRadioButton.setText(jCourseArray.get(i).getName());
courseRadioButton.getElement().setId(jCourseArray.get(i).getView());
verticalPanel.add(courseRadioButton);
//handler of course radio buttons
courseRadioButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
}
});
}
}
Run Code Online (Sandbox Code Playgroud)
我有一个对coursePopupPanel的引用.但我没有参考垂直面板,所以我可以获得垂直面板sonce的元素保持对coursePopupPanel的引用.
我使用ant来编译gwt,但编译需要很长时间.接近50秒.
如何加快编译过程.
蚂蚁任务是
<target name="gwtc" description="GWT compile to JavaScript">
<java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
<classpath>
<pathelement location="${src.dir}"/>
<path refid="compile.classpath"/>
</classpath>
<jvmarg value="-Xmx256M"/>
<!--<arg value="-style"/>-->
<!--<arg value="DETAILED"/>-->
<arg value="com.typingApplication.TypingApplication"/>
<arg value="-war" />
<arg value="${build.dir}" />
</java>
</target>
Run Code Online (Sandbox Code Playgroud) 我正在使用 jstl 进行小型测试。它不应该如何工作
这是小代码:
<c:set var="id" value="#{mBlog.blog.id}"/>
${id} //printing 4
<c:if test="${id > 0}">
<h:commandButton value="Update" action="#{mBlog.update}"/> //is not rendered
</c:if>
<c:if test="${id == 0}">
<h:commandButton value="Save" action="#{mBlog.save}"/> //is not rendered
</c:if>
Run Code Online (Sandbox Code Playgroud)
我不知道出了什么问题。在显示器中我只看到 4 个,没有别的。
当我试图创建一个new IndexSearcher(fsDir)类的对象时,它正在抛出IOException read past EOF.搜索索引不是基于RAM的,它是基于NFS的(使用FSDirectorylucene类).
我一派,得到了这一个
没有许可问题,也没有锁定,我用lockhunter检查过
所以必须有写权限,没有人使用该目录.
这是在过去2-3个月的工作.昨天突然停止工作,文件夹中的所有索引文件.
还有什么可能导致这个例外?有没有像索引是2-3个月(某个时期),然后它过期并给出这个例外?
java ×7
gwt ×3
hibernate ×2
ant ×1
concurrency ×1
date ×1
javascript ×1
jdbc ×1
jpa ×1
jquery ×1
jsf ×1
jstl ×1
locking ×1
lucene ×1
php ×1
spring-mvc ×1
tomcat ×1
validation ×1
widget ×1
windows ×1