2012年5月7日

动态修改Windows Service名称

摘要: View Code 1 (1)创建文件:ServiceConfig.txt 2 3 (2)写如下配置: 4 5 ServiceName=DaemonTask1 6 (3)写一个配置类: 7 8 public class Config 9 {10 public static string GetServiceConfig(string key)11 {12 string[] result = { string.Empty };13 string fileName1 = "ServiceConfig.t... 阅读全文

posted @ 2012-05-07 18:00 哥是技术人 阅读(448) 评论(0) 推荐(0)

2012年5月3日

将byte[]通过BinaryReader转换成对象

摘要: public static object ConvertResponseToObject(byte[] Bytes){if (Bytes == null || Bytes.Length == 0) { return null; }byte[] tempBytes = Bytes.Clone() as byte[];using (MemoryStream memoryStream = new MemoryStream(tempBytes)){BinaryReader binaryReader = new BinaryReader(memoryStream);audio_search_resp r 阅读全文

posted @ 2012-05-03 10:29 哥是技术人 阅读(615) 评论(0) 推荐(0)

将对象通过BinaryWriter转换成byte[]

摘要: public static byte[] ConvertRequestToBytes(audio_search_req requestData){using (MemoryStream memoryStream = new MemoryStream()){BinaryWriter binaryWriter = new BinaryWriter(memoryStream);binaryWriter.Write(requestData.version);binaryWriter.Write(requestData.queryFname);binaryWriter.Write(requestData 阅读全文

posted @ 2012-05-03 10:29 哥是技术人 阅读(938) 评论(0) 推荐(0)

JNA调用C++的DLL

摘要: import com.sun.jna.*;import com.sun.jna.platform.*;import com.sun.jna.platform.win32.WinNT;import com.sun.jna.win32.*;import java.util.ArrayList;public class TestJNA {public interface MyDrivers extends StdCallLibrary {MyDrivers INSTANCE1 = (MyDrivers)Native.loadLibrary("D:\\NCR_JNI\\DLL\\CRT_35 阅读全文

posted @ 2012-05-03 10:28 哥是技术人 阅读(332) 评论(0) 推荐(0)

Linux命令行在su root后突然变成bash-4.1$的办法

摘要: 1 在根目录下建立root目录2 拷贝/etc/skel目录下的.bash_logout和.bashrc和.bash_profile到root目录即可。 阅读全文

posted @ 2012-05-03 10:28 哥是技术人 阅读(646) 评论(0) 推荐(0)

JNI,C++,终于调试通过

摘要: 第一步,写hello.java第二步,执行javac hello.java第三步,执行javah -jni hello(如果写成hello.class会报错),生成hello.h第四步,创建一个C++的dll,比如叫hello第五步,将hello.h,jni.h,jni_md.h拷贝到hello工程目录下,添加进工程里第六步,修改hello工程中的hello.h中的#include <jni.h>成#include "jni.h"第七步,在hello工程中添加hello.cpp,在hello.cpp添加#include "hello.h",把 阅读全文

posted @ 2012-05-03 10:27 哥是技术人 阅读(234) 评论(0) 推荐(0)

Hbase测试&打补丁(HBASE-5415.patch)

摘要: 操作系统:CentOSHbase版本:0.92.0(1)下载到/opt目录下,解压缩,改名后:/opt/hbase(2)修改配置/opt/hbase/conf/hbase-env.sh,填写JDK目录:export JAVA_HOME=/opt/jdk(3)修改配置/opt/hbase/conf/hbase-site.xml<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="configuration.xsl"?><configurati 阅读全文

posted @ 2012-05-03 10:26 哥是技术人 阅读(719) 评论(0) 推荐(0)

2011年1月17日

一致性哈希算法测试(C#)

摘要: 10个Memcached节点,填充100000数据的测试结果如下:192.168.1.199:11211 => 13046192.168.1.191:11211 => 18230192.168.1.197:11211 => 6382192.168.1.194:11211 => 5242192.168.1.193:11211 => 25554192.168.1.190:11211 => 1124192.168.1.196:11211 => 4074192.168.1.198:11211 => 466192.168.1.192:11211 => 阅读全文

posted @ 2011-01-17 15:39 哥是技术人 阅读(293) 评论(0) 推荐(0)

导航