摘要: mnesia数据库学习笔记1、基本使用流程1>mnesia:create_schema([node]). %创建方案的本地节点上。2>mnesia:start(). %启动数据库3>mnesia:create_table(funky,[]).%创建表4>mnesia:info(). %查看数据库信息在启动erlang时,erl -mnesia dir '"/dir"' 用于指定Mnesia数据存储位置。2、定义表结构,创建表% company.hrl-record(employee, {emp_no, name, salary, se 阅读全文
posted @ 2011-12-21 11:40 陈峰 阅读(983) 评论(0) 推荐(1)
摘要: 网游同步算法之导航推测(Dead Reckoning)算法: 在了解该算法前,我们先来谈谈该算法的一些背景资料。大家都知道,在网络传输的时候,延迟现象是非常普遍的,而在基于Server/Client结构下 的网络游戏的同步也就成了非常头疼的问题,在确保客户端响应用户本地指令流畅的情况下,没法有效的确 阅读全文
posted @ 2011-12-19 13:46 陈峰 阅读(10094) 评论(1) 推荐(0)
摘要: 1、变量所有变量必须以大写字母开头。如:X Y2、模式匹配在Erlang中,=表示一个模式匹配操作, Lhs=Rhs实际是对右端求后,将结果与左端求值进行匹配。 其中如果左端为未绑定变量,则完全匹配,并赋值到左端。3、浮点数"/"永远返回浮点数, N div M 和 N rem M是用于整数除和取余数。如:0.324、原子在Erlang中,原子用来表示不同非数字常量值;原子是以一串以小写字母开头,后跟数字字母或下划线或邮件符号的字符串;使用单引号引起来的字符串也是原子。如:red、cat、joe@somhost、a_lang_name、'an atom'5、 阅读全文
posted @ 2011-12-16 14:42 陈峰 阅读(675) 评论(0) 推荐(0)
摘要: 实例代码http://blog.csdn.net/mxzy55560593/article/details/7063965BTree读写view plainDbdb(NULL,DB_CXX_NO_EXCEPTIONS);//环境指针//事务指针,数据库类别,访问标志(创建,只读,自动提交事务,线程安全),mode在windows中忽略if(db.open(NULL,"test.db",NULL,DB_BTREE,DB_CREATE|DB_TRUNCATE,0)!=0){cout<<"同名数据库存在"<<endl;}//基本写int 阅读全文
posted @ 2011-12-16 11:01 陈峰 阅读(286) 评论(0) 推荐(0)
摘要: MVC演化MVC已经成为我们最常误用的模式,人们之所以常常误用MVC,很大程度上是因为混淆了不同的MVC变体。【转自】http://www.cnblogs.com/wubaiqing/archive/2011/10/26/2225438.htmlhttp://www.cnblogs.com/wubaiqing/archive/2011/10/26/2225438.htmlClassic MVC Classic MVC 大概上世纪七十年代,Xerox PARC的Trygve提出了MVC的概念。 并应用在Smalltalk系统中,为了和其它类型的MVC加以区分,历史上习惯的称之为Classi... 阅读全文
posted @ 2011-12-13 13:05 陈峰 阅读(142) 评论(0) 推荐(0)
摘要: ACE的一个链接问题http://hi.baidu.com/developer_chen/blog/item/2bf78c7ec9971f3b0cd7da9b.html写了一个ACE小程序,发现链接的时候出现__declspec(dllimport) int __cdecl ace_os_wmain_i(class ACE_Main_Base &,int,wchar_t * * const)"错误提示。分析发现ACE小程序的工程字符集是Unicode,而ACE库编译的时候是设置"未设置",所以链接不到unicode版本的main函数。将ACE小程序的工程字 阅读全文
posted @ 2011-12-12 10:57 陈峰 阅读(309) 评论(0) 推荐(0)
摘要: 当你在项目属性中,常规设置在字符集为UNICODE后,运行以下代码:#include "stdafx.h"#include <iostream>using namespace std;int _tmain(int argc, _TCHAR* argv[]){#if defined UNICODEstd::cout << sizeof(L"aaa") <<endl;#endifreturn 0;}会发现UNICODE无效,此时,在项目配置属性-》C/C++-》预处理器-》预处理器定义中,点选编辑选择从“父项或项目默认属性 阅读全文
posted @ 2011-12-12 10:49 陈峰 阅读(1809) 评论(0) 推荐(0)
摘要: A Collection of Examples of 64-bit Errors in Real Programs29.06.2010Andrey Karpov Tags: 64-bit -->AbstractIntroductionExample 1. Buffer overflowExample 2. Unnecessary type conversionsExample 3. Incorrect #ifdef'sExample 4. Confusion of int and int*Example 5. Using deprecated (obsolete... 阅读全文
posted @ 2011-12-09 17:52 陈峰 阅读(348) 评论(0) 推荐(0)
摘要: 字符发展1. 美国ASCII-(American standard code information interchange) 美国信息互换标准代码范围:1-127 ; 单字备注:前部用作控制码,0x20以下的字节状态称为"控制码";后面跟数字,字母大小写至1272. 美国ASCII扩展编码范围:128-255; 单字备注:很多画表格时需要用下到的横线、竖线、交叉等形状,一直把序号编到了最后一 个状态2553. 中国GB2312原由:中国人们得到计算机时,有6000多个常用汉字需要保存呢规定:一个小于127的字符的意义与原来相同,但两个大于127的字符连在一起时,就表示一个 阅读全文
posted @ 2011-12-09 13:24 陈峰 阅读(1657) 评论(0) 推荐(0)
摘要: MotivationRecently, I had an old colleague ask me how to regenerate the source code to a DLL. His customer had been using this DLL to extend the capabilities of an application and needed to change the DLL's behavior. His customer, however, was no longer in possession of the source code to this D 阅读全文
posted @ 2011-12-01 13:10 陈峰 阅读(443) 评论(0) 推荐(0)
摘要: When are asynchronous file writes not asynchronous...[转]http://www.lenholgate.com/blog/2008/02/when-are-asynchronous-file-writes-not-asynchronous.htmlFor some time I've had a class which implements asynchronous file writing. It's the basis for a logging class that some of my clients use. The 阅读全文
posted @ 2011-09-14 23:58 陈峰 阅读(215) 评论(0) 推荐(0)
摘要: A Portable, Extensible and Efficient Implementation of Proactor Pattern Alexander Babu Arulanthu, Irfan Pyarali, Douglas C. Schmidt The Proactor pattern (1) describes how to structure applica- tions a... 阅读全文
posted @ 2011-06-28 23:04 陈峰 阅读(360) 评论(0) 推荐(0)
摘要: 最近看了《非金钱激励员工的108种手段》,感觉很好,很受益,要想带好一个团队,首先要自己具备领导才能及专业素质,学习与提高是必不可少的。现把其中的精华摘录一些,与大家分享。# Y3 r8 {( Z6 G/ q 一、榜样激励8 N2 w( C* Z5 h& R) L3 n) K4 ? 为员工树立一根行为标杆; t8 _2 N3 M" O& y: K6 { 在任何一个组织里,管理者都是下属的镜子。可以说,只要看一看这个组织的管理者是如何对待工作的,就可以了解整个组织成员的工作态度。“表不正,不可求直影。”要让员工充满激情地去工作,管理者就先要做出一个样子来。 1、领导是员 阅读全文
posted @ 2011-04-26 21:07 陈峰 阅读(365) 评论(0) 推荐(0)
摘要: 最近在开发项目的过程中遇到这么一个问题,就是在插入一条记录的后立即获取其在数据库中自增的ID,以便处理相关联的数据,怎么做?在sql server 2000中可以这样做,有几种方式。详细请看下面的讲解与对比。一、要获取此ID,最简单的方法就是:(以下举一简单实用的例子)--创建数据库和表create database MyDataBaseuse MyDataBasecreate table mytable(id int identity(1,1),name varchar(20))--执行这个SQL,就能查出来刚插入记录对应的自增列的值insert into mytable values(&# 阅读全文
posted @ 2011-04-02 18:27 陈峰 阅读(197) 评论(0) 推荐(0)
摘要: http://www.serverframework.com/asynchronousevents/2010/10/how-to-support-10000-concurrent-tcp-connections.html Using a modern Windows operating system it's pretty easy to build a server system that can support many thousands of connections if you design the system to use the correct Windows APIs 阅读全文
posted @ 2011-02-22 20:01 陈峰 阅读(258) 评论(0) 推荐(0)
摘要: 转自:http://www.cnblogs.com/jason-jiang/archive/2006/11/03/549337.htmlTCP TIME_WAIT状态关键词: TIME_WAIT SO_REUSEADDR Q: 我正在写一个unix server程序,不是daemon,经常需要在命令行上重启它,绝大 多数时候工作正常,但是某些时候会报告"bind: address in use",于是重启失 败。 A: Andrew Gierth server程序总是应该在调用bind()之前设置SO_REUSEADDR套接字选项。至于 TIME_WAIT状态,你无法避免 阅读全文
posted @ 2011-02-12 14:23 陈峰 阅读(220) 评论(0) 推荐(0)
摘要: 本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/evilswords/archive/2010/09/01/5855572.aspx为何要组包首先一个原因避免读写频率瓶颈:不管百兆还是千兆网卡,消息的收发对通讯io的调用都会产生中断,而这个中断限制了每秒不能无限制的写入/读出,目前网卡抛开系统和cpu瓶颈驱动级的测试瓶颈是60w/s,而笔者所用ace通讯框架在windows平台下按前摄器(proactor)模式封装的测试,读写瓶颈在接近10w/s。假设针对某个socket每秒有300条写入消息(这个数字在广播范围内密集战斗中还属中等要求),那么抛开消息大小来说, 阅读全文
posted @ 2011-02-11 20:44 陈峰 阅读(460) 评论(0) 推荐(0)
摘要: Author: FreeKnightDuzhi转自:http://hi.baidu.com/freedomknightduzhi/blog/item/5e8e7f3df775beff3c6d970d.html家庭所安装的4M,8M宽带。其中M是指,Mbits/S其中要提前说明的是:8bits = 1Byte 即8位等于1字节。我们硬盘大小50G。意思是50*1024M字节,约为 50000多字节。但是网宽是以&#8220;位&#8221;为单位的,所以,8Mbits就是1M字节。是容积体积的单位。8Mbits/s后面的S是秒。8Mbits/s意思是 每秒8M位,即每秒1M字节。 阅读全文
posted @ 2011-02-11 20:43 陈峰 阅读(1837) 评论(0) 推荐(0)
摘要: 转 开源日志库log4cplus+VS2008使用整理 转http://pyhcx.blog.51cto.com/713166/143549 一.简介 log4cplus是C++编写的开源的日志系统,功能非常全面.本文介绍如何在Windows+VS2008中使用该日志库。二.下载 可从网站http://log4cplus.sourceforge.net上去下载 log4cplus 1.0.3 rc9,具体地址http://downloads.sourceforge.net/log4cplus/log4cplus-1.0.3-rc9.tar.bz2?use_mirror=nchc,同时附件也 阅读全文
posted @ 2011-01-20 23:21 陈峰 阅读(1457) 评论(0) 推荐(0)
摘要: Web Farming with theNetwork Load Balancing Servicein Windows Server 2003By Rick Strahlhttp://www.west-wind.com/rstrahl@west-wind.comLast Update: June 4th, 2003 When a single Web Server machine isn’t enough to handle the traffic on your Web site it’s time to look into building a Web Farm that uses mu 阅读全文
posted @ 2011-01-07 17:09 陈峰 阅读(558) 评论(0) 推荐(0)