ITeye博客

djangofan的博客

djangofan · 共 31 篇文章

nc指令用法

一、 版本 通常的Linux发行版中都带有NetCat(简称nc),甚至在拯救模式光盘中也由busybox提供了 简版的nc工具。但不同的版本,其参数的 使用 略有差异。 NetCat 官方地址: http://netcat.sourceforge.net/ 引用 [root@hatest1 ~]# cat /etc/asianux-release Asianux release 2.0 (Trinity SP2) [root@hatest1 ~]# cat /etc/redflag-release Red Flag DC Server release 5.0 (Trinity SP2) […

2012-06-19 17:25 · linux · 评论(0)

利用shell命令操作Memcached

原文链接: http://blog.s135.com/post/384/ ] 首先,需要了解Memcached协议,如果不清楚可参考《 Memcached 协议中英文对照 》。 1、数据存储(假设key为zhangyan,value为12345) printf "set zhangyan 0 0 5\r\n12345\r\n" | nc 127.0.0.1 11211 STORED 2、数据取回(假设key为zhangyan) printf "get zhangyan\r\n" | nc 127.0.0.1 11211 VALUE zhangyan 0 5 12345 END 3、数值增加1…

2012-06-19 17:17 · linux · 分布式和集群 · 评论(0)

RMI Load Balancing , Failover and High-Availability

最近我发布了一个在客户端实现RMI 负载均衡和支持故障转移的项目;地址在: http://code.google.com/p/rmi-lb-client/ 你可以用如下的方式使用它: JAVA: Spring: 由于rmi端口问题,在server端实现比较困难,在client端实现相对容易和清晰,工程使用的是maven;有需要的,或者是发现bug,请给我联系;

2012-06-07 16:41 · java · 评论(0)

date 命令的使用

date命令 date命令的功能是显示和设置系统日期和时间。 该命令的一般格式为:date[选项]显示时间格式(以+开头,后面接格式) date设置时间格式 命令中各选项的含义分别为: -ddatestr,--datedatestr显示由datestr描述的日期 -sdatestr,--setdatestr设置datestr描述的日期 -u,--universal显示或设置通用时间 时间域 %H小时(00..23) %I小时(01..12) %k小时(0..23) %l小时(1..12) %M分(00..59) %p显示出AM或PM %r时间(hh:mm:ssAM或PM),12小时 %s从1…

2012-05-16 14:57 · linux · 评论(0)

Thundering Herd Mitigation (memcached redis)

2012-04-25 16:38 · python · 分布式和集群 · 评论(0)

python __getattribute__ 的优先级问题

The way __getattribute__() works needs to be covered, as it was implemented to behave in a very specific way. Thus it is very important to recognize this ordering: Class attributes Data descriptors Instance attributes Non-data descriptors Defaulting to __getattr__() A descriptor is a class attribut…

2011-10-26 14:54 · python · 评论(0)

python 算法

http://code.activestate.com/recipes/577573-compare-algorithms-for-heapqsmallest/?in=user-178123

2011-10-21 17:14 · python · 评论(0)

一致性hash 原理与实现 (Consistent hashing implemented)

1.背景介绍 memcached的分布式 memcached虽然称为“分布式”缓存服务器,但服务器端并没有“分布式”功能。服务器端内存存储功能,其实现非常简单。至于memcached的分布式,则是完全由客户端程序库实现的。这种分布式是memcached的最大特点。分布的原则是由client端的api来决定的,api根据存储用的key以及已知的服务器列表,根据key的hash计算将指定的key存储到对应的服务器列表上。 memcached的分布式是什么意思? 这里多次使用了“分布式”这个词,但并未做详细解释。现在开始简单地介绍一下其原理,各个客户端的实现基本相同。 下面假设memcached服…

2011-10-21 14:50 · 分布式和集群 · 评论(0)

How-To Guide for Descriptors

How-To Guide for Descriptors Author: Raymond Hettinger Contact: <python at rcn dot com> Copyright: Copyright (c) 2003, 2004 Python Software Foundation.All rights reserved. Contents Abstract Definition and Introduction Descriptor Protocol Invoking Descriptors Descriptor Example Properties Functions …

2011-10-20 11:07 · python · 评论(0)

centos 编译安装时软件时,出错处理

1.configure: error: C++ preprocessor “/lib/cpp” fails sanity check See `config.log’ for more details 解决方式:#yum install glibc-headers gcc-c++

2011-10-20 11:05 · linux · 评论(0)

python mysql 分页程序

这个对付100万以下的,应该没什么问题,当大数据量时,需要改进; 大部分情况下是可以满足要求的,具体的见程序吧,已经写的很清新了

2011-10-09 16:00 · python · database · 评论(0)

python lib 之 operator

operator module在使用内置函数如map,itertools.groupby,sorted排序使用DSU技巧时,经常用到;这里面最经常用到的两个函数是: operator. attrgetter ( attr [ , args... ] ) 这个函数返回一个可调用对象(Callable Objects),取此对象的attr属性值;如果参数是多个属性,则返回的是属性值tuple. 例如: f = attrgetter('name') ,则 f(b) 返回的是 b.name . f = attrgetter('name', 'date') ,则 f(b) 返回的是 (b.name, …

2011-05-06 16:29 · python · 评论(0)

MySQLdb for python 安装

升级到了python2.7.1,没有吸取以前的教训,再一次的跌倒在这个上面,浪费了半个小时; 标准解决方案: http://www.codegood.com/downloads 去这里下载老外编译好的版本,直接安装,别费劲了; 如果有试图编译安装的,你可以会先遇到: D:/MySQL-python-1.2.3/setup_windows.py", line 7, in get_config serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_ke y'])WindowsError: [Error …

2011-04-23 14:12 · python · 评论(2)

centos 编译安装glib

下载最新的glib.2.28.2 ./configure --prefix=/usr make clean && make && make install (1)遇到问题 make的时候 缺少 magic.h头文件;这个头文件在centos的/usr/include/linux/里确实没有,我把 http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/include/linux/magic.h 这个,直接拷贝到/usr/include/linux/下,顺利通过; (2)make的时候出现这个错误: http://blog.csdn.net/saint1…

2011-03-11 14:52 · linux · 评论(0)

Maven 使用问题解决 一

在使用maven中出现了两个问题: 1.指定源文件编码,避免插件输出乱码问题 http://docs.codehaus.org/display/MAVENUSER/POM+Element+for+Source+File+Encoding这个地址有详细的说明; Adding this element to the POM structure can only happen in Maven 3.x (tracked with MNG-2216 issue): <sourceEncoding> UTF-8</sourceEncoding> For Maven 2.x, the value can…

2010-08-19 13:17 · java · 评论(0)