Monday,May-21st
 

Twisted 编写的TCP转向连接程序


Python代码  收藏代码
  1. from twisted.internet.protocol import Protocol, ClientFactory, ServerFactory  
  2. from twisted.internet import reactor  
  3. impo...

阅读全文>>

 

新一代 Linux 文件系统 btrfs 简介

Btrfs 简介

文件系统似乎是内核中比较稳定的部分,多年来,人们一直使用 ext2/3,ext 文件系统以其卓越的稳定性成为了事实上的 Linux 标准文件系统。近年来 ext2/3 暴露出了一些扩展性问题,于是便催生了 ext4 。在 2008 年发布的 Linux2.6.19 内核中集成了 ext4 的 dev 版本。 2.6.28 内核发布时,ext4 结束了开发版,开始接受用户的使用。似乎...

阅读全文>>

 

Rsync in Python

This weekend, I was hacking Obnam, my backup program, adding support for using the rsync algorithm for backing up only the changed parts of modified files. I was reminded once again how beautiful rsyn...

阅读全文>>

 

NTFS结构综述

495x330

    整个NTFS分区就是由这五部分组成,其中两个数据区算一个部分,就是中间加入了一个MFT前几个数据文件的备份。从NTFS总体结构中看到,NTFS的第一个扇区为引导扇区,其中有NTFS分区的引导程序和一些BPB参数,系统根据这些BPB参数来得到分区的重要信息,如果没有这些信息分区将不能正常使用。在系统引导过程中,计算机主板BIOS将硬盘的主引导区读入内存0000H:7C00...

阅读全文>>

 

通过python client使用zookeeper

简介:   Zookeeper 分布式服务框架是 Apache Hadoop 的一个子项目,它主要是用来解决分布式应用中经常遇到的一些数据管理问题,如:统一命名服务、状态同步服务、集群管理、分布式应用配置项的管理等。 具体简介可以参照这篇文章。 zkpython的安装: python中有一个zkpython的包,是基于zookeeper的c-client开发的,所以安装的时...

阅读全文>>

 

Python 中使用 pyrex 生成 Linux 可执行文件

这个问题是相当有意义的,如果有了比较好的方法,Python 完全可以用来开发商业软件,而不用担心源代码泄露。
    前两天我在网上看了看,有很多的人在问这个问题。大部分的人都在用 py2exe,这是个对 Python 程序打包的东东,实际上只是在 Python 程序中找 出依赖的模块,然后发布这个程序。好处在于可以让这个程序脱离 Python 的环境来执行,不用安...

阅读全文>>

 

安装duplicity时的错误解决方法

安装duplicity,报以下错误:

gcc -pthread -shared build/temp.linux-x86_64-2.4/_librsyncmodule.o -lrsync -o build/lib.linux-x86_64-2.4/duplicity/_librsync.so
/usr/lib64/gcc-lib/x86_64-suse-linux/3.3.5/../../../....

阅读全文>>

 

Rsync Algorithm (Python recipe)

This is a pure Python implementation of the rsync algorithm. On my desktop (3.0GHz dual core, 7200RPM), best case throughput for target file hash generation and delta generation is around 2.9MB/s. Absolute worst case scenario (no blocks in common) throughput for delta generation is 200KB/s to 300KB/s on the same system. Tested in Python 2.5, 2.6, and 3.1. In 2.7, io.BufferedReader should yield the best throughput. On all other versions use __builtin__.open.

阅读全文>>

 

wsgi初探

前言 

本文不涉及WSGI的具体协议的介绍,也不会有协议完整的实现,甚至描述中还会掺杂着本人自己对于WSGI的见解。所有的WSGI官方定义请看http://www.python.org/dev/peps/pep-3333/。 


WSGI是什么? 

WSGI的官方定义是,the Python Web Server Gateway Interface。从名字就可以看出来...

阅读全文>>

 

python -- 并发网络编程库 Eventlet

Eventlet 是 由第二人生(Secondlife )开源的高度伸缩性的Python网络编程库.
Eventlet 可以用来处理多线程方面的工作,但它使用的是 green threads 概念,所以用资源的开销很少。

根据官方介绍大致特性如下:

  • 非阻塞I/O模型
  • 协程(Coroutines)使得开发者可以采用阻塞式的开发风格,却能够实现非阻塞I/O的效果
  • 隐式事件调度,使得可以在Py...

阅读全文>>