小编Sre*_*ag 的帖子

PhantomJS无法打开HTTPS站点

我正在使用以下基于loadspeed.js示例的代码打开一个https://站点,该站点也需要http服务器身份验证.

var page = require('webpage').create(), system = require('system'), t, address;

page.settings.userName = 'myusername';
page.settings.password = 'mypassword';

if (system.args.length === 1) {
    console.log('Usage: scrape.js <some URL>');
    phantom.exit();
} else {
    t = Date.now();
    address = system.args[1];
    page.open(address, function (status) {
        if (status !== 'success') {
            console.log('FAIL to load the address');
        } else {
            t = Date.now() - t;
            console.log('Page title is ' + page.evaluate(function () {
                return document.title;
            }));
            console.log('Loading time ' + t + ' msec');
        }
        phantom.exit();
    });
} …
Run Code Online (Sandbox Code Playgroud)

https screen-scraping phantomjs

103
推荐指数
5
解决办法
7万
查看次数

SQL:在OVER()中使用WHERE子句?

如何WHEREOVER子句中使用子句进行过滤?

即来自以下数据

LoanID | Principal | Tenor | AmortizingPrincipal 
----------------------------------------
1         20000       1       5000
1         20000       2       5000
1         20000       3       5000
1         20000       4       5000    
Run Code Online (Sandbox Code Playgroud)

我需要在每个Tenor中使用Balance Principal的第四个虚拟列,如下所示:

LoanID | Principal | Tenor | AmortizingPrincipal | BalancePrinicpal 
-----------------------------------------------------------
1        20000       1       5000                  20000  
1        20000       2       5000                  15000  
1        20000       3       5000                  10000 
1        20000       4       5000                  5000
Run Code Online (Sandbox Code Playgroud)

像这样的东西:

SELECT 
    BalancePrincipal = Principal - SUM(AmortizingPrincipal) OVER(PARTITION BY LoanID WHERE Tenor < this row's tenor) 
Run Code Online (Sandbox Code Playgroud)

更新:

以下查询为我提供了所需的结果: …

sql sql-server-2008

13
推荐指数
1
解决办法
2万
查看次数

标签 统计

https ×1

phantomjs ×1

screen-scraping ×1

sql ×1

sql-server-2008 ×1