小编pgr*_*ues的帖子

RegEx匹配m:ss进行输入验证

我一直在努力创建一个RegEx来实现以下目标:

  • 分钟只有一个数字(0到9);
  • 秒只有两个数字(00到59);
  • 必须格式为m:ss.

到目前为止我有这个: ^(?:([0]{0}?\d):)?([0-5]{1}?\d)$

然而,例如00的情况似乎是通过,它不应该,因为它不是m:ss格式.

javascript regex

5
推荐指数
2
解决办法
119
查看次数

在 Docker 容器内访问 raspistill / pi 相机

我一直在使用 Docker 在 Raspberry Pi 3 Model B 上试用我的 Node.js 应用程序,它运行没有任何问题。

当应用程序依赖项(raspicam)需要raspistill使用相机拍照时,问题就出现了。Raspberry 正在运行 Debian Stretch,并且 pi 相机已配置和测试。但是通过 Docker 运行应用程序时我无法访问它。

基本上,我使用以下 Dockerfile 在 win10 64 位机器上使用 Docker Desktop 构建映像:

FROM arm32v7/node:10.15.1-stretch

ENV PATH /opt/vc/bin:/opt/vc/lib:$PATH

RUN echo "/opt/vc/lib" > /etc/ld.so.conf.d/00-vcms.conf \
    && ldconfig

# Create the app directory
ENV APP_DIR /home/app
RUN mkdir $APP_DIR
WORKDIR $APP_DIR

# Copy both package.json and package-lock.json
COPY package*.json ./

# Install app dependencies
RUN npm install

# Bundle app source
COPY . .

EXPOSE …
Run Code Online (Sandbox Code Playgroud)

node.js raspberry-pi docker dockerfile

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

AngularJS无法正确呈现SVG

我有一个指令,应该将SVG元素附加到指令元素

.directive('aSvg', function ($compile) {
    return {
        restrict: 'E',
        replace: true,
        link: function (scope, element, attrs) {
            var svgTag = angular.element('<svg viewBox="0 0 4000 2000" version="1.1"><defs><marker id="StartMarker" viewBox="0 0 12 12" refX="12" refY="6" markerWidth="3" markerHeight="3" stroke="green" stroke-width="2" fill="none" orient="auto"><circle cx="6" cy="6" r="5"></circle></marker><marker id="MidMarker" viewBox="0 0 10 10" refX="5" refY="5" markerUnits="strokeWidth" markerWidth="3" markerHeight="3" stroke="lightblue" stroke-width="2" fill="none" orient="auto"><path d="M 0 0 L 10 10 M 0 10 L 10 0"></path></marker><marker id="EndMarker" viewBox="0 0 10 10" refX="5" refY="5" markerUnits="strokeWidth" markerWidth="3" markerHeight="3" stroke="red" stroke-width="2" …
Run Code Online (Sandbox Code Playgroud)

javascript svg angularjs

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

标签 统计

javascript ×2

angularjs ×1

docker ×1

dockerfile ×1

node.js ×1

raspberry-pi ×1

regex ×1

svg ×1