win7计算器左移、右移操作

  1. 如何找到Win7自带的计算器?
  2. win键+R,运行“calc” 就能打开计算器了。(或者从“所有程序”-〉“附件”中找到)
  3. 标准型计算器

    这是我们*常用的标准型计算器,这个没什么好说,加减乘除,开方倒数,让我们来看看一下计算器上的几个功能键:

    CE:表示的意思是ClearError(清除当前的错误输入,你就当是一个退格键就行了);
    C:表示的意思是Clear(清楚整个计算结果,重新归零)。
    MC/MR/MS/M+/M-:M表示Memory,是指一个中间数据缓存器,
    MC=Memory Clear,
    MR=Memory Read,
    MS=Memory Save,
    M+=Memory Add,
    M-=Memory Minus

    MC/MR/MS/M+/M-主要是用过计算复杂的运算公式,我们平常用处不大,举例来说明一下:(7-2) * (8-2)=?
    先输入7,按MS保存,输入2,按M-与缓存器中的7相减,此时缓存器中的值为5;然后计算8-2,得出结果为6,输入*相乘,按MR读出之前保存的数5,按=得出结果30,算完后按MC清除缓存器。(这样用是不是挺麻烦……)

    计算好帮手:功能强大的Win7计算器

  4. 各种计算功能的计算器

    计算好帮手:功能强大的Win7计算器

  5.  

    计算好帮手:功能强大的Win7计算器

  6. 科学型计算器

    标准型计算器的扩展,主要是添加了一些常用的数学函数的计算:
    取整(Int),圆周率(Pi),取模(Mod),函数如度分秒(dms),科学计数法(F-E),科学计数法输入(Exp)
    三角函数:正弦、双曲正弦,按Inv可以计算其反函数反正弦、反双曲正弦、对于余弦、还有正切,这样就有12个函数。
    代数函数:阶乘(n!)、指数函数(10x)、幂函数(x2, x3, x1/3, xy, x1/y)、对数函数(In, log)

    计算好帮手:功能强大的Win7计算器

  7. 程序员型

    2、8、10、16进制计算,字节计算,还有:

    And, Or, Not, Xor: *基本的与或非和异或操作
    Lsh, Rsh:全称是Left Shift和Right Shift,也就是左移和右移操作,你需要输入你要移动的位数(不能大于*大位数)
    RoL, RoR:全称是Rotate Left和Rotate Right,对于RoL来讲,就是向左移动一位,并将移出的那位补到*右边那位上,RoR类似。

    计算好帮手:功能强大的Win7计算器

  8. 统计型

    统计模式的计算:

    计算好帮手:功能强大的Win7计算器

    计算好帮手:功能强大的Win7计算器

  9. 各种附加功能的计算:单位转换、日期计算、抵押(贷款)计算、汽车租赁、油耗

    计算好帮手:功能强大的Win7计算器

    计算好帮手:功能强大的Win7计算器

    计算好帮手:功能强大的Win7计算器

    计算好帮手:功能强大的Win7计算器

  10. 好用的历史记录功能(请先通过“查看”,打开“历史记录”快捷键ctrl+H)

    计算好帮手:功能强大的Win7计算器

  11. win7计算器常用快捷键

    Atl+1 切换到标准模式
    Alt+2 切换到科学型模式
    Alt+3 切换到程序员模式
    Alt+4 切换到统计信息模式
    Ctrl+E 打开日期计算
    Ctrl+H 将计算历史记录打开或关闭
    Ctrl+U 打开单位转换
    Alt+C 计算或解决日期计算和工作表
    F1 打开“计算器”帮助

linux联机游戏服务器,linux游戏服务器搭建

服务器: CentOS6.3 x86-64 数据库:MySQL-server-5.5.25a-1.sles11.x86_64 cmake:cmake-2.8.4.tar …. CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程) 一、安装cmake编辑器。 (1)解压cmake. #tar -zvxf cmake-2.8.4.t

服务器:CentOS6.3 x86-64

数据库:MySQL-server-5.5.25a-1.sles11.x86_64

cmake:cmake-2.8.4.tar ….CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程)

一、安装cmake编辑器。

(1)解压cmake.  #tar -zvxf cmake-2.8.4.tar.gz

(2)配置编译。

#cd cmake-2.8.4

#yum -y install gcc

#yum -y install gcc-c++

#yum -y install ncurses-devel

#./configure

#make

#make install

当我#make时候提示无效命令。yum

install make,安装之后再 ./configure,然后是各种执行过程。执行完之后,再 make这次有反应了,继续等待执行。然后是 make install ,再次等待执行。这次估计都成功了。下面开始安装mysql.

二、安装Mysql。

千辛万苦再CSDN上面下载了两个rpm的安装文件,但是安装不成功,

aaa_base

is needed by MySQL-server-5.5.25a-1.sles11.x86_64

pwdutils

is needed by MySQL-server-5.5.25a-1.sles11.x86_64

/usr/bin/perl

is needed by MySQL-server-5.5.25a-1.sles11.x86_64

(1)tar版的安装。摘抄的命令

#mkdir /usr/local/mysql

#mkdir /usr/local/mysql/data

#cd /usr/local/src/mysql-5.5.27

#cmake . \

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \

-DINSTALL_DATADIR=/usr/local/mysql/data \

-DDEFAULT_CHARSET=utf8 \

