분류 전체보기(864)
-
Git commit을 하나로 합치기
개발을 하다보면 하나의 티켓을 처리하는데 자잘한 commit 들을 수십개까지 만들면서 작업을 하는 경우가 있다. 작업이 끝난 다음 Merge Request를 할 때, 구질구질하게 수십개의 commit으로 나열되어 있는 것을 보면 보기도 않좋지만 commit log 관리에도 좋지 않다. 이런 경우 git rebase를 이용하여 하나의 commit으로 합칠 수 있다. https://charsyam.wordpress.com/2013/01/11/%EC%9E%85-%EA%B0%9C%EB%B0%9Cgit-%EC%97%AC%EB%9F%AC-%EA%B0%9C%EC%9D%98-commit-%ED%95%98%EB%82%98%EB%A1%9C-%ED%95%A9%EC%B9%98%EA%B8%B0/ [입 개발]GIT: 여러 개의 ..
2020.05.06 -
MongoDB Aggregate 사용시 동적 연산 및 페이징 처리
정렬 기준이 되는 값을 복잡한 조건에 의해 동적으로 생성해서 정렬하고자 할 경우에는 $let, $cond, $eq 등의 명령을 이용하여 연산을 하고, 연산된 값을 기준으로 정렬을 시킬 수 있다. db.sales.aggregate( [ { $project: { finalTotal: { $let: { vars: { total: { $add: [ '$price', '$tax' ] }, discounted: { $cond: { if: '$applyDiscount', then: 0.9, else: 1 } } }, in: { $multiply: [ "$$total", "$$discounted" ] } } } } } ] ) https://docs.mongodb.com/manual/reference/operator/a..
2020.04.21 -
MongoDB Collection별 검색 결과 합치기
두개의 컬랙션을 Join하는 것이 아니라, 각각 컬랙션별로 검색한 결과를 최종적으로 합치는 방법은 다음과 같다. // Create employees data for testing the union. db.getCollection('employees').insert({ name: "John", type: "employee", department: "sales" }); db.getCollection('employees').insert({ name: "Martha", type: "employee", department: "accounting" }); db.getCollection('employees').insert({ name: "Amy", type: "employee", department: "warehou..
2020.04.20 -
Python Flask 프로젝트를 uWSGI와 nginx로 프로덕션 배포하기
Python Flask Web Server (HTTP) -> uWSGI -> nginx (HTTPS) 으로 배포하여 실제 서비스를 원활하게 할 수 있도록 처리한다. Python의 웹서버를 HTTPS로 구동하기 위해서 이전에 certbot으로 인증 받은 HTTPS 인증서 (pem 파일)을 nginx에서 그대로 사용할 수 있는 점이 편하다. https://blog.rhostem.com/posts/2018-11-20-deploy-flask-with-uwsgi 구글 애널리틱스 API를 사용한 Flask 앱을 uWSGI와 nginx로 배포한 과정 이미지 출처: Link 포스트 통계 기능을 위해 사용한 Google Analytics 서비스 API 이 블로그는 CMS 서비스나 별도의 백엔드 서비스가 연결되어 있지 않..
2020.04.14 -
액티비티 초기에 뷰 크기 구하기
ConstraintLayout constraintLayout = (ConstraintLayout) findViewById(R.id.constraint_layout); constraintLayout.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { @Override public void onGlobalLayout() { constraintLayout.getViewTreeObserver().removeOnGlobalLayoutListener(this); int width = constraintLayout.getWidth(); int height = constraintLayout.getHe..
2020.04.06 -
Python flask_restplus의 Swagger와 Static 폴더 설정 충돌 문제
기존에 Flask로 만들어진 백엔드에 Swagger UI를 적용하려 했더니, static 폴더 설정을 위해 Blueprint 사용하던 것과 뭔가 충돌이 있는 것으로 보였다. 한참을 삽질 끝에 static 폴더용 Blueprint와 REST api용 Blueprint를 각각 만들고 app에 등록하면 된다는 것을 알게 되었다. from flask import Blueprint, render_template from flask_restplus import Api, Resource, apidoc app_blueprint = Blueprint( 'app', __name__, url_prefix='', static_url_path='', static_folder='static', template_folder='st..
2020.03.13