ITeye博客

2009 年文章归档

共 4 篇文章

calculate Fibonacci Num by using Dynamic plan method

/* *filename: fibonacci.cpp *date: 2006.10.1 *created: karl zheng *description: MatrixMultiplication for calculate Fibonacci No. n,cost: logN */ #include <stdafx.h> #include <stdio.h> #include<iostream> #include "string.h" void MatrixMultiply2By2(int a[2][2],int b[2][2],int c[2][2]) { //c[1][1]=a[1…

2009-05-25 01:08

在python用socket传送文件

putget_server.py #encoding=utf-8 import socket import common import sys import thread import threading class connection: def __init__(self, s): self.socket = s self.status = "Read" self.data = "" self.data_len = 0 def read_command(self): buf = "" while True: data = self.socket.recv(1024) buf += dat…

2009-05-21 14:27

可以替换掉网页某个文件的代理

用twisted写一个替换掉网站上某个文件的代理,作用参见 http://lifesinger.org/blog/?p=40 “如何直接调试线上页面的JavaScript和CSS”这篇文章,有了这个就不用fidder了,而且使用更加方便,替换时把要把原来的文件的content-length这个header去掉: from twisted.web import http from twisted.web import proxy from twisted.internet import reactor from twisted.python import log import sys log.…

2009-05-21 06:52

Squid TCP_MISS/000 的意义

工作中需要了解Squid TCP_MISS/000 的意义,看了一下squid代码: 在代码Enums.h中:先定义了枚举量: HTTP_STATUS_NONE = 0, 下面这个 sline结构的status,最后会赋值到在log中看到的TCP_MISS后面000这个http->code变量 这个 sline变量的status值在初始化的时候被初始化为HTTP_STATUS_NONE, 也就是0: void httpStatusLineInit(HttpStatusLine * sline) { HttpVersion version; httpStatusLineSet(sline, v…

2009-01-17 14:57