묻고 답해요
158만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결[중급편] 코인 가격 모니터링 앱 제작 (Android Kotlin)
15, 30, 45분 데이터 및 어댑터 오류
안녕하세요 ㅠㅠ 찾아보니 저랑 똑같은 오류가 있는 분이 먼저 글을 올리셨더라구요.. 하지만 해결책이 댓글에 없어서 제가 다시 작성해봅니다.https://www.inflearn.com/questions/984537 저도 이분과 마찬가지로 어댑터를 연결했는데 그냥 아래와 같이 연결이 안됩니다. 제것은 물론 이건 개복치님 코드로 돌려본건데도 이럽니다..그리고 추가로 15분, 30분, 45분 데이터가 쌓이질 않습니다ㅠㅠ 관심있는 코인을 계속 추가할 경우 그 추가한 코인도 15, 30, 45분 데이터가 쌓이나요??
-
해결됨한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지
코드에서 궁금한게 있습니다.
<>{content}</> 로 쓰면 에러가 안나고{content} 로쓰면 에러가 나는 이유가 뭘까요 ??? 작성자 : {id} | 감정 : {emotion}<div className="content"> {isEdit ? ( <textarea value={localContent} onChange={(e) => setLocalContent(e.target.value)} /> ) : ( <>{content}</> )} </div>여기서 강의 보면 id,emotion는 <></>을 안쓰는데 content를 쓰는 이유가 뭔지 모르겠습니다. 어차피 const DiaryItem = ({ onEdit, onDelete, author, content, emotion, create_date, id, }) => {전부 List로 부터 받아오는데 누군 <>{content}</>이고 누군 그냥 {id} {emotion}인 이유가 먼지 궁금해요그리고 data.filter((it)=>(it.id!==targetId)); 을 data.filter((it)=>{it.id!==targetId}); 로 바꾸면 왜 에러가 나는걸까요 ?? ?언제 괄호를 쓰고 언제 중괄호를 써야하는지 정확히 알수있을까요 ??? 아래는 전체 코드입니다.import { useRef, useState } from "react"; const DiaryItem = ({ onEdit, onDelete, author, content, emotion, create_date, id, }) => { const [isEdit, setIsEdit] = useState(false); const toggleIsEdit = () => setIsEdit(!isEdit); const [localContent, setLocalContent] = useState(content); const handleDelete = () => { console.log(id); if (window.confirm(`${id}번쨰 일기를 삭제하겠습니까?`)) { onDelete(id); } }; const handleQuiteEdit = () => { setIsEdit(false); setLocalContent(content); }; const handleEdit = () => { onEdit(id, localContent); }; return ( <div className="DiaryItem"> <div className="info"> <span className="author_info"> 작성자 : <>{id}</> | 감정 : <>{emotion}</> </span> <br /> <span className="date">날짜: {create_date}</span> </div> <div className="content"> {isEdit ? ( <textarea value={localContent} onChange={(e) => setLocalContent(e.target.value)} /> ) : ( <>{content}</> )} </div> {isEdit ? ( <> <button onClick={handleQuiteEdit}>수정취소</button> <button onClick={handleEdit}>수정완료</button> </> ) : ( <> <button onClick={handleDelete}>삭제하기</button> <button onClick={toggleIsEdit}>수정하기</button> </> )} </div> ); }; export default DiaryItem;
-
미해결스프링 입문 - 코드로 배우는 스프링 부트, 웹 MVC, DB 접근 기술
빌드후 실행하면 동작도 잘 되는데 종료하고 나면 오류메시지가 나오네요
Execution failed for task ':DcsSpringApplication.main()'.> Build cancelled while executing task ':DcsSpringApplication.main()'* Try:> Run with --stacktrace option to get the stack trace.> Run with --info or --debug option to get more log output.> Run with --scan to get full insights.> Get more help at https://help.gradle.org.Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.For more on this, please refer to https://docs.gradle.org/8.2.1/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.BUILD FAILED in 18s3 actionable tasks: 1 executed, 2 up-to-date 라는 오류가 나오는데 무시해도 되는건가요?
-
해결됨스프링 시큐리티
SecurityConfig에서 사용하는 빈 주입 방식 질문
안녕하세요 3) 인증 처리자 - AjaxAuthenticationProvider 수업 듣던중 질문 남깁니다. SecurityConfig에서 어떤건 @Component로 빈 생성한 뒤에 Autowired로 주입받고(ex)CustomAuthenticationSuccessHandler ), 어떤건 @Component 안달고 직접 new 생성자 호출해서 @Bean 어노테이션으로 빈 등록을 하고 계시는데 (ex:CustomAuthenticationProvider 또는 FormAuthenticationProvider) 빈 주입하는 방식이 다른 이유가 궁금합니다. 일단 제가 해봤을 때 CustomAuthenticationProvider 에 @Component를 달면, SecurityConfig에 @Bean으로 등록한 PasswordEncoder 관련해서 빈 생성이 꼬이게 되는 것은 확인했는데요 단지, @Component를 달아보니까 꼬이더라 라는 이유를 넘어서서, SecurityConfig에서 사용하는 Bean을 주입하는 방식에 대해 구분하는 기준이 있다면 가르쳐주시면 감사하겠습니다.
-
미해결[리뉴얼] 타입스크립트 올인원 : Part2. 실전 분석편
axios catch 에서 error 타입에 대해 as 없이 이렇게 사용하면 어떨까요?
interface IResponse<T = {}> { data: T; message: string; } interface IUser { id: string; email: string; name: string; } class CustomError<T> extends AxiosError<T> { constructor(...args: any[]) { super(...args); } static isCustomError<T>(value: any): value is CustomError<T> { return value instanceof CustomError<T>; } } axios.get('').then().catch((error: unknown) => { if (CustomError.isCustomError<IResponse<IUser>>(error)) { // console.error( // (error as AxiosError<{ message: string }>.response?.data.message) // ) const errorMessage = error.response?.data.message; } })response의 대해서 타입이 좁혀지긴 하지만, 지저분해서 맞는 방법인지 모르겠네요
-
해결됨부트캠프에서 알려주지 않는 것들 (리액트) 1편
[섹션 3. Form 컴포넌트로 배우는 실전 기술] 강좌의 소스를 부탁드립니다.
안녕하세요 저는 리액트만 4년차 개발자인데요.. 기존에 리액트 강좌를 무지 많이 수강했음에도 아직도 많이 부족하다 싶어서 강사님의 강좌를 듣게 되었는데 많은 도움이 되고 있어서 너무 감사합니다. 참고로 아래와 같은 과정을 수상신청을 아래와 같이 했습니다. 부트캠프에서 알려주지 않는 것들 (리액트 렌더링 최적화 편) 2편부트캠프에서 알려주지 않는 것들 (리액트) 1편클론코딩에서 알려주지 않는 것들 (시스템 이론과 DB) 1편실전 연습으로 익히는 고급 타입스크립트 기술 다만 부탁이 있어서요 다름이 아니라 좀더 세심하게 코드를 보구 싶어서요혹시 강좌중 부트캠프에서 알려주지 않는 것들 (리액트) 1편 에서 섹션 3. Form 컴포넌트로 배우는 실전 기술 강좌의 소스를 과정별로 브랜치로 구분한 레파지토리는 없는지 해서요..강좌별로 들으면서 분석하면 많은 도움이 될거 같아서 문의 드립니다.정 안되면 최종 소스라도 부탁드립니다. 위에 강좌 신청을 좋게 봐 주셔서 부탁드립니다.공개가 힘드시면 메일이라도 부탁드리면 안될런지요? manhattansky73@gmail.com 입니다.감사합니다.
-
해결됨이득우의 언리얼 프로그래밍 Part2 - 언리얼 게임 프레임웍의 이해
소프트 레퍼런싱 관련 질문
안녕하세요, 강사님. 이번 강의에서 소프트 레퍼런싱 부분에서 질문이 있어서 글을 남겨봅니다. 강사님께서 설명해준대로 무기 아이템 상자를 먹기 전에는 해당 무기의 스켈레탈 메쉬가 로딩되지 않고 아이템 상자를 먹고 난 다음에 로딩되는 것을 확인하였습니다.이후 플레이를 종료하고 다시 플레이를 해보았는데요, 2번째 플레이부터는 무기 아이템 상자를 먹기 전에 이미 무기의 스켈레탈 메쉬가 로딩되어있는 것을 확인했습니다. 그래서 이번에는 아예 에디터를 종료한 다음 다시 에디터를 실행해 보았습니다. 에디터를 새롭게 다시 시작한 첫 플레이에서는 정상적으로 무기 아이템 상자를 먹기 전에는 해당 무기의 스켈레탈 메쉬가 로딩되지 않는 것을 확인했습니다. 이후 2번째 플레이부터는 이전과 마찬가지로 무기 아이템 상자를 먹기 전에 이미 무기의 스켈레탈 메쉬가 로딩되어있는 것을 확인했습니다. 에디터를 실행한 이후에 한 번이라도 스켈레탈 메쉬를 로딩하게 되면 에디터를 종료하기 전까지는 계속해서 에디터에 로딩된 상태로 남아있는 것인가요?? 개인적으로는 매번 플레이 할 때마다 소프트 레퍼런싱을 통해서 무기 아이템 상자를 먹기 전에는 무기 스켈레탈 메쉬가 로딩되지 않아야 한다고 예상했는데,직접 실행해본 결과 그렇지 않다보니, 원래 이런 것인지 에디터 상 오류인 것인지 여쭈어봅니다.
-
미해결홍정모의 따라하며 배우는 C언어
c언어에서 바이너리 표현
강의 3분08초를 보면c++같은 경우에는 바이너리 넘버(2진수표현법)를 코딩할 때 직접 사용할 수 있지만 c언어같은 경우 불가능하다고 하셨는데 숫자앞에 0b를 붙여서 표현가능하지 않나요?ex) 0b00000001이렇게 가능하지 않나요?제가 다르게 이해한 걸까요?감사합니다.
-
미해결차이를 만드는 AWS 클라우드 보안 첫걸음
강의자료를 어디서 구할 수 있나요..
강의자료는 어디서 구할 수 있나요..?
-
미해결
Development Essay Topics:Hot Ideas About Personality Development
Certainly! Here are some hot essay topics related to personality development:The Role of Nature vs. Nurture in Personality Development: Explore the debate over whether genetics (nature) or environmental factors (nurture) have a more significant impact on the development of personality traits.Cultural Influences on Personality Development: Examine how cultural norms, values, and practices shape an individual's personality and identity.The Influence of Early Childhood Experiences on Personality: Discuss the lasting effects of childhood experiences, such as attachment styles and parenting, on the development of personality. Personality Development Classes in PuneThe Impact of Technology and Social Media on Personality Development: Analyze how digital technologies and online interactions are shaping modern personality traits, social skills, and self-esteem.Personality Development in the Digital Age: Explore the challenges and opportunities of personality development in a world characterized by constant connectivity and information overload.The Role of Education in Personality Development: Investigate how the education system can foster or hinder the development of various personality traits, including creativity, resilience, and critical thinking.Personality Development and Mental Health: Examine the relationship between personality traits and mental health outcomes, such as anxiety, depression, and personality disorders.Self-Concept and Self-Esteem in Personality Development: Analyze how an individual's self-concept and self-esteem evolve over time and their impact on overall personality development.The Influence of Peer Groups on Personality: Discuss how peer relationships and peer pressure shape the development of personality traits, attitudes, and behaviors.Gender and Personality Development: Explore how societal expectations and gender roles influence the development of personality in individuals of different genders.The Importance of Emotional Intelligence in Personality Development: Investigate the role of emotional intelligence in shaping personality and its impact on personal and professional success. Personality Development Course in PuneResilience and Personality Development: Examine the relationship between resilience, adversity, and the development of personality traits such as perseverance, adaptability, and coping skills.Personality Development in Adulthood and Aging: Discuss how personality traits change and evolve as individuals progress through different stages of adulthood and into old age.Cross-Cultural Perspectives on Personality Development: Compare and contrast how personality development differs across various cultures and societies.Personal Growth and Self-Actualization: Explore the concept of self-actualization and how individuals can strive for personal growth and self-fulfillment throughout their lives.These essay topics offer a range of opportunities to delve into the fascinating field of personality development, considering various influences and aspects that contribute to the development of an individual's unique personality. Depending on your interests and the scope of your essay, you can focus on specific subtopics or aspects within the broader field of personality development. Personality Development Training in Pune
-
해결됨직장인에게 꼭 필요한 파이썬-아래아한글 자동화 레시피
시험지 만들기파트 질문
안녕하세요 선생님! 오랜만에 들어와서 공부를 다시 하고 있는데 시험지 합치기에서 궁금한게 있어서요. EBS 모의고사도 같은 방법으로 가능할지 궁금해져서 데이터를 수집하려고 보니까 pdf로만 제공이 되고 있더라구요 ㅠㅠ 혹시 한글로 받을 수 있는 경로를 알려주실 수 있을까요??
-
해결됨[왕초보편] 앱 8개를 만들면서 배우는 안드로이드 코틀린(Android Kotlin)
주사위앱 관련해서 질문 있습니다!
안녕하세요?오늘도 선생님 강의와 똑같이 따라한 것 같은데주사위가 선생님 버전보다 밑에 있고 버튼은 더 밑에 있어서 보이지 않습니다.혹시 해결 방법을 알고 계시면 알려 주시면 감사하겠습니다.풍요로운 한가위 보내시기를 바라고 항상 감사드립니다. 그리고 제 코드는<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#008000" android:orientation="vertical" tools:context=".MainActivity"> <LinearLayout android:layout_width="match_parent" android:layout_height="200dp" android:layout_marginTop="100dp"> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="30sp" android:textColor="@color/black" android:layout_margin="20dp" android:gravity="center" android:textStyle="bold" android:text="인생은 주사위 한방에 가는 거 아니겠습니까?"/> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="200dp"> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="200dp" android:weightSum="2"> <ImageView android:src="@drawable/dice_1" android:layout_width="120dp" android:layout_height="120dp" android:layout_weight="1"/> <ImageView android:src="@drawable/dice_2" android:layout_width="120dp" android:layout_height="120dp" android:layout_weight="1"/> </LinearLayout> <Button android:text="인생 고고" android:layout_width="match_parent" android:background="@color/black" android:textColor="@color/white" android:layout_height="50dp" android:layout_margin="50dp"/> </LinearLayout>입니다!
-
미해결
앱 번들 버전 오류
Suggestion: use a compatible library with a minSdk of at most 16,or increase this project's minSdk version to at least 19, 앱 번들 버전오류 인거 같은데 어디서 수정해야 할까요?
-
해결됨문법 공부 다음엔, 자바스크립트 프로젝트 101
filter 영상에서 질문이 있습니다
const selectCategory = (e) => { if (!myProducts) { alert('상품 목록을 불러와주세요.'); } else { const {selectedIndex} = e.target.options; // 구조분해할당 문법 const {value} = e.target.options[selectedIndex]; } }여기서 구조분해 할당 문법이 적용이 되었는데 잘 이해가 가지 않아서 질문 드립니다. 1) 구조분해 할당은 배열/객체에서 적용이 가능한 것으로 알고 있는데요, console.log(e.target.options) 를 찍어보면 Array 가 아닌 "HTMLOptionsCollection" 으로 반환이 되는데 어떻게 객체로 되어서 문법이 가능한지 궁금합니다.=> 보니까.. 첫 Prototype 에만 HTMLOptionsCollection 으로 반환이 되고, Prototype 에서 계속 타고 내려갈수록 결국 "Object" 에서 파생된거라 가능한건가요?2) option 의 value 값을 어떻게 한 번에 받아올 수가 있는지 궁금합니다. 부가 설명을 드리자면, e.target.options 를 찍으면 많은 정보들(ex. tagName, className, value 등등)이 나오는데요. 원래대로라면 e.target.options[selectedIndex].value 처럼 접근해야 값을 가져올 수 있는건데, 여기서는 const {value} = e.target.options[selectedIndex] 로 한 번에 가져오는게 궁금합니다.=> 해당 부분을 콘솔로 찍어보았을 때 아래처럼 HTML 태그를 가져오는 건 확인했습니다.<option value="life">생활용품</option>여기서 구조분해 할당 문법 적용 시 태그에 선언되어 있는 attribute 값이 자동으로 적용 이 되어 가져오는 건지, 아니면 문법적으로 뭔가 고정된 식 이 있는건지 궁금합니다.아래는 제가 const {value} = e.target.options[selectedIndex]; 코드로 적고 콘솔로 찍었을 때 반환하는 값을 테스트 해 본 결과로 공유 드립니다. <select name="category" class="select"> <option value="life">생활용품</option> <!-- "life" 반환 --> <option data-id="test">생활용품</option> <!-- "생활용품" 반환 --> <option data-id="test" value="life">생활용품</option> <!-- "life" 반환 --> </select>
-
해결됨Slack 클론 코딩[백엔드 with NestJS + TypeORM]
socket.io 사용시 랜덤하게 객체가 emit 됩니다.
안녕하세요 제로초님~ 백엔드 개발자 지망생이자 제로초님의 팬인 신유빈입니다.1개월 가량 하기 문제를 구글링 하며 여러 경우의 수를 찾아보았지만 이유를 찾지 못하여 질문드립니다.질문드리고자 하는 내용은 이렇습니다.socket.io 로 이벤트를 emit 할때, 같은 메서드를 사용함에도 객체에 따라 클라이언트에 전송될 때도 있고, 전송되지 않을 때도 있는데 그 원인을 찾지 못하고 있습니다.현재 저는 신규게시물 혹은 댓글이 작성되었을때 모든 사용자에게 알림을 emit 하고자 합니다.현재 3가지의 경우 중 A만 성공중인 상태입니다.A : 테스트를 위하여 handleConnection 메서드에서 소켓에 연결한 사용자의 정보 객체를 message 로 전송시 성공B : 게시물 작성 시 생성한 알림 메시지 객체를 message 로 전송시 실패C: 댓글 작성 시 생성한 알림 메시지 객체를 message 로 전송시 실패모든 케이스에서 클라이언트에게 메시지를 성공적으로 보내려면 어떻게 해야할지 도움을 주실 수 있을까요?// 실행 동영상 https://youtu.be/AgLmcV53EvM// 코드깃허브 저장소 전체 코드https://github.com/fog-of-war/dev-be/blob/zerocho/README.mdEventsGatewayhttps://github.com/fog-of-war/dev-be/blob/zerocho/src/events/events.gateway.ts#L55 // fow-be/src/events/events.gateway.ts /** 웹소켓 연결시 */ handleConnection(@ConnectedSocket() socket: Socket, client: any) { const interval = setInterval(() => { const userInfo = socket.userInfo; this.sendMessage(userInfo); }, 5000); socket.on("disconnect", () => { clearInterval(interval); }); } /** 메시지 전송 */ sendMessage(message?: any) { console.log(" \n 🌠 sendMessage \n", message); this.server.emit("message", message); return Promise.resolve("Message sent successfully"); } AlertServicehttps://github.com/fog-of-war/dev-be/blob/zerocho/src/alert/alert.service.ts#L12 // fow-be/src/alert/alert.service.ts // B: 게시물 작성시 실행되는 알림 서비스 코드 async createNotifyAlert(id: number) { const data = { alert_place_id: id, alert_type: "NOTIFY" as Type }; const alert = await this.prisma.alert.create({ data: data }); const result = await this.makePostAlertMessage(id); await this.eventsGateway .sendMessage(result) .then((response) => { // console.log("🌠 Notification sent successfully:", response); }) .catch((error) => { console.error("🌠 Error sending notification:", error); // 전송 실패 또는 오류가 발생한 경우에 실행할 로직을 여기에 추가 }); return result; }// fow-be/src/alert/alert.service.ts // C : 댓글 작성시 실행되는 알림 서비스 코드 async createActivityAlert(id: number) { const data = { alert_comment_id: id, alert_type: "ACTIVITY" as Type }; const alert = await this.prisma.alert.create({ data: data }); const result = await this.makeCommentAlertMessage(id); await this.eventsGateway .sendMessage(result) .then((response) => { // console.log("🌠 Notification sent successfully:", response); }) .catch((error) => { console.error("🌠 Error sending notification:", error); }); return result; } // 출력결과# A : 클라이언트에 전송 성공 🌠 sendMessage { sub: 2, user_email: 'shin.yubin18@gmail.com', iat: 1695983169, exp: 1695986769 } # B : 클라이언트에 전송 실패 🌠 sendMessage { place_id: 1, place_name: '코엑스', region_name: '강남구', post_id: 65, post_created_at: 2023-09-29T10:27:28.371Z, post_image_url: 'https://fog-of-war.s3.ap-northeast-2.amazonaws.com/랜드마크/1코엑스.jpeg' } # C : 클라이언트에 전송 실패 🌠 sendMessage { user_nickname: '구글신유빈', user_image_url: 'https://fog-of-war.s3.ap-northeast-2.amazonaws.com/defaultProfile.png', comment_id: 15, comment_text: '우왕', comment_created_at: 2023-09-29T10:52:24.960Z }
-
미해결ESXi 가상 인프라 구축과 보안 솔루션을 활용한 이상징후 탐지 모니터링
pfsense 설정 후 외부로 ping 불가
모든 절차를 똑같이 설정한 이후, pfsense를 최종적으로 설정하였습니다.그 이후 pfsense의 netgate services and support 부분이 무한 회전을하고,pfsense에서 8.8.8.8로의 핑이 나가질 않습니다. 또한 이를 확인해보고자 router 인 vyos에서도 ping 을 시도하였는데 ping이 8.8.8.8로 나가지 않습니다.모든 설정값이 동일했다는 가정하에, ping이 pfsense 설정 이후 나가지지 않게되는 이유가 무엇이며, 해결 방안은 무엇인가요?
-
미해결
integerOverFlow 뜨는 이유가 궁금합니다. 1섹션1강
#include <iostream> #include <cstdlib> using namespace std;1090번 문제 1섹션 1강 완전탐색 강의 5번째 문제입니다.c++에서 만든 코드입니다. 백준에 제출 했는데 integerOverFlow로 오류가 나옵니다.(예제는 모두 잘 실행됩니다)int의 범위에서 문제가 생길 것 같은 곳은 long long int 나 arr로 고쳤는데도 런타임 오류가 계속 뜹니다.도저히 어떤 부분에서 문제가 생기는지 짐작이 안가네요 int main(int argc, char **argv) { int n; int pointX, pointY; // <- 기준으로 완전 탐색 int minX, minY, maxX, maxY; //완전 탐색할 범위 cin >> n; int arr[n][2]; for(int i=0; i<n; i++){ cin >> arr[i][0] >> arr[i][1];//함수값 받기 } minX = arr[0][0]; maxX = arr[0][0]; //일단 값 1개 설정 minY = arr[0][1]; maxY = arr[0][1]; for(int i=1; i<n; i++){ // 완전 탐색할 범위 찾기 if(arr[i][0]>maxX){ maxX = arr[i][0]; } else if(arr[i][0]<minX){ minX = arr[i][0]; } if(arr[i][1]>maxY){ maxY = arr[i][1]; } else if(arr[i][1]<minY){ minY = arr[i][1]; } } pointX=minX; pointY=minY; long long int size = (maxY-minY+1)*(maxX-minX+1); //완전 탐색하는 횟수 long long int xy=0; // 완전 탐색해서 2차원 배열에 넣기 위한 열의 *번째 long long int arr_dis[size][n]; for(int i=minY; i<=maxY; i++){ for(int j=minX; j<= maxX; j++){ for(int l=0; l<n; l++){ //각 점에서 최소길이 구해서 한 행에 순차적으로 넣기 int subY= 0, subX=0; subY = i-arr[l][1]; subX = j-arr[l][0]; arr_dis[xy][l] = abs(subX) + abs(subY); } xy+=1; } } //일단 가능한 범위 내에서 모든 경우의 수를 다 구하는 것이기 떄문에 //최소 길이는 작은 순으로 정렬 안해도 된다고 판단. 맞는지는 확인 못함 //답이 되는 어떠한 한 점의 경우가 배열의 한 행에 무조건 있을 것 //arr_dis 출력 이상 없었음 /* for(int i=0; i<xy; i++){ for(int j=0; j<n; j++){ cout << arr_dis[i][j] << " "; } cout << "\n"; } */ for(int i=1; i<=n; i++){ long long int min_distance = 50000001; if(i==1){ cout << 0 << " "; continue; } for(int j=0; j <xy; j++){ // k개 사이의 최소 거리 찾기 int sum = 0; for(int k=0; k<i; k++){ sum += arr_dis[j][k]; } if(sum<min_distance){ min_distance = sum; } } cout << min_distance << " "; } return 0; /* for(int i=0; i<xy; i++){ for(int j=0; j<n; j++){ cout << arr_dis[i][j] << " "; } cout << "\n"; } n xy0 1 3 8 1 0 2 7 2 1 1 6 3 2 0 5 4 3 1 4 5 4 2 3 6 5 3 2 7 6 4 1 8 7 5 0 */ }
-
미해결Do it! 알고리즘 코딩테스트 with JAVA
12891_DNA비밀번호
package baekjoon; import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.StringTokenizer; public class p12891_DNA비밀번호 {static int[] myArr;static int[] checkArr;static int checkSecret; public static void main(String[] args) throws IOException {BufferedReader br = new BufferedReader(new InputStreamReader(System.in));StringTokenizer st = new StringTokenizer(br.readLine());int s = Integer.parseInt(st.nextToken());int p = Integer.parseInt(st.nextToken()); int result = 0;checkArr = new int[4]; // 비밀번호 체크 배열myArr = new int[4]; // 현재 상태 배열char[] a = new char[s];checkSecret = 0; // 현재 p개 중 몇개가 비밀번호 요건에 만족하는지 a = br.readLine().toCharArray();st = new StringTokenizer(br.readLine());for (int i = 0; i < 4; i++) {checkArr[i] = Integer.parseInt(st.nextToken());if (checkArr[i] == 0) {checkSecret++; // i번째 값은 이미 완성됨.}} for (int i = 0; i < p; i++) { // 부분 문자열 처음 받을 때 세팅Add(a[i]); // 현재 상태 배열에 담음} if (checkSecret == 4) {result++;} // 슬라이딩 윈도우for (int i = p; i < s; i++) {int j = i - p; // j = 맨 왼쪽, i = 맨 오른쪽Add(a[i]); // 오른쪽에 있는 값 추가Remove(a[j]);if (checkSecret == 4) {result++;}} System.out.println(result);br.close();} private static void Remove(char c) {switch (c) {case 'A':if (myArr[0] == checkArr[0]) // 같으면 이번에 빠짐으로써 충족이 안 되는 것이니까 checkSecret 하나 줄임checkSecret--;myArr[0]--;break;case 'C':if (myArr[1] == checkArr[1])checkSecret--;myArr[1]--;break;case 'G':if (myArr[2] == checkArr[2])checkSecret--;myArr[2]--;break;case 'T':if (myArr[3] == checkArr[3])checkSecret--;myArr[3]--;break;}} private static void Add(char c) {switch (c) {case 'A':myArr[0]++;if (myArr[0] == checkArr[0])checkSecret++; // 'A'가 더 많이 들어온다고 해서 checkSecret값을 올리면 되는 게 아니므로 딱 같을 때에만 증가시킴break;case 'C':myArr[1]++;if (myArr[1] == checkArr[1])checkSecret++;break;case 'G':myArr[2]++;if (myArr[2] == checkArr[2])checkSecret++;break;case 'T':myArr[3]++;if (myArr[3] == checkArr[3])checkSecret++;break;}}}현재 백준에서 문제가 통과되지 않고 있는데 혹시 잘못된 부분이라도 있을까요?ㅠ
-
미해결AWS(Amazon Web Service) 입문자를 위한 강의
connect.php 파일 오픈 안될 경우
기존에 있는 s3 connet.php 파일은 현재 php 버전에서 지원하지 않는 코드입니다 ;;;;; 하,,,, 그래서 찾아보니 현재 최신 버전에 맞는 코드로 작성해야 합니다. <?php$username = "";$password = "";$hostname = "";$dbname = "";// 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();?> 계속 http 에러가 뜨길래 뭔가 했는데 그냥 코드 문제였네요.. 강의가 좀 된거라서 그런지 안맞거나 안되는 부분이 너무 많습니다.
-
미해결자바와 스프링 부트로 생애 최초 서버 만들기, 누구나 쉽게 개발부터 배포까지! [서버 개발 올인원 패키지]
user domain 생성관련
안녕하세요 선생님, 7강 유저 생성 에서 질문이 생겨 남깁니다. DTO에 User를 생성하는 클래스가 있는데 domain으로 따로 빼서 User클래스를 또 생성하는 이유는 무엇인가요? 스프링부트의 구조 짜는 법을 잘 모르고 있는건가 싶기도 하고..dto는 단순히 어떤 데이터로 통신할건지 정의만 해놓고 상세한 정의는 domain 의 user에서 하는 개념인건가요? 상세한 설명 부탁드리겠씁니다..!