czh306

导航

<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

统计

常用链接

留言簿(2)

随笔分类

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜

2008年10月14日 #

二进制码与格雷码的转换(Verilog实现)

module Bin2Grad(BinCode, GradCode);
parameter Code_Width = 8;
input [Code_Width - 1 : 0] BinCode;
output [Code_Width - 1 : 0] GradCode;

integer i;
reg [Code_Width - 1 : 0] GradCode;
always @(BinCode)
    begin
        for (i = 0; i < Code_Width - 1; i = i +1)
            begin
                GradCode[i] = BinCode[i] + BinCode[i + 1];
            end
        GradCode[Code_Width - 1] = BinCode[Code_Width - 1];
    end

endmodule

posted @ 2008-10-14 14:42 czh306 阅读(1195) | 评论 (0)编辑 收藏

2006年10月5日 #

WTL支持中文

1)打开资源文件,把LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US修改为
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
2)关闭资源文件
3)打开对话框,输入汉字,并保存
4)右击资源文件属性,选择Resources->General->Culture,设置为:中文(中国) (0x804)
5)编译,测试

posted @ 2006-10-05 12:17 czh306 阅读(744) | 评论 (0)编辑 收藏

2006年9月24日 #

在VC2005中编译OpenVPN项目

1)下载openvpn-2.0.8
2)在VC2005中新建一个控制台空项目
3)把openvpn-2.0.8中的除memcmp.c外的所有文件增加到项目
4)删除修改config-win32.h文件中的#include <windows.h>行
5)增加openssl的头文件及库文件
6)增加lzo的头文件及库文件
以上主要是2)及4)其它可参考makefile.w32-vc文件
另最好不要在vc6中编译,如果要在vc6中编译要找齐其所用的头文件及库文件,比较麻烦

posted @ 2006-09-24 20:01 czh306 阅读(3216) | 评论 (50)编辑 收藏

2006年7月18日 #

Singleton单件模板类的用法

如下类WorkList:
public ref class WorkList
  {
  protected:
   WorkList(void);
  public:
   void AddWork(System::String^ workName, System::String^ ResourceId)
   {
       Console::WriteLine("WorkName:" + workName);
   }
   };
要注意WorkList的构造函数为受保护的并无参数.

Singleton单件模板的用法如下:
Singleton<WorkList>::Instance()->AddWork(workName, ResourceId);

posted @ 2006-07-18 16:27 czh306 阅读(615) | 评论 (0)编辑 收藏

C++/CLI中单件模板的实现

template<typename _T> public ref class Singleton : public _T
  {
  public:
   static _T^ Instance(void)
   {
    if (_instance == nullptr)
    {
     _mut->WaitOne();
     try
     {
      if (_instance == nullptr)
      {
       _instance = safe_cast<_T^>(gcnew Singleton<_T>);
      }
     }
     finally
     {
      _mut->ReleaseMutex();
     }
    }
    return _instance;
   }
  protected:
   Singleton(void){}
  protected:
   static _T^ _instance = nullptr;
   static System::Threading::Mutex^ _mut = gcnew System::Threading::Mutex();
  };

posted @ 2006-07-18 16:01 czh306 阅读(363) | 评论 (0)编辑 收藏

仅列出标题