ES6, class let ${}....

javascript 2017. 7. 20. 18:17

ES6_turorial.pdf  

ES6 javascript 는 지원되는 브라우저가 많지 않아서 그 사용용도가 제한적이지만.. 

   1. node.js를 이용한 서버개발

  2. 관리자 페이지 (브라우저를 제한 가능)

등에서 사용이 가능하다.

Babel을 사용하면 es6파일을 es5로 변환시켜 준다.  REF


기존 javascript대비 특이한 점들은....


1. class & extends 지원  ref

    - class constructor에( options 사용가능: json 형식)
    

2. let , const 지원  
    - let은 함수도 지정이 가능한 var로서
      let add = (a,b) => a+b    ref      (lambda도 지원)   =>이다. (java는 ->임) 

    -let은 block scoping이 된다. (가능하면 let을 써야겠군요)   REF (이하 3~5))

3. Promise   (java의 Future느낌) , 그리고     tutorial.pdf에 의하면 Map,Set도 지원. 
    - .resolve()  .reject()  .all() 등 

4. import  / export  : Babel등과 함께 사용: ref

5. template  :  ${변수}       let message = `Hello ${name}!`;  

6. module 지원: REF  (webpack의 기능을 일부 담당가능)


 배열을 파라미터로 전달. 
   - 
var data = [1,2]; function Test1(a,b)...; ==> Test1(...data) : (이경우 ...을 spread라고 부른다 REF)

   -  기존 parameter들은  지정하지 않아도, arguments변수에 자동으로 넘어갔지만
       (...args) => { console.log(args); }  지원.     (이경우 ...을 REST 파라미터 라고 부른다) 

Posted by yongary
,

Armeria with Thrift

network개발 2017. 7. 20. 16:46

REF  /server-thrift  /client-thrift      (기타  /client-decorator   /server-decorator  /client-custom-http-headers    )




<주요 class 들>  javadoc    pkg:  common.thrift,  server.thrift, client.thrift 


THttpService  :  (Thrift Http Service)


ThriftCompletableFuture  (extends CompletableFuture<java> implements AsyncMethodCallback<thrift> )




Posted by yongary
,

CompletableFuture implements Future, CompletableStage. (그래서 CompletableStage공부도 필요)



<CompleteFuture의 기본 함수들>

.complete(returnValue)

.completeExceptionally(exception)


.thenApply (Func)  : 결과값에 적용

.thenCompose (Func) : future에 적용?  - 이것 자체도 Task가 됨 (333p)

.thenCombine (Func)  :   A task결과와 B task결과를 이용한 연산가능.


.thenAccept(Consumer)



(static) .supplyAsync (  Supplier<R> )   R:ReturnType

첫번째 stream에서 CompletableFuture<String>의 List를 가지고 있지만,

List<String>을 원한다면 기다린 후, Future들에서 값을 가져와야 하는데, 이 일을 해주는게 join이다.

별도의 stream 루프로 처리해야 Parallel처리가 된다.. 안그러면 supplier->join->supplier->join 순차적처리가 됨. 


Posted by yongary
,

Mac북 사용시

Mac 2017. 7. 19. 23:40

$  top   -> 모니터링 화면이 뜨는데,   이 때 o를 입력하고 cpu라고 입력하면.. cpu많이쓰는 순서대로 정렬된다.



Posted by yongary
,

한글 REF성능개요    REF


  - angular과 달리, 단방향 data-binding임.


  


new Vue {     :html element를 하나 물고 있는 느낌의 객체.(물론 el없이 js ES6 class처럼 사용도 가능)

  el:  ,

   - template: ,

   

  props:  data전달 -  REF:vuejs.org  - $emit하고나서 props:로 데이타를 받음.

  data: ,

  created:  ,    //instance가 생성되고 나서 호출되는 hook.  REF'

    - mounted:
    - updated:
    - destroyed:  이런 hook들도 존재. 


  watch: 

  computed:  sort나 filter들을 적용해서 보여줄 수 있음.

   

  methods:

  validations:     ($v로 인용가능)


  components:    REF

}



- ajax요청시에는 axios 를 사용. REF

