小编Maz*_*zzy的帖子

将两个输入文本放在同一行

我正在使用html和jquery mobile.here代码:

<div data-role = "content">
        <form action = "?" method="post" name="form" id = "form">
            <fieldset>
            <div data-role = "fieldcontain" class = "ui-hide-label">
                <label for="name">Name</label>
                <input type="text" name="name" id="name" value="" placeholder="Name" />
            </div>

            <div data-role ="fieldcontain" class= "ui-hide-label">
                <label for="surname">Surname</label>
                <input type="text" name="surname" id="surname" value="" placeholder="Surname"/>
            </div>

            <div data-role ="fieldcontain" class= "ui-hide-label">
                <label for="address">Address</label>
                <input type="text" name="address" id="address" value="" placeholder="Address"/>
            </div>


                <div data-role="fieldcontain" class="ui-hide-label">
                    <label for="birth-place">Birth Place</label>
                    <input type="text" name="birth-place" id="birth_place" value="" placeholder="Birth Place" />
                </div>
                <div data-role = "fieldcontain" …
Run Code Online (Sandbox Code Playgroud)

html css jquery-mobile

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

在node.js中读取缓冲区对象

我正试图通过名为Wreck的节点模块获取html页面

获取数据应该很容易,但我无法得到它们

'use strict';

var Wreck = require('wreck');

var url = 'http://www.google.it';

var callback = function(err, response, payload){
  Wreck.read(response, null, function(err, body){
      //here print out the html page
  });
};

Wreck.get(url, callback);
Run Code Online (Sandbox Code Playgroud)

上面是一个简单的脚本,只是开发人员自述文件的副本.根据文档body应该返回一个缓冲对象,但我怎样才能读取一个body对象?我已阅读使用toJSON或toString()但我没有得到任何结果

javascript node.js

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

在里面调用新线程是构造函数

创建一个线程并在类的构造函数中调用其start()方法是否正确?

public class Server implements Runnable {

    private ServerSocket server;

    public Server(int port) {
        try {
            //Opens a new server 
            server = new ServerSocket(port);
        } catch (IOException ioe) {
            ioe.printStackTrace();
        }

        new Thread(this, "Server").start();
    }

    @Override
    public void run() {
    }
}
Run Code Online (Sandbox Code Playgroud)

java multithreading

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

在jsp页面中调用以验证已记录用户是否处于角色中的权限是正确的

我正在寻找验证用户登录属于角色的功能.可能是以下几点?

pageContext.request.userPrincipal.roles 
Run Code Online (Sandbox Code Playgroud)

我应该如何与JSTL一起正确使用它来测试用户是否属于ADMIN组?

jsp jstl azure-web-roles

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

在续集中更新错误

这有什么错误?

Unhandled rejection SequelizeDatabaseError: ER_EMPTY_QUERY: Query was empty
    at Query.formatError (node_modules/sequelize/lib/dialects/mysql/query.js:159:14)
    at Query._callback (node_modules/sequelize/lib/dialects/mysql/query.js:35:21)
    at Query.Sequence.end (node_modules/mysql/lib/protocol/sequences/Sequence.js:96:24)
    at Query.ErrorPacket (node_modules/mysql/lib/protocol/sequences/Query.js:94:8)
    at Protocol._parsePacket (node_modules/mysql/lib/protocol/Protocol.js:274:23)
    at Parser.write (node_modules/mysql/lib/protocol/Parser.js:77:12)
    at Protocol.write (node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (node_modules/mysql/lib/Connection.js:96:28)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:538:20)
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用以下代码更新实体:

