发红包android
立即春节,写个应景的控件
思路分析
大体知识点概况
实战
继承view,做点初始化的工作
private void init() {
mPath = new Path();
mRandom = new Random(); initPaint();
initMoneyPaint(); mText = moneys[mRandom.nextInt(moneys.length)]; //获取字体的宽高
moneyPaint.getTextBounds(mText, 0, mText.length(), mTextBound);
} private void initPaint() {
mPaint = new Paint();
mPaint.setColor(Color.parseColor("#c0c0c0"));
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeCap(Paint.Cap.ROUND);
/**
* 设置接合处的形态
*/
mPaint.setStrokeJoin(Paint.Join.ROUND);
/**
* 抗抖动
*/
mPaint.setDither(true);
mPaint.setAntiAlias(true);
mPaint.setStrokeWidth(PAINT_WIDTH);
} /**
* money画笔
*/
private void initMoneyPaint() {
moneyPaint = new Paint();
moneyPaint.setColor(Color.RED);
moneyPaint.setAntiAlias(true);
moneyPaint.setTextSize(30);
mTextBound = new Rect();
moneyPaint.getTextBounds(moneys[0], 0, moneys[0].length(), mTextBound);
}
2.创建一个画布,就是一个绘制一个红包的图片。根据手指在控件上的滑动路径,除去图片的结合部分
mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap); Bitmap bitmap = Bitmap.createBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.red_packet)); mCanvas.drawBitmap(bitmap, null, new RectF(0, 0, width, height), null); //设置图片的结合方式
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
mCanvas.drawPath(mPath, mPaint);
canvas.drawBitmap(mBitmap, 0, 0, null);
3.重写onTouchEvent方法记录手指的擦除路径以及实现跟手操作
public boolean onTouchEvent(MotionEvent event) {
x = (int) event.getX();
y = (int) event.getY(); switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
//路径的初始化位置
mPath.moveTo(x, y);
break;
case MotionEvent.ACTION_MOVE:
if (movable) {
// 跟手滑效果
setX(x + getLeft() + getTranslationX() - getWidth() / 2);
setY(y + getTop() + getTranslationY() - getHeight() / 2);
} else if (Math.abs(x - mLastX) > DEFAULT_PATH_INSTANCE || Math.abs(y - mLastY) > DEFAULT_PATH_INSTANCE) {
// 记录手指擦除路径
mPath.lineTo(x, y);
invalidate();
}
case MotionEvent.ACTION_UP:
MyAsyncTask task = new MyAsyncTask();
task.execute();
break;
} //记录上次位置
mLastX = x;
mLastY = y;
return true;
}
4.附上完整的代码
public class RedPacketView extends ImageView {
private Paint mPaint, moneyPaint;
private Path mPath;
private Canvas mCanvas;
private Bitmap mBitmap;
private int x, y, mLastX, mLastY;
public boolean movable = true;
public boolean isTouch = false;
private String[] moneys = new String[]{"¥5", "¥10", "¥20", "¥50"};
private Rect mTextBound;
private String mText;
private Random mRandom;
private boolean isComplete = false; /**
* 笔触的宽度
*/
private static final float PAINT_WIDTH = 20;
/**
* 默认绘制的最小距离
*/
private static final float DEFAULT_PATH_INSTANCE = 5; public RedPacketView(Context context) {
super(context);
init();
} public RedPacketView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
} public RedPacketView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
} private void init() {
mPath = new Path();
mRandom = new Random(); initPaint();
initMoneyPaint(); //随机产生一个面值
mText = moneys[mRandom.nextInt(moneys.length)]; //获取字体的宽高
moneyPaint.getTextBounds(mText, 0, mText.length(), mTextBound);
} private void initPaint() {
mPaint = new Paint();
mPaint.setColor(Color.parseColor("#c0c0c0"));
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeCap(Paint.Cap.ROUND);
/**
* 设置接合处的形态
*/
mPaint.setStrokeJoin(Paint.Join.ROUND);
/**
* 抗抖动
*/
mPaint.setDither(true);
mPaint.setAntiAlias(true);
mPaint.setStrokeWidth(PAINT_WIDTH);
} /**
* money画笔
*/
private void initMoneyPaint() {
moneyPaint = new Paint();
moneyPaint.setColor(Color.RED);
moneyPaint.setAntiAlias(true);
moneyPaint.setTextSize(30);
mTextBound = new Rect();
} @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec); int width = getMeasuredWidth();
int height = getMeasuredHeight(); try {
mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
mCanvas = new Canvas(mBitmap); Bitmap bitmap = Bitmap.createBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.red_packet)); mCanvas.drawBitmap(bitmap, null, new RectF(0, 0, width, height), null); } catch (Exception e) {
e.printStackTrace();
}
} @Override
protected void onDraw(Canvas canvas) {
try {
canvas.drawText(mText, getWidth() / 2 - mTextBound.width() / 2, getHeight() / 2 + mTextBound.height() / 2, moneyPaint); if (isComplete) return; //设置图片的结合方式
mPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_OUT));
mCanvas.drawPath(mPath, mPaint); canvas.drawBitmap(mBitmap, 0, 0, null);
} catch (Exception e) {
e.printStackTrace();
}
} @Override
public boolean onTouchEvent(MotionEvent event) {
x = (int) event.getX();
y = (int) event.getY(); switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
//路径的初始化位置
mPath.moveTo(x, y);
break;
case MotionEvent.ACTION_MOVE:
if (movable) {
// 跟手滑效果
setX(x + getLeft() + getTranslationX() - getWidth() / 2);
setY(y + getTop() + getTranslationY() - getHeight() / 2);
} else if (Math.abs(x - mLastX) > DEFAULT_PATH_INSTANCE || Math.abs(y - mLastY) > DEFAULT_PATH_INSTANCE) {
// 记录手指擦除路径
mPath.lineTo(x, y);
invalidate();
}
case MotionEvent.ACTION_UP:
MyAsyncTask task = new MyAsyncTask();
task.execute();
break;
} //记录上次位置
mLastX = x;
mLastY = y;
return true;
} /**
* 查看眼下的红包的擦除比例,实现全然擦除
*/
class MyAsyncTask extends AsyncTask{
@Override
protected Object doInBackground(Object[] params) {
clearOverPercent();
return null;
} private void clearOverPercent()
{
int[] mPixels; int w = getWidth();
int h = getHeight(); float wipeArea = 0;
float totalArea = w * h; Bitmap bitmap = Bitmap.createBitmap(mBitmap); mPixels = new int[w * h]; //拿到全部像素信息
bitmap.getPixels(mPixels, 0, w, 0, 0, w, h); //获取擦除部分的面积
int index = 0;
for (int i = 0; i < w; i++) {
for (int j = 0; j < h; j++) {
if (mPixels[index] == 0) {
wipeArea++;
}
index++;
}
} int percent = (int) (wipeArea / totalArea * 100);
if (percent > 70) {
isComplete = true;
postInvalidate();
}
}
};
}
5.实现发红包的父容器LaunchRedPacketLayout。
重点说下贝塞尔曲线动画部分的实现。实现的过程用到四个点。各自是起点,随机点1,随机点2,终点。
起点为控件的底部中点,终点为控件顶部的随意点即(x=n, y=0)。
随机点为控件内部随意点。当然为了更好的效果。点位分布均匀为佳。
/**
* 估值器
*/
static class BSEEvaluator implements TypeEvaluator<PointF> {
private PointF pointF1;
private PointF pointF2; public BSEEvaluator(PointF pointF1, PointF pointF2) {
this.pointF1 = pointF1;
this.pointF2 = pointF2;
} @Override
public PointF evaluate(float fraction, PointF startValue, PointF endValue) {
PointF pointF = new PointF(); float lFraction = 1 - fraction; pointF.x = (float) (startValue.x * Math.pow(lFraction, 3) +
3 * pointF1.x * fraction * Math.pow(lFraction, 2) +
3 * pointF2.x * Math.pow(lFraction, 2) * fraction +
endValue.x * Math.pow(fraction, 3));
pointF.y = (float) (startValue.y * Math.pow(lFraction, 3) +
3 * pointF1.y * fraction * Math.pow(lFraction, 2) +
3 * pointF2.y * Math.pow(fraction, 2) * lFraction +
endValue.y * Math.pow(fraction, 3)); return pointF;
}
}
7.设置属性动画的监听器,不断将新的位置设置给红包,让红包动起来
private ValueAnimator getBSEValueAnimator(View target) {
//贝赛尔估值器
BSEEvaluator evaluator = new BSEEvaluator(getPoint(), getPoint());
ValueAnimator animator = ValueAnimator.ofObject(evaluator, new PointF((mWidth - dWidth) / 2, mHeight - dHeight), new PointF(random.nextInt(mWidth), 0));
animator.addUpdateListener(new BSEListenr(target));
animator.setTarget(target);
animator.setDuration(3000);
return animator;
} private class BSEListenr implements ValueAnimator.AnimatorUpdateListener { private View target; public BSEListenr(View target) {
this.target = target;
} @Override
public void onAnimationUpdate(ValueAnimator animation) {
//这里获取到贝塞尔曲线计算出来的的xy值
PointF pointF = (PointF) animation.getAnimatedValue();
target.setX(pointF.x);
target.setY(pointF.y);
}
}
8.提供发射红包的入口方法
/**
* 发射多个红包
*
* @param numb
*/
public void launch(int numb) throws Exception {
for (int i = 0; i < numb; i++)
launch();
} /**
* 发射红包
*/
public void launch() throws Exception {
final RedPacketView imageView = new RedPacketView(getContext());
imageView.setImageDrawable(drawable); //设置位置
LayoutParams layoutParams = new LayoutParams(dWidth, dHeight);
layoutParams.addRule(ALIGN_PARENT_BOTTOM, TRUE);
layoutParams.addRule(CENTER_HORIZONTAL, TRUE);
imageView.setLayoutParams(layoutParams); final Animator set = addAnimatior(imageView); imageView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
x = (int) imageView.getX();
y = (int) imageView.getY(); if (!imageView.isTouch) {
imageView.isTouch = true;
set.end();
} if (MotionEvent.ACTION_UP == event.getAction()) {
if (imageView.movable) {
ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f).start();
AnimatorSet setDown = new AnimatorSet();
setDown.playTogether(
ObjectAnimator.ofFloat(imageView, "scaleX", 0.8f, 1.5f),
ObjectAnimator.ofFloat(imageView, "scaleY", 0.8f, 1.5f)
);
setDown.start(); imageView.movable = false;
}
} return false;
}
}); addView(imageView);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation); // 动画结束移除view
if (imageView.isTouch) {
imageView.setX(x);
imageView.setY(y);
} else {
removeView(imageView);
}
}
});
set.start();
}
9.附上完整代码
public class LaunchRedPacketLayout extends RelativeLayout {
private Drawable drawable;
private int dWidth;
private int dHeight;
private int mWidth;
private int mHeight;
int x, y; /**
* 插值器组
*/
private Interpolator[] interpolatorsArray; private Random random; public LaunchRedPacketLayout(Context context) {
super(context);
init();
} public LaunchRedPacketLayout(Context context, AttributeSet attrs) {
super(context, attrs);
init();
} private void init() {
drawable = getResources().getDrawable(R.drawable.red_packet);
dWidth = drawable.getIntrinsicWidth();
dHeight = drawable.getIntrinsicHeight(); random = new Random(); interpolatorsArray = new Interpolator[4];
interpolatorsArray[0] = new LinearInterpolator();
interpolatorsArray[1] = new AccelerateInterpolator();
interpolatorsArray[2] = new DecelerateInterpolator();
interpolatorsArray[3] = new AccelerateDecelerateInterpolator(); post(new Runnable() {
@Override
public void run() {
mHeight = getMeasuredHeight();
mWidth = getMeasuredWidth(); int curWidth = dWidth;
dWidth = mWidth / 5;
dHeight = dHeight * dWidth / curWidth;
}
});
} /**
* 发射多个红包
*
* @param numb
*/
public void launch(int numb) throws Exception {
for (int i = 0; i < numb; i++)
launch();
} /**
* 发射红包
*/
public void launch() throws Exception {
final RedPacketView imageView = new RedPacketView(getContext());
imageView.setImageDrawable(drawable); //设置位置
LayoutParams layoutParams = new LayoutParams(dWidth, dHeight);
layoutParams.addRule(ALIGN_PARENT_BOTTOM, TRUE);
layoutParams.addRule(CENTER_HORIZONTAL, TRUE);
imageView.setLayoutParams(layoutParams); final Animator set = addAnimatior(imageView); imageView.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View v, MotionEvent event) {
x = (int) imageView.getX();
y = (int) imageView.getY(); if (!imageView.isTouch) {
imageView.isTouch = true;
set.end();
} if (MotionEvent.ACTION_UP == event.getAction()) {
if (imageView.movable) {
ObjectAnimator.ofFloat(imageView, View.ALPHA, 1f).start();
AnimatorSet setDown = new AnimatorSet();
setDown.playTogether(
ObjectAnimator.ofFloat(imageView, "scaleX", 0.8f, 1.5f),
ObjectAnimator.ofFloat(imageView, "scaleY", 0.8f, 1.5f)
);
setDown.start(); imageView.movable = false;
}
} return false;
}
}); addView(imageView);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation); // 动画结束移除view
if (imageView.isTouch) {
imageView.setX(x);
imageView.setY(y);
} else {
removeView(imageView);
}
}
});
set.start();
} /**
* 设置动画
*
* @param target
*/
private Animator addAnimatior(View target) throws Exception {
AnimatorSet set = new AnimatorSet();
AnimatorSet enterSet = getEnterSet(target); ValueAnimator bezierValueAnimator = getBSEValueAnimator(target);
set.playSequentially(enterSet, bezierValueAnimator);
set.setInterpolator(interpolatorsArray[random.nextInt(4)]);
set.setTarget(target);
return set;
} private class BSEListenr implements ValueAnimator.AnimatorUpdateListener { private View target; public BSEListenr(View target) {
this.target = target;
} @Override
public void onAnimationUpdate(ValueAnimator animation) {
//这里获取到贝塞尔曲线计算出来的的x y值
PointF pointF = (PointF) animation.getAnimatedValue();
target.setX(pointF.x);
target.setY(pointF.y);
}
} /**
* 设置贝赛尔曲线动画
*
* @param target
* @return
*/
private ValueAnimator getBSEValueAnimator(View target) {
//贝赛尔估值器
BSEEvaluator evaluator = new BSEEvaluator(getPoint(), getPoint());
ValueAnimator animator = ValueAnimator.ofObject(evaluator, new PointF((mWidth - dWidth) / 2, mHeight - dHeight), new PointF(random.nextInt(mWidth), 0));
animator.addUpdateListener(new BSEListenr(target));
animator.setTarget(target);
animator.setDuration(3000);
return animator;
} private PointF getPoint() {
PointF pointF = new PointF();
pointF.x = random.nextInt(mWidth);
pointF.y = random.nextInt(mHeight - dHeight);
return pointF;
} /**
* 估值器
*/
static class BSEEvaluator implements TypeEvaluator<PointF> {
private PointF pointF1;
private PointF pointF2; public BSEEvaluator(PointF pointF1, PointF pointF2) {
this.pointF1 = pointF1;
this.pointF2 = pointF2;
} @Override
public PointF evaluate(float fraction, PointF startValue, PointF endValue) {
PointF pointF = new PointF(); float lFraction = 1 - fraction; pointF.x = (float) (startValue.x * Math.pow(lFraction, 3) +
3 * pointF1.x * fraction * Math.pow(lFraction, 2) +
3 * pointF2.x * Math.pow(lFraction, 2) * fraction +
endValue.x * Math.pow(fraction, 3));
pointF.y = (float) (startValue.y * Math.pow(lFraction, 3) +
3 * pointF1.y * fraction * Math.pow(lFraction, 2) +
3 * pointF2.y * Math.pow(fraction, 2) * lFraction +
endValue.y * Math.pow(fraction, 3)); return pointF;
}
} /**
* 入场动画
*
* @param target
* @return
*/
private AnimatorSet getEnterSet(View target) {
try {
AnimatorSet enterSet = new AnimatorSet(); enterSet.playTogether(
ObjectAnimator.ofFloat(target, View.ALPHA, 0, 1f),
ObjectAnimator.ofFloat(target, View.SCALE_X, 0.1f, 0.8f),
ObjectAnimator.ofFloat(target, View.SCALE_Y, 0.1f, 0.8f)
);
enterSet.setDuration(500);
enterSet.setInterpolator(new LinearInterpolator());
enterSet.setTarget(target); return enterSet;
} catch (Exception e) {
e.printStackTrace();
}
return null;
} }
10.试下
<? xml version="1.0" encoding="utf-8"? >
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="sample.MainActivity"
tools:showIn="@layout/activity_main"> <com.empty.launchredpacket.LaunchRedPacketLayout
android:id="@+id/launchRedPacket"
android:layout_width="match_parent"
android:background="#faecec"
android:layout_height="400dp"
/> <Button
android:id="@+id/launchBtn"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="5dp"
android:background="@color/colorPrimary"
android:text="发射"
android:textColor="@android:color/white" /> <Button
android:id="@+id/reStart"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="5dp"
android:background="@color/colorPrimary"
android:text="又一次開始"
android:textColor="@android:color/white" />
</LinearLayout>
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private LaunchRedPacketLayout launchRedPacketLayout;
private Button launchBtn, reStartBtn; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); launchRedPacketLayout = (LaunchRedPacketLayout) findViewById(R.id.launchRedPacket);
launchBtn = (Button) findViewById(R.id.launchBtn);
reStartBtn = (Button) findViewById(R.id.reStart); launchBtn.setOnClickListener(this);
reStartBtn.setOnClickListener(this);
} @Override
public void onClick(View v) {
try {
switch (v.getId()) {
case R.id.reStart:
startActivity(new Intent(this, MainActivity.class));
finish();
overridePendingTransition(0, 0);
break;
case R.id.launchBtn:
launchRedPacketLayout.launch(3);
break;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
总结
十分感谢 程序亦非猿,hongyang 大神的博客
发红包android的更多相关文章
- PHP实现发红包程序
我们先来分析下规律. 设定总金额为10元,有N个人随机领取: N=1 第一个 则红包金额=X元: N=2 第二个 为保证第二个红包可以正常发出,第一个红包金额=0.01至9.99之间的某个随机数. 第 ...
- PHP实现发红包程序(helloweba网站经典小案例)
我们先来分析下规律. 设定总金额为10元,有N个人随机领取: N=1 第一个 则红包金额=X元: N=2 第二个 为保证第二个红包可以正常发出,第一个红包金额=0.01至9.99之间的某个随机数. 第 ...
- 使用PHP编写发红包程序
使用PHP编写发红包程序 http://www.jb51.net/article/69815.htm 投稿:hebedich 字体:[增加 减小] 类型:转载 时间:2015-07-22 微信发红 ...
- js 发红包
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- 微信小程序红包开发 小程序发红包 开发过程中遇到的坑 微信小程序红包接口的
最近公司在开发一个小程序红包系统,客户抢到红包需要提现.也就是通过小程序来给用户发红包. 小程序如何来发红包呢?于是我想到两个方法. 之前公众号开发一直用了的.一个是红包接口,一个是企业支付接口.一开 ...
- 微信小程序发红包
背景: 近期一个朋友公司要做活动,活动放在小程序上.小程序开发倒是不难,不过要使用小程序给微信用户发红包,这个就有点麻烦 确定模式: 小程序目前没有发红包接口,要实现的话,只能是模拟红包,即小程序上做 ...
- JAVA发红包案例
模拟拼手气红包* 对于指定总金额以及红包个数,可以生成不同金额的红包,*,每个红包金额随机生成. * 分析这个题目:* 1.首先需要一个分发红包的方法.输入的参数是 总金额 以及 红包个数.* 按照这 ...
- Python_程序实现发红包
发红包 200块钱 20个红包 将200块随机分成20份 基础版本: import random ret = random.sample(range(1, 200 * 100), 19) ret = ...
- 微信发红包 PHP 实现
最近做生日营销,需要微信发红包,特此从网上找了一篇教程 首先你的有个服务号,并且开通了微信支付,我在这就不说怎么去申请和开通了,我是看了微信官方文档后,想看官方文档的朋友可以到下面这个链接 https ...
随机推荐
- ionic3 打包安卓平台环境搭建报错解决方案总结
1.jvm虚拟机提供的运行空间小于项目所需的空间是报错.如图: 解决方法:在环境变量中配置jvm的运行内存大小,大于所需的内存即可. 其中:-Xmx512M可根据实际提示情况,进行更改,如1024M, ...
- python爬虫(一)_爬虫原理和数据抓取
本篇将开始介绍Python原理,更多内容请参考:Python学习指南 为什么要做爬虫 著名的革命家.思想家.政治家.战略家.社会改革的主要领导人物马云曾经在2015年提到由IT转到DT,何谓DT,DT ...
- ASP.NET Core集成现有系统认证
我们现在大多数转向ASP.NET Core来使用开发的团队,应该都不是从0开始搭建系统,而是老的业务系统已经在运行,ASP.NET Core用来开发新模块.那么解决用户认证的问题,成为我们的第一个拦路 ...
- javaWeb内置对象
jsp内置对象是web容器创建的一组对象. jsp内置对象的名称是jsp的保留字. jsp内置对象是可以直接在jsp页面使用的对象,无需使用new获取实例. jsp九大内置对象 1.request 2 ...
- 高效sql2005分页存储过程
高效分页存储过程 --分页存储过程示例 Alter PROCEDURE [dbo].[JH_PageDemo] @pageSize int = 9000000000, @pageIndex int = ...
- java 导出blob图片到excel
实现功能,导出当前页面显示员工的图片,核心代码已给出,仅供参考, 如需转载请注明出处http://www.cnblogs.com/wangjianguang/p/7852060.html 随便再扯2句 ...
- [收藏] Java源码阅读的真实体会
收藏自http://www.iteye.com/topic/1113732 刚才在论坛不经意间,看到有关源码阅读的帖子.回想自己前几年,阅读源码那种兴奋和成就感(1),不禁又有一种激动. 源码阅读,我 ...
- python基础(二)-------数据类型
python开发基础篇(二)数据类型 python数据类型有: 1.数字 1.只能存放一个值 2.一经定义,不可更改 3.直接访问 主要的分类为:整型,长整型,(python2有长整型的概念Pytho ...
- pt-tcp-model
http://blog.9minutesnooze.com/analyzing-http-traffic-tcpdump-perconas-pttcpmodel/ #获取200k个packets tc ...
- Python之配置模块ConfigParser
http://docs.python.org/2/library/configparser.html http://www.cnblogs.com/sislcb/archive/2008/11/25/ ...