小编Ara*_*ras的帖子

什么是Ember RunLoop以及它是如何工作的?

我试图了解Ember RunLoop是如何工作的以及是什么让它成功.我查看了文档,但仍然有很多问题.我有兴趣更好地理解RunLoop的工作原理,所以我可以在其名称空间中选择适当的方法,当我不得不推迟执行某些代码时.

  • Ember RunLoop什么时候开始.它依赖于路由器或视图或控制器或其他东西?
  • 它花了多长时间(我知道这很愚蠢,要求并依赖于许多事情,但我正在寻找一个大概,或者如果有一个最小或最大的时间,一个runloop可能会采取)
  • RunLoop是否始终执行,或者它只是指示从开始到结束执行的一段时间,并且可能不会运行一段时间.
  • 如果从一个RunLoop中创建一个视图,它是否保证在循环结束时它的所有内容都会进入DOM?

请原谅我,如果这些是非常基本的问题,我认为理解这些将有助于像我这样的新人更好地使用Ember.

ember.js

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

使用cv :: Mat类型时如何在图像上叠加文本

我正在使用opencv 2.1.在我的代码中,我有几个图像存储为Mat对象初始化如下:

Mat img1 = imread("img/stuff.pgm", CV_LOAD_IMAGE_GRAYSCALE);
Run Code Online (Sandbox Code Playgroud)

在矩阵运算完成后,我可以使用imshow()正确显示它们.现在我想在图像上添加一些文字来描述发生了什么.看看文档似乎就是cvPutText()我需要的功能.但是,当我尝试这样的事情时:

cvPutText(result, "Differencing the two images.", cvPoint(30,30), &font, GREEN);

我得到以下编译错误: error: cannot convert ‘cv::Mat’ to ‘CvArr*’ for argument ‘1’ to ‘void cvPutText(CvArr*, const char*, CvPoint, const CvFont*, CvScalar)’

在显示此图像时,我需要做些什么才能添加一些文字?

c++ opencv computer-vision

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

Ember计算Coffeescript中的属性

我想在Coffeescript中实现以下Javascript代码

App.ItemView = Ember.View.extend({
    classNameBindings: ['itemId'],
    itemId: function() {
        console.log(this.get('content'));
        return "item-%@".fmt(this.get('content.id'));
    }.property('content.id'),
    templateName: 'item'    
}); 
Run Code Online (Sandbox Code Playgroud)

以下是我目前在coffeescript中所拥有的内容:

App.ItemView = Ember.View.extend(
    classNameBindings: ['itemId']

    itemId: ->
        console.log this.get('content')
        contentId = this.get('content.id')
        "item-#{contentId}");
    .property('content.id')

    templateName: 'item'    
)
Run Code Online (Sandbox Code Playgroud)

我明白了:

Error: Parse error on line 11: Unexpected '.'
Run Code Online (Sandbox Code Playgroud)

问题似乎与点在.property('content.id') .我不知道这是如何转化为Coffeescript的.如何在Coffeescript中正确实现此视图?

coffeescript ember.js

17
推荐指数
1
解决办法
4801
查看次数

Ember.js {{each}} vs {{collection}}

我理解eachcollection辅助方法是迭代我的手柄模板中的项目列表的两种可能方法.我要寻找有关何时使用一些实用的建议eachcollection什么是两种方法之间的差异.

ember.js

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

如何将我的序列化JSON字符串包装在"单引号"中

我有一个javascript对象blocki,我希望使用rest API进行序列化和更新.所以我打电话给:

JSON.stringify(blocki)
Run Code Online (Sandbox Code Playgroud)

这给了我这个字符串:

"{"name":"Updated Blocki","bounds":{"x":"2em","y":"2em","w":"8em","h":"12em"}}"
Run Code Online (Sandbox Code Playgroud)

这几乎是我需要的,除了双引号字符串外面应该有单引号,如下所示:

'{"name":"Updated Blocki","bounds":{"x":"2em","y":"2em","w":"8em","h":"12em"}}'
Run Code Online (Sandbox Code Playgroud)

根据MDN JSON.stringify上的示例,它应该返回一个用单引号括起来的字符串.但是,当我在该页面中尝试相同的示例时,我将字符串包装在双引号中.例如,当我输入JSON.stringify({})Firefox和Chrome控制台时,我会回来"{}"而不是'{}'.

如何正确序列化我的Javascript对象,以便外部引号为:'.同样,这个字符串是我想要实现的一个例子:

'{"name":"Updated Blocki","bounds":{"x":"2em","y":"2em","w":"8em","h":"12em"}}'
Run Code Online (Sandbox Code Playgroud)

理想情况下,我想学习一种很好的方法来序列化对象,而不必在序列化后修改字符串.

编辑:我认为我需要这样做的原因是,当字符串用双引号括起来时,我正在使用的API不知何故.例如,当我这样做

curl -i -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d "{"name":"Updated Blocki","bounds":{"x":"2em","y":"2em","w":"8em","h":"12em"}}" 'http://localhost:3000/api/blockies/17'
Run Code Online (Sandbox Code Playgroud)

请求失败,服务器给出解析错误.但是,当我尝试:

curl -i -H "Accept: application/json" -H "Content-type: application/json" -X PUT -d '{"name":"Updated Blocki","bounds":{"x":"2em","y":"2em","w":"8em","h":"12em"}}' 'http://localhost:3000/api/blockies/17'
Run Code Online (Sandbox Code Playgroud)

put请求成功完成,对象更新.

javascript rest json

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

如何为Cordova插件设置链接器选项?

