码迷,mamicode.com
首页 > 其他好文
tornado.gen.coroutine-编写异步函数
异步函数: 1. 返回Future 2. 必须有set_result( )或者set_exception( )调用。 这里展示一个异步socket读取的例子: 首先定义一个定时返回的服务器,来模拟耗时的操作 from?tornado.tcpserver?import?TCPServ...
分类:其他好文   时间:2015-03-18 07:52:28    阅读次数:287
Maven项目没有Run AS和Debug AS想要的命令操作
如果我说的没错,你可能想看到的界面大致如下: 右边m2的红色标记一直是你的疑惑,你会有这样的疑问:怎么我的项目就没有这些操作呢? 那一定是你的项目不符合基本maven项目的规范。 按照如下的操作步骤创建项目即...
分类:其他好文   时间:2015-03-18 07:52:56    阅读次数:312
上班的第四百五十六天
今天早上回去,好好看了下书,毕竟前几天脑袋还没有反应过来,所以没怎么敲代码。如果连书都不看,那就彻底浪费时间了。 ????看得差不多的时候,收到了昨天晚上买那个水货5s,很不放心地给了钱之后,...
分类:其他好文   时间:2015-03-18 07:52:34    阅读次数:230
使用rst2pdf拓展sphinx生成PDF
当初项目文档是用sphinx写的,一套rst下来make html得到一整个漂亮的在线文档。现在想要将文档导出为离线的handbook pdf,于是找到了rst2pdf这个项目,作为sphinx的拓展,然后加上少量配置即可输出中文PDF。rst2p...
分类:其他好文   时间:2015-03-18 07:49:45    阅读次数:181
poj 1406 Starship Hakodate-maru 暴力枚举
水题,直接贴代码。 //poj 1406 //sep9 # include using namespace std; __int64 f1[2024]; __int64 f2[3024]; int main() { __int64 index1=0,index2=0,n; for(index1=0;index1<1300;++index1) f1[index1]=index1*index...
分类:其他好文   时间:2015-03-18 07:51:27    阅读次数:166
漫谈程序员系列:怎么告别“混日子”
生活目标其实就是一件如果你愿意投入精力去做,就可能达到的事。怎么找你的目标呢……...
分类:其他好文   时间:2015-03-18 07:48:09    阅读次数:158
LeetCode – Refresh – Anagrams
Use a hash table to record it. The tricky part is that when the hash value is > 0, it is the index + 1. Otherwise, that string already exists in resul...
分类:其他好文   时间:2015-03-18 07:47:38    阅读次数:100
LeetCode – Refresh – Binary Tree Iterator
It is similar to use stack for BST inorder traversal.So do the same thing :1. Get stack to store right branchs(include current node).2. When you pop t...
分类:其他好文   时间:2015-03-18 07:50:34    阅读次数:139
LeetCode – Refresh – Balanced Binary Tree
Need a helper function to return the binary tree maximum height. If the return value is -1, it means there is a imbalanced subbranch . 1 /** 2 * Defi....
分类:其他好文   时间:2015-03-18 07:47:44    阅读次数:123
LeetCode – Refresh – Best Time to Buy and Sell Stock ii
This is simple, use greedy algorithm will solve the problem. 1 class Solution { 2 public: 3 int maxProfit(vector &prices) { 4 int len = pr...
分类:其他好文   时间:2015-03-18 07:46:55    阅读次数:155
LeetCode – Refresh – Best Time to Buy and Sell Stock iv
This is combination of II and III.1. when k >= length, it is totally II.2. when k localMax[j] = max(localMax[j] + diff, globalMax[j-1] + max(0, diff.....
分类:其他好文   时间:2015-03-18 07:49:13    阅读次数:399
LeetCode – Refresh – Add Binary
This question is pretty straight forward. 1 class Solution { 2 public: 3 string addBinary(string a, string b) { 4 int runnerA = a.size()-1...
分类:其他好文   时间:2015-03-18 07:48:23    阅读次数:132
LeetCode – Refresh – Add Two Numbers
Same with add binary. You can also skip delete the result pointer. But just return result->next. Depends on the interviewer. 1 /** 2 * Definition for....
分类:其他好文   时间:2015-03-18 07:47:51    阅读次数:114
LeetCode – Refresh – Best Time to Buy and Sell Stock iii
III is a kind of I. But it require 2 maximum value. So scan from begin and scan from end to record the maximum value for currrent index.Then scan the ...
分类:其他好文   时间:2015-03-18 07:46:13    阅读次数:134
26850: 收集数码晶体 有40%错误
http://arena.acmclub.com/problem.php?id=26850数码世界的国王Shoutmon想要在n个小岛上举办一个游戏,来让数码宝贝们好好玩耍。背景是这样的:在这n个小岛之间事先安放了一些单向通道,每个通道连接两个不同的小岛,且只能按一个给定的方向通过。数码宝贝每次由通...
分类:其他好文   时间:2015-03-18 07:46:41    阅读次数:205
LeetCode – Refresh – 4sum
To be honest, I dont like this problem. This is just an extra layer loop for 3sum. But two mistakes I had made…..1. when skip j, use condition j > i+1...
分类:其他好文   时间:2015-03-18 07:47:09    阅读次数:130
LeetCode – Refresh – Best Time to Buy and Sell Stock
1 class Solution { 2 public: 3 int maxProfit(vector &prices) { 4 if (prices.size() < 2) return 0; 5 int len = prices.size(), resu...
分类:其他好文   时间:2015-03-18 07:45:30    阅读次数:129
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!