-DDEFAULT_COLLATION=utf8_general_ci \

-DEXTRA_CHARSETS=all \

-DENABLED_LOCAL_INFILE=1

参数说明:

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql        //安装目录

-DINSTALL_DATADIR=/usr/local/mysql/data //数据库存放目录

-DDEFAULT_CHARSET=utf8                        //使用utf8字符

-DDEFAULT_COLLATION=utf8_general_ci            //校验字符

-DEXTRA_CHARSETS=all                            //安装所有扩展字符集

-DENABLED_LOCAL_INFILE=1                        //允许从本地导入数据

#make

#make install

(2)设置目录权限。

# cd /usr/local/mysql

# chown -R root:mysql . //把当前目录中所有文件的所有者所有者设为root,所属组为mysql

# chown -R mysql:mysql data

(3)配置文件。

# cp support-files/my-medium.cnf /etc/my.cnf //这个配置仅适合小内存系统(32M – 64M)

打开如下注释:

innodb_data_home_dir = /usr/local/mysql/data

innodb_data_file_path = ibdata1:10M:autoextend

innodb_log_group_home_dir = /usr/local/mysql/data

innodb_buffer_pool_size = 16M

innodb_additional_mem_pool_size = 2M

innodb_log_file_size = 5M

innodb_log_buffer_size = 8M

innodb_flush_log_at_trx_commit = 1

innodb_lock_wait_timeout = 50

添加默认字符集:

[client]

default-character-set = utf8    // 添加编码支持

[mysqld]

default-character-set = utf8   // 添加编码支持

max_connections = 10000     //根据服务器性能调节

basedir = /usr/local/mysql //设置安装目录,这样在系统启动时才能正确运行到/etc/rc.d/init.d/mysql start

6)、创建系统数据库的表

# cd /usr/local/mysql

#

scripts/mysql_install_db –user=mysql

7)、设置权限启动

设置环境变量:

# vi /root/.bash_profile

在PATH=$PATH:$HOME/bin添加参数为:

PATH=$PATH:$HOME/bin:/usr/local/mysql/bin:/usr/local/mysql/lib

#source /root/.bash_profile

手动启动MySQL:

# cd /usr/local/mysql

# ./bin/mysqld_safe –user=mysql &   //启动MySQL,但不能停止

启动日志写在此文件下:/usr/local/mysql/data/localhost.err

关闭MySQL服务

# mysqladmin -u root -p shutdown  //这里MySQL的root用户还没有配置密码,所以为空值。

通过脚本启动MySQL:

# ln -s /usr/local/mysql/support-files/mysql.server /usr/local/mysql

//必须注意,是放在mysql目录下,不是bin目录下

# cp /usr/local/mysql/support-files/mysql.server /usr/local/mysql

# mysql.server start //启动mysql

# mysql.server stop //停止mysql

在引导时启动MySQL :

# ln -s /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysql

# ln -s /usr/local/mysql/mysql.server /etc/rc.d/init.d/mysql

# cd /etc/rc.d/init.d

# chkconfig –add mysql       //配置是否自动启动, chkconfig –del mysql 可删除

# chmod +x /etc/rc.d/init.d/mysql    //添加如执行权限

三、给mysql配置权限。

测试时候直接用的root用户来连接的服务器,结果连接不上,解决之后才想到,为什么要让root用户连接服务器啊。悲催的再改回去,中间还有,貌似root用户不用输入密码就能访问。赶紧去掉root用户直接访问权限。

vi /etc/sysconfig/iptables,在系统配置里面去掉了下面这段,本来是我添加的。

-A RH-Firewall-1-INPUT -p tcp –dport 3306 -j ACCEPT

重启service

iptables restart。 OK,root只能本地连接数据库了。

附上允许root远程访问的方法。http://blog.csdn.net/sctq8888/article/details/7446906

这篇文章很详细。

其实我用的只有这两步

。http://blog.csdn.net/learnhard/article/details/5104330

1)下面给mysql新建一个账号:insert into mysql.user(host,user,password) value (‘%’,’name’,PASSWORD(‘password’));

2)更新密码

mysql>update user set password=password(‘jason’) where user=’jason’

3)授予权限

mysql>grant all on neuzjs.* to jason@’%’ identified by ‘jason’;其中neuzjs为数据库名;

4)刷新权限

mysql>flush previleges; 貌似不能用这个命令,大家查查别的,我直接工具刷新了。

例1、增加一个用户user001密码为123456,让他可以在任何主机上登录,并对所有数据库有查询、插入、修改、删除的权限。首先用以root用户连入MySQL,然后键入以下命令:

mysql> grant select,insert,update,delete on *.* to user001@”%” Identified by “123456”;

例2、增加一个用户user002密码为123456,让此用户只可以在localhost上登录,也可以设置指定IP,并可以对数据库test进行查询、插入、修改、删除的操作 (localhost指本地主机,即MySQL数据库所在的那台主机)

//这样用户即使用知道user_2的密码,他也无法从网上直接访问数据库,只能通过MYSQL主机来操作test库。

//首先用以root用户连入MySQL,然后键入以下命令:

mysql>grant select,insert,update,delete on test.* to user002@localhost identified by “123456”;这两个命令很好用,收藏下。

CSS选取第n个标签元素

 

1、first-child