- vuelidate :  vue component의 validations: 을 check:  REF


- vue-loader : webpack에서 사용하는 loader로서, css후처리등도 가능하다고 하는데...   REF

- vee-validator 로 각종 html input등의 type/regex 체크 가능.   REF


(plugin) - plugin제작가이드 

- vue-router : 해당 component를  화면에 그려줌.     
- vuex : 전역변수                     routre/vuex REF



$router, $v (이하/위 참조),  $emit(현재 instance에 event trigger) 

========  API-list  =====================================================

:is <component :is="componentId"> <component v-bind:is="currentView">


v-for  REF

v-show

v-if

v-on:click   =>    @on(click) 으로 이벤트 감지. 
                           v-on:click="$router.push('/detail')":서브페이지로 이동.ps://router.vuejs.org

                  원복: $router.push('/')   REF:rotuter.vuejs.orghtt           

v-model   양방향 바인딩 지원.  angular.js 처럼  .sync 키워드 필요.  

v-bind

v-cloak

Posted by yongary
,

빌드자동화툴 gulp

javascript 2017. 7. 19. 18:10

REF


gulp는 js빌드자동화 툴로서, node.js를 기반으로 node의 스트림을 사용해서 동작한다.


 - gulpfile.js파일에 설정내용.

   gulp.src ([a.js, b.js...]);

   gulp.task(name, (선행잡), function)


$ gulp task-name  :시 특정 task 실행.



추가 API 한글 : REF

API Doc: REF





Posted by yongary
,

prmd

IT 2017. 7. 19. 17:18

JSON이나 yml파일들을 이용해 자동으로 document생성.  REF


$prmd combine --meta meta.yml schema | \

  

Posted by yongary
,

gradle

springBoot gradle 2017. 7. 19. 14:58

REF


compileOnly : 컴파일타임에만 사용됨-예)어노테이션라이브러리등   REF

    - maven의 provided와 동일.



  build.gradle  good_REF

        (gradlew build시)

      - jar, assemble  task을 통해 최종 jar파일을 생성할 수 있다.   REF  
           위치(build/libs)  및  jar 단독실행(java -jar xxxx.jar)   - ref

      



멀티 프로젝트: GOOD_REF   REF

 - 상위 프로젝트의 build.gradle에 모든 설정을 다 넣는다.


 - 상위 프로젝트의 settings.gradle파일에 sub프로젝트들을 지정한다.

   include "my:cms"

   project(':my:cms').name = 'my-cms'


- bootRepackage 는 보통 main이 없는 공통모듈용.





Posted by yongary
,

Thrift (apache RPC)

network개발 2017. 7. 14. 11:37

 IDL을 정의하고, 여러가지 언어로 skeleton코드변환이 지원된다.

  - Async지원 (TNonblockingServer)

  - multi-thread지원 (ThreadPoolServer)

  - Exception제공 

  


IDL 정의는 REF 참조.

   - namespace는 java의 경우, 그대로 package명으로 변환 됨.

  - service는 상속이 된다. (interface개념)

  - struct는 상속이 안됨.  (class개념) - 단  delegation은 됨(다른 struct포함 가능)

  - list, set, map이 지원 됨. 

  - constant, enum, typedef가 지원되면 typedef는 java의경우 replace형태로 변환된다.



간단한 통신예제 : REF

-  서버가 Async인 경우 client에서 TFramedTransport를 사용한다.  위 사이트에서 NobblockingClient 라는게,

    Nonblocking  서버에 접속하는  BlokcingClient이다. 



Thrift Protocol Stack 그림 - REF



Posted by yongary
,

SELECT /*%expand*/* FROM (


SELECT
*,

if(@code = service_code, @count := @count + 1, (@count := 0 || @code := service_code)) count

FROM

my_table

WHERE service_code="blabla"

ORDER BY service_code )

WHERE count <=9 ;


이러면 service_code별로 10건씩 소팅이 되서 나온다.   

oracle의 rownum하고 비슷하게 사용한 예제이지만,  service_code별로 번호를 새로시작하도록 한 코드이다. 

Posted by yongary
,