会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
Sawyer Ford
博客园
首页
新随笔
联系
管理
订阅
上一页
1
···
3
4
5
6
7
8
9
10
11
···
22
下一页
2017年6月7日
使用Redis构建文章投票网站
摘要: 涉及到的key: 1. article_time, 记录文章的发布时间,zset结构 2. article_score, 记录文章的得分, zset结构 得分 = 发布时间 + 投票用户数 X 432 3. voted_article_id, 记录文章的投票用户集合,文章的发布者默认为文章的投票用户
阅读全文
posted @ 2017-06-07 19:49 Sawyer Ford
阅读(815)
评论(0)
推荐(0)
2017年6月1日
Python爬虫(三)爬淘宝MM图片
摘要: 直接上代码: 爬下来的图片: 参考资料: Python爬虫实战四之抓取淘宝MM照片
阅读全文
posted @ 2017-06-01 20:12 Sawyer Ford
阅读(582)
评论(0)
推荐(0)
libevhtp初探
摘要: libevent的evhttp不适合多线程,libevhtp重新设计了libevent的http API,采用了和memcached类似的多线程模型。 worker线程的管道读事件的回调函数为htp__run_in_thread_: htp__connection_accept_函数如下: 此时,c
阅读全文
posted @ 2017-06-01 16:40 Sawyer Ford
阅读(4429)
评论(3)
推荐(1)
memcached线程模型
摘要: 直接上图: memcached使用多线程模型,一个master线程,多个worker线程,master和worker通过管道实现通信。 每个worker线程有一个队列,队列元素为CQ_ITEM。 memcached使用libevent实现事件监听,master和worker各有一个event_bas
阅读全文
posted @ 2017-06-01 16:05 Sawyer Ford
阅读(2529)
评论(0)
推荐(1)
unix time
摘要: UTC: 1970年1月1日0点至今的秒数。(本文不考虑闰秒) 本地时间: UTC对应0时区,北京位于东八区,时间为UTC+8h。 相关API: tm结构: time_t一般用long或者long long表示。
阅读全文
posted @ 2017-06-01 11:16 Sawyer Ford
阅读(277)
评论(0)
推荐(0)
2017年5月27日
libevent(十三)evhttp事件处理流程
摘要: 在libevent(六)http server中,作为一个单线程http server,不仅要监听每个连接的到来,还要监听每个连接上的I/O事件。 查看源码可知,在evhttp_bind_socket中设置了accept的回调函数:accept_socket_cb。 两个重要函数: evhttp_g
阅读全文
posted @ 2017-05-27 16:08 Sawyer Ford
阅读(10592)
评论(0)
推荐(0)
2017年5月26日
Shell脚本(一)入门
摘要: 开始学习Shell脚本。 注意点: 1. var="hello world",等号两边不要有空格。 2. 变量替换在单引号中无效。 参考资料: 《Linux Shell 脚本攻略》
阅读全文
posted @ 2017-05-26 14:20 Sawyer Ford
阅读(193)
评论(0)
推荐(0)
2017年5月25日
awk调用外部程序
摘要: 程序的功能很简单: 调用外部解密程序decoder,将文件第二列字段解密,然后写入新文件中。 两个地方值得注意: 1. ARGIND,对应ARGV下标 2. tee命令 由于程序耗时较长,因此置于后台运行,同时不再使用tee: 脚本启动命令: 有一个问题值得注意: 通过&虽然可以将程序置于后台运行,
阅读全文
posted @ 2017-05-25 14:34 Sawyer Ford
阅读(484)
评论(0)
推荐(0)
AWS bind: cannot assign requested address
摘要: 最近在AWS上安装Redis,遇到一个坑。 Redis默认配置文件中有个bind配置项,默认为127.0.0.1。此时只能在服务器内部访问Redis。 为了从服务器外部访问Redis,我给bind添加了一个IP,这个IP是服务器的公有IP。 问题来了,我在服务器内部启动Redis-cli直接报错:
阅读全文
posted @ 2017-05-25 09:30 Sawyer Ford
阅读(914)
评论(0)
推荐(0)
2017年5月24日
内存相关函数
摘要: 总是记不住内存相关函数的API,特此记录。 1. malloc Allocates a block of size bytes of memory, returning a pointer to the beginning of the block.The content of the newly
阅读全文
posted @ 2017-05-24 09:00 Sawyer Ford
阅读(196)
评论(0)
推荐(0)
上一页
1
···
3
4
5
6
7
8
9
10
11
···
22
下一页
公告