Java

byte & 0xff

byte[] b = new byte[1];b[0] = -127;System.out.println("b[0]:"+b[0]+"; b[0]&0xff:"+(b[0] & 0xff));//output:b[0]:-127; b[0]&0xff:129

计算机内二进制都是补码形式存储:

b[0]: 补码,10000001(8bit)

b[0]int输出:int(32bit),补位1。11111111 11111111 11111111 10000001(32bit)
和原数一致

b[0]&0xff:11111111 11111111 11111111 10000001(32bit) & 11111111 =
00000000 00000000 00000000 10000001

低精度转成高精度数据类型,有两种扩展方案。(1)补零扩展 (2)符号位扩展

对于正数两种是一样的。

  • 使用补零扩展能够保证二进制存储的一致性,但不能保证十进制值不变

  • 使用补符号位扩展能够保证十进制值不变,但不能保证二进制存储的一致性

对于有符号类型,Java使用的是补符号位扩展,这样能保证十进制的值不变

return break

break is used to exit (escape) the for-loop, while-loop, switch-statement that you are currently executing.
return will exit the entire method you are currently executing (and possibly return a value to the caller, optional).

inputstream byte[] to String


byte[] buffer = new byte[17];if (is != null) {int size = is.read(buffer);if(size > 0 ){String Str = new String(buffer,0,size);}}

Stm32 send packet

byte[] packet = new byte[len];packet[0] = (byte) type;packet[1] = (byte) len;packet[2] = (byte) seq;packet[3] = (byte)(isreset?1:0);packet[4] = (byte) vx;packet[5] = (byte)(vx >>8);packet[6] = (byte) vy;packet[7] = (byte)(vy >>8 );// System.arraycopy(command.toDatas(), 0, packet, 3, command.getLen());int Seq = (datas[0]&0XFF);int vx = (datas[1]&0XFF) | ((datas[2])<<8));int Vy = ((datas[3]&0XFF) | ((datas[4])<<8));boolean Motostatel = ((datas[4] & (1 << 1))!=0);boolean Motostater = ((datas[4] & (1 << 2))!=0);
  • System.arraycopy(Object src,int srcPos,Object dest,int destPos,int length)

  • src:源数组

  • srcPos:源数组起始位置

  • dest:目标数组

  • destPos:目标数组起始位置

  • length:长度

Tips: srcdest是要可以互相转换或是同类型的数组

Tips:

可以自己复制自己


int[] src ={0,1,2,3,4,5,6}; System.arraycopy(src,0,src,3,3);// output:{0,1,2,0,1,2,6}

生成一个长度为length的临时数组,将fun数组中srcPos
srcPos+length-1之间的数据拷贝到临时数组中,再执行System.arraycopy(临时数组,0,fun,3,3)

new Semaphore(0)


Semaphore semaphore = new Semaphore(0);try {semaphore.acquire();} catch (InterruptedException e) {e.printStackTrace();}//semaphore.release();

初始化信号量为0,semaphore.acquire()线程会阻塞。直到semaphore.release()之后 信号量变为1。

mysql

1045 access denied for user 'root'@'localhost' using password yes

忘记localhost密码,密码错误

  • step1,找到mysql安装目录下my.ini。在[mysql]下添加 skip-grant-tables

  • step2,重启mysql服务

  • step3,以管理员身份运行 cmd. 输入mysql -u root -p,直接回车

  • step4,输入use mysql

  • step5,mysql 5.6以前的,输入UPDATE mysql.user SET Password=PASSWORD('123456') WHERE User='root';

    mysql 5.6以后的,输入UPDATE mysql.user SET authentication_string=PASSWORD('root') WHERE USER='root';

Android

权限

root

linux系统中是只有root权限普通权限,root即是最高权限。

Android获取root其实和Linux获取root权限一样。Linux下获取root权限的时候就是执行sudo或者su

Android本身就不想让你获得Root权限,大部分手机出厂的时候根本就没有su这个程序。所以你想获得Android的root权限,第一步就是要把编译好的su文件拷贝到Android手机的/system/bin或者/system/xbin/目录下。接下来你可以在Android手机的adb shell或者串口下输入su了。

getColor() 过时


// 过时
textView.setTextColor(getResources().getColor(R.color.text_color));textView.setTextColor(ContextCompat.getColor(this,R.color.text_color));

Installation error:INSTALL_FAILED_UID_CHANGED

