摘要: Linux下C语言编程的入门级好书,内容覆盖很全面,点到即止,适合刚毕业面临找工作的同学。网页版:http://learn.akae.cn/media/index.html 阅读全文
posted @ 2013-08-22 20:25 么幺 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 《Cracking the coding interview》是一本被许多人极力推荐的程序员面试书籍, 详情可见:http://www.careercup.com/book。 里面有150道程序员面试题目及相应的解答。hawstein同学对Cracking the coding interview的所有习题做了非常细致的解答:http://hawstein.com/posts/ctci-solutions-contents.html.每天看几道,收获多多! 阅读全文
posted @ 2013-08-21 17:10 么幺 阅读(266) 评论(0) 推荐(0) 编辑
摘要: 1 #!/bin/bash 2 3 NORMAL=$(tput sgr0) 4 GREEN=$(tput setaf 2; tput bold) 5 YELLOW=$(tput setaf 3) 6 RED=$(tput setaf 1) 7 8 function red() 9 {10 echo -e "$RED$1$NORMAL"11 }12 13 function green()14 {15 echo -e "$GREEN$1$NORMAL"16 }17 18 function yellow()19 {20 echo -e "$YELLO 阅读全文
posted @ 2013-08-20 12:38 么幺 阅读(657) 评论(0) 推荐(0) 编辑
摘要: 来自腾讯大讲堂的一篇文章,真心不错。记录下来:《Linux文件系统十问,你知道吗?》http://djt.qq.com/article/view/620?ADTAG=email.InnerAD.weekly.20130813 阅读全文
posted @ 2013-08-14 12:49 么幺 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 最近几天一直在看libevent的源代码。看的方法是: ①网络上一些大牛的博客资料 ②libevent源代码(版本:Libevent 2.0.16-stable) ③libevent例子程序 ④libevent相关文档特别推荐的学习资料是张亮大牛的Blog:http://blog.csdn.net/sparkliang/article/category/660506跟着这个资料,再动手调一下库中自带的例子程序,你很容易就能够了解libevent的事件处理流程。下面是一个对例子程序hello-world.c写的一个client程序: 1 /* Don't actually copy th 阅读全文
posted @ 2013-03-04 16:16 么幺 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 今天帮一个同事把CPP代码改成对应的python代码,cpp代码很简单,如下: 1 static inline 2 std::string calc_tid(uint32_t threshold, uint64_t filesize) 3 { 4 static const char trailing_bytes[] = {47, 13, 94, 118, 39, 71, 156, 59}; 5 char values[16], hashed_md5[33]; 6 7 const uint32_t vid = ~threshold; 8 const ui... 阅读全文
posted @ 2013-02-25 18:54 么幺 阅读(451) 评论(0) 推荐(0) 编辑
摘要: 搜集一些关于架构学习的博文,供参阅:1、《YouTube架构学习体会》:http://www.itivy.com/ivy/archive/2011/3/6/634350416046298451.html2、《优酷网架构学习笔记》:http://www.itivy.com/ivy/archive/2011/8/13/the-architecture-of-youku.html(待添加中……) 阅读全文
posted @ 2013-02-20 14:28 么幺 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 1、函数原型1 #include <sys/socket.h>2 ssize_t recv(int sockfd, void *buff, size_t nbytes, int flags);3 ssize_t send(int sockfd, const void *buff, size_t nbytes, int flags); flags说明:flags说明recvsendMSG_DONTROUTE绕过路由表查找—·MSG_DONTWAIT仅本操作非阻塞··MSG_OOB发送或接收带外数据··MSG_PEEK窥看外来消息 阅读全文
posted @ 2013-02-17 16:47 么幺 阅读(584) 评论(0) 推荐(0) 编辑
摘要: Python中对队列和线程的操作,需要使用模块:Queue 和 threading。其中,Queue模块中提供了同步的、线程安全的队列类,包括FIFO(先入先出)队列Queue,LIFO(后入先出)队列LifoQueue,和优先级队列PriorityQueue。这些队列都实现了锁原语,能够在多线程中直接使用。可以使用队列来实现线程间的同步。简单的研究了一下使用方法,写了一个小例子,代码如下: 1 #!/bin/env python 2 #coding=utf-8 3 4 import os 5 import sys 6 import threading 7 import tim... 阅读全文
posted @ 2013-02-05 18:56 么幺 阅读(1793) 评论(0) 推荐(0) 编辑
摘要: python中对文件和目录的操作主要用到两个模块:os 模块 和shutil 模块。一、对文件的操作: 1、创建文件 (1)方法一1 #创建空文件2 import os3 os.mknod("test.txt") (2) 方法二1 #直接打开一个文件,如果文件不存在则创建文件2 open("test.txt", 'w') 2、复制文件 (1)方法一:1 #oldfile和newfile都只能是文件2 import shutil3 shutil.copyfile("oldfile","newfile" 阅读全文
posted @ 2013-02-04 18:45 么幺 阅读(317) 评论(0) 推荐(0) 编辑