sort()함수 부분에 대해서 헷갈리는 부분이 있어서 질문드려요! 질문1. 인자 a, 인자b의 순서가 다름 제가 알고 있기로는 인자 a - 100, b - 40 으로 알고 있습니다 강사님이 설명하신것은 인자 a - 40, 인자 b - 100입니다. console.log 출력 결과는 a - 100, b - 40 으로 강사님 설명과 반대로 나와서 제가 출력시 실수한 부분이 있는지 질문드립니다 질문2. 양수일때 자리가 바뀐다 질문1. 에서 인자 a - 100, b - 40 이 맞다면 음수일때 자리가 바뀌는게 맞지 않나요?? 바쁘시겠지만 답변부탁드립니다!
본 강의를 모두 수강하였습니다! 코루틴에서 헷갈렸던 개념들을 알 수 있어서 좋았습니다! 본 코루틴 강의에서 자식과 부모 관계의 에러가 발생했을 때 에러 핸들링 하는 경우는 자식이 하나만 존재했을 때의 예시밖에 없어서 직접 2개를 가지고 실험을 해보았습니다! 먼저, 자식1이 취소가 됐을 때에는 취소예외가 발생했기 때문에 부모로 전파되지 않고, 그러므로 다른 자식2도 영향을 받지 않는다 라고 이해를 하고 있습니다! 하지만 자식1에서 취소가 아닌 예외가 발생했을 경우 부모로 전파되는 것으로 알고있고, 이 때 적절한 조치가 되지 않는다면 자식2까지 취소되는 것으로 알고있습니다! 따라서 다음과 같이 CoroutineExceptionHandler를 적용해보았습니다. fun main() = runBlocking { val handler = CoroutineExceptionHandler { _, exception -> println("Caught exception: $exception") } val parentJob = CoroutineScope(Dispatchers.Default).launch(handler) { val job1 = launch { println("Job 1 is running") throw RuntimeException("Error in Job 1") } val job2 = launch { println("Job 2 is running") delay(1000) println("Job 2 is completed") } job1.join() job2.join() } parentJob.join() println("Parent job is completed") } Job 1 is running Caught exception: java.lang.RuntimeException: Error in Job 1 Parent job is completed 결과는 자식1만 실행이되고, 거기서 Exception을 던졌는데, Job2는 취소되는것으로 보입니다..! 질문 1 ) 다음과 같이 try catch 로 전환하면 자식2의 취소가 발생하지 않는데, CoroutineExceptionHandler로는 자식2의 취소를 막을수는 없는 것일까요? val job1 = launch { println("Job 1 is running") try { throw RuntimeException("Error in Job 1") } catch (e: RuntimeException) { println("RuntimeException") } } 질문 2) 강의내용에서는 SupervisorJob() 을 사용하면 부모 코루틴으로 예외가 전파되지 않는다고 해주셨는데, 다음 결과에서는 부모코루틴에 해당되는 CoroutineExceptionHandler 가 실행되는 것으로 보입니다. 하지만, 질문1에서 걱정하는 자식2의 취소로 이어지지 않고 있습니다. 이는 부모코루틴으로 예외가 전파되는 상황일까요?? 만일 전파되는 상황이라면 왜 질문1과는 다르게 자식2의 취소로 이어지지 않는 것일까요? fun main() = runBlocking { val handler = CoroutineExceptionHandler { _, exception -> println("Caught exception: $exception") } val parentJob = CoroutineScope(Dispatchers.Default).launch(handler) { val job1 = launch(SupervisorJob()) { println("Job 1 is running") throw RuntimeException("Error in Job 1") } val job2 = launch { println("Job 2 is running") delay(1000) println("Job 2 is completed") } job1.join() job2.join() } parentJob.join() println("Parent job is completed") } Job 1 is running Job 2 is running Caught exception: java.lang.RuntimeException: Error in Job 1 Job 2 is completed Parent job is completed 자바 -> 코틀린 강의부터 시작해서 코루틴 강의까지 너무 감사하게 잘 보고있습니다! 감사드립니다 🙂
from selenium import webdriver from selenium.webdriver.chrome.options import Options # from selenium.webdriver.chrome.service import Service # from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys import requests from bs4 import BeautifulSoup import time options = Options() user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" options.add_argument(f"user-agent={user_agent}") options.add_experimental_option("detach", True) driver = webdriver.Chrome(options=options) url = "https://kream.co.kr/search?shop_category_id=34" driver.get(url) time.sleep(2) for i in range(1): driver.execute_script("window.scrollTo(0, document.body.scrollHeight)") time.sleep(2) html = driver.page_source soup = BeautifulSoup(html, "html.parser") items = soup.select(".product_card") for item in items: brand = item.select_one(".product_info_brand.brand") name = item.select_one(".translated_name") link = item.select_one(".item_inner").attrs['href'] click = name.text driver.find_element(By.PARTIAL_LINK_TEXT, click).send_keys(Keys.CONTROL+Keys.ENTER) time.sleep(1) driver.switch_to.window(driver.window_handles[-1]) html = driver.page_source soup2 = BeautifulSoup(html, "html.parser") model_num = soup2.select_one("div:nth-child(3) > div.product_info") print(brand.text.strip()) print(name.text) print(model_num.text.strip()) print(f"https://kream.co.kr{link}") print() driver.close() driver.switch_to.window(driver.window_handles[0]) 아무것도 모르는 상태에서 시작했는데 좋은 강의 올려주신 덕분에 크롤링을 조금이나마 맛보게 된 것 같습니다. 어설프게나마 완성은 한거 같은데 궁금한게 있어서 질문 남깁니다. 상품 링크를 타고 들어가야 원하는 정보를 긁어올 수 있는 사이트인데, 자바스크립트로 동작하게끔 되어 있습니다. 시행착오 끝에 셀레니움으로 동작을 시켜봤는데 제품 하나하나마다 새창을 열어서 정보를 가져온 후에 창을 닫고.. 다시 새창을 열어서 정보를 가져온 후에 창을 닫고.. 하다보니 시간도 너무 오래 걸리고 이렇게 하는게 맞는 건지 의구심이 듭니다. 어떻게 해야 속도를 높힐 수 있을까요?
안녕하세요 데브위키님 강의 수강 중 궁금한 점이 있어 질문 드립니다. 제가 지식이 얕아 틀릴 확률이 매우 큰데 저의 생각이 맞았는지 틀렸다면 지적도 부탁드립니다! 클라우트 네이티브 애플리케이션에서의 MSA는 수평 확장이 용이하다고 PART5에서 이해했습니다. 만약 DB 서버를 늘려야 한다고 했을 때 현재 강의에서처럼 Postgre를 도커 볼륨을 사용하여 이중화 DB를 사용한다면 AWS에서 새로운 인스턴스를 만들어서 도커를 설치하고 컨테이너를 만들게 되면 기존 서버의 도커 볼륨에 있는 데이터를 알 수 없어 서버를 늘리기가 힘들다고 생각합니다. 당연히 방법이 있을 것 같은데 확장을 하게 된다면 어떤 방식으로 확장을 하게 되는 건지 질문드립니다!
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. spring-io에서 만들어서 intellj에서 실행했는데 실행이 되지가 않습니다 뭐가 문제일까요 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 여기에 질문 내용을 남겨주세요.
일단 실기가 명확한 풀이과정이 없기는 하기는 하나저는 X_tr, y_tr로 accuracy_score, precision_score, recall_score, f1_score, roc_auc_score 비교한 뒤에점수가 높은것을 바탕으로 다시 train을 fit시키는게 일반적으로 더 나은 전략이 아닌가싶은데(양이 더많으니까)혹시 이게 크게 리스크가 있다거나 혹은 의미가 없다고 볼수있을까요? 강의에서는 X_tr, y_tr로만 하고 끝내길래 궁금해서 여쭤봅니다.
안녕하세요 선생님 🙂 함수에 있는 기저조건과 4가지 숫자가 같을 경우에 리턴 값으로 string(1, a[y][x])를 주셨는데요, 1 또는 0이라고 말씀해주셨지만 이해가 가지 않습니다. string 키워드로 교안과 구글을 찾아봤고, xstring으로 타고 들어가 분석해보려고도 했지만 마땅한 답을 찾지 못하였습니다. string함수 관한 설명이나 참고할 수 있는 교안의 목차를 알려주신다면 정말 감사하겠습니다 🙂 추가로, 함수 안에 있는 string ret = "";를 전역으로 빼면 값이 이상해지더라구요. 이유를 잘 모르겠어서 질문드립니다.
파이어베이스 북마크 만들기 하면서 나오는 에러입니다. 1. Dependency 'androidx.credentials:credentials:1.2.0-rc01' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.0 is 33. Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 2. Dependency 'androidx.credentials:credentials-play-services-auth:1.2.0-rc01' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.0 is 33. Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 3. Dependency 'androidx.navigation:navigation-common:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.0 is 33. Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 4. Dependency 'androidx.navigation:navigation-common-ktx:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.0 is 33. Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 5. Dependency 'androidx.navigation:navigation-runtime:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.0 is 33. Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 6. Dependency 'androidx.navigation:navigation-ui:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.0 is 33. Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 7. Dependency 'androidx.navigation:navigation-runtime-ktx:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.0 is 33. Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 8. Dependency 'androidx.navigation:navigation-ui-ktx:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.0 is 33. Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 9. Dependency 'androidx.navigation:navigation-fragment-ktx:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.0 is 33. Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 10. Dependency 'androidx.navigation:navigation-fragment:2.7.5' requires libraries and applications that depend on it to compile against version 34 or later of the Android APIs. :app is currently compiled against android-33. Also, the maximum recommended compile SDK version for Android Gradle plugin 8.0.0 is 33. Recommended action: Update this project's version of the Android Gradle plugin to one that supports 34, then update this project to use compileSdk of at least 34. Note that updating a library or application's compileSdk (which allows newer APIs to be used) can be done separately from updating targetSdk (which opts the app in to new runtime behavior) and minSdk (which determines which devices the app can be installed on). 대체 어떤 부분을 봐야 할까요...
안녕하세요, 질문이 있어서 글 남기게 되었습니다. 이런식으로 지점(branch)명에 맞는 공간(space)중 미팅룸 리스트를 보여주고 해당 미팅룸의 해당 날짜의 예약들도 보여주는 기능을 구현하고자 @Override public List<Reservation> findReservationListByDateAndBranchName(LocalDateTime startDatetime, LocalDateTime endDateTime, String branchName) { return queryFactory .select(reservation) .from(reservation) .join(reservation.space, space).fetchJoin() .join(space.branch, branch) .where(branch.branchName.eq(branchName), reservation.reservationStartDateTime.between(startDatetime, endDateTime), space.dtype.eq("MeetingRoom") ) .fetch(); } 이런 코드를 작성하였는데 아래와 같은 연관관계 때문에 Reservation Entity @Getter @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) @Table(name = "reservation") public class Reservation extends BaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "reservation_id") private Long reservationId; @Column(name = "reservation_start_date_time") private LocalDateTime reservationStartDateTime; @Column(name = "reservation_end_date_time") private LocalDateTime reservationEndDateTime; @OneToMany(mappedBy = "reservation") private List<MemberReservation> memberReservations = new ArrayList<>(); @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "space_id") private Space space; } Space Entity @Getter @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) @Inheritance(strategy = InheritanceType.JOINED) @Table(name = "space") @DiscriminatorColumn public abstract class Space { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "space_id") private Long spaceId; @NotNull @Column(name = "space_name") private String spaceName; @NotNull @Column(name = "space_floor") private int spaceFloor; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "branch_id") private Branch branch; @OneToMany(mappedBy = "space") private List<Reservation> reservations = new ArrayList<>(); @NotNull @Column(name = "dtype", insertable = false, updatable = false) private String dtype; } Space를 상속받는 FocusDesk, MeetingRoom, RechargingRoom @Getter @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) @Table(name = "focus_desk") public class FocusDesk extends Space { //추후에 해당 엔티티에 맞는 필드들 추가 } @Getter @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) @Table(name = "meeting_room") public class MeetingRoom extends Space { @Column(name = "meeting_room_capacity") @Positive private int meetingRoomCapacity; } @Getter @Entity @NoArgsConstructor(access = AccessLevel.PROTECTED) @Table(name = "recharging_room") public class RechargingRoom extends Space { //추후에 해당 엔티티에 맞는 필드들 추가 } select r1_0.reservation_id, r1_0.created_date, r1_0.last_modified_date, r1_0.reservation_end_date_time, r1_0.reservation_start_date_time, s1_0.space_id, s1_0.dtype, s1_0.branch_id, s1_0.space_floor, s1_0.space_name, s1_2.meeting_room_capacity from reservation r1_0 join (space s1_0 left join focus_desk s1_1 on s1_0.space_id=s1_1.space_id left join meeting_room s1_2 on s1_0.space_id=s1_2.space_id left join recharging_room s1_3 on s1_0.space_id=s1_3.space_id) on s1_0.space_id=r1_0.space_id join branch b1_0 on b1_0.branch_id=s1_0.branch_id where b1_0.branch_name=? and r1_0.reservation_start_date_time between ? and ? and s1_0.dtype=? 이런 쿼리가 나가게 됩니다. 처음에는 dtype 없이 MeetingRoom 만 join 하고 싶었지만 reservation.meetingRoom 이불가능하여(reservation은 space랑 매핑 되어있으니까) 불가능하여 이방법 밖에는 떠오르지 않았습니다. 문제는 위의 쿼리처럼 쓸모없는 테이블들을 강제로 조인한 후에 다시 where절의 dtype으로 구분을 해야한다는 것입니다. @Query("SELECT new com.example.sabujak.reservation.dto.ReservationQueryDto(r.reservationStartDateTime, r.reservationEndDateTime, s.spaceId, s.spaceFloor, s.spaceName, m.meetingRoomCapacity) " + "FROM Reservation r " + "JOIN r.space s " + "JOIN MeetingRoom m ON m.spaceId = s.spaceId " + "JOIN s.branch b " + "WHERE b.branchName = :branchName " + "AND r.reservationStartDateTime BETWEEN :startDateTime AND :endDateTime") 이런식의 jpql로는 해결이 가능하지만 추후에 정렬조건을 동적으로 받아야 하기에 querydsl을 사용해서 최대한 좋은 방향으로 사용하고 싶은데 어떻게 해야할지 잘 모르겠습니다
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] 안녕하세요. 섹션6 날짜와 시간 문제풀이2번째에서 막혀서 질문을 드립니다. 현재 저의 코드 상태가 그림으로 보시는 봐와 같이 이런 상태이고, 지금 이 상태 에서, 월요일이 첫 시작 일 때(2024년 1월 1일기준), 월요일에서 날짜를 넣는 방법을 모르겠더라고요. 이럴 때 에는 문제와 풀이2 해석을 보는게 나은지? 아니면 검색을 해서 라도 푸는게 나은지 알고 싶습니다. 답변 부탁 드립니다. 참조한 클래스는 TestLoopPlus, TestAdjusters 이 두개를 참조 했습니다.(클래스 이름 +import는 pdf에서 봄)