小编sko*_*ine的帖子

java sql空字段

嗨,我正在尝试执行查询

Statement stmt = conn.createStatement();
stmt.executeUpdate(location_query);
Run Code Online (Sandbox Code Playgroud)

location_query是

insert into table(col, col2) value("2", "");
Run Code Online (Sandbox Code Playgroud)

col和col2都是双(12,2)类型,我得到错误 Data truncated for column 'col2' at row 1,但如果我打印我的查询并复制,并将其粘贴到PMA(PhpMyAdmin),它是正确的.

我猜测它的col2的值是空的,但有没有机会以其他方式解决这个问题,而不是检查我试图放入查询的所有变量?

java sql

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

RXTX如何从com端口读取

嗨,我有这样的事情

package compot;

import java.util.Enumeration;
import gnu.io.*;


public class core {

    private static SerialPort p;

    /**
     * @param args
     */
    public static void main(String[] args) 
    {
        Enumeration ports = CommPortIdentifier.getPortIdentifiers();
        System.out.println("start");
        while(ports.hasMoreElements())
        {
            CommPortIdentifier port = (CommPortIdentifier) ports.nextElement();
            System.out.print(port.getName() + " -> " + port.getCurrentOwner() + " -> ");
            switch(port.getPortType())
            {
                case CommPortIdentifier.PORT_PARALLEL:
                    System.out.println("parell");
                break;
                case CommPortIdentifier.PORT_SERIAL:
                    //System.out.println("serial");
                try {
                    p = (SerialPort) port.open("core", 1000);
                    int baudRate = 57600; // 57600bps
                    p.setSerialPortParams(
                            baudRate,
                            SerialPort.DATABITS_8,
                            SerialPort.STOPBITS_1,
                            SerialPort.PARITY_NONE);
                } catch (PortInUseException e) …
Run Code Online (Sandbox Code Playgroud)

java rxtx

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

javascript日期不同天数等于毫秒

http://jsfiddle.net/skowron_line/zPCBc/1/

var d1 = '31.05.2012';
var d2 = '01.06.2012';

var s1 = d1.split('.');
var s2 = d2.split('.');

var nd1 = new Date(s1[2], s1[1], s1[0]);
var nd2 = new Date(s2[2], s2[1], s2[0]);

$('#a').html(s1 + ' - '+ s2 +' = '+ nd2.getTime() +' - '+ nd1.getTime());

$('#b').html(
nd1.getFullYear() +'-'+ nd1.getMonth() +'-'+ nd1.getDate() +'<br />'+ nd2.getFullYear() +'-'+ nd2.getMonth() +'-'+ nd2.getDate()
);
Run Code Online (Sandbox Code Playgroud)

有人可以解释我的代码有什么问题吗?为什么31.05.2012我等于01.06.2012

javascript

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

Symfony2以树枝形式主题更改类名

我想覆盖form_widget_simple功能

{% block form_widget_simple %}
{% spaceless %}
    {% set type = type|default('text') %}
    {% if errors|length > 0 %}
        {{dump(form.vars.attr)}}
    {% endif %}
    <input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
{% endspaceless %}
{% endblock form_widget_simple %}
Run Code Online (Sandbox Code Playgroud)

但我不知道如何设置form.vars.attr['class']内部if声明当我这样做set form.vars.attr['class'] = 'error';我得到错误Unexpected token "punctuation" of value "." ("end of statement block" expected)

symfony twig

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

标签 统计

java ×2

javascript ×1

rxtx ×1

sql ×1

symfony ×1

twig ×1