我正在开发一个使用自定义ios SDK框架的Cordova插件.该框架依赖于两个二进制库:libcurl.aboost.a.现在在开发过程中我将插件安装在这样的测试应用程序中:

cordova platform add ios
cordova plugin add my.cool.plugin
Run Code Online (Sandbox Code Playgroud)

二进制文件包含在框架中,并被复制到安装插件的项目中.但是,缺少某些链接器选项.为了构建项目,我必须打开xcode并执行两个额外的手动步骤:

open platforms/ios/MyCoolProject.xcodeproj/
Run Code Online (Sandbox Code Playgroud)

首先,我必须在Build Phases中将两个库添加到Link Binary With Libraries部分:

在此输入图像描述

其次,我必须将两个链接器标志(-lz -lstdc++)添加到项目默认目标的其他链接器标志部分. 在此输入图像描述

我当然希望cordova add plugin my.cool.plugin安装插件足够了.所以我的问题是,如何在安装插件时自动执行这些任务?

xcode linker ios phonegap-plugins cordova

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

插件未找到,或者不是CDVPlugin.检查config.xml中的插件映射

我在plugin.xml中声明了我的iOS插件文件,如下所示:

  <config-file target="config.xml" parent="/*">
      <feature name="CDVOP">
          <param name="ios-package" value="CDVOP"/>
      </feature>
  </config-file>

  <header-file src="src/ios/CDVOP.h" />
  <source-file src="src/ios/CDVOP.m" />
Run Code Online (Sandbox Code Playgroud)

在插件JavaScript文件中,我有这个函数,我稍后从JavaScript应用程序调用

showCatPictures: function(interval) {
  exec(null, null, 'CDVOP', 'showCatPictures', [interval]);   
},
Run Code Online (Sandbox Code Playgroud)

我正在运行从xcode使用此插件的应用程序来查看调试输出.我在调用showCatPictures函数时得到这个:

OP Cordova Tests[1122:60b] ERROR: Plugin 'CDVOP' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.
2014-02-14 16:23:45.233 OP Cordova Tests[1122:60b] -[CDVCommandQueue executePending] [Line 127] FAILED pluginJSON = [
  "INVALID",
  "CDVOP",
  "showCatPictures",
  [
    30
  ]
]
Run Code Online (Sandbox Code Playgroud)

我怀疑这可能与我导入的所有东西有关,所以这里是CDVOP.h

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <Cordova/CDVPlugin.h>
#import <Cordova/CDV.h> …
Run Code Online (Sandbox Code Playgroud)

ios phonegap-plugins cordova cordova-plugins

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

没有可用于类型“video/x-h264”的解码器

我正在尝试在不进行任何修改的情况下运行 qt 示例应用程序之一。它被称为player,它是一个多媒体小部件演示。我的系统是 Ubuntu 16.04 64 位。当我尝试播放视频时,我在控制台中看到以下错误:

No decoder available for type 'video/x-h264

这是尝试两个不同视频后的完整错误:

Starting /home/aras/Qt5.7.0_Sept2016/Examples/Qt-5.7/multimediawidgets/build-player-Sept2016-Debug/player...
Warning: "No decoder available for type 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)constrained-baseline, codec_data=(buffer)0142e01eff0100192742e01ea9101405ff2e00d418041adb7a00f480f55ef7c04001000428de09c8, width=(int)640, height=(int)360, framerate=(fraction)2997/125, pixel-aspect-ratio=(fraction)1/1'."
Warning: "No decoder available for type 'video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)3, profile=(string)constrained-baseline, codec_data=(buffer)0142e01eff0100192742e01ea9101405ff2e00d418041adb7a00f480f55ef7c04001000428de09c8, width=(int)640, height=(int)360, framerate=(fraction)2997/125, pixel-aspect-ratio=(fraction)1/1'."
Warning: "No decoder available for type 'video/x-h264, stream-format=(string)avc, pixel-aspect-ratio=(fraction)1/1, width=(int)1280, height=(int)720, framerate=(fraction)601600/10033'."
Run Code Online (Sandbox Code Playgroud)

我几乎安装了与 gstreamer 远程相关的所有软件包。当我运行时,gst-inspect-1.0我得到了很多输出,最后一行是:

Total count: 241 plugins (1 blacklist entry not shown), 1388 features

~$ gst-inspect-1.0 …
Run Code Online (Sandbox Code Playgroud)

video gstreamer h.264 qt5 qtmultimedia

8
推荐指数
2
解决办法
9081
查看次数

如何从Ember.js存储库构建和预览最新文档

我已经克隆了Ember存储库

git clone git://github.com/emberjs/ember.js.git
Run Code Online (Sandbox Code Playgroud)

然后导航到ember.js目录并运行bundle然后我尝试

rake docs:build
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

/home/zooby/.rvm/gems/ruby-1.9.3-p194@global/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25: warning: redundant nested repeat operator
rake aborted!
Don't know how to build task 'docs:build'
Run Code Online (Sandbox Code Playgroud)

我尝试时遇到类似的错误

rake docs:preview
Run Code Online (Sandbox Code Playgroud)

我错过了什么?如何构建和查看Ember中提供的最新版文档?

ember.js

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

如何为用户获取所有github"PushEvents"的列表

我可以看到特定用户的所有事件,例如这里是我的:

https://api.github.com/users/arasbm/events

但我只对特定类型的事件感兴趣:

"type": "PushEvent",
Run Code Online (Sandbox Code Playgroud)

如何在不处理所有事件列表(可能很慢)的情况下获取此数据.我正在尝试这样做,因为我想获得已经合并的所有PR的列表.如果你能给我一个很棒的curl命令.我无法在github api文档中的任何地方找到它.

rest github-api

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