标签: chaining

Hadoop Streaming:Chaining Jobs

问题是如何使用Hadoop Streaming(仅限)在Hadoop中链接作业.

streaming hadoop chaining

16
推荐指数
1
解决办法
5958
查看次数

jQuery链接:一切都可以链接吗?我们什么时候不能连锁?

我知道并非所有jQuery函数都可以链接在一起.对此有经验法则吗?什么时候我们不能将2个功能链接在一起

jquery chaining

15
推荐指数
1
解决办法
2812
查看次数

使用jQuery的动态AJAX承诺链

我的AJAX调用是在for循环中构建的.它们需要按顺序(同步).我如何用jQuery链接它们?

var array = ['One', 'Two', 'Three'];
var arrayLength = array.length;
for (var arrayCounter = 0; arrayCounter < arrayLength; arrayCounter++) {
    var id = array[arrayCounter];
    getData(id);

    function getData(id) {
        $.ajax({
            url: 'http://example.com/' + id,
            dataType: 'jsonp',
            success: function(d) {
                var response = d;
                console.log(d);
            },
            error: function() {
                alert("ERROR");
            }
        });
    }
}   
Run Code Online (Sandbox Code Playgroud)

javascript ajax jquery chaining promise

15
推荐指数
2
解决办法
6809
查看次数

如何使用angularjs $ q顺序链接promise?

在promise库Q中,您可以执行以下操作来按顺序链接promise:

var items = ['one', 'two', 'three'];
var chain = Q();
items.forEach(function (el) {
  chain = chain.then(foo(el));
});
return chain;
Run Code Online (Sandbox Code Playgroud)

但是,以下内容不适用于$ q:

var items = ['one', 'two', 'three'];
var chain = $q();
items.forEach(function (el) {
  chain = chain.then(foo(el));
});
return chain;
Run Code Online (Sandbox Code Playgroud)

chaining sequential angularjs q angular-promise

15
推荐指数
3
解决办法
3万
查看次数

如何在PHP中实现异常链接

PHP异常的构造函数有第三个参数,文档说:

$previous: The previous exception used for the exception chaining. 
Run Code Online (Sandbox Code Playgroud)

但我不能让它发挥作用.我的代码看起来像这样:

try
{
    throw new Exception('Exception 1', 1001);
}
catch (Exception $ex)
{
    throw new Exception('Exception 2', 1002, $ex);
}
Run Code Online (Sandbox Code Playgroud)

我希望抛出异常2,我希望它会附加异常1.但我得到的只是:

Fatal error: Wrong parameters for Exception([string $exception [, long $code ]]) in ...
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

php exception chaining

14
推荐指数
1
解决办法
6655
查看次数

如何链接javascript日期函数

有没有办法链接javascript日期函数?

例如,我想这样的事情:

var d = new Date().setMinutes(0).setSeconds(0).setMilliseconds(0);
Run Code Online (Sandbox Code Playgroud)

此语法因错误而中断:

(new Date).setMinutes(0).setSeconds is not a function
Run Code Online (Sandbox Code Playgroud)

我知道我可以这样做:

var d = new Date();
d.setMinutes(0);
d.setSeconds(0);
d.setMilliseconds(0);
Run Code Online (Sandbox Code Playgroud)

但这感觉冗长而繁琐.有没有更好的办法?

javascript date chaining

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

哈斯克尔:monadic takeWhile?

我有一些用C语言编写的函数,我从Haskell调用.这些功能返回IO (CInt).有时我想运行所有函数,无论它们返回什么,这很容易.为了示例代码,这是当前正在发生的事情的一般概念:

Prelude> let f x = print x >> return x
Prelude> mapM_ f [0..5]
0
1
2
3
4
5
Prelude>
Run Code Online (Sandbox Code Playgroud)

我得到了我想要的副作用,我不关心结果.但是现在我需要在第一个没有返回我想要的结果的项目之后立即停止执行.假设返回值为4或更高要求执行停止 - 那么我想要做的是:

Prelude> takeWhile (<4) $ mapM f [0..5]
Run Code Online (Sandbox Code Playgroud)

这给了我这个错误:

<interactive>:1:22:
    Couldn't match expected type `[b]' against inferred type `IO a'
    In the first argument of `mapM', namely `f'
    In the second argument of `($)', namely `mapM f ([0 .. 5])'
    In the expression: takeWhile (< 4) $ mapM f ([0 …

monads haskell chaining

12
推荐指数
4
解决办法
2923
查看次数

jQuery链接性能

这些在速度方面是否相同?

$(this).attr("date",date);
$(this).attr("date_start",date_start);
$(this).attr("heure_start",heure_start);
Run Code Online (Sandbox Code Playgroud)

要么

$(this).attr("date",date).attr("date_start",date_start).attr("heure_start",heure_start);
Run Code Online (Sandbox Code Playgroud)

即使第二个更快,最好将它单独编写以使代码更具可读性?

performance jquery chaining

12
推荐指数
2
解决办法
783
查看次数

C++链接运算符<< for std :: cout like usage

可能重复:
当重载operator << Operator重载时,std :: endl的类型未知

我目前正在编写一个记录器类,但该operator<<方法会导致编译器错误.这是类的最小化版本,在文件"logger.h"中:

#include <iostream>
class Logger {
public:
    Logger() : m_file(std::cout) {}

    template <typename T>
    Logger &operator<<(const T &a) {
        m_file<<a;
        return *this;
    }

protected:
    std::ostream& m_file;
};
Run Code Online (Sandbox Code Playgroud)

它包含在我的main.cpp中,并在输出字符串文字时完美地工作:

log << "hi"; 
Run Code Online (Sandbox Code Playgroud)

但是,以下内容无法编译.

#include "logger.h"
int main() {
    Logger log;

    log << std::endl;
}
Run Code Online (Sandbox Code Playgroud)

g ++编译器报告:

src/main.cpp:5:错误:'log << std :: endl'中'operator <<'不匹配

c++ operators chaining

11
推荐指数
1
解决办法
4088
查看次数

如何将groovy的太空船操作员连接起来进行多级排序?

Groovy拥有太空船操作员<=>,提供了一种简单的方法来实现比较.我怎样才能以更加时髦的方式将其链接到下面的代码?在这个例子中,我想首先按价格比较项目,然后按名称比较两个具有相同价格的项目.


class Item implements Comparable {
  int price
  String name

  int compareTo(Item other) {
    int result = price <=> other.price
    if (result == 0) {
      result = name <=> other.name
    }
    return result
  }
}
Run Code Online (Sandbox Code Playgroud)

groovy chaining spaceship-operator

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