분류 전체보기(864)
-
React에서 HTML 문자열을 출력하는 방법
아주 간단해서 좋지만 기억하지는 못해서 매번 찾아볼것 같다. ㅎㅎ medium.com/@uigalaxy7/how-to-render-html-in-react-7f3c73f5cafc How to render HTML in react Find out how to render an HTML string in the dom without skipping, using React. medium.com
2021.01.20 -
Flask-RESTPlus 에서 여러개 파일 업로드 처리
클라이언트에서 여러개의 파일을 선택해서 body에 담아서 업로드를 할 경우, 다음과 같이 처리를 하면 그중 첫번째 것만 받게 된다. # From file uploads parser.add_argument('picture', type=werkzeug.datastructures.FileStorage, location='files') 여러개의 값을 받고자하는 경우에는 다음과 같이 action을 추가해주면 되니, 이것을 위에 추가해주면 간단하게 해결된다. parser.add_argument('fruits', action='split') flask-restplus.readthedocs.io/en/stable/parsing.html Request Parsing — Flask-RESTPlus 0.13.0 docume..
2021.01.20 -
Swift 알파값 적용하여 텍스트 출력
let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.alignment = .left let attributes: [NSAttributedString.Key : Any] = [ .paragraphStyle: paragraphStyle, .font: UIFont.systemFont(ofSize: 8.0), .foregroundColor: UIColor.black.withAlphaComponent(0.4) ] let attributedString = NSAttributedString(string: place.getName(), attributes: attributes) let stringRect = CGRect(x: x+7, y: y-6, width:..
2021.01.05 -
Python으로 Elasticsearch update 실행
정말로 이해할 수 없게도 초반에 찾은 간단해보이는 레퍼런스들은 동작하지 않았다. update는 에러가 나지 않았지만 업데이트가 되지 않았고, update_by_query는 레퍼런스 대로 하면 다음과 같은 에러가 났다. "elasticsearch.exceptions.RequestError: RequestError(400, 'search_phase_execution_exception', "Failed to parse query" 삽질 타임 시작! kb.objectrocket.com/mongo-db/how-to-use-python-to-update-api-elasticsearch-documents-259 How to Use Python to Update API Elasticsearch Documents | O..
2020.12.19 -
Python으로 PDF 파일 다운로드 및 텍스트 추출
특정 사이트의 PDF 파일을 크롤링하려는데, 일반적인 방법으로 안되서 결국에는 wget 콘솔 명령을 호출해서 처리해야 했다. 다운받은 PDF 파일은 pdfminer3를 이용하여 텍스트 추출까지 해서 DB에 저장하는데는 성공했으나, PDF 파싱시에 CPU 점유율이 100%가 되는 문제가 있다. stackoverflow.com/questions/56494070/how-to-use-pdfminer-six-with-python-3 How to use PDFminer.six with python 3? I want to use pdfminer.six which is a tool, that can be used with Python3 for extracting information from PDF documents...
2020.12.13 -
Python에서 CSV 파일을 JSON으로 변환
다음 예제는 JSON 객체로 변환하는 것이지만, 조금만 수정하면 배열로 변환 가능하다 import csv import json # Function to convert a CSV to JSON # Takes the file paths as arguments def make_json(csvFilePath, jsonFilePath): # create a dictionary data = {} # Open a csv reader called DictReader with open(csvFilePath, encoding='utf-8') as csvf: csvReader = csv.DictReader(csvf) # Convert each row into a dictionary # and add it to data fo..
2020.12.13