小编Tin*_*iny的帖子

如何使用MySQL Workbench进行MySQL数据库备份?

如何使用MySQL Workbench进行数据库备份?我们可以通过以下方式进行备份 -

  1. 备份文件(.sql)包含Create Table语句和Insert into Table Statements
  2. 备份文件(.sql)仅包含Create Table Statements,而不包含所有表的Insert into Table语句
  3. 备份文件(.sql)仅包含"插入表语句",而不包含所有表的"创建表"语句

mysql database mysql-workbench database-backups

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

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

将InputStream读取为UTF-8

我试图text/plain通过互联网逐行读取文件.我现在的代码是:

URL url = new URL("http://kuehldesign.net/test.txt");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
LinkedList<String> lines = new LinkedList();
String readLine;

while ((readLine = in.readLine()) != null) {
    lines.add(readLine);
}

for (String line : lines) {
    out.println("> " + line);
}
Run Code Online (Sandbox Code Playgroud)

该文件test.txt包含¡Hélló!,我正在使用它来测试编码.

当我查看OutputStream(out)时,我将其视为> ¬°H?©ll??!.我不相信这是一个问题,OutputStream因为我可以out.println("é");没有问题.

阅读的任何想法都形成InputStreamUTF-8?谢谢!

java inputstream utf-8

94
推荐指数
3
解决办法
19万
查看次数

在请求参数'_csrf'或标题'X-CSRF-TOKEN'上找到无效的CSRF令牌'null'

配置Spring Security 3.2后,_csrf.token不会绑定请求或会话对象.

这是spring security配置:

<http pattern="/login.jsp" security="none"/>

<http>
    <intercept-url pattern="/**" access="ROLE_USER"/>
    <form-login login-page="/login.jsp"
                authentication-failure-url="/login.jsp?error=1"
                default-target-url="/index.jsp"/>
    <logout/>
    <csrf />
</http>

<authentication-manager>
    <authentication-provider>
        <user-service>
            <user name="test" password="test" authorities="ROLE_USER/>
        </user-service>
    </authentication-provider>
</authentication-manager>
Run Code Online (Sandbox Code Playgroud)

login.jsp文件

<form name="f" action="${contextPath}/j_spring_security_check" method="post" >
    <input type="hidden" name="${_csrf.parameterName}" value="${_csrf.token}" />
    <button id="ingresarButton"
            name="submit"
            type="submit"
            class="right"
            style="margin-right: 10px;">Ingresar</button>
    <span>
        <label for="usuario">Usuario :</label>
        <input type="text" name="j_username" id="u" class="" value=''/>
    </span>
    <span>
        <label for="clave">Contrase&ntilde;a :</label>

        <input type="password"
               name="j_password"
               id="p"
               class=""
               onfocus="vc_psfocus = 1;"
               value="">
    </span>
</form>
Run Code Online (Sandbox Code Playgroud)

它呈现下一个HTML:

<input type="hidden" name="" …
Run Code Online (Sandbox Code Playgroud)

spring csrf spring-security csrf-protection

88
推荐指数
7
解决办法
13万
查看次数

Java中的无限循环

while在Java中查看以下无限循环.它会导致它下面的语句出现编译时错误.

while(true) {
    System.out.println("inside while");
}

System.out.println("while terminated"); //Unreachable statement - compiler-error.
Run Code Online (Sandbox Code Playgroud)

以下相同的无限while循环,但工作正常,并不会发出任何错误,我只是用布尔变量替换条件.

boolean b=true;

while(b) {
    System.out.println("inside while");
}

System.out.println("while terminated"); //No error here.
Run Code Online (Sandbox Code Playgroud)

在第二种情况下,循环后的语句显然无法访问,因为布尔变量b为true,编译器根本不会抱怨.为什么?


编辑:下面的版本while陷入了无限循环,但是对于它下面的语句没有发出编译器错误,即使if循环中的条件总是false因此,循环也永远不会返回并且可以由编译器在编译时本身.

while(true) {

    if(false) {
        break;
    }

    System.out.println("inside while");
}