db.Account.update({
                    'post_id': data.id
                }, {
                  where: { id: account.id }
                })
                .spread(account => {

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

但它不起作用.任何的想法?

mysql sequelize.js

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

在jq中逃脱报价

我有以下两个bash行

TMPFILE="$(mktemp)" || exit 1

< package.json jq '. + {"foo":'"${BOO}"'}' > "$TMPFILE"
Run Code Online (Sandbox Code Playgroud)

但是我收到以下错误:

jq: error: syntax error, unexpected '}' (Unix shell quoting issues?) at <top-level>, line 1:
. + {"foo":}
jq: 1 compile error
Run Code Online (Sandbox Code Playgroud)

任何想法如何通过在那里使用双引号来使shellcheck错误静音来正确地逃避该部分

bash shell jq

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

带有 Click 库的 Python 3.6 中没有模块错误

我正在尝试使用包在 python 中构建 CLI click。我使用的 Python 版本是3.6

这是我的应用程序的主要内容:

import os
import click

cmd_folder = os.path.join(os.path.dirname(__file__), 'commands')


class IAMCLI(click.MultiCommand):

    def list_commands(self, ctx):
        rv = []
        for filename in os.listdir(cmd_folder):
            if filename.endswith('.py') and \
                    filename.startswith('cmd_'):
                rv.append(filename[4:-3])
        rv.sort()
        return rv

    def get_command(self, ctx, cmd_name):
        ns = {}
        fn = os.path.join(cmd_folder, 'cmd_{}.py'.format(cmd_name))
        with open(fn) as f:
            code = compile(f.read(), fn, 'exec')
            eval(code, ns, ns)
        return ns['cli']


@click.command(cls=IAMCLI)
@click.option('--env', default='dev', type=click.Choice(['dev', 'staging', 'production']),
              help='AWS Environment')
@click.pass_context
def cli():
    """AWS IAM roles and policies …
Run Code Online (Sandbox Code Playgroud)

python python-3.x

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

创建一个数组,其中每个位置都是枚举类型

嗨,我想创建一个数组,其中每个位置由枚举的值表示.

例如:

public enum type{

  green,blue,black,gray;

}
Run Code Online (Sandbox Code Playgroud)

现在我想创建一个阵列,其中每个位置都是绿色,蓝色,......

我会更清楚.我想创建一个数组,其中位置由enum class.instead int []数组表示.[=] int []创建int [] array = new int [type.value]

java arrays enums

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

将 Gson 添加到 pom.xml 但未找到

我已将gson添加到我的pom.xml。就这个。但是当我打电话Gson gson = new Gson()并尝试在 Maven 存储库中搜索时,它没有找到任何元素。为什么?我哪里错了?

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
    <artifactId>VolaConNoi_webapp</artifactId>
    <groupId>it.volaconnoi</groupId>
    <version>1.0-SNAPSHOT</version>
  </parent>

    <groupId>it.volaconnoi</groupId>
    <artifactId>VolaConNoi_webapp-ear</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>ear</packaging>

    <name>VolaConNoi_webapp-ear</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-ear-plugin</artifactId>
                <version>2.8</version>
                <configuration>
                    <version>6</version>
                    <defaultLibBundleDir>lib</defaultLibBundleDir>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>it.volaconnoi</groupId>
            <artifactId>VolaConNoi_webapp-ejb</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>ejb</type>
        </dependency>
        <dependency>
            <groupId>it.volaconnoi</groupId>
            <artifactId>VolaConNoi_webapp-web</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
        <!--  Gson: Java to Json conversion -->
        <dependency>
          <groupId>com.google.code.gson</groupId>
          <artifactId>gson</artifactId> …
Run Code Online (Sandbox Code Playgroud)

java xml maven gson

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

node_modules 的 kubernetes 卷

在 docker-compose 中,我用这种方式创建卷:

volumes:
  - ./server:/home/app
  - /home/app/node_modules
Run Code Online (Sandbox Code Playgroud)

为了解决 的问题node_modules

我该如何解决 kubernetes 中的问题?

我创建了以下配置

  spec:
    containers:
    - env: []
      image: "image"
      volumeMounts:
      - mountPath: /home/app
        name: vol-app
      - mountPath: /home/app/node_modules
        name: vol-node-modules
      name: demo
    volumes:
    - name: vol-app
      hostPath:
        path: /Users/me/server
    - name: vol-node-modules
      emptyDir: {}
Run Code Online (Sandbox Code Playgroud)

但它不起作用。节点模块为空

docker kubernetes docker-compose

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