분류 전체보기
-
도커 쓰다가 버그 발견해서 제보하려고 했더니짧은경험기 2023. 6. 6. 01:16
도커 쓰다가 설정을 열면 문제가 생기는 버그를 발견해서 제보하려고 했더니 이미 제보 완료... 나 뿐만 아니라 많은 사람들이 겪은 버그였다. 해당 버그 깃허브 이슈 4.20 버전으로 업데이트 되면서 도커 데스크톱에서 wsl의 버전을 가져오지 못해서 생긴 버그라고 한다. 아래는 해당 버그가 발생한 지점이다. [com.docker.backend.exe][E] getting WSL version: executing wsl --version: exit status 0xffffffff [2023-05-31T07:33:22.691488800Z][GoBackendProcess][I] 실시간으로 경험한 버그가 이슈로 등록되어 해소되는 과정이 신기해서 기록으로 남긴다. --------- fix되었다.
-
정규식 연습간단기법 2023. 6. 2. 19:38
기본 /패턴/플래그 패턴 /abcd/ // 문자열에 "abcd"가 있는지 찾는다. 플래그 i // 대소문자 구별 안함 g // 매칭 되는 모든 부분을 찾음 복잡한 패턴 정규식을 쓰는 이유. 알파벳만, 숫자만, 어떤 문자열로 시작해서 어떤 문자열로 끝나는지 지정 등등. 정규식을 조합하여 복잡한 패턴의 문자열을 특정할 수 있다. 이를 위해 정규식은 다양한 특수 문자를 지원한다. Metacharacters(메타 문자) 특별한 의미를 지닌다 cat|dog|fish cat 또는 dog 또는 fish . 어떤 캐릭터든지 \d digit \D non-digit \s white space \S non-white space \w alpha numreic \W non alpha numeric Quantifier(수량 지정..
-
JS 문득 궁금한거 생길때 정리간단기법 2023. 6. 2. 04:03
for ... of for ... of 문은 iterable object에서 순차적으로 데이터에 대하여 연산을 실행한다. iterable object에는 Array, String, NodeList 등이 존재하며 arguments 오브젝트와 제너레이터 함수로 생성한 제너레이터 오브젝트도 해당한다. 아래 코드는 제너레이터로 생성한 오브젝트를 이용하여 for ... of 문을 실행하고 있다. const log = console.log; function* filter(f, list) { for (const a of list) { if(f(a)) yield a; } } for(const a of filter(a => a%2, [1,2,3,4,5])) { log(a); } iterable object iterabl..
-
PHP 에러 핸들링간단기법 2023. 5. 24. 18:19
PHP 에러 핸들링 PHP에는 error, fatal error, exception이 있다. 이름이 비슷한 error와 fatal error의 차이는 스크립트를 당장 중단하냐 마냐의 것이다. exception은 비교적 나중에 나온 것으로 다른 언어랑 비슷하게 예외를 던져서 try-catch로 핸들링할 수 있는 매커니즘이다. PHP는 버전이 올라감에 따라 error, fatal error의 상당 부분을 exception으로 다룰 수 있게 되었다. PHP의 에러 핸들링 방침은 exception으로 보인다. Error 다음은 PHP의 에러를 다루는 함수이다. set_error_handler('에러핸들러함수이름', E_ALL); trigger_error(msg, err_level); set_error_handl..
-
에러 핸들링, PHP, mysqli, prepared statement간단기법 2023. 5. 17. 16:40
PHP mysqli prepared statement 에러 핸들링 PHP에서 데이터베이스를 다루기 위해서 mysqli과 prepared statement를 이용한 코드를 작성한다. 다음과 같은 코드 구조가 일반적이다. // db에 연결하여 데이터를 조작하려면 다음과 같은 코드가 필수로 필요하다. 이 코드를 그대로 쓸 수는 없다. 왜냐하면 에러 핸들링이 전혀 안되어있기 때문이다. 에러 핸들링을 적용한 코드로 바꿔보자. // db에 연결하여 데이터를 조작하려면 다음과 같은 코드가 필수로 필요하다. 각 단계의 호출마다 리턴값을 확인하여 에러를 체크하는 코드가 들어간다. 상상만 해도 번거롭다. 그리고 이것이 끝이 아니라 mysqli 드라이버에 에러를 어떻게 대할 것인지 설정하는 것에 따라 에러가 발생하면 경고가..
-
PHP 문득 궁금한거 생길때 정리간단기법 2023. 5. 16. 06:13
코드를 재사용하는 방향성 PHP의 코드 재사용 방식은 다른 파일을 포함하여 이루어진다. 위 코드처럼 문자열 변수를 이용하여 PHP파일을 동적으로 포함하여 사용하는 방식이 쓰인다. PHP는 클래스를 생성하기 위해서 동적인 문자열을 사용할 수 있는 점을 활용한다. 위 코드가 구조적인 형상을 갖추기 위해서 오토로드를 사용하는 방법이 있다. spl_autoload_register 함수로 클래스를 가져오는 방법을 한 번 등록해 주면, 클래스를 불러올 때마다 명시적으로 require_once 같은 포함 구문을 사용하지 않아도 된다. 예를 들어, App\Modesl 디렉토리 안에 Post클래스가 있고, 루트 디렉토리에 index.php 파일이 있다고 해보자. // index.php. 루트경로이다. Post클래스는 현..
-
도커를 이용하여 PHP 개발 환경 설정하기분석과탐구 2023. 5. 3. 19:59
도커를 이용한 PHP 개발 환경 구축의 이점 도커를 이용한 개발, 배포 환경 구성의 이점은 무엇일까. 재사용하기 좋다는 것이 가장 크지 않나 싶다. 재사용하기 좋다는 것은 다음과 같다. 한 명의 프로그래머가 도커 기반으로 개발환경을 꾸미면 나머지 사람들은 그대로 사용하면 된다. 나머지 사람들은 같은 팀원일 수도 있고 미래의 내가 될 수도 있다. 그리고 이렇게 올려놓은 개발환경에 설정파일을 바꿔 서비스에도 올릴 수 있고. 개발환경을 꾸민다는 것은 단순히 IDE만을 설치하는 것이 아니라 프로그램을 실행하기 위한 라이브러리나 시스템 도구, 런타임 등 필요한 것들을 구성하는 것을 의미한다. 따로 세팅을 한다면, 똑같은 일을 여러 번 반복하게 되어 시간이 낭비된다. 그리고, 시스템에 기본적으로 적용된 버전 차이에..
-
CDN은 어떻게 저비용으로 콘텐츠를 전달하나분석과탐구 2023. 5. 3. 05:38
CDN은 어떻게 저비용으로 콘텐츠를 전달하나-ChatGPT 어떻게 이것이 가능한가. chatgpt에게 물어보았다. CDNs also employ techniques such as compression and minification of content, as well as image optimization, to reduce the size of the content being delivered, further reducing the load on the network and improving the speed of delivery. Additionally, CDNs typically have agreements with internet service providers (ISPs) that allow th..