programming
-
Setting docker-machine on windows 10programming 2021. 6. 15. 16:50
1. install VirtualBox 2. install chocolatey 3. choco install docker-machine https://www.freecodecamp.org/news/how-to-run-docker-on-windows-10-home-edition/ How to run Docker on Windows 10 Home edition Recently I have been watching a tutorial where, in order to follow it, you need to have Docker running on your machine. So far, so good. But it turns out that the latest versions of Docker require ..
-
윈도우10에 리눅스 subsystem 설정programming 2021. 4. 12. 01:52
docs.microsoft.com/en-us/windows/wsl/install-win10 Install Windows Subsystem for Linux (WSL) on Windows 10 Installation guide for WSL on your Windows 10, with a Bash terminal, including Ubuntu, Debian, SUSE, Kali, Fedora, Pengwin, and Alpine. docs.microsoft.com
-
Schema evolutionprogramming 2020. 6. 29. 14:00
Schema evolution 라는 용어는 Avro schema가 데이터가 쌓이고 난 이후에 변경되었을때, 즉 이전 스키마 버전으로 데이터가 쌓여있고 스키마가 변경되었을때 어떻게 데이터를 저장하는지에 대한 메커니즘 용어이다. Avro는 데이터 직렬화 포맷중에 하나이고 Protocol Buffers(Protobuf), JSON등이 있다. 다시 Schema evolution으로 돌아와서 스키마를 변경할때, 새로운 필드는 반드시 default value를 가지고 있어야 한다. 이것은 이전버전 스키마를 참고하는 클라이언트로 부터 에러를 방지하게 된다. Rules for changing schema 1. 모든 필드에 default value를 설정하는것이다. 이건 나중에 필드를 삭제 필요하며 만약 default ..
-
[Spark tip] struct type을 csv로 저장시 에러programming 2019. 4. 8. 16:01
from pyspark.sql.functions import udf from pyspark.sql.types import StringType def array_to_string(my_list): return '[' + ','.join([str(elem) for elem in my_list]) + ']' array_to_string_udf = udf(array_to_string,StringType()) df = df.withColumn('window-stringified',array_to_string_udf(df["window"])) UDF로 String 포맷으로 List의 모양을 리턴해주는 함수를 정의한다. 그래서 struct type을 string으로 변형해서 저장
-
Gevent / Celery 에 대하여programming 2019. 3. 13. 19:18
Python framework 를 이용하여 개발을 하다보면 Gevent, Celery를 붙여서 개발할 경우가 있다. 보통 mailing or push 서버처럼 많은 메세지를 처리해야 하는경우 메세지큐를 이용하고 Celery통해 worker들을 생성하여 다량의 메세지를 빠르게 처리 하며 대량의 네트워크 요청을 처리하기 위해 Gevent를 사용하여 성능개선을 한다. 그리고 이 둘을 결합하여 사용하는 케이스들이 있다.하지만 대략적인 개념만 알고 쓰다보니 어느날 Gevent on Celery 구조의 프로젝트를 수정하려다보니 헷갈리는 부분이 있어서 정리하고자 포스팅을 한다.What is gevent?gevent is a coroutine -based Python networking library that uses..
-
Timsort python sorted 알고리즘programming 2019. 3. 13. 19:06
요즘 Programming peals 책을 읽고 있는데 정렬에 대한 언급이 나와서문득 Python을 사용하면서 데이터 sorting을 할때 bulit-in function인 sorted만 사용하고 있는것을 깨달았다.생각해보면 Python으로 되어있는 오픈소스 코드에서도 sorting할때 sorted를 사용하지 않는 경우는 딱히 못본거 같다.sorted 함수의 원형은 아래와 같다.sorted(iterable[, cmp[, key[, reverse]]])Pamater를 통해 key를 지정해주면 해당 key 기준으로 sorting을 해주고 reverse가 필요하면 reserver 옵션만 넣어주면 오름차순,내림차순 또한 마음대로 받아볼 수 있다.그렇다면 sorted 내부 sorting algorithm은 뭐가 ..