목록Software Engineering (80)
Pure Software Engineer :)
리눅스 vi editor로 코딩하는게 익숙해서윈도우에서 gVim으로 개발하고 있다. gVim으로 파일을 저장하다 보니, 소스코드에 계속 BOM(Byte order mark)가 들어가는 현상이 있었다.이를 해결하는 방법은 생각보다 간단했다. // bom이 있는지 확인:set bomb? // bom 제거:set nobomb 이후에는 vimrc 파일에 set nobomb을 설정해놓고 사용중. Referenceshttps://wincent.com/wiki/Remove_BOM_marker_from_file_with_Vim
The literal 0 is an int, not a pointer. // three overloads of f void f (int); void f (bool); void f (void *); f(0); // call f(int), not f(void *) f(NULL); // might not compile, but typically calls f(int). Never calls f(void*) This counterintuitive is what led to the guideline for C++98 programmers to avoid overloading on pointer and integral types. That guideline remains valid in C++11, because,..
int x(0); // initializer is in parentheses int y = 0; // initializer follows "=" int z{0}; // initializer is in braces The use of an equals sign for initialization often misleads C++ newbies into thinking that an assignment is taking place, even though it's not. Widget w1; // call default constructor Widget w2 = w1; // not an assignment; calls copy ctor Widget w1 = w2; // an assignment; calls co..
C++은 이제 더이상 예전의 C++이 아니다. C++11 표준이 발표되고 C++14도 곧 나올것같은 상황에서 계속 공부를 하지 않으면 이게 C++ 코드나 맞나? 싶을 정도로 새롭게 변화하고 있다 Effective C++에 이어 C++11, C++14를 위한 Effective Modern C++이 최근 출간되었다. 우선 항목부터 정리해보고 조금씩 읽어 보자. 1. Deducing Types Item 1: Understanding template type deduction Item 2: Understanding auto type deduction Item 3: Understanding decltype Item 4: Know how to view deduced types 2. auto Item 5: Prefe..
Open Platform을 준비하면서 최근 OAuth 2.0 스펙을 공부하고 있다. RFC문서를 중심으로 보고 있는데, 내용을 조금씩 정리하고자 한다. Roles resource owner 리소스 소유자, 실제 리소스는 resource server에 존재 resource server Resource owner의 리소스를 가지고 있는 서버 client Resource owner를 대신해서 리소스에 접근하려는 제3의 Entity authorization server client를 인증해서 Resource owner를 대신해서 resource server에 요청할 수 있도록 access token을 발급하는 주체. 때로 resource server와 authorization server는 동일한 entity가..
회사에서 일을하면서 최근 Redis를 사용할 일이 생겼다. Redis는 key, value storage로 value로 다양한 자료구조를 제공한다는 장점이 있다. 어떤 자료구조를 사용하느냐에 따라 연산을 얼마나 빨리 수행하는지가 핵심이다. 여기서는 내가 사용할 자료구조와 자료구조를 통해 redis에 접근하기 위한 몇가지 연산들을 까먹지 않게 정리하고자 한다. set saddadd one or more members to a set sismemberdetermine if a given value is a member of a set smembersget all members in a set sremremove one or more members from a set hash hgetallget all the..
우분투 패키지 관리자 apt-get 명령어를 통해 node 를 설치했을시 최신버전이 아니라 old 버전이 설치된다. $ apt-get install nodejs // old 버전 node 설치 아무 생각없이 위의 명령으로 node 설치하고, express 설치하려했더니 버전이 안맞다는 에러가 나서 확인해 보니 최신버전이 아니었다. 최신 버전 node를 설치하려면 다음과 같이 한다. 배포판 : Ubuntu 12.04 $ apt-get install python-software-properties $ apt-add-repository ppa:chris-lea/node.js // 이 과정에서 계속 진행할건지 경고 문구가 나오는데 계속 진행하기 위해 ENTER $ apt-get update 위의 2번째 comm..
C++의 다형성(polymorphism)은 객체의 동작방식을 런타임(runtime)에 결정하도록 한다. 예를들어, Animal 클래스에 move() 함수가 있다면, 물고기는 헤엄, 강아지는 달리기, 새는 날아서 움직일 것이다. 이와 같은 실제 동물에 따른 행위가 컴파일시점에 결정하는것이 아니라 실행시간에 결정할 수 있다는것이 다형성의 개념이다. 하지만, 경우에 따라서 런타임때 두가지 이상의 타입에 따라 함수의 동작방식이 선택되야 할 경우가 있다. 예를들면, Animal 클래스에 어떤 동물이 다른 동물을 먹을수 있는지 반환하는 eats() 함수가 있다고 하자. 이때는 먹는동물과 먹히는 동물에 따라 eats의 결과가 달라져야 할 것이다. C++에서 언어차원에서 두개 이상의 타입을 런타임에 결정할수있는 방법을..