안녕하세요~ 셀레니움 강의를 따라가던 중, 네이버 창을 열고 브라우저 꺼짐 방지시켜주는 코드까지 입력을 하고 실행했는데 네이버 창이 떴다가 곧 '주의 요함' 이라고 뜨는 Chrome 창으로 전환이 되어 버립니다. 위에 팝업으로 'Chrome이 자동화된 테스트 소프트웨어에 의해 제어되고 있습니다' 라고도 떠 있습니다. 해결 방안이 있을까요?
우리는 만약 int[] a = {1,3,2} ; 라고 주어졌다면 Arrays.sort(a) ; 를 하면 되는 것으로 알고 있습니다. 그런데 AudioBook 의 경우에는 사용자가 정의한 객체이기 때문에 sort 의 기준이 명확하지 않아 compareTo 메서드를 사용해야하는 것으로 알고 있어요. 그런데 여기서 AudioBook 객체가 Comparable class 를 반드시 implements 해야하는 이유는 그래야 Arrays.sort() 를 이용할 수 있기 때문인가요? 만약 implements 없이 그냥 사용하면 Arrays.sort() 에서는 compareTo 를 활용해야한다는 인식 자체를 못하는 건가요? 아래에는 제가 질문을 하게끔 만든 코드입니다. public class Books { //----------------------------------------------------------------- // Creates a AudioBookCollection object and adds some books to it. Prints // reports on the status of the collection. //----------------------------------------------------------------- public static void main (String[] args) { AudioBookCollection library = new AudioBookCollection(); library.addBook("The Kaiju Preservation Society", "John Scalzi", "Will Wheaton", 25.99, 482); library.addBook("Revenger", "Alastair Reynolds", "Clare Corbett", 22.94, 880); library.addBook("Klara and the Sun:A Novel", "Kazuo Ishiguro", "Sura Siu", 24.50, 616); library.addBook("Endurance: Shackleton's Incredible Voyage", "Alfred Lansing", "Simon Prebble", 21.83, 620); library.addBook("Barbarian Days: A Surfing Life", "William Finnegan", "William Finnegan", 21.99, 1088); System.out.println(library); library.sort(); System.out.println(library); } } import java.text.NumberFormat; import java.util.Locale; import java.util.Arrays; public class AudioBookCollection { private AudioBook[] collection; private int count; private double totalCost; /*----------------------------------------------------------------- * Constructor: Creates an initially empty collection. *----------------------------------------------------------------*/ public AudioBookCollection () { collection = new AudioBook[100]; count = 0; totalCost = 0.0; } /*----------------------------------------------------------------- * Adds an audio book to the collection, increasing the size of the * collection if necessary. *----------------------------------------------------------------*/ public void addBook (String title, String author, String readBy, double cost, int minutes) { if (count == collection.length) this.increaseSize(); collection[count] = new AudioBook(title, author, readBy, cost, minutes); totalCost += cost; count++; } /*----------------------------------------------------------------- * Returns a report describing the Book collection. *----------------------------------------------------------------*/ public String toString() { Locale usa = new Locale("en", "US"); NumberFormat fmt= NumberFormat.getCurrencyInstance(usa); String report = "~~~~~~~~~~~~~~Wow Cool~~~~~~~~~~~~~~~~~~~~~~~\n"; report += "My Audio Book Collection\n\n"; report += "Number of Books: " + count + "\n"; report += "Total cost: " + fmt.format(totalCost) + "\n"; report += "Average cost: " + fmt.format(totalCost/count); report += "\n\nBook List:\n\n"; for (int i = 0; i < count; i++) report += collection[i] + "\n"; return report; } public void sort() { Arrays.sort(collection,0,count); } //----------------------------------------------------------------- // Increases the capacity of the collection by creating a // larger array and copying the existing collection into it. //----------------------------------------------------------------- private void increaseSize () { AudioBook[] temp = new AudioBook[collection.length*2]; for (int i = 0; i < collection.length; i++) temp[i] = collection[i]; collection = temp; } } import java.text.NumberFormat; import java.util.Locale; public class AudioBook implements Comparable<AudioBook> { private String title, author, readBy; private double cost; private int minutes; //----------------------------------------------------------------- // Creates a new audio book with the specified information. //----------------------------------------------------------------- public AudioBook (String title, String author, String readBy, double cost, int minutes) { this.title = title; this.author = author; this.readBy = readBy; this.cost = cost; this.minutes = minutes; } //----------------------------------------------------------------- // Returns a string description of this audio book. //----------------------------------------------------------------- public String toString() { // for formatting money NumberFormat fmt= NumberFormat.getCurrencyInstance(Locale.US); // instead of using the ready-made Locale.US we could also create our own // Locale usa = new Locale("en","US") // try looking up country locale codes on the web! // for formatting strings String description; description = String.format(fmt.format(cost) + "\t" + minutes + "\t" + "%-20s" + "\t" + "%-50s",author,title); return description; } // compare based on book length public int compareTo(AudioBook other) { int answer = 0; if (this.minutes<other.minutes){ answer = -1; } if (this.minutes>other.minutes){ answer = 1; } return answer; } }
파이썬의 pyautoGUI.locateAllOnScreen의 경우 찾는 대상의 이미지픽셀이 달라지면 찾지 못하고 confidence 속성을 넣어 조정을 한다해도 한계가 있음을 확인했습니다. 실시간으로 움직이면서 색상과 크기 변하는 대상의 경우 어떤식으로 서치를 할수 있나요? 템플릿매칭에서 어떠한 전처리 과정을 거치는식으로 풀어가는게 맞을지 궁금합니다.
안녕하세요 큰돌님 강의 잘 듣고 있습니다. 3 - I (17071번)를 푸는데 bfs의 경계조건을 바로 밑에 코드에서 for(int next : {here + 1, here - 1, here * 2}){ if(next < 0 || next > max_n || visited[turn % 2][next]) continue; 아래와같이 바꾸면 런타임 에러 (OutOfBounds)가 발생하는데 그 이유가 궁금합니다. for(int next : {here + 1, here - 1, here * 2}){ if(visited[turn % 2][next] || next < 0 || next > max_n) continue;
안녕하세요. CAS 이해와 활용 -1 편 강의를 듣다가 질문 드립니다. 3분쯤에 PDF 자료에 'CAS는 CPU 캐시와 메인메모리의 두 값을 비교하고 그 값이 동일할 경우 새로운 값으로 교체하는 동기화 연산으로 여러 스레드가 공유하는 메모리 영역을 보호하는 데 사용된다'라고 나와있는습니다. 그런데 이후 강의를 듣다 보면 Main Memory Value, Expected Value, New Value 이렇게 세 가지 키워드로 CAS가 진행되더라구요. 여기서 Expected Value가 PDF 설명에 나와 있는 'CPU 캐시'를 의미하는 것 같은데요(강의 19분 쯤) 기대값은 특정 블록 안에 있는 지역 변수인데 지역 변수는 JVM 스택에 저장되는 걸로 알고 있습니다. JVM 스택에 저장되는 것이 CPU 캐시인가요? 어떤 관계인지 잘 모르겠어서 질문을 드립니다ㅠ
강의 9분 쯤에서 jakarta.inject:jakarta.inject-api:2.0.1 ` 라이브러리를 gradle에 추가한다고 하는데 추가하면 오류가 나요 구글 드라이브 첨부합니다 https://drive.google.com/file/d/1Ace92-jSQRpEjtPMts_enWCT98bkbZ_4/view?usp=sharing
만약 c.txt 라는 파일이 있다고 가정하고 command line 인자로 java mola c.txt 만 terminal 에서 적었다고 가정해보겠습니다. 그러면 ArrayIndexOutOfBoundsException 이 위 catch 블록에 잡혀 있으니까 그게 실행되어야하는거 아닌가요? (원래 java mola c.txt d.txt 같이 "d.txt" 도 해줘야 인덱스가 올바른 것이라고 생각해서 그렇게 생각했습니다.)
학습하는 분들께 도움이 되고, 더 좋은 답변을 드릴 수 있도록 질문전에 다음을 꼭 확인해주세요. 1. 강의 내용과 관련된 질문을 남겨주세요. 2. 인프런의 질문 게시판과 자주 하는 질문(링크)을 먼저 확인해주세요. (자주 하는 질문 링크: https://bit.ly/3fX6ygx) 3. 질문 잘하기 메뉴얼(링크)을 먼저 읽어주세요. (질문 잘하기 메뉴얼 링크: https://bit.ly/2UfeqCG) 질문 시에는 위 내용은 삭제하고 다음 내용을 남겨주세요. ========================================= [질문 템플릿] 1. 강의 내용과 관련된 질문인가요? (예/아니오) 2. 인프런의 질문 게시판과 자주 하는 질문에 없는 내용인가요? (예/아니오) 3. 질문 잘하기 메뉴얼을 읽어보셨나요? (예/아니오) [질문 내용] command + n을 했을때 강사님 처럼 class,interface를 지정할 수 있는 항목이 안뜹니다.
강의를 듣고 나서 개인 프로젝트에 적용 중인데 몇 가지 질문사항이 있습니다! 안드로이드 앱 개발의 시작을 개복치님의 강의를 통해서 깨닫고 가르쳐주신 내용들로 졸업프로젝트에 적용중입니다 현재 게시글 업로드 부분에서 이미지 업로드 시에 갤러리에서 업로드하는 방법에 카메라로 찍어서 이미지를 업로드하는 기능을 구현 중에 있습니다. 문제의 GetBoardWriteActivity 코드입니다. https://github.com/chihyeonwon/Capstone-Design/blob/master/app/src/main/java/com/example/giveback/GetBoard/GetBoardWriteActivity.kt 코드에서 Dialog를 띄우고 카메라로 업로드하기를 눌렀을 때 권한이 있는 경우에 코드를 수정해봤는데 이미지 업로드하는 부분을 putFile로 하여 수정해야 할 것 같은데 어떻게 방법이 있을까요? 카메라로 업로드 하는 경우에 이미지가 업로드는 되는데 까맣게 업로드가 됩니다. 카메라로 촬영하기를 눌렀을 때 카메라로 사진을 찍는 것까지는 됩니다. 카메라로 사진을 찍은 후에 binding.imageArea 즉 이미지 부분이 찍은 사진으로 바껴야 하는데 이 부분이 안되는 것으로 보아 업로드할 때 문제가 있는 것 같습니다. 혹시 방법이 있을까요 ㅠㅠ? 혹시나 해서 전체 코드 깃허브 링크 남겨드립니다. https://github.com/chihyeonwon/Capstone-Design ps 이 강의 덕분에 학과에 잘 적응하여 졸업프로젝트를 앱으로 수행할 수 있게 되었습니다. 개복치님의 또 다른 강의들 중에 채팅 강의도 들어서 프로젝트에 적용 예정 중에 있습니다 ㅎㅎ 좋은 강의 감사합니다!!