java生活小妙招

5 篇文章 0 订阅
2 篇文章 0 订阅

mariadb 自启动+远程

mariadb 自启动:>>systemctl enable mariadb;
                >>flush privileges;
mariadb 开远程:>>grant all privileges on *.* to 'root'@'%' identified by '密码'; 
                >>flush  privileges;
mariadb 大小写敏感:etc/my.cnf.d/mariadb-server.cnf  添加[mysqld]下添加lower-case-table-names=1

class打war包

进入项目根目录
>>jar -cvf 项目.war  *

cssTD强制换行-针对整个单子和IP地址

<td style="word-wrap:break-word;word-break:break-all;">

easyui-tip

$(this).datagrid('tooltip', [ '字段','内容' ]);

datagrid数据onloadsuccess成功后执行。

eclipse替换正则

^hello 以hello开头
hello$ 以hello结尾
<title>.* 以<title>开头
.*?</title> 以</title>结尾


<title>.*?</title>  以<title>开头 以</title>结尾

mysql备份

先 CD 到系统mysql的bin目录下,执行命令

mysqldump -P3306 -uroot -p密码 数据库名 > C:\数据库名.sql


textarea不换行

textarea{
white-space:pre-wrap; /* css3.0 /
white-space:-moz-pre-wrap; / Firefox /
white-space:-o-pre-wrap; / Opera 7 /
word-wrap:break-word; / Internet Explorer 5.5+ */
}

zip4jwintoluix乱码

/**
     * 判断zip文件是utf解压还是gbk解压
     * @param zipFile
     * @param fileName
     * @return
     */
1.if(isGBKZipFile(zipFile)){
            zFile.setFileNameCharset("GBK");
        }else{
            zFile.setFileNameCharset("UTF-8");
        }
    
2.public static boolean isGBKZipFile(File zipFile) {
        FileInputStream fis = null;
        ZipInputStream zis = null;
        try {
            fis = new  FileInputStream(zipFile);
            zis = new  ZipInputStream(new BufferedInputStream(fis));
            ZipEntry entry = null;
            while ((entry = zis.getNextEntry()) != null) {
            }
            return false;
        }catch(Exception e) {
            e.printStackTrace();
            return true;
        }finally{
            try {
                fis.close();
                zis.close();
            } catch (Exception e2) {
                // TODO: handle exception
            }
        }
    }

复选框单选判定

$("input:checkbox").click(getboolean);
function getboolean(){
        var that = $(this);
        var id = that.attr("id");
        if(that.is(":checked")){
            $("input[name='"+that.attr("name")+"']").each(function(th){
                var id1 =$(this).attr("id");
                if(id!=id1){
                    $(this).removeAttr("checked");
                }
            });
        }
    }

文件名特殊字符正则

private  boolean regbool(String str){
        String reg ="[\\\\/:*?\"<>|]";
        Pattern p =Pattern.compile(reg);
        Matcher m = p.matcher(str);
        return m.find();
//        String r[] = {"\\","/","*","?","\"","<",">","|"};
//        for(int i=0;i<r.length;i++){
//            if(str.contains(r[i])){
//                return true;
//            }
//        }
//        return false;
    }

#############################
var reg = new RegExp('[\\\\/:*?"<>|]');
        var rows  = $('#datagrid').datagrid('getRows');
        for(var i = 0; i < rows.length; i++){
            var filename = rows[i].name;
            if(reg.test(filename)){
                $.messager.alert('提示',filename+'的文件名含有括号内(\/:*?"<>|)的特殊字符,windows系统无法识别!');
                return ;
            }
        }
#####################        
var pat =/[\\ /:*?"<>|]/;
                      if(pat.test(testNmae)){
                          $.messager.alert('提示', "名称不合法。包含:\/\\:*?\"<>|或空格", 'info'); 
                          return false;
                      }
                      

encodeURIComponent
decodeURIComponent

页面encodeURIComponent和解码

encodeURIComponent
decodeURIComponent


java:
URLEncoder.encode(filename,"utf-8")

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值