我在macOS Sierra上使用react native 0.42.3:
我使用启动我的应用程序react-native run-ios
,然后按,然后Cmd-D选择"远程调试JS".之后,打开一个新的Chrome标签,通过切换到开发工具,我看到我的控制台到目前为止每个输出.
问题是:当我重新加载我的应用程序时,当调试器打开时,它会与臭名昭着的红色屏幕崩溃,说"运行时尚未准备好进行调试".
我发现很多关于使用react native进行调试的帖子,但是当你尝试重新加载它时似乎没有解决问题.
首先,我使用Rails3和Ruby 1.9.2.
使用PostgreSQL和PostGIS时遇到问题.我试过两个宝石:
问题是,nofxx中的第一个工作正常,但它不提供rake任务,因此postgis.sql和spatial_ref_sys.sql被插入到数据库中.我需要这个,因为它使用测试是舒适和必要的(自动创建数据库,插入postgis sql并在运行"rake test"时执行迁移).奇怪的是,在github的README中,作者写了一些关于PostGIS助手和rake任务的东西.但他们没有实施(或者我是盲目的).
上面列出的第二个宝石为rake提供了完美的功能!但我遇到了一个我无法解决的问题.我按照自述文件中的说明进行操作,但每当我尝试在空间列上设置位置时,我都会得到以下输出:
ruby-1.9.2-p136 :010 > v = Venue.new :location => "POINT(102.0, 47.2)"
=> #<Venue id: nil, last_updated: nil, created_at: nil, updated_at: nil, location: nil>
ruby-1.9.2-p136 :011 > v.location
=> nil
Run Code Online (Sandbox Code Playgroud)
如您所见,我使用WKT(众所周知的文本)设置了一个位置,但它始终为零.我也尝试将它保存到数据库中,但它也没有.我想通了,当我尝试使用RGeo提供的对象时
RGeo::Geos.factory.point(-122, 47)
Run Code Online (Sandbox Code Playgroud)
它说,工厂是零.因此,通过创建RGeo提供的工厂肯定存在问题.正如activerecord-postgis-adapter的README中所提到的,我在Venue模型中使用了以下行来提供这种支持:
self.rgeo_factory_generator = RGeo::Geos.factory_generator
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
因此,要找到解决方案,有两种方法:找到一种方法将rake任务放入nofxx的georuby gem中,或者使用activerecord-postgis-adapter的工厂解决问题.
希望有人可以帮助我,谢谢!
我有一个对象数组,我想随机排序.对于这种情况,我可以使用array.shuffle
.但是,如果我想稍后在同一阵列上重现该命令呢?有什么方法可以提供种子,随机数,等等,以便我可以在以后重现这个序列吗?
我想从MongoDB数据库生成一个随机的对象列表(使用MongoID),该列表必须在以后再现.但据我所知,没有什么好方法可以直接在MongoDB中实现随机排序.可能有很多对象(> 1,000,000),但计算时间是第一次尝试而不是重要的事实.
有谁知道如何用两个拇指在Flex 4(火花)中制作自定义hslider?由于Flex 4滑块组件的thumbcount属性不再可用(在mx组件上很容易设置).我必须设计轨道和拇指的样式.
教程会很好.
thx,tux.
我正在尝试使用Rails3测试谷歌地图应用.我正在使用带有水豚和硒的黄瓜进行JavaScript测试.我有一张地图,我等待加载谷歌地图,然后发送一个ajax请求到我的服务器,在那里我得到我插入地图的位置.我想知道是否可以使用selenium等到加载谷歌地图,完成对我的服务器的ajax调用并将标记放在地图内.另一个问题是,如何在谷歌地图中选择此标记.有选择器吗?
或者我应该走另一条路,并使用像Jasmine这样的JS测试框架来测试我的类是否已加载等等.我对Jasmine没有任何经验,所以可以测试谷歌地图吗?
也许有人知道一个解决方案,或一个提示,如果它不可能,或解决方法或......;)
[更新1]
我已经找到了如何在谷歌地图中选择标记.如果你看看googles selenium测试你可以看看他们在做什么.例如,选择标记:
waitForElementPresent xpath=//img[contains(@src,'marker')]
Run Code Online (Sandbox Code Playgroud)
但接下来是下一个问题.如何选择特定标记?是否有一种方法可以在javascript google maps API中为其分配ID,以便我可以使用#marker_1
,#marker_2
......?
另一个奇怪的事情是,我的黄瓜步骤定义中的功能类似于wait_for_element
或wait_for_condition
不可用.谷歌selenium测试使用自己的功能waitForElementPresent
吗?或者这个标准的硒功能是什么?我发现了很多帖子,他们总是使用类似的东西
selenium.wait_for_condition
selenium.wait_for_element
or
@selenium.wait_for_condition
...
Run Code Online (Sandbox Code Playgroud)
在我的步骤定义中selenium
和@selenium
var a nil.我该如何访问这些方法?我也发现了这篇文章,但它是从08年10月开始的,所以我认为必须有一个更好的解决方案(顺便说一下.这个解决方案一见钟情).
就像在这个页面上一样,他们概述了一些如何等待条件或元素的selenium方法.这仍然存在吗?我该如何使用这个功能?
[更新2]
该死的,我发现,我上面提到的硒测试是针对谷歌地图的V2,而不是针对V3.我试过了
wait_until { page.has_xpath?("//img[contains(@src,'marker')]") }
Run Code Online (Sandbox Code Playgroud)
但它不起作用.标记在地图上可见,但是我收到超时错误,因为找不到此XPath选择器.我想知道是否通常可以从DOM中选择一个标记.
我还尝试在创建标记时为标记分配一个附加属性:
// marker is the marker returned by google maps after adding it to the map
$(marker).attr('id', "marker_1");
Run Code Online (Sandbox Code Playgroud)
但是当我尝试使用jQuery选择器访问它时$("#marker_1")
,它找不到它.所以,仍然没有解决方案.
我有一个宝石,必须用一些选项来构建.
gem install pg --with-pg-include=/Library/PostgreSQL/9.0/include/ --with-pg-lib=/Library/PostgreSQL/9.0/lib/
Run Code Online (Sandbox Code Playgroud)
我可以在Gemfile中包含这些选项吗?在我的Gemfile中,pg
命令是
gem "pg", "0.12.2"
Run Code Online (Sandbox Code Playgroud)
我想在版本号后面提供一些选项.
thx,tux
突然,我的项目停止了与咕噜声.不幸的是,我有一段时间没有将我的修改变成git,所以我不知道它们有什么不同.
当我运行时grunt server --verbose
,我得到以下输出(上面的所有内容都...
带有OK
):
...
Running "wiredep" task
Running "wiredep:app" (wiredep) task
Verifying property wiredep.app exists in config...OK
Files: app/index.html
Verifying property wiredep.app.src exists in config...OK
Running "wiredep:sass" (wiredep) task
Verifying property wiredep.sass exists in config...OK
Files: app/styles/analyzer.scss, app/styles/colors.scss, app/styles/login.scss, app/styles/main.scss, app/styles/shared.scss, app/styles/styles.scss, app/styles/tagsinput.scss
Verifying property wiredep.sass.src exists in config...OK
Running "concurrent:server" (concurrent) task
Verifying property concurrent.server exists in config...OK
Files: [no src] -> server
Options: limit=2
Warning: Use --force to continue.
Aborted due …
Run Code Online (Sandbox Code Playgroud) 我想链接一些由服务返回的promise.只要一些返回promise的方法不需要额外的参数,这就可以工作.这是我的例子:
var first = function() {
var d = $q.defer();
$timeout(function() {
d.resolve("first resolved")
}, 100)
return d.promise;
};
var second = function(val) {
console.log("value of val: ", val);
var d = $q.defer();
$timeout(function() {
d.resolve("second resolved")
}, 200)
return d.promise;
};
first().then(second).then(function(value) {
console.log("all resolved", value);
});
Run Code Online (Sandbox Code Playgroud)
这按预期工作.但是,如果我的服务second
需要一个额外的参数val
来完成它的工作呢?随着价值之上的方法val
就是"first resolved"
,因为它得到的解析值的first
.
有没有办法,没有嵌套这样的匿名函数:
first().then(function() {
return second("foobar").then(function(value) {
console.log("all resolved", value);
});
});
Run Code Online (Sandbox Code Playgroud)
我正在考虑使用$q.all
,但恕我直言,你不能指定你的承诺的订单.
我在RSpec中有一个自定义匹配器,忽略空格/换行符,只匹配内容:
RSpec::Matchers.define :be_matching_content do |expected|
match do |actual|
actual.gsub(/\s/,'').should == expected.gsub(/\s/,'')
end
diffable
end
Run Code Online (Sandbox Code Playgroud)
我可以像这样使用它:
body = " some data \n more data"
body.should be_matching_content("some data\nmore wrong data")
Run Code Online (Sandbox Code Playgroud)
但是,当测试失败时(如上所述),diff输出看起来不太好:
-some data
-more wrong data
+ some data
+ more data
Run Code Online (Sandbox Code Playgroud)
是否可以配置diffable输出?第一行some data
是对的,但第二行more wrong data
是错的.仅将第二行作为失败的根本原因是非常有用的.
我想知道,如果有可能,扩展Angular的输入指令?我想将一些监听器附加到页面上的所有输入字段.我认为你可以装饰现有的模块$provide.decorate
,但我不知道如何使用指令(更确切地说是输入指令)来做到这一点.
那么,有人能推动我朝着正确的方向前进吗?一些例子?
编辑
这是我到目前为止的指令:
angular.module('onFocusBlur').
directive('onFocusBlur', ["$rootScope", function($rootScope) {
return {
restrict: "A",
link: function(scope, elem, attrs) {
elem.bind('focus',function() {
scope.$apply(function() {
$rootScope[attrs.onFocusBlur] = true;
});
});
elem.bind('blur',function() {
scope.$apply(function() {
$rootScope[attrs.onFocusBlur] = false;
});
});
}
};
}]);
Run Code Online (Sandbox Code Playgroud)
在我看来,我可以将它添加到这样的输入字段:
<input type="email" ng-model="email" on-focus-blur="repositionNavBar">
Run Code Online (Sandbox Code Playgroud)
缺点是,对于每个输入字段,我必须在我的代码中手动附加此侦听器.因此,更改现有的输入指令以包含此侦听器将是有用的.
angularjs ×3
javascript ×3
ruby ×3
apache-flex ×1
arrays ×1
bundler ×1
capybara ×1
cucumber ×1
debugging ×1
flex4 ×1
gem ×1
google-maps ×1
gruntjs ×1
ios ×1
node.js ×1
postgis ×1
postgresql ×1
promise ×1
random ×1
react-native ×1
rspec ×1
selenium ×1