- 博客(34)
- 收藏
- 关注
原创 python for in 语法 一览
./openid/pure_python_openid_demo.py: for k, v in request.iteritems():./openid/pure_python_openid_demo.py: for line in auth_resp.readlines():./openid/pure_python_openid_demo.py:for line in AS
2014-08-30 13:01:16 4658
转载 在python中获取当前位置所在的行号和函数名
在python中获取当前位置所在的行号和函数名 2011-12-23 12:52:38| 分类: python|举报|字号 订阅对于python,这几天一直有两个问题在困扰我:1.python中没办法直接取得当前的行号和函数名。这是有人在论坛里提出的问题,底下一群人只是在猜测python为什么不像__file__一样提供__line__和
2014-08-25 20:12:21 1012 1
转载 Python提供的基本数据类型
Python提供的基本数据类型主要有:布尔类型、整型、浮点型、字符串、列表、元组、集合、字典等等1、空(None)表示该值是一个空对象,空值是Python里一个特殊的值,用None表示。None不能理解为0,因为0是有意义的,而None是一个特殊的空值。2、布尔类型(Boolean)在Python中,None、任何数值类型中的0、空字符串“”、空元组()
2014-08-23 11:12:53 1544
原创 【二维dp】最长等差数列
这道题明显可以两重循环高低。#include #include #include #include using namespace std;int cal(vector t){ sort(t.begin(),t.end()); vector > ms(t.size(),map()); int _max=0; for(int i=0;i<t.size();i++){
2014-08-21 13:34:33 688 1
原创 uwsgi 配置 及 常见错误
uwsgi: /etc/w配置一个站点:nginx + uwsgi: — unavailable modifier requested: 0 --
2014-08-20 14:56:19 6140
原创 webapp2源码笔记
def default_dispatcher(self, request, response): """Dispatches a handler. :param request: A :class:`Request` instance. :param response: A :clas
2014-08-18 17:36:32 672
转载 tmux配置文件
转载自 http://www.cnblogs.com/scue/p/3705309.htmltmux中默认的shell是zsh,zsh在日常中使用可以协助我们高效地使用shell命令。# 设置Shellset-option -g default-shell /bin/zsh# 设置复制模式,空格开始选,Enter结束复制setw -g mode-keys vi
2014-08-16 23:51:47 1569
转载 Unix时间戳(Unix timestamp)转换工具
Unix时间戳(Unix timestamp)转换工具现在的Unix时间戳(Unix timestamp)是 1407997295 Unix时间戳(Unix timestamp) → 北京时间Unix时间戳(Unix timestamp) 北京时间 北京时间 → Unix时间戳(Unix timestamp)北京时间 年 月
2014-08-14 14:21:00 1384 1
转载 新浪开放平台接入Python版
应用python编写简单新浪微博应用(一)=============转载请注明出处============= 首先,你要有一个新浪微博账号。 申请页面:http://weibo.com 其次,你要在新浪微博的开发平台中创建一个应用,获取自己专属的App Key和App Secret。 申请页面:http://open.weibo.com/developmen
2014-08-10 17:34:32 636 1
转载 新浪微博推送API
接收事件推送微博会把用户关注/取消关注第三方微博账号,扫描带参数二维码等事件推送到第三方微博账号在粉丝服务后台填写的URL。方便开发者给用户下发欢迎消息或者做帐号的解绑。微博服务器在五秒内收不到响应会断掉连接,并且重新发起请求,总共重试三次。关于重试的消息排重,推荐使用FromUserName + CreateTime 排重。假如服务器无法保证在五秒内处理并回复
2014-08-10 16:59:34 1402 1
转载 Linux C程序I/O模型简介与异步 I/O性能模型分析
Linux C程序I/O模型简介与异步 I/O性能模型分析澈明 发布于 1年前,共有 0 条评论 http://m.oschina.net/blog/95518Linux® 中最常用的输入/输出(I/O)模型是同步 I/O。在这个模型中,当请求发出之后,应用程序就会阻塞,直到请求满足为止。这是很好的一种解决方案,因为调用应用程序在等待 I/O 请求完成时不需要使用任何中央处
2014-08-08 10:58:54 602
转载 tornado(epoll底层),apscheduler 异步IO封装库
yuan http://www.it165.net/os/html/201310/6453.html按照我的测试,sched和timer不适合做循环的计划任务,当然你可以在sched调用函数的时候,用while sleep的方法实现也是靠谱的。。。。感觉python应该有靠谱点的计划任务模块,问了下朋友,他们现在用的是 APScheduler一个很牛逼的库~ 已经测试过了
2014-08-08 01:34:03 2351
转载 select,poll,epoll 三种socket IO模型
原文地址: http://blog.csdn.net/hguisu/article/details/74533901. select、poll、epoll简介epoll跟select都能提供多路I/O复用的解决方案。在现在的Linux内核里有都能够支持,其中epoll是Linux所特有,而select则应该是POSIX所规定,一般操作系统均有实现se
2014-08-07 19:16:36 931
原创 【数据结构_二叉树+dfs】
Flatten Binary Tree to Linked List Total Accepted: 17814 Total Submissions: 64054My SubmissionsGiven a binary tree, flatten it to a linked list in-place.For example,Given 1
2014-08-02 23:15:45 597 1
原创 【数据结构_map容器迭代】Anagrams
class Solution {public: vector anagrams(vector &strs) { vector res;int n=strs.size(); if(n==0) return res; map > ss; char buffer[1000]; for(int i=
2014-08-02 21:57:56 605 1
原创 【数据结构_链表_最小堆】 链表找环,链表找交点,合并有序链表
Linked List Cycle Total Accepted: 24481 Total Submissions: 68828My SubmissionsGiven a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra sp
2014-08-02 21:27:41 591 1
原创 【矩阵加速_矩阵乘法_位运算】Climbing Stairs 求费波拉契数
class Solution {public: void mul(int (*src)[2],int (*m)[2]){ int a=src[0][0],b=src[0][1],c=src[1][0],d=src[1][1]; int e=m[0][0],f=m[0][1],g=m[1][0],h=m[1][1];///@error: fault
2014-08-02 20:42:29 757
原创 【矩阵二维或三维dp】最大子矩阵,子矩阵快速求和(用到最大直方图)
Maximal Rectangle Total Accepted: 9039 Total Submissions: 41503My SubmissionsGiven a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return i
2014-08-02 17:46:47 1155
原创 【区间查询_树状数组、线段树、次方数组】最大矩形
线段树(quanclass Solution {public: #define MAXN 0x7fffffff ////线段树 struct tree{ vector > arr; int n; void init(const vector &s){ n=s.size();
2014-08-02 15:44:21 783 1
原创 【字符串匹配】KMP(implement strStr()), 正则匹配(Wildcard Matching),2-dim 动规(regular expression)
1 KMP
2014-08-02 03:31:50 1330 1
原创 【一维dp_线性扫描】Word Break 、Best time to Buy and Sell Stocks |||、max subarray、jump game |||
Word Break Total Accepted: 18367 Total Submissions: 88637My SubmissionsGiven a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of
2014-08-02 03:10:35 776
原创 【双层loop】题型总结
class Solution {public: vector spiralOrder(vector > &matrix) { vector res; int x=-1,y=0;/// 巧妙设置起点 int n=matrix.size(); if(n==0) return res; int m=matrix[
2014-08-02 00:42:09 692
原创 【大数模板+十进制+for_loop】Multiply Strings
Multiply Strings Total Accepted: 10575 Total Submissions: 51788My SubmissionsGiven two numbers represented as strings, return multiplication of the numbers as a string.Note: The number
2014-08-02 00:28:06 492
原创 【两类dfs总结】 Restore IP Addresses、Word Search、Subsets、带重复的全排列
Restore IP Addresses Total Accepted: 11457 Total Submissions: 56215My SubmissionsGiven a string containing only digits, restore it by returning all possible valid IP address combinations
2014-08-02 00:01:07 875 2
原创 【二维dp_右下递推】interleaving、Distinct Subsequences、字符串交错、min edit distance、longest common sequence(LCS)
class Solution {public: bool isInterleave(string s1, string s2, string s3) { int n=s1.length(),m=s2.length(); if(n+m!=s3.length()) return false;///@@@error: s3.length can be not q
2014-08-01 23:24:16 566
原创 【树形dp】Binary Tree Maximum Path Sum
Binary Tree Maximum Path Sum Total Accepted: 14936 Total Submissions: 75024My SubmissionsGiven a binary tree, find the maximum path sum.The path may start and end at any node in the tr
2014-08-01 22:59:16 857
原创 【双数组二分法+控制划分点】两有序数组取第k小数
Median of Two Sorted Arrays Total Accepted: 16280 Total Submissions: 95001My SubmissionsThere are two sorted arrays A and B of size m and n respectively. Find the median of the two sorte
2014-08-01 22:42:10 886 1
原创 【一维动规】 regular string 正则匹配、Word Break II
Regular Expression Matching Total Accepted: 13504 Total Submissions: 67886My SubmissionsImplement regular expression matching with support for '.' and '*'.'.' Matches any single charac
2014-08-01 22:09:02 796 1
原创 【线性扫描ijk_贪心】candy 最少蛋糕分配、Trapping Rain water
Candy Total Accepted: 14466 Total Submissions: 78095My SubmissionsThere are N children standing in a line. Each child is assigned a rating value.You are giving candies to these childre
2014-08-01 21:43:05 696
原创 【图\树的BFS\DFS】 Word Ladder II (MinPath)、Surrounded Regions 、Add Next pointer in tree、zigzag bfs Tree
Word Ladder II Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one letter can be changed at a timeEach
2014-08-01 21:35:31 739 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人