728x90 Ubuntu에 docker 설치하기 https를 통해 Docker 저장소에 액세스 할 수 있도록 일부 종속성을 설치해야 된다. sudo apt-get install apt-transport-https ca-certificates curl gnupg2 필요한 모든 종속성이 설치되면 밑의 명령어를 통해 Docker의 GPG 키를 다운로드하고 추가한다. curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - Docker 저장소를 추가한다. sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable" apt-get의 reposito.. 2022. 3. 24. Ubuntu에서 sudoers에 사용자가 없다는 오류가 날 때 sudo apt update -y 위의 명령어로 우분투의 패키지 목록을 업데이트해주려고 했는데, 밑과 같은 오류가 났다. username is not in the sudoers file. This incident will be reported. 사용자가 sudoers file에 없어서 sudo 명령어를 쓸 수 없는 상황이었다. sudoers file에 가서 username를 추가해주면 되는데 sudo 권한이 없어 sudoers file도 write 권한으로 열 수 없었다. sudo 권한을 가지고 있는 root 계정으로 가서 sudoers file에 username를 추가해주기로 했다. grep /bin/bash /etc/passwd 위의 명령어를 통해 사용자 정보를 확인한다. 확인한 사용자 정보와 밑의 .. 2022. 3. 23. virtualBox에 debian buster 설치하기 debian buster(10) 설치 (11버전은 Debian bullseye이다. 10 버전을 잘 확인하고 다운받자!) http://cdimage.debian.org/cdimage/archive/10.9.0/amd64/iso-cd/ Index of /cdimage/archive/10.9.0/amd64/iso-cd What's in this directory? These are files containing the installer and other software for the Debian GNU/Linux operating system. The files in this directory are specifically for the amd64 architecture. How do I use these .. 2022. 3. 23. CPP 4가지 타입 변환 연산자 (Casting) CPP에서는 안전한 casting을 보장하기 위해 casting을 도와주는 4가지 타입 변환 연산자가 있다. ( static_cast, dynamic_cast, const_cast, reinterpret_cast ) 1. static_cast - 실수와 정수, 열거형과 정수형, 실수와 실수 캐스팅 가능 - 컴파일 타임에 형 변환을 하기 때문에 컴파일 당시 오류를 확인할 수 있는 장점이 있다. static_cast (바꿀 대상) 밑과 같이 부모를 private, protected로 상속받을 경우에는 캐스팅이 되지 않음! class A { }; class B : A { }; int main() { A aa; B bb; // 둘 다 불가능 aa = bb; aa = static_cast(bb); } 부모를 pu.. 2022. 3. 20. CPP template c언어에서 min이라는 함수를 만들 때, 아래 코드와 같이 파라미터로 int를 받는 함수, double를 받는 함수를 각기 만들어 줘야 되는 불편함이 있었다. int min(int a, int b) { return a > b ? b : a; } double min(double a, double b) { return a > b ? b : a; } cpp에서는 template을 통해 여러 가지 data type를 유동적으로 받을 수 있는 함수를 만들 수 있다!!! 위의 예제 코드와 같이 데이터 형 별로 함수를 따로 만들어줘야 됐는데 template를 사용하면 밑의 코드와 같이 하나만 만들어도 모든 데이터 타입에서 사용할 수 있다!! template T min(T a, T b) { return a > b ? .. 2022. 3. 18. PlatformIO version 확인 PlatformIO 버전을 확인하려고 했는데, PlatformIO Home이라는 애의 버전과 PlatformIO Core라는 애의 버전 두 가지가 존재했다. PlatformIO Home과 PlatformIO Core의 차이점에 대해 찾아봤다! PlatformIO Home은 간단하게 User Interface다. PlatformIO의 여러 가지 기능을 편하게 사용할 수 있게 해주는 프로그램이다. PlatformIO Core와 PlatformIO IDE는 PlatformIO Home에 빌트인 되어 있는 기능들이다. 결론적으로 PlatformIO Home은 PlatformIO Core와 PlatformIO IDE을 포함하고 있다. https://docs.platformio.org/en/latest/home/i.. 2022. 3. 11. CPP 부모클래스에서 virtual 함수가 하나라도 있으면 소멸자도 무조건 virtual? cpp 공부를 하며 여러 가지 테스트를 진행 중, 이상한 상황을 발견했다! class A { A() {}; ~A() {}; virtual void test1() {}; }; class B : A { } int main() { A a = new B(); delete a; } 위와 같이 코드를 적었을 때 컴파일 오류가 난다. 원래 업 캐스팅을 할 때는 자식 클래스의 소멸자가 호출되지 않기 때문에 부모 클래스의 소멸자를 virtual로 설정해서 가상 함수 테이블을 만들어 줘야 된다. 부모 클래스의 소멸자를 virtual로 설정하는 것이 좋다~이지 필수는 아니라고 알고 있어서 위의 코드에서 컴파일 오류를 마주했을 때 왜 오류가 뜨는지 몰랐다. 밑에 코드와 같이 A class(부모)에서 virtual 함수가 없으.. 2022. 3. 10. leetcode 2) Add Two Numbers LV. Medium 🧐 https://leetcode.com/problems/add-two-numbers/ Add Two Numbers - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains.. 2022. 3. 10. leetcode 799) Champagne Tower LV. Medium 🧐 https://leetcode.com/problems/champagne-tower/ Champagne Tower - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 We stack glasses in a pyramid, where the first row has 1 glass, the second row has 2 glasses, and so on until the 100th row. Each glass holds one cup of .. 2022. 3. 4. leetcode 338) Counting Bits LV. Easy 😎 https://leetcode.com/problems/counting-bits/ Counting Bits - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 Given an integer n, return an array ans of length n + 1 such that for each i (0 2022. 3. 1. 이전 1 2 3 4 5 6 7 ··· 17 다음 728x90