Git作为一种分布式的代码管理工具,在github上的代码管理都需要在本地配置对应的SSH key密钥,这样才能推送代码。

设置Git的username和email

1
2
$ git config --global user.name "YOUR USERNAME"
$ git config --global user.email "YOUR EMAIL"
Read more »

1. 第一个版本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import java.util.*;
import java.math.*;

//寻找阿姆斯特朗数
public class LookforNumber
{

public Scanner scanner = new Scanner(System.in);

public static void main(String[] args){
LookforNumber ln = new LookforNumber();
ln.number();
}

public void number(){//计算三位,四位,五位的阿姆斯特朗数
System.out.println("这是在求阿姆斯特朗数(n=3时,为水仙花数):");
System.out.println("请输入要求数的位数:");
int n = scanner.nextInt();
int a=0,b=0,c=0,d=0,e=0;
int x = (int)Math.pow(10,n-1);
int y = (int)Math.pow(10,n);
for(;x<y;x++){
for(int z=1;z<=n;z++){
switch(z){
case 1 : a = x/(int)Math.pow(10,n-z);break;
case 2 : b = x/(int)Math.pow(10,n-z)%10;break;
case 3 : c = x/(int)Math.pow(10,n-z)%10;break;
case 4 : d = x/(int)Math.pow(10,n-z)%10;break;
case 5 : e = x/(int)Math.pow(10,n-z)%10;break;
default : break;
}
}
if(x == (int)Math.pow(a,n)+(int)Math.pow(b,n)+(int)Math.pow(c,n)
+(int)Math.pow(d,n)+(int)Math.pow(e,n)){
System.out.print(x + " ");
}
}
System.out.println();
System.out.println("上述都是阿姆斯特朗数。");
}
}
Read more »

Hibernate

使用HibernateORM需要引入以下的包:

1
2
spring-boot-starter-data-jpa
mysql-connector-java

下面是Hibernate的详细配置信息:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#数据库使用的驱动类
hibernate.connection.driver_class=com.mysql.jdbc.Driver
#数据库连接地址
hibernate.connection.url=jdbc:mysql://localhost:3306/db
#数据库连接的用户名
hibernate.connection.username=user
#数据库连接的密码
hibernate.connection.password=password
#使用JNDI数据源连接数据库 -> 请看下一个JNDI配置
hibernate.connection.datasource=java:comp/env/jdbc/TestDb
#数据库使用的方言,将操作转为对应的SQL语句
hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
#是否打印SQL语句
hibernate.show_sql=true
javax.persistence.validation.mode=none
#在 log 和 console 中打印出更漂亮的 SQL语句
hibernate.format_sql=true
#设置在Hibernate数据库连接池中的连接数量,这里我们一般使用c3p0连接池
hibernate.connection.pool_size=3

Read more »

Relationship pattern and paradigm

11 关系模式与范式

11.1 关系模式的设计

数据库模式(Schema)是数据库中全体数据的逻辑结构和特征的描述,关系型数据库的模式又叫关系模式,我所理解的关系模式就是数据库中表结构的定义以及多张表之间的逻辑联系。

关系模式的设计就是根据一个具体的应用,把现实世界中的关系用表的形式来表示的逻辑设计过程,不规范的关系模式设计会带来以下的问题:

    1.数据冗余
    2.更新异常
    3.插入异常
    4.删除异常
Read more »

Welcome to Hexo! This is your very first post. Check documentation for more info. If you get any problems when using Hexo, you can find the answer in troubleshooting or you can ask me on GitHub.

Quick Start

Create a new post

1
$ hexo new "My New Post"

More info: Writing

Run server

1
$ hexo server

More info: Server

Generate static files

1
$ hexo generate

More info: Generating

Deploy to remote sites

1
$ hexo deploy

More info: Deployment