묻고 답해요
161만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨[백문이불여일타] 데이터 분석을 위한 고급 SQL 문제풀이
윈도우 함수를 이용해서 풀고 싶어서 써봤습니다. 더 간단하게 줄일 수 있을까요?
Select Distinct s.hackers, h.name, s.finalFrom (Select hackers, sum(maxscore) over (partition by hackers) as finalFrom( Select Distinct hacker_id as hackers, challenge_id, max(score) over (partition by hacker_id, challenge_id) as maxscoreFrom Submissions ) sub) sInner join Hackers h on h.hacker_id = s.hackersWhere s.final > 0Order by s.final desc
-
미해결Slack 클론 코딩[백엔드 with NestJS + TypeORM]
OneToMany 관계에서 FK 데이터를 Repository를 이용하여 insert시 오류
우선 제 프로젝트에서 구성하고 있는 DB의 일부분입니다. 간단하게 p_references 와 m_references, 그리고 parts 와 models 테이블에 그림파일의 정보를 가지고 있는 images객체의 배열이 필요한데 mysql이다보니 이걸 다 One to Many로 추가시켰습니다. 여기에 images의 각각 대상 테이블에 대한 FK를 nullable : true 상태로 추가시켰습니다. 물론 이렇게 구성하면 images 테이블안에 적어도 한개의 FK를 포함한 입력값만 허용하도록 Guards 를 추가시켜야 될꺼 같습니만... 간단히 이해도를 위해 설명을 추가한거고요.여기서 문제는 p_references/m_reference 와 images table과 연결 시킬때 원래 계획된 대로 images 테이블 안에 string 이나 int 형식의 column이 추가되는것이 아닌 대상 테이블 객체가 잡히는 문제인데요.entities/images.ts@Entity("Images", { schema: "workplaces" }) export class Images { @PrimaryGeneratedColumn({ type: "int", name: "imageID" }) id: number; @Column('varchar', { name: 'images', nullable: true }) image: string; @Column('bool', { name: 'isOwn', nullable: false, default: false }) isOwn: boolean; @ManyToOne(() => Mreferences, (mreferences) => mreferences.images, { onDelete: "SET NULL", onUpdate: "CASCADE" }) @JoinColumn([{ name: 'modelNumber', referencedColumnName: 'serialNumber' }]) mreferences: Mreferences; @ManyToOne(() => Preferences, (preferences) => preferences.images, { onDelete: "SET NULL", onUpdate: "CASCADE" }) @JoinColumn([{ name: 'partsNumber', referencedColumnName: 'serialNumber' }]) preferences: Preferences; @ManyToOne(() => Parts, (parts) => parts.images, { onDelete: "SET NULL", onUpdate: "CASCADE" }) @JoinColumn([{ name: 'partsID', referencedColumnName: 'id' }]) parts: Parts; @ManyToOne(() => Models, (models) => models.images, { onDelete: "SET NULL", onUpdate: "CASCADE" }) @JoinColumn([{ name: 'modelID', referencedColumnName: 'id' }]) models: Models; }이것이 images entity에서 설정한 코드입니다. 이렇게 해서 자동으로 생성된 DB 의 ERD가 처음에 올린 스샷으로 제대로 의도된대로 생성된걸 확인할 수 있습니다.기본 설명이 너무 길어졌는데, 이제 여기 강의의 "typeorm 쿼리 빌더" 강의에 나온대로 새로운 데이터를 insert 요청이 발생하면 Images Repository를 이용해서 저장을 하려하는데 문제가 발생드려서 문의드립니다.reference-book.service.tsimport { Injectable, NotFoundException } from '@nestjs/common'; import { InjectRepository } from '@nestjs/typeorm'; import { Mreferences } from '../entities/Mreferences'; import { Repository } from 'typeorm'; import { ReferencebookModelDto } from './dto/referencebook.model.dto'; import { Videos } from '../entities/Videos'; @Injectable() export class ReferenceBookService { constructor( @InjectRepository(Mreferences) private referenceModelRepository: Repository<Mreferences>, @InjectRepository(Images) private imagesRepository: Repository<Images>, ) { } async addReferenceModel(addReferenceModel: ReferencebookModelDto) { const referenceModelBook = new Mreferences(); const referenceModelImages = new Images(); referenceModelBook.serialNumber = addReferenceModel.serialNumber; referenceModelBook.name = addReferenceModel.modelName; referenceModelBook.brands = addReferenceModel.brand; //..... 생략 await this.referenceModelRepository.save(referenceModelBook); } }이렇게 작성시, 아무런 문제 없이 FK관련 column 값들을 제외하곤 이상없이 제대로 DB에 저장이 되는데요. 문젠 FK 관련한 값에서 제대로 작동하지 않습니다.const data = new Images() 로 새로 Images객체를 생성하여, ERD에서 처럼 거기에 등록된 modelNumber 값을 입력한 dto객체의 images.image 값으로 지정해주고 저장하면 될 줄 알았는데 실제 생성된 Images객체엔 modelNumber 문자열이 존재하는 대산 mreferences 객체만이 존재합니다. 강의에서 직접 다룬 프로젝트는 아니지만 제가 강의를 보면서 직접 따라하다 발생한 문제라 강의관련 문의에 올렸습니다.어딘가에서 오류가 있던걸까요? 추가로 혹시나 필요할까 해서 dto 파일도 올립니다/dto/referencebook.model.dto.tsimport { ApiProperty } from "@nestjs/swagger"; import { Images } from "../../entities/Images"; import { Brands, Categories } from "../../common/types/enum.types"; import { Videos } from "../../entities/Videos"; export class ReferencebookModelDto { @ApiProperty({ example: 'WX532433', description: 'Uniq Serial Number', required: true, }) public serialNumber: string; @ApiProperty({ example: 'Aug-23-2023', description: 'Updated Date', required: true, }) public updateDate: Date; @ApiProperty({ example: 'Samsung Dryer', description: 'Model Name', required: true, }) public modelName: string; @ApiProperty({ example: ['afd34323', 'ty23142'], description: 'Serial number List of related parts ', required: false, }) public relatedParts: string[]; @ApiProperty({ example: ['https:/atlanticappliance.com/parts/p?pid=WX532433/image1.jpg'], description: 'Links of own images location', required: false, }) public images: Images[]; @ApiProperty({ example: ['https:/atlanticappliance.com/parts/p?pid=WX532433/video1.mp4'], description: 'Links of own videos location', required: false, }) public videos: Videos[]; @ApiProperty({ example: 'This is a parts for testing model, WX532433', description: 'Scraped description of current product from other sites', required: false, }) public description: string; @ApiProperty({ example: 'Washer', description: 'Product categories', required: true, }) public category: Categories; @ApiProperty({ example: '24Inch', description: 'Product Variant Options', required: false, }) public variant: string; @ApiProperty({ example: '27.7', description: 'Product Weight', required: false, }) public weight: number; @ApiProperty({ example: 21.49, description: 'Product height', required: false, }) public height: number; @ApiProperty({ example: 21.49, description: 'Product width', required: false, }) public width: number; @ApiProperty({ example: 21.49, description: 'Product depth', required: false, }) public depth: number; @ApiProperty({ example: 'Samsung', description: 'Brand', required: false, }) public brand: Brands; }
-
미해결[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part3: 유니티 엔진
코드에서 질문이 하나 있습니다
lockTarget의 경우에는 BaseController으로부터 공용으로 PlayerController, MonsterController둘 다에서 사용되는데 locktarget이 각각 따로따로 적용되는 건지 아님 한곳에서 lockTarget이 Knight로 설정되어 있으면 다른 한곳에서도 똑같은 lockTarget이 Knight로 설정되어 있는 건지 궁금합니다.그리고 각각 따로 설정된다면 왜 그런지 알고싶습니다
-
미해결[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part3: 유니티 엔진
코드중에 궁굼한사항이 있어 질문남깁니다
BaseControllerprivate void Start() { Init(); } protected virtual void Init() { }PlayerControllerprotected override void Init() { base.Init(); _stat = gameObject.GetComponent<PlayerStat>(); //Managers.Input.KeyAction -= OnKeyboard; //Managers.Input.KeyAction += OnKeyboard; Managers.Input.MouseAction -= OnMouseEvent; Managers.Input.MouseAction += OnMouseEvent; Managers.UI.MakeWorldSpaceUI<UI_HpBar>(transform); //Managers.UI.ClosePopupUI(ui); //Managers.Resource.Instantiate("UI/UI_Button"); }1.BaseController에 start는 스크립트를 추가하지 않았는데 왜 실행되는지2. public과 protected 사용 기준이 두가지가 궁금합니다!
-
미해결10주완성 C++ 코딩테스트 | 알고리즘 코딩테스트
질문
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. http://boj.kr/651b3f6555054253aff3c5af3b037dbb이전에도 visited 위치에 대해서 질문한 적이 있는데, 이번에도 질문 드립니다.논리를 생각하고, 구현에서 막혀서 고민 중 강의의 코드를 보다가 구지 main과 dfs 둘 다 visited = 1 의 과정을 적어야 하는지에 대해 의문이 듭니다. 위의 제가 올려둔 코드처럼 할 경우 문제가 있는지 알고 싶습니다!
-
미해결쉽게 시작하는 쿠버네티스(v1.30) - {{ x86-64, arm64 }}
ImagePullBackOff 오류가 발생합니다
[질문 전 답변]1. 강의에서 다룬 내용과 관련된 질문인가요? 예2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? 예3. 질문 잘하기 법을 읽어보셨나요? 예(https://www.inflearn.com/blogs/1719)4. 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요.[질문 하기]안녕하세요.2.1.배포를 통해 확인하는 파드(Pod) 강의 4:44 의 내용을 실습중인데요[root@m-k8s ~]# kubectl get podNAME READY STATUS RESTARTS AGEnginx 0/1 ImagePullBackOff 0 3m27s라고 뜨네요. 어떤 부분을 확인하면 좋을까요?
-
미해결파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트
도커파일로 장고 프로젝트 빌드 하고 런할때 manage.py 가 없다는 에러가 발생 합니다
manage.py 가 없다고 나와요 vs code:
-
미해결백엔드 프레임워크 만들기 (개정판)
MasterController에서 ResourceBundle.getBundle() 질문입니다!
안녕하세요 제로님 강의 잘 듣고 있습니다!다른 분이 질문 남겨주신 것처럼 저도 세팅 후 하나씩 추가해보고 싶어서 그렇게 진행하고 있습니다.MasterController에서 ResourceBundle init = ResourceBundle.getBundle("com.code5.fw.init");부분이 어떻게 동작되는 것인지 이해가 잘 가지 않아 질문드립니다.제 폴더 구조는 위 사진과 같고 classpath는 아래와 같이 강의에서 나온 것과 크게 다르지 않습니다.컴파일 했을 때, WEB-INF 하위에 클래스만 생기고 init.properties 파일은 생기지 않는 것 같은데 강의에서 어떻게 톰캣이 com.code5.fw.init을 찾을 수 있는 건가요?제 로컬 환경에서는 Can't find bundle for base name com.code5.fw.init 이라고 오류가 발생하네요.WEB-INF 하위에 있는 fw 폴더 하위에 init.properties를 넣어주는 경우에는 잘 동작 했습니다!
-
해결됨탄탄한 백엔드 NestJS, 기초부터 심화까지
좋지 않은 예 에서 import
테스트를 잠깐 해 보았는데요.다른 모듈에있는 Service를 사용하기 위해서는 (지금까지 배운 내용에 한해서)1. B Module 에 A Module , A Service 등록하기. 2. B Module 에 A Service 만 등록하기 3. A Module 에서 A Service 를 exports 에 등록하고, B Module에서는 A Module 을 등록하기 정도 생각이 들었고 테스트 해 보았습니다.강사님꼐서는 1번과 3번을 예시로 들어주셨는데요, 좋지않은 예시(1번) 에서CatsModule 까지 import 한 이유가 있을까요? AppModule에 CatsModule을 import 하지 않고, CatsService 만 providers 에 등록해 준 것과 다른가요? 아니면, 2번 에서 암시적으로 A Module이 import된다거나 하는게 있는건가요? ++ 인스턴스 가 새로 생성되는 것이라면, 서버사이드에서 는 굳이 싱글톤이 아니어도 될 인스턴스 객체들이 많을 것이라 보이는데, 다른 이유가 있나요?
-
미해결웹플로우(Webflow) 시작하기 - 코딩 없이 자유도 높은 프로토타입 만들기
웹플로우 따라다니는 버튼 구현 질문 + 역순으로 디스콰이엇 클론하기(?)
장피엠님 강의듣고 웹플로우로 이제 랜딩페이지정도는 그냥 영역 잡고 슈슈숙 만들게 되었습니다 ! 정말 감사드립니다 ㅎㅎㅎ 강의가 너무 좋아서 한사이클 더 돌릴예정인데요 !이 복습 돌릴때 약간 역순으로 에어테이블 데이터 베이스로 정보들을 만들어 놓고 -> CMS 먼저 만들어 놓고 ->이걸 바탕으로 회원가입 입력시 두곳에 입력될 멤버스텍/탈리폼도 먼저 만들어 놓고 -> 나중에 최종적으로 홈 화면을 구축하는 방식으로 복습을 해볼 생각인데 처음에 에어테이블로 미리 데이터베이스를 만들때 에어테이블 연습해볼만한 보고 따라해볼만한 자료가 있을까요? (아니면 운영하고계신 에어테이블 강의있나요? ㅇㅁㅇ) 혹은 이렇게 역순으로 회원정보라던지 , 입력시 등록되는 자동화같은거 미리 설계해놓고 나서 마지막에 그걸로 화면구현하는 것에 대해서 어떤순으로 진행하면 좋아보이나요? 추가적으로 현재 만들어놓은 랜딩페이지에 인프런 보면요 문의하기 버튼이 졸졸 따라다니는데 이거 만들어보고 싶은데요.. STICKY였나 그거에 Z -INDEX 설정해야 할꺼같은 감이 아주 조금은 오는데 혹시 어떤식으로 만들어야 하는지 조언 부탁드립니다 ㅠㅠㅠ
-
미해결Slack 클론 코딩[백엔드 with NestJS + TypeORM]
mysql 설치는 윈도우에 대해서만 해주는 것인가요?
해당 강좌는 윈도우 기반인가요?설치에 대해서 윈도우만 설명하고 있어서 글을 적어보았습니다.
-
미해결스프링 배치
Multi-threaded과 Partitioning의 차이가 있나요?
Multi-threaded에다가 각 스레드가 담당할 데이터를 구분시켜주는 기능이 포함된게 Partitioning인가요??단지 차이점이 이렇게만 느껴집니다
-
해결됨[리뉴얼] React로 NodeBird SNS 만들기
npm i next@13
강의를 보면서 잘 오다가 npm i next@9로 해야하는걸 아래 질문에서 13을 써도 된다고 하셔서 @13 이라고 했는데 저렇게 에러 3줄이 next@9을 할 때 도 저렇게 뜨고 13으로 해도 저렇게 뜹니다 package.json 뜨는 것 까진 잘 됐어요 어떻게 해야할까요? PS C:\Users\USER\Desktop\1080\react1> cd preparePS C:\Users\USER\Desktop\1080\react1\prepare> cd frontPS C:\Users\USER\Desktop\1080\react1\prepare\front> node -v v18.14.0PS C:\Users\USER\Desktop\1080\react1\prepare\front> npm -v6.9.0PS C:\Users\USER\Desktop\1080\react1\prepare\front> npm initnpm WARN npm npm does not support Node.js v18.14.0npm WARN npm You should probably upgrade to a newer version of node as wenpm WARN npm can't make any promises that npm will work with this version.npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.npm WARN npm You can find the latest version at https://nodejs.org/This utility will walk you through creating a package.json file.It only covers the most common items, and tries to guess sensible defaults.See npm help json for definitive documentation on these fieldsand exactly what they do.Use npm install <pkg> afterwards to install a package andsave it as a dependency in the package.json file.Press ^C at any time to quit.package name: (front) react-nodebird-frontversion: (1.0.0)description:entry point: (index.js)test command:git repository:keywords:author:license: (ISC)About to write to C:\Users\USER\Desktop\1080\react1\prepare\front\package.json:{ "name": "react-nodebird-front", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC"}Is this OK? (yes) yesPS C:\Users\USER\Desktop\1080\react1\prepare\front> npm i next@13npm WARN npm npm does not support Node.js v18.14.0npm WARN npm You should probably upgrade to a newer version of node as wenpm WARN npm can't make any promises that npm will work with this version.npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.npm WARN npm You can find the latest version at https://nodejs.org/npm ERR! cb.apply is not a functionnpm ERR! A complete log of this run can be found in:npm ERR! C:\Users\USER\AppData\Roaming\npm-cache\_logs\2023-02-14T14_50_16_126Z-debug.logPS C:\Users\USER\Desktop\1080\react1\prepare\front>
-
미해결[코드팩토리] [초급] Flutter 3.0 앱 개발 - 10개의 프로젝트로 오늘 초보 탈출!
WebViewController 선언시 왜 nullable로 해주어야 하나요?
WebViewController? controller; 선언시 왜 nullable로 해주어야 하나요?WebView실행시 변수 controller에 WebViewController의 컨트롤러가 할당되는데 null이 되는 경우가 무엇이 있나요? 사용자가 네트워크 연결이 되어있지 않은상태로 웹뷰어플을 실행했을때 null이 되는건가요?만약 맞다면 이것외에 다른 null이 될만한 상황들은 뭐가 있을까요?
-
해결됨풀스택을 위한 탄탄한 프런트엔드 부트캠프 (HTML, CSS, 바닐라 자바스크립트 + ES6) [풀스택 Part2]
header 의 CSS 값 중 left:0 으로 설정한 부분이 잘 이해가 되지 않습니다.
[모던 HTML/CSS 로 상용화도 가능한 반응형 모던 웹페이지 만들기3] 12:10 부분에서, header 의 CSS 값 중 top :0 인 것은 이해가 되는데,left :0 으로 설정한 이유는 잘 모르겠습니다.이미 width:100% 로 설정해서 좌우에 딱 맞게 설정된것으로 이해했는데, 여기에다가 또 left:0 을 해서 중앙이 아닌 좌측 정렬을 하는 이유가 있는걸까요?
-
미해결수학으로부터 인류를 자유롭게 하라(기초대수학편)
Lecture6-2의 Decompositions of Rational Expressions 예제 수정 제안
Decompositions of Rational Expressions의 예제에 오류가 있습니다.ex.1) 을 보면 {(x-1)(x+1)}/x로 되어 있는데,{(x-1)+(x+1)}/x로 고쳐야 할 것 같습니다.ex.2)도 위와 동일한 방식으로 고쳐야 할 것 같습니다.
-
미해결Vue.js 끝장내기 - 실무에 필요한 모든 것
Node 버전변경, nvm 설치가 다른 프로젝트에도 영향 주나요?
초기 세팅하다 안돼서 폴더 다 삭제하고 처음부터 다시 했더니삭제전 노드, vue cli 버전이 그대로 뜨는데 수업 듣기 전 상태로 돌리는 방법이 있나요?
-
해결됨[리뉴얼] React로 NodeBird SNS 만들기
node -v v.18.14.0
node -v 쳤을 시 버전이 v18.14.0 으로 뜨는데 그대로 진행해도 괜찮은 건가요
-
미해결Github Action을 활용한 크롤러 웹 페이지 만들기
push 작업 중 아래와 같은 에러가 발생합니다.
크롤링 데이터 파일 생성 후 나에게 push하기 강의 실습 중 위의 에러가 발생했습니다.아래는 제 main.yml 파일입니다.name: helloGithubAction on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: # 개인 토큰을 사용할 것인지 말 것인지 persist-credentials: false - name: 1. pip 업그래이드 run: python -m pip install --upgrade pip - name: 2. 환경 설정 run: pip install -r requirements.txt - name: 3. 파이썬 실행 run: python test_crawl_2.py - name: Commit files run: | git config --local user.email "hajuny129@gmail.com" git config --local user.name "HaJunYoo" git add . git commit -m "Run crawler and update current data" - name: Push changes uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} branch: ${{ github.ref }}
-
미해결모바일 웹 퍼블리싱 포트폴리오 with Figma
fixde문제인가요?
마지막 goods- detail페이지 문의인데요 아래와 보시다 시피 fixed주고나서 저렇게 뛰어나왔어요 box-sizing: border-box 줘도 안먹히고요 width:값을 335px로 줄이면 딱맞는데 원래 fixed 주고 box-sizing: border-box 안먹히는건가요 ??html도 아래 good-order-info는 goods-detail-content밖으로 밖으로 잘 분리되어 있는데요~~ .goods-order-info { background-color: #fff; border-radius: 10px 10px 0 0; box-shadow: 0 -5px 5px rgba(0, 0, 0, 0.05); padding: 20px; position: fixed; bottom: 0; width: 375px; border: 1px solid red; box-sizing: border-box; } .goods-order-info