快过年了

2010年01月18日

不知是不是快过年了,总感觉到有些累。在公司越来越没有什么存在感了,可能和公司现在的工作方式有关吧,我不知道在公司还能做多久。每个人都有自己的价值,群居动物需要向其他个体证明自己的存在,当他体会不到自己的存在的时候,不知他会做何打算。

准备请个年假,带着熊猫回家过年,呵呵,希望能获准。不然老子不干了。

java nio ServerSocketChannel诡异问题。

2009年12月27日

昨天遇到个离奇问题,服务器连接不管怎么调,总是只能接受一条连接。

解决方法代码。

int acceptNum = serverSelector.selectNow() ;
if(acceptNum != 0)
{
Set<SelectionKey> keys = serverSelector.selectedKeys() ;
Iterator<SelectionKey> iter = keys.iterator();
while (iter.hasNext())
{
SelectionKey key = iter.next();
acceptOption( key ) ;
iter.remove() ;
}
}

关键的是这行代码iter.remove() ;

美域名注册商GoDaddy宣布将支持支付宝

2009年12月13日

转自新浪科技

新浪科技讯 北京时间12月13日下午消息,美国域名注册公司GoDaddy昨日宣布,将支付中国用户通过支付宝购买GoDaddy域名和主机。

此前中国用户要在GoDaddy注册域名或者购买主机,只能使用信用卡,通过PayPal也需要用信用卡进行验证,这给中国大陆用户带来了诸多不便。

GoDaddy发表声明称,亚洲拥有数量巨大的人口,拥有全球将近43%的网民。但信用卡和PayPal在亚洲市场的使用范围不广,这给亚洲消 费者购买GoDaddy服务带来了困难。GoDaddy表示,公司即将开始支付支付宝服务。IP地址在中国大陆和香港的用户将可以在支付选择中看到支付宝 的选项。

Godaddy是世界最大的域名注册商,成立于1997年,是全球域名注册排名第一的域名服务商,全球市场占有率达18%。经由Godaddy注册的域名数量已经超过2300万。

星海传奇——星系动态分区管理设计概要——动态地图

2009年12月13日

一个星系理论上可以容纳无限玩家,那么星系内的管理将是个挑战。

普通webgame,大多采取的是分场景的做法来避免广播的浪费。

在得到解决方案之前,本人也做过分场景的设计,在否决后有做了以玩家为分区的中心的设计,仍然否决,最后决定以坐标段为一个基本管理区的设计来实现动态地图。

描述:

将用户的当前区域坐标(x,y)进行处理,得到用户所在的管理区。uint a=x/z , uint b=y/z。将a,b连接,得到用户所在的管理区键,将用户存储到管理区。当用户发生动作的时候,只需要取得所在管理区和相邻的管理区广播消息即可。

星海传奇——服务端工作内容。

2009年12月13日

服务端的总体设计工作基本完成,剩下的内容将不断的在实现中完善。

部署:

1.网关:gateway

2.登录:login

3.管理:manager

4.运行:runner

5.数据:data

阅读这个条目剩下部分 »

epoll使用

2009年12月11日

转自csdn

名词解释:man epoll之后,得到如下结果:

NAME
epoll – I/O event notification facility

SYNOPSIS
#include <sys/epoll.h>

DESCRIPTION
epoll is a variant of poll(2) that can be used either as Edge or Level
Triggered interface and scales well to large numbers of  watched  fds.
Three  system  calls  are provided to set up and control an epoll set:
epoll_create(2), epoll_ctl(2), epoll_wait(2).

An epoll set is connected to a file descriptor created  by  epoll_cre-
ate(2).   Interest for certain file descriptors is then registered via
epoll_ctl(2).  Finally, the actual wait is started by epoll_wait(2).

阅读这个条目剩下部分 »

boost 中文翻译项目

2009年12月11日

http://groups.google.com/group/boost_doc_translation

http://code.google.com/p/boost-doc-zh/

C++ string转int

2009年12月11日

1:

#include <iostream>
#include <string>
using namespace std;

int main()
{
string str=”123456″;
int i;
char buf[10];

strcpy(buf,str.c_str());
sscanf(buf,”%d”,&i);

cout<<”i :”<<i<<endl;
return 0;
}

阅读这个条目剩下部分 »

C++ int转string

2009年12月11日

1.   int sprintf( char *buffer, const char *format [, argument] … );
<stdio.h>
例如:
int ss;
char temp[64];
string str;
ss = 1000;
sprintf(temp, “%d”, ss);
string s(temp);
//调用string的方法
cout<<s.c_str()<<endl;//1000
cout<<s.size()<<endl;  //长度为4
阅读这个条目剩下部分 »

Linux下C时间函数

2009年12月9日

日期时间篇
asctime
ctime
gettimeofday
gmtime
localtime
mktime
settimeofday
time

阅读这个条目剩下部分 »