我有一个包含UNIX Epoch时间的字符串,我需要将其转换为Java Date对象.
String date = "1081157732";
DateFormat df = new SimpleDateFormat(""); // This line
try {
Date expiry = df.parse(date);
} catch (ParseException ex) {
ex.getStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
标记的线是我遇到麻烦的地方.我无法弄清楚SimpleDateFormat()的参数应该是什么,或者即使我应该使用SimpleDateFormat().
我尝试在谷歌搜索,但我找不到任何好的例子,其中用数据库检查用户名和密码以进行身份验证.
换句话说,如何使用Spring和Hibernate创建一个简单的登录表单,其中使用数据库检查凭据.
更新
Cam有没有想出一个简单的例子,我可以看到流程如何以及输入数据如何传递给hibernate?
我一直在阅读Stoyan Stefanov撰写的JavaScript Patterns一书,其中一个强制构造函数的新运算符的模式就像这样
function Waffle() {
if (!(this instanceof Waffle)) {
return new Waffle();
}
this.tastes = "yummy";
}
Waffle.prototype.wantAnother = true;
Run Code Online (Sandbox Code Playgroud)
以这种方式书写时,您可以使用其中一种方式调用Waffle
var first = new Waffle(),
second = Waffle();
Run Code Online (Sandbox Code Playgroud)
我认为这是一个有用的功能,不确定它是否在未来版本的ecma/javascript中实现
我想出了一些东西,我认为每次创建构造函数时都可以复制和粘贴
这样的事情
function checkInstance (name) {
if (name.constructor.name === undefined) {
return "construct it"
} else {
return false;
}
}
function Waffle() {
var _self = checkInstance.call(this, this);
if (_self === "construct it") {
return new Waffle()
}
this.tastes = "yummy"
}
var waffle = Waffle()
waffle …Run Code Online (Sandbox Code Playgroud) var express = require('express');
var app = express();
port = process.argv[2] || 8000;
app.configure(function () {
app.use(
"/",
express.static(__dirname)
);
});
app.listen(port);
Run Code Online (Sandbox Code Playgroud)
我删除了下面的这一行,并在加载localhost时出错
app.configure(function () {
app.use(
"/",
express.static(__dirname)
);
});
Run Code Online (Sandbox Code Playgroud)
今天我正在浏览一个网站,发现了一些关于这个iphone和ipad开发项目的东西.我有一个问题,开发人员是否需要iPhone实际使用,或者是否有其他模拟器类型设备,我们也可以测试它.
如果您可以在开始时分享一些文档也会很棒.
谢谢.
var sys = require("sys"),
my_http = require("http");
my_http.createServer(function(request,response){
sys.puts("I got kicked");
response.writeHeader(200, {"Content-Type": "text/plain"});
response.write("Hello World");
response.end();
}).listen(8080);
sys.puts("Server Running on 8080");
Run Code Online (Sandbox Code Playgroud)
以上是我的基本web服务器,现在我想运行包含HTML和JS文件的应用程序.我会在哪里放置这些文件,以便我可以通过我的端口访问它.
我使用Apache and Xampp,所以我将我的文件放在htdocs目录中并通过我的浏览器访问它,但就node.js我而言,我完全糊涂了?
ArrayList<HashMap<String, String>>
arrayListRowsFirst = new ArrayList<HashMap<String, String>>();
Run Code Online (Sandbox Code Playgroud)
今天,当我通过代码时,这段代码让我感到震惊了一段时间.以下是我对此声明的一些问题.
我有一个应用程序,我需要检查是否username与password给定的输入是谷歌的username和password,然后告诉他基于一些自定义设置.
我无法在我的办公室检查互联网,Gmail关键字被阻止,当我导航到其他网站时,由于关键字被阻止,它们被阻止.
谁能指导我?PHP或Java都可以接受.
更新的信息
http://www.sourcebits.com/geemail/
只需检查他们已经开发的AIR Application.我在想这样的事.
我有一个检票口联系表格,我收到了表格对象.现在我需要将此对象传递给Spring Service.
package com.mysticcoders.mysticpaste.web.pages;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.TextField;
import org.apache.wicket.markup.html.panel.FeedbackPanel;
import com.mysticcoders.mysticpaste.model.Contact;
import org.apache.wicket.model.CompoundPropertyModel;
import com.mysticcoders.mysticpaste.services.IContact;
public class FormPage extends WebPage
{
private Contact contact;
private IContact icontact;
public FormPage()
{
// Add a FeedbackPanel for displaying our messages
FeedbackPanel feedbackPanel = new FeedbackPanel("feedback");
add(feedbackPanel);
Form<Object> form = new Form<Object>("contactForm",
new CompoundPropertyModel<Object>(contact))
{
private static final long serialVersionUID = 1L;
protected void onSubmit(Contact contact)
{
icontact.saveContact(contact);
}
};
form.add(new TextField<Object>("name"));
form.add(new TextField<Object>("email"));
form.add(new TextField<Object>("country"));
form.add(new TextField<Object>("age"));
add(form);
// …Run Code Online (Sandbox Code Playgroud) 我在设置xDocklet并遇到此错误时遇到了一些麻烦.
从存储库解析插件'xdoclet:maven2-xdoclet2-plugin'的版本时出错
<pluginRepositories>
<pluginRepository>
<id>codehaus-plugins</id>
<url>http://dist.codehaus.org/</url>
<layout>legacy</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<plugin>
<groupId>xdoclet</groupId>
<artifactId>maven2-xdoclet2-plugin</artifactId>
<executions>
<execution>
<id>xdoclet</id>
<phase>generate-sources</phase>
<goals>
<goal>xdoclet</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>xdoclet-plugins</groupId>
<artifactId>xdoclet-plugin-qtags</artifactId>
<version>1.0.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>xdoclet-plugins</groupId>
<artifactId>xdoclet-taglib-qtags</artifactId>
<version>1.0.4-SNAPSHOT</version>
</dependency>
</dependencies>
<goals>
<goal>xdoclet</goal>
</goals>
<configuration>
<configs>
<config>
<components>
<component> <classname>org.xdoclet.plugin.qtags.impl.QTagImplPlugin</classname>
</component>
<component>
<classname>org.xdoclet.plugin.qtags.impl.QTagLibraryPlugin</classname>
<params> <packagereplace>org.xdoclet.plugin.${xdoclet.plugin.namespace}.qtags</packagereplace>
</params>
</component>
<component>
<classname>org.xdoclet.plugin.qtags.doclipse.QTagDoclipsePlugin</classname>
<params>
<filereplace>qtags.xml</filereplace>
<namespace>${xdoclet.plugin.namespace}</namespace>
</params>
</component>
<component>
<classname>org.xdoclet.plugin.qtags.confluence.QTagConfluencePlugin</classname>
<params>
<destdir>${project.build.directory}/tag-doc</destdir>
<namespace>${xdoclet.plugin.namespace}</namespace> <filereplace>${xdoclet.plugin.namespace}.confluence</filereplace>
</params>
</component>
</components>
<includes>**/*.java</includes>
<params>
<destdir>${project.build.directory}/generated-resources/xdoclet</destdir>
</params>
</config>
</configs>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我的一些问题. …
什么是同步方法,什么是异步方法?同步和异步方法有什么区别?我什么时候必须使用同步或异步方法?我问这些问题是因为我不明白:
public async void ReadData(filepath)
{
CreateDoc("hello"); //<------ Why I can't do that ?
}
public void CreateDoc(string astring)
{
Debug.WriteLine(astring);
}
Run Code Online (Sandbox Code Playgroud)
为什么我不能这样做?:
public async void ReadData(filepath)
{
var BarreDroite = new string[] { "|" };
foreach (string tableArret in items.Split(BarreDroite, StringSplitOptions.RemoveEmptyEntries))
{
listeArret.Add(tableArret); //<---- Here appear the problem.
}
{
Run Code Online (Sandbox Code Playgroud)
我问这个问题是因为我在网上找不到明确的解释。
java ×6
javascript ×3
hibernate ×2
node.js ×2
spring ×2
asynchronous ×1
c# ×1
date ×1
express ×1
ipad ×1
iphone ×1
java-time ×1
maven-2 ×1
php ×1
spring-mvc ×1
synchronous ×1
wicket ×1