Dart의 final / const 선언자 비교
·
Mobile/Flutter
Dart에서 변경할 수 없는 변수를 선언할때 final와 const를 사용한다.final name = 'Bob';const name = 'Bob';두 선언자는 같은 기능을 하지만, 변수가 설정되는 시점에서 차이점을 갖는다.final은 run-time에, const는 compile-time에 초기화된다. 결론적으로 final과 const로 선언된 변수는 최종 값을 변수이지만 설정되는 시점에 알맞게 사용되어야 한다. final ↔️ const 공통점➡️ 변수 선언시 초기화 되어야한다final name = 'Bob'; ➡️ 한번 설정된 변수의 값은 변경할 수 없다name = 'Alice'; // error: final|const 변수는 한번만 설정할 수 있음. final ↔️ const 차이점final➡️ 타..
Git 명령어
·
Git
Git이란?Git은 분산 버전 관리 시스템으로 소스 코드 관리와 변경사항 추적을 위해 사용 될 수 있다. 분산 모델로 병렬 작업이 가능하고, 오프라인 상태로 로컬작업도 가능하다. 호스팅을 지원하는 서비스로 Github, Gitlab이 대표적이다. Git init# git 저장소 생성git initGit status# git 상태(branch, changed, staging, untracked) 표시git status# 상세정보git status -sbGit clone# Git 저장소를 복사하여 생성git clone # 경로지정하여 생성git clone Git config# .git/config 설정git config# user.name 설정git config user.name "Name"# user.e..
XAMPP Virtual Host
·
Tip
https://www.apachefriends.org/index.html XAMPP Installers and Downloads for Apache FriendsWhat is XAMPP? XAMPP is the most popular PHP development environment XAMPP is a completely free, easy to install Apache distribution containing MariaDB, PHP, and Perl. The XAMPP open source package has been set up to be incredibly easy to install and to uswww.apachefriends.org XAMPP 아파치서버에 Virtual Host를 설정하..
PHP PDO()
·
Web/PHP
PDO(PHP Data Objecs)방식은 기존 PHP mysql 연결함수(mysql, mysqli)보다 향상된 기능의 객체지향적 DB 연결방식 기존 함수와 비교했을때의 차이점은 크게 2가지이다. 1. 준비구문(Prepare Statements)을 이용한 SQL 삽입공격(SQL Injection) 방어 및 성능향상 2. MySQL, Oracle, MS SQL, PostgreSQL, ... 여러 종류의 DB를 동일한 방식으로 접근 PDO로 DB에 연결 $host = 'localhost'; // host 주소 $database = 'database'; // database 이름 $user = 'root'; // host user $password = 'root'; // host password try { $..
PHP mysqli()
·
Web/PHP
mysqli로 MySQL 서버에 연결 $host = 'localhost'; // host 주소 $user = 'user'; // host user $password = 'pass'; // host password $database = 'testDB'; // database 이름 $con = mysqli_connect($host, $user, $password, $database); // 연결 실패시 if(!$con) { die('연결 실패'.mysqli_error($con)); } PHP: mysqli::__construct - Manual mysqli can succeed in surprising ways, depending on the privileges granted to the user. For ..