Tag: web

  • Interactive plotly charts on jinja2 + flask

    It’s difficult to find explanation on how we can render plotly chart on flask + jinja, so I’m sharing my code snippets. First, in python, given a figure, turn that into json response of flask. The chart data will be served via /get_chart/<chart_name> Prepare js code that can render the given json. Following code inserts…

  • 웹사이트 성능 최적화

    소프트웨어 품질의 끝은 결국 측정과 최적화라고 생각하고, 측정이 모든 접근의 시작이자 끝이라고 생각한다. 측정은 목표를 설정할 수 있게 하고, 그 과정에서 목표 자체에 의미가 있는지 따져보게 한다. 하지만 기술적 지식으로 무장한 엔지니어들은 측정을 먼저 시작하기보다는 해결 방법과 수단을 먼저 떠올리게 되고 그것부터 적용 해 놓고 보려고 한다. 대부분의 경우에 적용되는 훌륭한 룰들은 있어서 그게 항상…

  • Flask의 request

    Flask의 request는 PEP 567의 Context Variables을 Werkzeug의 LocalProxy로 구현한 객체입니다. Context Variables은 thread local을 개선합니다. This concept is similar to thread-local storage (TLS), but, unlike TLS, it also allows correctly keeping track of values per asynchronous task, e.g. asyncio.Task. https://peps.python.org/pep-0567/ LocalProxy는 매번 컨텍스트를 ContextVar.get() 을 사용할 필요 없이 마치 로컬 객체처럼 다루게 해줍니다. 아래 코드의 _request와…

  • responsive web using rem

    Using rem (default 16px), one can write web page containing html elements and texts in harmony. Default root element font size is 16px, but many users override it for better readability. Use of rem respects that. https://www.sitepoint.com/understanding-and-using-rem-units-in-css/ Setting default font size and browser zoom level are two different controls. Browser zoom scales up everything by…