我有一个简单的测试方法,设置为每5秒运行一次,但是看看System.out,你可以看到它似乎做了一些奇怪的事情.
@Scheduled(cron="*/5 * * * * ?")
public void testScheduledMethod() {
System.out.println(new Date()+" > Running testScheduledMethod...");
}
Run Code Online (Sandbox Code Playgroud)
输出:
Wed Jan 09 16:49:15 GMT 2013 > Running testScheduledMethod...
Wed Jan 09 16:49:15 GMT 2013 > Running testScheduledMethod...
Wed Jan 09 16:49:20 GMT 2013 > Running testScheduledMethod...
Wed Jan 09 16:49:20 GMT 2013 > Running testScheduledMethod...
Wed Jan 09 16:49:25 GMT 2013 > Running testScheduledMethod...
Wed Jan 09 16:49:25 GMT 2013 > Running testScheduledMethod...
Wed Jan 09 16:49:30 GMT 2013 > Running …Run Code Online (Sandbox Code Playgroud) URL url = new URL("ftp://user:pass@ftp.example.com/thefolder/");
URLConnection connection = url.openConnection();
...
// List files in folder...
Run Code Online (Sandbox Code Playgroud)
使用类似上面的内容,我想知道如何获取文件夹'thefolder'中的文件列表?
嗨,大家好,
继这个原始问题之后,我把这个简单的FTP连接放在一起,这个连接都很好用.它可以查看/ live/conf/location中的所有文件,并将它们全部复制到local/conf/location.唯一的问题是,它正在复制文件,但没有内容.它们都是0KB而且是空的!
任何人都可以看到任何明显的复制文件名但不是文件内容.
干杯
KPS
try {
FTPClient ftp = new FTPClient();
ftp.connect("000.000.000.000");
ftp.login("USER", "PASSWORD");
ftp.enterLocalPassiveMode();
ftp.setFileType(FTP.BINARY_FILE_TYPE);
FTPFile[] files = ftp.listFiles("/live/conf/");
for (int i=0; i < files.length; i++) {
if (files[i].getName().contains(".csv")) {
String remoteFile1 = files[i].getName();
File downloadFile1 = new File("/var/local/import/conf/"+files[i].getName());
OutputStream outputStream1 = new BufferedOutputStream(new FileOutputStream(downloadFile1));
ftp.retrieveFile(remoteFile1, outputStream1);
outputStream1.close();
}
}
ftp.disconnect();
} catch (SocketException ex) {
ex.printStackTrace();
} catch (IOException ex) …Run Code Online (Sandbox Code Playgroud) 只是想知道是否可以在Oracle 11g的单个查询中将INSERT运行到两个表中?
我知道你可以做一个INSERT ALL ... SELECT查询,但是我需要在没有SELECT的情况下这样做,因为这是直接从XLS进入数据库的数据.
理想情况下,我想要这样的例子:
INSERT INTO table1 t1, table2 t2
(t1.tid, t1.date, t1.title, t2.tid, t2.date, t2.user, t2.note)
VALUES (1,'01-JAN-15','title',1,'01-JAN-15','john','test note');
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
提前致谢
KS
我有一个非常简单的C++类,只打开一个空白的Windows窗口,但我注意到每次双击.exe时,它都会打开窗口,但它也会打开一个命令提示符窗口.是否有一种快速简便的方法来阻止此命令提示符窗口的发生?
提前干杯,
KS.
#include <windows.h>
const char g_szClassName[] = "myWindowClass";
// Step 4: the Window Procedure
LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_LBUTTONDOWN:
{
char szFileName[MAX_PATH];
HINSTANCE hInstance = GetModuleHandle(NULL);
GetModuleFileName(hInstance, szFileName, MAX_PATH);
MessageBox(hwnd, szFileName, "This program is:", MB_OK | MB_ICONINFORMATION);
}
break;
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return DefWindowProc(hwnd, msg, wParam, lParam);
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{ …Run Code Online (Sandbox Code Playgroud) 我正在寻找一种方法,我可以使用一个国家列表...所以当你点击一个链接时,国家代码参数会被传递给qjuery,这将返回一个城市列表.
我已经能够使用下拉列表完成所有这些操作,但是想将其更改为a.href链接.
像下面这样的东西......
$('#country').click(function(event) {
// get the countryCode value here
var $country=$("a#country").val();
...
Run Code Online (Sandbox Code Playgroud)
这些需要通过countryCode
<a href="#" id="country">Australia</a>
<a href="#" id="country">United Kingdom</a>
<a href="#" id="country">NewZealand</a>
Run Code Online (Sandbox Code Playgroud) 在Oracle数据库中,我有一个表,其中包含许多不同测试类型的结果。
表:
object_tested, test_date, test_a, test_a_result, test_b, test_b_result
TmpObj timestamp, value1 value2 value3 value4
Run Code Online (Sandbox Code Playgroud)
我需要导出这些测试结果,但需要为每个测试创建一个单独的行,如下所示:
object_tested, test_date, test, test_result
TmpObj timestamp, value1, value2
TmpObj timestamp, value3, value4
Run Code Online (Sandbox Code Playgroud)
最快的方法是什么?也许是UNION或JOIN?
快问.当你在webApp使用的另一个jar中时,你可以在applicationContext.xml中引用Spring类吗?
JAR(包含我所有服务和daos等的常见jar)在WAR文件中,但是当我尝试通过applicationContext.xml引用服务时,我收到以下错误: -
Error creating bean with name 'com.myproject.common.test.impl.TestServiceImpl' defined in ServletContext resource [/WEB-INF/context/spring-context.xml]: Instantiation of bean failed; nested exception is java.lang.IllegalStateException: No bean class specified on bean definition
Run Code Online (Sandbox Code Playgroud)
(注意spring-context.xml被导入applicationContext.xml而没有错误.)
我的上下文XML:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<bean id="com.myproject.common.test.impl.TestServiceImpl">
<property name="genericDao" ref="genericDao" />
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
我的应用程序包都在com.myproject.web下我的常见JARS都在com.myproect.common下
Java String.startsWith()中的快速问题需要某种通配符.
我需要检查,看是否有链接开头http://或本地驱动器(c:\,d:\等),但我不知道的驱动器号.
所以我想我需要类似的东西 myString.startsWith("?:\\")
有任何想法吗?
为此欢呼,但我想我需要在此基础上继续努力.
我现在需要迎合
1.http://
2.ftp://
3.file:///
4.c:\
5.\\
Run Code Online (Sandbox Code Playgroud)
这太过分了,但我们想确保我们抓住了所有这些.
我有
if(!link.toLowerCase().matches("^[a-z]+:[\\/]+.*")) {
Run Code Online (Sandbox Code Playgroud)
适用于任何字符或字符后跟一个:( 示例http:,ftp:,C :),其中包括1-4但我无法满足\\
我能得到的最近的就是这个(它有效,但在regEx中得到它会很好).
if(!link.toLowerCase().startsWith("\\") && !link.toLowerCase().matches("^[a-z]+:[\\/]+.*")) {
Run Code Online (Sandbox Code Playgroud) 我正在尝试找到一种方法来动态构建环境变量,其中包含应用程序的 WEB-INF/lib 文件夹下的 JAR 文件列表。
这是我到目前为止所拥有的,但它每次都会覆盖自己,因此当到达循环末尾时,您只有变量中设置的循环中的最后一个文件。
SETLOCAL ENABLEDELAYEDEXPANSION
for %%f IN (WEB-INF/lib/*.jar) DO (
SET JAR_LIST=%JAR_LIST%;%%f
)
ECHO JAR_LIST -- %JAR_LIST%
Run Code Online (Sandbox Code Playgroud)
所以这会产生...
C:\apache\Tomcat6.0\webapps\myapp>(SET JAR_LIST=.;xsltcbrazil.jar )
C:\apache\Tomcat6.0\webapps\myapp>(SET JAR_LIST=.;xsltcejb.jar )
C:\apache\Tomcat6.0\webapps\myapp>(SET JAR_LIST=.;xsltcservlet.jar )
C:\apache\Tomcat6.0\webapps\myapp>ECHO JAR_LIST -- .;xsltcservlet.jar
JAR_LIST -- .;xsltcservlet.jar
java ×4
oracle ×2
spring ×2
sql ×2
ajax ×1
batch-file ×1
c++ ×1
environment ×1
executable ×1
file ×1
ftp ×1
javascript ×1
jquery ×1
mapping ×1
schedule ×1
startswith ×1
string ×1
windows ×1