自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(59)
  • 收藏
  • 关注

原创 用Cpp11新template feature尝试metaprogramming

Cplusplus 11 发布大半年了, 基本上浏览了一遍wiki pedia上关于新feature的介绍, 个别feature已经迅速被大家广泛运用了, 剩下的由于编译器的支持问题未敢大肆使用。由于 新标准在core language中就提供了以前要一堆template才能实现的feature以及std lib中把boost的一些container搬字过纸,所以熟悉boost的人可能一看介绍马上

2012-06-06 15:59:51 935

原创 tips to include tcmalloc

vim /etc/ld.so.conf ldconfig -v-ltcmalloc

2012-02-02 22:53:41 639

原创 读完了the practice of programming

the practice of programming是第二本读完的英文原版技术书籍,很多内容早已了解,抱着锻炼英语阅读能力和顺便回顾一下一些技术知识的心态读吧,利用下班的空当,不到两个星期读完,发现自己在调试方面的观点跟作者非常相像,都更喜欢深入看代码并且打印信息,最后才是一步一步跟着debugger step through程序,最后关于notation的阐述还算小有得益,好吧,下一本是看雪的

2011-12-11 17:55:51 731

原创 日本人的技术书

最近看了两本日本人写的技术书籍,大致感受就是严谨加谦虚,第一本是debug hacks,主要讨论linux平台的调试技术,第二本是大规模web服务开发,全面讨论了一下web系统的构建,都不算太深入,但能起启迪作用,我觉得这才是最重要的,说不算太深入是没有像工具使用说明书一样一步一步介绍具体操作和各种陷阱,这真没太大必要,所以我还挺喜欢这种写法的技术书籍。

2011-12-03 23:06:23 6882

原创 Pattern Hatching讲了什么

两三天内读完PatternHatching小册子,有点小幸福。 从一个文件系统设计开始讲,使用composite建立树状模型,使用proxy处理连接,访问方式上用了visitor,文件保护上用了template method,多用户保护上用了扩展的singleton,组映射上用了mediator,真有点小壮观,如同all stars game一样让人兴奋。 接着作者又八了八sing

2011-11-11 16:24:02 793

原创 六大OO设计原则

套用各种DP写一个系统,跑起来了,但后来发现真有变化来临的时候想扩展还得大规模改动甚至重写,这就是传说中的DP乱套了,达不到效果反而徒增工作量,内心惭愧,于是细读OO大师的设计信条,才慢慢明晓DP要怎么样实作才能真正达到效果,记下六大原则原文,肃清乱套之风,以作警戒。Si

2011-09-16 22:17:17 768

原创 Gauss-Jordan elimination

I suppose you know what Gauss-Jordan elimination is, so the note here was just simply tell you why it can work.As you know that, if I

2011-09-12 20:33:32 1156

原创 Ring a Bell : Three Sort Algorithms

The detail contents of how to code and how it works just lie in the book written by Simon Harris and James Ross, want to know more? so check

2011-08-31 18:03:32 483

原创 性能改造小记

一条专用线程负责接受连接,把新接收到的socket通知线程池,线程池派其中一条线程处理该连接,当接收连接数量超过最大线程数时不再接收新连接,直到线程池有成员空闲下来了再次通知专用线程进行接收连接,线程池中的线程皆是处理完业务立即关闭socket,认为是短连接,这里的业务暂时实现为

2011-08-30 23:54:04 548

原创 Substitution Failure Is Not An Error

SFINAE原则初看是刺激的,写好之后是高效的,写错了就是既折磨编译器又折磨自己的。各种编译器对模板的支持程度又是不一样的,对待代码要有屈机精神,不然就只好向言不由衷的错误信息投降了。先旨声明,调试这里的代码用vc2008会顺利很多,template就是把编译器的功能发挥

2011-08-25 23:43:49 840

原创 模板强化Template Method & Singleton 模式

阅读之前期望你已经懂得模板方法模式及单例模式的原理。通俗软件设计模式的表述呈现由GoF先行打响头炮,其后各种版本的模式书籍层出不穷,大多示范实现都是以有多态特性的虚函数作为核心,每一个virtual function call是间接进行的,如此一来性能会有小小的损耗,但可读性良好

