上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 35 下一页
/* For sockaddr_in */#include <netinet/in.h>/* For socket functions */#include <sys/socket.h>/* For gethostbyname */#include <netdb.h>#include <unistd.h>#include <string.h>#include <stdio.h>int main(int c, char **v){ const char query[] = "GET / HTTP/1.0\r\n&q Read More
posted @ 2013-04-01 23:16 godjob Views(185) Comments(0) Diggs(0)
#include "stdafx.h"#include <stl_h.hpp>#include <CInitSocket.hpp>#include <winsock2.h>#include <ws2tcpip.h>#pragma comment(lib,"ws2_32.lib")CInitSocket init;using namespace std;int main(int argc, char **argv){ char *ptr,**pptr; struct hostent *hptr; char s Read More
posted @ 2013-04-01 23:08 godjob Views(271) Comments(0) Diggs(0)
一、Libevent简介 libevent是一个基于事件触发的网络库,适用于windows、linux、bsd等多种平台,内部使用select、epoll、kqueue等系统调用管理事件机制。官网:http://libevent.org/特点:事件驱动,高性能;轻量级,专注于网络,不如ACE那么臃肿... Read More
posted @ 2013-03-31 23:29 godjob Views(1058) Comments(0) Diggs(0)
wget是在Linux下开发的开放源代码的软件,作者是Hrvoje Niksic,后来被移植到包括Windows在内的各个平台上。它有以下功能和特点:(1)支持断点下传功能;这一点,也是网络蚂蚁和FlashGet当年最大的卖点,现在,Wget也可以使用此功能,那些网络不是太好的用户可以放心了;(2)同时支持FTP和HTTP下载方式;尽管现在大部分软件可以使用HTTP方式下载,但是,有些时候,仍然需要使用FTP方式下载软件;(3)支持代理服务器;对安全强度很高的系统而言,一般不会将自己的系统直接暴露在互联网上,所以,支持代理是下载软件必须有的功能;(4)设置方便简单;可能,习惯图形界面的用户已经 Read More
posted @ 2013-03-31 21:01 godjob Views(175) Comments(0) Diggs(0)
inux zip命令zip -r myfile.zip ./*将当前目录下的所有文件和文件夹全部压缩成myfile.zip文件,-r表示递归压缩子目录下所有文件.2.unzipunzip -o -d /home/sunny myfile.zip把myfile.zip文件解压到 /home/sunny/-o:不提示的情况下覆盖文件;-d:-d /home/sunny 指明将文件解压缩到/home/sunny目录下;3.其他zip -d myfile.zip smart.txt删除压缩文件中smart.txt文件zip -m myfile.zip ./rpm_info.txt向压缩文件中myfil Read More
posted @ 2013-03-31 20:44 godjob Views(250) Comments(0) Diggs(0)
.tar 解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)———————————————.gz解压1:gunzip FileName.gz解压2:gzip -d FileName.gz压缩:gzip FileName.tar.gz 和 .tgz解压:tar zxvf FileName.tar.gz压缩:tar zcvf FileName.tar.gz DirName———————————————.bz2解压1:bzip2 -d FileName.bz2解压2:bunzip2 FileName.bz2压缩 Read More
posted @ 2013-03-31 20:39 godjob Views(138) Comments(0) Diggs(0)
Jeff Dean , 一位著名的 Google 工程师, 推出了一个 每个人都必须知道的数字的潜在数字列表。这个列表对设计大型基础架构的系统是一个巨大的资源。算法及其复杂性总是会在计算机系统的关键部分出现,但我发现很少有工程师对一个O(n!)级算法相较一个 O(n5) 算法会怎样有很好的理解。在编... Read More
posted @ 2013-03-31 11:18 godjob Views(317) Comments(0) Diggs(0)
通过例子讲解python是最好的办法,利于学习,利于记忆,做好笔记string.replace(str, old, new[, maxreplace])import strings='123456789123'print s#替换算法 string.replace(s, old, new, maxreplace)print string.replace(s, '123', '*****')print string.replace(s, '123', '*****',1)print s.replace('12 Read More
posted @ 2013-03-30 21:10 godjob Views(355) Comments(0) Diggs(0)
hashlib是个专门提供hash算法的库,现在里面包括md5, sha1, sha224, sha256, sha384, sha512,使用非常简单、方便。 md5经常用来做用户密码的存储。而sha1则经常用作数字签名使用Python进行文件Hash计算有两点必须要注意:1、文件打开方式一定要是二进制方式,既打开文件时使用b模式,否则Hash计算是基于文本的那将得到错误的文件Hash(网上看到有人说遇到Python的Hash计算错误在大多是由于这个原因造成的)。2、对于MD5如果需要16位(bytes)的值那么调用对象的digest()而hexdigest()默认是32位(bytes),同 Read More
posted @ 2013-03-30 20:11 godjob Views(3635) Comments(0) Diggs(0)
在看libevent源码中TAILQ的时候发现了一些让我迷惑的地方,就是里面的双端队列以及链表中节点的next与prev指针,它的设计与我们一般的链表以及linux内核的list完全不一样,因为里面的prev根本不是指向前一个节点,而是指向前一个节点的next元素的地址:#define TAILQ_HEAD(name, type) \struct name { \ struct type *tqh_first; /* first element */ \... Read More
posted @ 2013-03-29 17:37 godjob Views(2174) Comments(0) Diggs(0)
上一页 1 ··· 21 22 23 24 25 26 27 28 29 ··· 35 下一页