분류 전체보기 477

장고 | 장고 공식 문서 내용 정리 #1-2 Getting started : writing your first Django app, part 1

첫 번째 장고 앱 작성, 2부 | 장고 문서 | 장고 (djangoproject.com) Writing your first Django app, part 2 | Django documentation | Django Django The web framework for perfectionists with deadlines. Overview Download Documentation News Community Code Issues About ♥ Donate docs.djangoproject.com 첫 장고 앱 작성하기 #1 장고 문서에서는 기본적인 설문조사 웹페이지를 만든다. 프로젝트 만들기 $ django-admin startproject mysite 를 수행하여 'mysite' 프로젝트를 시작해준다. mys..

장고 | 장고 공식 문서 내용 정리 #1-1 Getting started : Django at a glance

Django documentation contents | Django documentation | Django (djangoproject.com) Django documentation contents | Django documentation | Django Django The web framework for perfectionists with deadlines. Overview Download Documentation News Community Code Issues About ♥ Donate docs.djangoproject.com 에서 전반적인 내용은 훑었지만, 주로 화면을 꾸미는 내용 중심이라 공식 문서로 공부할 필요성을 느꼈다. 하나하나 차근차근 해보자! 화이팅😄 장고 한 눈에 보기 빠르게 변화하는..

백준 C++ | #27 BOJ1620 나는야 포켓몬 마스터 이다솜 C++ 문제 풀이

1620번: 나는야 포켓몬 마스터 이다솜 (acmicpc.net) 1620번: 나는야 포켓몬 마스터 이다솜 첫째 줄에는 도감에 수록되어 있는 포켓몬의 개수 N이랑 내가 맞춰야 하는 문제의 개수 M이 주어져. N과 M은 1보다 크거나 같고, 100,000보다 작거나 같은 자연수인데, 자연수가 뭔지는 알지? 모르면 www.acmicpc.net 마찬가지로 C++ STL map을 이용해서 푸는 문제였다. 이 문제는 시간초과가 관건이라 최대한 간단하게 생각해내는 게 중요한 것 같다. 그리고 출력을 따로 벡터에 저장하지 않고 바로바로 처리해줘도 된다는 걸 오늘 알았다. #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include int m..

백준 C++ | #26 BOJ2358 평행선 C++ 문제 풀이

2358번: 평행선 (acmicpc.net) 2358번: 평행선 첫째 줄에 n(1 ≤ n ≤ 100,000)이 주어진다. 다음 n개의 줄에는 각 점의 좌표가 주어진다. 만약 입력에 서로 같은 두 점이 주어지면, 그 두 점을 이용하여 직선을 만들 수 있다. 좌표는 절댓값이 231보 www.acmicpc.net 문제는 너무 간단해서 딱 그냥 for문으로 풀면 시간초과가 나겠다는 생각이 들었다. STL map을 이용하면 해결되는 문제 Code by horang :: c++ std::map 사용법 총 정리1 (생성, 반복자, 크기, 값 확인 등) (tistory.com) #include #include #include int main() { // n 개의 좌표 int n; std::cin >> n; std::m..

W3Schools 자바 | #0 자바 튜토리얼 (입출력, 주석, 변수, 타입, 연산자 등)

Java Tutorial (w3schools.com) Java Tutorial W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more. www.w3schools.com 왜 자바인가? 자바는 모바일 앱, 데스트탑 프로그램, 웹 애플리케이션, 웹 서버, 게임, 데이터베이스 등등에 사용된다. 자바는 서로 다른 OS에서 자유롭게 사용할 수 있다. 자바 설치 환경 : Window10 wsl $ sudo apt instal..

백준 C++ | #25 BOJ2257 화학식량 C++ 문제 풀이

2257번: 화학식량 (acmicpc.net) 2257번: 화학식량 첫째 줄에 화학식이 주어진다. 화학식은 H, C, O, (, ), 2, 3, 4, 5, 6, 7, 8, 9만으로 이루어진 문자열이며, 그 길이는 100을 넘지 않는다. www.acmicpc.net 골드까지 화이팅! #define _CRT_SECURE_NO_WARNINGS #include #include #include #include int main() { char* str = new char[100]; scanf("%s", str); int size = strlen(str); std::stack stk; int i = 0; while (i < size) { if (str[i] == '(') { stk.push(-1); } else if..

백준 C++ | #24 BOJ1823 수확 C++ 문제 풀이

1823번: 수확 (acmicpc.net) 1823번: 수확 첫째 줄에 벼의 개수 N(1 ≤ N ≤ 2,000)이 주어지고 두 번째 줄부터 N+1번쨰 줄까지 벼의 가치 v(i) (1 ≤ v(i) ≤ 1,000) 가 주어진다. www.acmicpc.net 다이나믹 프로그래밍.. 너무 어렵당 그래도 왜 전역변수로 DP용 배열을 만드는지 알게 되었다. DP용 배열이 전역변수로 있으면, 재귀함수로 구현했다고 하더라도, 같은 값을 여러 번 구하지 않아도 된다. #include using namespace std; int n, a[2001], d[2001][2001]; int dp(int l, int r, int k) { if (l > r) { return 0; } int& ret = d[l][r]; if (ret..

[에러] ERROR 2002 (HY000): Can't connect to local MySQL server through socket ''/var/run/mysqld/mysqld.sock' (2) 에러 해결

에러 내용 $ mysql start ERROR 2002 (HY000): Can't connect to local MySQL server through socket ' '/var/run/mysqld/mysqld.sock' (2) 해결 방법 $ sudo apt install mysql-server $ sudo mysql 참고로 $ service mysql Usage: /etc/init.d/mysql start|stop|restart|reload|force-reload|status 여기서 시키는 대로 /etc/ 어쩌구로 실행했더니 authentication 문제가 발생해서 그냥 sudo mysql로 실행하는 게 편한 것 같다. $ sudo mysql Welcome to the MySQL monitor. Com..

[에러] OSError: mysql_config not found 에러 해결 방법

에러 출력 내용 error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [13 lines of output] /bin/sh: 1: mysql_config: not found /bin/sh: 1: mariadb_config: not found /bin/sh: 1: mysql_config: not found Traceback (most recent call last): File "", line 2, in File "", line 34, in File "/tmp/pip-install-w06o8t8k/mysqlclient_e734938cf6d148aeab1e70c686ed01..

점프 투 장고 #3-3 | 파이보 서비스 개발하기(views.py 분리, 추천, 앵커, 마크다운, 검색, 파이보 추가 기능)

views.py 파일 분리하기 지금까지는 장고에 페이지가 추가될 때마다 이에 맞는 view 함수를 views.py에 추가해주었다. views.py에 너무 함수가 많아지면 관리가 어렵기 때문에 views.py 파일을 분리해보자. views 폴더를 만들어, base_views.py, question_views.py, answer_views.py로 나누어 담는 방식 from webbrowser import get from django.http import HttpResponseNotAllowed from django.shortcuts import render, get_object_or_404, redirect from ..models import Question, Answer from django.utils ..