08 2018 档案
摘要:在flask.app模块里,__call__方法会调用wsgi_app方法 这个方法如下: 首先,request_context方法会返回一个RequestContext类的实例,这个实例是用传入的app,environ初始化的 RequestContext的初始化过程如下: 去掉了注释,这里有几个
阅读全文
posted @ 2018-08-20 13:10
geeklove
摘要:flask app.py 首先,初始化Flask,绑定一些属性,得到一个flask app 然后调用app的run方法,call procedure如下: run(flask.app) -> run_simple(werkzeug.serving) -> make_server(werkzeug.s
阅读全文
posted @ 2018-08-18 14:38
geeklove
摘要:def solve(num_str): MAX, MIN = 65535, -65536 num_str_len = len(num_str) i = 0 while num_str[i] == ' ': i += 1 if i == num_str_len: return 0 is_neg = True if n...
阅读全文
摘要:Two things to consider about when dealing with number operations, number sign and overflow
阅读全文
摘要:solution 1: merge two sorted array and return the middle index element O(m+n), O(m+n) 2 TopK https://blog.csdn.net/linhuanmars/article/details/1990551
阅读全文
摘要:O(n^2) solution 2: maintain a window:
阅读全文
摘要:ref: https://github.com/bottlepy/bottle/commit/fa7733e075da0d790d809aa3d2f53071897e6f76 下面实现了一个装饰器类,可以用它来给别的属性设置过期时间 Test Case:
阅读全文
摘要:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai
阅读全文
摘要:使用连接池的好处暂且不说,本文主要探讨Redis连接池的原理方式 要使用Redis,首先应该建立一个Redis客户端,比如: 在建立Redis客户端的时候,可以指定max_connections参数,这个参数指定了连接池中连接的数量 当读写Redis的时候,首先将传入的参数命令做一些处理,然后进入
阅读全文
posted @ 2018-08-04 18:22
geeklove
摘要:1 a thread-unsafe code version: 1.1 correct version 1: 1.2 correct version 2 and its pros and cons: Another approach is to pass the integer i directly
阅读全文
摘要:Using Threads for Parallelism Figure 12.30 shows the set relationships between sequential, concurrent, and parallel programs. A parallel program is a
阅读全文