尝试通过ADB删除产生冲突的数据文件


adb rm -rf /data/data/<your.package.name>

setHeight no use

当设置的高度比原来默认的高度要小时,调整setHeight是不生效的。


editText=(EditText)findViewById(R.id.myEditText);// editText.setHeight(10); //不生效editText.getLayoutParams().height = 100;

Installation error:INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

1.1 包名大写了

2.2 缺少AndroidManifest.xml文件

Error:Error converting bytecode to dex

1.1 包重复

2.2 build本身问题, 只需要clean and rebuild 一下

EditText光标颜色

EditText 有一个属性 android:textCursorDrawable 用来控制光标的颜色。android:textCursorDrawable="@null","@null"作用是让光标颜色和text color一样

发现了以元素'd:skin'开头的无效内容

把有问题的devices.xml删除,在Android SDK 里面的tool\lib 下找到devices.xml拷贝到那个文件夹。

finished with non-zero exit value 2

重复的jar包,删除引用的包,同时删除modulebuild.gradle文件的引用。

border


<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"><solid android:color="#418bdc"/><corners android:radius="2dp"/><stroke android:width="2dp" android:color="#303f9f"/><padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" />
</shape>

VideoView播放视频无法全屏问题

重写VideoView


import android.content.Context;
import android.util.AttributeSet;
import android.widget.VideoView;/*** Created by lijingnan on 12/04/2017.*/
public class CustomerVideoView extends VideoView {public CustomerVideoView(Context context) {super(context);}public CustomerVideoView(Context context, AttributeSet attrs) {super(context, attrs);}public CustomerVideoView(Context context, AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);}@Overrideprotected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {// 其实就是在这里做了一些处理。int width = getDefaultSize(0, widthMeasureSpec);int height = getDefaultSize(0, heightMeasureSpec);setMeasuredDimension(width, height);}
}

退出程序

  • KillProcess
//结束当前程序的进程  android.os.Process.killProcess(android.os.Process.myPid());

Tips:android中所有的activity都在主进程中,在Androidmanifest.xml中可以设置成启动不同进程,Service不是一个单独的进程也不是一个线程。

当你Kill掉当前程序的进程时也就是说整个程序的所有线程都会结束,Service也会停止,整个程序完全退出。

  • System.exit

//0表示正常退出,1表示异常退出(只要是非0的都为异常退出),即使不传0也可以退出,该参数只是通知操作系统该程序是否是正常退出
System.exit(0),System.exit(1)

Can't create handler inside thread that has not called Looper.prepare()

Handler对象与其调用者在同一线程中,如果在Handler中设置了延时操作,则调用线程也会堵塞。每个Handler对象都会绑定一个Looper对象,每个Looper对象对应一个消息队列(MessageQueue)。如果在创建Handler时不指定与其绑定的Looper对象,系统默认会将当前线程的Looper绑定到该Handler上。

在主线程中,可以直接使用new Handler()创建Handler对象,其将自动与主线程的Looper对象绑定;在非主线程中直接这样创建Handler则会报错,因为Android系统默认情况下非主线程中没有开启Looper,而Handler对象必须绑定Looper对象。

1.手动开启Looper,然后将其绑定到Handler对象上


