[C#과 유니티로 만드는 MMORPG 게임 개발 시리즈] Part9: MMO 컨텐츠 구현 (DB연동 + 대형 구조 + 라이브 준비)
루키스님 강의 듣고 만들어본 응용작입니다. 오래전부터 서버지식에 대한열망이 많았는데 너무 좋은 강의를 만나 너무 기쁘게 생각합니다. 어느정도 틀을 잡아주고 응용만 하는건데도 서버와 연동 하는건 너무 힘든 작업이네요 각종 툴 만든 거 영상이랑 붙여서 포폴을 낼까 합니다. 나이가 서른 중반이 되가는데 취업이 될까 고민이군요
프로그래머스에서 풀때 어쩔수 없이 class를 썻던 기억이 있는데 실제로 id값을 줘서 푸네요. public class Main { public int solution ( int [] arr , int k ) { Queue < Person > queue = new ArrayDeque <>() ; for ( int i = 0 ; i < arr. length ; i++ ) queue.offer ( i == k ? new Person ( - 1 , arr [ i ]) : new Person ( arr [ i ])) ; int day = 1 ; while ( !queue.isEmpty ()) { Person p = queue.poll () ; int emergency = Integer . parseInt ( String . valueOf ( queue.stream () .filter ( x -> x. number > p . number ) .count ())) ; if ( emergency == 0 && p. id != - 1 ) day++ ; else if ( emergency == 0 && p. id == - 1 ) return day ; else queue.add ( p ) ; } return day ; } public static void main ( String [] args ) { Scanner sc = new Scanner ( System . in) ; int n = sc.nextInt () ; int k = sc.nextInt () ; int [] arr = new int [ n ] ; for ( int i = 0 ; i < n ; i++ ) arr [ i ] = sc.nextInt () ; System . out .println ( new Main () .solution ( arr , k )) ; } }
제공 된 소스 파일에서 테스트코드를 제 환경에서 전체로 돌려보면 에러가 발생했습니다. 테스트가 @AfterEach로 저장소를 초기화 시키고 있는데 이 경우 전체로 돌렸을 때 문제가 발생할 여지가 있는것 같습니다. 저 같은 경우는 해당 코드를 @BeforeEach 로 바꿔서 전체 테스트 통과하도록 세팅하고 강의 수강을 시작했습니다. 별거 아닌 내용이긴한데 혹시 신경쓰이시는 분이 있을까봐 공유합니다.
추가 설명 중에, (2021-04-24 업데이트) Asian Population 문제는 Population Census 로 문제 명칭이 변경되었습니다. 라고 되어있는데, 2022년5월 문제푸는 지금은 제목이 다시 Asian Population로 검색됩니다. 다시 제목이 돌아온건지~ 참고삼아 말씀드립니다^^
createStore import시 취소선이 생기면서 아래와 같은 설명이 나옵니다. @deprecated We recommend using the configureStore method of the @reduxjs/toolkit package , which replaces createStore . createStore 대신 configureStore 사용하라고 하는데 두개가 같은 역할인건가요?
이번에 플렉스 반응형 사이트는 강의를 들으면서 선생님 강의를 따라 사이트를 만들지 않고 제 나름대로 응용해서 사이트를 하나 만들어 보았습니다. PC버전을 먼저 만들고, 모바일 버전을 만드는데서 부터 버벅 거리기 시작해서 모바일 버전 만드는데만 이틀이 걸렸습니다. 그 중에서 구글 지도 가져오는 부분이 있었는데요. 선생님 강의에 보면 구글 지도를 가져와서 iframe에서 사이즈 적용하시길래 저도 그렇게 해 보았습니다. 그렇게 하니까 PC버전에서는 문제가 없었습니다만 모바일 버전으로 가니까 이거 또 버벅버벅 ㅜㅜ 가만 생각해 보니까 지도 바깥 div가 있으니까 그 div에 사이즈를 정하고 지도에서는 가로세로 픽셀로 정하지 않고 그냥 100%로 적어주니까 간단히 해결이 되었습니다. 다른분들께도 도움이 되었으면 합니다. 제가 응용해서 만들어본 사이트는 이겁니다. http://sansok.dothome.co.kr/paperdream/index.html
Array.Fill이 없어서 찾아봤더니 using System.Linq; distance = Enumerable.Repeat(Int32.MaxValue, distance.Length).ToArray(); 이런걸 찾게됬어요 Array.Fill 없으신분들 참고해주세요 좋은 강의 감사합니다!
아 그리고 셀레니움 코드 말고도 키워드 입력 받은 부분까지 코딩되어 있는걸 공유 드립니다. import time from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys # 크롬 드라이버 자동 업데이트 from webdriver_manager.chrome import ChromeDriverManager import os import urllib.request import pyautogui # 브라우저 꺼짐 방지 chrome_options = Options() chrome_options.add_experimental_option("detach", True) # 불필요한 에러 메시지 없애기 chrome_options.add_experimental_option("excludeSwitches", ["enable-logging"]) service = Service(executable_path=ChromeDriverManager().install()) driver = webdriver.Chrome(service=service, options=chrome_options) keyword = pyautogui.prompt("검색어를 입력하세요>>>") #폴더 만들기 if not os.path.exists(f'2.인프런수업/실전편/05.구글이미지크롤링/{keyword}'): os.mkdir(f'2.인프런수업/실전편/05.구글이미지크롤링/{keyword}') # 웹페이지 해당 주소 이동 url = f"https://www.google.com/search?q={keyword}&sxsrf=ALiCzsZlmVXNZ5yaFSLh8_i6CbZtjJWZxw:1651960762167&source=lnms&tbm=isch&sa=X&sqi=2&ved=2ahUKEwivqKWzsc73AhU3xYsBHUsTAC0Q_AUoAXoECAIQAw&biw=1920&bih=961&dpr=1" #로딩시 대기 driver.implicitly_wait(5) #창 최대화 driver.maximize_window() #주소이동 driver.get(url) time.sleep(1) #무한스크롤 처리 before_h = driver.execute_script("return window.scrollY") #무한스크롤 while True: #맨밑으로 스크로 ㄹ내리기 driver.find_element(By.CSS_SELECTOR,"body").send_keys(Keys.END) time.sleep(1) after_h = driver.execute_script("return window.scrollY") if after_h == before_h: break before_h = after_h time.sleep(1) #썸네일 이미지 이미지 태그 추출 imgs = driver.find_elements(By.CSS_SELECTOR,".rg_i.Q4LuWd") for i, img in enumerate(imgs, 1): #각이미지를 클릭해서 큰사이즈 찾음 #셀레니움등 클릭하다보면 element click intercepted 에러의 해결방법 driver.execute_script("arguments[0].click();",img) # img.click() time.sleep(1) #큰이미지 주소 호출 if i == 1: target = driver.find_elements(By.CSS_SELECTOR,"img.n3VNCb")[0] else: target = driver.find_elements(By.CSS_SELECTOR,"img.n3VNCb")[1] # target = driver.find_element(By.CSS_SELECTOR,"img.n3VNCb") img_src = target.get_attribute('src') #이미지 다운로드 #크롤링 하다 보면 HTTP Error 403: Forbidden 에러가 나서 #오프너를 이용한 유저에이전트 추가 opener = urllib.request.build_opener() opener.add_handler = [('Uesr-Agent', 'Mozila/5.0')] urllib.request.install_opener(opener) urllib.request.urlretrieve(img_src, f'2.인프런수업/실전편/05.구글이미지크롤링/{keyword}/{i}.jpg')
강의는 셀레니움 구버전이라 새로운 버전의 셀레니움 코드를 공유합니다. from ast import keyword import time from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.options import Options #css 선택자 를 사용하려면 By 가 있어야 함 from selenium.webdriver.common.by import By #키전송하려면 Keys 가 있어야함 from selenium.webdriver.common.keys import Keys # 크롬 드라이버 자동 업데이트 from webdriver_manager.chrome import ChromeDriverManager #os 는 폴더만들기등 window 명령어를 수행함 import os #잘은모르지만 일단 다운로드 하는데 필요함 import urllib.request 명령프롬프트를 띄워줌 import pyautogui # 브라우저 꺼짐 방지 chrome_options = Options() chrome_options.add_experimental_option("detach", True) # 불필요한 에러 메시지 없애기 chrome_options.add_experimental_option("excludeSwitches", ["enable-logging"]) service = Service(executable_path=ChromeDriverManager().install()) driver = webdriver.Chrome(service=service, options=chrome_options) #검색어 입력 keyword = pyautogui.prompt("검색어를 입력하세요>>>") # 웹페이지 해당 주소 이동 if not os.path.exists(f'2.인프런수업/실전편/04.네이버이미지크롤링/{keyword}'): os.mkdir(f'2.인프런수업/실전편/04.네이버이미지크롤링/{keyword}') url = f"https://search.naver.com/search.naver?where=image&sm=tab_jum&query={keyword}" #로딩시 대기 driver.implicitly_wait(5) #창 최대화 driver.maximize_window() #주소이동 driver.get(url) time.sleep(1) #무한스크롤 처리 before_h = driver.execute_script("return window.scrollY") #무한스크롤 while True: #맨밑으로 스크로 ㄹ내리기 driver.find_element(By.CSS_SELECTOR,"body").send_keys(Keys.END) time.sleep(1) after_h = driver.execute_script("return window.scrollY") if after_h == before_h: break before_h = after_h time.sleep(1) #이미지 태그 추출 imgs = driver.find_elements(By.CSS_SELECTOR,"._image._listImage") for i, img in enumerate(imgs, 1): #각이미지의 태그 추출 img_src = img.get_attribute("src") print(i, img_src) urllib.request.urlretrieve(img_src, f'2.인프런수업/실전편/04.네이버이미지크롤링/{keyword}/{i}.png')
설계독학맛비's 실전 Verilog HDL Season 1 (Clock부터 Internal Memory까지)
Intro 안녕하세요 저의 경우 서버머신에 우분투를 올려 Vivado를 설치하는 과정에서 발생하였던 문제들과 해결 방안들을 정리해 보았습니다. 혹시 같은 문제가 생기신다면 참고해주세요. Setting Local machine : MacBook Air (M1), MacOs Monterey Remote machine : Dell R710 (Proxmox - Ubuntu 20.04 LTS x86_64) Remote Program : Royal TSX Problems 라이브러리가 설치 되지 않는 문제 libncurses5:i386 라이브러리가 설치되지 않는 문제가 있었습니다. 이는 apt-get 패키지 다운로드 서버를 이전에 kakao로 잡는 과정에서 문제가 있어 보입니다. 이에 따라 기본 다운로드 서버로 변경하여 해결하였습니다. cat <<EOF | sudo tee /etc/apt/sources.list deb <http://archive.ubuntu.com/ubuntu/> focal main universe multiverse restricted deb <http://security.ubuntu.com/ubuntu/> focal-security main universe multiverse restricted deb <http://archive.ubuntu.com/ubuntu/> focal-updates main universe multiverse restricted deb <http://archive.ubuntu.com/ubuntu/> focal-backports main universe multiverse restricted deb-src <http://archive.ubuntu.com/ubuntu/> focal main universe multiverse restricted deb-src <http://security.ubuntu.com/ubuntu/> focal-security main universe multiverse restricted deb-src <http://archive.ubuntu.com/ubuntu/> focal-updates main universe multiverse restricted deb-src <http://archive.ubuntu.com/ubuntu/> focal-backports main universe multiverse restricted EOF sudo dpkg --add-architecture i386 sudo apt-get update sudo apt-get install libncurses5 libncurses5:i386 ui/PlanAhead 문제 아래의 항은 vivado & 명령어 실행시 첫 줄에 있는 log 별 문제입니다. libXrender.so.1 문제 sudo apt-get install libxrender1 libXtst.so.6 문제 sudo apt-get update sudo apt-get install libxtst6 libXi.so.6 문제 sudo apt-get install libxi6 libgconf-2-4 경험상 ui/PlanAhead 문제는 그에 맞는 라이브러리만 잘 설치되어도 문제 없어 보입니다. Can't connect to X11 window server using 'localhost:0.0' 문제 저희는 현재 가상머신 혹은 리눅스 머신을 통해 VIVADO를 실행하려 합니다. 따라서 가상머신, 리눅스 화면에서 실행하는 VIVADO 화면을 저희 컴퓨터로 불러와야 합니다. 위의 문제는 로컬(사용하는 컴퓨터)에 VIVADO 화면을 실행할 (DISPLAY)모듈이 없거나, 혹은 설정한 IP가 맞지 않아 발생하는 문제입니다. 실습에 활용한 MobaXterm의 경우 같이 설치되는것으로 알고 있으며 혹시 다른 방법으로 사용하실분은 윈도우 : VcXsrv ( https://sourceforge.net/projects/vcxsrv/ ) 맥 : Xquartz ( https://www.xquartz.org ) 설치하신뒤 실행하고 리눅스로 돌아와 아래의 명령어 중 1개로 리눅스에서 화면을 보낼 IP를 설정하시면 됩니다. export DISPLAY=자신의 IP:0.0 export DISPLAY=localhost:0.0 Please check your system resources and launch again. 문제 Failed to open 'Vivado application'. Please check your system resources and launch again. JAVA 설치하시면 됩니다. java -version sudo apt install openjdk-11-jre-headless MAC OS 마지막으로 Mac OS에서 원격으로 사용하실분을 위해 맥의 경우 X11 ($DISPLAY)를 사용하기 위해서는 다음과 같이 구성되어야 합니다. ssh 접속시 ssh -X -p port@address 로 접속 XQuartz 설치 다양한 원격 프로그램이 있으나 저의 경우 Royal TSX를 사용하였고 이로 설명 드리겠습니다. Connection 아래의 자신의 서버의 속성 창 (우클릭 - Properties) Advanced - SSH 에서 X11 Forwarding 을 Enable X11 forwarding으로 변경 https://www.xquartz.org 에서 XQuartz 설치 (2.8.1) 다른 원격에서도 동일할 것으로 보이며 Terminal 에서 ssh 접속시 ssh -X -p port@address 로 접속 XQuartz 설치 또 다른 문제 발견시 추가하겠습니다. X11의 경우 서버 재부팅시 XQuartz를 재시작 해야 할 때가 가끔있습니다. 원격 접속후 단 1회만 ./build 명령어가 작동하고 두번째 ./build 명령어는 Can't connect to X11 window server using 'localhost:0.0' 오류가 발생합니다 -> 재접속하면 해결되나 아직 정확한 문제는 해결중입니다.
npm run seed:run을 사용한 후에 × Could not load the config file! Error: Cannot find module 'src/entities/ChannelChats' 이렇게 오류가 발생하는 경우가 있는데, ormconfig.ts에서 entities를 작성했을 때, import 의 경로를 잘 확인해주어야 했습니다. 예를 들어, import { ChannelChats } from 'src/entities/ChannelChats'; 이렇게 절대경로로 import를 작성했을 경우에는 import { ChannelChats } from './src/entities/ChannelChats'; 이렇게 상대경로로 잘 바꾸어주어야 정상적으로 seeding이 가능합니다.