2012年10月17日

摘要: #dataAnalysis from Client def dataAnalysis(self): datafmt='<IIIIIIII' #定义struct 解包格式,相当协议格式 fmtLen = struct.calcsize(datafmt) #得到协议长度 while len(self._buffer) >= fmtLen: print "Buffer Length:%s" % len(self._buffer) (protocLength,) = \ ... 阅读全文
posted @ 2012-10-17 01:05 Vovolie 阅读(5214) 评论(0) 推荐(0) 编辑
摘要: 我们有时会将一个整数与IP地址进行互换,用python代码实现很简单将一个整数如2000000,变为一个IP地址的方式>>> import socket>>> import struct>>> int_ip = 123456789>>> ip = socket.inet_ntoa(struct.pack('I',socket.htonl(int_ip))) #int to ip address'7.91.205.21'>>> socket.ntohl(struct.unpa 阅读全文
posted @ 2012-10-17 00:28 Vovolie 阅读(44619) 评论(1) 推荐(1) 编辑

2012年9月16日

摘要: 说假设有一个1000台节点的Hadoop集群,要配置节点之间的SSH免密码登录,该如何用shell脚本实现?#!/bin/expect#循环1000台机器的IP地址,生成密钥文件authorized_keysfor ip in {cat ip.list}do ssh user@$ip ssh-keygen -t rsa &>/dev/null expect{ "yes/no" { send "yes\r";exp_continue} "password:"{send "$passwd\r";exp_c 阅读全文
posted @ 2012-09-16 23:06 Vovolie 阅读(12222) 评论(1) 推荐(0) 编辑

2012年9月1日

摘要: 基础设备宿主机器:CPU:Intel&reg; Core™ i5-2400 CPU @ 3.10GHz内存:4G硬盘:500G操作系统:Win7 32BitLinux版本:CentOS-6.2-x86_64-minimal.iso虚拟机版本VirtualBox 4.2.0 RC1计划安装3个CentOS虚拟机,实现完整分布式模式。h1,h2,h3分别内存为512M,硬盘容量为20G。虚拟机配置新建虚拟机。内存预先设置为1G,安装完成后调整为512M。1G以上内存方可使用GUI安装。加载ISO光盘镜像。网络方式使用 桥接网卡 最为简单。具体介绍:http://www.douban.com 阅读全文
posted @ 2012-09-01 17:13 Vovolie 阅读(10460) 评论(1) 推荐(0) 编辑

2012年8月25日

摘要: #coding=utf-8# Filename:pr.pyS=[[0,0,0,0],[0.3333,0,0,1],[0.3333,0.5,0,0],[0.3333,0.5,1,0]] #原始矩阵U=[[1,1,1,1],[1,1,1,1],[1,1,1,1],[1,1,1,1]] #全部都为1的矩阵f=[1,1,1,1] #物征向量alpha=0.85 # a 值 0-1之间的小数n=len(S) #网页数'''aS a权重值 由google决定值大小,0-1之间,S为原始矩阵 '''def multiGeneMatrix(gene,Matrix 阅读全文
posted @ 2012-08-25 09:13 Vovolie 阅读(6813) 评论(9) 推荐(0) 编辑

导航