小编Cl0*_*ent的帖子

使用 Symfony 本地服务器时弃用 ServerBundle

我正在使用 Symfony 4.4.2
当我使用服务器包运行服务器时......

./bin/console server:run
Run Code Online (Sandbox Code Playgroud)

...我收到弃用警告:

User Deprecated: Using the WebserverBundle is deprecated since Symfony 4.4. The new Symfony local server has more features, you can use it instead.
Run Code Online (Sandbox Code Playgroud)

所以我安装了 Symfony 本地服务器,现在我正在使用它:

User Deprecated: Using the WebserverBundle is deprecated since Symfony 4.4. The new Symfony local server has more features, you can use it instead.
Run Code Online (Sandbox Code Playgroud)

但是,弃用仍然存在。
为什么?

php symfony

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

GitLab CI/CD:构建多架构 Docker 镜像

我想要一种在 GitLab 运行程序中构建多架构 Docker 映像的简单方法。简单地说,我的意思是我只需要在我的项目中添加一个 .gitlab-ci.yml 就可以了。

这是我写的 .gitlab-ci.yml。它使用 buildx 构建多架构镜像,然后将其推送到 GitLab 注册表:

image: cl00e9ment/buildx

services:
- name: docker:dind

variables:
  PLATFORMS: linux/amd64,linux/arm64
  TAG: latest

before_script:
  - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"

build:
  stage: build
  script:
  - docker buildx build --platform "$PLATFORMS" -t "${CI_REGISTRY_IMAGE}:${TAG}" . --push
Run Code Online (Sandbox Code Playgroud)

问题是linux/arm64平台不可用。

以下是我构建 cl00e9ment/buildx 映像的方法(强烈受到snadn/docker-buildx的启发):

这是 Dockerfile:

FROM docker:latest

ENV DOCKER_CLI_EXPERIMENTAL=enabled
ENV DOCKER_HOST=tcp://docker:2375/

RUN mkdir -p ~/.docker/cli-plugins \
  && wget -qO- https://api.github.com/repos/docker/buildx/releases/latest | grep "browser_download_url.*linux-amd64" | cut -d : -f 2,3 | …
Run Code Online (Sandbox Code Playgroud)

build gitlab docker gitlab-ci multiarch

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

CORS 和 Web 扩展

我在http://localhost:8080上设置了一个服务器,其中http://example.com可以执行 POST 请求:

'use strict';

const express = require('express');

const app = express();
const port = 8080;

// allowing CORS for example.com
app.use('/', function (req, res, next) {
    res.header('Access-Control-Allow-Origin', 'http://example.com');
    if (req.method === 'OPTIONS') {
        res.header('Access-Control-Allow-Methods', 'OPTIONS, POST');
        res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length');
        res.status(200).send();
    } else {
        next();
    }
});

// handling POST requests
app.use('/', function (req, res) {
    console.log('a client did a POST request');
    res.status(200);
});

app.listen(port, () => console.log ('server started on port ' + port));
Run Code Online (Sandbox Code Playgroud)

它工作正常:由于同源策略,我无法从 …

firefox-addon same-origin-policy cors

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

构建一个AffineTransform对象来匹配3个点的变换

我知道仿射变换前后 3 个点(p0、p1、p2)的位置(X 和 Y)。我想构建与此转换匹配的 AffineTransformation 对象。换句话说,我想找到将已知点 p0、p1、p2 移动到其已知目的地的仿射变换。

这是我到目前为止所做的:

package image_transformation;

import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;

import math.Vector2d;

public class ImageTransformation {

    public static void main(String[] args) throws IOException {

        // the position of the points before the transformation
        Vector2d[] src = new Vector2d[] {
                new Vector2d(486, 191),
                new Vector2d(456, 565),
                new Vector2d(149, 353)
        };

        // the position of the points after the transformation
        Vector2d[] dest = new Vector2d[] {
                new Vector2d(0, …
Run Code Online (Sandbox Code Playgroud)

java transformation image-processing

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