ZEROST's Blog

Zerost's Programming Notes

부팅시 VERR_INTNET_FLT_IF_NOT_FOUND 오류

1. 배경 윈도우에서 VirtualBox를 통해서 리눅스를 설치하고 사용하고 있다. 그런데, 윈도우 업데이트 이후 리눅스 부팅시 아래의 메시지가 뜨면서 부팅이 되지 않는다. 가상 머신 ubuntu-20의 세션을 열 수 없습니다. Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter' (VERR_INTNET_FLT_IF_NOT_FOUND). Failed to attach the network LUN (VERR_INTNET_FLT_IF_NOT_FOUND). 결과 코드: E_FAIL (0x80004005) 구성 요소: ConsoleWrap 인터페이스: IConsole {872da645-4a9b-1727-bee2-5585105b9eed} - 환경 Host: Windows 11 22H2 2. 원인, 해결책 원인은 아직 찾지 못했으나, 검색해본 결과 나와 같은 케이스가 있었다. 해당 블로그에서는 새로 네트워크를 생성해주니 된다고 포스팅 되어있다. 그런데 시스템을 깔끔하게 싶어서 기존에 있는 네트워크를 삭제하고, 다시 생성해서 부팅했는데 되지 않았다. 그래서 블로그에 적힌대로 안되는 어댑터를 냅두고 어댑터를 추가 생성했더니 정상 부팅된다. VirtualBox > 파일 > 호스트 네트워크 관리자(H) > 만들기(C) IP관련해서 수정이 필요하면 속성(P)을 눌러서 정보를 변경해주면 된다. 그리고 확인을 누르면 어댑터 생성 완료. 그리고 왼쪽 > VM선택 (ex: ubuntu-20) > 설정(S) > 네트워크 메뉴들어가서 호스트 전용 어댑터 선택되어있는 탭을 찾아서 새로 만들어놓은 어댑터 선택하면 완료. 그리고 부팅하면 정상 부팅 완료. 3. 결론 위에도 작성했지만 원인은 아직 찾지 못했다. 윈도우 업데이트 할때마다 이런 경우가 자주 발생한다면 원인을 찾긴 해야겠다. 하지만, 지금은 해결되었으니 이번에는 해결하는걸로 패스. 9. 참조 버추얼박스(VirtualBox) 호스트 네트워크 관련 VERR_INTNET_FLT_IF_NOT_FOUND 오류

git checkout를 switch restore로 대체하기

1. 배경 git에 사용법이 그리 익숙치가 않아서, branch이동이나 복구등등을 찾다보니 git checkout 기능이 switch, restore로 분리되어서 새 기능이 추가 되었다고 한다. 사유는 checkout 하나의 명령어에 기능이 많기 때문이라고 한다. 그 동안 checkout으로 사용해왔는데, 명확하기 위해서 분리했다고 하니 새로운 기능을 사용하는 것이 좋을 것 같다. 2. switch branch 이동 $ git switch master Switched to branch 'master' branch HEAD기반 생성 $ git switch -c new-branch Switched to a new branch 'new-branch' branch 특정commit기반 생성 git switch -c new-branch3 67b7c2d Switched to a new branch 'new-branch3' branch Reset ※ 브랜치 리셋을 하는 기능이 있긴한데, 이게 권고되는건지는 확인필요 $ git switch --force-create new-branch Reset branch 'new-branch' git-switch reference 3. restore HEAD로 restore $ git restore test.md stage에 올라간 파일 제외하기 git restore --staged test.md git-restore reference 4. 결론 git checkout보다는 switch, restore로 구분해서 사용하자. 그리고 해당 명령어에 전체 기능을 정리한게 아니기 때문에 다른 기능이 더 필요하다면 레퍼런스를 참조해서 진행하자. 기능을 하나씩 습득할때마다 그때마다 정리를 하자. 참조 새 버전에 맞게 git checkout 대신 switch/restore 사용하기 - Outsider's Dev Story Git reference

SpringBoot Web MVC DELETE

