\sc – case in … esac (n, i)
\sei – elif then (n, i)
\sf – for in do done (n, i, v)
\sfo – for ((…)) do done (n, i, v)
\si – if then fi (n, i, v)
\sie – if then else fi (n, i, v)
\ss – select in do done (n, i, v)
\su – until do done (n, i, v)
\sw – while do done (n, i, v)
\sfu – function (n, i, v)
\se – echo -e "…" (n, i, v)
\sp – printf "…" (n, i, v)
\sa – 数组元素, ${.[.]} (n, i, v) 和其它更多的数组功能。
\rr – 更新文件,运行脚本(n, i)
\ra – 设置脚本命令行参数 (n, i)
\rc – 更新文件,检查语法 (n, i)
\rco – 语法检查选项 (n, i)
\rd – 启动调试器(n, i)
\re – 使脚本可/不可执行(*) (n, i)
linux总结
发表于
更新于
#bash语法,等号两边不能有空格
[root@xhs bash]# FreeMem=`free -m | grep Mem: | awk '{print $4}'`
[root@xhs bash]# echo $FreeMem
#设置时区
[root@xhs ~]# timedatectl set-timezone Asia/Shanghai
[root@xhs ~]# ll /etc/localtime
lrwxrwxrwx. 1 root root 35 Feb 2 11:28 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
#用户权限
是 SGID 的第二个功能,即在某个目录中创建的文件自动继承该目录的用户组(只可以对目录进行设置)
#分区
分区的知识,可以只有一个分区,但效率不高,一个扇区最多只能存四个主分区,一般是在第四个扇区里存逻辑分区的指针;
fdisk进行分区
mkfs格式化
mount 挂载
#查看
df -h
du -sh /newFS/
mysql可连接IP
发表于
更新于
mysql> insert into user (host,user,password, ssl_cipher, x509_issuer,x509_subject) values('192.168.3.%','root',password('123456'),'', '','');
mysql> flush privileges;
virtualbox centos7 虚拟机 与宿主机共享文件夹
发表于
更新于
点安装增强功能 wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-7.repo yum clean all yum makecache sudo yum update sudo yum upgrade yum install gcc gcc-devel gcc-c++ gcc-c++-devel make kernel kernel-devel yum install -y "kernel-devel-$(uname -r)" gcc bzip2 yum install bzip2 tar shutdown -r now mount /dev/cdrom /mnt/ cd /mnt ./VBoxLinuxAdditions.run mkdir /mnt/share 在虚拟机新建共享文件夹,名叫share #有两种方式用共享文件夹 #一是手动挂载,如下,挂载后文件就在 /mnt/share下 mount -t vboxsf share /mnt/share #二是重启让虚拟机自动挂载,挂载后文件夹在 /media 下,且文件夹多了前缀 sf_ reboot ls /media
80端口被System 4 占用
发表于
更新于
$ nginx -t nginx: the configuration file D:\soft\server\nginx1.6.3/conf/nginx.conf syntax is ok nginx: [emerg] bind() to 0.0.0.0:80 failed (10013: An attempt was made to access a socket in a way forbidden by its access permissions) nginx: configuration file D:\soft\server\nginx1.6.3/conf/nginx.conf test failed netstat -ano|findstr "80" 解决: netstat -ano|findstr "80" Sc config http start= disabled 参考: https://www.cnblogs.com/hope-help/archive/2013/05/13/3076606.html https://jingyan.baidu.com/article/870c6fc37678c4b03fe4bef6.html
mybatis mapper 生成代码
发表于
更新于
过程: 1、在pom.xml加插件配置 在plugins加入:
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-maven-plugin</artifactId>
<version>1.3.6</version>
<configuration>
<configurationFile>
${basedir}/src/main/resources/generator/generatorConfig.xml
</configurationFile>
<overwrite>true</overwrite>
<verbose>true</verbose>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.29</version>
</dependency>
<dependency>
<groupId>tk.mybatis</groupId>
<artifactId>mapper</artifactId>
<version>${mapper.version}</version>
</dependency>
</dependencies>
</plugin>
2、建generator/generatorConfig.xml配置文件
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<properties resource="config.properties"/>
<context id="Mysql" targetRuntime="MyBatis3Simple" defaultModelType="flat">
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<plugin type="tk.mybatis.mapper.generator.MapperPlugin">
<property name="mappers" value="tk.mybatis.mapper.common.Mapper"/>
<property name="caseSensitive" value="true"/>
</plugin>
<jdbcConnection driverClass="${jdbc.driverClass}"
connectionURL="${jdbc.url}"
userId="${jdbc.user}"
password="${jdbc.password}">
</jdbcConnection>
<javaModelGenerator targetPackage="com.xhs.oa.entity"
targetProject="src/main/java"/>
<sqlMapGenerator targetPackage="com.xhs.oa.mapper"
targetProject="src/main/java"/>
<javaClientGenerator targetPackage="com.xhs.oa.mapper"
targetProject="src/main/java"
type="XMLMAPPER"/>
<table tableName="over_budget_apply">
<generatedKey column="id" sqlStatement="JDBC"/>
</table>
</context>
</generatorConfiguration>
3、建config.properties文件,放在resources目录下,填数据库连接信息 示例:jdbc.driverClass=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.3.4:3306/test
jdbc.user=xxx
jdbc.password=1234564、运行 mvn mybatis-generator:generate 生成
遇到的问题:
报generatorConfig.xml 找不到,对比代码输出的路径和文件路径,发现少了xml后缀
报缺少config.properties文件,的确是缺少,但不知道放哪里好,程序没有报路径,后来查到是配置文件这节配置的
报 Cannot instantiate object of type tk.mybatis.mapper.generator.MapperPlugin
maven依赖,因为pom.xml里上面这个tk.mybatis引入过了,以为插件这里就不用引了,还是要的参考:https://github.com/abel533/Mapper/wiki/4.1.mappergenerator
jetbrain常用快捷键
发表于
更新于
Generate code Alt + Ins Debuggin Smart step into/Step out Shift + F7 / Shift + F8 Edit Expand/collapse code block Ctrl + NumPad+ / - Expand all Ctrl + Shift + NumPad+ Collapse all Ctrl + Shift + NumPad- VCS Push commits Ctrl + Shift + K Navigation Go to class Ctrl + N Go to file Ctrl + Shift + N Go to symbol Ctrl + Alt + Shift + N Go to editor (from tool window) Esc #函数调用层次 Call hierarchy Ctrl + Alt + H
mvn 命令
发表于
更新于
#查看maven的依赖树 mvn dependency:tree #打包 mvn package 运行 java -jar demo-0.0.1-SNAPSHOT.jar --server.port=9090
git hooks 钩子使用
发表于
更新于
进入git服务端仓库钩子目录 /home/git/repositories/blog/.git/hooks cp post-receive.sample post-receive vi post-receive 内容为: #!/bin/sh # # An example hook script for the "post-receive" event. # # The "post-receive" script is run after receive-pack has accepted a pack # and the repository has been updated. It is passed arguments in through # stdin in the form ## For example: # aa453216d1b3e49e7f6f98441fa56946ddcd6a20 68f7abf4e6f922807889f52bc043ecd31b79f814 refs/heads/master # # see contrib/hooks/ for a sample, or uncomment the next line and # rename the file to "post-receive". unset GIT_INDEX_FILE git --work-tree=/usr/share/nginx/html/blog checkout -f 保存 这时注意看钩子 post-receive的属主和权限,因为我是用root用户复制的,要改回git用户所有 chown git:git post-receive ll 查看权限如下,要注意要有执行权限 -rwx--x--x 1 git git 672 Dec 29 22:36 post-receive 测试发现不行,看了别的文章猜想是代码目录权限问题 代码目录 blog是nginx所有,将git用户加入nginx用户组里 usermod -a -G nginx git 再push代码,发现服务端有反应了 Total 6 (delta 3), reused 0 (delta 0) remote: error: unable to unlink old 'backend/views/wechatUser/_form.php' (Permis sion denied) remote: error: unable to unlink old 'backend/views/wechatUser/_search.php' (Perm ission denied) remote: error: unable to unlink old 'backend/views/wechatUser/create.php' (Permi ssion denied) remote: error: unable to unlink old 'backend/views/wechatUser/index.php' (Permis sion denied) remote: error: unable to unlink old 'backend/views/wechatUser/update.php' (Permi ssion denied) remote: error: unable to unlink old 'backend/views/wechatUser/view.php' (Permiss 还是权限, 又把这些文件属主改为nginx,再push,就可以了 参考 https://www.digitalocean.com/community/tutorials/how-to-use-git-hooks-to-automate-development-and-deployment-tasks
composer 命令
发表于
更新于
#安装一个包 composer require "sunra/php-simple-html-dom-parser:1.5.2" #设置全局参数 composer config -g repo.packagist composer http://xxx.com #查看配置 composer config -l -g