摘要: 我的技术路线是C、C++、C#、PHP,什么都做过,很杂,总想着该怎么继续下去。最近突然发现了NodeJs,觉得很适合我。学习环境定在了Ubuntu下,编辑软件选择了WebStorm7。经过几天的努力,终于把基础环境弄熟了,因为对IOCP比较熟,所以上手还是比较快的。首先结合算法,来熟悉javascript与编辑开发环境,准备用JS实现一系列的算法。 阅读全文
posted @ 2014-03-07 22:51 zhoutk 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 最近在看反射,突然想写一个ORM工具,要轻量级的,不要配置文档,先不管效率,就是一个小工具,在项目初期方便挂数据库。我的目标就是在数据库中建个表,在项目中写个模型,然后用上这个ORM工具,就能实现数据库的基本增删改查。有想法就动手做,翠花上代码:增public bool Insert(object entity) { Type t = entity.GetType(); PropertyInfo[] properties = t.GetProperties(); if (properties.Count<Prope... 阅读全文
posted @ 2013-01-09 00:05 zhoutk 阅读(4723) 评论(15) 推荐(7) 编辑
摘要: 最近有项目要做一个高性能网络服务器,决定下功夫搞定完成端口(IOCP),最终花了一个星期终于把它弄清楚了,并用C++写了一个版本,效率很不错。但,从项目的总体需求来考虑,最终决定上.net平台,因此又花了一天一夜弄出了一个C#版,在这与大家分享。一些心得体会:1、在C#中,不用去面对完成端口的操作系统内核对象,Microsoft已经为我们提供了SocketAsyncEventArgs类,它封装了IOCP的使用。请参考:http://msdn.microsoft.com/zh-cn/library/system.net.sockets.socketasynceventargs.aspx?cs-s 阅读全文
posted @ 2012-12-26 10:16 zhoutk 阅读(26832) 评论(58) 推荐(26) 编辑
摘要: View Code typedef int DataType;struct Node{ DataType entry; Node * next; Node(); Node(DataType item, Node * add_on = NULL);};class DyStack{public: DyStack(); bool empty() const; ErrorCode push(const DataType &item); ErrorCode pop(); ErrorCode top(DataType &item) const; ... 阅读全文
posted @ 2012-10-26 00:34 zhoutk 阅读(332) 评论(0) 推荐(0) 编辑
摘要: C#队列的循环实现:View Code class MyQueue <T> { private const int MAXLIMIT = 10; private int count; private int rear, front; private T[] entry = new T[MAXLIMIT]; public MyQueue() { count = 0; rear = MAXLIMIT - 1; front = 0; ... 阅读全文
posted @ 2012-10-24 19:42 zhoutk 阅读(897) 评论(0) 推荐(0) 编辑
摘要: C++队列的循环实现:View Code const int MAXQUEUE = 10;template<class T>class ZtkQueue {public: ZtkQueue(); bool empty() const; ErrorCode append(const T &x); ErrorCode serve(); ErrorCode retrieve (T &x)const; bool full() const; int size() const; void clear(); ErrorCode serve_and_ret... 阅读全文
posted @ 2012-10-24 00:20 zhoutk 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 用顺序结构(数组)与模板技术实现Stack如下:View Code class MyStack <T> { private const int MAXSTACK = 10; private int count; private T[] entry = new T[MAXSTACK]; public MyStack() { count = 0; } public bool empty() { bool outcome = true; if (count > 0) ... 阅读全文
posted @ 2012-10-16 09:52 zhoutk 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 用顺序结构(数组)与模板技术实现Stack如下:View Code const int MAXSTACK = 10;template<class T>class ZtkStack{public: ZtkStack(); bool empty() const; ErrorCode pop(); ErrorCode top(T &item) const; ErrorCode push(const T &item);private: int count; T entry[MAXSTACK];};template<class T>ZtkStack<T> 阅读全文
posted @ 2012-10-16 00:49 zhoutk 阅读(325) 评论(0) 推荐(0) 编辑
摘要: 1、建立Win32控制台空项目;2、项目属性默认使用Unicode库,我们要关闭它,Alt+F7/Character Set/Not Set;3、添加源文件C++ File(.cpp); 最简单的示例代码:#include<iostream>int main(){ std::cout << "This is a test program!" << std::endl; std::getchar(); return 0;}注:这是使用VS2012编写标准C++代码(ISO/IEC C++),可移植性最好的方法。 阅读全文
posted @ 2012-10-11 00:21 zhoutk 阅读(307) 评论(0) 推荐(0) 编辑