묻고 답해요
158만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨Slack 클론 코딩[백엔드 with NestJS + TypeORM]
try문 밖에서 에러 발생시 트랜잭션이 release가 안됩니다.
12:00 시작된 join 매서드를 만들고 실행을 시켜보니 에러 처리를 하면 커넥션 pool이 종료되지 않는거 같습니다. 이메일이 중복된 user를 insert하려 할 때 new ForbiddenException이 실행이 됩니다. 하지만 finally문이 실행이 안되는거 같습니다.async join(email: string, nickname: string, password: string) { const queryRunner = this.dataSource.createQueryRunner(); await queryRunner.connect(); await queryRunner.startTransaction(); const user = await queryRunner.manager .getRepository(Users) .findOne({ where: { email } }); if (user) { throw new ForbiddenException('이미 존재하는 사용자입니다'); } const hashedPassword = await bcrypt.hash(password, 12); try { const returned = await queryRunner.manager.getRepository(Users).save({ email, nickname, password: hashedPassword, }); const workspaceMember = queryRunner.manager .getRepository(WorkspaceMembers) .create(); workspaceMember.User = returned.id; workspaceMember.Workspace = 1; // throw new NotFoundException('롤백해봐'); await queryRunner.manager .getRepository(WorkspaceMembers) .save(workspaceMember); await queryRunner.manager.getRepository(ChannelMembers).save({ User: returned.id, ChannelId: 1, }); await queryRunner.commitTransaction(); return true; } catch (error) { console.error(error); await queryRunner.rollbackTransaction(); throw error; } finally { console.log('이거 실행됨?'); await queryRunner.release(); } }'이거 실행됨?' 이라는 문자가 출력이 되지 않습니다. 여러번 반복한 후 pgAdmin에서 database activity를 살펴보니 커넥션 pool이 release되지 않고 idle 상태로 되어있습니다.이 때문에 서버의 pool이 가득차서 서버가 종료됩니다. user의 중복검사도 try문 안에 넣으면 해결되는거 같습니다. 🟩 혹시 존재하는 사용자 로직을 try문 밖에 빼신 이유가 있는지 궁금합니다.
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
4-D 매개변수로 넘기면 왜 안빼도 되는거죠?
ㅠㅠ
-
미해결프로그래밍 시작하기 : 도전! 45가지 파이썬 기초 문법 실습 (Inflearn Original)
phonebook project (name_check, json)
안녕하세요~ 2가지 질문 드립니다. def add_member(d) 함수를 만들 때 name_check를 넣으셨는데, 없어도 함수를 돌리는 데에는 문제가 없어 보입니다. 중간에 체크를 넣으신 이유가 있을까요? json 파일은 'a+' 모드가 없고 'r'과 'w'만 가능한 것으로 알고 있습니다. 초반에 'r'로 읽어오고 종료하기 직전에 'w'로 쓰고 종료해도 괜찮을까요?with open ('../source/45-1.json', 'r') as file: phonebook = json.load(file) < 1~3 중간 내용 동일 > elif menu == '4': with open ('../source/45-2.json', 'w') as out: json.dump(d, out) print('Exit') break
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
1-N 곱셈 모듈러 관련 문의드립니다.
안녕하세요:)본 문제의 재귀 함수(go 함수) 안에서, b가 홀수인 경우 ret = ret * a % c; 가 되어야 하는 부분에 대해 한번 더 %c 연산을 하지 않아도 되는지 문의드립니다. 예를 들어 (a^5)%c의 경우, [{(a^4)%c}{a%c}]%c 와 같다고 이해했습니다. 이때 b=5 이므로 if(b%2) 에 걸리는데, ret가 (a^4)%c 인 상황에서 (a%c)%c 만큼 추가로 곱해줘야 성립이 되는게 아닌지 궁금합니다!( 만일 (a^4)%c 에 (a%c) 만 곱한다면 그 값이 c 보다 커져서 나머지 연산을 한번 더 해야할 경우도 있지 않나요? ) 감사합니다 :)
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
1-A 일곱 난쟁이 next_permutation 코드 관련 질문드립니다
안녕하세요:)일곱난쟁이 문제에서 "결과값을 오름차순으로 출력" 해야하는 부분과 관련하여 문의드립니다.next_permutation을 활용하여 경우의 수를 뽑는 경우에, 앞에서 부터 7개 순열을 잘라서 보면 어떤 것은 오름차순으로 되어있지 않은데 혹시 만일 그러한 순열이 답이 되는 경우 sort로 정렬을 다시 안해줘도 되나요? 예를 들어, 본 문제 테스트케이스의 경우[ 7 8 10 13 19 20 23] 이라는 값이 딱 sum이 100인 경우여서 오름차순 그대로 값이 출력이 되지만.. 만약 [7 8 10 13 15 25 19] 가 답이었다고 가정한다면 .. 오름차순이 안되는게 아닌지 해서요! 감사합니다:)
-
미해결
수강기간 연장 부탁드립니다
안녕하세요 강사님,강의 신청해두고 일이 바빠 못듣고 있었는데들으려고 보니 기한이 임박해져서.. 죄송하지만 수강기한 연장 부탁드려도 될까요..?
-
해결됨Google 공인! 텐서플로(TensorFlow) 개발자 자격증 취득
강의 ppt 자료는 어디서 받을 수 있는지요?
강의 ppt 자료는 어디서 받을 수 있는지요? 필기하면서 보고 싶은데 도저히 못 찾겠네요.
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
3-Q 이렇게 하면 안되는 이유가 뭘까요
http://boj.kr/48d6be65693f4801bc29d65346739e1a
-
해결됨[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)
대응표본검정 실습문제 중 심화문제
제공해주신 쥬피터노트북에서 귀무가설의 부등호 방향이 반대인 것 같은데 혹시 맞을까요?
-
미해결현업 실무자에게 배우는 Kaggle 머신러닝 입문 - ML 엔지니어 실무 꿀팁
강의자료
강의 자료 어딧나요 실습자료 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
-
미해결
What are the Best Resources to Locate IELTS Classes Near Me?
Finding IELTS (International English Language Testing System) schools nearby can be crucial if you're studying for this well-known English language competence test. A high IELTS score might lead to endless international opportunities.If you are looking for 'IELTS classes near me' - then AbroAdvice.com has everything you need. However, if you are looking for signs on how to locate the best IELTS courses, then here they are:IELTS official websiteA trustworthy place to start is the official IELTS website (ielts.org). It provides thorough details regarding the test, test locations and approved test prep companies.Find IELTS test centers that are officially registered. Continue reading to know more about study abroad counseling.Online learning platformsIELTS exams are conducted 48 times a year meaning students have more than one opportunity to crack it. To make it convenient consider enrolling in IELTS prep courses online when you are flexible.These portals provide a selection of courses and training resources.Social Media and ForumsJoin neighborhood Facebook groups, Reddit forums, or discussion boards. There you can get suggestions and guidance on IELTS courses nearby.Language Schools and InstitutesNearby language schools or institutes frequently offer IELTS preparation classes. Look for reputable universities with knowledgeable faculty.Colleges and UniversitiesCertain universities and colleges provide IELTS preparation classes to assist prospective students in meeting language requirements. Check with local institutions.Use well-known search engines like Google to look up "IELTS classes near me" or "IELTS preparation courses in [your location]." There are several selections available, along with reviews and ratings.Educational Directories Language schools and tutoring facilities are frequently listed in online directories like Yelp, Yellow Pages, or educational websites. Search for the nearest selections while reading reviews.Groups on MeetupFind language exchange and English-learning groups. Some of these organizations also plan IELTS prep courses.Visit your neighborhood library or community center to see if they provide language or exam preparation programs. They might offer no-cost or inexpensive classes.Tutoring ServicesLook for private IELTS tutors in your neighborhood who can offer customized, one-on-one training. You can discover tutors using websites like Wyzant and Preply.Inquire about ReferralsAsk friends, relatives, coworkers, or classmates who may have participated in IELTS preparation programs for recommendations. Personal recommendations can be beneficial.Local publicationsSome IELTS education providers may run advertisements in regional publications. Look for listings in the classifieds.Find people in your neighborhood who speak English well. Those who are interested in language exchange as language exchange partners can give you promising leads. They can offer advice or suggest classes.Visit Language Schools DirectlyTake the time to go directly to language schools or institutions to meet the staff. Check out the surroundings, and evaluate the level of instruction.Visiting and seeing the authenticity of yourself can help you make better decisions.Selecting the best local IELTS class might improve your chances of getting the target IELTS score. Take no risks with it and ensure you are picking a good site. Follow the tips mentioned above to ensure you pick the best centre.
-
미해결홍정모의 따라하며 배우는 C++
접근지정자와 상속
#include <iostream> #include <cstdio> using namespace std; class Parent { public: Parent() { this->parent_pri = 2; } virtual void pri_print() { printf("%d", parent_pri); } private: int parent_pri; }; class Public_Child : public Parent{}; int main() { Public_Child public_child; public_child.pri_print(); } 이거를 실행하면 비쥬얼 스튜디오에서 2가 출력이 되는데, 클래스 밖의 main 함수에서 public_child.pri_print()에 접근할 수 있는 이유가 public 이기 때문이고, 그 public안의 pri_print함수는 클래스 Parent의 멤버 함수이기 때문에 private로 지정되어 있는 parent_pri에 접근할 수 있기 때문인가요?
-
미해결처음 만난 리액트(React)
chapter_04 시계만들기에서 오류가 납니다ㅠㅠ
설명보고 따라하였는데 시계가 아닌 오류문구만 뜹니다..무엇이 문제일까요?ㅠㅠ
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
3-L 이렇게 풀면 왜 안될까요?
ㅠㅠhttp://boj.kr/4d01aaf298574b598ed3f4d4412788fc
-
미해결[LV1] Jetpack Compose - UI 연습하기
강사님 닉네임에 생각나는 것이 있어용 ^^
포항에 가니 죽도시장에 개복치회가 있던데 혹시 고향이 포항부근이신감유 *.^
-
해결됨NAVER Cloud Boot Camp - 네이버 클라우드 부트 캠프
linux 계정 변경 후 접속 방법 추가 설명 요청
리눅스 서베에 접속할 때 생성한 키 파일을 이용해서 관리자 비밀번호를 표시하고, 이를 이용해서 로그인하는 방식으로 설명이 되어 있습니다.보안상 root 계정 접속을 막고 새로 만든 계정으로 접속을 하라고 설명을 하셨는데요.새로 만든 계정과 키 파일을 어떻게 연결을 해서 접솓을 하는지에 대한 설명이 없습니다.이 부분에 대해서 추가 설명 부탁드립니다.또한, 서버를 생성할 때 계정을 지정할 수 있는 방법이 있다면 이 부분도 설명 부탁드립니다.
-
미해결함수형 프로그래밍과 JavaScript ES6+
fxts를 배워보려고 합니다.
안녕하세요. 이번에 회사에서 함수형 프로그래밍을 해보려고 하는데, fxts를 사용하려고 합니다.이 강의는 fxjs를 다루고 있는데, fxts를 사용하려 할때도 도움이 될까요?감사합니다.
-
해결됨AWS(Amazon Web Service) 입문자를 위한 강의
[4-5] RDS 실습 - 1부 수업자료
안녕하세요RDS 실습하니깐 안돼서 질문 쪽으로 와봤는데 버전이 바뀌면서 함수이름이 바뀐거같네요. 질문도 같은거 여러개라 그런데 수업자료도 같이 고쳐주실수있을까요?#!/bin/bashyum install httpd php php-mysql -yyum update -ychkconfig httpd onservice httpd startecho "<?php phpinfo();?>" > /var/www/html/index.phpcd /var/www/htmlwget https://aws-learner-storage.s3.ap-northeast-2.amazonaws.com/connect.php connect. php<?php$username = "awslearner";$password = "awslearner";$hostname = "yourhostnameaddress";$dbname = "awslearner";// connection to the database$dbhandle = new mysqli($hostname, $username, $password, $dbname);if ($dbhandle->connect_error) {die("MySQL에 연결할 수 없습니다: " . $dbhandle->connect_error);}echo "MySQL 접속 성공!<br>";// Later, when done with the database connection$dbhandle->close();?> yum install httpd php php-mysql -ywget https://aws-learner-storage.s3.ap-northeast-2.amazonaws.com/connect.php이부분 고쳐야하는건 알겠는데 마지막 줄은 어떻게 바꿔야할지 모르겠어요
-
해결됨그림으로 쉽게 배우는 자료구조와 알고리즘 (심화편)
AVL 트리 회전 질문
안녕하세요. 선생님~[AVL트리 - 개념] 강의 - 회전 관련 질문있습니다.7:00 즈음LL회전, RR회전 펼져있는 노드 이미지가 반대로 된것 아닌지? 궁금합니다.헷갈려서 검색해보니LL이라는 용어가 회전할 기준이 되는 노드의 왼쪽 노드, 그 다음 왼쪽 노드형태에서 오른쪽으로 회전해서 균형을 맞추자!로 대체적으로 설명이 되어있는것같습니다.(이미지로는 왼쪽으로 쭉 내려가는 이미지)위키백과에는 따로 LL,RR이라는 용어설명이 없어서, 블로그 글들 참조하였습니다.뭔가 관점 차이인 부분일까요?
-
해결됨홍정모의 따라하며 배우는 C++
IntArray 클래스를 구현해봤는데 피드백 부탁드립니다.
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.#include <iostream> #include <initializer_list> using namespace std; class IntArray // integer가 담기는 클래스 { private: int m_length = 0; int* m_data = nullptr; public: //Constructors 생성자 IntArray(const int array_len) : m_length(array_len) { initialize(m_length); } IntArray(const initializer_list<int>& list) :IntArray(list.size()) { int count = 0; for ( auto& ele : list ) { m_data[ count ] = ele; count++; } } //initialize() 생성자에서 가져다 쓸 함수 void initialize(int len) { m_data = new int[ len ]; } //Destructors 소멸자 ~IntArray() { if ( m_data != nullptr ) delete[ ] m_data; m_data = nullptr; } //reset(); 메모리 지우고 초기상태로. void reset() { delete[ ] m_data; m_data = nullptr; m_length = 0; } //resize(); // 사이즈 바꿈 void resize(int n) { // 기존 메모리 temp에 저장 int* temp = m_data; // n만큼의 메모리 리사이징 m_data = new int[ n ]; // 리사이징된 메모리 크기만큼 기존메모리에서 값의 복사 for ( int i = 0; i < n; i++ ) { m_data[ i ] = temp[ i ]; } m_length = n; // 복사가 완료됐으면 기존 메모리 삭제 delete[ ] temp; } void insertBefore(const int& value, const int& ix) { // 인서트를 위한 새로운 메모리 할당 int* temp = new int[ m_length + 1 ]; // ix에 값이 들어가므로, temp[ix+1] = m_data[ix]의 전달이 이뤄진다. for ( int i = ix; i < m_length + 1; i++ ) { temp[ i + 1 ] = m_data[ i ]; } // 인서트 인덱스에 value 넣기 temp[ ix ] = value; // ix 전까지 기존 밸류 복사 for ( int i = ix - 1; i >= 0; i-- ) { temp[ i ] = m_data[ i ]; } // 기존 데이터 메모리 삭제 delete[ ] m_data; // 새롭게 인서트된 메모리 저장 m_data = temp; // 길이 +1 m_length += 1; } void remove(const int& ix) { // 제거를 위한 새로운 메모리 공간할당 int* temp = new int[ m_length - 1 ]; // 제거할 인덱스(ix)를 기준으로 값의 paste // step1. ix전의 값은 정상복사 for ( int i = 0; i < ix; i++ ) { temp[ i ] = m_data[ i ]; } // step2. ix기준 우측값의 복사 for ( int i = ix; i < m_length - 1; i++ ) { temp[ i ] = m_data[ i + 1 ]; } // 완료됐으면 기존 메모리 삭제 delete[ ] m_data; // 새로운 메모리 저장 m_data = temp; // 삭제됐으므로 길이 -1 m_length -= 1; } void push_back(const int& value) { // 끝자리 추적후에 그 뒤 새로운 메모리공간 할당후 추가하기 // insertBefore(value, m_length)를 하면? insertBefore(value, m_length); } void showAllEle() const { cout << "m_length: " << m_length << endl; cout << "m_data: "; for ( int i = 0; i < m_length; i++ ) { cout << m_data[ i ] << " "; } cout << endl; } }; int main() { IntArray my_arr{1,3,5,7,9}; my_arr.showAllEle(); my_arr.insertBefore(10,1); my_arr.showAllEle(); my_arr.remove(3); my_arr.showAllEle(); my_arr.push_back(13); my_arr.showAllEle(); } 살짝 지저분하지만, 구현에 목적을 두고 최대한 해봤는데 일단 원하는대로 구현이 되는건 확인했습니다. 추가로 문제가 발생할 수 있거나 아쉬운 부분 피드백을 해주세요! 더 정확하고 깔끔하게 다시 수정해보겠습니다.또한, 마지막 push_back 함수는 insert랑 기능상 비슷해보여서 insert함수를 재활용했는데 이 방법또한 괜찮은것인지 아니면 위험한것인지도 답변해주시면 감사합니다