final Runnable runnable = new Runnable() {@Overridepublic void run() {//执行耗时操作try {Thread.sleep(2000);} catch (InterruptedException e) {e.printStackTrace();}}
};
new Thread() {public void run() {Looper.prepare();new Handler().post(runnable);//在子线程中直接去new 一个handlerLooper.loop();    //这种情况下,Runnable对象是运行在子线程中的,可以进行联网操作,但是不能更新UI}
}.start();

2.通过Looper.getMainLooper(),获得主线程的Looper


final Runnable runnable = new Runnable() {@Overridepublic void run() {//执行耗时操作try {Thread.sleep(2000);} catch (InterruptedException e) {e.printStackTrace();}}
};
new Thread() {public void run() {new Handler(Looper.getMainLooper()).post(runnable);//这种情况下,Runnable对象是运行在主线程中的,不可以进行联网操作,但是可以更新UI}
}.start();

xxx is not an enclosing class

  • 一般出现在内部类中,若要创建内部类的实例,需要有外部类的实例才行,或者是将内部类设置为静态的,添加 static 关键字

public class A {  public class B {  }
}A a = new A();
A.B ab = a.new B();

there is no default constructor available in ...

子类中使用了无参构造方法,而它的父类中至少有一个没有无参的构造方法。

  • 如果一个类没有构造方法,会有一个默认的无参构造方法。
  • 如果显示的定义了带参构造方法则默认的无参构造方法就会失效。

  • 一个类只要有父类,那么在它实例化的时候,一定是从顶级的父类开始创建

子类使用无参构造函数创建子类对象时,会去先递归调用父类的无参构造方法,这时候如果某个类的父类没有无参构造方法就会出错

错误实例:


public class Parent{int aga;public Parent(int age){this.aga = age;}}public class Child extends Parent{public Child(){/** 默认调用父类的无参构造方法 * super();*/}}

如果子类使用带参参构造函数创建子类对象时,没有使用super先调用父类的带参构造方法,这时默认会调用父类的无参构造方法,如果父类没有也会报错

错误实例:


public class Parent{int aga;public Parent(int age){this.aga = age;}}public class Child extends Parent{public Child(int age){/** 默认调用父类的无参构造方法 * super();*/}}

上述也可以在子类调用父类的有参构造函数

public class Child extends Parent{public Child(int age){super(age);}}

JFinal

javax.servlet.ServletContext

BUG :The type javax.servlet.ServletContext cannot be resolved. It is indirectly referenced from required

Solution: 把tomcat/lib目录中的jsp-api.jarservlet-api.jar导入到项目的web/lib目录下。

cast

BUG :Jfinal Db.findFirst java.lang.Long cannot be cast to java.lang.Integer

Solution:return Db.findFirst(sql).getLong("count").intValue();

错误: 编码GBK的不可映射字符

BUG : eclipse导出javadoc时的错误: 编码GBK的不可映射字符

Solution:-encoding UTF-8 -charset UTF-8

JavaScript

数组删除元素

var arr = [1,2,3,4];arr.splice(1,1);/*** Array(3)* 0:1* 1:3* 2:4*/var arr = [1,2,3,4];delete arr[1];/*** Array(3)* 0:1* 1:undefined* 2:3* 3:4*/

delete arr[1],arr[1]变为undefined,数组的索引也保持不变

不要使用包装对象来创建原始类型变量

在js中我们可以使用String()Number()Boolean()构造函数来显式的创建包装对象


// String("test") , 一个字符串对象
// Number(5),一个数值对象
// Boolean(false),一个布尔对象// Don't do it!var x = new Boolean(false);
if (x) {alert('hi');  // Shows 'hi'.
}var x = Boolean(0);
if (x) {alert('hi');  // This will never be alerted.
}
typeof Boolean(0) == 'boolean';
typeof new Boolean(0) == 'object';

script文件异步加载

<script src="path/to/myModule.js" defer></script>
<script src="path/to/myModule.js" async></script>

<script>标签打开defer或async属性,脚本就会异步加载。渲染引擎遇到这一行命令,就会开始下载外部脚本,但不会等它下载和执行,而是直接执行后面的命令。

  • defer与async的区别是:defer要等到整个页面在内存中正常渲染结束(DOM 结构完全生成,以及其他脚本执行完成),才会执行;async一旦下载完,渲染引擎就会中断渲染,执行这个脚本以后,再继续渲染。一句话,defer是“渲染完再执行”,async是“下载完就执行”。另外,如果有多个defer脚本,会按照它们在页面出现的顺序加载,而多个async脚本是不能保证加载顺序的。

cookie

cookie只区分域名,不管端口

  • cookie安全

1.1 httponly:设置了httponly属性,无法通过脚本获取到cookie信息

2.2 secure:设置了secure属性,cookie只能通过https安全传输,并不会通过未加密的http连接发送

3.3 sameSite:目前只有chrome和firefox支持,用于定义cookie如果跨域发送

debug

debugger

可以在JavaScript手动添加断点


debugger;

DOM

  • 右击DOM元素,'Force Element State',展开子菜单可以看到几种常见的伪类::active, :hover, :focus, and :visited。可以调试伪类。

  • 右击DOM元素,可以看到一个名为Break on的选项,展开有Subtree Modifications,Attributes Modifications以及Node Removal三个选项。(当JS尝试改变DOM元素时,给元素添加的断点便会触发。)

a) Subtree Modifications,当添加,改变,删除子元素时触发

b) Attributes Modifications,当元素属性被改变时触发

c) Node Removal,当移除元素时触发

Audits

Audits可以检查页面的性能方面存在的问题,并给出优化意见

Jquery

Cannot read property 'msie' of undefined

原因是$.browser这个api从jQuery1.9开始就正式废除,js代码里只要用到$.browser就会报这个错。

jQuery官方说明

1.1 可以替换成1.9之前的版本

2.2 使用插件jQuery Migrate,这个插件会恢复在更新版本中废弃的API

3.3 在jQuery文件之后,$.browser的代码之前 加载以下代码


jQuery.browser={};(function(){jQuery.browser.msie=false; jQuery.browser.version=0;if(navigator.userAgent.match(/MSIE ([0-9]+)./)){ jQuery.browser.msie=true;jQuery.browser.version=RegExp.$1;}})();

$.ajax

data封装不加入JSON.stringify(data),会变成字符串拼接,'name=vinxent&age=21',有点和get方法相像。

若使用JSON.stringify(data),则会传输json对象'{name;'vinxent', age:21}'。

所以,在一般场景来说,get方法无需JSON.stringify,post方法需要。

Jquery动态绑定事件


//Jquery绑定事件$('.div').click(function(){});//Jquery动态绑定事件$('.div').on('click',function(){});<-- 当页面动态刷新时,新加载的元素依然可以绑定事件 -->$(document).on('click','.div',function(){});

Jquery on绑定hover事件

不能用on处理hover事件,因为Jqueryhover事件是一个封装的事件,不是真正的事件。

所以使用mouseentermouseleave来代替鼠标悬浮和离开事件。


$(document).on('mouseenter', '.div', function() {
});$(document).on('mouseleave', '.div', function() {
});

Jquery获取时间并且格式化


Date.prototype.format = function(format) {/** eg:format="YYYY-MM-dd hh:mm:ss";*/var o = {"M+" :this.getMonth() + 1, // month"d+" :this.getDate(), // day"h+" :this.getHours(), // hour"m+" :this.getMinutes(), // minute"s+" :this.getSeconds(), // second"q+" :Math.floor((this.getMonth() + 3) / 3), // quarter"S" :this.getMilliseconds()// millisecond}if (/(y+)/.test(format)) {format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));}for ( var k in o) {if (new RegExp("(" + k + ")").test(format)) {format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k]: ("00" + o[k]).substr(("" + o[k]).length));}}return format;
}var startTime = new Date().format("yyyy-MM-dd 00:00:00");
var endTime = new Date().format("yyyy-MM-dd hh:mm:ss");

滚动条滚动底部

  • scrollTop([val]) 获取匹配元素相对滚动条顶部的偏移。

  • scrollLeft([val]) 获取匹配元素相对滚动条左侧的偏移。

  • scrollHeight 滚动条高度


$(".div").scrollTop( $(".div")[0].scrollHeight);

Jquery size( )和length

size()jQuery 提供的函数,而 length是属性。两者的取值是一样的。

页面之间传值

//页面一location.href = "href2.html?id=3";
   //页面二var _url = document.URL;var _urlParam = _url.split('?')[1];var _value = _urlParam.split('=')[1];

也可以使用jquery.params.js $.query.get("id");

### 灵活运用三目运算符

 (_list.equipStatus ==1?"运行中":(_list.repairStatus ==2?"维修中":"待确认"))

正确引用jQuery

  1. 尽量在body结束前才引入jQuery,而不是在head中。
    2.借助第三方提供的CDN来引入jQuery,同时注意当使用第三方CDN出现问题时,要引入本地的jQuery文件。
    3.如果在</body>前引入script文件的话,就不用写document.ready,因为这时执行js代码时DOM已经加载完毕了。

<body>  <script src="http://lib.sinaapp.com/js/jquery11/1.8/jquery.min.js"></script>  <script>window.jQuery  document.write('<script src="jquery1.8.min.js">\x3C/script>')</script>
</body>

优化jQuery选择器


<div id="nav" class="nav">  <a class="home" href="http://www.jquery001.com">jQuery学习网</a>  <a class="articles" href="http://www.jquery001.com/articles/">jQuery教程</a>
</div>

如果我们选择class为home的a元素时,可以使用下边代码:

$('.home'); //1

$('#nav a.home'); //2

$('#nav').find('a.home'); //3

  1. 方法1,会使jQuery在整个DOM中查找class为home的a元素,性能可想而知。
    2.方法2,为要查找的元素添加了上下文,在这里变为查找id为nav的子元素,查找性能得到了很大提升。
    3.方法3,使用了find方法,它的速度更快,所以方法三最好。

关于jQuery选择器的性能优先级,ID选择器快于元素选择器,元素选择器快于class选择器。因为ID选择器和元素选择器是原生的JavaScript操作,而类选择器不是。

缓存jQuery对象

缓存jQuery对象可以减少不必要的DOM查找,关于这点大家可以参考下缓存jQuery对象来提高性能。


// 糟糕
h = $('#element').height();
$('#element').css('height',h-20);// 建议
$element = $('#element');
h = $element.height();
$element.css('height',h-20);

使用子查询缓存的父元素

正如前面所提到的,DOM遍历是一项昂贵的操作。典型做法是缓存父元素并在选择子元素时重用这些缓存元素。


// 糟糕
var$container = $('#container'),$containerLi = $('#container li'),$containerLiSpan = $('#container li span');
// 建议 (高效)
var$container = $('#container '),$containerLi = $container.find('li'),$containerLiSpan= $containerLi.find('span');

精简jQuery代码

一般来说,最好尽可能合并函数。


// 糟糕
$first.click(function(){$first.css('border','1px solid red');$first.css('color','blue');
});
// 建议
$first.on('click',function(){$first.css({'border':'1px solid red','color':'blue'});
});

减少DOM操作

最小化DOM更新

重布局和重绘是WEB页面中最常见的也是最昂贵的两种操作。
当改变样式,而不改变页面几何布局时,将会发生重绘。隐藏一个元素或者改变一个元素的背景色时都将导致一次重绘。
当对页面结构进行更新时,将导致页面重布局。

//糟糕for(var i=0; i<10000; i++){$("#main table").append("<tr><td>aaaa</td></tr>");}//建议var tablerow = "";for(var i=0; i<10000; i++){tablerow  += "<tr><td>aaaa</td></tr>";}
$("#main table").append(tablerow);

prop和attr方法

对于元素自身的固有属性 使用 prop 对于自定义的属性使用attr方法

例:获取选中的checkbox的value值

$("input[type=checkbox]").each(function() {if(true == $(this).prop("checked")) {alert($(this).attr("value"));}});

each遍历

each实现全选或是取消全选。

$("#selectAll").click(function() {if($("#selectAll").prop("checked")) {$("#selectAll input[type=checkbox]").each(function() {$(this).prop("checked", "true");});} else {$("#selectAll input[type=checkbox]").each(function() {$(this).removeAttr("checked");});}});

layer.js

父页面和子页面传值

1.1 访问父页面值


// "id" 父页面元素
var parentId=parent.$("#id").val();

2.2 访问父页面方法


var parentMethod=parent.getMethod();

3.3 给父页面传值

// "id" 父页面元素parent.$('#id').text('');

4.4 关闭弹出的子页面窗口


//获取窗口索引  var index = parent.layer.getFrameIndex(window.name); //关闭弹出的子页面窗口  parent.layer.close(index);

5.5 子页面调用父页面刷新


parent.location.reload();

uploadify.js

error placeholder element

这是因为input 元素必须有id,并且用id初始化uploadify函数。否则就报错。

chart.js

Uncaught TypeError: Cannot read property 'length' of null

这个问题是因为js代码执行的时候canvas还没有被创建。可以将初始化图表代码片段放到window.onload后面


window.onload = function() {var ctx = document.getElementById("myChart");var lineChart = new Chart(ctx, {type: 'line',data: {labels: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],datasets: [{label: "2015",data: [10, 8, 6, 5, 12, 8, 16, 17, 6, 7, 6, 10]}]}})
}

The problem is that when your code executes, the canvas has not been created yet. You should wrap your code inside a function and assign that function to window.onload event. You can see the sample code below.

Cannot read property 'transition' of null

Try to call mychart.update() after setting the new data... that solved the problem for me.

Browser

Slow network is detected. Fallback font will be used while loading

新版本的Chrome在网络环境较差的时候会在控制台输出Slow network is detected. Fallback font will be used while loading,但有时会对调试造成不便,可以在chrome配置中禁用该项:

地址栏输入chrome://flags/#enable-webfonts-intervention-v2,并设置为Disabled;重启Chrome。

AngularJS

$sce

$sce is included by default starting with angular 1.2- so you don't need sanitize anymore in order to get $sce. So, with 1.2, you can pass $sce in as any other service. But make sure your angular is version 1.2 (in case you checked the sanitize version vs core).

获取body元素


// $document 服务$document[0].bodyangular.element(document).find('body')

防抖动输入


<body ng-controller="myCtrl"><div ng-app="App" ng-controller="Ctrl" class="app"><button ng-click="inc()">Add</button><span>{{ val }}</span></div><script>angular.module("App", []).controller("Ctrl", ['$scope', '$debounce', function($scope, $debounce) {$scope.shouldBeFocus = true;$scope.val = 0;$scope.inc = function() {$debounce(increase, 300);};var increase = function() {$scope.val++;}}]).factory('$debounce', ['$rootScope', '$browser', '$q', '$exceptionHandler',function($rootScope, $browser, $q, $exceptionHandler) {var deferreds = {},methods = {},uuid = 0;function debounce(fn, delay, invokeApply) {var deferred = $q.defer(),promise = deferred.promise,skipApply = (angular.isDefined(invokeApply) && !invokeApply),timeoutId, cleanup,methodId, bouncing = false;// check we dont have this method already registeredangular.forEach(methods, function(value, key) {if(angular.equals(methods[key].fn, fn)) {bouncing = true;methodId = key;}});// not bouncing, then register new instanceif(!bouncing) {methodId = uuid++;methods[methodId] = {fn: fn};} else {// clear the old timeoutdeferreds[methods[methodId].timeoutId].reject('bounced');$browser.defer.cancel(methods[methodId].timeoutId);}var debounced = function() {// actually executing? clean method bankdelete methods[methodId];try {deferred.resolve(fn());} catch(e) {deferred.reject(e);$exceptionHandler(e);}if(!skipApply) $rootScope.$apply();};timeoutId = $browser.defer(debounced, delay);// track id with methodmethods[methodId].timeoutId = timeoutId;cleanup = function(reason) {delete deferreds[promise.$$timeoutId];};promise.$$timeoutId = timeoutId;deferreds[timeoutId] = deferred;promise.then(cleanup, cleanup);return promise;}// similar to angular's $timeout canceldebounce.cancel = function(promise) {if(promise && promise.$$timeoutId in deferreds) {deferreds[promise.$$timeoutId].reject('canceled');return $browser.defer.cancel(promise.$$timeoutId);}return false;};return debounce;}]);;</script></body>

this in AngularJS


angular.module("App", []).controller("Ctrl", function($scope) {// this controllerconsole.log("controller",this);$scope.foo = function() {// this scopeconsole.log("foo",this);};var foo2 = function() {// this windowsconsole.log("foo2",this);}$scope.foo();foo2();});

angular.copy() angular.extend()

angular.copy(source, [destination]); // source: copy的对象. 可以使任意类型, 包括null和undefined. destination:接收的对象 返回复制或更新后的对象

  • 如果省略了destination,一个新的对象或数组将会被创建出来;

  • 如果提供了destination,则source对象中的所有元素和属性都会被复制到destination中;

  • 如果source不是对象或数组(例如是null或undefined), 则返回source;

  • 如果source和destination类型不一致,则会抛出异常。

angular.extend(destination, source);

  • 复制src对象中的属性到dst对象中. 支持多个src对象. 如果你不想改变一个对象,你可以把dst设为空对象{}: var object = angular.extend({}, object1, object2).

  • 注意: angular.extend不支持递归复制.

Git

push 需要输入用户名和密码

换成ssh方式


git remote -v // origin https://github.com/xxxxxx/xxxx.git (fetch)
// origin https://github.com/xxxxxx/xxxx.git (push)git remote rm origingit remote add origin git@github.com:xxxxx/xxxx.gitgit push origin

git默认用notepad++ 打开


git config --global core.editor "'D:\Notepad++\notepad++.exe' -multiInst -notabbar -nosession -noPlugin '$*'"

npm

npm WARN saveError ENOENT: no such file or directory ... package.json

npm init -f

生成一个package.json

React

render(, document.body);

warning.js:36 Warning: render(): Rendering components directly into document.body is discouraged, since its children are often manipulated by third-party scripts and browser extensions. This may lead to subtle reconciliation issues. Try rendering into a container element created for your app.


ReactDOM.render(<Greeter />, document.getElementById('react_container'));

转载于:https://www.cnblogs.com/chenjy1225/p/9661237.html

program collections相关推荐

  1. C#编程利器之五:集合对象(Collections)

    C#里面的集合对象,是一个很重要的知识点.可以说没有人编程不使用集合.这里我不打算过多的去介绍理论相关的知识,下面和大家分享和学习一下在平时开发中的常用集合对象,以及他们之间的关系. 记得教科书上有这 ...

  2. 类型实现《程序员的第一年》--------------C#中System.Collections.Generic.SortedDictionary 的使用...

    在改章节中,我们主要介绍类型实现的内容,自我感觉有个不错的建议和大家分享下 SortedDictionary<TKey,TValue> 类型参数 TKey 字典中的键的类型. TValue ...

  3. java collections 用法_Java Collections unmodifiableCollection()用法及代码示例

    java.util.Collections类的unmodifiableCollection()方法用于返回指定集合的​​不可修改视图.此方法允许模块为用户提供对内部集合的只读访问权限.对返回的集合&q ...

  4. Java Collections list()方法与示例

    集合类list()方法 (Collections Class list() method) list() method is available in java.util package. list( ...

  5. python的userlist_Python Collections.UserList用法及代码示例

    Python列表是array-like数据结构,但与之不同的是它是同质的.单个列表可能包含数据类型,例如整数,字符串以及对象. Python中的列表是有序的,并且有一定数量.根据确定的序列对列表中的元 ...

  6. Java Collections copy()方法与示例

    集合类的copy()方法 (Collections Class copy() method) copy() method is available in java.util package. copy ...

  7. Java Collections singletonMap()方法与示例

    集合类singletonMap()方法 (Collections Class singletonMap() method) singletonMap() method is available in ...

  8. Java Collections unmodifiableCollection()方法与示例

    集合类unmodifiableCollection()方法 (Collections Class unmodifiableCollection() method) unmodifiableCollec ...

  9. Java Collections BinarySearch()方法与示例

    集合类binarySearch()方法 (Collections Class binarySearch() method) Syntax: 句法: public static int binarySe ...

最新文章

  1. 衡量微型计算机的性能指标参数有哪些,衡量计算机性能的主要技术指标有哪些?...
  2. 中国AI又夺一冠!依图刷榜全球声纹识别挑战赛,刷新纪录,大比分夺魁
  3. 再次学习mysql优化
  4. nagios nrpe
  5. spring AbstractBeanDefinition创建bean类型是动态代理类的方式
  6. rem,em,px的区别
  7. 和县机电工程学校工业机器人_成都机电工程学校专业有哪些
  8. 「开源·共创·照亮」TDengine开源两周年暨灯塔计划发布会邀你一起闪耀
  9. 暑假前挑战赛1—— A,B题解
  10. Dynamics AX 2012 Manufacturing (Part 1)
  11. linux下c语言队列,C语言队列的实现
  12. jquery weui 上拉加载,下拉刷新,问题解答。
  13. 当你的MS OFFICE打不开时,安全模式也失效,来看我给你变戏法吧
  14. 安装IDEA 并创建快捷方式
  15. 免费注册的域名.tk
  16. CodeForces-1062E LCA,DFN,RMQ
  17. P1293 班级聚会
  18. Distill文章-A gentle introduction to graph Neural Networks(图神经网络是怎么构造的)
  19. iOS开发 UIBezierPath曲线动画
  20. 加入美团2021届北斗计划,用科技定义未来生活

热门文章

  1. android微信小程序支持横屏,微信小程序关于横屏存在的一些问题
  2. zookeeper linux 环境变量,zookeeper linux版安装
  3. 如何选择python书籍_如何选择一本优质的数据科学书籍
  4. php是独立服务吗,使用Sprockets作为PHP应用程序的独立服务
  5. oracle11g约束有哪几种状态,【简答题】数据完整性通常有哪几种类型, Oracle11g 通过哪些方式来进行数据完整性控制...
  6. LQ训练营(C++)学习笔记_广度优先搜索
  7. python2exe下载_py2exe下载 0.6.9.win32-py2.7-python转exe工具-pc6下载站
  8. 数学--数论--剩余系 与 完全剩余系 与 简化剩余系
  9. 如何在ubuntu 14.04系统下开启nfs网络文件系统
  10. PC串口DB9接口 示意图 (备忘)