System.out.println("while terminated"); //No error here.
Run Code Online (Sandbox Code Playgroud)
while(true) {

    if(false)  { //if true then also
        return;  //Replacing return with break fixes the following error.
    }

    System.out.println("inside while");
}

System.out.println("while terminated"); //Compiler-error - unreachable statement. …
Run Code Online (Sandbox Code Playgroud)

java halting-problem

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

Oracle中的null vs空字符串

可能重复:
为什么Oracle 9i将空字符串视为NULL?

我在Oracle 10g中的表命名TEMP_TABLE,只有两列- iddescription只为示范的缘故.

该列id是序列生成的类型主键,NUMBER(35, 0) not nullDESCRIPTION是其类型VARCHAR2(4000) not null.

在这种情况下,基本的表结构如下所示.

+--------------+-----------+---------------+
|Name          | Null?     | Type          |
+--------------+-----------+---------------+
|ID            | NOT NULL  | NUMBER(35)    |
|DESCRIPTION   | NOT NULL  | VARCHAR2(4000)|
+--------------+-----------+---------------+
Run Code Online (Sandbox Code Playgroud)

创建此表后,我尝试INSERT交替插入以下命令.

INSERT INTO temp_table (id, description) VALUES (1, null); ->unsuccessful
INSERT INTO temp_table (id, description) VALUES (2, '');   ->unsuccessful
Run Code Online (Sandbox Code Playgroud)

它们都不成功,因为not nullDESCRIPTION列上强制执行约束.

在这两种情况下,Oracle都抱怨道

ORA-01400: cannot insert NULL …
Run Code Online (Sandbox Code Playgroud)

string oracle null oracle10g

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

为HTML表格行提供边框<tr>

是否可以<tr>一次性对表行进行边界处理,而不是为单个单元格设置边框,<td>例如,

<table cellpadding="0" cellspacing="0" width="100%" style="border: 1px;" rules="none">
    <tbody>
        <tr>
            <th style="width: 96px;">Column 1</th>
            <th style="width: 96px;">Column 2</th>
            <th style="width: 96px;">Column 3</th>
        </tr>

        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>

        <tr>
            <td style="border-left: thin solid; border-top: thin solid; border-bottom: thin solid;">&nbsp;</td>
            <td style="border-top: thin solid; border-bottom: thin solid;">&nbsp;</td>
            <td style="border-top: thin solid; border-bottom: thin solid; border-right: thin solid;">&nbsp;</td>
        </tr>

        <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
    </tbody>
</table>
Run Code Online (Sandbox Code Playgroud)

这给出了给定边界的边界,<tr>但它需要围绕单个单元格的边界.

我们可以<tr>一次性给一个边界吗?

→jsFiddle

html css html-table border

75
推荐指数
5
解决办法
23万
查看次数

Apache POI锁定标题行

有没有人熟悉在Apache POI 3.7创建的电子表格中锁定行的方法?通过锁定,我的意思是当用户滚动行时,我希望列的标题行保持可见.我创建的电子表格将有500行,如果列的名称始终可见,将会很有用.

java apache-poi

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

多个返回语句没有编译器错误

这是一个采访问题:

public class Demo {

    public static void main(String[] args) {
        System.out.println(foo());
    }

    static String foo() {
        try {
            return "try ...";
        } catch (Exception e) {
            return "catch ...";
        } finally {
            return "finally ..."; //got as result
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我的问题是为什么没有编译时错误.当我在finally块中有return语句时,它必然会从而finally不是trycatch块返回.我尝试使用-Xlint选项编译此代码,它会发出警告.

warning: [finally] finally clause cannot complete normally
Run Code Online (Sandbox Code Playgroud)

java compiler-errors return try-catch try-catch-finally

64
推荐指数
7
解决办法
3616
查看次数

从为CakePHP创建的现有MySQL数据库生成ER图

对于CakePHP应用程序,我创建了MySQL数据库.

用于创建数据库ER图的工具?表格之间的字段和关系以cakePHP喜欢的方式创建.

先感谢您!

mysql cakephp er-diagrams reverse-engineering mysql-workbench

59
推荐指数
3
解决办法
18万
查看次数