first-child表示选择列表中的*个标签。例如:li:first-child{background:#fff}

2、last-child

last-child表示选择列表中的*后一个标签,例如:li:last-child{background:#fff}

3、nth-child(3)

表示选择列表中的第3个标签,例如:li:nth-child(3){background:#fff},代码中的3也可以改成其它数字,如4、5等。想选择第几个标签,就填写几。

4、nth-child(2n) 

这个表示选择列表中的偶数标签,即选择 第2、第4、第6…… 标签,例如:li:nth-child(2n){background:#fff}

5、nth-child(2n-1)

这个表示选择列表中的奇数标签,即选择 第1、第3、第5、第7……标签,例如:li:nth-child(2n-1){background:#fff}

6、nth-child(n+3)

这个表示选择列表中的标签从第3个开始到*后。

7、nth-child(-n+3)

这个表示选择列表中的标签从0到3,即小于3的标签。

8、nth-last-child(3)

这个表示选择列表中的倒数第3个标签。

Minecraft多人联机服务器配置

事前准备
1个Minecraft服务器
一台好电脑(系统无所谓,我这里用Windows)
一个敢于折腾的心
开始配置
解压之前下载的服务器,至于解压到哪随便你只要懂得变通就行.
我的世界官方服务器有配置教程
打开eula.txt更改eula=false为eula=true表示你同意EULA
在当前目录下打开终端输入java -Xincgc -Xmx1G -jar 核心文件名.jar官方服务器可以加nogui来关闭图形界面节省性能(显着减少内存和CPU资源占用)
在终端不在跑码时输入stop关闭服务器.如果是第三方服务器要等插件加载完毕,判断方法是在终端输入?看看会不会打印帮助,会就表示开启成功
在服务器关闭后打开server.properties文件我们需要修改以下字符=后的内容
server-name=Unknown Server #服务器名称,中文需要转换编码
gamemode=0 #默认游戏模式0生存、1创造、2冒险、3旁观者(1.8后)
difficulty=1 #默认游戏难度0和平、1简单、2普通、3困难
pvp=true #允许玩家vs玩家(玩家间伤害),关闭改成false
enable-command-block=true #开启命令方块
server-ip=127.0.0.1 #服务器IP,填局域网地址
server-port=25565 #服务器端口,默认25565
level-name=world #世界名称
online-mode=false #正版验证,默认为true,开启后盗版不能登陆服务器
max-players=100 #*大玩家数量,默认20
max-build-height=256 #*大建筑高度
level-seed= #地图种子,默认为空
motd=A Minecraft Server #服务器描述,中文要编码

到这里基础配置完成

进阶配置
官方服务器加Forgemod加载器
下载Forge服务器版直接选择服务器根目录安装就行
mod要服务器版,丢到mode文件夹就行

Tomcat服务器架构

一、Tomcat顶层架构

先上一张Tomcat的顶层结构图(图A),如下:

了解Tomcat服务器架构这四张图就够了,让面试官颤抖吧

 

Tomcat中*顶层的容器是Server,代表着整个服务器,从上图中可以看出,一个Server可以包含至少一个Service,用于具体提供服务。

Service主要包含两个部分:Connector和Container。从上图中可以看出 Tomcat 的心脏就是这两个组件,他们的作用如下:

1、Connector用于处理连接相关的事情,并提供Socket与Request和Response相关的转化;

2、Container用于封装和管理Servlet,以及具体处理Request请求;

一个Tomcat中只有一个Server,一个Server可以包含多个Service,一个Service只有一个Container,但是可以有多个Connectors,这是因为一个服务可以有多个连接,如同时提供Http和Https链接,也可以提供向相同协议不同端口的连接,示意图如下(Engine、Host、Context下边会说到):

了解Tomcat服务器架构这四张图就够了,让面试官颤抖吧

 

多个 Connector 和一个 Container 就形成了一个 Service,有了 Service 就可以对外提供服务了,但是 Service 还要一个生存的环境,必须要有人能够给她生命、掌握其生死大权,那就非 Server 莫属了!所以整个 Tomcat 的生命周期由 Server 控制。

另外,上述的包含关系或者说是父子关系,都可以在tomcat的conf目录下的server.xml配置文件中看出,下图是删除了注释内容之后的一个完整的server.xml配置文件(Tomcat版本为8.0)

了解Tomcat服务器架构这四张图就够了,让面试官颤抖吧

 

详细的配置文件文件内容可以到Tomcat官网查看:http://tomcat.apache.org/tomcat-8.0-doc/index.html

上边的配置文件,还可以通过下边的一张结构图更清楚的理解:

了解Tomcat服务器架构这四张图就够了,让面试官颤抖吧

 

Server标签设置的端口号为8005,shutdown=”SHUTDOWN” ,表示在8005端口监听“SHUTDOWN”命令,如果接收到了就会关闭Tomcat。一个Server有一个Service,当然还可以进行配置,一个Service有多个,Service左边的内容都属于Container的,Service下边是Connector。

二、Tomcat顶层架构小结:

(1)Tomcat中只有一个Server,一个Server可以有多个Service,一个Service可以有多个Connector和一个Container;

(2) Server掌管着整个Tomcat的生死大权;

(4)Service 是对外提供服务的;

(5)Connector用于接受请求并将请求封装成Request和Response来具体处理;

(6)Container用于封装和管理Servlet,以及具体处理request请求;

知道了整个Tomcat顶层的分层架构和各个组件之间的关系以及作用,对于*大多数的开发人员来说Server和Service对我们来说确实很远,而我们开发中*大部分进行配置的内容是属于Connector和Container的,所以接下来介绍一下Connector和Container。

三、Connector和Container的微妙关系

由上述内容我们大致可以知道一个请求发送到Tomcat之后,首先经过Service然后会交给我们的Connector,Connector用于接收请求并将接收的请求封装为Request和Response来具体处理,Request和Response封装完之后再交由Container进行处理,Container处理完请求之后再返回给Connector,*后在由Connector通过Socket将处理的结果返回给客户端,这样整个请求的就处理完了!

Connector*底层使用的是Socket来进行连接的,Request和Response是按照HTTP协议来封装的,所以Connector同时需要实现TCP/IP协议和HTTP协议!

Tomcat既然处理请求,那么肯定需要先接收到这个请求,接收请求这个东西我们首先就需要看一下Connector!

四、Connector架构分析

Connector用于接受请求并将请求封装成Request和Response,然后交给Container进行处理,Container处理完之后在交给Connector返回给客户端。

因此,我们可以把Connector分为四个方面进行理解:

(1)Connector如何接受请求的?

(2)如何将请求封装成Request和Response的?

(3)封装完之后的Request和Response如何交给Container进行处理的?

(4)Container处理完之后如何交给Connector并返回给客户端的?

首先看一下Connector的结构图(图B),如下所示:

了解Tomcat服务器架构这四张图就够了,让面试官颤抖吧

 

Connector就是使用ProtocolHandler来处理请求的,不同的ProtocolHandler代表不同的连接类型,比如:Http11Protocol使用的是普通Socket来连接的,Http11NioProtocol使用的是NioSocket来连接的。

其中ProtocolHandler由包含了三个部件:Endpoint、Processor、Adapter。

(1)Endpoint用来处理底层Socket的网络连接,Processor用于将Endpoint接收到的Socket封装成Request,Adapter用于将Request交给Container进行具体的处理。

(2)Endpoint由于是处理底层的Socket网络连接,因此Endpoint是用来实现TCP/IP协议的,而Processor用来实现HTTP协议的,Adapter将请求适配到Servlet容器进行具体的处理。

(3)Endpoint的抽象实现AbstractEndpoint里面定义的Acceptor和AsyncTimeout两个内部类和一个Handler接口。Acceptor用于监听请求,AsyncTimeout用于检查异步Request的超时,Handler用于处理接收到的Socket,在内部调用Processor进行处理。

至此,我们应该很轻松的回答(1)(2)(3)的问题了,但是(4)还是不知道,那么我们就来看一下Container是如何进行处理的以及处理完之后是如何将处理完的结果返回给Connector的?

五、Container架构分析

Container用于封装和管理Servlet,以及具体处理Request请求,在Connector内部包含了4个子容器,结构图如下(图C):

了解Tomcat服务器架构这四张图就够了,让面试官颤抖吧

 

4个子容器的作用分别是:

(1)Engine:引擎,用来管理多个站点,一个Service*多只能有一个Engine;

(2)Host:代表一个站点,也可以叫虚拟主机,通过配置Host就可以添加站点;

(3)Context:代表一个应用程序,对应着平时开发的一套程序,或者一个WEB-INF目录以及下面的web.xml文件;

(4)Wrapper:每一Wrapper封装着一个Servlet;

下面找一个Tomcat的文件目录对照一下,如下图所示:

了解Tomcat服务器架构这四张图就够了,让面试官颤抖吧

 

Context和Host的区别是Context表示一个应用,我们的Tomcat中默认的配置下webapps下的每一个文件夹目录都是一个Context,其中ROOT目录中存放着主应用,其他目录存放着子应用,而整个webapps就是一个Host站点。

我们访问应用Context的时候,如果是ROOT下的则直接使用域名就可以访问,例如:www.ledouit.com,如果是Host(webapps)下的其他应用,则可以使用www.ledouit.com/docs进行访问,当然默认指定的根应用(ROOT)是可以进行设定的,只不过Host站点下默认的主营用是ROOT目录下的。

看到这里我们知道Container是什么,但是还是不知道Container是如何进行处理的以及处理完之后是如何将处理完的结果返回给Connector的?别急!下边就开始探讨一下Container是如何进行处理的!

六、Container如何处理请求的

Container处理请求是使用Pipeline-Valve管道来处理的!(Valve是阀门之意)

Pipeline-Valve是责任链模式,责任链模式是指在一个请求处理的过程中有很多处理者依次对请求进行处理,每个处理者负责做自己相应的处理,处理完之后将处理后的请求返回,再让下一个处理着继续处理。

了解Tomcat服务器架构这四张图就够了,让面试官颤抖吧

 

但是!Pipeline-Valve使用的责任链模式和普通的责任链模式有些不同!区别主要有以下两点:

(1)每个Pipeline都有特定的Valve,而且是在管道的*后一个执行,这个Valve叫做BaseValve,BaseValve是不可删除的;

(2)在上层容器的管道的BaseValve中会调用下层容器的管道。

我们知道Container包含四个子容器,而这四个子容器对应的BaseValve分别在:StandardEngineValve、StandardHostValve、StandardContextValve、StandardWrapperValve。

Pipeline的处理流程图如下(图D):

了解Tomcat服务器架构这四张图就够了,让面试官颤抖吧

 

(1)Connector在接收到请求后会首先调用*顶层容器的Pipeline来处理,这里的*顶层容器的Pipeline就是EnginePipeline(Engine的管道);

(2)在Engine的管道中依次会执行EngineValve1、EngineValve2等等,*后会执行StandardEngineValve,在StandardEngineValve中会调用Host管道,然后再依次执行Host的HostValve1、HostValve2等,*后在执行StandardHostValve,然后再依次调用Context的管道和Wrapper的管道,*后执行到StandardWrapperValve。

(3)当执行到StandardWrapperValve的时候,会在StandardWrapperValve中创建FilterChain,并调用其doFilter方法来处理请求,这个FilterChain包含着我们配置的与请求相匹配的Filter和Servlet,其doFilter方法会依次调用所有的Filter的doFilter方法和Servlet的service方法,这样请求就得到了处理!

(4)当所有的Pipeline-Valve都执行完之后,并且处理完了具体的请求,这个时候就可以将返回的结果交给Connector了,Connector在通过Socket的方式将结果返回给客户端。

总结

至此,我们已经对Tomcat的整体架构有了大致的了解,从图A、B、C、D可以看出来每一个组件的基本要素和作用。我们在脑海里应该有一个大概的轮廓了!

 

Minecraft服务器设置

1.MineCraft伺服器到底有分成啥米?
MC伺服器目前有2種 MineCraft官方版本 以及 CraftBukkit
都屬於官方認可形式

1.1那這兩版的差別在哪捏?
*大的差別 就是界面 以及後續補丁相關 會有所不同
官方伺服器比較人性化 可使用ModloaderMP模組補丁
CraftBukkit就都是編碼 可使用Plugin相關插件
目前屬後者比較多人使用 原因是因為有團隊在CraftBukkit上開發ModloaderMP 不過進度較慢
1.1.1等一下!!啥事ModLoaderMP?啥又是Plugin
後續會說明 現在暫時不討論
只要知道這兩個能讓遊戲更豐富就好XD

2.MineCraft伺服器要如何安裝?如何啟動?
基本上只要把執行檔放到你要安裝的地方 然後啟動就好
官方伺服器有 exe檔 以及 jar檔 前者直接執行就好 後者需要程式碼啟動
CraftBukkit伺服器 只有 Jar檔 可以使用 需要透過程式碼啟動

2.1那我幹嘛用後面的?為何不用exe檔就好?
因為如果使用exe檔 無法安裝插件 而且不能控制Ram的使用大小
(其實可以只是程式碼會比較複雜)

2.2那程式碼怎麼打?
以下是程式碼

“%ProgramFiles%\Java\jre6\bin\java.exe” -Xmx1024M -Xms1024M -jar minecraft_server.jar
‘      這段是Java的啟動路徑 通常不變     ‘   ‘伺服器能使用的Ram量’    ‘MineCraft伺服器檔名’

在其中*重要的是Ram使用量 越大 伺服器就越穩 效能也吃越大 我習慣上使用2048M 也就是2G的Ram給伺服器使用

2.3那我要怎麼寫?怎麼啟動?
先將上面那一列複製到記事本 然後存檔名txt改成bat 在將檔案放到伺服器的資料夾下即可

3.我剛剛啟動了伺服器 出現了一堆字 還有一堆WARNING 還多了一堆檔案 到底是啥意思 = =?
像這樣吧

%title插图%num

俺來說明給你聽XD
182 recipes
((182個物件拼湊圖
27 achievements
((27個成就
[INFO]Starting minecraft server version 1.2.5
[資訊]啟動 MC伺服器 版本1.2.5
[INFO]Loading properties
[資訊]讀取伺服器設定檔
[WARNING]server.properties does not exist
[警告]伺服器設定檔不存在
[INFO]Generating new properties file
[資訊]建立新的設定檔
[INFO]Starting minecraft server on *.25565
[資訊]啟動 MC伺服器 在 *.25565 (*指自己預設伺服器IP 如果本機登錄 其實只要輸入localhost就好)
[WARNING]Failed to load ban list: java.io.FileNotFoundException: banned-players.txt
[警告]無法讀取禁止名單 : java.io.FileNotFoundException: banned-players.txt
[WARNING]Failed to load ip ban list: java.io.FileNotFoundException: banned-ips.txt
[警告]無法讀取IP禁止名單 : java.io.FileNotFoundException: banned-ips.txt
[WARNING]Failed to load operators list: java.io.FileNotFoundException: ops.txt
[警告]無法讀取管理員名單 : java.io.FileNotFoundException: ops.txt
[WARNING]Failed to load white-list: java.io.FileNotFoundException: white-list.txt
[警告]無法讀取白名單 : java.io.FileNotFoundException: white-list.txt
(這時候系統就會自己建立這些檔案)
[INFO]Preparing level “world”
[資訊]準備建立”世界”
(這時候會多出一個檔名為World的資料夾)
[INFO]Default game type: 0
[資訊]預設遊戲模式 :0 ((0為生存 1為創造
[INFO]Preparing spawn area: 16%
[資訊]準備種子地圖區域 :16%
[INFO]Preparing spawn area: 36%
[資訊]準備種子地圖區域 :36%
[INFO]Preparing spawn area: 61%
[資訊]準備種子地圖區域 :61%
[INFO]Preparing spawn area: 81%
[資訊]準備種子地圖區域 :81%
(速度取決於電腦能力)
[INFO]Done <4.990s>! For help, type “help” or “?”
[資訊]完成 <4.99秒>! 需要任何幫助,輸入 help 或是 ?

到這裡伺服器就開始運作拉XD

而資料夾應該裡面會有這些檔案

%title插图%num

如果是CraftBukkit伺服器的話 裡面會多出plugin資料夾
以及world_netherworld_the_end資料夾
plugin 是插件相關的資料夾
剩下兩個world的 是存檔 CraftBukkit存檔方式和官方伺服器有點差距
不過官方的移到CraftBukkit下可以直接讀取 反之…可能地獄和終界會有點差別.0.0

3.1那我啟動了伺服器之後 需要設定檔案嗎?
需要 首先
設定管理員 通常是身為架設者的你 或是某某人 將他的ID輸入到ops.txt裡即可 裡面以空格區分
再來 打開Server.properties 可以使用記事本打開

裡面的資料如下
#Minecraft server properties
MC伺服器設定檔
#Sun Apr 15 14:26:01 CST 2012
在星期日 4/45 下午2:26 01秒 西元2012年
allow-nether=true
是否啟動地獄及終界=是
(如果關閉地獄和終界 在當地人的會遇到停擺的世界 並且無法透過重送門回來)
level-name=world
地圖名稱=world
enable-query=false
啟動遠端game spy查詢=不是
allow-flight=false
啟動飛行模式=不是
server-port=25565
系統port=25565
level-type=DEFAULT
地圖模式=預設(平地/預設)
enable-rcon=false
啟動遠端操控=不是
level-seed=
地圖種子(通常是空白)
server-ip=
(伺服器IP 空白就是現在的IP)
max-build-height=256
*大高度限制=256格
spawn-npcs=true
製造NPC=是
white-list=false
白名單=不是(不啟動)
spawn-animals=true
製造家畜=是
online-mode=true
正版认证=是
pvp=true
Players vs players=是
difficulty=1
難度=1(1~3)
gamemode=0
遊戲模式=0(0=生存 1=創造)
max-players=20
*多玩家人數=20
spawn-monsters=true
製造怪物=是
generate-structures=true
生成天然建築=是
view-distance=10
*大讀取視野=10
motd=A Minecraft Server
伺服器名稱=Minecraft Server

maven settings.xml国内仓库配置

<?xml version=”1.0″ encoding=”UTF-8″?>
<settings xmlns=”http://maven.apache.org/SETTINGS/1.0.0″
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd”>

<pluginGroups />
<proxies />
<servers />

<localRepository>D:/ProgrammeJar/maven-jar</localRepository>

<mirrors>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>http://repo1.maven.org/maven2/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>ibiblio</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://mirrors.ibiblio.org/pub/mirrors/maven2/</url>
</mirror>
<mirror>
<id>jboss-public-repository-group</id>
<mirrorOf>central</mirrorOf>
<name>JBoss Public Repository Group</name>
<url>http://repository.jboss.org/nexus/content/groups/public</url>
</mirror>
<mirror>
<id>google-maven-central</id>
<name>Google Maven Central</name>
<url>https://maven-central.storage.googleapis.com
</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!– 中央仓库在中国的镜像 –>
<mirror>
<id>maven.net.cn</id>
<name>oneof the central mirrors in china</name>
<url>http://maven.net.cn/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>

</settings>

maven 配置篇 之 settings.xml

maven2 比起maven1 来说,需要配置的文件少多了,主要集中在pom.xml和settings.xml中。
先来说说settings.xml,settings.xml对于maven来说相当于全局性的配置,用于所有的项目。在maven2中存在两个settings.xml,一个位于maven2的安装目录conf下面,作为全局性配置。对于团队设置,保持一致的定义是关键,所以maven2/conf下面的settings.xml就作为团队共同的配置文件。保证所有的团队成员都拥有相同的配置。当然对于每个成员,都需要特殊的自定义设置,如用户信息,所以另外一个settings.xml就作为本地配置。默认的位置为:${user.dir}/.m2/settings.xml目录中(${user.dir} 指windows 中的用户目录)。
settings.xml基本结构如下:
<settings 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/settings-1.0.0.xsd”>
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<mirrors/>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>
简单介绍一下几个主要的配置因素:
localRepository:表示本地库的保存位置,也就是maven2主要的jar保存位置,默认在${user.dir}/.m2/repository,如果需要另外设置,就换成其他的路径。
offline:如果不想每次编译,都去查找远程中心库,那就设置为true。当然前提是你已经下载了必须的依赖包。
Servers
在POM中的 distributionManagement元素定义了开发库。然而,特定的username和pwd不能使用于pom.xml,所以通过此配置来保存server信息
<servers>
<server>
<id>server001</id>
<username>my_login</username>
<password>my_password</password>
<privateKey>${usr.home}/.ssh/id_dsa</privateKey>
<passphrase>some_passphrase</passphrase>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
<configuration></configuration>
</server>
</servers>

  • id:server 的id,用于匹配distributionManagement库id,比较重要。
  • username, password:用于登陆此服务器的用户名和密码
  • privateKey, passphrase:设置private key,以及passphrase
  • filePermissions, directoryPermissions:当库文件或者目录创建后,需要使用权限进行访问。参照unix文件许可,如664和775

Mirrors
表示镜像库,指定库的镜像,用于增加其他库
<mirrors>
<mirror>
<id>planetmirror.com</id>
<name>PlanetMirror Australia</name>
<url>http://downloads.planetmirror.com/pub/maven2</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>

  • id,name:唯一的标志,用于区别镜像
  • url:镜像的url
  • mirrorOf:此镜像指向的服务id

Proxies
此设置,主要用于无法直接访问中心的库用户配置。
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>8080</port>
<username>proxyuser</username>
<password>somepassword</password>
<nonProxyHosts>*.google.com|ibiblio.org</nonProxyHosts>
</proxy>
</proxies>

  • id:代理的标志
  • active:是否激活代理
  • protocol, host, port:protocol://host:port 代理
  • username, password:用户名和密码
  • nonProxyHosts: 不需要代理的host

Profiles
类似于pom.xml中的profile元素,主要包括activation,repositories,pluginRepositories 和properties元素
刚开始接触的时候,可能会比较迷惑,其实这是maven2中比较强大的功能。从字面上来说,就是个性配置。
单独定义profile后,并不会生效,需要通过满足条件来激活。
repositories 和pluginRepositories
定义其他开发库和插件开发库。对于团队来说,肯定有自己的开发库。可以通过此配置来定义。
如下的配置,定义了本地开发库,用于release 发布。
<repositories>
<repository>
<id>repo-local</id>
<name>Internal 开发库</name>
<url>http://192.168.0.2:8082/repo-local</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<layout>default</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo-local</id>
<name>Internal 开发库</name>
<url>http://192.168.0.2:8082/repo-local</url>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<layout>default</layout>
</pluginRepository>
</pluginRepositories>
releases, snapshots:每个产品的版本的Release或者snapshot(注:release和snapshot的区别,release一般是比较稳定的版本,而snapshot基本上不稳定,只是作为快照)

properties
maven 的properties作为placeholder值,如ant的properties。
包括以下的5种类型值:

  1. env.X,返回当前的环境变量
  2. project.x:返回pom中定义的元素值,如project.version
  3. settings.x:返回settings.xml中定义的元素
  4. java 系统属性:所有经过java.lang.System.getProperties()返回的值
  5. x:用户自己设定的值

Activation
用于激活此profile
<activation>
<activeByDefault>false</activeByDefault>
<jdk>1.5</jdk>
<os>
<name>Windows XP</name>
<family>Windows</family>
<arch>x86</arch>
<version>5.1.2600</version>
</os>
<property>
<name>mavenVersion</name>
<value>2.0.3</value>
</property>
<file>
<exists>${basedir}/file2.properties</exists>
<missing>${basedir}/file1.properties</missing>
</file>
</activation>

  • jdk:如果匹配指定的jdk版本,将会激活
  • os:操作系统
  • property:如果maven能检测到相应的属性
  • file: 用于判断文件是否存在或者不存在

除了使用activation来激活profile,同样可以通过activeProfiles来激活
Active Profiles
表示激活的profile,通过profile id来指定。
<activeProfiles>
<activeProfile>env-test</activeProfile> 指定的profile id
</activeProfiles>

settings.xml配置文件(*简单的可用版本)

<?xml version=”1.0″ encoding=”UTF-8″?>

<!–
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
“License”); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
“AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
–>

<!–
| This is the configuration file for Maven. It can be specified at two levels:
|
| 1. User Level. This settings.xml file provides configuration for a single user,
| and is normally provided in ${user.home}/.m2/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -s /path/to/user/settings.xml
|
| 2. Global Level. This settings.xml file provides configuration for all Maven
| users on a machine (assuming they’re all using the same Maven
| installation). It’s normally provided in
| ${maven.conf}/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -gs /path/to/global/settings.xml
|
| The sections in this sample file are intended to give you a running start at
| getting the most out of your Maven installation. Where appropriate, the default
| values (values used when the setting is not specified) are provided.
|
|–>
<settings xmlns=”http://maven.apache.org/SETTINGS/1.0.0″
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xsi:schemaLocation=”http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd”>
<!– localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository –>
<localRepository>D:\devEnviroment\maven\repo</localRepository>

<!– interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
–>

<!– offline
| Determines whether maven should attempt to connect to the network when executing a build.
| This will have an effect on artifact downloads, artifact deployment, and others.
|
| Default: false
<offline>false</offline>
–>

<!– pluginGroups
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
| when invoking a command line like “mvn prefix:goal”. Maven will automatically add the group identifiers
| “org.apache.maven.plugins” and “org.codehaus.mojo” if these are not already contained in the list.
|–>
<pluginGroups>
<!– pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
–>
</pluginGroups>

<!– proxies
| This is a list of proxies which can be used on this machine to connect to the network.
| Unless otherwise specified (by system property or command-line switch), the first proxy
| specification in this list marked as active will be used.
|–>
<proxies>
<!– proxy
| Specification for one proxy, to be used in connecting to the network.
|
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
–>
</proxies>

<!– servers
| This is a list of authentication profiles, keyed by the server-id used within the system.
| Authentication profiles can be used whenever maven must make a connection to a remote server.
|–>
<servers>
<!– server
| Specifies the authentication information to use when connecting to a particular server, identified by
| a unique name within the system (referred to by the ‘id’ attribute below).
|
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
| used together.
|
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
–>

<!– Another sample, using keys to authenticate.
<server>
<id>siteServer</id>
<privateKey>/path/to/private/key</privateKey>
<passphrase>optional; leave empty if not used.</passphrase>
</server>
–>
</servers>

<!– mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|–>
<mirrors>
<!– mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
–>
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
</mirrors>

<!– profiles
| This is a list of profiles which can be activated in a variety of ways, and which can modify
| the build process. Profiles provided in the settings.xml are intended to provide local machine-
| specific paths and repository locations which allow the build to work in the local environment.
|
| For example, if you have an integration testing plugin – like cactus – that needs to know where
| your Tomcat instance is installed, you can provide a variable here such that the variable is
| dereferenced during the build process to configure the cactus plugin.
|
| As noted above, profiles can be activated in a variety of ways. One way – the activeProfiles
| section of this document (settings.xml) – will be discussed later. Another way essentially
| relies on the detection of a system property, either matching a particular value for the property,
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
| value of ‘1.4’ might activate a profile when the build is executed on a JDK version of ‘1.4.2_07’.
| Finally, the list of active profiles can be specified directly from the command line.
|
| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
| repositories, plugin repositories, and free-form properties to be used as configuration
| variables for plugins in the POM.
|
|–>
<profiles>
<!– profile
| Specifies a set of introductions to the build process, to be activated using one or more of the
| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
| or the command line, profiles have to have an ID that is unique.
|
| An encouraged best practice for profile identification is to use a consistent naming convention
| for profiles, such as ‘env-dev’, ‘env-test’, ‘env-production’, ‘user-jdcasey’, ‘user-brett’, etc.
| This will make it more intuitive to understand what the set of introduced profiles is attempting
| to accomplish, particularly when you only have a list of profile id’s for debug.
|
| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
<profile>
<id>jdk-1.4</id>
<activation>
<jdk>1.4</jdk>
</activation>
<repositories>
<repository>
<id>jdk14</id>
<name>Repository for JDK 1.4 builds</name>
<url>http://www.myhost.com/maven/jdk14</url>
<layout>default</layout>
<snapshotPolicy>always</snapshotPolicy>
</repository>
</repositories>
</profile>
–>

<!–
| Here is another profile, activated by the system property ‘target-env’ with a value of ‘dev’,
| which provides a specific path to the Tomcat instance. To use this, your plugin configuration
| might hypothetically look like:
|
| …
| <plugin>
| <groupId>org.myco.myplugins</groupId>
| <artifactId>myplugin</artifactId>
|
| <configuration>
| <tomcatLocation>${tomcatPath}</tomcatLocation>
| </configuration>
| </plugin>
| …
|
| NOTE: If you just wanted to inject this configuration whenever someone set ‘target-env’ to
| anything, you could just leave off the <value/> inside the activation-property.
|
<profile>
<id>env-dev</id>
<activation>
<property>
<name>target-env</name>
<value>dev</value>
</property>
</activation>
<properties>
<tomcatPath>/path/to/tomcat/instance</tomcatPath>
</properties>
</profile>
–>
</profiles>

<!– activeProfiles
| List of profiles that are active for all builds.
|
<activeProfiles>
<activeProfile>alwaysActiveProfile</activeProfile>
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
</activeProfiles>
–>
</settings>
以上是settings.xml文件的全部内容,直接全部复制即可用。

 

备注:settings.xml文件从maven的安装目录下的conf下的settings.xml文件改造而来,只做了两个地方的修改,一个是<localRepository>D:\devEnviroment\maven\repo</localRepository>,这里需要改成自己的仓库地址(自己定,随意都行),第二个修改是镜像的配置,加入的代码是下面的代码块

<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
修改后,在idea我的设置中的maven设置将settings.xml文件指向该文件,以及仓库指向自定义的仓库地址即可。

Minecraft 服务器搭建经验分享

Minecraft 多人在线服务器搭建
多人在线同时玩Minecraft需要一台服务器:

局域网服务器:个人电脑作为服务器,可以供多人同时在线,对个人电脑性能有一定要求,没有测试过。局限性比较大,只能局域网,适合同宿舍、同学校玩家。

云服务器:购买一台云服务器,服务器配置不同,能同时在线人数差别很大,大约是一个玩家可能会占用50-100MB左右的内存,用不同的服务器软件差别会很大,我*开始用MCPC+服务器,CentOS 7.0 1G 内存,4个玩家就有人掉线,内心是崩溃的,MCPC+存在对内存的利用率不高,性能不稳定等情况。

当然,针对服务器性能问题,可以修改服务器参数,做性能调优。

常用的MC服务器软件:

CraftBukkit
MCPC+
Spigot
游戏对内存和带宽有一定的要求,毕竟是多人同时在线,内存、带宽、网速肯定会影响体验。

XX云 CentOS 7.x 2G 内存,5Mbps带宽。经过实践证明,Spigot 1.9.0性能*好。目前的测试结果表明,2G内存可同时在线12人,服务器稳定运行,并且还有提升空间,由于团队玩家数量不足,没能测试Spigot服务器的*限。

Spigot 服务器下载地址: https://mcadmin.net

服务器搭建过程可参考 : http://sintonblog.win/mc-build-1