小编ces*_*hon的帖子

如何在运行selenium nightwatch.js测试时保持打开的开发人员工具?

我开始使用nightwatch.js编写e2e测试,我注意到一些错误,我想在目标浏览器的控制台(开发人员工具)中手动检查.但是当我打开开发者控制台时,它会自动被浏览器关闭.这是selenium或nightwatch.js的预期功能,如果是这样,我该如何禁用它?

selenium-webdriver

17
推荐指数
2
解决办法
8506
查看次数

配置d3以使用angular2和typescript的正确方法

试图将d3库包含到angular2打字稿项目中.我添加了d3 via npm install d3和typings via typing install d3 --save,项目本地服务器没有启动(tsc && concurrently "npm run tsc:w" "npm run lite"),出现以下错误:

typings/browser/definitions/d3/index.d.ts(3319,1): error TS2300: Duplicate identifier 'export='.
typings/browser/definitions/d3/index.d.ts(3323,1): error TS2300: Duplicate identifier 'export='.
typings/browser/definitions/d3/index.d.ts(3327,1): error TS2300: Duplicate identifier 'export='.
typings/modules/d3/index.d.ts(3319,1): error TS2300: Duplicate identifier 'export='.
typings/modules/d3/index.d.ts(3323,1): error TS2300: Duplicate identifier 'export='.
typings/modules/d3/index.d.ts(3327,1): error TS2300: Duplicate identifier 'export='.
Run Code Online (Sandbox Code Playgroud)

这些是我的配置文件:

typings.json:

{
  "ambientDependencies": {
    "es6-shim": "github:DefinitelyTyped/DefinitelyTyped/es6-shim/es6-shim.d.ts#7de6c3dd94feaeb21f20054b9f30d5dabc5efabd",
    "jasmine": "github:DefinitelyTyped/DefinitelyTyped/jasmine/jasmine.d.ts#5c182b9af717f73146399c2485f70f1e2ac0ff2b",
    "gapi": "github:DefinitelyTyped/DefinitelyTyped/gapi.auth2/gapi.auth2.d.ts"
  },
  "dependencies": {
    "d3": "registry:npm/d3#3.0.0+20160211003958"
  }
}
Run Code Online (Sandbox Code Playgroud)

的package.json:

{
  "name": "session-explorer", …
Run Code Online (Sandbox Code Playgroud)

d3.js typescript angular

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

node_modules中的aws lambda层共享库功能不可用

我最近更改了lambda函数,以使用新的aws Lambda Layer功能来共享所有的node_modules文件夹。我使用以下结构创建了zip文件:

nodejs/node_modules/<libraries, like 'async' and others..>
nodejs/package.json
Run Code Online (Sandbox Code Playgroud)

我也将lambda函数链接到该层,并且成功了(在CLI和Web控制台中都进行了检查),请参见下面的输出。

in lambda: require('async')

output: "errorMessage":"Cannot find module 'async'"
Run Code Online (Sandbox Code Playgroud)

update-function调用的输出:

aws lambda update-function-configuration --function-name MY_LAMBDA --layers arn:aws:lambda:us-west-2:MY_ID:layer:MY_LAYER:4
{
"Layers": [
{
"CodeSize": 21482560,
"Arn": "arn:aws:lambda:us-west-2:MY_ID:layer:MY_LAYER:4"
}
],
"FunctionName": "MY_LAMBDA",
"LastModified": "2018-12-18T23:44:34.062+0000",
"RevisionId": "f55a6ab7-7b0b-494a-840c-87fb8371a117",
"MemorySize": 128,
"Version": "$LATEST",
"Role": "arn:aws:iam::MY_ID:role/service-role/MY_ROLE",
"Timeout": 30,
"Runtime": "nodejs4.3",
"TracingConfig": {
"Mode": "PassThrough"
},
"CodeSha256": "hajYdqb+...=",
"Description": "",
"VpcConfig": { ... lot of stuff here .. },
"CodeSize": 429123,
"FunctionArn": "arn:aws:lambda:MY_ZONE:MY_ID:function:MY_LAMBDA",
"Handler": "MY_HANDLER"
}
Run Code Online (Sandbox Code Playgroud)

注意:1.我的图层在版本4中。2.我将该图层设置为所有三个node.js环境的支持。3.我检查了zip,它具有预期的所有node_modules内容。

任何关于其他检查内容的建议都欢迎!

aws-lambda

7
推荐指数
3
解决办法
1202
查看次数

如何在angular.js 2.0打字稿应用程序中使用谷歌登录按钮?

我试图在Angular.js 2.0(打字稿)SPA中包含一个Google登录按钮,但我不知道实现Google回调的正确方法是什么,以便在我的Angular组件中触发某些内容.

(或者,我想知道正确的方法是编写指令,但是如何从那里连接回调?)

编辑:添加源代码

  ngAfterViewInit() {
    gapi.signin2.render(
      "google-login-button",
      {
        "onSuccess": (user) => console.log(user),
        "scope": "profile",
        "theme": "dark",
        "onfailure": function(err){console.log("error:"+err);}
      });
    console.log("afterview: gapi started"); //this is printed 
  }
Run Code Online (Sandbox Code Playgroud)

初始化似乎没问题.我看到console.log和按钮.我可以在弹出窗口中登录,但在该窗口关闭后没有任何反应.控制台中没有打印任何内容,无论是成功还是失败消息

typescript google-signin angular

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

FFMPEG avformat_write_header更改我的流time_base

我正在将ffmpeg 2.1.3与libavcodec 55.39.101混合使用(由于使用了google-chrome PNACL端口项目中的可用版本,因此强制使用该版本)。我所有的镜架时间似乎都很糟糕。他们尝试在播放视频时立即将其全部渲染。

我将流时基设置为1/25,但是在调用avformat_write_header之后,它的值为-18082736/1。在每帧中,当我打印流time_base时,它表示1/12800,而编解码器的time_base始终正常(1/25)。

av_format_write_header之前和之后的控制台日志:

before avformat_write_header stream time_base: 1/25
after avformat_write_header ret 0 stream time_base: -18082736/1
Run Code Online (Sandbox Code Playgroud)

代码(缩写为简短起见,原始版本中的所有调用均进行了错误检查):

AVCodecContext *codecContext;
AVCodec * codec = avcodec_find_encoder(codec_id);  
myOutputStream->stream = avformat_new_stream(outputFormatContext, *codec);
myOutputStream->stream->id = outputFormatContext->nb_streams-1;
codecContext = myOutputStream->stream->codec;
codecContext->codec_id = codec_id;
codecContext->bit_rate = 400000;
codecContext->width    = width;
codecContext->height   = height;
myOutputStream->stream->time_base = (AVRational){ 1, 25 };
codecContext->time_base       = myOutputStream->stream->time_base;
codecContext->gop_size      = 12; 
codecContext->pix_fmt       = AV_PIX_FMT_YUV420P;
AVDictionary *opt = NULL;
av_dict_copy(&opt, opt_arg, 0);
ret = avcodec_open2(codecContext, codec, &opt);
av_dict_free(&opt);
myOutputStream->frame = alloc_picture(codecContext->pix_fmt, codecContext->width, …
Run Code Online (Sandbox Code Playgroud)

video ffmpeg

3
推荐指数
1
解决办法
2251
查看次数