小编and*_*dig的帖子

该软件包没有足够稳定的版本

以下情况:

  • andig/dbcopy应用程序在开发版本中 需要:composer require andig/dbcopy:dev-master
  • andig/dbcopy开发版本需要symfony/console(由于 2.5 中的错误):

    "require": {
        "doctrine/dbal": "2.4.*",
        "symfony/console": "2.6.*@dev"
    },
    
    Run Code Online (Sandbox Code Playgroud)

现在,当andig/dbcopy使用添加到应用程序时composer require,作曲家抱怨稳定性:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for andig/dbcopy dev-master -> satisfiable by andig/dbcopy[dev-master].
    - andig/dbcopy dev-master requires symfony/console 2.6.*@dev -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version …
Run Code Online (Sandbox Code Playgroud)

symfony composer-php

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

我可以在 github 页面中使用带有图像链接的 Markdown 吗?

我管理 github 通过 Jeckyl 运行我的 index.md 并按照https://help.github.com/articles/creating-project-pages-manually/在 github.io 下显示它。但是,我的这种形式的图像链接:

 ![Sicherung vorbereiten](img/export.png?raw=true)
Run Code Online (Sandbox Code Playgroud)

不要像他们在 README.md 中那样显示

从 markdown 文件运行时,我可以将图像与 github.io 一起使用吗?

markdown github

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

Gulp:如何将参数从watch传递给任务

有了吞咽,你经常会看到这样的模式:

gulp.watch('src/*.jade',['templates']);

gulp.task('templates', function() {
  return gulp.src('src/*.jade')
    .pipe(jade({
      pretty: true
    }))
    .pipe(gulp.dest('dist/'))
    .pipe( livereload( server ));
});
Run Code Online (Sandbox Code Playgroud)

这实际上是将watcheded文件传递给模板任务吗?这些如何覆盖/扩展/过滤src的任务?

gulp gulp-watch

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

如何为每个前端指定基本身份验证

阅读了https://github.com/containous/traefik/issues/751https://github.com/containous/traefik/pull/1147并提到traefik.frontend.auth.basic我正在尝试为每个traefik前端设置基本身份验证(而不是入口点) )。

都没有

[frontends.kibana]
backend = "kibana"
    [frontends.kibana.routes.nas]
    rule = "Host:kibana.mydomain.io"
    [frontends.kibana.auth]
    basic = "kibana:$apr1$cHAIJt0o$..."
Run Code Online (Sandbox Code Playgroud)

也不

[frontends.kibana]
backend = "kibana"
auth.basic = "kibana:$apr1$cHAIJt0o$..."
    [frontends.kibana.routes.nas]
    rule = "Host:kibana.mydomain.io"
Run Code Online (Sandbox Code Playgroud)

工作中。如何在前端级别指定基本身份验证?

traefik

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

如何将大对象/数组序列化为JSON

我的应用程序需要生成一个具有data类型数组的大属性的对象的json .数组需要在收集数据库输出时保留在内存中,并且只有在数组完成后才能确定某些属性.

复杂性:数组是基于数字的,并且必须在json输出中显示,因此直接json_encode()不是一个选项.

为了在像RasPi这样的低规格机器上实现这一点,我研究了修剪内存消耗:

  1. 使用 SPLFixedArray
  2. 使用stringpack()

这两种方法都会处理数组存储内存问题,但在使用JSON进行编码时会失败.

我已经研究了实现JsonSerializable但是因为它强制用户返回结果,然后在Json中编码我回到了

public function jsonSerialize() {
    return $this->toArray();
}
Run Code Online (Sandbox Code Playgroud)

它有相同的记忆问题.

zendframework/Component_ZendJson看起来很有希望,因为它寻找具有toJson()提供自己的编码的方法的对象string而不是object.

我想知道是否有更好的选择不会给内存问题?

php arrays spl json zend-framework

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

如何在Symfony2/Silex中捕获错误和异常?

我想在我的Silex应用程序中捕获错误和异常,将它们包装在一个自定义的JSON响应中,该响应将始终返回给客户端.我找到了三种基本方法:

$app->error()
Symfony\Component\Debug\ErrorHandler::register();
Symfony\Component\Debug\ExceptionHandler::register();
Run Code Online (Sandbox Code Playgroud)

虽然我能够使用error()我的php错误来捕获控制器异常 - 但它们总是在xdebug中结束.我还没有理解如何error()ExceptionHandler::register()每个其他-我需要两个互动?如何确保我的error()回复是JSON?

我现在有以下示例代码:

use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

class Router extends Silex\Application
{
    function __construct() {
        parent::__construct();

        // routes
        $this->match('/{context}', array($this, 'handler'));

        // error handler
        $this->error(function(\Exception $e, $code) {
            return $this->json(array("error" => $e->getMessage()), $code);
        });
    }

    function handler(Request $request, $context) {
        // throw new \Exception('test'); // exception- this is caught
        $t = new Test(); // error- this is not caught

        return 'DONE';
    }
}

Symfony\Component\Debug\ErrorHandler::register();

$app …
Run Code Online (Sandbox Code Playgroud)

php symfony silex

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

