小编Daz*_*ylz的帖子

AngularJS:ngRoute,否则无效

我有一个非常奇怪的错误,我设置了我的路线和我的控制器.现在我只有一个没有错误的空白页面?

index.html的;

<!DOCTYPE html>
<html ng-app="RekenTalent" lang="nl">
    <head>
        <title>Rekentalent.nl: Ben jij een talent in Rekenen?</title>
        <!-- Stylesheets -->
        <link rel="stylesheet" type="text/css" href="/app/front/assets/stylesheets/style.css">
        <!-- AngularJS -->
        <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular.min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular-route.min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.16/angular-animate.min.js"></script>
        <!-- Controllers -->
        <script src="/app/front/controllers/controller.js"></script>
        <!-- Router -->
        <script src="/app/front/router.js"></script>
    </head>

    <body ng-view></body>
</html
Run Code Online (Sandbox Code Playgroud)

>

Controller.js:

/**
*  RekenTalent
*
* Copyright 2014 - Rekentalent.nl
*/
var RekenTalent = angular.module('RekenTalentControllers', []);

RekenTalent.controller('rekenCtrl', ['$scope', function($scope){

}]);
Run Code Online (Sandbox Code Playgroud)

Router.js:

var RekenTalent = angular.module('RekenTalent', [
    'ngRoute', 'RekenTalentControllers'
]);

