日记整理---->2016-11-26

  记录一些营销产品中的一些学习知识。我们在同一个时区,却有一辈子的时差。

 一、关于mysql的注释问题

mysql的注释有以下三种,要注意是第二种的--后面至少要有一个空格

/*hello world*/
-- hello world
#hello world

 二、angular中的map的遍历

  • js测试的数据
$scope.maptest = {
    "man0": "hello1",
    "man1": "hello2",
    "man2": "hello3"
};
  •  html页面的代码
<div ng-repeat="(key, value) in maptest">
    {{key}} and {{value}} and {{$index}}
</div>
  • 代码的效果如下:

三、js数组的splice方法的介绍

splice:该方法的作用就是从数组中删除一个元素
array.splice(index,count,value....);
index:表示从哪一个下标开始,
count:表示删除元素的个数
value:代表增加的元素

提供一个例子如下:

var arrays = ["huhx", "linux", "tomhu"];
// 替换一个元素
arrays.splice(1, 1, "python");
console.log(arrays); // ["huhx", "python", "tomhu"]
// 增加一个元素
arrays.splice(arrays.length, 0, "go");
console.log(arrays); // ["huhx", "python", "tomhu", "go"]
// 删除一个元素
arrays.splice(0, 1);
console.log(arrays); // ["python", "tomhu", "go"]

 js中关于slice方法的使用:http://www.w3school.com.cn/jsref/jsref_slice_array.asp

四、java中关于List遍历的情况

public static void main(String[] args) {
    List<String> strLists = new ArrayList<String>();
    strLists.add("linux");
    strLists.add("huhx");
    for (String string : strLists) {
        string += "huhx";
    }
    System.out.println(strLists); // [linux, huhx]
    
    List<Map> mapLists = new ArrayList<Map>();
    Map<String, String> map = new HashMap<String, String>();
    map.put("username", "huhx");
    map.put("password", "1234");
    mapLists.add(map);
    for (Map maps : mapLists) {
        map.put("address", "china");
        map.put("password", "123456");
    }
    System.out.println(mapLists); // [{username=huhx, address=china, password=123456}]
}

五、关于响应式事件的开发

http://cn.vuejs.org/v2/guide/reactivity.html

六、关于java中的static块

class StaticClass {
    static {
        System.out.println("hello world");
    }

    public static void sayHello() {
        System.out.println("Hello");
    }

    public void sayWorld() {
        System.out.println("World");
    }
}

以下是测试的结果:

StaticClass.sayHello();
hello world
Hello
------------------------------------------
StaticClass.sayHello();
new StaticClass().sayWorld();
hello world
Hello
World
------------------------------------------
new StaticClass().sayWorld();
new StaticClass().sayWorld();
hello world
World
World

七、阿里云的maven仓库,提高下载速度

 修改maven根目录下的conf文件夹中的setting.xml文件,内容如下:

<mirrors>
    <mirror>
        <id>alimaven</id>
        <name>aliyun maven</name>
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
        <mirrorOf>central</mirrorOf>        
    </mirror>
</mirrors>

八、position:absolute的用法

<div style="position: relative;">
    <div style="position: absolute;">hello world</div>
    <input type="file" name="file" >
</div>

效果如下:

<div style="position: relative;">
    <span style="position: absolute;">hello world</span>
    <span>hello world</span>
    <input type="file" name="file" onchange="alert('hello world')" >
</div

九、关于spring中的BeanWrap的使用

Person是一个javaBean,有两个属性username,password。

public void beanWrap_1() {
    BeanWrapper wrapper = new BeanWrapperImpl(new Person());
    wrapper.setPropertyValue("username", "linux");
    PropertyValue passwordValue = new PropertyValue("password", "123456");
    wrapper.setPropertyValue(passwordValue);

    System.out.println(wrapper.getPropertyValue("username") + ", " + wrapper.getPropertyValue("password"));
}
// linux, 123456

十、Spring Expression Language的基础使用

public void expressionTest_1() {
    ExpressionParser parser = new SpelExpressionParser();
    Expression exp = parser.parseExpression("new String('hello world').toUpperCase()");
    String message = exp.getValue(String.class);
    System.out.println(message); // HELLO WORLD
    exp = parser.parseExpression("'Hello World'.bytes.length");
    int length = (Integer) exp.getValue();
    System.out.println(length); // 11
}

友情链接

原文地址:https://www.cnblogs.com/huhx/p/basediary20161126.html