我已经使用mocha测试和JSlint设置了一个Gruntfile.如果我只是从终端运行grunt,这工作正常.
我想从詹金斯那里咕噜咕噜!
我设置了一个新工作 - >并构建了一个shell脚本,包括:
/usr/local/bin/grunt
Run Code Online (Sandbox Code Playgroud)
一旦我完成工作,Jenkins的终端输出说:
[workspace] $ /bin/sh -xe /tmp/hudson8550584576040162032.sh
+ /usr/local/bin/grunt
/usr/bin/env: node: No such file or directory
Build step 'Execute shell' marked build as failure
Finished: FAILURE
Run Code Online (Sandbox Code Playgroud)
它似乎不能精细节点二进制!?!但节点已安装并在终端中正常运行!
我的所有二进制文件(mocha,grunt,node)都在/ usr/local/bin /
有谁知道这是什么问题?或者也许有人有链接用jenkins设置grunt.js?
有人得到了什么?
谢谢
我在Objective C中很新,我想我不知道如何处理对象.我创建了一个UILabel,我可以设置文本和其他所有内容.但我想从一个不同的方法更新它..意思我想改变文本,但我没有该方法中的对象!
多数民众赞成我如何设置UILabel
- (void)viewDidLoad
{
[super viewDidLoad];
UILabel *scoreLabel = [ [UILabel alloc ] initWithFrame:CGRectMake((self.view.bounds.size.width / 2), 0.0, 150.0, 43.0) ];
scoreLabel.textAlignment = UITextAlignmentCenter;
scoreLabel.textColor = [UIColor whiteColor];
scoreLabel.backgroundColor = [UIColor redColor];
scoreLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:(36.0)];
[self.view addSubview:scoreLabel];
scoreLabel.text = [NSString stringWithFormat: @"%d", 0];
}
Run Code Online (Sandbox Code Playgroud)
这就是我想改变UILabel文本的地方
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
self.crossView.alpha = 0.5;
...change scoreLabel.test
}
Run Code Online (Sandbox Code Playgroud)
这两种方法都在ViewController中!
也许我可以把UILabel绑在自己身上?但怎么样?
我在界面构建器中创建了一个分段控件.
在我的ViewController.h中:
@interface ViewController : UIViewController <MKMapViewDelegate>
@property IBOutlet UISegmentedControl *Segment;
- (IBAction)switchMode:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)
我能做的是将分段控制与IBAction连接,但我无法将其与IBOutlet连接!
我已经构建了一个jQuery插件,但现在我需要使用插件外插件中的一个函数.
插件
(function ($) {
jQuery.fn.vierGewinnt = function () {
var VierGewinnt = function (config) {
this.view = config.view;
this.dx;
this.turn = 1;
}
VierGewinnt.prototype.setToken = function (column) {
for (var i = this.rows; i > 0; i--) {
if (this.gamearray[column][i] == 0) {
this.gamearray[column][i] = "red";
this.turn++;
this.findWinner(column, i);
break;
}
}
}})(jQuery);
Run Code Online (Sandbox Code Playgroud)
main.js我试过:
$.setToken()
$.fn.vierGewinnt.setToken()
$.fn.vierGewinnt.VierGewinnt.setToken()
Run Code Online (Sandbox Code Playgroud)
也许有人有线索!Thx提前!
我试图给一个对象一个倒数计时器,当倒计时结束时,它应该调用一个从数组中删除该对象的函数.
array = [];
var object = {
'name' : 'user',
'limit' : function() {
setTimeout(destroyMe(this),10000);
}
}
array.push(object);
var destroyMe = function(obj) {
array.remove(obj);
}
Run Code Online (Sandbox Code Playgroud)
我知道这可能有问题,但超时功能根本不起作用,甚至不是这样的:
var object = {
'name' : 'user',
'limit' : function() {
setTimeout(console.log("dd"),3000);
}
}
Run Code Online (Sandbox Code Playgroud)
也许有人可以告诉我我的setTimeout版本的问题.谢谢
iphone ×2
objective-c ×2
gruntjs ×1
ios ×1
ios6 ×1
javascript ×1
jenkins ×1
jquery ×1
node.js ×1
settimeout ×1
xcode4 ×1