小编zaj*_*jca的帖子

为什么作曲家会在300秒后安装超时?

当我尝试在我的服务器上构建它时,我在symfony2中创建了一个小项目,在解压缩symfony时总是失败.构建是好的,突然作曲家不会解压缩symfony,我没有改变任何东西.我尝试使用Jenkins构建,也尝试使用bash手动构建相同的结果.这不是权限问题,我的服务器上的互联网连接也没问题.

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
 - Installing symfony/symfony (v2.3.4)
 Downloading: 100%
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "unzip '/path/vendor/symfony/symfony/6116f6f3
d4125a757858954cb107e64b' -d 'vendor/composer/b2f33269' && chmod -R u+w 'vendor/composer/b2f33269'" exceeded the timeout of 300 seconds.
Run Code Online (Sandbox Code Playgroud)

timeout symfony composer-php

57
推荐指数
7
解决办法
5万
查看次数

Laravel angularjs Request :: ajax()总是假的

我正在用angularjs和laravel构建应用程序4.一切都很好但我现在只需要允许XHR请求.

这就是我在控制器开头所拥有的.但这种说法总是错误的.

    if (!\Request::ajax())
    {
        return Response::json(array('halt'=>Request::ajax()));
    };
Run Code Online (Sandbox Code Playgroud)

在角度我使用标准的$ http服务.

angular.module('APP')
.factory("API", ($http,$q,appClient,apiURL) ->
 class FB
  constructor:->
    this.deferredData = $q.defer();
  info: (reload)->
    $http(
      method: "get"
      url: apiURL+'game/'+appClient+"/info"
    ).success((res)->
      dostuff()
    )
Run Code Online (Sandbox Code Playgroud)

php ajax coffeescript angularjs laravel-4

29
推荐指数
3
解决办法
8228
查看次数

语法错误:令牌'mod'是意外的,期望在[mod}}开始的表达式[partials/{{mod}}.html]第12列的[:].html]

我想做一个简单的思考.在循环中使用ng-include将多个html页面包含在渲染页面中.

<div ng-controller="pageCTRL">
 <div ng-repeat="mod in modules">
  <div ng-include src='partials/{{mod}}.html'></div>
 </div>
</div>

$scope.modules = ["mod_nav","mod_feature","mod_footer"];
Run Code Online (Sandbox Code Playgroud)

但我得到的就是这个.

Error: Syntax Error: Token 'mod' is unexpected, expecting [:] at column 12 of the expression [partials/{{mod}}.html] starting at [mod}}.html].
at Error (<anonymous>)
at throwError (angular.js:6066:11)
at consume (angular.js:6104:7)
at object (angular.js:6394:9)
at primary (angular.js:6278:17)
at unary (angular.js:6265:14)
at multiplicative (angular.js:6251:39)
at additive (angular.js:6239:16)
at relational (angular.js:6230:16)
at equality (angular.js:6221:16) <div ng-include="" src="partials/{{mod}}.html"> 
Run Code Online (Sandbox Code Playgroud)

你有解决方法怎么做?

呈现的代码如下所示:

  <div ng-include="" src="partials/mod_nav.html"></div>
Run Code Online (Sandbox Code Playgroud)

所以我不明白我做错了什么

javascript angularjs

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

Angularjs过滤嵌套对象

我有像这样的角度嵌套对象.有没有办法过滤它的嵌套属性

<li ng-repeat="shop in shops | filter:search">
search.locations.city_id = 22
Run Code Online (Sandbox Code Playgroud)

我只显示父元素,但想要同时过滤它们,例如:

search = 
  category_id: 2
  locations:
    city_id: 368

[
 name: "xxx"
 category_id: 1
 locations: [
   city_id: 368
   region_id: 4
  ,
   city_id: 368
   region_id: 4
  ,
   city_id: 368
   region_id: 4
  ]
,
 name: "xxx"
 category_id: 2
 locations: [
   city_id: 30
   region_id: 4
  ,
   city_id: 22
   region_id: 2
  ]
]
Run Code Online (Sandbox Code Playgroud)

filter angularjs angularjs-filter

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

IntersectionObserver 在高度大于视图的元素上的位置

我正在寻找一种方法来在菜单中向用户显示他在页面上的位置。每个菜单项都有指向另一个元素和 IntersectionObserver 的锚链接,IntersectionObserver 设置项目的背景宽度,以及项目是否从底部或顶部显示(背景上的左右)

