`
小网客
  • 浏览: 1215711 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
需求: 查询某固定db中所有表的记录数,然后排序 实现: select table_name,table_rows from information_schema.tables  where table_schema='yourdb' order by table_rows desc;  
需求: linux下获取某文件的总行数 实现: 方案一: echo `cat logfile.txt | wc -l` 方案二: more logfile.txt |wc -l   摘自:http://www.xhuojia.com/zhuanlan/2779749052.html
需求: linux脚本统计某字符串在文件中那行出现 实现: more logfile.txt |grep 'headee' -n   摘自:http://www.xhuojia.com/zhuanlan/2755510772.html
需求: linux下对文件按照行数进行切割 实现: sed -n '10,100p' logfile.txt  > lognew.txt   摘自:http://www.xhuojia.com/zhuanlan/1891238847.html
需求:实现RSA非对称加密算法实现:public static class RSACoder {    public static final String KEY_ALGORITHM = "RSA";    private static final int KEY_SIZE = 512;    private static final String PUBLIC_KEY = "RSAPublicKey";    private static final String PRIVATE_KEY = "RSAPrivateKey";   ...
需求:利用apache的common包中的configuration2进行属性文件的操作实现:public static PropertiesConfiguration loadProperties(File file)        throws ConfigurationException {    Parameters params = new Parameters();    PropertiesConfiguration configuration = new FileBasedConfigurationBuilder<PropertiesConfiguration>(  ...
需求:基于Java的标准库提取URL对应的域名并拼接成basePath实现:public static String extactBasePath(String line) {    try {        java.net.URL url = new java.net.URL(line);        StringBuilder sb = new StringBuilder();        return sb.append(url.getProtocol()).append("://").append(url.getHost())                .t ...
需求: shell脚本的命令行传递赋值与参数问题 实现: echo "Shell 传递参数实例!"; echo "执行的文件名:$0"; echo "第一个参数为:$1"; echo "第二个参数为:$2"; echo "第三个参数为:$3"; 执行 ./test.sh www.someabcd.com  www.xhuojia.com 输出: ./test www.someabcd.com www.xhuojia.com   摘自:http://www.xhuo ...
需求: shell读取文件内容,然后把内容赋值给变量然后进行字符串处理 实现: dataline=$(cat /root/data/data.txt) echo $dataline   摘自:http://xhuojia.com/zhuanlan/1832921069.html
查询某表所有索引列mysql> show index from tablename;mysql> show keys from tablename;其他说明:Index_type:(BTREE, FULLTEXT, HASH, RTREE)默认为BTREE 摘自:http://www.xhuojia.com/zhuanlan/1113302892.html
需求: 有时候需要查看nginx的配置文件路径 实现: 直接nginx -t即可 如果nginx没有在path中的话那么需要进入安装目录执行 sbin/nginx -t   摘自:http://www.someabcd.com/java/1636077204.html
需求: 获取class所在的目录的时候通过Test.class.getResources("/");报空指针 分析: linux下没有任何问题,不以/开头的比如window文件系统,那么就会报空指针 解决方式:
背景:在用freemarker做模板的时候碰到了long类型对数字做了格式化,用逗号分隔,id的时候容易出问题   解决方案: 模板文件中直接tostring输出: ${num.toString()}  在模板中直接加<#setting number_format="#">使用?c控制,如 ${num?c} 一次性java文件中解决通过freemarker.template.Configuration的config.setNumberFormat("#")来设定freemarker对数值的格式化
有时候需要写脚本批量处理数据对某目录进行遍历通知执行相关操作 for file in 03/* do if test -f $file then echo $file fi if test -d $file then echo $file fi done    
错误信息如下: Incorrect string value: '\xF0\x9F\x98\x89 \xE6...' 问题产生的原因是字符串不兼容4字节的unicode导致的,一般我们常见的表情编码等 解决方案: 1.数据库支持,配置文件是my.cnf [client] default-character-set = utf8mb4 [mysql] default-character-set = utf8mb4 [mysqld] character-set-client-handshake = FALSE character-set-server = utf8 ...
Global site tag (gtag.js) - Google Analytics