RekenTalent.config(['$routeProvider', function($routeProvider) {
    $routeProvider.
    when('/index', …
Run Code Online (Sandbox Code Playgroud)

angularjs ngroute

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

NodeJS和Raspberry Pi

我现在在Raspberry Pi上运行Raspbian,我想为它制作一个控制面板,所以我可以在网络浏览器中控制我的Raspberry Pi.但是如何在NodeJS中执行命令?

node.js raspberry-pi

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

CSS Bootstrap:带有错误消息的内联表单

我正在使用Bootstrap v3.2.我有一个内联表单,但我想显示一条错误消息,但它不好: http://i.imgur.com/BCM6bZH.png

有没有办法做到这一点: 在此输入图像描述

HTML:

<div class="jumbotron">
    <p class="lead">{{errorMsg}}</p>
    <form class="form-inline" role="form" name="loginForm">
        <div class="form-group">
            <input class="form-control" ng-model="user.name" type="text" placeholder="Gebruikersnaam" required>
            <div>
                <span style="float:left" class="glyphicon glyphicon-warning-sign"></span>
            </div>
        </div>
    <div class="form-group">
      <input type="password" class="form-control" ng-model="user.password" placeholder="Wachtwoord" required>
    </div>
        <button onclick="javascript:void(0)"class="btn btn-default" ng-disabled="loginForm.$invalid" ng-click="login()">Log in</button>
    </form>
</div>
Run Code Online (Sandbox Code Playgroud)

问题是输入上升,我不想要.

html css twitter-bootstrap

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

angularjs push object undefined不是一个函数

所以,我对这段代码有疑问,我不知道为什么会出现这个错误

$scope.veilingen = {};
$http.get('./helpers/get/Veilingen.php').
success(function(data) {
    if(debugMode) console.log(data);
    $scope.veilingenCache = data;
    for(var i = 0; i < 2; i++) {
        console.log($scope.veilingen)
        $scope.veilingen.push({
           test: 'hello'
        });
        console.log($scope.veilingen)
    }
});
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

TypeError:undefined不是http://example.com/includes/controllers/veilingCntrl.js:12:30 at http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.18/上的函数angular.min.js:72:72 at I(http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.18/angular.min.js:100:144)at I(http:/ /cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.18/angular.min.js:100:144)在http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2. 18/angular.min.js:101:308 at k.$ eval(http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.18/angular.min.js:112:32)at at k.$ digest(http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.18/angular.min.js:109:121)at k.$ apply(http://cdnjs.cloudflare .com/ajax/libs/angular.js/1.2.18/angular.min.js:112:362)at h(http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.18/ angular.min.js:72:327)at x(http://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.18/angular.min.js:77:288)

第12行是push()区域.我已经搜索了为什么会发生这种情况,但我找不到它.我想要的是veilingen对象获得前2个结果,加载后用户可以通过以下方式更改它:

$scope.setLimitVeiling = function(items) {
    for(var i = 0; i < items; …
Run Code Online (Sandbox Code Playgroud)

angularjs

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

在 Docker 容器中运行 python 脚本错误的时区

我在 Docker 容器 (python:3.6) 中运行一个脚本,它在日志中显示了错误的时间。在 python 控制台(容器内)中使用以下 python 代码时,它给了我正确的时区。

import datetime
datetime.datetime.now()
datetime.datetime(2019, 8, 3, 17, 26, 25, 662809)
Run Code Online (Sandbox Code Playgroud)

此外,在date容器内运行命令时,它会给出正确的时区。

但是,我的脚本中有这个打印语句:

print("Updating....", datetime.datetime.now())
Run Code Online (Sandbox Code Playgroud)

但是,这给了我错误的时区(休息 2 小时)。

在此处输入图片说明

这是我的 docker-compose.yml:

version: '3'
services:
  app:
    container_name: app
    build: .
    restart: unless-stopped
    environment:
      TZ: Europe/Amsterdam
    depends_on:
      - db
  db:
    container_name: db
    image: mariadb
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: x
      MYSQL_DATABASE: x
      MYSQL_USER: x
      MYSQL_PASSWORD: x
      TZ: Europe/Amsterdam
    volumes:
      - /volumes/x/db:/var/lib/mysql
Run Code Online (Sandbox Code Playgroud)

这是我的 crontab 文件(在应用程序容器内运行)

CRON_TZ=Europe/Amsterdam

*/5 * * * * cd /usr/src/app && /usr/local/bin/python3.6 …
Run Code Online (Sandbox Code Playgroud)

python datetime python-3.x docker

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

Javascript中的所有RGB颜色组合

我想要Javascript中的所有RGB颜色。我已经建立了这个模式。

R   G   B
0   0   0
255 255 255
0   255 255
255 0   255
255 255 0
0   255 0
0   0   255
255 0   0
Run Code Online (Sandbox Code Playgroud)

我用Java语言制作的: 点击

我现在有所有可能的RGB颜色组合吗?

javascript rgb

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

正则表达式:1 个数字或 2 个数字

我需要检查 title="Week 1" 或 title="Week 13" 的链接,我已经尝试了在互联网上找到的一些内容,但它不起作用:

http://regexr.com?38bet

那么,如果某个东西只有一个数字或两个数字,如何匹配呢?

regex expression

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

MySQL:在1个查询中具有更多WHERE的COUNTS

是否有可能做到这一点:

SELECT COUNT(username) as username FROM users WHERE username = 'Piet';
SELECT COUNT(email) as email FROM users WHERE email = 'piet@google.nl';
SELECT COUNT(ip_registed) as ip FROM users WHERE ip = '127.0.0.1';
Run Code Online (Sandbox Code Playgroud)

在一个查询中(所以没有子查询)?

mysql count where

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

创建倾斜的三角形

是否有可能创造出这个小提琴制作的形状.但是没有JavaScript但CSS3(带<div>)?

基本上这个:

for(var i = 0; i < coords.length; i += 1) {
    if(coords[(i + 1)] != undefined) {
        ctx.beginPath();
        ctx.moveTo(coords[i].x, coords[i].y);
        ctx.lineTo(coords[(i + 1)].x, coords[(i + 1)].y);
        ctx.stroke();
    } else {
        ctx.beginPath();
        ctx.moveTo(coords[i].x, coords[i].y);
        ctx.lineTo(coords[0].x, coords[0].y);
        ctx.stroke();
    }
}
Run Code Online (Sandbox Code Playgroud)

所以你有点需要相互连接?

html css svg css3 css-shapes

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