let options = {
  root: null,
  rootMargin: "0px",
  threshold: []
}
for (let i = 0; i <= 1.0; i += 0.01) {
  options.threshold.push(i)
}
this.observer = new IntersectionObserver(entries => {
  const item = entries[0]
  if (item.isIntersecting) {
    let visiblePct = Math.floor(item.intersectionRatio * 100)
    this.pageProgressOpt.width =
      (this.$el.getBoundingClientRect().width / 100) * visiblePct
    this.pageProgressOpt.align =
      item.boundingClientRect.top < 0 ? "right" : "left"
  } else {
    this.pageProgressOpt.width = 0
  }
}, options)
Run Code Online (Sandbox Code Playgroud)

但是,当元素高度大于可见窗口的高度并且视图位于元素中间时,不会触发回调。这有点明显,因为达到了阈值 1.0。但我正在寻找继续观察元素的方法。我想在发生这种情况时附加到滚动条上,但无法说明是否发生这种情况。

我应该为此使用滚动事件还是有任何解决方法?

//编辑:这是我正在做的视频https://drive.google.com/file/d/1gPrIWgcLTJ3vhquyrUnyyh9IlTuZiDRJ/view

javascript intersection-observer

5
推荐指数
0
解决办法
2943
查看次数

Ruby除了一些字符外删除所有内容

如何从字符串中删除除空格,数字和其他字符之外的所有字符?像这样的东西:

oneLine.gsub(/[^ULDR0-9\<\>\s]/i,'')
Run Code Online (Sandbox Code Playgroud)

我只需要: 0-9 l d u r < > <space>

另外,有没有关于在Ruby中使用正则表达式的好文档,比如带有示例的特殊字符列表?

ruby regex gsub

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

Symfony表单集合未保存参考

我有包含多张照片的实体:

/**
 * related images
 * @ORM\OneToMany(targetEntity="Photo", mappedBy="entity",cascade={"persist"})
 * @ORM\OrderBy({"uploaded_at" = "ASC"})
 */
private $photos;
Run Code Online (Sandbox Code Playgroud)

照片与实体有ManyToOne关系

    /**
 * @ORM\ManyToOne(targetEntity="Acme\AppBundle\Entity\Entity", inversedBy="photos")
 * @ORM\JoinColumn(name="entity_id", referencedColumnName="id", onDelete="CASCADE")
 */
private $entity;
Run Code Online (Sandbox Code Playgroud)

我设置了symfony集合文档:http ://symfony.com/doc/current/reference/forms/types/collection.html

表格类型:

             ->add('photos', 'collection', array(
             'type' => new PhotoFormType(),
             'allow_add' => true,
             'by_reference' => false,
             'allow_delete' => true,
             'prototype' => true

         ))
Run Code Online (Sandbox Code Playgroud)

相片类型:

        $builder
        ->add('title', null, ['label' => 'front.photo.title', 'required' => true])
        ->add('image', 'file', array('required' => false))
    ;
Run Code Online (Sandbox Code Playgroud)

对于上载,我使用的是vichUploadableBundle,图像保存得很好,但是entity_id不保存并且为空。我不知道我在这里错过了什么。

php symfony doctrine-orm

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

GitLab:你不被允许访问高手!将gitlab移动到另一台服务器后

我正在将我的gitlab实例移动到另一台服务器,我遇到了问题.克隆工作正常,但推送错误,我无法弄清问题在哪里.在gitlab中,日志没有用.

git push
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 351 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: GitLab: You are not allowed to access master! 
remote: error: hook declined to update refs/heads/master
To git@server:user/repo.git
! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'git@server:user/repo.git'
Run Code Online (Sandbox Code Playgroud)

我不知道问题在哪里,我改变了一点配置.Repos和satelites在以前的服务器符号链接到/media/data/git/repositories现在的/home/git符号链接到/media/disk/git但我不认为这是问题.

编辑:// gitlab:检查是一切还好gitlab-shell检查还可以

linux git ssh

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

无法为命名路由"regions.index"生成URL,因为此路由不存在

我正在用laravel 4做休息api,我收到了这个错误:

Unable to generate a URL for the named route "regions.index"
as such route does not exist.
Run Code Online (Sandbox Code Playgroud)

我的路由器:

Route::group(array('prefix' => 'api/v1'), function(){
   Route::get('regions', 'RegionsController@index');
   Route::get('regions/{id}', 'RegionsController@getOne');
   Route::get('regions/{id}/cities', 'RegionsController@getCities');
});
Run Code Online (Sandbox Code Playgroud)

api/v1/regions和api/v1/regions/1/cities工作正常

但是api/v1/regions/1不起作用而且异常,我真的不知道为什么,也找不到如何让它工作.

php routing laravel laravel-4

0
推荐指数
1
解决办法
1968
查看次数