본문 바로가기

Tech

(37)
[DS] 스택 - Stack (개념 및 배열로 스택 구현하기) 스택은 후입선출(LIFO, Last-In, First-Out)의 원리에 따라 삽입과 삭제를 수행하는 자료구조입니다. 실생활에서 접시를 쌓아 둔 것과 비교할 수 있습니다. (접시를 층층이 쌓아 둘 때, 가장 먼저 쌓아 둔 접시는 맨 아래에 위치하게 되고, 나중에 쌓은 접시는 가장 위에 위치하게 되어 접시를 사용할 때 먼저 사용됩니다.) 스택은 구현이 쉬운 편이며 상당히 많은 분야에서 응용됩니다. 다음 그림은 스택이 어떻게 동작하는지를 나타낸 것입니다. C++에서 배열을 사용하여 간단히 스택을 구현하겠습니다. 이전에, 예외 처리를 위해 커스텀 예외 처리 클래스를 구현하였습니다. #ifndef RUNTIME_EXCEPTION_H #define RUNTIME_EXCEPTION_H #include using st..
CentOS 8에서 Docker CE 설치하기 개발용 서버 세팅을 위해 CentOS 8을 설치하였습니다. Reference : https://www.linuxtechi.com/install-docker-ce-centos-8-rhel-8/ How to Install Docker CE on CentOS 8 / RHEL 8 Server Docker is a daemon-based container engine which allows us to deploy applications inside containers. With the release of RHEL 8 and CentOS 8, docker package has been removed from their default package repositories, docker has been replaced..
[Angular] 의존성 주입을 위한 서비스 작성 서비스는 앵귤러에서 의존성 주입을 위해 사용되는 요소입니다. 컴포넌트에서 비즈니스 로직을 분리할 수 있지요. 서비스를 사용함으로써 컴포넌트에서 new를 통해 객체를 생성하지 않고 Injectable class에서 데이터를 얻어올 수 있습니다. Reference : https://angular.io/guide/dependency-injection Angular angular.io 의존성 주입(DI, Dependency Injection)이란 각 객체간의 결합을 느슨하게 만들어 프로그램이 의존성 역전(Dependency inversion)과 단일 책임 법칙(Single responsibility principle)을 따르게 설계하는 디자인 패턴을 의미합니다. 각 구성요소(혹은 객체)간의 관계를 해당 객체 내..
[Angular] 양방향 바인딩 (2-way binding) 지난번에 구성한 레이아웃에 이어 Departments 페이지에 대한 레이아웃도 비슷하게 구성하고 진행하겠습니다. 우선 departments.component.ts 파일에 Departments 리스트를 다음과 같이 import 해 줍니다. //departments.component.ts import { Component, OnInit } from '@angular/core'; import { Department } from './department'; import { DEPARTMENTS } from './departmentList'; @Component({ selector: 'app-departments', templateUrl: './departments.component.html', styleUrls..
추가 변수(혹은 임시 변수) 없이 SWAP 구현하기 일반적으로 배열 등에 있는 두 변수를 교환할때는 call by reference로 두 변수의 메모리 주소를 함수로 넘긴 다음, 다음과 같이 임시변수를 사용하여 값을 교환합니다. void swap(int *a, int *b) { int tmp = *a; *a = *b; *b = tmp; } 다음은 third variable인 tmp변수 선언 없이 두 값을 교환하는 방법들입니다. Reference : https://www.geeksforgeeks.org/swap-two-numbers-without-using-temporary-variable/ How to swap two numbers without using a temporary variable? - GeeksforGeeks Given two variabl..
맥에서 VS code로 C/C++ 빌드, 실행 개발 환경설정 맥에서 사용할 가벼운 C/C++ 에디터를 찾으려니 vs code가 답인것 같아서 혼자 세팅해본 과정을 글로 남기기로 했습니다. Download VS Code for MAC : https://code.visualstudio.com/download Download Visual Studio Code - Mac, Linux, Windows Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows. Download Visual Studio Code to experience a redefined code editor, optimized for building and debugging modern web ..
[Angular] UI 작업, 라우팅 (routing-module) 지난번에 구성한 오른쪽 레이아웃에 몇 가지 기능을 더 추가하고 라우팅 모듈을 작성할 것입니다. 그 전에 department component를 추가하고 employees component에 몇 가지 속성을 더 추가하겠습니다. 터미널 상에서 다음 명령어를 입력합니다. ng generate component departments 그리고 해당 컴포넌트 내에 Department 클래스를 정의합니다. //department.ts export class Department { id: number; name: string; } 리스트를 작성합니다. //departmentList.ts import { Department } from './department'; export const DEPARTMENTS: Depart..
맥에서 HEIC 이미지 JPG로 쉽게 변환하기 아이폰에서 이미지 저장공간 최적화를 선택하면 자동으로 파일 포맷은 .heic으로 변경됩니다. 에어드롭을 통해 해당 이미지를 맥으로 전송하면 .heic 포맷으로 전송되는데 이 포맷은 인터넷에 바로 업로드하지 못하는 경우가 많습니다. 이를 맥에 기본으로 설치된 Automator 프로그램으로 스크립트를 만들어 쉽게 변환하는 방법을 공유합니다. 원문 : https://www.howtogeek.com/398927/how-to-convert-heic-images-to-jpg-on-a-mac-the-easy-way/ How to Convert HEIC Images to JPG on a Mac the Easy Way Apple started using the HEIC image format with iOS 11. It..