博文

defer vs async in script

图片
The blue line means loading times. Ref: segmentfault. com/ q / 1010000000640869

Getting Started with Underscore.js

http://www.sitepoint.com/getting-started-with-underscore-js/

Efficient SQL Statements in Oracle

1. not in A: SELECT col1,col2,col3 FROM table1 a WHERE a.col1 not in (SELECT col1 FROM table2) B:SELECT col1,col2,col3 FROM table1 a WHERE not exists (SELECT 'x' FROM table2 b WHERE a.col1=b.col1) B:  is better than A. a<>0  to->  a>0 or a<0 a<>''  to->  a>'' 2. not null a>0 or a>'' is better than a is not null. 3.>= replace > A: SELECT … FROM DEPARTMENT WHERE DEPT_CODE >=0; B: SELECT * FROM EMP WHERE DEPTNO >3 A is better than B. 4.LIKE name LIKE '%jeck%'  should be name LIKE 'Xjeck%' OR YY_BH LIKE 'Bjack%' 5.EXISTS v DISTINCT A: SELECT DISTINCT DEPT_NO,DEPT_NAME FROM DEPT D , EMP E WHERE D.DEPT_NO = E.DEPT_NO B: SELECT DEPT_NO,DEPT_NAME FROM DEPT D WHERE EXISTS (SELECT 'X' FROM EMP E WHERE E.DEPT_NO = D.DEPT_NO); B is better than A 6. page A: select *   from (select a.*, rownum as rnum           from (select * from table1) a  ...

Datepicker z-index issue?

http://jqueryui.com/download/ Ref: http://stackoverflow.com/questions/11533161/jquery-ui-datepicker-change-z-index Solution:     var date2 = $( "#end_date" ).datepicker({    defaultDate: new Date(),    changeMonth: true ,    numberOfMonths: 1,    minDate: lastYear,    dateFormat: 'yy-mm-dd' ,    beforeShow: function () {        setTimeout( function (){             $( '.ui-datepicker' ).css( 'z-index' , 99999999999999);        }, 0);    }  });

Interface in Java 8

1.Default Methods in Interfaces Java 8 introduced a new keyword default. Now you’re allowed to write a default implementation of a method in the interface. Such a method won’t be considered abstract anymore, and you won’t be forced to implement it in your class. 2.Static Methods in Interfaces Starting from Java 8, interfaces are also allowed to include static methods, which are not specific to any instance and can be used only internally by other methods of the interface. public interface testInter { public void test1 ( int i ); public default void test2 ( int i ){ System . out . println ( "Default Method!" ); if(isJUNE()){System.out.println("There is a Static Method.");}  }; //S tatic Method,which are not specific to any instance //and can be used only internally by other methods of the interface. static boolean is JUNE (){ Month month = LocalDate . now (). getMonth (); if ( month ...

System.exit()

Exit code is 0 when execution went fine; 1 , -1 , whatever != 0 when some error occurred, you can use different values for different kind of errors. If I'm correct exit codes used to be just positive numbers (I mean in UNIX) and according to range: 1-127 are user defined codes (so generated by calling exit(n) ) 128-255 are codes generated by termination due to different unix signals like SIGSEGV or SIGTERM The following codes are from http://www.opensource.apple.com/source/Libc/Libc-320/include/sysexits.h. Note Ref: http://stackoverflow.com/questions/2434592/difference-in-system-exit0-system-exit-1-system-exit1-in-java sysexits.h    [ plain text ] /* * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Publ...

data-* in HTML5

Example: <article id="tu" data-category="Demo1" data-author="1"> ... </article> 1. In JavaScript :getAttribute() and dataset。   getAttribute     document.getElementById('tu').getAttribute('data-category');   setAttribute     document.getElementById('tu').setAttribute ( 'data-author' , '2' ) ;     var a = document.getElementById('tu');     a.dataset.category = "xxx";     a.setAttribute("data-category", "xxx");    dataset      var article = document.getElementById('tu');      var data = article.dataset;      alert(data.category);      alert(data.author); //1 2. jQuery   $("#tu").data('category');   $("#tu").data("category", "Uncategorized"); 3. CSS  attr    article::before {       content: attr(data-category);    }  article[data-author='1'...