전체 글
-
php 백엔드 개발환경 설정 (windows)php 2023. 8. 8. 14:53
1. scoop에 버킷을 생성하고 필요한 버전의 php를 다운받는다 scoop bucket add versions scoop install apache php74 php81 php74-xdebug php81-xdebug composer symfony-cli wp-cli php -v # PHP 버전 확인 2. php 환경 설정 (예시 PHP 8.1 버전 ) - php.ini 를 변경하는 것으로 PHP 서버의 옵션을 변경할 수 있다. php.ini는 cli 폴더 내부에 있는 것으로 활용하겠다. # PHP 8.1 수정 방법 code $env:USERPROFILE\scoop\apps\php81\current\cli\php.ini # Visual Studio Code 로 열림 3. 확장 프로그램 설정 - php에..
-
scoop으로 php 다운받기php 2023. 8. 8. 14:34
1. PowerShell로 scoop 다운로드 # 실행 권한 변경 Set-ExecutionPolicy RemoteSigned -scope CurrentUser # 설치 Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') # 또는 짧은 명령어 iwr -useb get.scoop.sh | iex # 설치 확인 scoop 2. scoop으로 필요한 프로그램 다운로드 # 프로그램 검색 # scoop search ${search_keywords} scoop search git # 프로그램 설치 # scoop install ${app_name} scoop install git # Powershell에서 '..
-
mySQL 버전에 따른 쿼리문Sql 2023. 6. 25. 20:24
학원에서 사용하던 쿼리문을 집에서 사용하니 ### Error querying database. Cause: java.sql.SQLSyntaxErrorException: Expression 2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'control_third_project.o.order_date' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by 다음의 에러가 발생했다. 같은 mysql이더라도, 버전이 다르면 쿼리문의 이용 방법이 조금 변하는 것 같..
-
배열 형태로 데이터 submit 하기카테고리 없음 2023. 6. 21. 11:43
학원의 3번째 프로젝트에서 1 : n 관계의 데이터를 insert 하기위해서 form 태그를 submit 했을 때 여러개의 데이터가 배열 형태로 Model에 저장되도록 만들고싶었다. 부모가 되는 모델이 다음과 같고 자식이 되는(List 형태로 받을) 모델이 다음과 같다. 컨트롤러에서는 AdminOrderVO 로 받을 경우, OrderedProductVO 를 list 형태로 받아오려면 어떻게 해야할지 고민해봤다. jsp jsp에는 다음과 같이 form 태그와, AdminOrderVO 의 기본 필드 중 하나인 deliveryDate 를 미리 생성해뒀다. javaScript 스크립트에서는 버튼을 누를 경우 OrderedProductVO 내부에 값을 넣을 수 있도록 input이 생성되도록 만들었는데, input..
-
mybatis: resultMap ( 1:1 / 1:n select )기타 2023. 6. 21. 09:25
이번 프로젝트에서는 DB를 기능마다 나눠서, 기능을 추가하거나 데이터를 관리하기 편리하게 다음과 같이 설계했다. 다만 데이터를 select 하는데 있어서 두 가지 방법에 대해 이해가 필요했다 1 : 1 관계 두 가지 테이블을 join 할 때, 각 각 한 개의 행끼리 매치가 되도록 만드는 것이다. 위의 erd에서는 주문 테이블과 주문취소 테이블이 1:1 방법이다. 1개의 주문에는 해당 주문이 취소되었는지 아닌지 확인하는 주문 취소 열이 필요하다. SELECT * FROM `order` o JOIN order_cancel oc ON o.order_id = oc.order_id WHERE oc.state = 'normal' 이렇게 쿼리문을 작성하면, 주문 테이블과 주문 취소 테이블을 order_id 값을 기준..
-
if문과 논리연산자기타 2023. 6. 15. 16:45
부트스트랩을 사용하던 도중, 브라우저의 너비가 변할 때 마다 table을 리랜더링하는 스크립트가 작동하고 있는 것을 발견했다. 나는 테이블의 th가 스크립트로 인해 변하는 것을 막기 위해서 스크립트를 보다가 처음 보는 if문 형태를 발견했다. 큰 if문의 조건식에 다음과 같은 논리 연산자들이 많이 있는데 이해하기가 힘들었다. 위의 조건식을 이해하기 위해서 아래의 과정이 필요했다. 1. , (쉼표) if 문의 조건문 내부에 , 이 존재한다면 각 조건을 차례대로 검사하고, 검사하는 도중 true 가 발생하면 검사를 멈추고 if문의 실행문을 실행한다. -> 이 성질을 이용해서 왼쪽에 부작용을 가진 표현식을 적고 변수나 속성을 할당하도록 로직을 만들고 가장 오른쪽에 실행하는 로직을 작성한다. 따라서 위의 조건문..
-
코드 포맷터 ( Prettier ) 사용하기기타 2023. 6. 15. 12:45
js 를 변경하고 싶을 때, 다음과 같이 띄어쓰기가 되어있지 않다면 매우 곤란하다. 이 때 자동으로 코드를 포맷해주는 Prettier를 사용해보자 사용방법은 간단하다. npm에서 전역으로 prettier를 설치하고 3번의 명령어를 실행하면 되는데, vsCode의 powerShell 에서는 보안상 스크립트를 실행할 수 없었다. 이럴때는 powerShell을 관리자 권한으로 실행한 뒤 실행 정책을 Restricted 에서 RemoteSigned로 변경해서 js 를 powerShell에서 실행할 수 있도록 변경한 후, prettier를 사용하면 해당 js 파일이 다음과 같이 보기 좋아진다
-
ajax를 사용하지 않는 방법 생각해보기기타 2023. 6. 12. 10:22
웹 페이지를 동적으로 구성하는 방법으로 ajax를 많이 사용했지만, ajax는 개발자 도구에서 javascript를 변경하는 방법을 이용해서 이용자가 악의적으로 DB에서 데이터를 가져올 수 있는 위험이 있다. 따라서 동적으로 구성하고자 하는 웹 페이지를 처음 랜더링 할 때 해당 페이지에서 이용하고자하는 데이터를 모두 가져와서 javascript의 변수에 객체 형태로 저장해두고 특정 이벤트를 발생시켰을 때 변수로부터 원하는 데이터를 가져와서 웹 페이지를 동적으로 구성하면 좋을거라고 생각해서 방법을 찾아봤다. 1. controller에서 javascript로 데이터를 바로 넘겨주는 방법 gson 라이브러리를 활용해서 DB로 부터 받아온 데이터를 json 형태로 변경하고 model에 담아서 jsp로 보냈다. ..