摘要: public static class ByteHexHelper{ private static char[] _buffedChars = null; private static byte[] _buffedBytes = null; static ByteHexHelper() { _buffedChars = new char[(byte.MaxValue - byte.MinValue + 1) * 2]; int idx = 0; byte b = byte.MinValue; while (true... 阅读全文
posted @ 2011-08-29 00:46 ahui 阅读(7053) 评论(0) 推荐(0) 编辑
摘要: function resizeImage(image, max) { if (Math.max(image.width, image.height) > max) { if (image.width > image.height) image.width = max; else image.height = max; } return true;} <img onload="var max=64;if(Math.max(this.width,this.height)>max){if(this.width>this.height)this.width=ma 阅读全文
posted @ 2011-08-18 14:46 ahui 阅读(804) 评论(0) 推荐(0) 编辑
摘要: EF通用的分页实现:/// <summary>/// 根据条件分页获得记录/// </summary>/// <param name="where">条件</param>/// <param name="orderBy">排序</param>/// <param name="ascending">是否升序</param>/// <param name="pageIndex">当前页码</param> 阅读全文
posted @ 2011-08-04 14:03 ahui 阅读(23251) 评论(19) 推荐(6) 编辑
摘要: 假设消息头为16byte0-3 消息头标识4-7 消息体长度8-15 CRC校验码public class StreamHelper { #region 将消息转为包含消息头的字节数组 /// <summary> /// 将消息转为包含消息头的字节数组 /// </summary> /// <param name="stream"></param> /// <param name="message"></param> /// <returns></returns&g 阅读全文
posted @ 2011-07-12 09:32 ahui 阅读(4452) 评论(0) 推荐(0) 编辑
摘要: #region 异步接收Socket数据/// <summary>/// 异步接收Socket数据/// </summary>/// <param name="socket"></param>/// <returns></returns>public static byte[] ReceiveData(Socket socket){ ReceiveObject state = new ReceiveObject() { Client = socket }; socket.BeginReceive(sta 阅读全文
posted @ 2011-07-04 16:31 ahui 阅读(5734) 评论(0) 推荐(1) 编辑
摘要: set s=%date:~0,4%%date:~5,2%%date:~8,2%%time:~1,1%%time:~3,2%%time:~6,2%mysqldump -u root -ppasswd test> E:\51MobApp\Mysql\test_%s%_bak.sqlInstall.bat:@echo offcd /d %~dp0echo 执行此脚本会清除所有数据set /p svr=请输入Mysql服务器IP: echo mysql -u root -h %svr% -p < All.sqlmysql -u root -h %svr% -p < All.sqlpa 阅读全文
posted @ 2011-06-24 10:12 ahui 阅读(350) 评论(0) 推荐(0) 编辑
摘要: 体步骤如下 1、获得root权限:adb root 2、设置/system为可读写:adb remount 3、将hosts文件复制到PC:adb pull /system/etc/hosts e:\hosts4、修改PC机上文件 5、将PC机上文件复制到手机:adb push e:\hosts /system/etc/hosts 但在第五步时,有的人会报 out of memory的错误 这是因为直接用命令行启动,而没加一个参数造成的,但是用下面这个命令来启动就行了 emulator -avd Android2.1 -partition-size 128 阅读全文
posted @ 2011-05-17 14:38 ahui 阅读(5448) 评论(0) 推荐(0) 编辑
摘要: 1.NET源代码:using System;using System.Text;using System.Security.Cryptography;namespace ConsoleApplicationDemo{ /// <summary> /// AES对称加密解密类 /// </summary> public class AESHelper { #region 成员变量 /// <summary> /// 密钥(32位,不足在后面补0) /// </summary> private co... 阅读全文
posted @ 2011-04-22 16:27 ahui 阅读(5588) 评论(4) 推荐(1) 编辑
摘要: 1.C#代码(需要调用SharpZipLib):using System.IO;using System.Text;using ICSharpCode.SharpZipLib.Zip.Compression.Streams;namespace ConsoleApplicationDemo{ public class ZipHelper { /// <summary> /// 以Deflater方式压缩字符串,返回字节数组 /// </summary> /// <param name="sString"></param> /// 阅读全文
posted @ 2011-04-21 18:00 ahui 阅读(1918) 评论(1) 推荐(1) 编辑
摘要: package com.google.test;import java.lang.reflect.Array;import java.lang.reflect.Field;import java.lang.reflect.ParameterizedType;import java.lang.reflect.Type;import java.util.Collection;import org.json.JSONArray;import org.json.JSONException;import org.json.JSONObject;import org.json.JSONStringer;/ 阅读全文
posted @ 2011-04-21 17:54 ahui 阅读(6124) 评论(2) 推荐(2) 编辑