전체 글
-
Java I/O <2 - InputStream>언어/자바 2023. 12. 23. 04:05
막연하게만 사용하던 I/O를 조금 더 이해해보고자 작성한 글입니다. 기본적으로 I/O는 O/S 레벨에서 이루어지고 byte를 다룬다는 것을 생각야해합니다. 글 작성에 참고한 영상입니다. Java IO - Output Streams by Kody Simpson InputStream 기본적으로 들어온 입력을 byte로 변환해주는 역할을 한다. System.in의 read 메소드를 사용해서 콘솔에서 받은 입력을 어떻게 보여주는지 확인해보자. 1. read() 입력된 스트림에서 1byte를 읽어서 int로 된 결과를 반환한다. - 영문 입력 (UTF-8 기준 1Byte 입력) class TestInputStream { public static void main(String[] args) { InputStream..
-
Java I/O <1 - OutputStream>언어/자바 2023. 12. 23. 03:46
막연하게만 사용하던 I/O를 조금 더 이해해보고자 작성한 글입니다. 기본적으로 I/O는 O/S 레벨에서 이루어지고 byte를 다룬다는 것을 생각하면 좋을 것 같습니다. 글 작성에 참고한 영상입니다. Java IO - Output Streams by Kody Simpson OutputStream 데이터를 Byte로 변경하여 목적지로 보내는 역할을 한다. 크게 1개의 Byte를 사용하는 것과 Byte[ ]을 사용하는 경우로 나누어서 볼 수 있겠다. - 단일 Byte 사용 1. byte타입 class TestOuputStream { public static void main(String[] args) { byte b = 75; OutputStream out = System.out; out.write(b); o..
-
자주 쓰이는 도커 명령어 정리인프라/도커 2023. 12. 21. 12:46
손에 완전히 익을 때 까지 빠르게 찾기 위한 용도로 자주 쓰는 도커 명령어를 좀 정리해봅니다. - run// -i + -t의 조합// 터미널 실행$ docker run -it ubuntu// --rm// 터미널 세션이 종료되면 컨테이너 삭제$ docker run -it --rm ubuntu// --cpus [코어 수]// 컨테이너에 cpu 코어 3개를 할당해서 실행$ docker run -i --cpus 3 eclipse-temurin:17-jdk// --cpuset-cpu [코어 목록의 시작 인덱스 - 끝 인덱스]// 컨테이너에 인덱스 범위에 해당되는 코어를 할당해서 실행$ docker run -i --cpuset-cpu 0-2 eclipse-temurin:17..
-
컴퓨터는 어떻게 작동할까 <2 - Register & RAM>CS/하드웨어 2023. 12. 21. 04:06
좋은 영상들을 찾게되서 시작했는데,, 책으로 돌아가야할 것 같네요. 이전 회사 CTO님께서 FlipFlop도 몰라서 되겠냐는 이야기를 하셨었는데, 이제서야 이런게 있구나 싶습니다 ㅎㅎ. 이번 글에서는 어떻게 구성되어있는지 하드웨어 레벨에서 살펴보고, 작동 매커니즘은 다음 글에서 적어보겠습니다. 이 시리즈들은 아래 영상에 기반하고 있습니다. 논리회로에 대한 내용 출처 by 정선생 Register에 대한 내용 by CrashCorse 전반적인 cpu 실행 흐름 영상 by bRd 3D 비트를 저장한다? 이런 생각은 누가 처음에 했나 참 대단한 것 같다. Latch는 비트를 임시로 저장할 수 있는 논리회로 장치 (이후 글의 진행은 AND-OR-LATCH를 기준으로 합니다.) 1. SR-Latch SR(0,0) ..
-
컴퓨터는 어떻게 작동할까 <1- ALU>CS/하드웨어 2023. 12. 21. 03:53
공부에 온전히 시간을 쏟을 수 있어서 재밌는 요즘입니다. 32bit 컴퓨터와 64bit 컴퓨터가 무슨 차이인지를 알아보다가, cpu의 작동까지 흘러왔고 cs기초를 조금 더 쌓을 수 있는 기회가 되었던 것 같아 적어봅니다. 이 시리즈들은 아래 영상에 기반하고 있습니다. ALU에 대한 내용 by CrashCourse 전반적인 cpu 실행 흐름 영상 by bRd 3D 트랜지스터와 논리회로 '너무 하위 레이어인가'라는 생각이 들기도 하지만 정리하는 김에 한번 적어봅니다. 1. AND Gate 실제 코드레벨에서 사용하는 && 를 도식화한 이미지! 2. OR Gate 실제 코드레벨에서 사용하는 || 를 도식화한 이미지! 3. NOT Gate 실제 코드레벨에서 사용하는 !를 도식화한 이미지! 4. XOR Gate X..
-
self.crypto.randomUUID() is not a function기타/IDE 2023. 12. 21. 03:32
1. Localhost는 secure origin으로 간주한다. 2. Web Cryptography API는 secure origin에서 작동한다. 다른 팀원들은 정상작동하는데, 한 팀원에게서만 코드가 작동하지 않는 상황을 만났습니다. reviewBtn.addEventListener("click", () => { const uuid = self.crypto.randomUUID(); localStorage.setItem(uuid, { name: 'hi' }); } // Uncaught TypeError: self.crypto.randomUUID is not a function self.crypto.randomUUID()가 함수가 아니라는 에러를 주는 상황입니다. 브라우저의 버전이나 종류에 문제가 있을 것이..
-
List 정렬에 대하여책/Head First Java 2023. 12. 21. 03:18
List를 정렬하는 여러가지 방법들을 정리해본다. Collections.sort 에서부터 stream.sorted까지 살펴본다. 글의 흐름은 Head First Java를 기초로 하고 있다. 정렬하는 방법들 1. Collections.sort(List) List인 경우만 정렬이 가능하다. /* 배열은 정렬 불가 */ String[] sArr = {"z", "b", "k"}; Collections.sort(sArr); // error /* List로 변경해서 정렬 */ String[] sArr = {"z", "b", "k"}; List sList = Arrays.asList(sArr); System.out.println("b4" + sList); // z,b,k Collections.sort(sList);..
-
도커에서 자바를 실행할 때의 문제책/스프링으로 하는 마이크로서비스 구축 2023. 12. 20. 17:17
예전 자바 버전에서는 도커 컨테이너에 할당된 리소스 제약을 무시하고 도커 호스트의 전체 자원을 할당하는 이슈가 있었습니다. 도커와 로컬의 비교, 그리고 자바 버전별로 리소스 사용을 비교해보겠습니다. 1. 도커 없이 자바 커맨드 실행 현재 로컬 컴퓨터에서 사용가능한 리소스들을 측정해보겠습니다. 컴퓨터의 하드웨어를 살펴보면 8core를 사용할 수 있고, 메모리는 16GB 입니다. 1) 코어 먼저 사용가능한 코어 숫자를 확인해 봅니다. $ echo 'Runtime.getRuntime().availableProcessors()' | jshell -q Hardware Overview에서 보여주는 core 숫자와 일치하는 것을 확인할 수 있습니다. 2) 최대 힙 사이즈 이번에는 최대 힙 사이즈를 확인해보겠습니다. ..