2011-08-25 12:00:38 565

原创 模板强化RAII

RAII的应用在C++这种高危语言中尤其重要,结合模板,效果更爽。先看应用:#include "stdafx.h"using namespace Loki;void myFree(char* s){ if (s != NULL) {  free(s

2011-08-24 17:59:13 596

原创 实现无需OO机制的观察者(性能至上)

模式大部分实现利用的是编程语言的继承多态等机制,以面向接口编程优先使用组合等等原则为实作的依归,把系统高内聚低耦合地划分了许多相对独立的类来实现拼装,模式套用多了难免出现很多类及各种子类,但却很大程度从结构上让系统的可维护性增强了,一般来说现在很多公司的OO系统就是这样做出来的。

2011-08-21 15:53:11 792

原创 boost:tuple解码

tuple想必人人都会用,究之实质,其实就是模板全特化及部分特化的又一种应用而已。简要的实现如下: template struct Tuple {  Tuple(){}  Tuple(typename traits::type_traits::const_reference a,   typename traits::type_traits::const_refer

2011-08-20 00:37:18 886

原创 linux app 无 core dump 退出的处理

1,首先要淡定。2,在程序退出之后马上echo $?,获得返回数字R。3,计算信号码和退出码: R & 0x7f = signal_no (R & 0xff00) >> 8 = exit_no4,这时就知道程序何故退出了。至于我的状况,就是没有处理SIGP

2011-08-16 17:55:10 989

原创 Tips to Handle Linux APPs Crack Shit

Problem 1: linux应用程序段错误挺常见,得淡定。一般处理手法:Solution:1.编译时加入标志-g。2.设置core文件大小。 struct rlimit res = { .rlim_cur = RLIM_INFINITY, .rlim_max

2011-08-15 11:39:05 660

原创 C++ traits两种用途

C++ traits两种用途1. 利用编译器为自己约束程序行为。//拒绝使用double的traits,完全特化templatestruct type_restrict{ enum{value};};templatestruct type_re

2011-08-15 09:49:03 811

原创 Thread-Specific Storage

This article told the last pattern illustrated in POSA2 - Thread Specific Storage, which is such a common mechanism provided by some  operat

2011-07-30 13:51:33 1065

原创 Leader/Followers

This article outlined a global view of the Leader/Followers pattern  in POSA2 as my reading note.The Leader/Followers architectural patter

2011-07-30 13:06:28 1078

原创 Half-Sync/Half-Async

This article makes a brief introduction of the Half-Sync/Half-Async pattern from POSA2 as my reading note.The Half-Sync/Half-Async archite

2011-07-30 12:05:12 1288

原创 Monitor Object

This article is extracted from POSA2 as a reading note.The Monitor Object design pattern synchronizes concurrent method execution to ensur

2011-07-30 10:21:40 1490

原创 Active Object

This article is extracted from POSA2 as a reading note.The Active Object design pattern decouples method execution from method invocation

2011-07-30 09:40:04 665

原创 Double Checked Locking Optimization

This article is extracted from POSA2 as a reading note.I recall that I read an article argued about whether DCL is truely safe sometime. The

2011-07-26 18:18:42 535

原创 Thread-Safe Interface

This article is extracted from POSA2 as a reading note.This pattern is really a shock for me. I met it in some projects before but I cannot

2011-07-26 15:20:50 619

原创 Strategized Locking

This article is extracted from POSA2 as a reading note.Strategized Locking is another pattern I was very familiar with through working with

2011-07-26 11:03:23 679

原创 Scoped Locking

This article is extracted from POSA2 as a reading note.Scoped Locking is a pattern? I can't answer well until I read the associated portion

2011-07-25 18:06:22 829 1

原创 Acceptor-Connector

This article is extracted from POSA2 as a reading note.Superserver implementations, for example Inetd, Listen, and the Service Configurator

2011-07-25 15:58:39 1454

原创 Asynchronous Completion Token

This article is extracted from POSA2 as my reading note.See a familiar scene that all people experienced now and then: HTTP Cokkies. Web ser

2011-07-20 12:06:33 1014

原创 Proactor

This article is extracted from POSA2 as my reading note. The Proactor architectural pattern allows event-driven applications to efficiently

2011-07-10 21:31:23 597

原创 3D游戏部分基础数学知识整理笔记2

1.叉积,u*v=|u|*|v|*sin(a)*n,n是单位法线向量,与u和v都垂直。2.虚数,i=sqrt(-1), i*i=-1。3.复数是一个实数与虚数的和。z=(a+b*i)4.四元数是超复数。从数学上说,术语超复数可以指任何东西,但通常指有多个虚部的

2011-07-04 10:03:17 415

原创 Reactor

This article told a brief introduction of reactor illustrated in POSA2, so there are more you want to know, refer to POSA2.The Reactor architectural pattern allows event-driven applications to dem

2011-07-01 00:14:00 542

原创 Extension Interface

All contents are extracted from POSA2.  The Extension Interface design pattern allows multiple interfaces to be exported by a component, to prevent bloating of interfaces and breaking of client co

2011-06-26 23:48:00 667

原创 Summary of interceptor introduced in POSA2

This pattern allows services to be added transparently to a framework and triggered automatically when certain events occur.  Concrete Framework : A concrete framework instantiates a generic and e

2011-06-21 15:04:00 421

原创 Reading Response of Component Configurator in POSA2

Refer to POSA2 for any details. This article is a simple review with some records that give me brain storming in the book. The Component Configurable design pattern also known as Service Configura

2011-06-19 10:05:00 445

原创 Weird Events

Q1: (surrendered) istream::gcount() can not work?A1: Now I apply strlen() function to the read-buffer instead of invocation to gcount() as a temporary alternative.I should overview and debug the STL a

2011-06-15 17:16:00 516

原创 Review of Wrapper Facade in POSA2

Facade is a pattern which was referred to in so many books or articles. Here is a simple review of facade in POSA2, in which facade is called wrapper facade. For more details, refer to POSA2. They

2011-06-13 23:42:00 552

原创 WaitForMultipleObjects啊!

WaitForMultipleObjects等待多个线程的结束信号,无效,必须循环调用WaitForSingleObject,经过bing(最近毫无理由地支持bing)搜寻,总结了两个小细节如下: 1、_beginthread出来的线程完成后自动调用的_endthread会执行CloseHandle把线程handle干掉,而_beginthreadex不会。2、WaitForMulti

2011-06-09 11:02:00 1100

原创 无痛运行OGRE和CEGUI中的例子

OGRE:1、下载OgreSDK_vc9_v1-7-22、用现成的sln编译3、编译完成后另开一个vs新建一个win32项目4、贴上wiki基础教程的一小段代码5、遇到各种依赖库问题,在工具/选项/项目和解决方案/VC++目录下设置6、调试工作目录设为[ogrehome]/bin/debug7、字符集设为多字节8、完成 CEGUI:1、下载CEGUI-S

2011-06-05 18:53:00 1635 1

原创 3D游戏部分基础数学知识整理笔记1

<br />详细内容参看《3D游戏编程大师技巧》或更专业的数学书籍。<br />1.很多图形算法都以这样的方式进行优化:在第一象限中解决问题,根据对称性将解决方案反射到其他象限。<br />2.2D笛卡尔坐标(Cartesian Coordinates)用(x,y)形式标示一个点,2D极坐标(polar coordinates)用(距离,角度)形式标示一个点。<br />3.2D极坐标转为2D笛卡尔坐标,x=距离*cos(角度),y=距离*sin(角度)。<br />4.2D笛卡尔坐标转为2D极坐标,距离=

2011-06-01 18:34:00 1066

原创 My Class for Directory Operation

You can use it in any way, but the author name should always be there.It's nice to leave your suggestions.//author: huanghaifeng#include #include #include #include #include #include #include #include class CDir{ public: enum E

2011-05-30 11:54:00 709

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除