• 每日记载内容总结19


    1.mysql报错
    java.sql.SQLException: Incorrect string value: 'xCExC4xB8xF1xB1xF2' for column 'name' at row 1
    有的建议在sql语句中加入:set names utf8 有的可以解决,有的未解决,
    查询一下建表用的字符集是,就发现了是用的latin1 ,也就是用latin1字符建表,sql语句里面设置字符集,对新插入数据起作用,
    但是对建好的表就无能为力,所以,完全解决的话就是把表删除,重新建表,建表语句为create table ... () ENGINE=InnoDB DEFAULT CHARSET=utf8;来设置数据存储引擎为Innodb(此引擎可提供外键 事务等功能)和字符集为utf-8.


    2.在服务器上面改变catalina.sh文件,进行关闭运行tomcat命令时候,会出现以下问题:
    Cannot find ./catalina.sh
    The file is absent or does not have execute permission
    This file is needed to run this program
    解决方法为:在tomcat 的bin目录下 执行这条命令chmod +x *.sh。作用为:赋予catalina.sh可执行权限

    3.java类型和java Objec类型的区别:
       JAVA所有的类都默认继承Object类(即包java.lang.object),包括你自己创建的类。
       Boolean,Integer,Long,Double是java.util包中的类,它们是boolean,int,long,double相对应的包装类用以产生对应的对象。
        后者称基本类型,创建后置于stack(堆栈)中,存取速度很快,而其他引用对象创建后置于heap(堆)中,速度没有堆栈快。
        
        创建方法不同:
            int i = 1;//此创建了一个基本类型的int对象。
            Integer integer = new Integer();//此创建了一个Integer包装类的引用,在内存中的位置不同。
     类似的还有char和Character、float和Float、short和Short、byte和Byte。
     要记得前者用于产生对象的引用,而后者直接产生一的基本类型的数据。

    4.setTimeout 与 setInterval区别

    setTimeout(表达式,延时时间)
    在执行时,是在载入后延迟指定时间后,去执行一次表达式,记住,次数是一次

    用setTimeout实现的自动变化显示随机数的效果:

    <html>
    <head>
    <script>
    window.onload=sett;
    function sett()
    {
    document.body.innerHTML=Math.random();
    setTimeout("sett()",500);
    }
    </script> 
    </head>
    <body>
    </body>
    </html>

    setInterval(表达式,交互时间)
    则不一样,它从载入后,每隔指定的时间就执行一次表达式

    用setInterval实现的自动变化显示随机数的效果:

    <html>
    <head>
    <script>
    function sett()
    {
    document.body.innerHTML=Math.random();
    }
    setInterval("sett();", 500);
    </script>
    </script> 
    </head>
    <body>
    </body>
    </html>

    5.不规则边框的设计:

    用两个div进行拼接,不需要的边框,设置该div的z-index高于另外一个,而且其border-* 为0 即可
    重合的边框,只需要该div的margin-* 为border的宽度的相反数即可

    js获取元素的长度和宽度
    id.offsetWidth和id.offsetHeight

    6.jquery获取鼠标点击的li在此ul中的位置(以下提供两种方法)

     $(function(){
                //$("ul li").each(function(index){
                //    $(this).click(function(){
                // alert(index);
                // });
                //    });
            $("ul li").click(function(){
                alert($(this).index());
            });
              
            }); 

    7.使用jquery去除li的class(以下提供两种方法)

    <html>  
        <head>  
            <script type="text/javascript" src="../jquery-1.7.2.min.js"></script>  
            <script type="text/javascript">  
            $(function(){
              $("#btn").click(function(){
                $("ul li").each(function() {  
                    $(this).removeClass();
                });
              }); 
            });  
            </script>  
            <style>.cls{color: red;}</style>  
        </head>  
        <body>  
            <ul>  
                <li class="cls">1111111111111</li>  
                <li class="cls">222222222222</li>  
                <li class="cls">333333333333</li>  
                <li class="cls">44444444444</li>  
                <li class="cls">55555555555555</li>  
                <li class="cls">66666666666666</li>  
            </ul>
            <input type="button" value="去除Class" id="btn"/>
        </body>  
    </html> 

    以下例子主要为学会运用先取到对赋值给参数,然后进行操作

    <html>
        <head>
            <script type="text/javascript" src="jquery-1.4.2.min.js"></script>
            <script>
            $(function(){
              var items = $("ul li");
              items.each(function(i) {
                var t = $(this);
                t.click(function(){
                    t.toggleClass("selected");
                    t.siblings().removeClass();
                });
              });
            });
            </script>
            <style>.selected{color: red;}</style>
        </head>
        <body>
            <ul>
                <li>1111111111111</li>
                <li>222222222222</li>
                <li>333333333333</li>
                <li>44444444444</li>
                <li>55555555555555</li>
                <li>66666666666666</li>
            </ul>
        </body>
    </html>
  • 相关阅读:
    golang gc
    set password to qcow2
    golang reflect struct
    Mac 自启动管理
    shell exec
    shell 管道 与 mkfifo
    shell 读取文件
    shell 函数
    shell read 命令
    ubuntu 快速安装和设置 mysql
  • 原文地址:https://www.cnblogs.com/cuiyf/p/3266238.html
Copyright © 2020-2023  润新知