golang 中位数 package mainimport ( "fmt")func findMedianSortedArrays(nums1 []int, nums2 []int) float64 { l1 := len(nums1) l2 := len(nums2) var l3 []int = make([]int, l1+l2) // 中位数 i := 0 j := 0 idx := 0 for { if i >= ...
最大无重复子串 package mainimport ( "fmt")func lengthOfLongestSubstring(s string) int { var maxLen int = 0 var repeat bool = false // maxLen = 0 // n * 3 复杂度 for idx, _ := range s { // idx 起点 for i := idx; i < len(s); i++ {...
golang 随机返回 /*** Definition for singly-linked list.* type ListNode struct {* Val int* Next *ListNode* }*/// type Solution struct {// }// func Constructor(head *ListNode) Solution {// }// func (this *Solution) GetRandom() int {// }..
两数相加golang 实现 package mainimport ( "fmt")type ListNode struct { Val int Next *ListNode}func addTwoNumbers(l1 *ListNode, l2 *ListNode) *ListNode { // 链表两数相加 var head *ListNode = nil var p *ListNode = nil var pre *ListNode = nil va...
xpool cpool(epool) apooll 四种网络模型分析 xpool多个线程操作1 多个线程重复以下操作(没有负载均衡 类似nginx worker工作原理)lockfd= acceptunlockepoll(fd)2 cpool/epool工作原理类似(只不过一个是select 另一个是epoll)一个主线程fd =accept(listenfd)select(..) //listenfd + fda...
Django 源码剖析 Django 运行原理理清三个类关系WSGIServerWSGIRequestHandler (__init__ 中负责调用 application(environ)WSGIHandler (内部定义__call__)1 WSGIServer listen, select, process_request WSGIServer.RequestHandler...
python tarjan算法实现 #coding:utf-8#tarjan 算法#https://blog.csdn.net/jeryjeryjery/article/details/52829142?locationNum=4&fps=1#求任意顶点开始的联通图 有且仅存在一个 且dfn[u] == low[u]from collections import OrderedDictmatric = [[0,1,...
pycharm 升级pip 10 后无法安装问题 AttributeError: module 'pip' has no attribute 'main'如何解决?Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter loc...
expect 使用 一、概述 我们通过Shell可以实现简单的控制流功能,如:循环、判断等。但是对于需要交互的场合则必须通过人工来干预,有时候我们可能会需要实现和交互程序如telnet服务器等进行交互的功能。而expect就使用来实现这种功能的工具。 expect是一个免费的编程工具语言,用来实现自动和交互式任务进行通信,而无需人的干预。expect是不断发展的,随着时间的流逝,其功能越来越...
nohup setsid区别 nohup执行完成之后 需要 exit 才能保证 不会退出,如果直接close session 进程依然会死掉https://www.ibm.com/developerworks/cn/linux/l-cn-nohup/index.htmlUnix/Linux下一般想让某个程序在后台运行,很多都是使用&在程序结尾来让程序自动运行;但如果要想在退出终端后,程序依然还在后台运行,则要用nohu...
elasticsearch 相似度计算 https://www.cnblogs.com/didda/p/5283753.htmlhttp://lucene.apache.org/core/4_6_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html
process_template_responseprocess https://www.cnblogs.com/zhaof/p/6281541.htmlhttps://www.cnblogs.com/sss4/p/7106033.html总结:中间件 process_request process_view 是从前往后执行process_exception process_response 是从后往前执行如果process_view返回的对象有render 则...