小编Dea*_*ake的帖子

DB2的GETDATE()方法

我已经尝试了一段时间来获得GETDATE()DB2 for i中的类似方法.到目前为止,我发现了以下内容:

current date
current timestamp
current time
Run Code Online (Sandbox Code Playgroud)

我有可能:

 select specific, columns
 from table
 where datefield = current date - 1 day
Run Code Online (Sandbox Code Playgroud)

这是最有效的方式还是有一些方法我可能还没有找到?

编辑:

我目前有这个:

WHERE datefield = - days(date('2013-10-28'))
Run Code Online (Sandbox Code Playgroud)

虽然这没有用,因为我需要每天编辑它以运行查询.

现在来到这个:

WHERE datefield = VARCHAR_FORMAT(CURRENT TIMESTAMP, 'YYYYMMDD') - 1
Run Code Online (Sandbox Code Playgroud)

除非这个在一月的第一天不起作用,因为1 - 1 = 0并且一个月内没有第0天......

sql t-sql sql-server db2-400 ibm-midrange

10
推荐指数
1
解决办法
7万
查看次数

在Angular中动态重置ng-form

我已经采取了看看下面:重设表单在AngularJS棱角分明的子窗体数据和重置验证这些我想创建一个动态表单复位/清除功能,会是什么样子像下面这样:

$scope.clearSection = function(formName){

    $scope.formName.$setPristine();
    $scope.formName.$setUntouched();
};
Run Code Online (Sandbox Code Playgroud)

是否可以在角度中创建一个动态清除函数,其中表单名称动态传递给此函数?

javascript angularjs

6
推荐指数
1
解决办法
3011
查看次数

MSSQL Totals每天一个月

我正在尝试做一些与我之前提出的问题非常类似的事情,但我似乎无法让它正常工作.这是我之前的问题:如何获得每天的总数

该表如下所示:

              Table Name: Totals
Date       |Program label   |count
           |                |    
2013-04-09 |Salary Day      |4364
2013-04-09 |Monthly         |6231
2013-04-09 |Policy          |3523
2013-04-09 |Worst Record    |1423
2013-04-10 |Salary Day      |9872
2013-04-10 |Monthly         |6543
2013-04-10 |Policy          |5324
2013-04-10 |Worst Record    |5432
2013-04-10 |Salary Day      |1245
2013-04-10 |Monthly         |6345
2013-04-10 |Policy          |5431
2013-04-10 |Worst Record    |5232
Run Code Online (Sandbox Code Playgroud)

我的问题是:使用MSSQL 2008 - 有没有办法让我获得当前每月每个程序标签的总计数.正如您所看到的,它有时会每天运行两次.我需要能够解释这一点.

输出应如下所示:

Date      |Salary Day |Monthly |Policy |Worst Record
2013-04-9 |23456      |63241   |23521  |23524
2013-04-10|45321      |72535   |12435  |83612
Run Code Online (Sandbox Code Playgroud)

sql t-sql sql-server pivot sql-server-2008

5
推荐指数
2
解决办法
1535
查看次数

如何从当前运行的jar中复制文件

我有一个.jar,它有两个依赖的.dll文件.我想知道是否有任何方法可以将这些文件从.jar中复制到运行时的用户临时文件夹中.这是我当前的代码(编辑为只有一个.dll加载以减少问题大小):

public String tempDir = System.getProperty("java.io.tmpdir");
public String workingDir = dllInstall.class.getProtectionDomain().getCodeSource().getLocation().getPath();

public boolean installDLL() throws UnsupportedEncodingException {

try {
             String decodedPath = URLDecoder.decode(workingDir, "UTF-8");
             InputStream fileInStream = null;
             OutputStream fileOutStream = null;

             File fileIn = new File(decodedPath + "\\loadAtRuntime.dll");
             File fileOut = new File(tempDir + "loadAtRuntime.dll");

             fileInStream = new FileInputStream(fileIn);
             fileOutStream = new FileOutputStream(fileOut);

             byte[] bufferJNI = new byte[8192000013370000];
             int lengthFileIn;

             while ((lengthFileIn = fileInStream.read(bufferJNI)) > 0) {
                fileOutStream.write(bufferJNI, 0, lengthFileIn);
             }

            //close all steams
        } catch (IOException e) { …
Run Code Online (Sandbox Code Playgroud)

java jar executable-jar

5
推荐指数
1
解决办法
7690
查看次数

Smack XMPP:无法登录到openfire服务器:"SASLErrorException:SASLError使用DIGEST-MD5:未授权"

我正在尝试创建一个基本连接并登录到我已安装的Openfire服务器.我通过Openfire Web管理界面创建的用户数据库中有以下用户:

User: user
Password: 12345678
Run Code Online (Sandbox Code Playgroud)

我可以很好地连接到服务器,因为连接在我的sout中返回true.问题是当它尝试登录时我收到以下错误:

org.jivesoftware.smack.sasl.SASLErrorException: SASLError using DIGEST-MD5: not-authorized
Run Code Online (Sandbox Code Playgroud)

我有以下代码:

private XMPPConnection connection;

public void connect(String serverIP) {
    try {

        System.setProperty("smack.debugEnabled", "true");
        ConnectionConfiguration config = new ConnectionConfiguration(serverIP, 5223);
        config.setDebuggerEnabled(true);
        config.setSocketFactory(new DummySSLSocketFactory());    
        config.setSecurityMode(ConnectionConfiguration.SecurityMode.enabled);
        config.setCompressionEnabled(true);
        connection = new XMPPTCPConnection(config);
        connection.connect();

        System.out.println("Connected: " + connection.isConnected());
        connection.login("user", "12345678");
        System.out.println("Logged in: " + connection.isAuthenticated());

    } catch (SmackException | IOException | XMPPException ex) {
        ex.printStackTrace();
    }
}

public static void main(String[] args) {
    connectionHandler test = new connectionHandler();
    test.connect("localhost");
}
Run Code Online (Sandbox Code Playgroud)

如果有人能够纠正我做错的事情,我将非常感激.

我也尝试过用户名,例如电子邮件

user@localhost.com …
Run Code Online (Sandbox Code Playgroud)

java xmpp smack

4
推荐指数
1
解决办法
5295
查看次数