React에서 컴포넌트의 생명 주기를 다룬 깃허브 글이 있어 소개한다.

http://busypeoples.github.io/post/react-component-lifecycle/



초기화를 하면 다음과 같은 순서대로 리액트 함수가 호출된다.




GetDefaultProp  =>  GetInitialState  => ComponentWillMount => Render => ComponentDidMound




state를 변경하면  다음과 같은 순서대로 리액트 함수가 호출된다.





props를 변경하면 다음과 같은 순서대로 리액트 함수가 호출된다.




unmount가 되면 다음 리액트 함수가 호출된다. 




개발해보니 react 컴포넌트가 로딩되기 전, 후에 작업은 componentWillUnmount, componentWillMount를 사용할 때가 가장 많이 사용되는 것 같다. 

Posted by '김용환'
,


fluentd의 filter/record안에서는 예약어가 존재한다.



https://docs.fluentd.org/v0.12/articles/filter_record_transformer



<filter foo.bar>
  @type record_transformer
  <record>
    hostname "#{Socket.gethostname}"
    tag ${tag}
  </record>
</filter>


요청이 다음과 같이 들어오면.. 


{"message":"hello world!"}

hostname과 tag가 추가된다.

{"message":"hello world!", "hostname":"db001.internal.example.com", "tag":"foo.bar"}




중간에 Parameter 내용을 보면.. 


record 디렉티브 하위에 tag_xxx, tag, time, hostname을 사용할 수 있다고 한다.


예를 들어 time을 통해 발생 시간이 넘어온다.






Parameters

<record> directive

Parameters inside <record> directives are considered to be new key-value pairs:

<record>
  NEW_FIELD NEW_VALUE
</record>

For NEW_FIELD and NEW_VALUE, a special syntax ${} allows the user to generate a new field dynamically. Inside the curly braces, the following variables are available:

  • The incoming event’s existing values can be referred by their field names. So, if the record is {"total":100, "count":10}, then record["total"]=100 and record["count"]=10.
  • tag_parts[N] refers to the Nth part of the tag. It works like the usual zero-based array accessor.
  • tag_prefix[N] refers to the first N parts of the tag. It works like the usual zero-based array accessor.
  • tag_suffix[N] refers to the last N parts of the tag. It works like the usual zero-based array accessor.
  • tag refers to the whole tag.
  • time refers to stringanized event time.
  • hostname refers to machine’s hostname. The actual value is result of Socket.gethostname.




'Cloud' 카테고리의 다른 글

[k8s] postgresql 운영 - stateful (펌질)  (0) 2018.01.25
[fluentd]의 fluent-plugin-forest(forest)  (0) 2018.01.22
NIFI의 provenance 의 drop event  (0) 2017.12.12
NIFI 팁  (0) 2017.12.08
[nifi] tail -> cassandra 저장 예제  (0) 2017.12.01
Posted by '김용환'
,



React에서 부모 컴포넌트의 state를 자식 컴포넌트의 state로 이동시킬 수 있는 방법은 다음과 같다.


https://ourcodeworld.com/articles/read/409/how-to-update-parent-state-from-child-component-in-react



class Parent extends React.Component {
    constructor(props) {
        super(props)

        // Bind the this context to the handler function
        this.handler = this.handler.bind(this);

        // Set some state
        this.state = {
            messageShown: false
        };
    }

    // This method will be sent to the child component
    handler() {
        this.setState({
            messageShown: true
        });
    }

    // Render the child component and set the action property with the handler as value
    render() {
        return <Child action={this.handler} />
    }
}




class Child extends React.Component {
    render() {
        return (
            <div>
                {/* The button will execute the handler function set by the parent component */}
                <Button onClick={this.props.action} />
            </div>
        )
    }
}



일반 함수로 리턴할 수 있어서 좋다. 




https://www.quora.com/Why-doesnt-React-automatically-allow-child-components-to-call-setState-of-the-parent-component


  1. class ParentComponent extends React.Component {
  2. onClick() {
  3. const _childValue = this.state.childValue;
  4. this.setState({ childValue: _childValue + 1 });
  5. }
  6. render() {
  7. return (<ChildComponent value={this.state.childVvalue} onClick={this.onClick.bind(this)} />)
  8. }
  9. }
  10. class ChildComponent extends React.Component {
  11. render() {
  12. return (
  13. <span>
  14. <div>My value: {this.props.value} </div>
  15. <button onClick={this.props.onClick}>Increment</button>
  16. </span>
  17. )
  18. }
  19. }



Posted by '김용환'
,



일리노이주 주립 대학의 coursera CS master 강의가 떠서 확인해보았다. 





https://cs.illinois.edu/admissions/graduate/degree-program-options



학부 성적은 3.2가 되어야 한다





https://cs.illinois.edu/admissions/graduate/applications-process-requirements


등록 절차

- 추천서

- 공부 목적 

- 이력서


등등




https://cs.illinois.edu/additional-required-application-materials-international-students



A passing score on the TOEFL iBT (spoken portion of the exam only) is 24/30. And, a passing score on the IELTS (on the spoken portion of the exam only) is 8.



역시 영어를 잘해야 하나 보다.. 


Posted by '김용환'
,