Github:只读访问私有仓库,以便分布式部署到客户设备

我有一个私人仓库,需要部署到许多物联网设备(RasPi).我希望能够git pull通过cron工作.我想知道如何管理对repo的只读访问:

  • 访问代码不是一个考虑因素,因为无论如何它都可以在设备上使用
  • 部署密钥似乎不起作用,因为它们授予访问权限

我正在考虑使用具有只读访问权限的专用github用户来实现此目的.还有其他或更好的选择吗?

deployment github

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

如何从Yaml解组嵌入式结构

我想使用嵌入式结构将yaml解组为DRY:

package main

import (
    "fmt"
    "log"
    "gopkg.in/yaml.v2"
)

type Person struct {
    Name string
}

type Employee struct {
    Person
    Number string
}

func (c *Employee) Dump() {
    d, err := yaml.Marshal(c)
    if err != nil {
        log.Fatalf("error: %v", err)
    }
    fmt.Printf("--- dump:\n%s\n\n", string(d))
}

func main() {
    s := `
name: john
number: one
`

    c := &Employee{}
    err := yaml.Unmarshal([]byte(s), c)
    if err != nil {
        log.Fatalf("Unmarshal: %v", err)
    }

    c.Dump()
}
Run Code Online (Sandbox Code Playgroud)

结果是:

--- dump:
person:
  name: …
Run Code Online (Sandbox Code Playgroud)

yaml go unmarshalling

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

如何在Symfony 4上配置easyadminbundle?

根据http://fabien.potencier.org/symfony4-best-practices.html,文件没有/有限的用例config.yml.我应该在哪里easy_admin为symfony 4管理的实体配置?

symfony symfony2-easyadmin

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

地图接收器类型无效

我试图在基本地图上定义其他方法https://play.golang.org/p/3BKgxVJIjP1

type Typ struct {
    config string
}

type typeRegistry = map[string]Typ

func (r typeRegistry) Add(name string) {
    typ := Typ{
        config: "config",
    }

    r[name] = typ
}
Run Code Online (Sandbox Code Playgroud)

这样做会失败:

invalid receiver type map[string]Typ (map[string]Typ is not a defined type)
Run Code Online (Sandbox Code Playgroud)

重构之前,方法类似,但用 afunc代替Typ

invalid receiver type map[string]Typ (map[string]Typ is not a defined type)
Run Code Online (Sandbox Code Playgroud)

这个版本有效。在映射类型接收器上定义附加方法的区别在哪里?

go

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

如何在 Vue 的 v-model 中使用 Bootstrap 按钮组收音机?

我在 bootstrap 4.4 中使用 vuejs。重构我想从调用方法转移到使用的代码v-model(为了清楚起见,省略了一些引导标记)。单选按钮组模仿https://getbootstrap.com/docs/4.0/components/buttons/#checkbox-and-radio-buttons

{{mode}}
<div class="btn-group btn-group-toggle py-4 mb-2" data-toggle="buttons">
    <label>
        <input type="radio" name="mode" value="off" v-model="mode">Stop</input>
    </label>
    <label>
        <input type="radio" name="mode" value="now" v-model="mode">Sofort</input>
    </label>
</div>
Run Code Online (Sandbox Code Playgroud)

mode 是一个简单的属性:

data: function () {
  return {
    mode:"pv",
  };
},
Run Code Online (Sandbox Code Playgroud)

不幸的是,在使用v-on:click="setMode(...)"to从以前的实现更改后v-modelmode永远不会更新,也没有给出错误。

bootstrap 文档说明:

这些按钮的选中状态仅通过按钮上的单击事件更新

这可能与 vuejs 的v-model处理冲突吗?如何v-model与引导无线电组一起工作?

vue.js bootstrap-4 vuejs2

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

为什么没有调用子类的虚函数

我有一个基类和派生类:

plugin.h

#ifndef PLUGIN_H
#define PLUGIN_H

// plugin states
#define PLUGIN_IDLE 0

class Plugin {
public:
  Plugin();
  ~Plugin();

  virtual void loop();
};

#endif
Run Code Online (Sandbox Code Playgroud)

plugin.cpp

#include <Arduino.h>
#include "plugin.h"

Plugin::Plugin() {
}

Plugin::~Plugin(){
}

void Plugin::loop(){
  Serial.println("Plugin::loop()");
}
Run Code Online (Sandbox Code Playgroud)

派生类

class OneWirePlugin : public Plugin {
public:
  OneWirePlugin(byte pin);
  void loop();
};

OneWirePlugin::OneWirePlugin(byte pin) {
}

void OneWirePlugin::loop() {
  Serial.println("OneWirePlugin::loop()");
}
Run Code Online (Sandbox Code Playgroud)

我期待调用派生实例的loop()方法将执行OneWirePlugin::loop().

但是,这只发生在我在派生类上下文中调用它时:

Plugin p = Plugin();
Plugin o = OneWirePlugin(ONEWIRE_PIN);
OneWirePlugin q = OneWirePlugin(ONEWIRE_PIN);
p.loop(); …
Run Code Online (Sandbox Code Playgroud)

c++ arduino

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