DELETE의개념 HTTP DELETE 메서드는 지정한 리소스를 삭제합니다. 예제 요청 DELETE /file.html HTTP/1.1 응답 아마도 명령을 성공적으로 수행할 것 같으나 아직은 실행하지 않은 경우 202 (Accepted) 상태 코드. 명령을 수행했고 더 이상 제공할 정보가 없는 경우 204 (No Content) 상태 코드. 명령을 수행했고 응답 메시지가 이후의 상태를 설명하는 경우 200 (OK) 상태 코드. HTTP/1.1 200 OK Date: Wed, 21 Oct 2015 07:28:00 GMT <html> <body> <h1>File deleted.</h1> </body> </html> Kotlin - SpringBoot Controller 예제 @RestController @RequestMapping("/api") class DeleteApiController { // URL : /api/delete-mapping?name=test&age=22 @DeleteMapping(path = ["/delete-mapping"]) fun deleteMapping( @RequestParam(value = "name") _name : String, @RequestParam(value = "age") _age : Int, ): String { println(_name) println(_age) return _name + " " + _age } // URL : /api/delete-mapping/name/{name}/age/{age} @DeleteMapping(path = ["/delete-mapping/name/{name}/age/{age}"]) fun deleteMappingPath( @PathVariable(value = "name") _name : String, @PathVariable(value = "age") _age : Int, ): String { println(_name) println(_age) return _name + " " + _age } } 출처 DELETE의 개념, 예제 - https://developer.mozilla.org/ko/docs/Web/HTTP/Methods/DELETE 인프런: 스프링부트-코틀린 - https://www.inflearn.com/course/%EC%8A%A4%ED%94%84%EB%A7%81%EB%B6%80%ED%8A%B8-%EC%BD%94%ED%8B%80%EB%A6%B0

SpringBoot Web MVC PUT

Put의개념 HTTP PUT 메서드는 요청 페이로드를 사용해 새로운 리소스를 생성하거나, 대상 리소스를 나타내는 데이터를 대체합니다. PUT과 POST의 차이는 멱등성으로, PUT은 멱등성을 가집니다. PUT은 한 번을 보내도, 여러 번을 연속으로 보내도 같은 효과를 보입니다. 즉, 부수 효과가 없습니다. ※ 멱등성 동일한 요청을 한 번 보내는 것과 여러 번 연속으로 보내는 것이 같은 효과를 지니고, 서버의 상태도 동일하게 남을 때, 해당 HTTP 메서드가 멱등성을 가졌다고 말합니다. 다른 말로는, 멱등성 메서드에는 통계 기록 등을 제외하면 어떠한 부수 효과(side effect)도 존재해서는 안됩니다. 올바르게 구현한 경우 GET, HEAD, PUT, DELETE 메서드는 멱등성을 가지며, POST 메서드는 그렇지 않습니다. 모든 안전한 메서드는 멱등성도 가집니다. 예제 요청 PUT /new.html HTTP/1.1 Host: example.com Content-type: text/html Content-length: 16 <p>New File</p> 응답 데이터가 생성된 경우 HTTP/1.1 201 Created Content-Location: /new.html 데이터가 없는경우는 200(OK) 또는 204(No Content) 응답 HTTP/1.1 204 No Content Content-Location: /existing.html Kotlin - SpringBoot Controller 예제 @RestController @RequestMapping("/api") class PutApiController { //비추천 - @PutMapping 사용 @RequestMapping(method = [RequestMethod.PUT], path = ["/request-mapping"]) fun requestMapping(): String{ return "request-mapping - put method" } //추천 @PutMapping("/put-mapping") fun putMapping(@RequestBody svcDto: UserRequestDto): UserResponseDto { return UserResponseDto().apply { this.result = ResultDto().apply { this.resultCode = "OK" this.resultMessage = "성공" } }.apply { this.description = "~~~~~~~~~~~~~~" }.apply { this.userList.add(svcDto) this.userList.add(UserRequestDto().apply { this.name = "Steve" this.age = 22 }) this.userList.add(UserRequestDto().apply { this.name = "Ah~~~~" this.age = 18 }) } } } Dto - UserRequestDto @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class) //@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy::class) //deprecated data class UserRequestDto( var name: String?=null, var age: Int?=null, var email: String?=null, var address: String?=null, ) Dto - UserResponseDto @JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy::class) //@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy::class) //deprecated data class UserResponseDto( var result:ResultDto?=null, var description:String?=null, @JsonProperty("user") var userList: MutableList = mutableListOf(), ) data class ResultDto ( var resultCode: String ?= null, var resultMessage: String ?= null, ) 출처 PUT의 개념, 예제 - https://developer.mozilla.org/ko/docs/Web/HTTP/Methods/PUT 멱등성 - https://developer.mozilla.org/ko/docs/Glossary/Idempotent PropertyNamingStrategies.SnakeCaseStrategy::class - https://zzang9ha.tistory.com/380 인프런: 스프링부트-코틀린 - https://www.inflearn.com/course/%EC%8A%A4%ED%94%84%EB%A7%81%EB%B6%80%ED%8A%B8-%EC%BD%94%ED%8B%80%EB%A6%B0

SpringBoot Web MVC ResponseEntity

ResponseEntity란? Spring Framework에서 제공하는 클래스 중 HttpEntity라는 클래스가 존재한다. 이것은 HTTP 요청(Request) 또는 응답(Response)에 해당하는 HttpHeader와 HttpBody를 포함하는 클래스이다. Http 상태코드 1xx (정보): 요청을 받았으며 프로세스를 계속한다 2xx (성공): 요청을 성공적으로 받았으며 인식했고 수용하였다 3xx (리다이렉션): 요청 완료를 위해 추가 작업 조치가 필요하다 4xx (클라이언트 오류): 요청의 문법이 잘못되었거나 요청을 처리할 수 없다 5xx (서버 오류): 서버가 명백히 유효한 요청에 대해 충족을 실패했다 Kotlin - SpringBoot Controller 예제 @RestController @RequestMapping("/api") class ResponseApiController { // 1. Get 4xx // Get http://locaLhost:8080/api/repose?age=10 @GetMapping("") fun getMapping(@RequestParam age: Int?): ResponseEntity { return age?.let { if (age { return ResponseEntity.status(HttpStatus.OK).body(userRequestDto) } // 3. Put 201 @PutMapping fun putMapping(@RequestBody userRequestDto: UserRequestDto?): ResponseEntity { return ResponseEntity.status(HttpStatus.CREATED).body(userRequestDto) } // 4. delete 500 fun deleteMapping(@PathVariable id: Int) : ResponseEntity { return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(null) } } 출처 ResponseEntity란? - https://devlog-wjdrbs96.tistory.com/182 Http 상태코드 - https://ko.wikipedia.org/wiki/HTTP_%EC%83%81%ED%83%9C_%EC%BD%94%EB%93%9C 인프런: 스프링부트-코틀린 - https://www.inflearn.com/course/%EC%8A%A4%ED%94%84%EB%A7%81%EB%B6%80%ED%8A%B8-%EC%BD%94%ED%8B%80%EB%A6%B0