我的项目需要angular-leaflet,而angular-leaflet有很长的devDependencies列表,包括jQuery 2.我不想要jQuery 2 - 我想要jQuery 1.x. 我怎样才能让bower忽略angular-leaflet的devDependencies并让我使用jQuery 1?
我正在使用凉亭1.2.8.这是一个最小的bower.json,它为我重现了这个问题:
{
"name": "bower-test",
"dependencies": {
"jquery": "1.x",
"angular": "1.2.x",
"angular-leaflet": "0.7.x"
}
}
Run Code Online (Sandbox Code Playgroud)
运行bower install
导致以下错误:
Unable to find a suitable version for jquery, please choose one:
1) jquery#1.x which resolved to 1.11.0 and has bower-test as dependants
2) jquery#2.1.0 which resolved to 2.1.0 and has angular-leaflet#0.7.5 as dependants
3) jquery#>= 1.9.0 which resolved to 2.1.0 and has bootstrap#3.0.3 as dependants
Run Code Online (Sandbox Code Playgroud)
至少,我希望bower install --production
忽略angular-leaflet中的devDependencies.但这是结果(与上面相同): …
Debian的httpredir.debian.org
镜像服务导致我的Docker构建非常频繁地失败,因为apt-get无法下载软件包或连接到服务器或类似的东西.我是唯一一个遇到这个问题的人吗?问题是我的,Debian的还是Docker的?我能做些什么吗?
我有几个Dockerfiles debian:jessie
,Debian默认使用该httpredir.debian.org
服务来找到使用apt-get等时的最佳镜像.几个月前,httpredir在尝试构建图像时给了我持续的悲痛.当在Dockerfile中运行时,使用httpredir的apt-get几乎总是会在一两个包上搞乱,整个构建都会失败.错误通常看起来像镜子已经过时或以某种方式腐败.我最终通过添加以下行停止在我的所有Dockerfiles中使用httpredir:
# don't use httpredir.debian.org mirror as it's very unreliable
RUN echo deb http://ftp.us.debian.org/debian jessie main > /etc/apt/sources.list
Run Code Online (Sandbox Code Playgroud)
今天又回去httpredir.debian.org
再次尝试,因为ftp.us.debian.org
我需要的软件包已经过时了,果然它在Docker Hub上失败了:
Failed to fetch http://httpredir.debian.org/debian/pool/main/n/node-retry/node-retry_0.6.0-1_all.deb Error reading from server. Remote end closed connection [IP: 128.31.0.66 80]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
Run Code Online (Sandbox Code Playgroud)
这是我在这种情况下运行的apt-get命令,虽然我和其他许多人一起遇到过它:
RUN apt-get update && apt-get install -y \
build-essential \
chrpath \
libssl-dev \
libxft-dev \
libfreetype6 …
Run Code Online (Sandbox Code Playgroud) 简短版本:对于单元测试,我需要一个不可读的文件来确保抛出正确的异常.显然,Git无法存储该无法读取的文件,因此我chmod 000
在测试时使用,git update-index --assume-unchanged
以便Git不会尝试存储不可读的文件.但后来我无法签出一个不同的分支,但得到错误"您对以下文件的本地更改将被结帐覆盖."
有没有更好的测试方法,或者更好的方式来使用Git,以便一切运行良好?
长版本:在一个类中,我有一个方法来读取文件,以便将其内容导入到数据库中:
public function readFile($path) {
...
if(!is_readable($path))
throw new FileNotReadableException("The file $path is not readable");
...
}
Run Code Online (Sandbox Code Playgroud)
我使用PHPUnit测试该方法,特别是一个测试应该(间接)触发FileNotReadableException:
/**
* @expectedException Data\Exceptions\FileNotReadableException
*/
public function testFileNotReadableException() {
$file = '/_files/6504/58/6332_unreadable.xlsx';
@chmod(__DIR__ . $file, 0000);
$import = Import::find(58);
$import->importFile(array('ID'=>2, 'newFilename'=> $file), __DIR__);
}
Run Code Online (Sandbox Code Playgroud)
经过测试,git checkout other_branch
将中止:
error: Your local changes to the following files would be overwritten by checkout:
Data/Tests/_files/6504/58/6332_unreadable.xlsx
Please, commit your changes or stash them before …
Run Code Online (Sandbox Code Playgroud) 我正在使用PHP进行计算bcmath
,需要e
通过小数指数来提高.不幸的是,bcpow()
只接受整数指数.指数通常比浮点数允许的精度更高,因此正常的算术函数不会削减它.
例如:
$e = exp(1);
$pow = "0.000000000000000000108420217248550443400745280086994171142578125";
$result = bcpow($e, $pow);
Run Code Online (Sandbox Code Playgroud)
结果是"1"
错误,"bc数学警告:指数中的非零刻度".
我可以用另一种功能代替bcpow()
吗?
使用该rax
模块启动服务器并获取清单时,如何告诉Ansible连接到隔离网络上的IP地址,而不是服务器的公共IP?
注意:正在从同一隔离网络中的服务器运行Ansible。
我在rax
模块上使用Ansible在Rackspace Cloud中启动服务器,然后将其添加到隔离/专用网络中。然后,将其添加到清单并开始配置。我要做的第一件事是锁定SSH,部分是通过告诉SSH仅绑定到隔离网络上提供给主机的IP地址。问题是,这意味着ansible无法通过公共IP地址进行连接,因此我也将其设置ansible_ssh_host
为私有IP。(将主机添加到清单时会发生这种情况。)
- name: Add servers to group
local_action:
module: add_host
hostname: "{{ item.name }}"
ansible_ssh_host: "{{ item.rax.addresses.my_network_name[0].addr }}"
groups: launched
with_items: rax_response.success
when: rax_response.action = 'create'
Run Code Online (Sandbox Code Playgroud)
在第一次创建和配置新实例时,此方法就很好。不幸的是,下次我尝试连接到这些服务器时,连接被拒绝,因为Ansible正在尝试使用SSH无法监听的IP地址。发生这种情况是因为:
ansible_ssh_host
...rax.py
清单脚本已设置ansible_ssh_host
为accessIPv4
Rackspace返回的...accessIPv4
为服务器的公共IP地址。现在,我不确定该怎么办。Rackspace确实允许API调用来更新服务器并设置服务器accessIPv4
,所以我认为我可以local_action
在创建服务器后再运行一个服务器。不幸的是,rax模块似乎不允许更新服务器,即使这样做,它也依赖于pyrax,而后者又取决于novaclient,而novaclient仅允许更新服务器的名称,而不是accessIPv4
。
肯定有人这样做过。通过rax
模块获取动态清单时,告诉Ansible在隔离网络上进行连接的正确方法是什么?
在AngularJS中,ng-options
让我们指定一个包含任何值的数组,而不仅仅是字符串,同时保留类型.例如,我可以select
使用ng-options
整数数组创建HTML .选择某个选项时,整数值将放入model-no string-to-int转换中.
在榆树,期权的value
属性只接受一个字符串,因此select
的onInput
事件发回的字符串.然后我必须手动将其转换为int.
榆树有没有与AngularJS相同的东西ng-options
?或者任何方式使用select
具有任意,甚至非标量值的值?