04-10 장고 기본 CBV API (Generic display views) - ListView 강의를 듣던 중 index.html 에서 {% load django_bootstrap5 %}나 {% bootstrap_pagination %} 를 타고 들어가서 소스를 보는 기능이 전체검색 말고는 vscode에서 다른 방법이 없는 것 같아서 유료버전pycharm 처럼 흉내내서 확장프로그램을 만들어봤습니다. 저만 쓰게 될거같아서.. 필요하신 분들께 알리고 피드백을 받고 싶은 마음에 여기에 링크를 남기고 공유해도 혹시 괜찮을까요? https://github.com/southglory/python-package-definition-navigator https://marketplace.visualstudio.com/items?itemName=QG-devramyun.python-package-definition-navigator 감사합니다.
강의를 들으면서 제가 아는 해시 테이블의 개념과 조금 헷갈려서 질문을 남깁니다. 일반적으로 해시 테이블은 특정한 값이 들어오면 어떤 연산을 통해 해싱을 합니다. 그리고 해싱된 값을 통해 이 데이터가 어떠한 버킷의 어떤 슬롯에 담기는지를 정하게 됩니다. 그리고 여기에서 논리적으로 해시충돌이 일어나면 이를 해결할 수 있습니다. 여기에서는 데이터가 실제로 담기기 때문에 이러한 충돌이 발생할 수 있고 해결 또한 해야하죠. 근데 Redis의 클러스터에서는 어떤 데이터가 들어온다면 모듈러 연산을 통해 얻은 해시 값이 특정 노드에 속하는지를 판단한다고 강의를 들었습니다. 예) 노드 A : 0~ 4819 노드 B: 4820~16383 이 때 해싱을 통해 얻은 값이 4819라면 해당 데이터는 노드A에 속하게 되고 노드A에 연결된 DB에 데이터가 저장이 되겠죠 ? ( DB의 Cluster 구동 방식을 검색해보니 각각의 노드마다 DB를 별도로 샤용한다고 했습니다. ) 이 때 해쉬 슬롯은 단순히 너는 노드A로 가라. 너는 노드B로 가라 라고 연결다리 역할만 하는건지 궁금합니다. 실제로 해쉬 슬롯은 노드를 나누기 위한 논리적인 숫자에 불과하며 실제 슬롯에는 그 어떠한 값도 저장하고 있지 않는 것인지가 너무 헷갈립니다.. 제가 해쉬 테이블의 개념만 너무 생각해서 그런건지 잘 모르겠습니다 ..
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 학습 커리큘럼에는 데이터불러오기, EDA 전처리 피처엔지니어링 모델링/평가(분류/회귀) 평가지표 머신러닝파트에서 정리하신 순서는 불러오기 EDA 전처리 피처엔지니어링 검증데이터분리 모델학습,평가 등 예측 CSV파일 생성 이렇게 구성되었습니다. 커리큘럼과 학습정리 순서가 왜 다른지? 그럼 둘 중 뭐가 맞는가요? 커리큘럼 작업형2의 모의고사1 에서 머신러닝 풀다보면 불러오기-EDA-전처리-피처엔지니어링-검증데이터분리-모델학습,평가까지만 나가고 이 후 예측 부분을 작업하진 않으신 것 같습니다. 맞는지 확인 바랍니다. 설명이 프로세스대로 구분되지 않고 실습 형태로 위 아래 왔다 갔다 전개되어 단계별 경계를 구분할 수 없습니다.
섹션2 [응용] 엑셀문서 값을 필드에 입력하기 안녕하세요....선생님 만약 제가 관리하는 엑셀파일의 열별 정리순서가 ["이름", "주소", "연락처", "성별", "생일", "취미"] 인 파일을 이용하여, 한/글 누름틀 적용하여 ["이름", "성별", "생일", "취미"]만 추출하고자 한다면....어떻게 해야 하는지요? 저는 누름틀을 이용하면 엑셀파일에서 [이름, 성별,생일,취미]에 해당하는 열에서 값을 불러와 한/글로 가져오는 줄 알았습니다만....실제로 해보니 [이름,주소,연락처,성별]로 파일이 생성되더군요. 코딩없이 한/글 메일머지를 이용하면 엑셀의 항목과 한/글의 항목이 일치하는 값을 불러와 주던데...... 누름틀은 그렇지 않은 것인지...아니면 제가 실수한게 있는지 궁금합니다.
안녕하세요! 동현님 강의 잘 듣구 있습니다~!! Streams 자료구조를 설명할 때 append-only log 에 consumer groups 과 같은 기능 을 더한 자료구조라고 설명해주셨는데요. append-only log 는 데이터를 오직 추가( append )만 할 수 있는 자료구조라고 추가로 설명해주셨습니다! 그런데 xdel 같은 명령어로 이벤트를 삭제할 수 있다고 설명해주셨는데요. 오직 추가만 할 수 있는 자료구조 라고 인식했는데, 갑자기 삭제 명령어가 있어서 헷갈립니다! 감사합니다.
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 어제 제가 올린 질문이 이곳에 노출이 안 되었고, 24년 11월 29일이 마지막 질문으로 11월 29일 이후 질문이 노출 되지 않았습니다.
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 이 강의를 보면서 이 강의가 학습을 시키기 위한 정식 강의인지, 대충 이런 게 있다고 그냥 넘어가기는 그렇고 적당히 소개하고 말려고 한 강의인가요? 엄청난 속도로 위아래 올라갔다 내려가며 쫓기듯이 강의하시는데... 이것이 최선인건지,, 초심자를 위한 최적화된 강의가 과연 맞는 것인지.. 정신없어서 뭐가 뭔지 손을 못 대겠던데요. 교안으로 제공하면 출력해서 노트하며 복습이라도 할 텐데 이거 뭐 어쩌란 건지 도무지 모르겠습니다. 초급자에게 이 강의를 이해 시키려고 하신 강의 맞으신가요? 또는 이 강의를 이해하지 못하면 어떻게 되는 걸까요? 이 강의를 어떻게 해석해야 하는지 설명을 요청 드립니다. 빅분기가 결국 결과물을 시각화 하는 과정인데 강의에서는 말로만 하고 시각화된 자료도 제공이 되야 효율적이지 않을까 합니다. 따라하는 것도 따라하는 것이지만 머리에 한계가 있잖아요. 강사는 아는 내용을 막힘없이 설명하는 것이고, 초심자는 말하는 족족 그대로 머리에 익혀지지 않잖아요.
학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! 질문과 관련된 영상 위치를 알려주면 더 빠르게 답변할 수 있어요 먼저 유사한 질문이 있었는지 검색해보세요 평가지표(이진/다중 분류, 회귀) 3분지점의 설명에 대해 보충 설명을 요청합니다. train데이터는 학습을 하고 test데이터는 예측을 한다고 했으나 train데이터를 분리하여 하나는 학습 다른 하나는 검증이라고 하여 이걸(검증) 예측이라고 설명했어요. 그럼 test의 예측과 train 검증에서의 ‘예측’의 차이는 뭔지 이 둘은 같은건지? train데이터의 레이블로 데이터를 검증한다고 했는데 레이블은 실제값이고 검증하는 데이터는 예측값(pred)라고 하여 이 둘을 비교한다고 했습니다. 검증하는 데이터가 예측값? 여기서도 test데이터(예측값)와 어떤 관계인지 이 개념을 이해 못하겠습니다.
에포크 5에서 오류가 발생합니다. AttributeError Traceback (most recent call last) <ipython-input-19-00485008cd01> in <cell line: 0>() 13 #config.save_freq = eval;config.map_freq = 5 14 # 1 epoch시마다 P100에서 약 3분30초 걸림. 적절한 epochs 수 설정 필요. ---> 15 model.fit( 16 get_dataset(True, config), 17 epochs=15, 5 frames /usr/local/lib/python3.11/dist-packages/numpy/__init__.py in __getattr__(attr) 322 def _sanity_check(): 323 """ --> 324 Quick sanity checks for common bugs caused by environment. 325 There are some cases e.g. with wrong BLAS ABI that cause wrong 326 results under specific runtime conditions that are not necessarily AttributeError: module 'numpy' has no attribute 'float'. `np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here. The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecation s
1. 현재 학습 진도 링크드 리스트를 학습하고 있습니다 2. 어려움을 겪는 부분 보너스 문제인 요세푸스 문제를 '링크드 리스트'를 활용하여 푸는데 어려움을 겪고 있습니다 ㅠ 3. 시도해보신 내용 링크드 리스트의 보너스 문제는 링크드 리스트를 학습하는데 도움이 될만한 문제라고 생각하여 풀이하고 있는데 어려움을 겪고 있습니다. class Node: def __init__(self, data): self.data = data self.next = None class CircularLinkedList: def __init__(self): self.head = None def append(self, data): new_node = Node(data) if not self.head: self.head = new_node self.head.next = self.head else: cur = self.head while cur.next != self.head: cur = cur.next cur.next = new_node new_node.next = self.head def delete(self, prev, cur): if cur == self.head: if cur.next == self.head: # 마지막 노드일 경우 self.head = None else: self.head = cur.next prev.next = cur.next def print_all(self): if not self.head: return [] result = [] cur = self.head while True: result.append(cur.data) cur = cur.next if cur == self.head: break return result def josephus_problem(n, k): circle = CircularLinkedList() for i in range(1, n + 1): circle.append(i) result = [] cur = circle.head prev = None while circle.head: for _ in range(k - 1): prev = cur cur = cur.next result.append(cur.data) circle.delete(prev, cur) cur = prev.next if prev else None return result # 입력 처리 n, k = map(int, input().split()) result = josephus_problem(n, k) print("<" + ", ".join(map(str, result)) + ">") 위와 같이 링크드 리스트의 개념을 활용하여 문제를 풀다가 어려워서 chatGPT의 도움을 받아서 변형하여 풀어봤는데도 지속적으로 런타임에러가 나는 상황입니다. 이 문제를 링크드리스트로 풀 수 없는 문제인지 어떤 부분이 잘못된 것인건지 잘모르겠습니다. 또한 만약 풀기 어려운 문제라면, 이정도 수준의 링크드 리스트를 활용하는 문제는 나오지 않는 것인지 이정도 수준으로 연습하면 좋을 지도 궁금합니다! 감사합니다 🙂
주피터노트북으로 코딩시. hwp.open("파일명.hwp")를 실행해도 화일이 없다고 열리지 안네요.........분명 해당경로에 그 파일이 존재하는데도 불구하구요... 강의 듣다가 느낀점. 코딩프로그램 사용법이 더 어려워요. 파이참으로 했다가 주피터로 하기도 하고.....
안녕하세요 강사님 우선 아래 질문한 내용에 대해 구글에서 이것저것 찾아보고 GPT도 다 돌려봤는데 도저히 이해가 안가서 강사님께 여쭤봅니다. 강의에서 분산 락과 Pub/Sub 개념을 복습한 후, 이전에 Redisson을 사용해 구현했던 분산 락 로직을 정리하고 있습니다. 그 과정에서 RedissonLock 클래스의 tryLock 메서드를 살펴보다가 PublishSubscribe 클래스의 subscribe 메서드까지 코드를 따라가게 되었습니다. 이와 관련하여 다음 몇 가지 질문이 생겼습니다: PublishSubscribe 클래스의 subscribe 메서드를 보면 세마포어를 사용하는데, 여기서 세마포어의 역할이 무엇인지 잘 이해가 되지 않습니다. 왜 이 시점에서 세마포어를 사용하는 건가요? CompletableFuture<RedissonLockEntry> subscribeFuture = subscribe(threadId); 코드에서 threadId로 무언가를 구독합니다. 정확히 무엇을 구독하는지 잘 모르겠습니다. 구독 대상과 구독의 목적이 무엇인지 궁금합니다. tryLock 메서드의 아래쪽 코드를 보면 while (true)로 락을 반복적으로 시도하는 모습이 마치 스핀락처럼 보입니다. 저는 Redisson의 분산 락이 Lettuce의 스핀락과는 다르다고 생각했는데, 실제 구현을 보니 스핀락과 비슷한 방식으로 동작한다고 봐도 될까요? RedissonLock 클래스의 tryLock 메서드 @Override public boolean tryLock(long waitTime, long leaseTime, TimeUnit unit) throws InterruptedException { long time = unit.toMillis(waitTime); long current = System.currentTimeMillis(); long threadId = Thread.currentThread().getId(); Long ttl = tryAcquire(waitTime, leaseTime, unit, threadId); // lock acquired if (ttl == null) { return true; } time -= System.currentTimeMillis() - current; if (time <= 0) { acquireFailed(waitTime, unit, threadId); return false; } current = System.currentTimeMillis(); CompletableFuture<RedissonLockEntry> subscribeFuture = subscribe(threadId); try { subscribeFuture.get(time, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { if (!subscribeFuture.cancel(false)) { subscribeFuture.whenComplete((res, ex) -> { if (ex == null) { unsubscribe(res, threadId); } }); } acquireFailed(waitTime, unit, threadId); return false; } catch (ExecutionException e) { acquireFailed(waitTime, unit, threadId); return false; } try { time -= System.currentTimeMillis() - current; if (time <= 0) { acquireFailed(waitTime, unit, threadId); return false; } while (true) { long currentTime = System.currentTimeMillis(); ttl = tryAcquire(waitTime, leaseTime, unit, threadId); // lock acquired if (ttl == null) { return true; } time -= System.currentTimeMillis() - currentTime; if (time <= 0) { acquireFailed(waitTime, unit, threadId); return false; } // waiting for message currentTime = System.currentTimeMillis(); if (ttl >= 0 && ttl < time) { commandExecutor.getNow(subscribeFuture).getLatch().tryAcquire(ttl, TimeUnit.MILLISECONDS); } else { commandExecutor.getNow(subscribeFuture).getLatch().tryAcquire(time, TimeUnit.MILLISECONDS); } time -= System.currentTimeMillis() - currentTime; if (time <= 0) { acquireFailed(waitTime, unit, threadId); return false; } } } finally { unsubscribe(commandExecutor.getNow(subscribeFuture), threadId); } // return get(tryLockAsync(waitTime, leaseTime, unit)); } PublishSubscribe 클래스 /** * Copyright (c) 2013-2022 Nikita Koksharov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.redisson.pubsub; import org.redisson.PubSubEntry; import org.redisson.client.BaseRedisPubSubListener; import org.redisson.client.ChannelName; import org.redisson.client.RedisPubSubListener; import org.redisson.client.codec.LongCodec; import org.redisson.client.protocol.pubsub.PubSubType; import org.redisson.misc.AsyncSemaphore; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; /** * * @author Nikita Koksharov * */ abstract class PublishSubscribe<E extends PubSubEntry<E>> { private final ConcurrentMap<String, E> entries = new ConcurrentHashMap<>(); private final PublishSubscribeService service; PublishSubscribe(PublishSubscribeService service) { super(); this.service = service; } public void unsubscribe(E entry, String entryName, String channelName) { AsyncSemaphore semaphore = service.getSemaphore(new ChannelName(channelName)); semaphore.acquire().thenAccept(c -> { if (entry.release() == 0) { entries.remove(entryName); service.unsubscribe(PubSubType.UNSUBSCRIBE, new ChannelName(channelName)) .whenComplete((r, e) -> { semaphore.release(); }); } else { semaphore.release(); } }); } public void timeout(CompletableFuture<?> promise) { service.timeout(promise); } public void timeout(CompletableFuture<?> promise, long timeout) { service.timeout(promise, timeout); } public CompletableFuture<E> subscribe(String entryName, String channelName) { AsyncSemaphore semaphore = service.getSemaphore(new ChannelName(channelName)); CompletableFuture<E> newPromise = new CompletableFuture<>(); semaphore.acquire().thenAccept(c -> { if (newPromise.isDone()) { semaphore.release(); return; } E entry = entries.get(entryName); if (entry != null) { entry.acquire(); semaphore.release(); entry.getPromise().whenComplete((r, e) -> { if (e != null) { newPromise.completeExceptionally(e); return; } newPromise.complete(r); }); return; } E value = createEntry(newPromise); value.acquire(); E oldValue = entries.putIfAbsent(entryName, value); if (oldValue != null) { oldValue.acquire(); semaphore.release(); oldValue.getPromise().whenComplete((r, e) -> { if (e != null) { newPromise.completeExceptionally(e); return; } newPromise.complete(r); }); return; } RedisPubSubListener<Object> listener = createListener(channelName, value); CompletableFuture<PubSubConnectionEntry> s = service.subscribeNoTimeout(LongCodec.INSTANCE, channelName, semaphore, listener); newPromise.whenComplete((r, e) -> { if (e != null) { s.completeExceptionally(e); } }); s.whenComplete((r, e) -> { if (e != null) { value.getPromise().completeExceptionally(e); return; } value.getPromise().complete(value); }); }); return newPromise; } protected abstract E createEntry(CompletableFuture<E> newPromise); protected abstract void onMessage(E value, Long message); private RedisPubSubListener<Object> createListener(String channelName, E value) { RedisPubSubListener<Object> listener = new BaseRedisPubSubListener() { @Override public void onMessage(CharSequence channel, Object message) { if (!channelName.equals(channel.toString())) { return; } PublishSubscribe.this.onMessage(value, (Long) message); } }; return listener; } } 감사합니다.
- 학습 관련 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. icopyx@gmail.com 확인 부탁 드립니다.