묻고 답해요
161만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결자바(Java) 알고리즘 문제풀이 입문: 코딩테스트 대비
마구간 질문드립니다.
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. 마구간 문제에서 lt,rt를 음반 문제처럼Arrays.stream(arr).max().getAsInt();하면 rt가 9가되고,Arrays.stream(arr).min().getAsInt()해서 lt가 1로 되게해서는 코드를 짤수 없나요??
-
미해결처음하는 딥러닝과 파이토치(Pytorch) 부트캠프 (쉽게! 기본부터 챗GPT 핵심 트랜스포머까지) [데이터분석/과학 Part3]
Multi-Class Classfication 딥러닝 적용해보기 (IRIS 분류 문제) - 미니배치 기반 예측 코드 질문
강사님께서 코드를 보면서 '전체 데이터를 가지고 예측을 했기 때문에 굳이 미니배치 기반으로 예측을 안해도 된다' 고 언급하신 부분이 이해가 잘 가지 않습니다.(9분 ~ 9분 20초 경)저희가 훈련 데이터로 모델을 학습할 때 미니배치 기준으로 학습을 했으니까 예측을 할 때에도 미니배치 기준으로 해야하지 않나요? 강의 내에서 아래 코드를 굳이 안해도 된다고 언급09_SIMPLE_ACTUAL_EXAMPLE_MULTI-LABEL_CLASSIFICATION.ipynby_pred_list = list() x_test_batch_list = X_test_tensor.split(minibatch_size, 0) model.eval() with torch.no_grad(): for x_minibatch in x_test_batch_list: y_test_pred = model(x_minibatch) y_test_pred = torch.argmax(y_test_pred, dim=1) y_pred_list.extend(y_test_pred.detach().tolist()) y_pred_list = torch.tensor(y_pred_list)
-
미해결[2025년 출제기준] 웹디자인기능사 실기시험 완벽 가이드
공지사항, 갤러리 배경색이 변화지 않습니다.
아무리 봐도 똑같이 입력하였는데 전, 공지사항 갤러리 배경색이 변하지 않습니다. 무엇이 잘못 입력 되었는지 확인해 주십시오. 그리고, 강의에 나오는 A타입, B타입, C타입만 반복해서 연습 후 할 수 있으면 다른 내용의 문제가 출제 되어도 합격 가능하겠습니까? 처음 보는 유형의 문제가 출제 되어 작업을 하지 못할까 봐 걱정이 됩니다.index.html<!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <title>JUST 쇼핑몰</title> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="container"> <header> <div class="header-logo"> <a href="#none"> <img src="images/logo-header.png" alt="header-logo"> </a> </div> <div class="navi"> <ul class="menu"> <li> <a href="#none">탑</a> <div class="sub-menu"> <a href="#none">블라우스</a> <a href="#none">티</a> <a href="#none">셔츠</a> <a href="#none">니트</a> </div> </li> <li> <a href="#none">아우터</a> <div class="sub-menu"> <a href="#none">자켓</a> <a href="#none">코트</a> <a href="#none">가디건</a> <a href="#none">머플러</a> </div> </li> <li> <a href="#none">팬츠</a> <div class="sub-menu"> <a href="#none">청바지</a> <a href="#none">짧은바지</a> <a href="#none">긴바지</a> <a href="#none">레깅스</a> </div> </li> <li> <a href="#none">악세서리</a> <div class="sub-menu"> <a href="#none">귀고리</a> <a href="#none">목걸이</a> <a href="#none">반지</a> <a href="#none">팔찌</a> </div> </li> </ul> </div> </header> <div class="slide"> <div> <a href="#none"><img src="images/slide-01.jpg" alt="slide1"></a> <a href="#none"><img src="images/slide-02.jpg" alt="slide2"></a> <a href="#none"><img src="images/slide-03.jpg" alt="slide3"></a> </div> </div> <div class="items"> <div class="news"> <div class="tab-inner"> <div class="btn"> <a class="active" href="#none">공지사항</a> <a href="#none">갤러리</a> </div> <div class="tabs"> <div class="tab1"> <a href="#none">SMS 발송 모바일 서비스 개선작업 안내입니다. <b>2020.01.09</b></a> <a href="#none">휴대폰 인증 서비스 개선 작업 기간 연장합니다. <b>2020.01.07</b></a> <a href="#none">카드사 부분 무이자 할부 이벤트 2월 3일까지 혜택 <b>2019.12.31</b></a> <a href="#none">올앳 시스템 작업 안내 <b>2019.12.20</b></a> <a href="#none">휴대폰 결제 시스템 작업이 완료되었습니다. <b>2019.12.20</b></a> </div> <div class="tab2"> <a href="#none"><img src="images/gallery-01.jpg" alt="gallery-01"></a> <a href="#none"><img src="images/gallery-02.jpg" alt="gallery-02"></a> <a href="#none"><img src="images/gallery-03.jpg" alt="gallery-03"></a> </div> </div> </div> </div> <div class="banner"> <a href="#none"> <img src="images/banner-01.jpg" alt="banner"> </a> </div> <div class="shortcut"> <a href="#none"> <img src="images/banner-02.jpg" alt="shortcut"> </a> </div> </div> <footer> <div class="footer-logo"> <a href="#none"> <img src="images/logo-footer.png" alt="footer-logo"> </a> </div> <div class="copyright"> 상호 : 엣지컴퍼니 | 대표자 : 홍길동 | 개인정보관리책임자 : 장길산 차장<br> 사업장주소 : 서울특별시 강남구 테헤란로 123-56 </div> <div class="sns"> <a href="#none"><img src="images/sns-01.png" alt="sns1"></a> <a href="#none"><img src="images/sns-02.png" alt="sns2"></a> <a href="#none"><img src="images/sns-03.png" alt="sns3"></a> </div> </footer> </div> <script src="script/jquery-1.12.4.js"></script> <script src="script/custom.js"></script> </body> </html>style.css@charset 'utf-8'; body{ margin: 0; font-size: 15px; background-color: #fff; color: #222328; } a{ color: #222328; text-decoration: none; } .container{ width: 1200px; margin: auto; } header{ height: 100px; position: relative; z-index: 10; } header>div{ height: 100px; } .header-logo{ width: 200px; float: left; } .navi{ width: 600px; float: right; } .slide{} .slide>div{ height: 300px; } .items{ overflow: hidden; } .items>div{ height: 200px; float: left; box-sizing: border-box; } .news{ width: 500px; } .banner{ width: 350px; } .shortcut{ width: 350px; } footer{ overflow: hidden; } footer>div{ height: 100px; float: left; box-sizing: border-box; } .footer-logo{ width: 200px; } .copyright{ width: 800px; } .sns{ width: 200px; } .header-logo,.footer-logo{ line-height: 130px; } .copyright{ padding-top: 30px; text-align: center; } .sns{ line-height: 130px; text-align: center; } .slide{ position: relative; width: 1200px; height: 300px; overflow: hidden; margin-bottom: 10px; } .slide>div{ position: absolute; top: 0; left: 0; animation: slide 10s linear infinite; font-size: 0; } @keyframes slide{ 0%{top: 0;} 30%{top: 0;} 35%{top: -300px;} 65%{top: -300px;} 70%{top: -600px;} 95%{top: -600px;} 100%{top: 0;} } /* 네비게이션 */ .menu{ list-style: none; padding: 0; padding-top: 20px; } .menu li{ float: left; width: 25%; box-sizing: border-box; border: 1px solid black; text-align: center; } .menu li>a{ display: block; border: 1px solid black; padding: 5px; transition: 0.5s; } .menu li:hover>a{ background-color: #000; color: #fff; } .sub-menu{ background-color: #fff; border: 1px solid black; display: none; } .sub-menu a{ display: block; padding: 5px; } .sub-menu a:hover{ background-color: #000; columns: #fff; } /* tab menu */ .tab-inner{ width: 95%; margin: auto; } .btn{} .btn a{ border: 1px solid black; display:inline-block; width: 100px; padding: 5px; text-align: center; margin-right: -8px; border-radius: 5px 5px 0 0; border-bottom: none; margin-bottom: -1px; background-color: #ddd; } .btn a.active{ background-color: #fff; } .tabs{} .tab1{ border: 1px solid black; /* display: none; */ } .tab1 a{ display: block; padding: 5px; border-bottom: 1px solid black; padding: 0 15px; } .tab1 a:last-child{ border-bottom: none; } .tab1 a b{ float: right; font-weight: normal; } .tab2{ display: none; border: 1px solid #000; height: 170px; text-align: center; padding-top: 20px; box-sizing: border-box; } .tab2 img{ width: 130px; }custom.js$('.menu li').mouseenter(function(){ $('.sub-menu').stop().slideDown() }) $('.menu li').mouseleave(function(){ $('.sub-menu').stop().slideUp() }) /*tab menu */ $('.btn a:first-child').click(function(){ $('.tab1').show() $('.tab2').hide() $(this).addClass('active') $(this).siblings().removeclass('active') }) $('.btn a:last-child').click(function(){ $('.tab2').show() $('.tab1').hide() $(this).addClass('active') $(this).siblings().removeclass('active') })
-
미해결스프링 MVC 2편 - 백엔드 웹 개발 활용 기술
label, page, button등에 대한 질문이 있습니다.
label이라고 해주는 기준이나,page라고 해주는 기준이나,button의 기준을 모르겠습니다.단순 명시상인건지, button이면 button.save라고 해줘야 하는지요?또한 label.item.itemName처럼 .[온점]을 두 번이나 찍었는데, 이 .찍는 기준이 어떻게될까요?ㅠ
-
미해결[리뉴얼] Node.js 교과서 - 기본부터 프로젝트 실습까지
mysql db를 배포하셨는데요
배포하시면서 비밀번호를 기존 코드에 .env랑 동일하게 생성하시고 db도 만드신걸로 아는데이렇다는것은 서버컴퓨터에 새로 mysql db를 만들어버린것인가요? 전 배포후에도 워크벤치로 db내용을 보고 수정하고싶은데 이건 불가능한건가요? 감사합니다
-
미해결[코드팩토리] [중급] Flutter 진짜 실전! 상태관리, 캐시관리, Code Generation, GoRouter, 인증로직 등 중수가 되기 위한 필수 스킬들!
firebase로 받은 데이터모델링 fromJson 생성자 만드려고 합니다.
firebase로 받은 async querysnapshot을 json으로 바꿔서강의에서 알려주신 fromJson, fromModel 생성자를 만드려고 하는데요,firebase 데이터는 Map<String, dynamic>형태가 아니라고 하는데, 어떻게 타입을 바꾸면 좋을까요?
-
해결됨Flutter 앱 개발 기초
비동기 질문드립니다.
Http 통신을 위해 비동기 통신을 사용하는것으로 보이는데요그런데 네트웤통신의 느림을 해소하기 위해 비동기 통신을 하였는데굳이 그걸 또 async await을 사용해서 동기 통신처럼 만드는 이유가 있을까요?응답을 받고 처리 하기 위함이라는 것은 알고 있습니다.제 질문의 의도는 처음부터 동기처리 하면 되지 , 굳이 비동기 처리하고 나서 응답을 받고 다시 동기화 처리하는사유가 따로 있을까 해서요좋은 강의 감사드립니다. 추가 질문이 있습니다.강의노트 전체 페이지를 갈수 있는 URL을 알수 잇을가요지금은 해당 회차에 강의에 걸려 있는 링크를 타고 들어가고 있습니다.
-
미해결평생 써먹는 데이터 기반 투자법 with 파이썬 퀀트 투자
퍼포먼스 지표로 샤프지수와 표준편차
안녕하세요 강사님목소리가 좋으셔서 듣기편한거 같네요. 아직 완강은 하지 못했지만요..퍼포먼스 지표로 샤프지수와 표준편차도 있으면 좋을거 같은데. 본 강의에선 없어서 좀 아쉽네요혹시 구할려면 어떻게 해야하는지 알려주실수 있나요?
-
미해결파이썬(Python) 기초부터 실무까지 part.5
버튼 배치관련 질문
선생님 15분 50초 가량에 Button을 row=1로주는 이유가 0에는 canvas가 있기 때문이라 하셨는데btn을 이미 작성해줄때 Button(frame)으로 위치를 고정했기에 Frame내에 이미 고정된 상태라서 row 는 상관없지 않나요?
-
미해결Swift로 iOS 2D 아케이드 게임 만들기
안녕하세요 asset 이미지 관련 질문이 있씁니다
제가 배운것들을 바탕으로 완성된 게임에기능을 더 추가하고 싶은데이미지같은건 어디서 구하는건가요?스토어에 런칭할 목적도 아니여서 저작권 있는 사진도 상관이 없는데ios 게임개발할때 넣은 이미지들 구하는 사이트가 있을까요?
-
미해결뉴욕 프로덕트 디자이너가 알려주는, 입문자를 위한 UX디자인 개론
안녕하세요 에릭님 !! 공부한 강의 내용 정리하고 공부 한 내용을 제 개인 블로그에 올려도 괜찮을까요??
안녕하세요!! 웹디 공부를 이번에 시작했습니다 !! 찾아 보다가 블로그에 공부한 것들을 정리해서 올리면 나중에 면접을 볼 때 도움이 된다고 들었습니다 ㅜㅜ제가 에릭님 강의 듣고 너무 좋아서 커리큘럼 대로 구매해서 보고 있습니다,, 강의 공부가 끝나면 정리한 내용들을 블로그에 올려도 괜찮을까요..?! 안된다면 올리지 않겠습니다 죄송합니다 ㅠㅠ
-
미해결
데브툴 소스맵 오류 확인 좀 부탁드립니다 ㅠ
browser-polyfill.js 파일이 없다는거같은데맞나요? 혹시 맞다면 해결방법 좀 알려주시면 감사하겠습니다
-
미해결스프링 기반 REST API 개발
maven으로 생성한 docs파일(index.html)에서의 not found 오류 질문
안녕하세요. 백기선님 강의 덕분에 성장 중입니다. 강의 항상 감사합니다. 다름이 아니라, 인텔리제이의 maven 메뉴에 있는 package로 생성된 index.html 에 있는 내용들이not found operator:: 라면서 오류가 납니다.pom.xml, test에 있는 createEvent(), EventController 에서 틀린 부분이 있는지 찾아봤는데도 분명 소스는 같은데 왜 틀리는지 잘 모르겠습니다.제가 아직 not found operator:: 이 부분이 무슨 뜻인지 몰라서일까요...테스트는 일단 잘 돌아갑니다(?)현재 사용 중인 버전은아파치 메이븐 3.8.1 (약 2018년 버전으로 예상)스프링 부트 2.6.13입니다. 도와주시면 감사드리겠습니다🙇♂️소스는 링크로 걸어놓겠습니다. (pom.xml 외 다른 소스들은 실습 중이라 달라질 수 있습니다)EventControllerhttps://github.com/intrager/Spring-STUDY2/blob/main/restfulHan/src/main/java/me/brucehan/restfulhan/events/EventController.java RestDocsConfigurationhttps://github.com/intrager/Spring-STUDY2/blob/main/restfulHan/src/test/java/me/brucehan/restfulhan/common/RestDocsConfiguration.java EventControllerTestshttps://github.com/intrager/Spring-STUDY2/blob/main/restfulHan/src/test/java/me/brucehan/restfulhan/events/EventControllerTests.java pom.xmlhttps://github.com/intrager/Spring-STUDY2/blob/main/restfulHan/pom.xml index.adochttps://github.com/intrager/Spring-STUDY2/blob/main/restfulHan/src/main/asciidoc/index.adoc
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
@controller 인식이 안돼요
섹션 1 view 환경설정 코드 그대로 폴더만들고 따라치다가 @controller를 인식못하는 것같아서 이것저것 다 구글링해서 시도해봣는데 해결이 안됩니다 ㅠㅠ왜 @controller하면 인식못하는지 어떻게 해결해야하는지 알고 싶습니다
-
해결됨[개정판] 파이썬 머신러닝 완벽 가이드
예측정확도가 아닌 예측결과를 알 수 있나요?
머신러닝을 통해 하나의 데이터 값이 어느 값을 가질지 예측하는 결과를 알 수는 없나요?예를 들어 여러 붓꽃데이터를 학습시킨 다음에 하나의 붓꽃데이터를 준 후 기계가 이 붓꽃데이터가 어디에 들어가는지 판별하는것을 알 수 있나요?
-
미해결Jenkins를 이용한 CI/CD Pipeline 구축
ssh-copy-id 에러 문의
저도 밑에 있는 분과 같은 증상인데요ansible-server에서 ssh-copy-id 명령어 입력 후윈도우 .ssh 폴더에 가서 authorized_key를 열어보면ECHO가 설정되어 있습니다라는 글이 한줄 추가 되어있습니다.같은걸 반복해서 실행 할 경우 동일하게 같은 글이 한줄더 추가가 됩니다(수동으로 직접 값을 넣어봐도 ping 오류는 납니다)혹시 관련 사항 해결방법이 있을까요??
-
미해결실전! 스프링 부트와 JPA 활용1 - 웹 애플리케이션 개발
엔티티나 임베디드 타입 개발
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요.1. 강의 내용과 관련된 질문을 남겨주세요.2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요.(자주 하는 질문 링크: https://bit.ly/3fX6ygx)3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요.(질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG)질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요.=========================================[질문 템플릿]1. 강의 내용과 관련된 질문인가요? (예/아니오)2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오)3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오)[질문 내용]강의 자료에 JPA 스펙상 엔티티나 임베디드타입은 자바 기본 생성자를 public 또는 protected로 설정해야 한다고 나와있습니다. 그리고 protected로 설정하는 것을 추천해주셨는데요. 쉽게 말해서 모든 엔티티나 임베디드타입을 개발할때 @NoArgumentConstructor를 넣어주면 괜찮을까요?
-
미해결[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part2: 자료구조와 알고리즘
코드를 혹시 받을 수 있을까요?
파란색 말이 움직이지를 않아서요. 혹시 예제코드가 있다면 받고 싶어요
-
미해결Slack 클론 코딩[실시간 채팅 with React]
Chats안에 Route된 페이지가 화면에 출력 되지 않는 현상
import { AddButton, Channels, Chats, Header, LogOutButton, MenuScroll, ProfileImg, ProfileModal, RightMenu, WorkspaceButton, WorkspaceModal, WorkspaceName, Workspaces, WorkspaceWrapper } from '@layouts/Workspace/styles' import fetcher from '@utils/fetcher'; import React, { useCallback, useState } from 'react'; import useSWR from 'swr'; import axios from 'axios' import gravatar from 'gravatar' import loadable from '@loadable/component'; import { Navigate, Route, Routes } from 'react-router'; import { useParams } from 'react-router'; import { toast } from 'react-toastify'; import Menu from '@components/Menu'; import useInput from '@hooks/useInput'; import Modal from '@components/Modal'; import CreateChannelModal from '@components/CreateChannelModal'; import { IChannel, IUser } from '@typings/db'; import { Link } from 'react-router-dom'; import { Button, Input, Label } from '@pages/SignUp/styles'; import InviteWorkspaceModal from '@components/InviteWorkspaceModal'; import InviteChannelModal from '@components/InviteChannelModal'; import ChannelList from '@components/ChannelList'; import DMList from '@components/DMList'; const Channel = loadable(() => import('@pages/Ch')); const DirectMessage = loadable(() => import('@pages/DirectMessage')); const Workspace = () => { // const Workspace: React.FC<Props> = ({ children }) => { // const { data: userData, mutate: revalidateUser } = useSWR<IUser | false>('http://localhost:3095/api/users', fetcher); const [showUserMenu, setShowUserMenu] = useState(false); const [showCreateWorkspaceModal, setShowCreateWorkspaceModal] = useState(false); const [showInviteWorkspaceModal, setShowInviteWorkspaceModal] = useState(false); const [showInviteChannelModal, setShowInviteChannelModal] = useState(false); const [showWorkspaceModal, setShowWorkspaceModal] = useState(false); const [showCreateChannelModal, setShowCreateChannelModal] = useState(false); const [newWorkspace, onChangeNewWorkspace, setNewWorkpsace] = useInput(''); const [newUrl, onChangeNewUrl, setNewUrl] = useInput(''); const { workspace } = useParams<{ workspace: string }>(); const { data: userData, error, mutate: revalidateUser } = useSWR<IUser | false>('/api/users', fetcher, { dedupingInterval: 2000, }); const { data: channelData } = useSWR<IChannel[]>( userData ? `/api/workspaces/${workspace}/channels` : null, fetcher); const onLogout = useCallback(() => { console.log(userData) axios.post( '/api/users/logout', null, { withCredentials: true, }) .then(() => { revalidateUser(false, false); }) .catch((err) => { console.log(err) }) }, []) const onClickUserProfile = useCallback(() => { setShowUserMenu((prev) => !prev); }, []) const onCloseUserProfile = useCallback((e: React.MouseEvent<HTMLInputElement>) => { // console.trace('click') e.stopPropagation(); setShowUserMenu((prev) => !prev); }, []) const onClickCreateWorkspace = useCallback(() => { setShowCreateWorkspaceModal(true); }, []) // 메뉴창에 채널생성 const onCreateWorkspace = useCallback((e: React.FormEvent<HTMLFormElement>) => { e.preventDefault(); if (!newWorkspace || !newWorkspace.trim()) return; if (!newUrl || !newUrl.trim()) return; axios.post('/api/workspaces', { workspace: newWorkspace, url: newUrl, }, { // 내가 로그인 된 상태라는걸 쿠키를 전달해서 안다 withCredentials: true, }).then(() => { revalidateUser(); // 초기화 setShowCreateWorkspaceModal(false); setNewWorkpsace(''); setNewUrl(''); }).catch((error) => { console.dir(error); // toastify npm으로 에러 메세지 toast.error(error.response?.data, { position: 'bottom-center' }) }) }, [newWorkspace, newUrl]) // 모달닫기 const onCloseModal = useCallback(() => { setShowCreateWorkspaceModal(false); setShowCreateChannelModal(false); setShowInviteWorkspaceModal(false); setShowInviteChannelModal(false); }, []) const toggleWorkspaceModal = useCallback(() => { setShowWorkspaceModal((prev) => !prev); }, []) const onClickAddChannel = useCallback(() => { setShowCreateChannelModal(true); }, []) const onClickInviteWorkspace = useCallback(() => { setShowInviteWorkspaceModal(true); }, []); // return 아래에 hooks가 있으면 Invalid hook call 에러가 뜬다 if (userData === undefined) return null; if (userData === false) { return <Routes><Route path="/*" element={<Navigate replace to="/login" />} /></Routes> } return ( <div> <Header> <RightMenu> <span onClick={onClickUserProfile}> <ProfileImg src={gravatar.url(userData.email, { s: '28px', d: 'retro' })} alt={userData.nickname} /> {showUserMenu && (<Menu style={{ right: 0, top: 38 }} show={showUserMenu} onCloseModal={onCloseUserProfile}> <ProfileModal> <img src={gravatar.url(userData.email, { s: '28px', d: 'retro' })} alt={userData.nickname} /> <div> <span id="profile-name">{userData.nickname}</span> <span id="profile-active">Active</span> </div> </ProfileModal> <LogOutButton onClick={onLogout}>로그아웃</LogOutButton> </Menu> )} </span> </RightMenu> </Header> <WorkspaceWrapper> <Workspaces> {userData?.Workspaces && userData?.Workspaces.map((ws: any) => { return ( <Link key={ws.id} to={`/workspace/${ws.url}/channel/일반`}> <WorkspaceButton>{ws.name.slice(0, 1).toUpperCase()}</WorkspaceButton> </Link> ); })} <AddButton onClick={onClickCreateWorkspace}>+</AddButton> </Workspaces> <Channels> <WorkspaceName onClick={toggleWorkspaceModal}>Sleact</WorkspaceName> <MenuScroll> {/* Menu에서 div옆에 style을 받았기 때문에 style사용가능 */} <Menu show={showWorkspaceModal} onCloseModal={toggleWorkspaceModal} style={{ top: 95, left: 80 }}> <WorkspaceModal> <h2>Sleact</h2> <button onClick={onClickInviteWorkspace}>워크스페이스에 사용자 초대</button> <button onClick={onClickAddChannel}>채널 만들기</button> <button onClick={onLogout}>로그아웃</button> </WorkspaceModal> </Menu> <ChannelList /> <DMList /> </MenuScroll> </Channels> <Chats> <Routes> <Route path='/workspace/:workspace/channel/:channel/*' element={<><Channel /></>} /> <Route path='/workspace/:workspace/dm/:id/*' element={<><DirectMessage /></>} /> </Routes> </Chats> </WorkspaceWrapper> <Modal show={showCreateWorkspaceModal} onCloseModal={onCloseModal}> <form onSubmit={onCreateWorkspace}> <Label id="workspace-label"> <span>워크스페이스 이름</span> <Input id="workspace" value={newWorkspace} onChange={onChangeNewWorkspace} /> </Label> <Label id="workspace-url-label"> <span>워크스페이스 url</span> <Input id="workspace" value={newUrl} onChange={onChangeNewUrl} /> </Label> <Button type="submit">생성하기</Button> </form> </Modal> <CreateChannelModal show={showCreateChannelModal} onCloseModal={onCloseModal} setShowCreateChannelModal={setShowCreateChannelModal} /> <InviteWorkspaceModal show={showInviteWorkspaceModal} onCloseModal={onCloseModal} setShowInviteWorkspaceModal={setShowInviteWorkspaceModal} /> <InviteChannelModal show={showInviteChannelModal} onCloseModal={onCloseModal} setShowInviteChannelModal={setShowInviteChannelModal} /> </div> ) } export default Workspace;Workspace import React from 'react'; import gravatar from 'gravatar'; import { Container, Header } from './styles'; import { useParams } from 'react-router'; import useSWR from 'swr'; import fetcher from '@utils/fetcher'; import ChatBox from '@components/ChatBox'; import ChatList from '@components/ChatList'; const DirectMessage = () => { const { workspace, id } = useParams<{ workspace: string; id: string }>(); const { data: userData } = useSWR(`/api/workspaces/${workspace}/users/${id}`, fetcher); const { data: myData } = useSWR('/api/users', fetcher); if (!userData || !myData) { return null } return ( <Container> <Header> <img src={gravatar.url(userData.email, { s: '24px', d: 'retro' })} alt={userData.nickname} /> <span>{userData.nickname}</span> </Header> <ChatList /> <ChatBox chat="" /> </Container> ) } export default DirectMessage;DirectionMessage import React, { useCallback } from 'react' import { Form } from 'react-router-dom'; import { ChatArea, MentionsTextarea, SendButton, Toolbox } from './styles'; interface Props { chat: string; } const ChatBox: React.FC<Props> = ({ chat }) => { const onSubmitForm = useCallback(() => { }, []); return ( <ChatArea> <Form onSubmit={onSubmitForm}> <MentionsTextarea> <textarea /> </MentionsTextarea> <Toolbox> <SendButton className={ 'c-button-unstyled c-icon_button c-icon_button--light c-icon_button--size_medium c-texty_input__button c-texty_input__button--send' + (chat?.trim() ? '' : ' c-texty_input__button--disabled') } data-qa="texty_send_button" aria-label="Send message" data-sk="tooltip_parent" type="submit" disabled={!chat?.trim()} > <i className="c-icon c-icon--paperplane-filled" aria-hidden="true" /> </SendButton> </Toolbox> </Form> </ChatArea> ) } export default ChatBox;ChatBoximport styled from '@emotion/styled'; export const Container = styled.div` display: flex; flex-wrap: wrap; height: calc(100vh - 38px); flex-flow: column; position: relative; `; export const Header = styled.header` height: 64px; display: flex; width: 100%; --saf-0: rgba(var(--sk_foreground_low, 29, 28, 29), 0.13); box-shadow: 0 1px 0 var(--saf-0); padding: 20px 16px 20px 20px; font-weight: bold; align-items: center; & img { margin-right: 5px; } `; export const DragOver = styled.div` position: absolute; top: 64px; left: 0; width: 100%; height: calc(100% - 64px); background: white; opacity: 0.7; display: flex; align-items: center; justify-content: center; font-size: 40px; `;DirectMessage stylesimport styled from '@emotion/styled'; import { MentionsInput } from 'react-mentions'; export const ChatArea = styled.div` display: flex; width: 100%; padding: 20px; padding-top: 0; `; export const Form = styled.form` color: rgb(29, 28, 29); font-size: 15px; width: 100%; border-radius: 4px; border: 1px solid rgb(29, 28, 29); `; export const MentionsTextarea = styled(MentionsInput)` font-family: Slack-Lato, appleLogo, sans-serif; font-size: 15px; padding: 8px 9px; width: 100%; & strong { background: skyblue; } & textarea { height: 44px; padding: 9px 10px !important; outline: none !important; border-radius: 4px !important; resize: none !important; line-height: 22px; border: none; } & ul { border: 1px solid lightgray; max-height: 200px; overflow-y: auto; padding: 9px 10px; background: white; border-radius: 4px; width: 150px; } `; export const Toolbox = styled.div` position: relative; background: rgb(248, 248, 248); height: 41px; display: flex; border-top: 1px solid rgb(221, 221, 221); align-items: center; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; `; export const SendButton = styled.button` position: absolute; right: 5px; top: 5px; `; export const EachMention = styled.button<{ focus: boolean }>` padding: 4px 20px; background: transparent; border: none; display: flex; align-items: center; color: rgb(28, 29, 28); width: 100%; & img { margin-right: 5px; } ${({ focus }) => focus && ` background: #1264a3; color: white; `}; `;ChatBox stylesimport styled from '@emotion/styled'; export const RightMenu = styled.div` float: right; `; export const Header = styled.header` height: 38px; background: #350d36; color: #ffffff; box-shadow: 0 1px 0 0 rgba(255, 255, 255, 0.1); padding: 5px; text-align: center; `; export const ProfileImg = styled.img` width: 28px; height: 28px; position: absolute; top: 5px; right: 16px; `; export const ProfileModal = styled.div` display: flex; padding: 20px; & img { display: flex; } & > div { display: flex; flex-direction: column; margin-left: 10px; } & #profile-name { font-weight: bold; display: inline-flex; } & #profile-active { font-size: 13px; display: inline-flex; } `; export const LogOutButton = styled.button` border: none; width: 100%; border-top: 1px solid rgb(29, 28, 29); background: transparent; display: block; height: 33px; padding: 5px 20px 5px; outline: none; cursor: pointer; `; export const WorkspaceWrapper = styled.div` display: flex; flex: 1; `; export const Workspaces = styled.div` width: 65px; display: inline-flex; flex-direction: column; align-items: center; background: #3f0e40; border-top: 1px solid rgb(82, 38, 83); border-right: 1px solid rgb(82, 38, 83); vertical-align: top; text-align: center; padding: 15px 0 0; `; export const Channels = styled.nav` width: 260px; display: inline-flex; flex-direction: column; background: #3f0e40; color: rgb(188, 171, 188); vertical-align: top; & a { padding-left: 36px; color: inherit; text-decoration: none; height: 28px; line-height: 28px; display: flex; align-items: center; &.selected { color: white; } } & .bold { color: white; font-weight: bold; } & .count { margin-left: auto; background: #cd2553; border-radius: 16px; display: inline-block; font-size: 12px; font-weight: 700; height: 18px; line-height: 18px; padding: 0 9px; color: white; margin-right: 16px; } & h2 { height: 36px; line-height: 36px; margin: 0; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; font-size: 15px; } `; export const WorkspaceName = styled.button` height: 64px; line-height: 64px; border: none; width: 100%; text-align: left; border-top: 1px solid rgb(82, 38, 83); border-bottom: 1px solid rgb(82, 38, 83); font-weight: 900; font-size: 24px; background: transparent; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; padding: 0; padding-left: 16px; margin: 0; color: white; cursor: pointer; `; export const MenuScroll = styled.div` height: calc(100vh - 102px); overflow-y: auto; `; export const WorkspaceModal = styled.div` padding: 10px 0 0; & h2 { padding-left: 20px; } & > button { width: 100%; height: 28px; padding: 4px; border: none; background: transparent; border-top: 1px solid rgb(28, 29, 28); cursor: pointer; &:last-of-type { border-bottom: 1px solid rgb(28, 29, 28); } } `; export const Chats = styled.div` flex: 1; `; export const AddButton = styled.button` color: white; font-size: 24px; display: inline-block; width: 40px; height: 40px; background: transparent; border: none; cursor: pointer; `; export const WorkspaceButton = styled.button` display: inline-block; width: 40px; height: 40px; border-radius: 10px; background: white; border: 3px solid #3f0e40; margin-bottom: 15px; font-size: 18px; font-weight: 700; color: black; cursor: pointer; `;Workspace Styles (혹시나 해서 스타일까지 올렸습니다)저기 흰색 부분 (Chats) 부분에 아무것도 출력이 되지 않습니다. 아예 DirectMessage 페이지 자체를 못 받아오는 것 같은데 route를 App으로 옮겨서 <div>TEST</div>만 출력 시킬 땐 작동이 됩니다..그래서 <Channel />이랑 <DirectMessage />이렇게 Route바깥으로 빼서 출력해보면const { data: userData } = useSWR(`/api/workspaces/${workspace}/users/${id}`, fetcher);저 ${id} 부분이 undefined가 나옵니다.. 메세지 클릭시 url 주소는 제대로 다 바뀌고 있습니다
-
미해결자바(Java) 알고리즘 문제풀이 입문: 코딩테스트 대비
강사님 2-7 점수계산 문의드립니다.
안녕하세요 선생님덕분에 코딩테스트 열심히 준비하고 있는 학생입니다. 다름이 아니라 궁금한 점이 있어 이렇게 문의 드립니다. 강의와 같은 코드를 구현 후 로컬에서 실행 시켰을 경우에는 답이 정확하게 나오는데 채점 사이트에 올리면 오답이라고 답이 계속 나오는데 혹시 제가 잘못한 부분인건지, 아니면 채점 사이트에서 요구하는 것이 잘못된 것인지 여쭤보고 싶습니다. import java.util.*; class Main { public int solution(int number, int[] numArray) { int answer = 0; int cnt = 0; for (int i = 0; i < number - 1; i++) { if (numArray[i] == 1) { cnt++; answer += cnt; } else { cnt = 0; } } return answer; } public static void main(String[] args) { Main T = new Main(); Scanner kb = new Scanner(System.in); Integer number = kb.nextInt(); int[] numArray = new int[number]; for (int i = 0; i < number; i++) { numArray[i] = kb.nextInt(); } System.out.print(T.solution(number, numArray)); } }